public function actionGetItem($id)
 {
     $result = array();
     // теперь будет с поддержкой кэша
     $cache_id = $this->taxonomy . "_" . $id;
     if (is_null(CApp::getApp()->cache->get($cache_id))) {
         $term = CTaxonomyManager::getTerm($id);
         if (!is_null($term)) {
             $result[$term->getId()] = $term->getValue();
         }
         CApp::getApp()->cache->set($cache_id, $result, 30);
     }
     return CApp::getApp()->cache->get($cache_id);
 }
 public function actionGetObject($id)
 {
     return CTaxonomyManager::getTerm($id);
 }
 /**
  * Сохранение изменений
  *
  * @return bool
  */
 public function actionManagePersonSave()
 {
     if (!CSession::isAuth()) {
         return true;
     }
     $person = CStaffManager::getPersonById(CRequest::getInt("id"));
     $manager = CStaffManager::getPersonById(CRequest::getInt("manager_id"));
     $role = CTaxonomyManager::getTerm(CRequest::getInt("department_role_id"));
     if (!is_null($manager)) {
         $person->setManager($manager);
     } else {
         $person->setManagerId(0);
     }
     if (!is_null($role)) {
         $person->setRole($role);
     }
     $person->save();
     $this->redirect("?action=manage");
 }
Esempio n. 4
0
 /**
  * Роль на кафедре
  *
  * @return string
  */
 public function getRole()
 {
     if (is_null($this->_role)) {
         if ($this->getRoleId() != 0) {
             $term = CTaxonomyManager::getTerm($this->getRoleId());
             if (!is_null($term)) {
                 $this->_role = $term;
             }
         }
     }
     return $this->_role;
 }
 public function actionEditTerm()
 {
     $term = new CTerm();
     if (CRequest::getInt("id") != 0) {
         $term = CTaxonomyManager::getTerm(CRequest::getInt("id"));
     }
     $this->setData("term", $term);
     $this->renderView("_taxonomy/editTerm.tpl");
 }