/**
  * Получение информации о файле
  */
 public function actionGetInfo()
 {
     $storage = $_POST["_storage"];
     $file = $_POST["_file"];
     $size = $_POST["_size"];
     $index = $_POST["_index"];
     $result = array("isImage" => false, "previewUrl" => "", "fullUrl" => "", "url" => "", "name" => $file, "index" => $index);
     if (file_exists($storage . $file)) {
         // заменяем обратный слэш в адресе на прямой
         $linkWithBackSlash = CUtils::strRight($storage, CORE_CWD) . $file;
         $link = str_replace('\\', '/', $linkWithBackSlash);
         $result["fullUrl"] = WEB_ROOT . $link;
         $result["url"] = $link;
         $result["isImage"] = CUtils::isImage($storage . $file);
         if (CUtils::isImage($storage . $file)) {
             $result["previewUrl"] = WEB_ROOT . "_modules/_thumbnails/?src=" . $result["url"] . "&w=" . $size;
         } else {
             $filetype = CUtils::getMimetype($storage . $file);
             if (file_exists(CORE_CWD . CORE_DS . "images" . CORE_DS . ICON_THEME . CORE_DS . "64x64" . CORE_DS . "mimetypes" . CORE_DS . $filetype . ".png")) {
                 $result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/" . $filetype . ".png";
             } else {
                 $result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/unknown.png";
             }
         }
     }
     echo json_encode($result);
 }
 /**
  * 是否能被共享
  * @param array $sharePaths    - 数组,有包含user_id的path组成
  * @param string $path         - 包含user_id的path
  * @return bool
  */
 public function canShared($sharePaths, $path)
 {
     $paths = CUtils::assemblyPaths($path);
     $keys = array_keys($paths);
     if (count($keys) > 0) {
         unset($paths[$keys[0]]);
     }
     //
     // 检查path,如果存在于$paths中则父目录存在共享
     //
     foreach ($sharePaths as $k => $sharePath) {
         if (isset($paths[$sharePath])) {
             return false;
         }
     }
     //
     // 检查子目录是否存在共享,如果存在则返回false
     //
     $path .= '/';
     foreach ($sharePaths as $k => $sharePath) {
         if (strpos($sharePath, $path) === 0) {
             return false;
         }
     }
     return true;
 }
Example #3
0
 function getResult()
 {
     $this->updateData();
     $q = $this->tables['questions']->getItem(CUtils::_postVar('vote_question', true, 0) ? CUtils::_postVar('vote_question', true, 0) : "publish='on' AND date_beg<'" . date('Y-m-d H:i:s') . "' AND date_end>'" . date('Y-m-d H:i:s') . "'");
     if ($q) {
         $a = $this->tables['answers']->getArraysWhere('question_id=' . $q['id'] . " AND publish='on'");
         $rows = array();
         foreach ($a as $k => $v) {
             $a[$k]['percent'] = round($v['quantity'] ? intval($v['quantity']) / intval($q['quantity']) * 100 : 0, 2);
             if ($a[$k]['quantity']) {
                 $rows[] = array(intval(360 * $a[$k]['percent'] / 100), $a[$k]['color']);
             }
         }
         if ($q['is_dia']) {
             inc_lib('tools/CDiagram.php');
             $dia = new CDiagram();
             $dia->bgcolor = 'EAEAEA';
             if ($dia->draw($rows)) {
                 $this->smarty->assign('vote_dia', '<img src="' . $dia->fname . '" width="' . $dia->width . '" height="' . $dia->height . '">');
             }
         }
         $this->smarty->assign('a', $a);
         $this->smarty->assign('q', $q);
         return $this->smarty->fetch('service/' . $this->props['lang'] . '/vote.result.tpl');
     } else {
         return '';
     }
 }
