/**
  * Clone assignments of exercise
  *
  * @param
  * @return
  */
 function cloneAssignmentsOfEphorus($a_old_eph_id, $a_new_eph_id)
 {
     $ass_data = ilEphAssignment::getAssignmentDataOfEphorus($a_old_eph_id);
     foreach ($ass_data as $d) {
         // clone assignment
         $new_ass = new ilEphAssignment();
         $new_ass->setEphorusId($a_new_eph_id);
         $new_ass->setTitle($d["title"]);
         $new_ass->setDeadline($d["deadline"]);
         $new_ass->setDeadline($d["deadline"]);
         $new_ass->setInstruction($d["instruction"]);
         $new_ass->setMandatory($d["mandatory"]);
         $new_ass->setOrderNr($d["order_val"]);
         $new_ass->setStartTime($d["start_time"]);
         $new_ass->save();
         // clone assignment files
         /* include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilFSStorageEphorus.php");
                     $old_storage = new ilFSStorageEphorus($a_old_eph_id, (int) $d["id"]);
                     $new_storage = new ilFSStorageEphorus($a_new_eph_id, (int) $new_ass->getId());
                     $new_storage->create();
         
                     if (is_dir($old_storage->getPath()))
                     {
                         ilUtil::rCopy($old_storage->getPath(), $new_storage->getPath());
                     }*/
     }
 }
 /**
  * Save assignment
  *
  */
 public function saveAssignment()
 {
     global $tpl, $lng, $ilCtrl, $ilTabs;
     $ilTabs->activateTab("overview");
     $this->addOverviewSubTabs("list_assignments");
     $this->initAssignmentForm();
     if ($this->form->checkInput()) {
         include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
         // additional checks
         if ($_POST["start_time_cb"]) {
             // check whether start date is before end date
             $start_date = $this->form->getItemByPostVar("start_time")->getDate();
             $end_date = $this->form->getItemByPostVar("deadline")->getDate();
             if ($start_date->get(IL_CAL_UNIX) >= $end_date->get(IL_CAL_UNIX)) {
                 ilUtil::sendFailure($lng->txt("form_input_not_valid"), true);
                 $this->form->getItemByPostVar("start_time")->setAlert($lng->txt("start_date_should_be_before_end_date"));
                 $this->form->getItemByPostVar("deadline")->setAlert($lng->txt("start_date_should_be_before_end_date"));
                 $this->form->setValuesByPost();
                 $tpl->setContent($this->form->getHtml());
                 return;
             }
         }
         $ass = new ilEphAssignment();
         $ass->setTitle($_POST["title"]);
         $ass->setInstruction($_POST["instruction"]);
         $ass->setEphorusId($this->object->getId());
         $ass->setMandatory($_POST["mandatory"]);
         if ($_POST["start_time_cb"]) {
             $date = $this->form->getItemByPostVar("start_time")->getDate();
             $ass->setStartTime($date->get(IL_CAL_UNIX));
         } else {
             $ass->setStartTime(null);
         }
         // deadline
         $date = $this->form->getItemByPostVar("deadline")->getDate();
         $ass->setDeadline($date->get(IL_CAL_UNIX));
         $ass->save($this->object);
         // save files
         $ass->uploadAssignmentFiles($_FILES["files"]);
         ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
         $ilCtrl->redirect($this, "listAssignments");
     } else {
         $this->form->setValuesByPost();
         $tpl->setContent($this->form->getHtml());
     }
 }