public function executeCommand()
 {
     // $this->prepareOutput();
     switch ($this->ctrl->getNextClass($this)) {
         case "ilcontainerstartobjectspagegui":
             $this->checkPermission("write");
             $this->tabs_gui->clearTargets();
             $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "listStructure"));
             include_once "Services/Container/classes/class.ilContainerStartObjectsPage.php";
             if (!ilContainerStartObjectsPage::_exists("cstr", $this->object->getId())) {
                 // doesn't exist -> create new one
                 $new_page_object = new ilContainerStartObjectsPage();
                 $new_page_object->setParentId($this->object->getId());
                 $new_page_object->setId($this->object->getId());
                 $new_page_object->createFromXML();
                 unset($new_page_object);
             }
             $this->ctrl->setReturnByClass("ilcontainerstartobjectspagegui", "edit");
             include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
             $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
             // needed for editor?
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $pgui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0));
             $ret = $this->ctrl->forwardCommand($pgui);
             if ($ret) {
                 $this->tpl->setContent($ret);
             }
             break;
         default:
             $cmd = $this->ctrl->getCmd("listStructure");
             $cmd .= "Object";
             $this->{$cmd}();
             break;
     }
 }
Ejemplo n.º 2
0
 /**
  * Clone container settings
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * @return object new object 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilLog;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     $sorting = new ilContainerSortingSettings($new_obj->getId());
     $sorting->setSortMode($this->getOrderType());
     $sorting->update();
     // copy content page
     include_once "./Services/Container/classes/class.ilContainerPage.php";
     if (ilContainerPage::_exists("cont", $this->getId())) {
         $orig_page = new ilContainerPage($this->getId());
         $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId());
     }
     // #10271 - copy start objects page
     include_once "./Services/Container/classes/class.ilContainerStartObjectsPage.php";
     if (ilContainerStartObjectsPage::_exists("cstr", $this->getId())) {
         $orig_page = new ilContainerStartObjectsPage($this->getId());
         $orig_page->copy($new_obj->getId(), "cstr", $new_obj->getId());
     }
     // #10271
     foreach (self::_getContainerSettings($this->getId()) as $keyword => $value) {
         self::_writeContainerSetting($new_obj->getId(), $keyword, $value);
         // copy custom icons
         if ($keyword == "icon_custom" && $value) {
             // see saveIcons()
             $new_obj->createContainerDirectory();
             $tgt_dir = $new_obj->getContainerDirectory();
             $src_dir = $this->getContainerDirectory();
             $file = "icon_custom.svg";
             $src_file = $src_dir . "/" . $file;
             if (file_exists($src_file)) {
                 copy($src_file, $tgt_dir . "/" . $file);
             }
         }
     }
     return $new_obj;
 }