Example #4
0
 public static function get_Size($pdo_connection, $catalog_id)
 {
     $db_name = FileConfig::get_Value('db_name', $catalog_id);
     switch (CDB::getDriverName()) {
         case 'mysql':
             // Return N/A for MySQL server prior version 5 (no information_schemas)
             if (version_compare(CDB::getServerVersion(), '5.0.0') >= 0) {
                 // Prepare SQL statment
                 $statment = array('table' => 'information_schema.TABLES', 'fields' => array("table_schema AS 'database', (sum( data_length + index_length) / 1024 / 1024 ) AS 'dbsize'"), 'where' => array("table_schema = '{$db_name}'"), 'groupby' => 'table_schema');
                 $result = CDBUtils::runQuery(CDBQuery::get_Select($statment, $pdo_connection), $pdo_connection);
                 $db_size = $result->fetch();
                 $db_size = $db_size['dbsize'] * 1024 * 1024;
                 return CUtils::Get_Human_Size($db_size);
             } else {
                 echo 'Not supported (' . CDB::getServerVersion() . ') <br />';
             }
             break;
         case 'pgsql':
             $statment = "SELECT pg_database_size('{$db_name}') AS dbsize";
             $result = CDBUtils::runQuery($statment, $pdo_connection);
             $db_size = $result->fetch();
             return CUtils::Get_Human_Size($db_size['dbsize']);
             break;
         case 'sqlite':
             $db_size = filesize(FileConfig::get_Value('db_name', $catalog_id));
             return CUtils::Get_Human_Size($db_size);
             break;
     }
 }
 public function actionIndex()
 {
     $set = new CRecordSet();
     $query = new CQuery();
     $set->setQuery($query);
     $query->select("com.*");
     $query->leftJoin(TABLE_DIPLOM_PREVIEW_MEMBERS . " as members", "members.comm_id=com.id")->from(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as com")->order("com.date_act desc");
     $showAll = true;
     if (CRequest::getInt("showAll") != 1) {
         $query->condition('com.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"');
         $showAll = false;
     }
     if (CRequest::getString("order") == "person.fio") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_PERSON . " as person", "com.secretary_id = person.id");
         $query->order("person.fio " . $direction);
     }
     $items = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $commission = new CDiplomPreviewComission($ar);
         $items->add($commission->getId(), $commission);
     }
     $this->setData("showAll", $showAll);
     $this->setData("commissions", $items);
     $this->setData("paginator", $set->getPaginator());
     $this->addActionsMenuItem(array(array("title" => "Добавить комиссию", "link" => "?action=add", "icon" => "actions/list-add.png")));
     $this->renderView("_diploms/preview_commission/index.tpl");
 }
 public function actionGetViewData()
 {
     $result = array();
     // комиссии по защите дипломов. показываем только комиссии этого года
     foreach (CActiveRecordProvider::getWithCondition(TABLE_SAB_COMMISSIONS, "year_id=" . CUtils::getCurrentYear()->getId())->getItems() as $ar) {
         $comm = new CSABCommission($ar);
         $value = $comm->title;
         if (!is_null($comm->manager)) {
             $value .= " " . $comm->manager->getName();
         }
         if (!is_null($comm->secretar)) {
             $value .= " (" . $comm->secretar->getName() . ")";
         }
         $diplom = CStaffManager::getDiplom(CRequest::getInt("diplom_id"));
         if (!is_null($diplom)) {
             $cnt = 0;
             foreach ($comm->diploms->getItems() as $d) {
                 if (strtotime($diplom->date_act) == strtotime($d->date_act)) {
                     $cnt++;
                 }
             }
             $value .= " " . $cnt;
         }
         $result[$comm->getId()] = $value;
     }
     return $result;
 }
