?> :</td> <td> <input type="text" name="LETTER" size="1" maxlength="1" value="<?php echo $str_LETTER; ?> "> </td> </tr> <tr> <td class="adm-detail-valign-top"><?php echo GetMessage('DESCRIPTION'); ?> </td> <td><textarea name="DESCRIPTION" cols="30" rows="5"><?php echo CTask::GetLangDescription($str_NAME, $str_DESCRIPTION); ?> </textarea> </td> </tr> <?php $tabControl->BeginNextTab(); ?> <tr> <td colspan="2" align="center"> <table border="0" cellpadding="5" cellspacing="0" align="center"> <tr> <td width="10%" align="center"> </td> <td width="90%"> </td> </tr> <?php
?> :</td> <td> <input type="text" name="LETTER" size="1" maxlength="1" value="<?php echo $str_LETTER; ?> "> </td> </tr> <tr> <td class="adm-detail-valign-top"><?php echo GetMessage('DESCRIPTION'); ?> </td> <td><textarea name="DESCRIPTION" cols="30" rows="5"><?php echo CTask::GetLangDescription($str_NAME, $str_DESCRIPTION, $str_MODULE_ID); ?> </textarea> </td> </tr> <?php $tabControl->BeginNextTab(); ?> <tr> <td colspan="2" align="center"> <table border="0" cellpadding="5" cellspacing="0" align="center"> <tr> <td width="10%" align="center"> </td> <td width="90%"> </td> </tr> <?php
?> </select> </td> </tr> <tr> <td><?echo GetMessage('LETTER')?>:</td> <td> <input type="text" name="LETTER" size="1" maxlength="1" value="<?php echo $str_LETTER; ?> "> </td> </tr> <tr> <td class="adm-detail-valign-top"><?echo GetMessage('DESCRIPTION')?></td> <td><textarea name="DESCRIPTION" cols="30" rows="5"><? echo CTask::GetLangDescription($str_NAME, $str_DESCRIPTION, $str_MODULE_ID);?></textarea> </td> </tr> <?$tabControl->BeginNextTab();?> <tr> <td colspan="2" align="center"> <table border="0" cellpadding="5" cellspacing="0" align="center"> <tr> <td width="10%" align="center"> </td> <td width="90%"> </td> </tr> <? if (isset($_POST['OPERATION_ID'])) $arTaskOperations = $_POST['OPERATION_ID']; else $arTaskOperations = CTask::GetOperations($ID);
function GetList($arOrder = array('MODULE_ID' => 'asc', 'LETTER' => 'asc'), $arFilter = array()) { global $DB, $USER, $CACHE_MANAGER; if (CACHED_b_task !== false) { $cacheId = "b_task" . md5(serialize($arOrder) . "." . serialize($arFilter)); if ($CACHE_MANAGER->Read(CACHED_b_task, $cacheId, "b_task")) { $arResult = $CACHE_MANAGER->Get($cacheId); $res = new CDBResult(); $res->InitFromArray($arResult); return $res; } } static $arFields = array("ID" => array("FIELD_NAME" => "T.ID", "FIELD_TYPE" => "int"), "NAME" => array("FIELD_NAME" => "T.NAME", "FIELD_TYPE" => "string"), "LETTER" => array("FIELD_NAME" => "T.LETTER", "FIELD_TYPE" => "string"), "MODULE_ID" => array("FIELD_NAME" => "T.MODULE_ID", "FIELD_TYPE" => "string"), "SYS" => array("FIELD_NAME" => "T.SYS", "FIELD_TYPE" => "string"), "BINDING" => array("FIELD_NAME" => "T.BINDING", "FIELD_TYPE" => "string")); $err_mess = CAllTask::err_mess() . "<br>Function: GetList<br>Line: "; $arSqlSearch = array(); $strSqlSearch = ""; if (is_array($arFilter)) { $filter_keys = array_keys($arFilter); for ($i = 0, $l = count($filter_keys); $i < $l; $i++) { $n = strtoupper($filter_keys[$i]); $val = $arFilter[$filter_keys[$i]]; if (strlen($val) <= 0 || strval($val) == "NOT_REF") { continue; } if ($n == 'ID') { $arSqlSearch[] = GetFilterQuery("T.ID", $val, 'N'); } elseif (isset($arFields[$n])) { $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val); } } } $strOrderBy = ''; foreach ($arOrder as $by => $order) { if (isset($arFields[strtoupper($by)])) { $strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ','; } } if (strlen($strOrderBy) > 0) { $strOrderBy = "ORDER BY " . rtrim($strOrderBy, ","); } $strSqlSearch = GetFilterSqlSearch($arSqlSearch); $strSql = "\n\t\t\tSELECT\n\t\t\t\tT.ID, T.NAME, T.DESCRIPTION, T.MODULE_ID, T.LETTER, T.SYS, T.BINDING\n\t\t\tFROM\n\t\t\t\tb_task T\n\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t{$strOrderBy}"; $res = $DB->Query($strSql, false, $err_mess . __LINE__); $arResult = array(); while ($arRes = $res->Fetch()) { $arRes['TITLE'] = CTask::GetLangTitle($arRes['NAME']); $arRes['DESC'] = CTask::GetLangDescription($arRes['NAME'], $arRes['DESCRIPTION']); $arResult[] = $arRes; } $res->InitFromArray($arResult); if (CACHED_b_task !== false) { $CACHE_MANAGER->Set($cacheId, $arResult); } return $res; }
/** * @return array of possible rights. Example of array item: * $arPossibleRights['ID'] = array( * 'name' => 'NAME', * 'name_human' => $nameUpperCase, * 'sys' => 'SYS', * 'description' => 'DESCRIPTION', * 'description_human' => $descrUpperCase, * 'binding' => 'BINDING' * ); */ public static function ListAllPossibleRights() { global $DB, $MESS; $rc = $DB->Query("SELECT ID, NAME, SYS, DESCRIPTION, BINDING FROM b_task WHERE MODULE_ID = 'learning'"); if ($rc === false) { throw new LearnException('EA_SQLERROR', LearnException::EXC_ERR_ALL_ACCESS_DENIED | LearnException::EXC_ERR_ALL_GIVEUP); } $arPossibleRights = array(); while ($row = $rc->Fetch()) { $nameUpperCase = strtoupper($row['NAME']); $arPossibleRights[$row['ID']] = array('name' => $row['NAME'], 'name_human' => CTask::GetLangTitle($nameUpperCase, "learning"), 'sys' => $row['SYS'], 'description' => $row['DESCRIPTION'], 'description_human' => CTask::GetLangDescription($nameUpperCase, "", "learning"), 'binding' => $row['BINDING']); } return $arPossibleRights; }
function GetList($arOrder = array('MODULE_ID' => 'asc', 'LETTER' => 'asc'), $arFilter = array()) { global $DB; static $arFields = array("ID" => array("FIELD_NAME" => "T.ID", "FIELD_TYPE" => "int"), "NAME" => array("FIELD_NAME" => "T.NAME", "FIELD_TYPE" => "string"), "LETTER" => array("FIELD_NAME" => "T.LETTER", "FIELD_TYPE" => "string"), "MODULE_ID" => array("FIELD_NAME" => "T.MODULE_ID", "FIELD_TYPE" => "string"), "SYS" => array("FIELD_NAME" => "T.SYS", "FIELD_TYPE" => "string"), "BINDING" => array("FIELD_NAME" => "T.BINDING", "FIELD_TYPE" => "string")); $err_mess = CAllTask::err_mess() . "<br>Function: GetList<br>Line: "; $arSqlSearch = array(); if (is_array($arFilter)) { foreach ($arFilter as $n => $val) { $n = strtoupper($n); if (strlen($val) <= 0 || strval($val) == "NOT_REF") { continue; } if ($n == 'ID' || $n == 'MODULE_ID' || $n == 'BINDING' || $n == 'SYS') { $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val, 'N'); } elseif (isset($arFields[$n])) { $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val); } } } $strOrderBy = ''; foreach ($arOrder as $by => $order) { if (isset($arFields[strtoupper($by)])) { $strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ','; } } if ($strOrderBy != '') { $strOrderBy = "ORDER BY " . rtrim($strOrderBy, ","); } $strSqlSearch = GetFilterSqlSearch($arSqlSearch); $strSql = "\n\t\t\tSELECT\n\t\t\t\tT.ID, T.NAME, T.DESCRIPTION, T.MODULE_ID, T.LETTER, T.SYS, T.BINDING\n\t\t\tFROM\n\t\t\t\tb_task T\n\t\t\tWHERE\n\t\t\t\t" . $strSqlSearch . "\n\t\t\t" . $strOrderBy; $res = $DB->Query($strSql, false, $err_mess . __LINE__); $arResult = array(); while ($arRes = $res->Fetch()) { $arRes['TITLE'] = CTask::GetLangTitle($arRes['NAME']); $arRes['DESC'] = CTask::GetLangDescription($arRes['NAME'], $arRes['DESCRIPTION']); $arResult[] = $arRes; } $res->InitFromArray($arResult); return $res; }
function GetList($arOrder = array('MODULE_ID'=>'asc','LETTER'=>'asc'),$arFilter=array()) { global $DB, $CACHE_MANAGER;; if(CACHED_b_task !== false) { $cacheId = "b_task".md5(serialize($arOrder).".".serialize($arFilter)); if($CACHE_MANAGER->Read(CACHED_b_task, $cacheId, "b_task")) { $arResult = $CACHE_MANAGER->Get($cacheId); $res = new CDBResult; $res->InitFromArray($arResult); return $res; } } static $arFields = array( "ID" => array("FIELD_NAME" => "T.ID", "FIELD_TYPE" => "int"), "NAME" => array("FIELD_NAME" => "T.NAME", "FIELD_TYPE" => "string"), "LETTER" => array("FIELD_NAME" => "T.LETTER", "FIELD_TYPE" => "string"), "MODULE_ID" => array("FIELD_NAME" => "T.MODULE_ID", "FIELD_TYPE" => "string"), "SYS" => array("FIELD_NAME" => "T.SYS", "FIELD_TYPE" => "string"), "BINDING" => array("FIELD_NAME" => "T.BINDING", "FIELD_TYPE" => "string") ); $err_mess = (CAllTask::err_mess())."<br>Function: GetList<br>Line: "; $arSqlSearch = array(); if(is_array($arFilter)) { foreach($arFilter as $n => $val) { $n = strtoupper($n); if(strlen($val) <= 0 || strval($val) == "NOT_REF") continue; if(isset($arFields[$n])) { $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val, ($n == 'NAME'? "Y" : "N")); } } } $strOrderBy = ''; foreach($arOrder as $by=>$order) if(isset($arFields[strtoupper($by)])) $strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"].' '.(strtolower($order)=='desc'?'desc'.(strtoupper($DB->type)=="ORACLE"?" NULLS LAST":""):'asc'.(strtoupper($DB->type)=="ORACLE"?" NULLS FIRST":"")).','; if($strOrderBy <> '') $strOrderBy = "ORDER BY ".rtrim($strOrderBy, ","); $strSqlSearch = GetFilterSqlSearch($arSqlSearch); $strSql = " SELECT T.ID, T.NAME, T.DESCRIPTION, T.MODULE_ID, T.LETTER, T.SYS, T.BINDING FROM b_task T WHERE ".$strSqlSearch." ".$strOrderBy; $res = $DB->Query($strSql, false, $err_mess.__LINE__); $arResult = array(); while($arRes = $res->Fetch()) { $arRes['TITLE'] = CTask::GetLangTitle($arRes['NAME'], $arRes['MODULE_ID']); $arRes['DESC'] = CTask::GetLangDescription($arRes['NAME'], $arRes['DESCRIPTION'], $arRes['MODULE_ID']); $arResult[] = $arRes; } $res->InitFromArray($arResult); if(CACHED_b_task !== false) { /** @noinspection PhpUndefinedVariableInspection */ $CACHE_MANAGER->Set($cacheId, $arResult); } return $res; }