public function actionSaveGroup() { $group = new CExamGroupAdd(); $group->setAttributes(CRequest::getArray($group::getClassName())); $texts = explode(chr(13), $group->text); foreach ($texts as $text) { $q = new CExamQuestion(); $q->speciality_id = $group->speciality_id; $q->course = $group->course; $q->year_id = $group->year_id; $q->category_id = $group->category_id; $q->discipline_id = $group->discipline_id; $q->text = trim($text); $q->save(); } $this->redirect("?action=index"); }
public function actionSave() { $object = new CExamQuestion(); $object->setAttributes(CRequest::getArray($object::getClassName())); if ($object->validate()) { $object->save(); if ($this->continueEdit()) { $this->redirect("workplanexamquestions.php?action=edit&id=" . $object->getId()); } else { $this->redirect("workplanexamquestions.php?action=index&plan_id=" . $object->plan_id . "&type=" . $object->type); } return true; } $this->setData("object", $object); $this->renderView("_corriculum/_workplan/examQuestions/edit.tpl"); }