Example #7
0
 function getSInsert()
 {
     global $PRJ_DIR, $THEME_REF, $smarty;
     if (file_exists($PRJ_DIR . '/templates/admin/components/' . CUtils::_getVar('unit') . '.' . CUtils::_getVar('table') . '.tpl')) {
         return $smarty->fetch('admin/components/' . CUtils::_getVar('unit') . '.' . CUtils::_getVar('table') . '.tpl');
     } else {
         reset($this->t->fields);
         $ret = '';
         $fields = '';
         foreach ($this->t->fields as $k => $v) {
             if (empty($v['readonly'])) {
                 $vis = '';
                 if ($this->t->getDBTableName() == 'table_attributes' && ($v['name'] == 'select_values' || $v['name'] == 'params')) {
                     $vis = ' style="display:none;"';
                 }
                 $fields .= '<tr' . $vis . ' id="add_' . $v['name'] . '" bgcolor="#fafafa"><td class="left" width="180" align="left"><b>' . $v['title'] . '</b>' . $this->getHelpLink($k, $v) . $this->getTemplateName($v) . '</td><td class="right">';
                 $ft = $this->t->createFieldType($v);
                 $fields .= $ft->getInput() . '</td></tr>' . "\n";
             }
         }
         $ret .= '<form enctype="multipart/form-data" method="post" name="frmInsert" id="frmInsert" action="' . $this->fullRef . '&action=insert">';
         $ret .= '<input type="hidden" id="utype" name="utype" value="0">';
         $ret .= $this->getTableHeader();
         $ret .= '<tr">' . "\n";
         $ret .= '<td><b>Добавить</b><a name=add></a><br><img src="' . $THEME_REF . '/img/0.gif" width="150" height="1"></td>' . "\n";
         $ret .= '<td><div class="empty"></div></td></tr>' . "\n";
         $ret .= $fields;
         $ret .= '</table><div class="ctlbtns"><input type="button" class="adm-btn" onClick="preSubmit(\'frmInsert\', 1)" value="Применить"><input type="button" class="adm-btn" onClick="preSubmit(\'frmInsert\', 0)" value="Сохранить"><input type="button" class="adm-btn" onClick="window.location = \'' . (!empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $this->fullRef) . '\'" value="Отменить"></div></form>' . "\n";
         return $ret;
     }
 }
 private function getValues()
 {
     $values = array();
     if (array_key_exists('source', $this->params)) {
         $source = $this->params['source'];
         if (CUtils::strLeft($source, ".") == "class") {
             $class = CUtils::strRight($source, ".");
             if (array_key_exists('properties', $this->params)) {
                 $object = new $class(array("properties" => $this->params['properties']));
             } else {
                 $object = new $class();
             }
             $sourceParams = $this->params['params'];
             // для совместимости их надо положить в запрос
             foreach ($sourceParams as $key => $value) {
                 $_POST[$key] = $value;
             }
             $values = $object->actionGetViewData();
         } else {
             $taxonomy = CTaxonomyManager::getTaxonomy($this->params['source']);
             $values = $taxonomy->getTermsList();
         }
     } elseif (array_key_exists('values', $this->params)) {
         $values = $this->params['values'];
     }
     return $values;
 }
