public function actionDelete()
 {
     $event = CGrantManager::getEvent(CRequest::getInt("id"));
     $id = $event->grant_id;
     $event->remove();
     $this->redirect("index.php?action=edit&id=" . $id);
 }
 public function actionChangeAuthors()
 {
     $field = CCoreObjectsManager::getCoreModelField(CRequest::getInt("id"));
     $field->is_authors = 1 - $field->is_authors;
     $field->save();
     echo $field->is_authors;
 }
 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;
 }
 public function display($templateName = '', $isCache = false, $num = '')
 {
     if (empty($templateName)) {
         $templateName = CRequest::getController() . '/' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction());
     }
     parent::display($templateName, $isCache, $num);
 }
Exemplo n.º 5
0
 /**
  * 创建URL
  */
 protected function createUrl($a, $c, $params = array())
 {
     // 将参数合并传给请求类生成URL
     $params['c'] = $c;
     $params['a'] = $a;
     return CRequest::createUrl($params);
 }
 /**
  * 是否有权限
  */
 public static function checkRight($thisRoute = null)
 {
     // 用户资源
     $userData = CSession::get('user');
     if ($userData['groupId'] == 1) {
         return true;
     }
     $userRightList = isset($userData['rightAll']) ? $userData['rightAll'] : array();
     // 附加公共资源
     array_push($userRightList, 'system@welcome');
     array_push($userRightList, 'system@navList');
     array_push($userRightList, 'system@addNav');
     array_push($userRightList, 'system@addNavHandle');
     array_push($userRightList, 'system@ajaxAddNav');
     array_push($userRightList, 'system@editNav');
     array_push($userRightList, 'system@editNavHandle');
     array_push($userRightList, 'system@delNav');
     array_push($userRightList, 'system@changeMyPassword');
     array_push($userRightList, 'system@changeMyPassHandle');
     array_push($userRightList, 'adminRole@messageCenterForClient');
     array_push($userRightList, 'system@seeHelp');
     // 转小写
     foreach ($userRightList as $key => $val) {
         $userRightList[$key] = strtolower($val);
     }
     // 获取当前请求的路由
     if ($thisRoute == null) {
         $route = CRequest::getController() . '@' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction());
     } else {
         $route = $thisRoute;
     }
     return in_array(strtolower($route), $userRightList);
 }
 /**
  * Получение данных модели по идентификатору
  */
 private function actionJSONGet()
 {
     // получим название класса модели, которую надо пользователю
     $modelClass = CRequest::getString("model");
     // идентификатор
     $id = CRequest::getInt("id");
     // создадим объект, посмотрим, в какой таблице он весь живет
     /**
      * @var $model CActiveModel
      */
     $model = new $modelClass();
     // проверим, может не реализует нужный интерфейс
     if (!is_a($model, "IJSONSerializable")) {
         throw new Exception("Класс " . $modelClass . " не реализует интерфейс IJSONSerializable");
     }
     $modelTable = $model->getRecord()->getTable();
     // получим из этой таблицы объект
     $ar = CActiveRecordProvider::getById($modelTable, $id);
     if (is_null($ar)) {
         echo json_encode(null);
         return;
     }
     // создадим новый объект указанного типа
     /**
      * @var $model IJSONSerializable
      */
     $model = new $modelClass($ar);
     // получим json объект модели
     $jsonObj = $model->toJsonObject();
     // добавим к json-объекту перевод
     $jsonObj->_translation = CCoreObjectsManager::getAttributeLabels($model);
     // сразу добавим штатную валидацию
     // может, чуть позже, пока нет
     echo json_encode($jsonObj);
 }
 public function execute($contextObject)
 {
     $result = array();
     $studyLoad = new CArrayList();
     $load = CIndPlanManager::getLoad(CRequest::getInt("planId"));
     $studyLoad = $load->getWorksByType(6);
     foreach ($studyLoad->getItems() as $row) {
         $dataRow = array();
         $dataRow[0] = count($result) + 1;
         $dataRow[1] = $row->change_section;
         $dataRow[2] = $row->change_reason;
         $dataRow[3] = "";
         $dataRow[4] = $row->change_add_date;
         $dataRow[5] = $row->isExecuted();
         $result[] = $dataRow;
     }
     for ($i = count($result); $i <= 7; $i++) {
         $row = array();
         for ($j = 0; $j <= 5; $j++) {
             $row[$j] = "";
         }
         $result[] = $row;
     }
     return $result;
 }
 public function actionSave()
 {
     $quest = new CQuestion();
     $quest->setAttributes(CRequest::getArray($quest::getClassName()));
     if ($quest->validate()) {
         if (!CSession::isAuth()) {
             $user = "";
         } else {
             $user = CStaffManager::getUser(CSession::getCurrentUser()->getId())->getName();
         }
         $quest->contact_info .= " " . $user . '; ip ' . $_SERVER["REMOTE_ADDR"];
         if ($quest->answer_text != '') {
             $quest->datetime_answ = date("Y-d-m H:i:s", time());
         }
         $quest->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $quest->getId());
         } else {
             $this->redirect(WEB_ROOT);
         }
         return true;
     }
     $this->setData("quest", $quest);
     $this->renderView("__public/_question_add/edit.tpl");
 }
 public function actionDelete()
 {
     $order = CSABManager::getSABPersonOrder(CRequest::getInt("id"));
     $person = $order->person_id;
     $order->remove();
     $this->redirect("index.php?action=edit&id=" . $person);
 }
