示例#1
0
 public function tearDown()
 {
     $path = array(LIB_PATH . 'custom_config/controls/failed_to_load.php', LIB_PATH . 'custom_config/test.php', LIB_PATH . 'custom_config/test2.php');
     foreach ($path as $row) {
         if (file_exists($row)) {
             unlink($row);
         }
     }
     $register = new SystemRegister('Applications/cconfig/user_control_path');
     $child = SystemRegisterSample::selectChild($register->getId());
     foreach ($child as $row) {
         $register->delete($row['name']);
     }
 }
示例#2
0
文件: sample.php 项目: gudwin/extasy
 /**
  * Обновляет лист в бд
  */
 public static function update(SystemRegister $parent, $id, $szName, $szValue, $szComment, $szType)
 {
     // Экранируем переменные
     $id = intval($id);
     $szName = \Faid\DB::escape($szName);
     $szValue = \Faid\DB::escape($szValue);
     $szComment = \Faid\DB::escape($szComment);
     $szType = \Faid\DB::escape($szType);
     // запрос
     $sql = 'UPDATE `%s` SET `name`="%s",`value`="%s",`comment`="%s",`type`="%s" WHERE `id`="%s"';
     $sql = sprintf($sql, SYSTEMREGISTER_TABLE, $szName, $szValue, $szComment, $szType, $id);
     //
     DB::post($sql);
     // обновляем кеш предка
     self::updateChildCache($parent->getId());
     self::updateGetCache($szName, $parent->getId());
     return $id;
 }
示例#3
0
文件: users.php 项目: gudwin/extasy
 protected function displayRights($rightsString)
 {
     // Получаем все права существующие в системе
     $register = new SystemRegister('System/CMS/userRights');
     $fullRightsList = SystemRegisterHelper::exportData($register->getId());
     $usersRights = explode("\r\n", $rightsString);
     // Перебор прав
     $result = array();
     foreach ($fullRightsList as $key => $row) {
         $checkbox = new CCheckbox();
         $checkbox->name = 'rights[]';
         $checkbox->value = $key;
         $checkbox->title = $row['comment'];
         if (in_array($key, $usersRights)) {
             $checkbox->checked = true;
         }
         $result[] = $checkbox;
     }
     return implode('<br/>', $result);
 }
示例#4
0
 protected static function loadConfig()
 {
     $register = new \SystemRegister(self::SystemRegisterPath);
     self::$config = \SystemRegisterHelper::exportData($register->getId());
 }
示例#5
0
文件: cms.php 项目: gudwin/extasy
 public static function getRootDocuments()
 {
     $register = new SystemRegister(self::RootDocumentsKey);
     return SystemRegisterHelper::export($register->getId());
 }
示例#6
0
 /**
  * Возвращает имена классов всех контролов, с которыми в данный момент работает CConfig
  * @return array
  */
 public static function selectAll()
 {
     // Грузим все файлы в папке контролов
     $files = DAO::getInstance('fs')->getFileList(CCONFIG_CONTROLS_PATH);
     $result = array();
     foreach ($files as $row) {
         try {
             $row = basename($row, '.php');
             $result[$row] = self::loadControl($row);
         } catch (Exception $e) {
         }
     }
     // Дополняем классами, записанными в реестре
     $register = new SystemRegister('Applications/cconfig/user_control_path');
     $paths = SystemRegisterSample::selectChild($register->getId());
     foreach ($paths as $row) {
         try {
             $result[$row['name']] = self::loadControl($row['name']);
         } catch (Exception $e) {
         }
     }
     return $result;
 }