Example #9
0
 public function getDiskFreeSpace()
 {
     if (file_exists(BASE) == false) {
         CUtils::MkDirs(BASE);
     }
     return @disk_free_space(BASE);
 }
 /**
  * Магический метод получения любых классов
  *
  * @param $name
  * @param array $params
  * @throws Exception
  */
 public static function __callStatic($name, $params = array())
 {
     /**
      * Получаем имя класса из имени функции
      */
     $className = "C" . CUtils::strRight($name, "get");
     if (!class_exists($className)) {
         throw new Exception("В приложении не объявлен класс " . $className);
     }
     /**
      * @var CActiveModel $simpleClass
      */
     $simpleClass = new $className();
     $table = $simpleClass->getRecord()->getTable();
     $id = $params[0];
     /**
      * Попробуем сначала получить из кэша
      */
     $keySeek = $table . "_" . $id;
     if (CApp::getApp()->cache->hasCache($keySeek)) {
         return CApp::getApp()->cache->get($keySeek);
     }
     $ar = CActiveRecordProvider::getById($table, $id);
     if (!is_null($ar)) {
         $obj = new $className($ar);
         CApp::getApp()->cache->set($keySeek, $obj, 60);
         return $obj;
     }
 }
 /**
  * Генератор названий обработчиков
  *
  * @param string $event
  * @param string $element
  * @return array
  */
 private function getHandlerNames($event = '', $element = '')
 {
     // получим основные названия обработчиков
     $handlers = array();
     $handlers[] = $event . '_' . $element;
     $e = $element;
     while (mb_strpos($e, '_') !== false) {
         $e = CUtils::strLeftBack($e, '_');
         $handlers[] = $event . '_' . $e;
     }
     $handlers[] = $event;
     // для цифровых обработчиков сгенерируем нецифровые аналоги
     $pattern = '/(_[0-9]+)/';
     foreach ($handlers as $handler) {
         if (preg_match($pattern, $handler) > 0) {
             $h = preg_replace($pattern, '', $handler);
             if (!in_array($h, $handlers)) {
                 $handlers[] = $h;
             }
         }
     }
     // сгенерируем дополнительно полный список
     $result = array();
     foreach ($handlers as $handler) {
         $result[] = 'handle_before_' . $handler;
         $result[] = 'handle_' . $handler;
         $result[] = 'handle_after_' . $handler;
     }
     // для отладки пропишем все обработчики в бин
     $this->getStatefullFormBean()->getElement($element)->setHandlers($result);
     return $result;
 }
Example #12
0
 public static function write($sMessage)
 {
     global $db;
     $sIPAddress = empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'];
     $sUserName = CUtils::_sessionVar('user');
     $sQuery = "\r\n\t\t\t\tINSERT INTO\r\n\t\t\t\t\tsystem_log(credate, ip_address, user_name, description) \r\n\t\t\t\tVALUES\r\n\t\t\t\t\t(NOW(), '{$sIPAddress}','{$sUserName}', '{$sMessage}')\r\n\t\t\t";
     $db->execQuery('log', $sQuery);
 }
Example #13
0
 /**
  * 更新文件meta信息
  * @param string $file_path
  * @param string $meta_key
  * @param string $meta_value
  */
 public static function updateFileMeta($file_path, $meta_key, $meta_value)
 {
     $meta_value = CUtils::real_escape_string($meta_value);
     $sql = "UPDATE " . DB_PREFIX . "_file_metas ";
     $sql .= "SET meta_value = '{$meta_value}', updated_at = now() ";
     $sql .= "WHERE file_path=\"{$file_path}\" AND meta_key=\"{$meta_key}\"";
     $db_manager = MDbManager::getInstance();
     return $db_manager->updateDb($sql);
 }
 /**
  * @return bool
  */
 public function isTextField()
 {
     if ($this->type == "text") {
         return true;
     } elseif (CUtils::strLeft($this->type, "(") == "varchar") {
         return true;
     }
     return false;
 }
Example #15
0
 public function getStatic()
 {
     global $PRJ_REF;
     $ret = '';
     if ($this->dbValue) {
         $ret = '<a href="' . $PRJ_REF . $this->dbValue . '">' . $this->dbValue . '</a>&nbsp;(' . CUtils::getFileSize($this->dbValue) . ')';
     }
     return $ret;
 }
Example #16
0
 function getText()
 {
     if (CUtils::_postVar('utype')) {
         $path = str_replace(stristr($_SERVER['HTTP_REFERER'], '&message'), '', $_SERVER['HTTP_REFERER']);
         header('location: ' . $path . '&message=' . ($this->t->updateGlobals() ? urlencode('Обновлено') : urlencode('Ошибка обновления')));
     } else {
         $this->messageAction($this->t->updateGlobals() ? 'Обновлено' : 'Ошибка обновления');
     }
 }
