本文整理汇总了PHP中CAdminList::addGroupError方法的典型用法代码示例。如果您正苦于以下问题:PHP CAdminList::addGroupError方法的具体用法?PHP CAdminList::addGroupError怎么用?PHP CAdminList::addGroupError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAdminList
的用法示例。
在下文中一共展示了CAdminList::addGroupError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$arActiveTests[$abtest['SITE_ID']][] = $abtest['ID'];
}
}
foreach ($arID as $ID) {
$ID = intval($ID);
if ($ID <= 0) {
continue;
}
$abtest = Bitrix\ABTest\ABTestTable::getById($ID)->fetch();
if (empty($abtest)) {
continue;
}
switch ($_REQUEST['action']) {
case 'delete':
if (!Bitrix\ABTest\Helper::deleteTest($ID)) {
$lAdmin->addGroupError(getMessage('ABTEST_DELETE_ERROR'));
}
break;
case 'start':
if (!empty($arActiveTests[$abtest['SITE_ID']])) {
if (in_array($ID, $arActiveTests[$abtest['SITE_ID']])) {
$lAdmin->addGroupError(getMessage('ABTEST_START_ERROR'));
} else {
$lAdmin->addGroupError(getMessage('ABTEST_ONLYONE_WARNING'));
}
} else {
if ($abtest['ENABLED'] != 'Y') {
$lAdmin->addGroupError(getMessage('ABTEST_START_ERROR'));
} else {
if (!Bitrix\ABTest\Helper::startTest($ID)) {
$lAdmin->addGroupError(getMessage('ABTEST_START_ERROR'));
示例2: buildList
//.........这里部分代码省略.........
$visibleColumns = array_values($visibleColumns);
$visibleColumns = array_merge($visibleColumns, array_keys($this->tableColumnsMap));
}
$className = static::getModel();
$visibleColumns[] = static::pk();
$sectionsVisibleColumns[] = static::sectionPk();
$raw = array('SELECT' => $visibleColumns, 'FILTER' => $this->arFilter, 'SORT' => $sort);
foreach ($this->fields as $name => $settings) {
if (isset($settings['VIRTUAL']) and $settings['VIRTUAL'] == true) {
$key = array_search($name, $visibleColumns);
unset($visibleColumns[$key]);
unset($this->arFilter[$name]);
unset($sort[$name]);
}
if (isset($settings['FORCE_SELECT']) and $settings['FORCE_SELECT'] == true) {
$visibleColumns[] = $name;
}
}
$visibleColumns = array_unique($visibleColumns);
$sectionsVisibleColumns = array_unique($sectionsVisibleColumns);
// Поля для селекта (перевернутый массив)
$listSelect = array_flip($visibleColumns);
foreach ($this->fields as $code => $settings) {
$widget = $this->createWidgetForField($code);
$widget->changeGetListOptions($this->arFilter, $visibleColumns, $sort, $raw);
// Множественные поля не должны быть в селекте
if (!empty($settings['MULTIPLE'])) {
unset($listSelect[$code]);
}
}
// Поля для селекта (множественные поля отфильтрованы)
$listSelect = array_flip($listSelect);
if ($sectionEditHelper) {
$mixedData = $this->getMixedData($sectionsVisibleColumns, $visibleColumns, $sort, $raw);
$res = new \CDbResult();
$res->InitFromArray($mixedData);
$res = new \CAdminResult($res, $this->getListTableID());
$res->nSelectedCount = $this->totalRowsCount;
// используем кастомный NavStart что бы определить правильное количество страниц и элементов в списке
$this->customNavStart($res);
$this->list->NavText($res->GetNavPrint(Loc::getMessage("PAGES")));
while ($data = $res->NavNext(false)) {
$this->modifyRowData($data);
if ($data['IS_SECTION']) {
list($link, $name) = $this->getRow($data, $this->getHelperClass(AdminSectionEditHelper::className()));
$row = $this->list->AddRow('s' . $data[$this->pk()], $data, $link, $name);
foreach ($this->sectionFields as $code => $settings) {
if (in_array($code, $sectionsVisibleColumns)) {
$this->addRowSectionCell($row, $code, $data);
}
}
$row->AddActions($this->getRowActions($data, true));
} else {
$this->modifyRowData($data);
list($link, $name) = $this->getRow($data);
// объединение полей элемента с полями раздела
foreach ($this->tableColumnsMap as $elementCode => $sectionCode) {
if (isset($data[$elementCode])) {
$data[$sectionCode] = $data[$elementCode];
}
}
$row = $this->list->AddRow($data[$this->pk()], $data, $link, $name);
foreach ($this->fields as $code => $settings) {
$this->addRowCell($row, $code, $data, isset($this->tableColumnsMap[$code]) ? $this->tableColumnsMap[$code] : false);
}
$row->AddActions($this->getRowActions($data));
}
}
} else {
$res = $this->getData($className, $this->arFilter, $listSelect, $sort, $raw);
$res = new \CAdminResult($res, $this->getListTableID());
$res->NavStart();
$this->list->NavText($res->GetNavPrint(Loc::getMessage("PAGES")));
while ($data = $res->NavNext(false)) {
$this->modifyRowData($data);
list($link, $name) = $this->getRow($data);
$row = $this->list->AddRow($data[$this->pk()], $data, $link, $name);
foreach ($this->fields as $code => $settings) {
$this->addRowCell($row, $code, $data);
}
$row->AddActions($this->getRowActions($data));
}
}
$this->list->AddFooter($this->getFooter($res));
$this->list->AddGroupActionTable($this->getGroupActions(), $this->groupActionsParams);
$this->list->AddAdminContextMenu($this->getContextMenu());
$this->list->BeginPrologContent();
echo $this->prologHtml;
$this->list->EndPrologContent();
$this->list->BeginEpilogContent();
echo $this->epilogHtml;
$this->list->EndEpilogContent();
// добавляем ошибки в CAdminList для режимов list и frame
if (in_array($_GET['mode'], array('list', 'frame')) && is_array($this->getErrors())) {
foreach ($this->getErrors() as $error) {
$this->list->addGroupError($error);
}
}
$this->list->CheckListMode();
}