本文整理汇总了PHP中CAdminList::addHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP CAdminList::addHeaders方法的具体用法?PHP CAdminList::addHeaders怎么用?PHP CAdminList::addHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAdminList
的用法示例。
在下文中一共展示了CAdminList::addHeaders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LocalRedirect
if ($request->getQuery('GROUP_ID')) {
$varsGroup = new UserVars\VarsGroup();
$dataGroup = $varsGroup->findOneById($request->getQuery('GROUP_ID'))->fetch();
}
if (!isset($dataGroup) || empty($dataGroup)) {
LocalRedirect(sprintf('user_vars.php?lang=%s', LANGUAGE_ID));
}
$includePath = array('prolog' => '/bitrix/modules/main/include/prolog_admin_after.php', 'prolog_js' => '/bitrix/modules/main/include/prolog_admin_js.php', 'epilog' => '/bitrix/modules/main/include/epilog_admin.php', 'epilog_js' => '/bitrix/modules/main/include/epilog_admin_js.php');
$contextMenu[] = array('TEXT' => Loc::getMessage('USER_VARS_ADD'), 'TITLE' => Loc::getMessage('USER_VARS_ADD'), 'LINK' => 'user_vars_edit.php?GROUP_ID=' . $dataGroup['ID'] . '&lang=' . LANGUAGE_ID, 'ICON' => 'btn_new');
$contextMenu[] = array('TEXT' => Loc::getMessage('USER_VARS_EDIT_GROUP'), 'TITLE' => Loc::getMessage('USER_VARS_EDIT_GROUP'), 'LINK' => 'user_vars_group_edit.php?ID=' . $dataGroup['ID'] . '&lang=' . LANGUAGE_ID, 'ICON' => 'btn_edit');
$varsMap = Model\VarsTable::getMap();
$headers = array(array('id' => 'ID', 'content' => 'ID', 'sort' => 'ID', 'default' => true), array('id' => 'NAME', 'content' => $varsMap['NAME']['title'], 'sort' => 'NAME', 'default' => true), array('id' => 'CODE', 'content' => $varsMap['CODE']['title'], 'sort' => 'CODE', 'default' => true), array('id' => 'VALUE', 'content' => $varsMap['VALUE']['title'], 'sort' => 'VALUE', 'default' => true), array('id' => 'DESCRIPTION', 'content' => $varsMap['DESCRIPTION']['title'], 'sort' => 'DESCRIPTION', 'default' => true));
$tableId = 'tbl_user_vars_list';
$adminSort = new CAdminSorting($tableId, 'NAME', 'asc');
$adminList = new CAdminList($tableId, $adminSort);
$adminList->addHeaders($headers);
if ($request->getQuery('mode') != 'list') {
$context = new CAdminContextMenu($contextMenu);
}
$queryBuilder = new Entity\Query(Model\VarsTable::getEntity());
$queryBuilder->setSelect(array('ID', 'NAME', 'CODE', 'DESCRIPTION', 'VALUE'))->setFilter(array('GROUP_ID' => $dataGroup['ID']));
$sortBy = $request->getQuery('by') ? strtoupper($request->getQuery('by')) : 'ID';
$sortOrder = $request->getQuery('order') ?: 'asc';
$queryBuilder->setOrder(array($sortBy => $sortOrder));
$resultData = new CAdminResult($queryBuilder->exec(), $tableId);
$resultData->navStart();
$adminList->navText($resultData->getNavPrint(Loc::getMessage('PAGES')));
while ($item = $resultData->fetch()) {
$row = $adminList->addRow($item['ID'], $item);
$actions = array();
$actions[] = array('ICON' => 'edit', 'TEXT' => Loc::GetMessage('USER_VARS_ACTION_EDIT_VAR'), 'ACTION' => $adminList->actionRedirect('user_vars_edit.php?ID=' . $item['ID'] . '&GROUP_ID=' . $dataGroup['ID']));
示例2: array
} else {
$arActiveTests[$abtest['SITE_ID']] = $abtest;
}
}
}
break;
case 'stop':
if (!Bitrix\ABTest\Helper::stopTest($ID)) {
$lAdmin->addGroupError(getMessage('ABTEST_STOP_ERROR'));
}
break;
}
}
}
$arHeaders = array(array('id' => 'TITLE', 'content' => getMessage('ABTEST_TBL_HEADER_TITLE'), 'default' => true, 'sort' => 'name'), array('id' => 'ACTIVE', 'content' => getMessage('ABTEST_TBL_HEADER_STATE'), 'default' => true, 'sort' => 'active'));
$lAdmin->addHeaders($arHeaders);
$result = Bitrix\ABTest\ABTestTable::getList(array('order' => array(strtoupper($by) => $order), 'select' => array('*', 'USER_NAME' => 'USER.NAME', 'USER_LAST_NAME' => 'USER.LAST_NAME', 'USER_SECOND_NAME' => 'USER.SECOND_NAME', 'USER_TITLE' => 'USER.TITLE', 'USER_LOGIN' => 'USER.LOGIN')));
$result = new CAdminResult($result, $sTableID);
$arRows = array();
$arActiveTests = array();
while ($abtest = $result->fetch()) {
$arRows[] = $abtest;
if ($abtest['ACTIVE'] == 'Y') {
if (!isset($arActiveTests[$abtest['SITE_ID']])) {
$arActiveTests[$abtest['SITE_ID']] = array();
}
$arActiveTests[$abtest['SITE_ID']][] = $abtest['ID'];
}
}
foreach ($arRows as &$abtest) {
$row =& $lAdmin->addRow($abtest['ID'], $abtest);