Example #17
0
 function getBody()
 {
     $ret = $this->smarty->fetch('service/' . $this->props['lang'] . '/search.form.tpl');
     $max_per_page = 20;
     $this->page = CUtils::_getVar('page', true, 1);
     if (CUtils::_getVar('text')) {
         $search_array = array();
         $simple_search_array = explode(' ', CUtils::_getVar('text'));
         foreach ($simple_search_array as $ssa) {
             inc_lib('tools/stemming/stemming.php');
             $ssa = PorterStem::stemming($ssa);
             $search_array[] = $ssa;
         }
         if (count($search_array)) {
             $results = $this->getResults($search_array);
         } else {
             $results = $this->getResults(addslashes($this->text));
         }
         $this->smarty->assign('search_text', addslashes(CUtils::_getVar('text')));
         if (sizeof($results) > 0) {
             $pages_cnt = ceil(sizeof($results) / $max_per_page);
             if ($pages_cnt > 1) {
                 $pages = '<div>';
                 if ($this->page > 1) {
                     $ref = '?text=' . urlencode(CUtils::_getVar('text')) . '&page=' . ($this->page - 1);
                     $pages .= '<a title="назад" href="' . $ref . '">&larr;</a>';
                 }
                 for ($i = 1; $i <= $pages_cnt; $i++) {
                     $pages .= $i == $this->page ? ' ' . $i . ' ' : ' <a href="?text=' . urlencode(CUtils::_getVar('text')) . '&page=' . $i . '">' . $i . '</a> ';
                 }
                 if ($this->page < $pages_cnt) {
                     $ref = '?text=' . urlencode(CUtils::_getVar('text')) . '&page=' . ($this->page + 1);
                     $pages .= '<a title="вперед" href="' . $ref . '">&rarr;</a>';
                 }
                 $pages .= '</div>';
                 $this->smarty->assign('ptext', $pages);
             }
             if ($this->page == $pages_cnt && sizeof($results) % $max_per_page > 0) {
                 $max_per_page_cur = count($results) % $max_per_page;
             } else {
                 $max_per_page_cur = $max_per_page;
             }
             $items = array();
             for ($i = 1; $i <= $max_per_page_cur; $i++) {
                 $j = $i + ($this->page - 1) * $max_per_page;
                 $results[$j - 1]['num'] = $j;
                 $items[] = $results[$j - 1];
             }
             $this->smarty->assign('items', $items);
             $ret .= $this->smarty->fetch('service/' . $this->props['lang'] . '/search.list.tpl');
         } else {
             $ret .= $this->smarty->fetch('service/' . $this->props['lang'] . '/search.no.tpl');
         }
     }
     return $ret;
 }
Example #18
0
 public function getStatic()
 {
     global $PRJ_REF;
     $ret = '';
     if ($this->dbValue) {
         $path = pathinfo($this->dbValue);
         $ret = $path['basename'] . '&nbsp;' . CUtils::getFileSize($this->dbValue);
     }
     return $ret;
 }
Example #19
0
 public function getInput($value = '', $name = '')
 {
     $name = $name ? $name : $this->getName();
     $value = $value ? $value : $this->dbValue;
     $input_id = strtr($name, '[]', '__');
     $ret = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%"><input type="text" readonly style="width:100%;" value="' . $this->getStatic() . '" size="62" id="' . $input_id . '_title">';
     $ret .= '<input type="hidden" name="' . $name . '" value="' . $value . '" id="' . $input_id . '">';
     $ret .= '</td><td><input class="butt" type="button" value="&hellip;" onClick="show_list_popup(\'' . $input_id . '\',\'' . CUtils::_getVar('unit') . '_' . CUtils::_getVar('table') . '\',\'' . $this->getName() . '\', \'' . CUtils::_getVar('id', true, 0) . '\',\'' . $value . '\');"></td></tr></table>';
     return $ret;
 }
 public function actionAdd()
 {
     $commission = new CSABCommission();
     $form = new CSABCommissionForm();
     $commission->year_id = CUtils::getCurrentYear()->getId();
     $form->commission = $commission;
     $this->setData("form", $form);
     $this->addActionsMenuItem(array(array("title" => "Назад", "link" => "index.php?action=index", "icon" => "actions/edit-undo.png")));
     $this->renderView("_state_attestation/add.tpl");
 }
