/**
  * Автоподстановка индексов
  */
 public function actionGetIndexes()
 {
     $indexes = $_GET["data"]["term"];
     $res = array();
     $tmpRes = new CArrayList();
     foreach (CActiveRecordProvider::getWithCondition(TABLE_RATING_INDEXES, "title LIKE '%{$indexes}%'")->getItems() as $item) {
         $index = CRatingManager::getRatingIndex($item->getItemValue("id"));
         if (!is_null($index)) {
             $tmpRes->add($index->title, $index);
         }
     }
     foreach ($tmpRes->getItems() as $index) {
         $res[] = array("label" => $index->title, "value" => $index->title);
     }
     echo json_encode($res);
 }
 public function actionDelete()
 {
     $index = CRatingManager::getRatingIndex(CRequest::getInt("id"));
     if (!is_null($index)) {
         foreach ($index->getIndexValues()->getItems() as $value) {
             if (!is_null($value->id)) {
                 $value->remove();
             }
         }
         $index->remove();
     }
     $this->redirect("?action=index");
 }
 public function actionView()
 {
     $thisPerson = CStaffManager::getPerson(CRequest::getInt("id"));
     if (is_null($thisPerson)) {
         $this->redirectNoAccess();
     }
     $year = CTaxonomyManager::getYear(CRequest::getInt("year"));
     $this->setData("year", $year);
     $this->setData("person", $thisPerson);
     /**
      * С человеком есть связанные показатели. Надо взять глобальные объекты этих
      * показателей и посчитать их значения по всем людям в указанном году.
      *
      * Берем через менеджер, так как у персона свои личные показатели.
      */
     $indexes = new CArrayList();
     foreach ($thisPerson->getRatingIndexesByYear($year)->getItems() as $index) {
         $index = CRatingManager::getRatingIndex($index->getId());
         $indexes->add($index->getId(), $index);
     }
     $this->setData("indexes", $indexes);
     $this->renderView("_rating/person/view.tpl");
 }