public function actionDelete()
 {
     $order = CSABManager::getSABPersonOrder(CRequest::getInt("id"));
     $person = $order->person_id;
     $order->remove();
     $this->redirect("index.php?action=edit&id=" . $person);
 }
 public function actionGetStatisticReport()
 {
     $commission = CSABManager::getCommission(CRequest::getInt("id"));
     $marks = array();
     $marks[0] = "";
     foreach (CTaxonomyManager::getMarksList() as $id => $mark) {
         if (in_array(mb_strtolower($mark), array("отлично", "хорошо", "удовлетворительно", "неудовлетворительно"))) {
             $marks[$id] = $mark;
         }
     }
     $marks[] = "оценка не указана";
     $report = array();
     /**
      * Добавляем оценки в список
      */
     $row = array();
     foreach ($marks as $mark) {
         $row[] = $mark;
     }
     $report["Оценка"] = $row;
     /**
      * Добавляем оценки по дням
      */
     foreach ($commission->diploms->getItems() as $diplom) {
         $row = array();
         foreach ($marks as $id => $mark) {
             $row[$id] = array("Бюджет" => 0, "Контракт" => 0, "Не указана" => 0);
         }
         $row[0] = array("Бюджет" => 0, "Контракт" => 0, "Не указана" => 0);
         if (array_key_exists(date("d.m.Y", strtotime($diplom->date_act)), $report)) {
             $row = $report[date("d.m.Y", strtotime($diplom->date_act))];
         }
         /**
          * Добавляем оценку в соответствующую колонку
          */
         if (is_null($diplom->mark)) {
             $key = array_search("оценка не указана", $marks);
         } else {
             $key = array_search($diplom->mark->getValue(), $marks);
         }
         /**
          * Статистика по форме обучения
          */
         $student = $diplom->student;
         $byForm = $row[$key];
         if (!is_null($student)) {
             if ($student->getMoneyForm() == "") {
                 $byForm["Не указана"] += 1;
             } else {
                 $byForm[$student->getMoneyForm()] += 1;
             }
         }
         $row[$key] = $byForm;
         $report[date("d.m.Y", strtotime($diplom->date_act))] = $row;
     }
     /**
      * Посчитаем по дням
      * Лучше отдельно, так нагляднее
      */
     foreach ($commission->diploms->getItems() as $diplom) {
         $byForm = $report[date("d.m.Y", strtotime($diplom->date_act))][0];
         $student = $diplom->student;
         if (!is_null($student)) {
             if ($student->getMoneyForm() == "") {
                 $byForm["Не указана"] += 1;
             } else {
                 $byForm[$student->getMoneyForm()] += 1;
             }
         }
         $report[date("d.m.Y", strtotime($diplom->date_act))][0] = $byForm;
     }
     /**
      * Посчитаем всего.
      * Тоже отдельно для наглядности
      */
     $row = array();
     foreach ($marks as $id => $mark) {
         $row[$id] = array("Бюджет" => 0, "Контракт" => 0, "Не указана" => 0);
     }
     foreach ($commission->diploms->getItems() as $diplom) {
         if (is_null($diplom->mark)) {
             $key = array_search("оценка не указана", $marks);
         } else {
             $key = array_search($diplom->mark->getValue(), $marks);
         }
         $byMark = $row[$key];
         $student = $diplom->student;
         if (!is_null($student)) {
             if ($student->getMoneyForm() == "") {
                 $byMark["Не указана"] += 1;
             } else {
                 $byMark[$student->getMoneyForm()] += 1;
             }
         }
         $row[$key] = $byMark;
         /**
          * Полнейшее всего
          */
         $byMark = $row[0];
         $student = $diplom->student;
         if (!is_null($student)) {
             if ($student->getMoneyForm() == "") {
                 $byMark["Не указана"] += 1;
             } else {
                 $byMark[$student->getMoneyForm()] += 1;
             }
         }
         $row[0] = $byMark;
     }
     $report["Всего"] = $row;
     /**
      * Слегка пересортируем элементы массива
      */
     $this->setData("report", $report);
     $this->renderView("_state_attestation/subform.report.statistic.tpl");
 }
 public function actionDelete()
 {
     $commission = CSABManager::getPreviewCommission(CRequest::getInt("id"));
     $commission->remove();
     $this->redirect("?action=index");
 }
 /**
  * @return CArrayList|null
  */
 private static function getCachePreviewCommission()
 {
     if (is_null(self::$_cachePreviewCommission)) {
         self::$_cachePreviewCommission = new CArrayList();
     }
     return self::$_cachePreviewCommission;
 }
 public function actionGetObject($id)
 {
     return CSABManager::getCommission($id);
 }
 public function actionSave()
 {
     $diplom = new CDiplom();
     $diplom->setAttributes(CRequest::getArray($diplom::getClassName()));
     $oldDate = $diplom->date_act;
     if ($diplom->validate()) {
         // дату нужно сконвертить в MySQL date
         $diplom->date_act = date("Y-m-d", strtotime($diplom->date_act));
         $diplom->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $diplom->getId());
         } else {
             $this->redirect(WEB_ROOT . "_modules/_diploms/index.php");
         }
         //$this->redirect("?action=index");
         return true;
     }
     // сконвертим дату из MySQL date в нормальную дату
     $diplom->date_act = date("d.m.Y", strtotime($diplom->date_act));
     $commissions = array();
     foreach (CSABManager::getCommissionsList() as $id => $c) {
         $commission = CSABManager::getCommission($id);
         $nv = $commission->title;
         if (!is_null($commission->manager)) {
             $nv .= " " . $commission->manager->getName();
         }
         if (!is_null($commission->secretar)) {
             $nv .= " (" . $commission->secretar->getName() . ")";
         }
         $cnt = 0;
         foreach ($commission->diploms->getItems() as $d) {
             if (strtotime($diplom->date_act) == strtotime($d->date_act)) {
                 $cnt++;
             }
         }
         $nv .= " " . $cnt;
         $commissions[$commission->getId()] = $nv;
     }
     if (!array_key_exists($diplom->gak_num, $commissions)) {
         $diplom->gak_num = null;
     }
     $reviewers = CStaffManager::getPersonsListWithType(TYPE_REVIEWER);
     if (!array_key_exists($diplom->recenz_id, $reviewers)) {
         $reviewer = CStaffManager::getPerson($diplom->recenz_id);
         if (!is_null($reviewer)) {
             $reviewers[$reviewer->getId()] = $reviewer->getName();
         }
     }
     $this->setData("reviewers", $reviewers);
     $this->setData("commissions", $commissions);
     $this->setData("diplom", $diplom);
     $this->renderView("_diploms/edit.tpl");
 }