當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CAdminList::addHeaders方法代碼示例

本文整理匯總了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']));
開發者ID:ASDAFF,項目名稱:citfact.uservars,代碼行數:31,代碼來源:user_vars_list.php

示例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);
開發者ID:Satariall,項目名稱:izurit,代碼行數:31,代碼來源:abtest_admin.php


注:本文中的CAdminList::addHeaders方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。