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 actionSave()
 {
     $arr = CRequest::getArray("CModel");
     if ($arr["work_type"] == "1") {
         $load = CIndPlanManager::getLoad($arr["load_id"]);
         $object = new CIndPlanPersonLoadTable($load);
         $object->setAttributes(CRequest::getArray($object::getClassName()));
         if ($object->validate()) {
             $object->save();
             if ($this->continueEdit()) {
                 $this->redirect("work.php?action=add&id=" . $object->getLoad()->getId() . "&type=1" . "&year=" . $object->getLoad()->year_id);
             } else {
                 $this->redirect("load.php?action=view&id=" . $object->getLoad()->person_id . "&year=" . $object->getLoad()->year_id);
             }
             return true;
         }
     } else {
         $object = new CIndPlanPersonWork();
         $object->setAttributes(CRequest::getArray($object::getClassName()));
         if ($object->validate()) {
             $object->save();
             if ($this->continueEdit()) {
                 $this->redirect("work.php?action=edit&id=" . $object->getId() . "&year=" . $object->load->year_id);
             } else {
                 $this->redirect("load.php?action=view&id=" . $object->load->person_id . "&year=" . $object->load->year_id);
             }
             return true;
         }
     }
     $this->setData("object", $object);
     $this->renderView("_individual_plan/work/edit.tpl");
 }
 public function actionWizardCompleted()
 {
     $sign_date = CRequest::getString("sign_date");
     $chairman = CStaffManager::getPersonById(CRequest::getInt("chairman_id"));
     $master = CStaffManager::getPersonById(CRequest::getInt("master_id"));
     $members = new CArrayList();
     foreach (CRequest::getArray("members") as $m) {
         $member = CStaffManager::getPersonById($m);
         $members->add($member->getId(), $member);
     }
     CProtocolManager::getAllSebProtocols();
     // на студента по протоколу
     foreach (CRequest::getArray("student") as $key => $value) {
         $student = CStaffManager::getStudent($key);
         $ticket = CSEBTicketsManager::getTicket($value['ticket_id']);
         $mark = CTaxonomyManager::getMark($value['mark_id']);
         $questions = $value['questions'];
         $protocol = CFactory::createSebProtocol();
         $protocol->setSignDate($sign_date);
         $protocol->setStudent($student);
         $protocol->setChairman($chairman);
         $protocol->setTicket($ticket);
         $protocol->setMark($mark);
         $protocol->setQuestions($questions);
         $protocol->setBoarMaster($master);
         $protocol->setSpeciality($student->getSpeciality());
         foreach ($members->getItems() as $member) {
             $protocol->addMember($member);
         }
         $protocol->setNumber(CProtocolManager::getAllSebProtocols()->getCount() + 1);
         $protocol->save();
         CProtocolManager::getCacheSebProtocols()->add($protocol->getId(), $protocol);
     }
     $this->redirect("?action=index");
 }
 /**
  * Сохранение пункта меню
  */
 public function actionSaveItem()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $item = new CMenuItem();
     $item->setAttributes(CRequest::getArray(CMenuItem::getClassName()));
     if ($item->validate()) {
         $item->save();
         // сохранение ролей. удаляем старые, записываем новые
         foreach (CActiveRecordProvider::getWithCondition(TABLE_MENU_ITEMS_ACCESS, "item_id = " . $item->id)->getItems() as $val) {
             $val->remove();
         }
         // делаем новые и сохраняем их
         $items = CRequest::getArray(CMenuItem::getClassName());
         if (array_key_exists("roles", $items)) {
             foreach ($items["roles"] as $role) {
                 $r = new CMenuItemRole();
                 $r->item_id = $item->id;
                 $r->role_id = $role;
                 $r->save();
             }
         }
         $this->redirect("?action=view&id=" . $item->getMenu()->getId());
     }
     $this->setData("item", $item);
     $this->setData("menu", CMenuManager::getMenu(CRequest::getInt("menu_id", CMenuItem::getClassName())));
     $this->renderView("_menumanager/editItem.tpl");
 }
 public function actionWizardCompleted()
 {
     $speciality = CTaxonomyManager::getCacheSpecialities()->getItem(CRequest::getInt("speciality_id"));
     $year = CTaxonomyManager::getCacheYears()->getItem(CRequest::getInt("year_id"));
     $protocol = CProtocolManager::getDepProtocol(CRequest::getInt("protocol_id"));
     $signer = CStaffManager::getPersonById(CRequest::getInt("signer_id"));
     $disciplines = new CArrayList();
     foreach (CRequest::getArray("discipline") as $i) {
         $disciplines->add($disciplines->getCount(), CDisciplinesManager::getDiscipline($i));
     }
     // бегаем по циклу столько раз, сколько нам билетов нужно
     for ($i = 1; $i <= CRequest::getInt("count"); $i++) {
         $ticket = CFactory::createSebTicket();
         $ticket->setSpeciality($speciality);
         $ticket->setYear($year);
         $ticket->setProtocol($protocol);
         $ticket->setSigner($signer);
         $ticket->setNumber($i);
         foreach ($disciplines->getItems() as $disc) {
             if ($disc->getQuestions()->getCount() == 0) {
                 break;
             }
             $question = $disc->getQuestions()->getShuffled()->getFirstItem();
             $disc->getQuestions()->removeItem($question->getId());
             $ticket->addQuestion($question);
         }
         $ticket->save();
     }
     $this->redirect("?action=index");
 }
 public function actionPrintIndPlan()
 {
     // складываем из бина параметры
     $bean = self::getStatefullBean();
     $selected = CRequest::getArray("selected");
     $bean->add("planId", $selected[0]);
     // редирект на печать
     $this->redirectNextAction("CPrintController", "PrintWithBeanData");
     return true;
 }
 public function actionSave()
 {
     $formset = new CPrintFormset();
     $formset->setAttributes(CRequest::getArray($formset::getClassName()));
     if ($formset->validate()) {
         $formset->save();
         $this->redirect("?action=index");
     }
     $this->setData("set", $formset);
     $this->renderView("_print/formset/edit.tpl");
 }
 public function actionSave()
 {
     $order = new CSABPersonOrder();
     $order->setAttributes(CRequest::getArray($order::getClassName()));
     if ($order->validate()) {
         $order->save();
         $this->redirect("index.php?action=edit&id=" . $order->person_id);
         return true;
     }
     $this->setData("order", $order);
     $this->renderView("_staff/order_sab/edit.tpl");
 }
 public function actionSave()
 {
     $rate = new CRate();
     $rate->setAttributes(CRequest::getArray($rate::getClassName()));
     if ($rate->validate()) {
         $rate->save();
         $this->redirect("?action=index");
         return true;
     }
     $this->setData("rate", $rate);
     $this->renderView("_rates/rate/edit.tpl");
 }
 public function actionSave()
 {
     $speciality = new CSpeciality();
     $speciality->setAttributes(CRequest::getArray($speciality::getClassName()));
     if ($speciality->validate()) {
         $speciality->save();
         $this->redirect("?action=index");
         return true;
     }
     $this->setData("speciality", $speciality);
     $this->renderView("_specialities/edit.tpl");
 }
 public function actionSave()
 {
     $corriculum = new CCorriculum();
     $corriculum->setAttributes(CRequest::getArray($corriculum::getClassName()));
     if ($corriculum->validate()) {
         $corriculum->save();
         $this->redirect("?action=view&id=" . $corriculum->getId());
         return true;
     }
     $this->setData("corriculum", $corriculum);
     $this->addCSSInclude(JQUERY_UI_CSS_PATH);
     $this->addJSInclude(JQUERY_UI_JS_PATH);
     $this->renderView("_corriculum/_plan/edit.tpl");
 }
 public function actionSave()
 {
     $t = new CCoreModelFieldTranslation();
     $t->setAttributes(CRequest::getArray($t::getClassName()));
     if ($t->validate()) {
         $t->save();
         if ($this->continueEdit()) {
             $this->redirect("translations.php?action=edit&id=" . $t->getId());
         } else {
             $this->redirect("fields.php?action=edit&id=" . $t->field_id);
         }
     }
     $this->setData("translation", $t);
     $this->renderView("_core/translation/edit.tpl");
 }
 public function actionSave()
 {
     $checkboxes = array("dashboard_enabled", "dashboard_show_birthdays", "dashboard_show_messages", "dashboard_show_all_tasks", "dashboard_check_messages");
     $settings = new CUserSettings();
     $settings->setAttributes(CRequest::getArray($settings::getClassName()));
     foreach ($checkboxes as $box) {
         if (!array_key_exists($box, CRequest::getArray($settings::getClassName()))) {
             $settings->{$box} = 0;
         }
     }
     if ($settings->validate()) {
         $settings->save();
         $this->redirect("?action=index");
     }
 }
 public function actionSave()
 {
     $child = new CPersonChild();
     $child->setAttributes(CRequest::getArray($child::getClassName()));
     if ($child->validate()) {
         $child->birth_date = date("Y-m-d", strtotime($child->birth_date));
         $child->save();
         $this->redirect("index.php?action=edit&id=" . $child->kadri_id);
         return true;
     }
     $this->addJSInclude(JQUERY_UI_JS_PATH);
     $this->addCSSInclude(JQUERY_UI_CSS_PATH);
     $this->setData("child", $child);
     $this->renderView("_staff/child/add.tpl");
 }
 public function actionSave()
 {
     $object = new CWorkPlanSelfEducationBlock();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("workplanselfeducationblocks.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("workplancontentloads.php?action=edit&id=" . $object->load_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_corriculum/_workplan/selfEducationBlocks/edit.tpl");
 }
 public function actionSave()
 {
     $form = new CSABCommissionForm();
     $form->setAttributes(CRequest::getArray($form::getClassName()));
     if ($form->validate()) {
         $form->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $form->commission->getId());
         } else {
             $this->redirect("?action=index");
         }
         return true;
     }
     $this->setData("form", $form);
     $this->renderView("_state_attestation/edit.tpl");
 }
 public function actionSave()
 {
     $p = new CCorriculumPractice();
     $p->setAttributes(CRequest::getArray($p::getClassName()));
     if ($p->validate()) {
         $p->save();
         if ($this->continueEdit()) {
             $this->redirect("practices.php?action=edit&id=" . $p->getId());
         } else {
             $this->redirect("index.php?action=edit&id=" . $p->corriculum_id);
         }
         return true;
     }
     $this->setData("practice", $p);
     $this->renderView("_corriculum/_practices/edit.tpl");
 }
 public function actionSave()
 {
     $object = new CWorkPlanContentSectionLoadTechnology();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("workplancontenttechnologies.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("workplancontentloads.php?action=edit&id=" . $object->load_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_corriculum/_workplan/contentTechnology/edit.tpl");
 }
 public function actionSave()
 {
     $object = new CDashboardReport();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("reports.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("index.php?action=index");
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_dashboard/report/edit.tpl");
 }
 public function actionSave()
 {
     $load = new CIndPlanPersonLoad();
     $load->setAttributes(CRequest::getArray($load::getClassName()));
     if ($load->validate()) {
         $load->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $load->getId() . "&year=" . $load->year_id);
         } else {
             $this->redirect("?action=view&id=" . $load->person_id . "&year=" . $load->year_id);
         }
         return true;
     }
     $this->setData("load", $load);
     $this->renderView("_individual_plan/load/add.tpl");
 }
 public function actionSave()
 {
     $cycle = new CCorriculumCycle();
     $cycle->setAttributes(CRequest::getArray($cycle::getClassName()));
     if ($cycle->validate()) {
         $cycle->save();
         if ($this->continueEdit()) {
             $this->redirect("cycles.php?action=edit&id=" . $cycle->getId());
         } else {
             $this->redirect("index.php?action=view&id=" . $cycle->corriculum->getId());
         }
         return true;
     }
     $this->setData("cycle", $cycle);
     $this->renderView("_corriculum/_cycles/add.tpl");
 }
 public function actionSave()
 {
     $object = new CPersonPaper();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("papers.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("index.php?action=edit&id=" . $object->kadri_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_staff/paper/edit.tpl");
 }
 public function actionSave()
 {
     $object = new CCoreModelTask();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("tasks.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("models.php?action=edit&id=" . $object->model_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_core/task/edit.tpl");
 }
 public function actionSave()
 {
     $year = new CTimeIntervals();
     $year->setAttributes(CRequest::getArray($year::getClassName()));
     if ($year->validate()) {
         $year->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $year->getId());
         } else {
             $this->redirect("index.php?action=index");
         }
         return true;
     }
     $this->setData("year", $year);
     $this->renderView("_time_intervals/edit.tpl");
 }
 public function actionSave()
 {
     $object = new CNMSProtocolAgendaPoint();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("point.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("index.php?action=edit&id=" . $object->protocol_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_protocols_nms/agendaPoint/edit.tpl");
 }
 public function actionSave()
 {
     $object = new CDocumentFile();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         $this->redirect("index.php?action=index&parent=" . $object->folder_id);
         return true;
     }
     /**
      * Генерация меню
      */
     $this->addActionsMenuItem(array("title" => "Назад", "link" => "index.php?action=index&parent=" . $object->folder_id, "icon" => "actions/edit-undo.png"));
     $this->setData("object", $object);
     $this->renderView("_documents/_file/edit.tpl");
 }
 public function actionSave()
 {
     $object = new CWorkPlanGoal();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("workplangoals.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("workplans.php?action=edit&id=" . $object->plan_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_corriculum/_workplan/goal/edit.tpl");
 }
 public function actionSave()
 {
     $validator = new CCoreModelFieldValidator();
     $validator->setAttributes(CRequest::getArray($validator::getClassName()));
     if ($validator->validate()) {
         $validator->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $validator->getId());
         } else {
             $this->redirect("fields.php?action=edit&id=" . $validator->field_id);
         }
         return true;
     }
     $this->setData("validator", $validator);
     $this->renderView("_core/fieldvalidator/edit.tpl");
 }
 public function actionSave()
 {
     $object = new CCorriculumDisciplineSection();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("disciplineSections.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("disciplines.php?action=edit&id=" . $object->discipline_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_corriculum/_disciplineSections/edit.tpl");
 }
 public function actionSave()
 {
     $task = new CUserRole();
     $task->setAttributes(CRequest::getArray($task::getClassName()));
     if ($task->validate()) {
         $task->save();
         if ($this->continueEdit()) {
             $this->redirect("tasks.php?action=edit&id=" . $task->getId());
         } else {
             $this->redirect("tasks?action=index");
         }
         return true;
     }
     $this->setData("task", $task);
     $this->renderView("_users/tasks/edit.tpl");
 }