/** * Executes the query * * @param string $filterField * @param mixed $filterFieldValue * @param string $method * * @return \Bitrix\Main\DB\MysqlResult */ private function execute($filterField, $filterFieldValue, $method) { $queryBuilder = new Entity\Query(Model\VarsTable::getEntity()); $queryBuilder->setSelect(array('ID', 'NAME', 'CODE', 'DESCRIPTION', 'GROUP_ID', 'VALUE'))->setOrder(array('ID' => 'ASC'))->setFilter(array($filterField => $filterFieldValue)); if ($method == 'findOneBy') { $queryBuilder->setLimit(1); } return $queryBuilder->exec(); }
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'])); $actions[] = array('ICON' => 'delete', 'TEXT' => Loc::getMessage('USER_VARS_ACTION_DELETE_VAR'), 'ACTION' => "if(confirm('" . Loc::getMessage('USER_VARS_DELETE_VAR_CONFIRM') . "')) " . $adminList->actionRedirect('user_vars_edit.php?action=delete&ID=' . $item['ID'] . '&GROUP_ID=' . $dataGroup['ID'] . '&' . bitrix_sessid_get())); $row->addActions($actions); } $prologType = $request->getQuery('mode') == 'list' ? 'prolog_js' : 'prolog';
<input type="hidden" name="GROUP_ID" value="<?php echo $dataGroup['ID']; ?> "> <input type="hidden" name="lang" value="<?php echo LANGUAGE_ID; ?> "> <?php echo bitrix_sessid_post(); ?> <? $tabControl->begin(); $tabControl->beginNextTab(); $varMap = Model\VarsTable::getMap(); ?> <tr> <td width="40%"><strong><?php echo $varMap['NAME']['title']; ?> </strong></td> <td width="60%"><input type="text" name="NAME" value="<?php echo $dataVar['NAME']; ?> " /></td> </tr> <tr> <td><strong><?php echo $varMap['CODE']['title'];