/** * Get menu items */ function getMenuItems($a_node, $a_depth, $a_first_child = false, $a_next_sibling = null, $a_childs = null) { global $lng, $ilUser; include_once "./Services/Style/classes/class.ilPageLayout.php"; $page_layouts = count(ilPageLayout::activeLayouts()) > 0; $special_pages = count(ilPageLayout::activeLayouts(true)) > 0; $cmds = array(); //echo "+".$a_depth."-"; if (!$a_first_child) { // page inserts if ($a_node["type"] == "page" || $a_node["type"] == "sco" && count($a_childs) == 0 || $a_node["type"] == "ass" && count($a_childs) == 0) { if ($a_node["type"] == "sco" || $a_node["type"] == "ass") { $cmds[] = array("text" => $lng->txt("sahs_insert_page"), "cmd" => "insertPage", "multi" => 10, "as_subitem" => true); if ($page_layouts > 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_pagelayout"), "cmd" => "insertTemplateGUI", "multi" => 10, "as_subitem" => true); } if ($special_pages > 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_special_page"), "cmd" => "insertSpecialPage", "multi" => 10, "as_subitem" => true); } if ($ilUser->clipboardHasObjectsOfType("page")) { $cmds[] = array("text" => $lng->txt("sahs_insert_page_from_clip"), "cmd" => "insertPageClip", "as_subitem" => true); } } else { $cmds[] = array("text" => $lng->txt("sahs_insert_page"), "cmd" => "insertPage", "multi" => 10); if ($page_layouts > 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_pagelayout"), "cmd" => "insertTemplateGUI", "multi" => 10); } if ($special_pages > 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_special_page"), "cmd" => "insertSpecialPage", "multi" => 10); } if ($ilUser->clipboardHasObjectsOfType("page")) { $cmds[] = array("text" => $lng->txt("sahs_insert_page_from_clip"), "cmd" => "insertPageClip"); } } } // sco/asset inserts... in/after chapters if ($a_node["type"] == "chap" || $a_node["type"] == "seqc") { $cmds[] = array("text" => $lng->txt("sahs_insert_ass"), "cmd" => "insertAsset", "multi" => 10); if (count($a_childs) == 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_ass_inside_chap"), "cmd" => "insertAsset", "multi" => 10, "as_subitem" => true); } $cmds[] = array("text" => $lng->txt("sahs_insert_sco"), "cmd" => "insertSco", "multi" => 10); if (count($a_childs) == 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_sco_inside_chap"), "cmd" => "insertSco", "multi" => 10, "as_subitem" => true); } if ($ilUser->clipboardHasObjectsOfType("sco")) { $cmds[] = array("text" => $lng->txt("sahs_insert_sco_from_clip"), "cmd" => "insertScoClip", "as_subitem" => false); if (count($a_childs) == 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_sco_from_clip_inside_chap"), "cmd" => "insertScoClip", "as_subitem" => true); } } if ($ilUser->clipboardHasObjectsOfType("ass")) { $cmds[] = array("text" => $lng->txt("sahs_insert_ass_from_clip"), "cmd" => "insertAssetClip", "as_subitem" => false); if (count($a_childs) == 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_ass_from_clip_inside_chap"), "cmd" => "insertAssetClip", "as_subitem" => true); } } } // sco/asset inserts... after sco/assets if ($a_node["type"] == "sco" || $a_node["type"] == "ass") { // scos $cmds[] = array("text" => $lng->txt("sahs_insert_sco"), "cmd" => "insertSco", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("sco")) { $cmds[] = array("text" => $lng->txt("sahs_insert_sco_from_clip"), "cmd" => "insertScoClip"); } // assets $cmds[] = array("text" => $lng->txt("sahs_insert_ass"), "cmd" => "insertAsset", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("ass")) { $cmds[] = array("text" => $lng->txt("sahs_insert_ass_from_clip"), "cmd" => "insertAssetClip"); } // chapters if ($a_node["depth"] == 2) { $cmds[] = array("text" => $lng->txt("sahs_insert_chapter"), "cmd" => "insertChapter", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("chap")) { $cmds[] = array("text" => $lng->txt("sahs_insert_chap_from_clip"), "cmd" => "insertChapterClip"); } } } //if ($a_node["type"] == "chap") //{ // $cmds[] = array("text" => $lng->txt("sahs_insert_sub_chapter"), "cmd" => "insertSubchapter", "multi" => 10); //} // chapter inserts if ($a_node["type"] == "chap" || $a_node["type"] == "seqc") { $cmds[] = array("text" => $lng->txt("sahs_insert_chapter"), "cmd" => "insertChapter", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("chap")) { $cmds[] = array("text" => $lng->txt("sahs_insert_chap_from_clip"), "cmd" => "insertChapterClip"); } //check if parent chaper has sequencing scenario // $cmds[] = array("text" => $lng->txt("sahs_insert_scenario"), "cmd" => "insertScenarioGUI", "multi" => 0); } } else { if ($a_node["type"] == "" && $a_node["node_id"] == 1) { // scos $cmds[] = array("text" => $lng->txt("sahs_insert_sco"), "cmd" => "insertSco", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("sco")) { $cmds[] = array("text" => $lng->txt("sahs_insert_sco_from_clip"), "cmd" => "insertScoClip"); } // assets $cmds[] = array("text" => $lng->txt("sahs_insert_ass"), "cmd" => "insertAsset", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("ass")) { $cmds[] = array("text" => $lng->txt("sahs_insert_ass_from_clip"), "cmd" => "insertAssetClip"); } // chapters $cmds[] = array("text" => $lng->txt("sahs_insert_chapter"), "cmd" => "insertChapter", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("chap")) { $cmds[] = array("text" => $lng->txt("sahs_insert_chap_from_clip"), "cmd" => "insertChapterClip"); } // $cmds[] = array("text" => $lng->txt("sahs_insert_scenario"), "cmd" => "insertScenarioGUI", "multi" => 0); } if ($a_node["type"] == "chap" || $a_node["type"] == "seqc") { $cmds[] = array("text" => $lng->txt("sahs_insert_sco"), "cmd" => "insertSco", "multi" => 10); $cmds[] = array("text" => $lng->txt("sahs_insert_ass"), "cmd" => "insertAsset", "multi" => 10); if ($ilUser->clipboardHasObjectsOfType("sco")) { $cmds[] = array("text" => $lng->txt("sahs_insert_sco_from_clip"), "cmd" => "insertScoClip"); } if ($ilUser->clipboardHasObjectsOfType("ass")) { $cmds[] = array("text" => $lng->txt("sahs_insert_ass_from_clip"), "cmd" => "insertAssetClip"); } } if ($a_node["type"] == "sco" || $a_node["type"] == "ass") { $cmds[] = array("text" => $lng->txt("sahs_insert_page"), "cmd" => "insertPage", "multi" => 10); if ($page_layouts > 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_pagelayout"), "cmd" => "insertTemplateGUI", "multi" => 10); } if ($special_pages > 0) { $cmds[] = array("text" => $lng->txt("sahs_insert_special_page"), "cmd" => "insertSpecialPage", "multi" => 10); } if ($ilUser->clipboardHasObjectsOfType("page")) { $cmds[] = array("text" => $lng->txt("sahs_insert_page_from_clip"), "cmd" => "insertPageClip"); } } /* if ($a_childs["type"] == "") { $cmds[] = array("text" => "insert Chapter", "cmd" => "insertChapter", "multi" => 10); }*/ } return $cmds; }
protected function initCreateForm($a_new_type) { global $ilSetting; $this->ctrl->setParameter($this, "new_type", $this->getType()); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); // title $ti = new ilTextInputGUI($this->lng->txt("title"), "title"); $ti->setSize(min(40, ilObject::TITLE_LENGTH)); $ti->setMaxLength(ilObject::TITLE_LENGTH); $ti->setRequired(true); $form->addItem($ti); /* description $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc"); $ta->setCols(40); $ta->setRows(2); $form->addItem($ta); */ $main = new ilRadioGroupInputGUI($this->lng->txt("prtf_creation_mode"), "mode"); $main->setValue("mode_scratch"); $form->addItem($main); $opt_scratch = new ilRadioOption($this->lng->txt("prtf_creation_mode_scratch"), "mode_scratch"); $main->addOption($opt_scratch); // 1st page $type = new ilRadioGroupInputGUI($this->lng->txt("prtf_first_page_title"), "ptype"); $type->setRequired(true); $opt_scratch->addSubItem($type); $type_page = new ilRadioOption($this->lng->txt("page"), "page"); $type->addOption($type_page); // page type: page $tf = new ilTextInputGUI($this->lng->txt("title"), "fpage"); $tf->setMaxLength(128); $tf->setSize(40); $tf->setRequired(true); $type_page->addSubItem($tf); // page templates include_once "Services/Style/classes/class.ilPageLayout.php"; $templates = ilPageLayout::activeLayouts(false, ilPageLayout::MODULE_PORTFOLIO); if ($templates) { $options = array(0 => $this->lng->txt("none")); foreach ($templates as $templ) { $templ->readObject(); $options[$templ->getId()] = $templ->getTitle(); } $use_template = new ilSelectInputGUI($this->lng->txt("prtf_use_page_layout"), "tmpl"); $use_template->setRequired(true); $use_template->setOptions($options); $type_page->addSubItem($use_template); } // page type: blog if (!$ilSetting->get('disable_wsp_blogs')) { $options = array(); include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($this->user_id); $root = $tree->readRootId(); if ($root) { $root = $tree->getNodeData($root); foreach ($tree->getSubTree($root) as $node) { if ($node["type"] == "blog") { $options[$node["obj_id"]] = $node["title"]; } } asort($options); } if (sizeof($options)) { $type_blog = new ilRadioOption($this->lng->txt("obj_blog"), "blog"); $type->addOption($type_blog); $obj = new ilSelectInputGUI($this->lng->txt("obj_blog"), "blog"); $obj->setRequired(true); $obj->setOptions(array("" => $this->lng->txt("please_select")) + $options); $type_blog->addSubItem($obj); } else { ilUtil::sendInfo($this->lng->txt("prtf_no_blogs_info")); $type->setValue("page"); } } // portfolio templates $opt_tmpl = new ilRadioOption($this->lng->txt("prtf_creation_mode_template"), "mode_tmpl"); $main->addOption($opt_tmpl); include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php"; $templates = ilObjPortfolioTemplate::getAvailablePortfolioTemplates(); if (!sizeof($templates)) { $opt_tmpl->setDisabled(true); } else { $tmpl = new ilSelectInputGUI($this->lng->txt("obj_prtt"), "prtt"); $tmpl->setRequired(true); $tmpl->setOptions(array("" => $this->lng->txt("please_select")) + $templates); $opt_tmpl->addSubItem($tmpl); // incoming from repository if ((int) $_REQUEST["prtt_pre"]) { $tmpl->setValue((int) $_REQUEST["prtt_pre"]); $main->setValue("mode_tmpl"); } } $form->setTitle($this->lng->txt("prtf_create_portfolio")); $form->addCommandButton("save", $this->lng->txt("create")); $form->addCommandButton("toRepository", $this->lng->txt("cancel")); return $form; }
/** * Displays GUI to select template for page */ function insertTemplateGUI($a_redirect = true, $a_special_page = false) { global $ilCtrl, $lng, $tpl; include_once "./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php"; $arr_templates = ilPageLayout::activeLayouts($a_special_page, ilPageLayout::MODULE_SCORM); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_page_layout_chooser.html", "Modules/Scorm2004"); $this->tpl->setCurrentBlock("option_item"); $count = 0; foreach ($arr_templates as $templ) { $count++; $sel = ""; $templ->readObject(); $this->tpl->setVariable("VAL_LAYOUT_TITLE", $templ->getTitle()); $this->tpl->setVariable("VAL_LAYOUT_IMAGE", $templ->getPreview()); $this->tpl->setVariable("VAL_LAYOUT_ID", $templ->getId()); $this->tpl->setVariable("VAL_DISPLAY", "inline"); if ($count == 1) { $this->tpl->setVariable("VAL_CHECKED", "checked"); } if ($count % 4 == 0) { $this->tpl->setVariable("END_ROW", "</tr>"); } if ($count == 1 || ($count - 1) % 4 == 0) { $this->tpl->setVariable("BEGIN_ROW", "<tr>"); } $this->tpl->parseCurrentBlock(); } //matrix table if ($count % 4 != 0) { $rest = 4 - $count % 4; } else { $rest = 0; } for ($i = 1; $i <= $rest; $i++) { $this->tpl->setVariable("VAL_DISPLAY", "none"); $this->tpl->setVariable("VAL_LAYOUT_ID", $templ->getId()); if ($i == $rest) { $this->tpl->setVariable("END_ROW", "</tr>"); } $this->tpl->parseCurrentBlock(); } //empty cells and closing <tr> $this->tpl->setVariable("VAL_NODE_ID", ilSCORM2004OrganizationHFormGUI::getPostNodeId()); $this->tpl->setVariable("VAL_MULTI", ilSCORM2004OrganizationHFormGUI::getPostMulti()); $this->tpl->setVariable("VAL_FIRST_CHILD", ilSCORM2004OrganizationHFormGUI::getPostFirstChild()); $this->tpl->setVariable("VAL_OBJ_ID", ilSCORM2004OrganizationHFormGUI::getPostFirstChild()); $ilCtrl->saveParameter($this, "obj_id"); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("BTN_NAME", "insertTemplate"); $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel")); $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("create")); $this->tpl->setVariable("CMD_CANCEL", "showOrganization"); $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel")); $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert")); $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change")); if ($a_special_page) { $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_special_page")); } else { $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_page_template")); } }
/** * Init portfolio page form * * @param string $a_mode * @return ilPropertyFormGUI */ public function initPageForm($a_mode = "create") { include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); // title $ti = new ilTextInputGUI($this->lng->txt("title"), "title"); $ti->setMaxLength(200); $ti->setRequired(true); $form->addItem($ti); // save and cancel commands if ($a_mode == "create") { include_once "Services/Style/classes/class.ilPageLayout.php"; $templates = ilPageLayout::activeLayouts(false, ilPageLayout::MODULE_PORTFOLIO); if ($templates) { $use_template = new ilRadioGroupInputGUI($this->lng->txt("prtf_use_page_layout"), "tmpl"); $use_template->setRequired(true); $form->addItem($use_template); $opt = new ilRadioOption($this->lng->txt("none"), 0); $use_template->addOption($opt); foreach ($templates as $templ) { $templ->readObject(); $opt = new ilRadioOption($templ->getTitle() . $templ->getPreview(), $templ->getId()); $use_template->addOption($opt); } } $form->setTitle($this->lng->txt("prtf_add_page") . ": " . $this->object->getTitle()); $form->addCommandButton("savePage", $this->lng->txt("save")); $form->addCommandButton("view", $this->lng->txt("cancel")); } else { /* edit is done directly in table gui $form->setTitle($this->lng->txt("prtf_edit_page")); $form->addCommandButton("updatePage", $this->lng->txt("save")); $form->addCommandButton("view", $this->lng->txt("cancel")); */ } return $form; }