Exemplo n.º 11
0
 /**
  * Ajout des codes pour les Groups
  *
  * @return bool
  */
 protected function addCodeToGroups()
 {
     $ds = CSQLDataSource::get("std");
     $request = new CRequest();
     $request->addSelect(array("group_id", "code", "text"));
     $request->addTable("groups_mediboard");
     $query = $request->makeSelect();
     $groups = $ds->loadList($query);
     foreach ($groups as $_group) {
         $group_id = $_group["group_id"];
         $code = CMbString::makeInitials($_group["text"]);
         $query = $ds->prepare("UPDATE `groups_mediboard` SET `code`=?1 WHERE `group_id`= ?2", $code, $group_id);
         $ds->exec($query);
     }
     return true;
 }
 public function actionDel()
 {
     $cycle = CCorriculumsManager::getCycle(CRequest::getInt("id"));
     $id = $cycle->corriculum_id;
     $cycle->remove();
     $this->redirect("index.php?action=view&id=" . $id);
 }
 public function execute($contextObject)
 {
     $result = array();
     $studyLoad = new CArrayList();
     $load = CIndPlanManager::getLoad(CRequest::getInt("planId"));
     $studyLoad = $load->getWorksByType(2);
     foreach ($studyLoad->getItems() as $row) {
         $dataRow = array();
         $dataRow[0] = count($result) + 1;
         $dataRow[1] = $row->getTitle();
         $dataRow[2] = $row->plan_amount;
         $dataRow[3] = $row->plan_expiration_date;
         $dataRow[4] = $row->plan_report_type;
         $dataRow[5] = $row->isExecuted();
         $dataRow[6] = $row->comment;
         $result[] = $dataRow;
     }
     for ($i = count($result); $i <= 7; $i++) {
         $row = array();
         for ($j = 0; $j <= 6; $j++) {
             $row[$j] = "";
         }
         $result[] = $row;
     }
     return $result;
 }
Exemplo n.º 14
0
 /**
  * Ресурс
  */
 public function setResourceId()
 {
     $this->getRecord()->setItemValue("resource_id", CRequest::getInt("resource_id"));
     if ($this->getType() == "kadri") {
         $this->_resource = CStaffManager::getPersonById($this->getResourceId());
     }
 }
 public function actionDelete()
 {
     $validator = CCoreObjectsManager::getCoreModelFieldValidator(CRequest::getInt("id"));
     $field = $validator->field_id;
     $validator->remove();
     $this->redirect("fields.php?action=edit&id=" . $field);
 }
 public function actionView()
 {
     $page = CPageManager::getPage(CRequest::getInt("id"));
     if (!is_null($page)) {
         $this->setData("page", $page);
         $this->renderView("_pages/public.view.tpl");
     }
 }
Exemplo n.º 17
0
 /**
  * Returns the value of a property of the user's agent, according to the BrowsCap project.
  *
  * The names of the properties and their meanings are defined by the
  * [Browser Capabilities Project](http://browscap.org/).
  *
  * @param  string $propertyName The name of the BrowsCap property.
  *
  * @return CUStringObject The value of the BrowsCap property.
  */
 public static function userAgentProperty($propertyName)
 {
     assert('is_cstring($propertyName)', vs(isset($this), get_defined_vars()));
     if (!isset(self::$ms_browsCap)) {
         self::$ms_browsCap = get_browser(null, true);
     }
     return (string) self::$ms_browsCap[$propertyName];
 }
 /**
  * Получить всех студентов учебной группы
  */
 public function actionGetStudentsByGroup()
 {
     $group = CRequest::getInt("group");
     $res = array();
     foreach (CStaffManager::getStudentGroup($group)->getStudents()->getItems() as $student) {
         $res[$student->getId()] = $student->getName();
     }
     echo json_encode($res);
 }
 public function actionGetQuestionsJSON()
 {
     $arr = array();
     $disc = CTaxonomyManager::getCacheDisciplines()->getItem(CRequest::getInt("id"));
     foreach (CSEBQuestionsManager::getQuestionsByDiscipline($disc)->getItems() as $i) {
         $arr[] = $i->toArrayForJSON();
     }
     echo json_encode($arr);
 }