Example #21
0
/**
 * Smarty {raFInfo} function plugin
 *
 * Type:     function<br>
 * Name:     raFInfo<br>
 * @author   Roman Alyakrytskiy
 * @param array
 * @param Smarty
 * @return array
 */
function smarty_function_raFInfo($params, &$smarty)
{
    if (!isset($params['file'])) {
        $smarty->trigger_error('raFInfo: Не указан параметр: file');
    } elseif (!isset($params['var'])) {
        $smarty->trigger_error('raFInfo: Не указан параметр: var');
    } else {
        $ipath = pathinfo($params['file']);
        $smarty->assign($params['var'], array('ext' => $ipath['extension'], 'size' => CUtils::getFileSize($params['file'])));
    }
}
 public function getIconLink()
 {
     if ($this->isFileExists()) {
         $filetype = CUtils::getMimetype(CORE_CWD . CORE_DS . 'library' . CORE_DS . 'gost' . CORE_DS . $this->nameFile);
         if (file_exists(CORE_CWD . CORE_DS . "images" . CORE_DS . ICON_THEME . CORE_DS . "64x64" . CORE_DS . "mimetypes" . CORE_DS . $filetype . ".png")) {
             return WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/" . $filetype . ".png";
         } else {
             return WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/text-x-install.png";
         }
     }
     return "";
 }
Example #23
0
 private static function getConditionField(array $params = array())
 {
     $result = "";
     if ($params["relationPower"] == RELATION_HAS_ONE) {
         if ($params["storageField"] != "") {
             $condition = $params["storageField"];
             $result = CUtils::strLeft($condition, "=");
             $result = str_replace(" ", "", $result);
         }
     }
     return $result;
 }
Example #24
0
 /**
  * 获得站点信息
  */
 public static function getSiteInfo()
 {
     $data = array();
     $data['version'] = APP_VERSION;
     $data['status'] = "done";
     $data['app_name'] = 100;
     $data['app_logo'] = MiniHttp::getSystemParam("absoluteUrl") . "/static/images/logo.png";
     $data['default_size'] = 100;
     $data['can_register'] = true;
     $data['register_url'] = "";
     //产品名称
     $value = MiniOption::getInstance()->getOptionValue('site_name');
     if (isset($value)) {
         $data['app_name'] = $value;
     }
     //站点ID
     $data['code'] = MiniSiteUtils::getSiteCode();
     $data['site_id'] = MiniSiteUtils::getSiteID();
     $data['wx_token'] = MiniSiteUtils::getWxToken();
     //产品Logo
     $value = MiniOption::getInstance()->getOptionValue('site_logo_url');
     if (isset($value)) {
         $data['app_logo'] = MiniHttp::getSystemParam("absoluteUrl") . $value;
     }
     //判断系统是否可以注册
     $enableReg = MiniOption::getInstance()->getOptionValue("user_register_enabled");
     if (isset($enableReg) && $enableReg == "0") {
         $data['can_register'] = false;
     }
     //系统注册入口是否在第3方
     $value = MiniOption::getInstance()->getOptionValue("user_create_url");
     if (isset($value) && !empty($value)) {
         $data['register_url'] = $value;
     }
     // 32M
     $blockSize = 4 * 1024 * 1024;
     // 内存配置需要
     $memoryLimit = CUtils::return_bytes(ini_get('memory_limit'));
     if ($memoryLimit < 4 * $blockSize) {
         $blockSize = $memoryLimit / 4;
     }
     $postMaxSize = CUtils::return_bytes(ini_get('post_max_size'));
     $uploadMaxFileSize = CUtils::return_bytes(ini_get('upload_max_filesize'));
     $min = $postMaxSize > $uploadMaxFileSize ? $uploadMaxFileSize : $postMaxSize;
     $data['block_size'] = $min > $blockSize ? $blockSize : $min;
     if ($data['block_size'] == $postMaxSize && $data['block_size'] == $uploadMaxFileSize) {
         $data['block_size'] = $data['block_size'] - 104858;
     }
     // 获取忘记密码使用短信口子地址
     $forgetPasswordUrl = MiniHttp::getSystemParam("absoluteUrl");
     $data['forget_password_url'] = $forgetPasswordUrl;
     return $data;
 }
 public function actionAddGroup()
 {
     $plan = CWorkPlanManager::getWorkplan(CRequest::getInt("id"));
     $group = new CExamGroupAdd();
     $group->plan_id = CRequest::getInt("id");
     $group->type = CRequest::getInt("type");
     $group->discipline_id = $plan->discipline->id;
     $group->year_id = CUtils::getCurrentYear()->getId();
     $this->setData("group", $group);
     $this->setData("cources", array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5));
     $this->addActionsMenuItem(array("title" => "Назад", "link" => "workplanexamquestions.php?action=index&plan_id=" . CRequest::getInt("id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/edit-undo.png"));
     $this->renderView("_corriculum/_workplan/examQuestions/groupadd.tpl");
 }
 /**
  * Расписание
  * 
  * @return CArrayList
  */
 public function getSchedule()
 {
     if (is_null($this->_schedules)) {
         $this->_schedules = new CArrayList();
         $query = new CQuery();
         $query->select("schedule.*")->from(TABLE_SCHEDULE . " as schedule")->condition("schedule.id=" . $this->getId() . " and schedule.year=" . CUtils::getCurrentYear()->getId() . " and schedule.month=" . CUtils::getCurrentYearPart()->getId());
         foreach ($query->execute()->getItems() as $item) {
             $schedule = new CSchedule(new CActiveRecord($item));
             $this->_schedules->add($schedule->getId(), $schedule);
         }
     }
     return $this->_schedules;
 }
