public function showMoveIntoObjectTreeObject()
 {
     global $ilTabs, $ilToolbar;
     $ilTabs->setTabActive('view_content');
     if (!in_array($_SESSION['clipboard']['cmd'], array('cut'))) {
         $message = __METHOD__ . ": cmd was not 'cut'; may be a hack attempt!";
         $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
     }
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html', "Services/Object");
     require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
     $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_RADIO, 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_cut_repexpand');
     $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showMoveIntoObjectTree'));
     $exp->setTargetGet('ref_id');
     $exp->setPostVar('node');
     $exp->setCheckedItems(array((int) $_POST['node']));
     $exp->highlightNode($_GET['ref_id']);
     if ($_GET['paste_cut_repexpand'] == '') {
         $expanded = $this->tree->readRootId();
     } else {
         $expanded = $_GET['paste_cut_repexpand'];
     }
     $this->tpl->setVariable('FORM_TARGET', '_top');
     $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects'));
     $exp->setExpand($expanded);
     // build html-output
     $exp->setOutput(0);
     $output = $exp->getOutput();
     $this->tpl->setVariable('OBJECT_TREE', $output);
     $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
     $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('paste'));
     $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'cancelMoveLink'));
 }
Esempio n. 2
0
 /**
  * Show target selection
  */
 public function showTargetSelectionTree()
 {
     global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition, $lng;
     $this->tpl = $tpl;
     if ($objDefinition->isContainer($this->getType())) {
         ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_container'));
     } else {
         ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard'));
     }
     //
     include_once "./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php";
     $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
     $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
     $exp->setSelectMode("target", false);
     if ($exp->handleCommand()) {
         return;
     }
     $output = $exp->getHTML();
     // toolbars
     $t = new ilToolbarGUI();
     $t->setFormAction($ilCtrl->getFormAction($this, "saveTarget"));
     if ($objDefinition->isContainer($this->getType())) {
         $t->addFormButton($lng->txt("btn_next"), "saveTarget");
     } else {
         $t->addFormButton($lng->txt("paste"), "saveTarget");
     }
     $t->addSeparator();
     $t->addFormButton($lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
     $t->addFormButton($lng->txt("cancel"), "cancel");
     $t->setCloseFormTag(false);
     $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
     $output = $t->getHTML() . $output;
     $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
     $t->setCloseFormTag(true);
     $t->setOpenFormTag(false);
     $output .= "<br />" . $t->getHTML();
     $this->tpl->setContent($output);
     return;
     // old implementation
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html', "Services/Object");
     include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
     $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_RADIO, 'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=goto', 'paste_copy_repexpand');
     // Target selection should check for create permission
     $required_perm = 'visible';
     $create_perm = 'create_' . ilObject::_lookupType($this->getSource(), true);
     if ($create_perm) {
         $required_perm .= ',' . $create_perm;
     }
     $exp->setRequiredFormItemPermission($required_perm);
     $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showTargetSelectionTree'));
     $exp->setTargetGet('ref_id');
     $exp->setPostVar('target');
     $exp->highlightNode($_GET['ref_id']);
     $exp->setCheckedItems(array((int) $_POST['target']));
     // Filter to container
     foreach (array('cat', 'root', 'crs', 'grp', 'fold') as $container) {
         /*
         if($this->getType() == 'crs' and $container == 'crs')
         {
         	continue;
         }
         */
         $sub = $objDefinition->getSubObjects($container);
         if (!isset($sub[$this->getType()])) {
             $exp->removeFormItemForType($container);
         }
     }
     if ($_GET['paste_copy_repexpand'] == '') {
         $expanded = $tree->readRootId();
     } else {
         $expanded = $_GET['paste_copy_repexpand'];
     }
     $this->tpl->setVariable('FORM_TARGET', '_self');
     $this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection'));
     $exp->setExpand($expanded);
     // build html-output
     $exp->setOutput(0);
     $output = $exp->getOutput();
     $this->tpl->setVariable('OBJECT_TREE', $output);
     $this->tpl->setVariable('CMD_SUBMIT', 'saveTarget');
     if ($objDefinition->isContainer($this->getType())) {
         $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
     } else {
         if (!$objDefinition->isPlugin($this->getType())) {
             $submit = $this->lng->txt('obj_' . $this->getType() . '_duplicate');
         } else {
             // get plugin instance
             include_once "Services/Component/classes/class.ilPlugin.php";
             $plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType()));
             $submit = $plugin->txt('obj_' . $this->getType() . '_duplicate');
         }
         $this->tpl->setVariable('TXT_SUBMIT', $submit);
     }
     $ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this, 'cancel'));
 }