public function actionSave()
 {
     $object = new CCorriculumDisciplineCompetention();
     $object->setAttributes(CRequest::getArray($object::getClassName()));
     if ($object->validate()) {
         $object->save();
         if ($this->continueEdit()) {
             $this->redirect("competentions.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/_competentions/edit.tpl");
 }
 public function actionCopyCompetentions()
 {
     $plan = CWorkPlanManager::getWorkplan(CRequest::getInt("id"));
     $corriculumDiscipline = $plan->corriculumDiscipline;
     $type = CRequest::getInt("type");
     foreach ($plan->competentionsFormed->getItems() as $competentionFormed) {
         $newItem = new CCorriculumDisciplineCompetention();
         $newItem->discipline_id = $corriculumDiscipline->getId();
         $newItem->competention_id = $competentionFormed->competention_id;
         $newItem->level_id = $competentionFormed->level_id;
         foreach ($competentionFormed->knowledges->getItems() as $knowledge) {
             $newItem->knowledges->add($knowledge->getId(), $knowledge->getId());
         }
         foreach ($competentionFormed->skills->getItems() as $skill) {
             $newItem->skills->add($skill->getId(), $skill->getId());
         }
         foreach ($competentionFormed->experiences->getItems() as $experience) {
             $newItem->experiences->add($experience->getId(), $experience->getId());
         }
         $newItem->save();
     }
     $this->redirect("workplancompetentions.php?action=index&plan_id=" . $plan->getId() . "&type=" . $type);
 }