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 actionSaveGroup() { $plan = CWorkPlanManager::getWorkplan(CRequest::getInt("id")); $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->plan_id = $group->plan_id; $q->type = $group->type; $q->text = trim($text); $q->save(); } $this->redirect("workplanexamquestions.php?action=index&plan_id=" . $q->plan_id . "&type=" . $q->type); }