function getItems() { global $ilUser; include_once "./Services/Portfolio/classes/class.ilPortfolioPage.php"; $data = ilPortfolioPage::getAllPages($this->portfolio->getId()); $this->setData($data); $this->blogs = array(); include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($ilUser->getId()); $root = $tree->readRootId(); if ($root) { $root = $tree->getNodeData($root); foreach ($tree->getSubTree($root) as $node) { if ($node["type"] == "blog") { $this->blogs[$node["obj_id"]] = $node["wsp_id"]; } } } include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php"; }
/** * Init verification form * * @param bool $a_insert * @return ilPropertyFormGUI */ protected function initForm($a_insert = false) { global $ilCtrl, $ilUser, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_verification")); } else { $form->setTitle($this->lng->txt("cont_update_verification")); } $lng->loadLanguageModule("wsp"); $options = array(); include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($ilUser->getId()); $root = $tree->getRootId(); if ($root) { $root = $tree->getNodeData($root); foreach ($tree->getSubTree($root) as $node) { if (in_array($node["type"], array("excv", "tstv"))) { $options[$node["obj_id"]] = $node["title"] . " (" . $lng->txt("wsp_type_" . $node["type"]) . ")"; } } asort($options); } $obj = new ilSelectInputGUI($this->lng->txt("cont_verification_object"), "object"); $obj->setRequired(true); $obj->setOptions($options); $form->addItem($obj); if ($a_insert) { $form->addCommandButton("create_verification", $this->lng->txt("save")); $form->addCommandButton("cancelCreate", $this->lng->txt("cancel")); } else { $data = $this->content_obj->getData(); $obj->setValue($data["id"]); $form->addCommandButton("update", $this->lng->txt("save")); $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel")); } return $form; }
protected function initCreatePortfolioFromTemplateForm($a_prtt_id, $a_title) { global $ilSetting; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmpl = new ilNonEditableValueGUI($this->lng->txt("obj_prtt")); $tmpl->setValue(ilObject::_lookupTitle($a_prtt_id)); $form->addItem($tmpl); $title = new ilNonEditableValueGUI($this->lng->txt("title"), "pt"); $title->setValue($a_title); $form->addItem($title); // gather user blogs if (!$ilSetting->get('disable_wsp_blogs')) { $blog_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") { $blog_options[$node["obj_id"]] = $node["title"]; } } asort($blog_options); } } $has_form_content = false; include_once "Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php"; $check_quota = ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive(); $quota_sum = 0; include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php"; foreach (ilPortfolioTemplatePage::getAllPages($a_prtt_id) as $page) { switch ($page["type"]) { case ilPortfolioTemplatePage::TYPE_PAGE: if ($check_quota) { $source_page = new ilPortfolioTemplatePage($page["id"]); $quota_sum += $source_page->getPageDiskSize(); } break; case ilPortfolioTemplatePage::TYPE_BLOG_TEMPLATE: if (!$ilSetting->get('disable_wsp_blogs')) { $has_form_content = true; $field_id = "blog_" . $page["id"]; $blog = new ilRadioGroupInputGUI($this->lng->txt("obj_blog") . ": " . $page["title"], $field_id); $blog->setRequired(true); $blog->setValue("blog_create"); $form->addItem($blog); $new_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_create"), "blog_create"); $blog->addOption($new_blog); $title = new ilTextInputGUI($this->lng->txt("title"), $field_id . "_create_title"); $title->setRequired(true); $new_blog->addSubItem($title); if (sizeof($blog_options)) { $reuse_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_reuse"), "blog_resuse"); $blog->addOption($reuse_blog); $obj = new ilSelectInputGUI($this->lng->txt("obj_blog"), $field_id . "_reuse_blog"); $obj->setRequired(true); $obj->setOptions(array("" => $this->lng->txt("please_select")) + $blog_options); $reuse_blog->addSubItem($obj); } $blog->addOption(new ilRadioOption($this->lng->txt("prtf_template_import_blog_ignore"), "blog_ignore")); } break; } } if ($quota_sum) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible($quota_sum)) { ilUtil::sendFailure($this->lng->txt("prtf_template_import_quota_failure"), true); $this->ctrl->redirect($this, "create"); } } // no dialog needed, go ahead if (!$has_form_content) { return; } $form->setTitle($this->lng->txt("prtf_creation_mode") . ": " . $this->lng->txt("prtf_creation_mode_template")); $form->addCommandButton("createPortfolioFromTemplateProcess", $this->lng->txt("continue")); $form->addCommandButton("toRepository", $this->lng->txt("cancel")); return $form; }
protected function initCreatePortfolioFromTemplateForm($a_prtt_id, $a_title) { global $ilSetting, $ilUser; if ((int) $_REQUEST["exc_id"]) { $this->ctrl->setParameter($this, "exc_id", (int) $_REQUEST["exc_id"]); $this->ctrl->setParameter($this, "ass_id", (int) $_REQUEST["ass_id"]); } include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmpl = new ilNonEditableValueGUI($this->lng->txt("obj_prtt")); $tmpl->setValue(ilObject::_lookupTitle($a_prtt_id)); $form->addItem($tmpl); $title = new ilNonEditableValueGUI($this->lng->txt("title"), "pt"); $title->setValue($a_title); $form->addItem($title); // gather user blogs if (!$ilSetting->get('disable_wsp_blogs')) { $blog_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, true, "blog") as $node) { $blog_options[$node["obj_id"]] = $node["title"]; } asort($blog_options); } } $has_form_content = false; include_once "Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php"; $check_quota = ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive(); $quota_sum = 0; include_once "Services/Skill/classes/class.ilPersonalSkill.php"; $pskills = array_keys(ilPersonalSkill::getSelectedUserSkills($ilUser->getId())); $skill_ids = array(); include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php"; foreach (ilPortfolioTemplatePage::getAllPages($a_prtt_id) as $page) { switch ($page["type"]) { case ilPortfolioTemplatePage::TYPE_PAGE: // skills $source_page = new ilPortfolioTemplatePage($page["id"]); $source_page->buildDom(true); $dom = $source_page->getDom(); if ($dom instanceof php4DOMDocument) { $dom = $dom->myDOMDocument; } $xpath = new DOMXPath($dom); $nodes = $xpath->query("//PageContent/Skills"); foreach ($nodes as $node) { $skill_id = $node->getAttribute("Id"); if (!in_array($skill_id, $pskills)) { $skill_ids[] = $skill_id; } } unset($nodes); unset($xpath); unset($dom); if ($check_quota) { $quota_sum += $source_page->getPageDiskSize(); } if (sizeof($skill_ids)) { $has_form_content = true; } break; case ilPortfolioTemplatePage::TYPE_BLOG_TEMPLATE: if (!$ilSetting->get('disable_wsp_blogs')) { $has_form_content = true; $field_id = "blog_" . $page["id"]; $blog = new ilRadioGroupInputGUI($this->lng->txt("obj_blog") . ": " . $page["title"], $field_id); $blog->setRequired(true); $blog->setValue("blog_create"); $form->addItem($blog); $new_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_create"), "blog_create"); $blog->addOption($new_blog); $title = new ilTextInputGUI($this->lng->txt("title"), $field_id . "_create_title"); $title->setRequired(true); $new_blog->addSubItem($title); if (sizeof($blog_options)) { $reuse_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_reuse"), "blog_resuse"); $blog->addOption($reuse_blog); $obj = new ilSelectInputGUI($this->lng->txt("obj_blog"), $field_id . "_reuse_blog"); $obj->setRequired(true); $obj->setOptions(array("" => $this->lng->txt("please_select")) + $blog_options); $reuse_blog->addSubItem($obj); } $blog->addOption(new ilRadioOption($this->lng->txt("prtf_template_import_blog_ignore"), "blog_ignore")); } break; } } if ($skill_ids) { include_once "Services/Skill/classes/class.ilSkillTreeNode.php"; $skills = new ilCheckboxGroupInputGUI($this->lng->txt("skills"), "skill_ids"); $skills->setInfo($this->lng->txt("prtf_template_import_new_skills")); $skills->setValue($skill_ids); foreach ($skill_ids as $skill_id) { $skills->addOption(new ilCheckboxOption(ilSkillTreeNode::_lookupTitle($skill_id), $skill_id)); } $form->addItem($skills); } if ($quota_sum) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible($quota_sum)) { ilUtil::sendFailure($this->lng->txt("prtf_template_import_quota_failure"), true); $this->ctrl->redirect($this, "create"); } } // no dialog needed, go ahead if (!$has_form_content) { return; } $form->setTitle($this->lng->txt("prtf_creation_mode") . ": " . $this->lng->txt("prtf_creation_mode_template")); $form->addCommandButton("createPortfolioFromTemplateProcess", $this->lng->txt("continue")); $form->addCommandButton("toRepository", $this->lng->txt("cancel")); return $form; }
/** * Init portfolio page form * * @param string $a_mode * @return ilPropertyFormGUI */ public function initBlogForm($a_mode = "create") { global $lng, $ilCtrl, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $options = array(); include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($ilUser->getId()); $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); } // no blogs to add? if (!sizeof($options)) { ilUtil::sendInfo($lng->txt("prtf_no_blogs_info"), true); $ilCtrl->redirect($this, "pages"); } $obj = new ilSelectInputGUI($lng->txt("obj_blog"), "blog"); $obj->setRequired(true); $obj->setOptions($options); $form->addItem($obj); // save and cancel commands if ($a_mode == "create") { $form->setTitle($lng->txt("prtf_add_blog") . ": " . $this->portfolio->getTitle()); $form->addCommandButton("saveBlog", $lng->txt("save")); $form->addCommandButton("pages", $lng->txt("cancel")); } else { /* edit is done directly in table gui $form->setTitle($lng->txt("prtf_edit_page")); $form->addCommandButton("updatePage", $lng->txt("save")); $form->addCommandButton("pages", $lng->txt("cancel")); */ } return $form; }