public function actionSave()
 {
     $object = new CWorkPlanTerm();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("workplanterms.php?action=edit&id=" . $object->getId());
         } else {
             $this->redirect("workplanterms.php?action=index&plan_id=" . $object->plan_id);
         }
         return true;
     }
     $this->setData("object", $object);
     $this->renderView("_corriculum/_workplan/terms/edit.tpl");
 }
 public function actionUpdate()
 {
     $plan = CWorkPlanManager::getWorkplan(CRequest::getInt("plan_id"));
     if (!is_null($plan->corriculumDiscipline)) {
         foreach (CActiveRecordProvider::getWithCondition(TABLE_CORRICULUM_DISCIPLINE_SECTIONS, "discipline_id=" . $plan->corriculumDiscipline->getId())->getItems() as $ar) {
             $term = new CActiveModel($ar);
             $object = new CWorkPlanTerm();
             $object->plan_id = $plan->getId();
             $object->number = $term->getId();
             $object->save();
         }
     }
     $this->redirect("workplanterms.php?action=index&plan_id=" . $plan->getId());
 }