From 6535c1738ecb25a4a45f65a0264ee64d79d7738f Mon Sep 17 00:00:00 2001 From: s-sementsov Date: Wed, 16 Dec 2015 17:54:01 +0300 Subject: [PATCH 1/4] Update IblockElementWidget.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Поправил вывод ссылки на элемент инфоблока --- lib/widget/IblockElementWidget.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/widget/IblockElementWidget.php b/lib/widget/IblockElementWidget.php index 9bdaa71..5f207d8 100644 --- a/lib/widget/IblockElementWidget.php +++ b/lib/widget/IblockElementWidget.php @@ -85,7 +85,19 @@ public function getValueReadonly() if (!empty($elementId)) { $rsElement = ElementTable::getById($elementId); $element = $rsElement->fetch(); - + + $rsIblock = IblockTable::getList([ + 'filter' => [ + 'ID' => $element['IBLOCK_ID'] + ], + 'select' => [ + 'IBLOCK_TYPE_ID' + ] + ]); + + $iblock = $rsIblock->fetch(); + $element['IBLOCK_TYPE_ID'] = $iblock['IBLOCK_TYPE_ID']; + return '[' . $elementId . '] ' . static::prepareToOutput($element['NAME']) . ''; @@ -102,7 +114,19 @@ public function generateRow(&$row, $data) if (!empty($elementId)) { $rsElement = ElementTable::getById($elementId); $element = $rsElement->fetch(); - + + $rsIblock = IblockTable::getList([ + 'filter' => [ + 'ID' => $element['IBLOCK_ID'] + ], + 'select' => [ + 'IBLOCK_TYPE_ID' + ] + ]); + + $iblock = $rsIblock->fetch(); + $element['IBLOCK_TYPE_ID'] = $iblock['IBLOCK_TYPE_ID']; + $html = '[' . $elementId . '] ' . static::prepareToOutput($element['NAME']) . ''; @@ -112,4 +136,4 @@ public function generateRow(&$row, $data) $row->AddViewField($this->getCode(), $html); } -} \ No newline at end of file +} From f4e2b90593b1597aea294a0094514b41ba758dcc Mon Sep 17 00:00:00 2001 From: s-sementsov Date: Wed, 16 Dec 2015 18:01:40 +0300 Subject: [PATCH 2/4] Update IblockElementWidget.php --- lib/widget/IblockElementWidget.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/widget/IblockElementWidget.php b/lib/widget/IblockElementWidget.php index 5f207d8..2242b49 100644 --- a/lib/widget/IblockElementWidget.php +++ b/lib/widget/IblockElementWidget.php @@ -2,6 +2,7 @@ namespace DigitalWand\AdminHelper\Widget; +use Bitrix\Iblock\IblockTable; use Bitrix\Iblock\ElementTable; use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; From aaed1c5e9f1f07cb0e9d1c3663d34d7b4e947a03 Mon Sep 17 00:00:00 2001 From: s-sementsov Date: Wed, 16 Dec 2015 18:46:14 +0300 Subject: [PATCH 3/4] Update IblockElementWidget.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Сделал через IBLOCK.IBLOCK_TYPE_ID --- lib/widget/IblockElementWidget.php | 37 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/lib/widget/IblockElementWidget.php b/lib/widget/IblockElementWidget.php index 2242b49..7948c98 100644 --- a/lib/widget/IblockElementWidget.php +++ b/lib/widget/IblockElementWidget.php @@ -2,7 +2,6 @@ namespace DigitalWand\AdminHelper\Widget; -use Bitrix\Iblock\IblockTable; use Bitrix\Iblock\ElementTable; use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; @@ -84,23 +83,22 @@ public function getValueReadonly() $elementId = $this->getValue(); if (!empty($elementId)) { - $rsElement = ElementTable::getById($elementId); - $element = $rsElement->fetch(); - - $rsIblock = IblockTable::getList([ + $rsElement = ElementTable::getList([ 'filter' => [ - 'ID' => $element['IBLOCK_ID'] + 'ID' => $elementId ], 'select' => [ - 'IBLOCK_TYPE_ID' + 'ID', + 'NAME', + 'IBLOCK_ID', + 'IBLOCK.IBLOCK_TYPE_ID', ] ]); - $iblock = $rsIblock->fetch(); - $element['IBLOCK_TYPE_ID'] = $iblock['IBLOCK_TYPE_ID']; + $element = $rsElement->fetch(); return '[' . $elementId . '] ' . static::prepareToOutput($element['NAME']) . ''; } } @@ -113,23 +111,22 @@ public function generateRow(&$row, $data) $elementId = $this->getValue(); if (!empty($elementId)) { - $rsElement = ElementTable::getById($elementId); - $element = $rsElement->fetch(); - - $rsIblock = IblockTable::getList([ + $rsElement = ElementTable::getList([ 'filter' => [ - 'ID' => $element['IBLOCK_ID'] + 'ID' => $elementId ], 'select' => [ - 'IBLOCK_TYPE_ID' + 'ID', + 'NAME', + 'IBLOCK_ID', + 'IBLOCK.IBLOCK_TYPE_ID', ] ]); - - $iblock = $rsIblock->fetch(); - $element['IBLOCK_TYPE_ID'] = $iblock['IBLOCK_TYPE_ID']; + + $element = $rsElement->fetch(); $html = '[' . $elementId . '] ' . static::prepareToOutput($element['NAME']) . ''; } else { $html = ''; From d67d413c4f312fd29448686c078f48685dced0d9 Mon Sep 17 00:00:00 2001 From: s-sementsov Date: Fri, 18 Dec 2015 17:36:11 +0300 Subject: [PATCH 4/4] fix remove action, action_button --- lib/helper/AdminListHelper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/helper/AdminListHelper.php b/lib/helper/AdminListHelper.php index 41d0a59..4370e3f 100644 --- a/lib/helper/AdminListHelper.php +++ b/lib/helper/AdminListHelper.php @@ -222,7 +222,8 @@ public function __construct(array $fields, $isPopup = false) $filteredIDs[] = IntVal($id); } $this->groupActions($IDs, $_REQUEST['action']); - }elseif (isset($_REQUEST['action']) || isset($_REQUEST['action_button']) && count($this->getErrors()) == 0 ) { + } + if (isset($_REQUEST['action']) || isset($_REQUEST['action_button']) && count($this->getErrors()) == 0 ) { $listHelperClass = $this->getHelperClass(AdminListHelper::className()); $className = $listHelperClass::getModel(); $id = isset($_GET['ID']) ? $_GET['ID'] : null; @@ -1377,4 +1378,4 @@ public static function getUrl(array $params = array()) { return static::getViewURL(static::getViewName(), static::$listPageUrl, $params); } -} \ No newline at end of file +}