Beispiel #1
0
 /**
  * Clone poll
  *
  * @param ilObjPoll new object
  * @param int target ref_id
  * @param int copy id
  * @return ilObjPoll
  */
 public function doCloneObject(ilObjPoll $new_obj, $a_target_id, $a_copy_id = 0)
 {
     // question/image
     $new_obj->setQuestion($this->getQuestion());
     $image = $this->getImageFullPath();
     if ($image) {
         $image = array("tmp_name" => $image, "name" => $this->getImage());
         $new_obj->uploadImage($image, true);
     }
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOnline($this->isOnline());
     }
     $new_obj->setViewResults($this->getViewResults());
     $new_obj->setShowComments($this->getShowComments());
     $new_obj->setShowResultsAs($this->getShowResultsAs());
     $new_obj->update();
     // answers
     $answers = $this->getAnswers();
     if ($answers) {
         foreach ($answers as $item) {
             $new_obj->saveAnswer($item["answer"]);
         }
     }
     return $new_obj;
 }
 /**
  * Clone poll
  *
  * @param ilObjPoll new object
  * @param int target ref_id
  * @param int copy id
  * @return ilObjPoll
  */
 public function doCloneObject(ilObjPoll $new_obj, $a_target_id, $a_copy_id = 0)
 {
     // question/image
     $new_obj->setQuestion($this->getQuestion());
     $image = $this->getImageFullPath();
     if ($image) {
         $image = array("tmp_name" => $image, "name" => $this->getImage());
         $new_obj->uploadImage($image, true);
     }
     $new_obj->setViewResults($this->getViewResults());
     $new_obj->update();
     // answers
     $answers = $this->getAnswers();
     if ($answers) {
         foreach ($answers as $item) {
             $new_obj->saveAnswer($item["answer"]);
         }
     }
     return $new_obj;
 }