Exemplo n.º 20
0
 /**
  * 获取请求并处理
  */
 public function GetRequest()
 {
     //处理请求
     ob_start();
     CRequest::getInstance()->run();
     //发送响应
     CResponse::getInstance()->send();
     ob_end_flush();
 }
 public function actionGetViewData()
 {
     $result = array();
     $query = new CQuery();
     $query->select("term.id as id, term.name as name")->from(TABLE_WORK_PLAN_COMPETENTIONS . " as competention")->innerJoin(TABLE_TAXONOMY_TERMS . " as term", "term.id = competention.competention_id")->condition("competention.plan_id=" . CRequest::getInt("plan_id") . " AND competention.type=0")->limit(0, 10);
     foreach ($query->execute()->getItems() as $item) {
         $result[$item["id"]] = $item["name"];
     }
     return $result;
 }
 public function actionPrintIndPlan()
 {
     // складываем из бина параметры
     $bean = self::getStatefullBean();
     $selected = CRequest::getArray("selected");
     $bean->add("planId", $selected[0]);
     // редирект на печать
     $this->redirectNextAction("CPrintController", "PrintWithBeanData");
     return true;
 }
Exemplo n.º 23
0
 public function actionAutosave()
 {
     if (CRequest::getInt("id") !== 0) {
         $help = CHelpManager::getHelp(CRequest::getInt("id"));
         if (!is_null($help)) {
             $help->content = CRequest::getString("content", $help::getClassName());
             $help->save();
         }
     }
 }
 public function actionGetViewData()
 {
     $result = array();
     $plan = CWorkPlanManager::getWorkplan(CRequest::getInt("plan_id"));
     $query = new CQuery();
     $query->select("parent.id as id, subject.name as name")->from(TABLE_CORRICULUM_DISCIPLINES . " as discipline")->innerJoin(TABLE_CORRICULUM_DISCIPLINES . " as parent", "parent.id = discipline.parent_id")->innerJoin(TABLE_DISCIPLINES . " as subject", "parent.discipline_id = subject.id")->condition("discipline.id = " . $plan->corriculum_discipline_id);
     foreach ($query->execute()->getItems() as $item) {
         $result[$item["id"]] = $item["name"];
     }
     return $result;
 }
 public function actionDel()
 {
     $labor = CCorriculumsManager::getLabor(CRequest::getInt("id"));
     if (is_null($labor->section)) {
         $id = $labor->discipline_id;
     } else {
         $id = $labor->section->discipline_id;
     }
     $labor->remove();
     $this->redirect("disciplines.php?action=edit&id=" . $id);
 }
 public function actionGetViewData()
 {
     $result = array();
     // выбор сотрудников
     $query = new CQuery();
     $query->select("category.id as id, category.title as name")->from(TABLE_WORK_PLAN_CONTENT_CATEGORIES . " as category")->condition("plan_id=" . CRequest::getInt("plan_id"))->limit(0, 10);
     foreach ($query->execute()->getItems() as $item) {
         $result[$item["id"]] = $item["name"];
     }
     return $result;
 }
 public function actionGetViewData()
 {
     $result = array();
     // выбор сотрудников
     $query = new CQuery();
     $query->select("term.id as id, term.number as name")->from(TABLE_WORK_PLAN_TERMS . " as term")->condition("plan_id=" . CRequest::getInt("plan_id"))->limit(0, 10);
     foreach ($query->execute()->getItems() as $item) {
         $result[$item["id"]] = $item["name"];
     }
     return $result;
 }
 public function actionGetViewData()
 {
     $result = array();
     // выбор сотрудников
     $query = new CQuery();
     $query->select("term.id as id, disc_term.title as name")->from(TABLE_WORK_PLAN_TERMS . " as term")->innerJoin(TABLE_CORRICULUM_DISCIPLINE_SECTIONS . " as disc_term", "disc_term.id = term.number")->condition("term.plan_id=" . CRequest::getInt("plan_id"))->limit(0, 10);
     foreach ($query->execute()->getItems() as $item) {
         $result[$item["id"]] = $item["name"];
     }
     return $result;
 }
 public function actionGetViewData()
 {
     $result = array();
     $plan = CWorkPlanManager::getWorkplan(CRequest::getInt("plan_id"));
     $discipline = CCorriculumsManager::getDiscipline($plan->corriculum_discipline_id);
     $query = new CQuery();
     $query->select("term.id as id, term.title as name")->from(TABLE_CORRICULUM_DISCIPLINE_SECTIONS . " as term")->condition("discipline_id=" . $discipline->getId());
     foreach ($query->execute()->getItems() as $item) {
         $result[$item["id"]] = $item["name"];
     }
     return $result;
 }
Exemplo n.º 30
0
 /**
  * @return CArrayList
  */
 public static function getCommissions()
 {
     $res = new CArrayList();
     $ids = CRequest::getString("id");
     $ids = explode(":", $ids);
     foreach ($ids as $id) {
         $comm = self::getCommission($id);
         if (!is_null($comm)) {
             $res->add($comm->getId(), $comm);
         }
     }
     return $res;
 }