/** * Render html */ function render($a_mode = "") { global $lng, $tpl, $ilUser; $quota_exceeded = $quota_legend = false; if (self::$check_wsp_quota) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible()) { $lng->loadLanguageModule("file"); return $lng->txt("personal_workspace_quota_exceeded_warning"); } else { $quota_legend = ilDiskQuotaHandler::getStatusLegend(); } } // make sure jQuery is loaded iljQueryUtil::initjQuery(); // add file upload scripts include_once "./Services/FileUpload/classes/class.ilFileUploadGUI.php"; ilFileUploadGUI::initFileUpload(); // load template $this->tpl = new ilTemplate("tpl.prop_dndfiles.html", true, true, "Services/Form"); // general variables $this->tpl->setVariable("UPLOAD_ID", $this->uniqueId); // input $this->tpl->setVariable("FILE_SELECT_ICON", ilUtil::getImagePath('icon_fold.png')); $this->tpl->setVariable("TXT_SHOW_ALL_DETAILS", $lng->txt('show_all_details')); $this->tpl->setVariable("TXT_HIDE_ALL_DETAILS", $lng->txt('hide_all_details')); $this->tpl->setVariable("TXT_SELECTED_FILES", $lng->txt('selected_files')); $this->tpl->setVariable("TXT_DRAG_FILES_HERE", $lng->txt('drag_files_here')); $this->tpl->setVariable("TXT_NUM_OF_SELECTED_FILES", $lng->txt('num_of_selected_files')); $this->tpl->setVariable("TXT_SELECT_FILES_FROM_COMPUTER", $lng->txt('select_files_from_computer')); $this->tpl->setVariable("TXT_OR", $lng->txt('logic_or')); $this->tpl->setVariable("INPUT_ACCEPT_SUFFIXES", $this->getInputAcceptSuffixes($this->getSuffixes())); // info $this->tpl->setCurrentBlock("max_size"); $this->tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString()); $this->tpl->parseCurrentBlock(); if ($quota_legend) { $this->tpl->setVariable("TXT_MAX_SIZE", $quota_legend); $this->tpl->parseCurrentBlock(); } $this->outputSuffixes($this->tpl); // create file upload object $upload = new ilFileUploadGUI("ilFileUploadDropZone_" . $this->uniqueId, $this->uniqueId, false); $upload->enableFormSubmit("ilFileUploadInput_" . $this->uniqueId, $this->submit_button_name, $this->cancel_button_name); $upload->setDropAreaId("ilFileUploadDropArea_" . $this->uniqueId); $upload->setFileListId("ilFileUploadList_" . $this->uniqueId); $upload->setFileSelectButtonId("ilFileUploadFileSelect_" . $this->uniqueId); $this->tpl->setVariable("FILE_UPLOAD", $upload->getHTML()); return $this->tpl->get(); }
/** * List all tests in which current user participated */ public function create() { global $ilTabs; if ($this->id_type == self::WORKSPACE_NODE_ID) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible()) { $this->lng->loadLanguageModule("file"); ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true); $this->ctrl->redirect($this, "cancel"); } } $this->lng->loadLanguageModule("crsv"); $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "cancel")); include_once "Modules/Course/classes/Verification/class.ilCourseVerificationTableGUI.php"; $table = new ilCourseVerificationTableGUI($this, "create"); $this->tpl->setContent($table->getHTML()); }
/** * * @param * @return */ protected function initPropertiesForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->lng->loadLanguageModule('file'); $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this), 'update'); $form->setTitle($this->lng->txt('file_edit')); $form->addCommandButton('update', $this->lng->txt('save')); $form->addCommandButton('cancel', $this->lng->txt('cancel')); $title = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title->setValue($this->object->getTitle()); $title->setInfo($this->lng->txt("if_no_title_then_filename")); $form->addItem($title); $upload_possible = true; if ($this->id_type == self::WORKSPACE_NODE_ID) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; $upload_possible = ilDiskQuotaHandler::isUploadPossible(); } if ($upload_possible) { $file = new ilFileInputGUI($this->lng->txt('obj_file'), 'file'); $file->setRequired(false); // $file->enableFileNameSelection('title'); $form->addItem($file); $group = new ilRadioGroupInputGUI('', 'replace'); $group->setValue(0); $replace = new ilRadioOption($this->lng->txt('replace_file'), 1); $replace->setInfo($this->lng->txt('replace_file_info')); $group->addOption($replace); $keep = new ilRadioOption($this->lng->txt('file_new_version'), 0); $keep->setInfo($this->lng->txt('file_new_version_info')); $group->addOption($keep); $file->addSubItem($group); } else { $file = new ilNonEditableValueGUI($this->lng->txt('obj_file')); $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning")); $form->addItem($file); } $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $desc->setRows(3); #$desc->setCols(40); $form->addItem($desc); if ($this->id_type == self::REPOSITORY_NODE_ID) { $this->lng->loadLanguageModule('rating'); $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating'); $rate->setInfo($this->lng->txt('rating_activate_rating_info')); $form->addItem($rate); } return $form; }
/** * Insert property html */ function insert(&$a_tpl) { global $lng; $quota_exceeded = $quota_legend = false; if (self::$check_wsp_quota) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible()) { $lng->loadLanguageModule("file"); $quota_exceeded = $lng->txt("personal_workspace_quota_exceeded_warning"); } else { $quota_legend = ilDiskQuotaHandler::getStatusLegend(); if ($quota_legend) { $quota_legend = "<br />" . $quota_legend; } } } $i_tpl = new ilTemplate("tpl.prop_image_file.html", true, true, "Services/Form"); if ($this->getImage() != "") { if (!$this->getDisabled() && $this->getALlowDeletion()) { $i_tpl->setCurrentBlock("delete_bl"); $i_tpl->setVariable("POST_VAR_D", $this->getPostVar()); $i_tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file")); $i_tpl->parseCurrentBlock(); } if (strlen($this->getValue())) { $i_tpl->setCurrentBlock("has_value"); $i_tpl->setVariable("TEXT_IMAGE_NAME", $this->getValue()); $i_tpl->parseCurrentBlock(); } $i_tpl->setCurrentBlock("image"); if (!$this->getUseCache()) { $pos = strpos($this->getImage(), '?'); if ($pos !== false) { $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "&time=" . time()); } else { $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "?time=" . time()); } } else { $i_tpl->setVariable("SRC_IMAGE", $this->getImage()); } $i_tpl->setVariable("ALT_IMAGE", $this->getAlt()); $i_tpl->parseCurrentBlock(); } $pending = $this->getPending(); if ($pending) { $i_tpl->setCurrentBlock("pending"); $i_tpl->setVariable("TXT_PENDING", $lng->txt("file_upload_pending") . ": " . $pending); $i_tpl->parseCurrentBlock(); } $i_tpl->setVariable("POST_VAR", $this->getPostVar()); $i_tpl->setVariable("ID", $this->getFieldId()); if (!$quota_exceeded) { $i_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString() . $quota_legend); $this->outputSuffixes($i_tpl, "allowed_image_suffixes"); } else { $i_tpl->setVariable("TXT_MAX_SIZE", $quota_exceeded); } if ($this->getDisabled() || $quota_exceeded) { $i_tpl->setVariable("DISABLED", " disabled=\"disabled\""); } $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $i_tpl->get()); $a_tpl->parseCurrentBlock(); }
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; }
/** * Render html */ function render($a_mode = "") { global $lng; $quota_exceeded = $quota_legend = false; if (self::$check_wsp_quota) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible()) { $lng->loadLanguageModule("file"); $quota_exceeded = $lng->txt("personal_workspace_quota_exceeded_warning"); } else { $quota_legend = ilDiskQuotaHandler::getStatusLegend(); } } $f_tpl = new ilTemplate("tpl.prop_file.html", true, true, "Services/Form"); // show filename selection if enabled if ($this->isFileNameSelectionEnabled()) { $f_tpl->setCurrentBlock('filename'); $f_tpl->setVariable('POST_FILENAME', $this->getFileNamePostVar()); $f_tpl->setVariable('VAL_FILENAME', $this->getFilename()); $f_tpl->setVariable('FILENAME_ID', $this->getFieldId()); $f_tpl->setVAriable('TXT_FILENAME_HINT', $lng->txt('if_no_title_then_filename')); $f_tpl->parseCurrentBlock(); } else { if (trim($this->getValue() != "")) { if (!$this->getDisabled() && $this->getALlowDeletion()) { $f_tpl->setCurrentBlock("delete_bl"); $f_tpl->setVariable("POST_VAR_D", $this->getPostVar()); $f_tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file")); $f_tpl->parseCurrentBlock(); } $f_tpl->setCurrentBlock('prop_file_propval'); $f_tpl->setVariable('FILE_VAL', $this->getValue()); $f_tpl->parseCurrentBlock(); } } if ($a_mode != "toolbar") { if (!$quota_exceeded) { $this->outputSuffixes($f_tpl); $f_tpl->setCurrentBlock("max_size"); $f_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString()); $f_tpl->parseCurrentBlock(); if ($quota_legend) { $f_tpl->setVariable("TXT_MAX_SIZE", $quota_legend); $f_tpl->parseCurrentBlock(); } } else { $f_tpl->setCurrentBlock("max_size"); $f_tpl->setVariable("TXT_MAX_SIZE", $quota_exceeded); $f_tpl->parseCurrentBlock(); } } else { if ($quota_exceeded) { return $quota_exceeded; } } $pending = $this->getPending(); if ($pending) { $f_tpl->setCurrentBlock("pending"); $f_tpl->setVariable("TXT_PENDING", $lng->txt("file_upload_pending") . ": " . $pending); $f_tpl->parseCurrentBlock(); } if ($this->getDisabled() || $quota_exceeded) { $f_tpl->setVariable("DISABLED", " disabled=\"disabled\""); } $f_tpl->setVariable("POST_VAR", $this->getPostVar()); $f_tpl->setVariable("ID", $this->getFieldId()); $f_tpl->setVariable("SIZE", $this->getSize()); return $f_tpl->get(); }
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; }