/** * Инициализация вопросов для всех билетов, которые есть в базе * * @static */ public static function initQuestions() { foreach (CActiveRecordProvider::getAllFromTable(TABLE_SEB_QUSTIONS_IN_TICKETS)->getItems() as $i) { if (self::getCacheTickets()->hasElement($i->getItemValue("ticket_id"))) { $question = CSEBQuestionsManager::getQuestion($i->getItemValue("question_id")); $ticket = self::getCacheTickets()->getItem($i->getItemValue("ticket_id")); $ticket->addQuestion($question); } } }
public function actionSave() { if (CRequest::getInt("id") == 0) { $ticket = CFactory::createSebTicket(); } else { $ticket = CSEBTicketsManager::getTicket(CRequest::getInt("id")); } foreach (CRequest::getArray("question") as $i) { $q = CSEBQuestionsManager::getQuestion($i); if (!is_null($q)) { $ticket->addQuestion($q); } } $ticket->setSpeciality(CTaxonomyManager::getCacheSpecialities()->getItem(CRequest::getInt("speciality_id"))); $ticket->setYear(CTaxonomyManager::getCacheYears()->getItem(CRequest::getInt("year_id"))); $ticket->setProtocol(CProtocolManager::getDepProtocol(CRequest::getInt("protocol_id"))); $ticket->setSigner(CStaffManager::getPersonById(CRequest::getInt("signer_id"))); $ticket->setNumber(CRequest::getInt("number")); $ticket->save(); $this->redirect("?action=index"); }
public function actionEdit() { $q = CSEBQuestionsManager::getQuestion(CRequest::getInt("id")); $this->setData("question", $q); $this->renderView("_state_exam/_questions/edit.tpl"); }
/** * Вопросы в билете * * @return CArrayList */ public function getQuestions() { if (is_null($this->_questions)) { $this->_questions = new CArrayList(); foreach (CActiveRecordProvider::getWithCondition(TABLE_SEB_QUSTIONS_IN_TICKETS, "ticket_id=" . $this->getId())->getItems() as $r) { $q = CSEBQuestionsManager::getQuestion($r->getItemValue("question_id")); if (!is_null($q)) { $this->_questions->add($q->getId(), $q); } } } return $this->_questions; }