Skip to content

Commit

Permalink
Merge pull request #11 from s-sementsov/2.x
Browse files Browse the repository at this point in the history
Update IblockElementWidget.php
  • Loading branch information
niksamokhvalov committed Jan 7, 2016
2 parents 7b96205 + d67d413 commit 55c8524
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
5 changes: 3 additions & 2 deletions lib/helper/AdminListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1377,4 +1378,4 @@ public static function getUrl(array $params = array())
{
return static::getViewURL(static::getViewName(), static::$listPageUrl, $params);
}
}
}
36 changes: 29 additions & 7 deletions lib/widget/IblockElementWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,22 @@ public function getValueReadonly()
$elementId = $this->getValue();

if (!empty($elementId)) {
$rsElement = ElementTable::getById($elementId);
$element = $rsElement->fetch();
$rsElement = ElementTable::getList([
'filter' => [
'ID' => $elementId
],
'select' => [
'ID',
'NAME',
'IBLOCK_ID',
'IBLOCK.IBLOCK_TYPE_ID',
]
]);

$element = $rsElement->fetch();

return '<a href="/bitrix/admin/iblock_element_edit.php?IBLOCK_ID=' . $element['IBLOCK_ID']
. '&type=' . $element['IBLOCK_TYPE_ID'] . '&ID='
. '&type=' . $element['IBLOCK_ELEMENT_IBLOCK_IBLOCK_TYPE_ID'] . '&ID='
. $elementId . '&lang=ru">[' . $elementId . '] ' . static::prepareToOutput($element['NAME']) . '</a>';
}
}
Expand All @@ -100,16 +111,27 @@ public function generateRow(&$row, $data)
$elementId = $this->getValue();

if (!empty($elementId)) {
$rsElement = ElementTable::getById($elementId);
$rsElement = ElementTable::getList([
'filter' => [
'ID' => $elementId
],
'select' => [
'ID',
'NAME',
'IBLOCK_ID',
'IBLOCK.IBLOCK_TYPE_ID',
]
]);

$element = $rsElement->fetch();

$html = '<a href="/bitrix/admin/iblock_element_edit.php?IBLOCK_ID=' . $element['IBLOCK_ID']
. '&type=' . $element['IBLOCK_TYPE_ID'] . '&ID='
. '&type=' . $element['IBLOCK_ELEMENT_IBLOCK_IBLOCK_TYPE_ID'] . '&ID='
. $elementId . '&lang=ru">[' . $elementId . '] ' . static::prepareToOutput($element['NAME']) . '</a>';
} else {
$html = '';
}

$row->AddViewField($this->getCode(), $html);
}
}
}

0 comments on commit 55c8524

Please sign in to comment.