Example #27
0
 public static function fdate($d, $format)
 {
     $dstr = date($format, mktime(substr($d, 11, 2), substr($d, 14, 2), substr($d, 17, 2), substr($d, 5, 2), substr($d, 8, 2), substr($d, 0, 4)));
     $lang = CUtils::_sessionVar('lang', false, 'ru');
     if ($lang != 'en') {
         $smonth = array('ru' => array('Jan' => 'января', 'Feb' => 'февраля', 'Mar' => 'марта', 'Apr' => 'апреля', 'May' => 'мая', 'Jun' => 'июня', 'Jul' => 'июля', 'Aug' => 'августа', 'Sep' => 'сентября', 'Oct' => 'октября', 'Nov' => 'ноября', 'Dec' => 'декабря'), 'fr' => array(), 'it' => array());
         $month = array('ru' => array('January' => 'января', 'February' => 'февраля', 'March' => 'марта', 'April' => 'апреля', 'May' => 'мая', 'June' => 'июня', 'July' => 'июля', 'August' => 'августа', 'September' => 'сентября', 'October' => 'октября', 'November' => 'ноября', 'December' => 'декабря'), 'fr' => array(), 'it' => array());
         $weekday = array('ru' => array('Monday' => 'понедельник', 'Tuesday' => 'вторник', 'Wednesday' => 'среда', 'Thursday' => 'четверг', 'Friday' => 'пятница', 'Saturday' => 'суббота', 'Sunday' => 'воскресенье'), 'fr' => array(), 'it' => array());
         $sweekday = array('ru' => array('Mon' => 'понедельник', 'Tue' => 'вторник', 'Wed' => 'среда', 'Thu' => 'четверг', 'Fri' => 'пятница', 'Sat' => 'суббота', 'Sun' => 'воскресенье'), 'fr' => array(), 'it' => array());
         $dstr = strtr($dstr, array_merge($smonth[$lang], $month[$lang], $sweekday[$lang], $weekday[$lang]));
     }
     return $dstr;
 }
