public function run() { require_once './Services/WebDAV/classes/class.ilDiskQuotaChecker.php'; if (ilDiskQuotaActivationChecker::_isActive()) { ilDiskQuotaChecker::_updateDiskUsageReport(); if (ilDiskQuotaActivationChecker::_isReminderMailActive()) { ilDiskQuotaChecker::_sendReminderMails(); } if (ilDiskQuotaActivationChecker::_isSummaryMailActive()) { ilDiskQuotaChecker::_sendSummaryMails(); } } $result = new ilCronJobResult(); $result->setStatus(ilCronJobResult::STATUS_OK); return $result; }
/** * The disk quota report list shows user accounts, their disk quota and their * disk usage, as well as the last time a reminder was sent. */ public function viewDiskQuotaReport() { global $rbacsystem, $ilErr, $ilSetting, $lng; if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) { $ilErr->raiseError($lng->txt("no_permission"), $ilErr->WARNING); } $this->tabs_gui->setTabActive('disk_quota'); $this->addDiskQuotaSubtabs('disk_quota_report'); // nothing to do if disk quota is not active require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; if (!ilDiskQuotaActivationChecker::_isActive()) { return; } // get the form $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.disk_quota_report.html', "Services/WebDAV"); // get the date of the last update require_once "./Services/WebDAV/classes/class.ilDiskQuotaChecker.php"; $last_update = ilDiskQuotaChecker::_lookupDiskUsageReportLastUpdate(); if ($last_update == null) { // nothing to do if disk usage report has not been run $this->tpl->setVariable('LAST_UPDATE_TEXT', $lng->txt('disk_quota_report_not_run_yet')); return; } else { $this->tpl->setVariable('LAST_UPDATE_TEXT', $lng->txt('last_update') . ': ' . ilFormat::formatDate($last_update, 'datetime', true)); } // Filter $_SESSION['quota_usage_filter'] = isset($_POST['usage_filter']) ? $_POST['usage_filter'] : $_SESSION['quota_usage_filter']; if ($_SESSION['quota_usage_filter'] == 0) { $_SESSION['quota_usage_filter'] = 4; } $_SESSION['quota_access_filter'] = isset($_POST['access_filter']) ? $_POST['access_filter'] : $_SESSION['quota_access_filter']; if ($_SESSION['quota_access_filter'] == 0) { $_SESSION['quota_access_filter'] = 1; } $usage_action[1] = $lng->txt('all_users'); $usage_action[2] = $lng->txt('filter_users_without_disk_usage'); $usage_action[3] = $lng->txt('filter_users_with_disk_usage'); $usage_action[4] = $lng->txt('filter_users_with_exceeded_disk_quota'); $access_action[1] = $lng->txt('all_users'); $access_action[2] = $lng->txt('filter_users_with_access'); $access_action[3] = $lng->txt('filter_users_without_access'); $select_usage_filter = ilUtil::formSelect($_SESSION['quota_usage_filter'], "usage_filter", $usage_action, false, true); $select_access_filter = ilUtil::formSelect($_SESSION['quota_access_filter'], "access_filter", $access_action, false, true); $this->tpl->setCurrentBlock("filter"); $this->tpl->setVariable("FILTER_TXT_FILTER", $lng->txt('filter')); $this->tpl->setVariable("SELECT_USAGE_FILTER", $select_usage_filter); $this->tpl->setVariable("SELECT_ACCESS_FILTER", $select_access_filter); $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getLinkTarget($this, 'viewDiskQuotaReport')); $this->tpl->setVariable("FILTER_NAME", 'view'); $this->tpl->setVariable("FILTER_VALUE", $lng->txt('apply_filter')); $this->tpl->parseCurrentBlock(); // load templates for table $a_tpl = new ilTemplate('tpl.table.html', true, true); $a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html"); // create table require_once './Services/Table/classes/class.ilTableGUI.php'; $tbl = new ilTableGUI(0, false); // title & header columns $header_vars = array('login', 'firstname', 'lastname', 'email', 'access_until', 'last_login', 'disk_quota', 'disk_usage', 'last_reminder'); $tbl->setHeaderNames(array($lng->txt('login'), $lng->txt('firstname'), $lng->txt('lastname'), $lng->txt('email'), $lng->txt('access_until'), $lng->txt('last_login'), $lng->txt('disk_quota'), $lng->txt('disk_usage'), $lng->txt('last_reminder'))); $tbl->setHeaderVars($header_vars, $this->ctrl->getParameterArray($this, 'viewDiskQuotaReport', false)); $tbl->enable("numinfo_header"); $tbl->setFormName("cmd"); $tbl->setSelectAllCheckbox("id"); // sorting $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); // fetch the data $data = ilDiskQuotaChecker::_fetchDiskQuotaReport($_SESSION['quota_usage_filter'], $_SESSION['quota_access_filter'], $header_vars[$tbl->getOrderColumn()], $tbl->getOrderDirection()); // paging $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount(count($data)); // footer $tbl->setFooter("tblfooter", $lng->txt("previous"), $lng->txt("next")); // render table $tbl->setTemplate($a_tpl); // render rows $count = 0; for ($i = $tbl->getOffset(); $i < count($data) && $i < $tbl->getOffset() + $tbl->getLimit(); $i++) { $row = $data[$i]; // build columns foreach ($header_vars as $key) { switch ($key) { case 'login': //build link $this->ctrl->setParameterByClass("ilobjusergui", "ref_id", "7"); $this->ctrl->setParameterByClass("ilobjusergui", "obj_id", $row["usr_id"]); $link = $this->ctrl->getLinkTargetByClass("ilobjusergui", "view"); $tbl_content_cell = '<a href="' . $link . '">' . htmlspecialchars($row[$key]) . '</a>'; break; case 'disk_quota': if ($row['role_id'] == SYSTEM_ROLE_ID) { $tbl_content_cell = "<span class=\"smallgreen\">" . $lng->txt('access_unlimited') . '</span>'; } else { $tbl_content_cell = ilFormat::formatSize($row[$key], 'short'); } break; case 'disk_usage': if ($row['last_update'] == null) { $tbl_content_cell = $lng->txt('unknown'); } else { if ($row['disk_usage'] > $row['disk_quota']) { $tbl_content_cell = "<span class=\"smallred\">" . ilFormat::formatSize($row[$key], 'short') . '</span>'; } else { $tbl_content_cell = ilFormat::formatSize($row[$key], 'short'); } } break; case 'access_until': if (!$row['active']) { $tbl_content_cell = "<span class=\"smallred\">" . $lng->txt('inactive') . '</span>'; } else { if ($row['time_limit_unlimited']) { $tbl_content_cell = "<span class=\"smallgreen\">" . $lng->txt('access_unlimited') . '</span>'; } else { if ($row['expired']) { $tbl_content_cell = "<span class=\"smallred\">" . $lng->txt('access_expired') . '</span>'; } else { $tbl_content_cell = ilFormat::formatDate($row[$key]); } } } break; case 'last_login': case 'last_reminder': if ($row[$key] == null) { $tbl_content_cell = $lng->txt('no_date'); } else { $tbl_content_cell = ilFormat::formatDate($row[$key]); } break; default: $tbl_content_cell = htmlspecialchars($row[$key]); } /* if (is_array($tbl_content_cell)) { $tbl->tpl->setCurrentBlock("tbl_cell_subtitle"); $tbl->tpl->setVariable("TBL_CELL_SUBTITLE",$tbl_content_cell[1]); $tbl->tpl->parseCurrentBlock(); $tbl_content_cell = "<b>".$tbl_content_cell[0]."</b>"; }*/ $tbl->tpl->setCurrentBlock("tbl_content_cell"); $tbl->tpl->setVariable("TBL_CONTENT_CELL", $tbl_content_cell); $tbl->tpl->parseCurrentBlock(); } $tbl->tpl->setCurrentBlock("tbl_content_row"); $rowcolor = ilUtil::switchColor($count, "tblrow1", "tblrow2"); $tbl->tpl->setVariable("ROWCOLOR", $rowcolor); $tbl->tpl->parseCurrentBlock(); $count++; } $tbl->render(); // Add table to page $this->tpl->setVariable("USER_TABLE", $a_tpl->get()); }
/** * add standard object section */ function addObjectSections() { global $lng, $ilCtrl, $ilUser, $ilAccess, $tree, $ilSetting, $ilObjDataCache; $this->addSection($lng->txt("additional_info")); $a_obj = $this->gui_object->object; // links to the object if (is_object($a_obj)) { // permanent link $type = $a_obj->getType(); $ref_id = $a_obj->getRefId(); if ($ref_id) { include_once './Services/Link/classes/class.ilLink.php'; $href = ilLink::_getStaticLink($ref_id, $type, true); include_once 'Services/WebServices/ECS/classes/class.ilECSServerSettings.php'; if (ilECSServerSettings::getInstance()->activeServerExists()) { $this->addProperty($lng->txt("object_id"), $a_obj->getId()); } include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php'; $pm = new ilPermanentLinkGUI($type, $ref_id); $pm->setIncludePermanentLinkText(false); $pm->setAlignCenter(false); $this->addProperty($lng->txt("perma_link"), $pm->getHTML(), ""); // bookmarks $title = $ilObjDataCache->lookupTitle($a_obj->getId()); $bms = ilPermanentLinkGUI::_getBookmarksSelectionList($title, $href); // links to resource if ($ilAccess->checkAccess("write", "", $ref_id) || $ilAccess->checkAccess("edit_permissions", "", $ref_id)) { $obj_id = $a_obj->getId(); $rs = ilObject::_getAllReferences($obj_id); $refs = array(); foreach ($rs as $r) { if ($tree->isInTree($r)) { $refs[] = $r; } } if (count($refs) > 1) { $links = $sep = ""; foreach ($refs as $r) { $cont_loc = new ilLocatorGUI(); $cont_loc->addContextItems($r, true); $links .= $sep . $cont_loc->getHTML(); $sep = "<br />"; } $this->addProperty($lng->txt("res_links"), '<div class="small">' . $links . '</div>'); } } } } // creation date $this->addProperty($lng->txt("create_date"), ilDatePresentation::formatDate(new ilDateTime($a_obj->getCreateDate(), IL_CAL_DATETIME))); // owner if ($ilUser->getId() != ANONYMOUS_USER_ID and $a_obj->getOwner()) { include_once './Services/Object/classes/class.ilObjectFactory.php'; include_once './Services/User/classes/class.ilObjUser.php'; if (ilObjUser::userExists(array($a_obj->getOwner()))) { $ownerObj = ilObjectFactory::getInstanceByObjId($a_obj->getOwner(), false); } else { $ownerObj = ilObjectFactory::getInstanceByObjId(6, false); } if (!is_object($ownerObj) || $ownerObj->getType() != "usr") { $this->addProperty($lng->txt("owner"), $lng->txt("no_owner")); } else { if ($ownerObj->hasPublicProfile()) { $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $ownerObj->getId()); $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName(), $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML")); } else { $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName()); } } } // disk usage require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; if ($ilUser->getId() != ANONYMOUS_USER_ID && ilDiskQuotaActivationChecker::_isActive()) { $size = $a_obj->getDiskUsage(); if ($size !== null) { $this->addProperty($lng->txt("disk_usage"), ilFormat::formatSize($size, 'long')); } } // change event require_once 'Services/Tracking/classes/class.ilChangeEvent.php'; if (ilChangeEvent::_isActive()) { if ($ilUser->getId() != ANONYMOUS_USER_ID) { $readEvents = ilChangeEvent::_lookupReadEvents($a_obj->getId()); $count_users = 0; $count_members = 0; $count_user_reads = 0; $count_anonymous_reads = 0; foreach ($readEvents as $evt) { if ($evt['usr_id'] == ANONYMOUS_USER_ID) { $count_anonymous_reads += $evt['read_count']; } else { $count_user_reads += $evt['read_count']; $count_users++; /* to do: if ($evt['user_id'] is member of $this->getRefId()) { $count_members++; }*/ } } if ($count_anonymous_reads > 0) { $this->addProperty($this->lng->txt("readcount_anonymous_users"), $count_anonymous_reads); } if ($count_user_reads > 0) { $this->addProperty($this->lng->txt("readcount_users"), $count_user_reads); } if ($count_users > 0) { $this->addProperty($this->lng->txt("accesscount_registered_users"), $count_users); } } } // END ChangeEvent: Display change event info // BEGIN WebDAV: Display locking information require_once 'Services/WebDAV/classes/class.ilDAVServer.php'; if (ilDAVServer::_isActive()) { global $ilias, $ilUser; if ($ilUser->getId() != ANONYMOUS_USER_ID) { $davLocks = new ilDAVLocks(); // Show lock info if ($ilias->account->getId() != ANONYMOUS_USER_ID) { $locks =& $davLocks->getLocksOnObjectObj($a_obj->getId()); if (count($locks) > 0) { $lockUser = new ilObjUser($locks[0]['ilias_owner']); $this->addProperty($this->lng->txt("in_use_by"), $lockUser->getPublicName(), "./ilias.php?user=" . $locks[0]['ilias_owner'] . '&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI'); } } } } // END WebDAV: Display locking information }
/** * Read role properties and write them to form * @return * @param object $role */ protected function readRoleProperties(ilObjRole $role) { global $rbacreview; include_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; $data['title'] = $role->getTitle(); $data['desc'] = $role->getDescription(); $data['reg'] = $role->getAllowRegister(); $data['la'] = $role->getAssignUsersStatus(); if (ilDiskQuotaActivationChecker::_isActive()) { $data['disk_quota'] = $role->getDiskQuota() / pow(ilFormat::_getSizeMagnitude(), 2); } if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) { $data['wsp_disk_quota'] = $role->getPersonalWorkspaceDiskQuota() / pow(ilFormat::_getSizeMagnitude(), 2); } $data['pro'] = $rbacreview->isProtected($this->rolf_ref_id, $role->getId()); $this->form->setValuesByArray($data); }
/** * 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")); }
private function initTasks() { global $ilias; require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; require_once 'Services/Payment/classes/class.ilUserDefinedInvoiceNumber.php'; $this->default_tasks = array('ilLDAPCronSynchronization::start', 'ilCronCheckUserAccounts::check', 'ilLuceneIndexer::index', 'ilCronLinkCheck::check', 'ilCronWebResourceCheck::check', 'ilCronForumNotification::sendNotifications', 'ilCronMailNotification::sendNotifications', 'ilCronValidator::check', 'ilCronDiskQuotaCheck::updateDiskUsageStatistics', 'ilCronDiskQuotaCheck::sendReminderMails', 'ilCronDeleteInactiveUserAccounts::run', 'ilCronDeleteInactivatedUserAccounts::run', 'ilCronPaymentNotification::sendNotifications', 'ilCronCourseGroupNotification::check', 'ilCronPaymentUDInvoiceNumberReset::check', 'ilCronObjectStatisticsCheck::check'); $this->possible_tasks = array('ilLDAPCronSynchronization::start' => array('classname' => 'ilLDAPCronSynchronization', 'method' => 'start', 'location' => 'Services/LDAP', 'condition' => true), 'ilCronCheckUserAccounts::check' => array('classname' => 'ilCronCheckUserAccounts', 'method' => 'check', 'location' => 'cron', 'condition' => $ilias->getSetting('cron_user_check')), 'ilLuceneIndexer::index' => array('classname' => 'ilLuceneIndexer', 'method' => 'index', 'location' => 'Services/Search', 'sub_location' => 'Lucene', 'condition' => $ilias->getSetting("cron_lucene_index")), 'ilCronLinkCheck::check' => array('classname' => 'ilCronLinkCheck', 'method' => 'check', 'location' => 'cron', 'condition' => $ilias->getSetting("cron_link_check")), 'ilCronWebResourceCheck::check' => array('classname' => 'ilCronWebResourceCheck', 'method' => 'check', 'location' => 'cron', 'condition' => $ilias->getSetting("cron_web_resource_check")), 'ilCronForumNotification::sendNotifications' => array('classname' => 'ilCronForumNotification', 'method' => 'sendNotifications', 'location' => 'cron', 'condition' => $ilias->getSetting('forum_notification') == 2), 'ilCronMailNotification::sendNotifications' => array('classname' => 'ilCronMailNotification', 'method' => 'sendNotifications', 'location' => 'cron', 'condition' => $ilias->getSetting('mail_notification') == 1), 'ilCronValidator::check' => array('classname' => 'ilCronValidator', 'method' => 'check', 'location' => 'cron', 'condition' => $ilias->getSetting('systemcheck_cron') == 1), 'ilCronDiskQuotaCheck::updateDiskUsageStatistics' => array('classname' => 'ilCronDiskQuotaCheck', 'method' => 'updateDiskUsageStatistics', 'location' => 'cron', 'condition' => ilDiskQuotaActivationChecker::_isActive()), 'ilCronDiskQuotaCheck::sendReminderMails' => array('classname' => 'ilCronDiskQuotaCheck', 'method' => 'sendReminderMails', 'location' => 'cron', 'condition' => ilDiskQuotaActivationChecker::_isReminderMailActive()), 'ilCronDiskQuotaCheck::sendSummaryMails' => array('classname' => 'ilCronDiskQuotaCheck', 'method' => 'sendSummaryMails', 'location' => 'cron', 'condition' => ilDiskQuotaActivationChecker::_isSummaryMailActive()), 'ilCronDeleteInactiveUserAccounts::run' => array('classname' => 'ilCronDeleteInactiveUserAccounts', 'method' => 'run', 'location' => 'Services/User', 'condition' => $ilias->getSetting('cron_inactive_user_delete', 0)), 'ilCronDeleteInactivatedUserAccounts::run' => array('classname' => 'ilCronDeleteInactivatedUserAccounts', 'method' => 'run', 'location' => 'Services/User', 'condition' => $ilias->getSetting('cron_inactivated_user_delete', 0)), 'ilCronPaymentNotification::sendNotifications' => array('classname' => 'ilCronPaymentNotification', 'method' => 'sendNotifications', 'location' => 'cron', 'condition' => $ilias->getSetting('payment_notifications') == 1), 'ilCronCourseGroupNotification::check' => array('classname' => 'ilCronCourseGroupNotification', 'method' => 'sendNotifications', 'location' => 'cron', 'condition' => $ilias->getSetting("crsgrp_ntf")), 'ilCronPaymentUDInvoiceNumberReset::check' => array('classname' => 'ilCronPaymentUDInvoiceNumberReset', 'method' => 'check', 'location' => 'cron', 'condition' => ilUserDefinedInvoiceNumber::_isUDInvoiceNumberActive()), 'ilCronObjectStatisticsCheck::check' => array('classname' => 'ilCronObjectStatisticsCheck', 'method' => 'check', 'location' => 'cron', 'condition' => true)); }