/**
  * 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());
 }
 protected function handleQuotaUpdate()
 {
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::handleUpdatedSourceObject($this->getType(), $this->getId(), ilUtil::dirsize($this->initStorage($this->getId())), array($this->getId()), true);
 }
 protected static function handleQuotaUpdate(ilObjMediaObject $a_mob)
 {
     $parent_obj_ids = array();
     foreach ($a_mob->getUsages() as $item) {
         $parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
         if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
             $parent_obj_ids[] = $parent_obj_id;
         }
     }
     // we could suppress this if object is present in a (repository) media pool
     // but this would lead to "quota-breaches" when the pool item is deleted
     // and "suddenly" all workspace owners get filesize added to their
     // respective quotas, regardless of current status
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::handleUpdatedSourceObject($a_mob->getType(), $a_mob->getId(), ilUtil::dirSize($a_mob->getDataDirectory()), $parent_obj_ids);
 }
 protected static function handleQuotaUpdate(ilObjMediaObject $a_mob)
 {
     global $ilSetting;
     // if neither workspace nor portfolios are activated, we skip
     // the quota update here. this due to performance reasons on installations
     // that do not use workspace/portfolios, but heavily copy content.
     // in extreme cases (media object in pool and personal blog, deactivate workspace, change media object,
     // this may lead to incorrect data in the quota calculation)
     if ($ilSetting->get("disable_personal_workspace") && !$ilSetting->get('user_portfolios')) {
         return;
     }
     $parent_obj_ids = array();
     foreach ($a_mob->getUsages() as $item) {
         $parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
         if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
             $parent_obj_ids[] = $parent_obj_id;
         }
     }
     // we could suppress this if object is present in a (repository) media pool
     // but this would lead to "quota-breaches" when the pool item is deleted
     // and "suddenly" all workspace owners get filesize added to their
     // respective quotas, regardless of current status
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::handleUpdatedSourceObject($a_mob->getType(), $a_mob->getId(), ilUtil::dirSize($a_mob->getDataDirectory()), $parent_obj_ids);
 }
Example #6
0
 /**
  * 
  * @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;
 }
 protected function show()
 {
     global $tpl, $lng, $ilToolbar, $ilCtrl;
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("prtf_add_portfolio");
     $button->setUrl($ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
     $ilToolbar->addButtonInstance($button);
     include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
     $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     $tpl->setContent($table->getHTML() . ilDiskQuotaHandler::getStatusLegend());
 }
 /**
  * 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() . "&amp;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();
 }
 public static function getStatusLegend()
 {
     global $ilUser, $lng;
     include_once "Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php";
     if (!ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         return;
     }
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     $usage = ilDiskQuotaHandler::getFilesizeByOwner($ilUser->getId());
     include_once "Services/WebDAV/classes/class.ilDiskQuotaChecker.php";
     $quota = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($ilUser->getId());
     $quota = $quota["disk_quota"];
     // administrator
     if (is_infinite($quota) || !(int) $quota) {
         return;
     }
     $lng->loadLanguageModule("file");
     return sprintf($lng->txt("personal_workspace_quota_status_legend"), ilFormat::formatSize($usage), ilFormat::formatSize($quota), $quota ? round($usage / $quota * 100) : 0);
 }
 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;
 }
Example #11
0
 /**
  * deletes a user
  * @access	public
  * @param	integer		user_id
  */
 function delete()
 {
     global $rbacadmin, $ilDB;
     // deassign from ldap groups
     include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php';
     $mapping = ilLDAPRoleGroupMapping::_getInstance();
     $mapping->deleteUser($this->getId());
     // remove mailbox / update sent mails
     include_once "Services/Mail/classes/class.ilMailbox.php";
     $mailbox = new ilMailbox($this->getId());
     $mailbox->delete();
     $mailbox->updateMailsOfDeletedUser($this->getLogin());
     // delete feed blocks on personal desktop
     include_once "./Services/Block/classes/class.ilCustomBlock.php";
     $costum_block = new ilCustomBlock();
     $costum_block->setContextObjId($this->getId());
     $costum_block->setContextObjType("user");
     $c_blocks = $costum_block->queryBlocksForContext();
     include_once "./Services/Feeds/classes/class.ilPDExternalFeedBlock.php";
     foreach ($c_blocks as $c_block) {
         if ($c_block["type"] == "pdfeed") {
             $fb = new ilPDExternalFeedBlock($c_block["id"]);
             $fb->delete();
         }
     }
     // delete block settings
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     ilBlockSetting::_deleteSettingsOfUser($this->getId());
     // delete user_account
     $ilDB->manipulateF("DELETE FROM usr_data WHERE usr_id = %s", array("integer"), array($this->getId()));
     // delete user_prefs
     ilObjUser::_deleteAllPref($this->getId());
     // delete user_session
     include_once "./Services/Authentication/classes/class.ilSession.php";
     ilSession::_destroyByUserId($this->getId());
     // remove user from rbac
     $rbacadmin->removeUser($this->getId());
     // remove bookmarks
     // TODO: move this to class.ilBookmarkFolder
     $q = "DELETE FROM bookmark_tree WHERE tree = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     $q = "DELETE FROM bookmark_data WHERE user_id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     // DELETE FORUM ENTRIES (not complete in the moment)
     include_once './Modules/Forum/classes/class.ilObjForum.php';
     ilObjForum::_deleteUser($this->getId());
     // Delete link check notify entries
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     ilLinkCheckNotify::_deleteUser($this->getId());
     // Delete crs entries
     include_once './Modules/Course/classes/class.ilObjCourse.php';
     ilObjCourse::_deleteUser($this->getId());
     // Delete user tracking
     include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
     ilObjUserTracking::_deleteUser($this->getId());
     include_once 'Modules/Session/classes/class.ilEventParticipants.php';
     ilEventParticipants::_deleteByUser($this->getId());
     // Delete Tracking data SCORM 2004 RTE
     include_once 'Modules/Scorm2004/classes/ilSCORM13Package.php';
     ilSCORM13Package::_removeTrackingDataForUser($this->getId());
     // Delete Tracking data SCORM 1.2 RTE
     include_once 'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
     ilObjSCORMLearningModule::_removeTrackingDataForUser($this->getId());
     // remove all notifications
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilNotification::removeForUser($this->getId());
     // remove portfolios
     include_once "./Modules/Portfolio/classes/class.ilObjPortfolio.php";
     ilObjPortfolio::deleteUserPortfolios($this->getId());
     // remove workspace
     include_once "./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
     $tree = new ilWorkspaceTree($this->getId());
     $tree->cascadingDelete();
     // remove disk quota entries
     include_once "./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::deleteByOwner($this->getId());
     // Delete user defined field entries
     $this->deleteUserDefinedFieldEntries();
     // Delete clipboard entries
     $this->clipboardDeleteAll();
     // Reset owner
     $this->resetOwner();
     // Trigger deleteUser Event
     global $ilAppEventHandler;
     $ilAppEventHandler->raise('Services/User', 'deleteUser', array('usr_id' => $this->getId()));
     // delete object data
     parent::delete();
     return true;
 }