Example #28
0
 public function __construct(&$unitAdminInterface)
 {
     $this->uai = $unitAdminInterface;
     $this->baseRef = $unitAdminInterface->getBaseTableRef();
     if (is_object($this->t = $this->uai->getBaseTable())) {
         $this->search_url = $this->t->getSeachURL();
         $this->search_sql = $this->t->getSeachSQL();
         $this->searchRef0 = $this->baseRef . ($this->search_url ? '&' . $this->search_url : '');
         $this->searchRef = $this->searchRef0 . (CUtils::_getVar('rpp') ? '&rpp=' . CUtils::_getVar('rpp') : '');
         $this->fullRef0 = $this->searchRef0 . (CUtils::_getVar('page') ? '&page=' . CUtils::_getVar('page') : '');
         $this->fullRef = $this->searchRef . (CUtils::_getVar('page') ? '&page=' . CUtils::_getVar('page') : '');
     }
 }
Example #29
0
 /**
  *   获取events数据
  */
 public function getList($path, $time, $deviceUuid, $pageSize, $currentPage)
 {
     $user = $this->user;
     $userId = $user['id'];
     $time = $this->getTime($time);
     if ($path != "") {
         $path = MiniUtil::joinPath($path);
     }
     $total = MiniEvent::getInstance()->getTotal($path, $time, $userId, $deviceUuid);
     $totalPage = ceil($total / $pageSize);
     $events = MiniEvent::getInstance()->getByCondition($path, $userId, $time, $deviceUuid, $pageSize, ($currentPage - 1) * $pageSize);
     $itemList = array();
     $data = array();
     foreach ($events as $event) {
         $item = array();
         $device = MiniUserDevice::getInstance()->getUserDevice($event['user_device_id']);
         $item['create_user_id'] = $device['user_id'];
         $item['file_path'] = MiniUtil::getRelativePath($event['file_path']);
         $item['action'] = $event['action'];
         $item['user_name'] = $user['user_name'];
         $item['user_device_type'] = $device['user_device_type'];
         if ($device['user_id'] == $userId) {
             $item['user_self'] = true;
         } else {
             $item['user_self'] = false;
             $user = MiniUser::getInstance()->getById($device['user_id']);
             $userMetas = MiniUserMeta::getInstance()->getUserMetas($device['user_id']);
             if (isset($userMetas['nick'])) {
                 $item['user_name'] = $userMetas['nick'];
             } else {
                 $item['user_name'] = $user['user_name'];
             }
         }
         $item['created_at'] = MiniUtil::formatTime(strtotime($event['created_at']));
         $item['user_device_name'] = $device['user_device_name'];
         $item['context'] = MiniUtil::getRelativePath($event['context']);
         $item['device_uuid'] = $device['user_device_uuid'];
         if ($event['action'] == 2) {
             //判断是否是重命名还是创建
             $fromParent = CUtils::pathinfo_utf($event['file_path']);
             $toParent = CUtils::pathinfo_utf($event['context']);
             if ($fromParent['dirname'] == $toParent['dirname']) {
                 $item['action'] = MConst::RENAME;
             }
         }
         $itemList[] = $item;
     }
     $data['events'] = $itemList;
     $data['totalPage'] = $totalPage;
     return $data;
 }
 public function actionSearch()
 {
     $res = array();
     $term = CRequest::getString("query");
     /**
      * Ищем группу по названию
      */
     $query = new CQuery();
     $query->select("st_group.id, st_group.name")->from(TABLE_STUDENT_GROUPS . " as st_group")->condition("LCASE(st_group.name) like '%" . mb_strtolower($term) . "%' and st_group.year_id =" . CUtils::getCurrentYear()->id)->limit(0, 5);
     foreach ($query->execute()->getItems() as $item) {
         $res[] = array("field" => "id", "value" => $item["id"], "label" => $item["name"], "class" => "CStudentGroup");
     }
     echo json_encode($res);
 }