Example #12
0
 /**
  * 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;
 }
Example #14
0
 protected static function handleQuotaUpdate(ilObjFile $a_file)
 {
     include_once "Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mob = new ilObjMediaObject();
     // file itself could be workspace item
     $parent_obj_ids = array($a_file->getId());
     foreach ($a_file->getUsages() as $item) {
         $parent_obj_id = $mob->getParentObjectIdForUsage($item);
         if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
             $parent_obj_ids[] = $parent_obj_id;
         }
     }
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::handleUpdatedSourceObject($a_file->getType(), $a_file->getId(), $a_file->getDiskUsage(), $parent_obj_ids);
 }
Example #15
0
 /**
  * Init user form
  */
 function initForm($a_mode)
 {
     global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser;
     $settings = $ilSetting->getAll();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
     if ($a_mode == "create") {
         $this->form_gui->setTitle($lng->txt("usr_new"));
     } else {
         $this->form_gui->setTitle($lng->txt("usr_edit"));
     }
     // login data
     $sec_l = new ilFormSectionHeaderGUI();
     $sec_l->setTitle($lng->txt("login_data"));
     $this->form_gui->addItem($sec_l);
     // authentication mode
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
     $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode");
     $option = array();
     foreach ($active_auth_modes as $auth_name => $auth_key) {
         if ($auth_name == 'default') {
             $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
         } else {
             $name = $this->lng->txt('auth_' . $auth_name);
         }
         $option[$auth_name] = $name;
     }
     $am->setOptions($option);
     $this->form_gui->addItem($am);
     if ($a_mode == "edit") {
         $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id");
         $id->setValue($this->object->getId());
         $this->form_gui->addItem($id);
     }
     // login
     $lo = new ilUserLoginInputGUI($lng->txt("login"), "login");
     $lo->setRequired(true);
     if ($a_mode == "edit") {
         $lo->setCurrentUserId($this->object->getId());
         try {
             include_once 'Services/Calendar/classes/class.ilDate.php';
             $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
             $lo->setInfo(sprintf($this->lng->txt('usr_loginname_history_info'), ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)), $last_history_entry[0]));
         } catch (ilUserException $e) {
         }
     }
     $this->form_gui->addItem($lo);
     $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd");
     $pw->setSize(32);
     $pw->setMaxLength(32);
     $pw->setValidateAuthPost("auth_mode");
     if ($a_mode == "create") {
         $pw->setRequiredOnAuth(true);
     }
     $pw->setInfo(ilUtil::getPasswordRequirementsInfo());
     $this->form_gui->addItem($pw);
     // @todo: invisible/hidden passwords
     // external account
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     if (ilAuthUtils::_isExternalAccountEnabled()) {
         $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account");
         $ext->setSize(40);
         $ext->setMaxLength(250);
         $ext->setInfo($lng->txt("user_ext_account_desc"));
         $this->form_gui->addItem($ext);
     }
     // login data
     $sec_si = new ilFormSectionHeaderGUI();
     $sec_si->setTitle($this->lng->txt("system_information"));
     $this->form_gui->addItem($sec_si);
     // create date, approve date, agreement date, last login
     if ($a_mode == "edit") {
         $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner");
         foreach ($sia as $a) {
             $siai = new ilNonEditableValueGUI($lng->txt($a), $a);
             $this->form_gui->addItem($siai);
         }
     }
     // active
     $ac = new ilCheckboxInputGUI($lng->txt("active"), "active");
     $ac->setChecked(true);
     $this->form_gui->addItem($ac);
     // access	@todo: get fields right (names change)
     $lng->loadLanguageModule('crs');
     // access
     $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
     $radg->setValue(1);
     $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1);
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0);
     $radg->addOption($op2);
     //		$ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
     //		$ac->setChecked(true);
     //		$ac->setOptionTitle($lng->txt("crs_unlimited"));
     // access.from
     $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
     $acfrom->setShowTime(true);
     //		$ac->addSubItem($acfrom);
     $op2->addSubItem($acfrom);
     // access.to
     $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
     $acto->setShowTime(true);
     //		$ac->addSubItem($acto);
     $op2->addSubItem($acto);
     //		$this->form_gui->addItem($ac);
     $this->form_gui->addItem($radg);
     require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if (ilDiskQuotaActivationChecker::_isActive()) {
         $lng->loadLanguageModule("file");
         $quota_head = new ilFormSectionHeaderGUI();
         $quota_head->setTitle($lng->txt("repository_disk_quota"));
         $this->form_gui->addItem($quota_head);
         // disk quota
         $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota");
         $disk_quota->setSize(10);
         $disk_quota->setMaxLength(11);
         $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
         $this->form_gui->addItem($disk_quota);
         if ($a_mode == "edit") {
             // show which disk quota is in effect, and explain why
             require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
             $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId());
             if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) {
                 $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
             } else {
                 if (is_infinite($dq_info['role_disk_quota'])) {
                     $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
                 } else {
                     $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
                 }
             }
             $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
             // disk usage
             $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId());
             $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
             if ($du_info['last_update'] === null) {
                 $disk_usage->setValue($lng->txt('unknown'));
             } else {
                 require_once './Services/Utilities/classes/class.ilFormat.php';
                 $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'], 'short'));
                 $info = '<table class="il_user_quota_disk_usage_overview">';
                 // write the count and size of each object type
                 foreach ($du_info['details'] as $detail_data) {
                     $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['size'], 'short') . '</td>' . '</tr>';
                 }
                 $info .= '</table>';
                 $info .= '<br>' . $this->lng->txt('last_update') . ': ' . ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME));
                 $disk_usage->setInfo($info);
             }
             $this->form_gui->addItem($disk_usage);
             // date when the last disk quota reminder was sent to the user
             if (true || $dq_info['last_reminder']) {
                 $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder");
                 $reminder->setValue(ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME)));
                 $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc"));
                 $this->form_gui->addItem($reminder);
             }
         }
     }
     if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         $lng->loadLanguageModule("file");
         $quota_head = new ilFormSectionHeaderGUI();
         $quota_head->setTitle($lng->txt("personal_workspace_disk_quota"));
         $this->form_gui->addItem($quota_head);
         // personal workspace disk quota
         $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota");
         $wsp_disk_quota->setSize(10);
         $wsp_disk_quota->setMaxLength(11);
         $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
         $this->form_gui->addItem($wsp_disk_quota);
         if ($a_mode == "edit") {
             // show which disk quota is in effect, and explain why
             require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
             $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId());
             if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota']) {
                 $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_wsp_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']);
             } else {
                 if (is_infinite($dq_info['role_wsp_disk_quota'])) {
                     $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
                 } else {
                     $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']);
                 }
             }
             $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
         }
         // disk usage
         include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
         $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId());
         $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
         if (!sizeof($du_info)) {
             $disk_usage->setValue($lng->txt('unknown'));
         } else {
             require_once './Services/Utilities/classes/class.ilFormat.php';
             $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId())));
             $info = '<table class="il_user_quota_disk_usage_overview">';
             // write the count and size of each object type
             foreach ($du_info as $detail_data) {
                 $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt("obj_" . $detail_data["src_type"]) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['filesize'], 'short') . '</td>' . '</tr>';
             }
             $info .= '</table>';
             $disk_usage->setInfo($info);
         }
         $this->form_gui->addItem($disk_usage);
     }
     // personal data
     if ($this->isSettingChangeable('gender') or $this->isSettingChangeable('firstname') or $this->isSettingChangeable('lastname') or $this->isSettingChangeable('title') or $this->isSettingChangeable('personal_image') or $this->isSettingChangeable('birhtday')) {
         $sec_pd = new ilFormSectionHeaderGUI();
         $sec_pd->setTitle($this->lng->txt("personal_data"));
         $this->form_gui->addItem($sec_pd);
     }
     // gender
     if ($this->isSettingChangeable('gender')) {
         $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender");
         $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]);
         $female = new ilRadioOption($lng->txt("gender_f"), "f");
         $gndr->addOption($female);
         $male = new ilRadioOption($lng->txt("gender_m"), "m");
         $gndr->addOption($male);
         $this->form_gui->addItem($gndr);
     }
     // firstname, lastname, title
     $fields = array("firstname" => true, "lastname" => true, "title" => isset($settings["require_title"]) && $settings["require_title"]);
     foreach ($fields as $field => $req) {
         if ($this->isSettingChangeable($field)) {
             $inp = new ilTextInputGUI($lng->txt($field), $field);
             $inp->setSize(32);
             $inp->setMaxLength(32);
             $inp->setRequired($req);
             $this->form_gui->addItem($inp);
         }
     }
     // personal image
     if ($this->isSettingChangeable('upload')) {
         $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
         if ($a_mode == "edit" || $a_mode == "upload") {
             $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true, true));
         }
         $this->form_gui->addItem($pi);
     }
     if ($this->isSettingChangeable('birthday')) {
         $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday');
         $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]);
         $birthday->setShowEmpty(true);
         $birthday->setStartYear(1900);
         $this->form_gui->addItem($birthday);
     }
     // institution, department, street, city, zip code, country, phone office
     // phone home, phone mobile, fax, e-mail
     $fields = array(array("institution", 40, 80), array("department", 40, 80), array("street", 40, 40), array("city", 40, 40), array("zipcode", 10, 10), array("country", 40, 40), array("sel_country"), array("phone_office", 30, 30), array("phone_home", 30, 30), array("phone_mobile", 30, 30), array("fax", 30, 30));
     $counter = 0;
     foreach ($fields as $field) {
         if (!$counter++ and $this->isSettingChangeable($field[0])) {
             // contact data
             $sec_cd = new ilFormSectionHeaderGUI();
             $sec_cd->setTitle($this->lng->txt("contact_data"));
             $this->form_gui->addItem($sec_cd);
         }
         if ($this->isSettingChangeable($field[0])) {
             if ($field[0] != "sel_country") {
                 $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]);
                 $inp->setSize($field[1]);
                 $inp->setMaxLength($field[2]);
                 $inp->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]);
                 $this->form_gui->addItem($inp);
             } else {
                 // country selection
                 include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php";
                 $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]);
                 $cs->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]);
                 $this->form_gui->addItem($cs);
             }
         }
     }
     // email
     if ($this->isSettingChangeable('email')) {
         $em = new ilEMailInputGUI($lng->txt("email"), "email");
         $em->setRequired(isset($settings["require_email"]) && $settings["require_email"]);
         $this->form_gui->addItem($em);
     }
     // interests/hobbies
     if ($this->isSettingChangeable('hobby')) {
         $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby");
         $hob->setRows(3);
         $hob->setCols(40);
         $hob->setRequired(isset($settings["require_hobby"]) && $settings["require_hobby"]);
         $this->form_gui->addItem($hob);
     }
     // referral comment
     if ($this->isSettingChangeable('referral_comment')) {
         $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment");
         $rc->setRows(3);
         $rc->setCols(40);
         $rc->setRequired(isset($settings["require_referral_comment"]) && $settings["require_referral_comment"]);
         $this->form_gui->addItem($rc);
     }
     // interests
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("interests"));
     $this->form_gui->addItem($sh);
     $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
     foreach ($multi_fields as $multi_field) {
         if ($this->isSettingChangeable($multi_field)) {
             // see ilUserProfile
             $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field);
             $ti->setMulti(true);
             $ti->setMaxLength(40);
             $ti->setSize(40);
             $ti->setRequired(isset($settings["require_" . $multi_field]) && $settings["require_" . $multi_field]);
             $this->form_gui->addItem($ti);
         }
     }
     // instant messengers
     if ($this->isSettingChangeable('instant_messengers')) {
         $sec_im = new ilFormSectionHeaderGUI();
         $sec_im->setTitle($this->lng->txt("instant_messengers"));
         $this->form_gui->addItem($sec_im);
     }
     // icq, yahoo, msn, aim, skype
     $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
     foreach ($fields as $field) {
         if ($this->isSettingChangeable('instant_messengers')) {
             $im = new ilTextInputGUI($lng->txt("im_" . $field), "im_" . $field);
             $im->setSize(40);
             $im->setMaxLength(40);
             $this->form_gui->addItem($im);
         }
     }
     // other information
     if ($this->isSettingChangeable('user_profile_other')) {
         $sec_oi = new ilFormSectionHeaderGUI();
         $sec_oi->setTitle($this->lng->txt("user_profile_other"));
         $this->form_gui->addItem($sec_oi);
     }
     // matriculation number
     if ($this->isSettingChangeable('matriculation')) {
         $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation");
         $mr->setSize(40);
         $mr->setMaxLength(40);
         $mr->setRequired(isset($settings["require_matriculation"]) && $settings["require_matriculation"]);
         $this->form_gui->addItem($mr);
     }
     // delicious
     if ($this->isSettingChangeable('delicious')) {
         $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious");
         $mr->setSize(40);
         $mr->setMaxLength(40);
         $mr->setRequired(isset($settings["require_delicious"]) && $settings["require_delicious"]);
         $this->form_gui->addItem($mr);
     }
     // client IP
     $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip");
     $ip->setSize(40);
     $ip->setMaxLength(255);
     $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" . '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>");
     $this->form_gui->addItem($ip);
     // additional user defined fields
     include_once './Services/User/classes/class.ilUserDefinedFields.php';
     $user_defined_fields = ilUserDefinedFields::_getInstance();
     if ($this->usrf_ref_id == USER_FOLDER_ID) {
         $all_defs = $user_defined_fields->getDefinitions();
     } else {
         $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions();
     }
     foreach ($all_defs as $field_id => $definition) {
         if ($definition['field_type'] == UDF_TYPE_TEXT) {
             $udf = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
             $udf->setSize(40);
             $udf->setMaxLength(255);
         } else {
             if ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
                 $udf = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $udf->setUseRte(true);
             } else {
                 $udf = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $udf->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
             }
         }
         $udf->setRequired($definition['required']);
         $this->form_gui->addItem($udf);
     }
     // settings
     if ($a_mode == 'create' or $this->isSettingChangeable('language') or $this->isSettingChangeable('skin_style') or $this->isSettingChangeable('hits_per_page') or $this->isSettingChangeable('hide_own_online_status')) {
         $sec_st = new ilFormSectionHeaderGUI();
         $sec_st->setTitle($this->lng->txt("settings"));
         $this->form_gui->addItem($sec_st);
     }
     // role
     if ($a_mode == "create") {
         $role = new ilSelectInputGUI($lng->txt("default_role"), 'default_role');
         $role->setRequired(true);
         $role->setValue($this->default_role);
         $role->setOptions($this->selectable_roles);
         $this->form_gui->addItem($role);
     }
     // language
     if ($this->isSettingChangeable('language')) {
         $lang = new ilSelectInputGUI($lng->txt("language"), 'language');
         $languages = $lng->getInstalledLanguages();
         $lng->loadLanguageModule("meta");
         $options = array();
         foreach ($languages as $l) {
             $options[$l] = $lng->txt("meta_l_" . $l);
         }
         $lang->setOptions($options);
         $lang->setValue($ilSetting->get("language"));
         $this->form_gui->addItem($lang);
     }
     // skin/style
     if ($this->isSettingChangeable('skin_style')) {
         $sk = new ilSelectInputGUI($lng->txt("skin_style"), 'skin_style');
         $templates = $styleDefinition->getAllTemplates();
         include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
         $options = array();
         if (count($templates) > 0 && is_array($templates)) {
             foreach ($templates as $template) {
                 $styleDef =& new ilStyleDefinition($template["id"]);
                 $styleDef->startParsing();
                 $styles = $styleDef->getStyles();
                 foreach ($styles as $style) {
                     if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
                         continue;
                     }
                     $options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"];
                 }
             }
         }
         $sk->setOptions($options);
         $sk->setValue($ilClientIniFile->readVariable("layout", "skin") . ":" . $ilClientIniFile->readVariable("layout", "style"));
         $this->form_gui->addItem($sk);
     }
     // hits per page
     if ($this->isSettingChangeable('hits_per_page')) {
         $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"), 'hits_per_page');
         $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit"));
         $hpp->setOptions($options);
         $hpp->setValue($ilSetting->get("hits_per_page"));
         $this->form_gui->addItem($hpp);
         // users online
         $uo = new ilSelectInputGUI($lng->txt("users_online"), 'show_users_online');
         $options = array("y" => $lng->txt("users_online_show_y"), "associated" => $lng->txt("users_online_show_associated"), "n" => $lng->txt("users_online_show_n"));
         $uo->setOptions($options);
         $uo->setValue($ilSetting->get("show_users_online"));
         $this->form_gui->addItem($uo);
     }
     // hide online status
     if ($this->isSettingChangeable('hide_own_online_status')) {
         $os = new ilCheckboxInputGUI($lng->txt("hide_own_online_status"), "hide_own_online_status");
         $this->form_gui->addItem($os);
     }
     if ((int) $ilSetting->get('session_reminder_enabled')) {
         $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
         $cb->setValue(1);
         $this->form_gui->addItem($cb);
     }
     // Options
     if ($this->isSettingChangeable('send_mail')) {
         $sec_op = new ilFormSectionHeaderGUI();
         $sec_op->setTitle($this->lng->txt("options"));
         $this->form_gui->addItem($sec_op);
     }
     // send email
     $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail');
     $se->setInfo($lng->txt('inform_user_mail_info'));
     $se->setValue('y');
     $se->setChecked($ilUser->getPref('send_info_mails') == 'y');
     $this->form_gui->addItem($se);
     // ignore required fields
     $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf');
     $irf->setInfo($lng->txt('ignore_required_fields_info'));
     $irf->setValue(1);
     $this->form_gui->addItem($irf);
     // @todo: handle all required fields
     // command buttons
     if ($a_mode == "create" || $a_mode == "save") {
         $this->form_gui->addCommandButton("save", $lng->txt("save"));
     }
     if ($a_mode == "edit" || $a_mode == "update") {
         $this->form_gui->addCommandButton("update", $lng->txt("save"));
     }
     $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
 }
 protected function show()
 {
     global $tpl, $lng, $ilToolbar, $ilCtrl;
     $ilToolbar->addButton($lng->txt("prtf_add_portfolio"), $ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
     include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
     $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     $tpl->setContent($table->getHTML() . ilDiskQuotaHandler::getStatusLegend());
 }