コード例 #1
0
 protected function initLicenseForm()
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "updateLicense"));
     $form->setTitle($this->lng->txt('edit_license'));
     $exist = new ilNumberInputGUI($this->lng->txt("existing_licenses"), "licenses");
     $exist->setInfo($this->lng->txt("zero_licenses_explanation"));
     $exist->setMaxLength(10);
     $exist->setSize(10);
     $exist->setValue($this->license->getLicenses());
     $form->addItem($exist);
     $info_used = new ilNonEditableValueGUI($this->lng->txt("used_licenses"));
     $info_used->setInfo($this->lng->txt("used_licenses_explanation"));
     $info_used->setValue($this->license->getAccesses());
     $form->addItem($info_used);
     $remaining_licenses = $this->license->getLicenses() == "0" ? $this->lng->txt("arbitrary") : $this->license->getRemainingLicenses();
     $info_remain = new ilNonEditableValueGUI($this->lng->txt("remaining_licenses"));
     $info_remain->setInfo($this->lng->txt("remaining_licenses_explanation"));
     $info_remain->setValue($remaining_licenses);
     $form->addItem($info_remain);
     $info_potential = new ilNonEditableValueGUI($this->lng->txt("potential_accesses"));
     $info_potential->setInfo($this->lng->txt("potential_accesses_explanation"));
     $info_potential->setValue($this->license->getPotentialAccesses());
     $form->addItem($info_potential);
     $comm = new ilTextAreaInputGUI($this->lng->txt("comment"), "remarks");
     $comm->setRows(5);
     $comm->setValue($this->license->getRemarks());
     $form->addItem($comm);
     $form->addCommandButton('updateLicense', $this->lng->txt('save'));
     return $form;
 }
コード例 #2
0
 /**
  * Init server info form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initServerInfoForm()
 {
     global $lng, $ilClientIniFile, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // installation name
     $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), "");
     $ne->setValue($ilClientIniFile->readVariable("client", "name"));
     $ne->setInfo($ilClientIniFile->readVariable("client", "description"));
     $this->form->addItem($ne);
     // client id
     $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "");
     $ne->setValue(CLIENT_ID);
     $this->form->addItem($ne);
     // installation id
     $ne = new ilNonEditableValueGUI($lng->txt("inst_id"), "");
     $ne->setValue($ilSetting->get("inst_id"));
     $this->form->addItem($ne);
     // database version
     $ne = new ilNonEditableValueGUI($lng->txt("db_version"), "");
     $ne->setValue($ilSetting->get("db_version"));
     include_once "./Services/Database/classes/class.ilDBUpdate.php";
     $this->form->addItem($ne);
     // ilias version
     $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), "");
     $ne->setValue($ilSetting->get("ilias_version"));
     $this->form->addItem($ne);
     // host
     $ne = new ilNonEditableValueGUI($lng->txt("host"), "");
     $ne->setValue($_SERVER["SERVER_NAME"]);
     $this->form->addItem($ne);
     // ip & port
     $ne = new ilNonEditableValueGUI($lng->txt("ip_address") . " & " . $this->lng->txt("port"), "");
     $ne->setValue($_SERVER["SERVER_ADDR"] . ":" . $_SERVER["SERVER_PORT"]);
     $this->form->addItem($ne);
     // server
     $ne = new ilNonEditableValueGUI($lng->txt("server_software"), "");
     $ne->setValue($_SERVER["SERVER_SOFTWARE"]);
     $this->form->addItem($ne);
     // http path
     $ne = new ilNonEditableValueGUI($lng->txt("http_path"), "");
     $ne->setValue(ILIAS_HTTP_PATH);
     $this->form->addItem($ne);
     // absolute path
     $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), "");
     $ne->setValue(ILIAS_ABSOLUTE_PATH);
     $this->form->addItem($ne);
     $not_set = $lng->txt("path_not_set");
     // convert
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_convert"), "");
     $ne->setValue(PATH_TO_CONVERT ? PATH_TO_CONVERT : $not_set);
     $this->form->addItem($ne);
     // zip
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_zip"), "");
     $ne->setValue(PATH_TO_ZIP ? PATH_TO_ZIP : $not_set);
     $this->form->addItem($ne);
     // unzip
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_unzip"), "");
     $ne->setValue(PATH_TO_UNZIP ? PATH_TO_UNZIP : $not_set);
     $this->form->addItem($ne);
     // java
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_java"), "");
     $ne->setValue(PATH_TO_JAVA ? PATH_TO_JAVA : $not_set);
     $this->form->addItem($ne);
     // htmldoc
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_htmldoc"), "");
     $ne->setValue(PATH_TO_HTMLDOC ? PATH_TO_HTMLDOC : $not_set);
     $this->form->addItem($ne);
     // mkisofs
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_mkisofs"), "");
     $ne->setValue(PATH_TO_MKISOFS ? PATH_TO_MKISOFS : $not_set);
     $this->form->addItem($ne);
     // latex
     $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), "");
     $ne->setValue(URL_TO_LATEX ? URL_TO_LATEX : $not_set);
     $this->form->addItem($ne);
     $this->form->setTitle($lng->txt("server_data"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
コード例 #3
0
 /**
  * Init add cast item form.
  */
 function initAddCastItemForm($a_mode = "create")
 {
     global $lng, $ilCtrl, $ilTabs;
     $this->checkPermission("write");
     $ilTabs->activateTab("edit_content");
     $lng->loadLanguageModule("mcst");
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     include "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setMultipart(true);
     // Property Title
     $text_input = new ilTextInputGUI($lng->txt("title"), "title");
     $text_input->setMaxLength(200);
     $this->form_gui->addItem($text_input);
     // Property Content
     $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
     $text_area->setRequired(false);
     $this->form_gui->addItem($text_area);
     // Property Visibility
     if ($enable_internal_rss) {
         $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
         $radio_option = new ilRadioOption($lng->txt("access_users"), "users");
         $radio_group->addOption($radio_option);
         $radio_option = new ilRadioOption($lng->txt("access_public"), "public");
         $radio_group->addOption($radio_option);
         $radio_group->setInfo($lng->txt("mcst_visibility_info"));
         $radio_group->setRequired(true);
         $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
         $this->form_gui->addItem($radio_group);
     }
     // Duration
     $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
     $dur->setInfo($lng->txt("mcst_duration_info"));
     $dur->setShowDays(false);
     $dur->setShowHours(true);
     $dur->setShowSeconds(true);
     $this->form_gui->addItem($dur);
     foreach (ilObjMediaCast::$purposes as $purpose) {
         if ($purpose == "VideoAlternative" && $a_mode == "create") {
             continue;
         }
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title"));
         $this->form_gui->addItem($section);
         if ($a_mode != "create") {
             $value = new ilHiddenInputGUI("value_" . $purpose);
             $label = new ilNonEditableValueGUI($lng->txt("value"));
             $label->setPostVar("label_value_" . $purpose);
             $label->setInfo($lng->txt("mcst_current_value_info"));
             $this->form_gui->addItem($label);
             $this->form_gui->addItem($value);
         }
         $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose);
         $file->setSuffixes($this->purposeSuffixes[$purpose]);
         $this->form_gui->addItem($file);
         $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose);
         $text_input->setPattern("/https?\\:\\/\\/.+/i");
         $text_input->setInfo($lng->txt("mcst_reference_info"));
         $this->form_gui->addItem($text_input);
         if ($purpose != "Standard") {
             $clearCheckBox = new ilCheckboxInputGUI();
             $clearCheckBox->setPostVar("delete_" . $purpose);
             $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
             $this->form_gui->addItem($clearCheckBox);
         } else {
             // mime type selection
             $mimeTypeSelection = new ilSelectInputGUI();
             $mimeTypeSelection->setPostVar("mimetype_" . $purpose);
             $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype"));
             $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info"));
             $options = array("" => $lng->txt("mcst_automatic_detection"));
             $options = array_merge($options, $this->mimeTypes);
             $mimeTypeSelection->setOptions($options);
             $this->form_gui->addItem($mimeTypeSelection);
             // preview picure
             $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic");
             $pp->setSuffixes(array("png", "jpeg", "jpg"));
             $pp->setInfo($lng->txt("mcst_preview_picture_info") . " mp4, mp3, png, jp(e)g, gif");
             $this->form_gui->addItem($pp);
         }
     }
     // save/cancel button
     if ($a_mode == "create") {
         $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
         $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
     } else {
         $this->form_gui->setTitle($lng->txt("mcst_edit_item"));
         $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
     }
     $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
 }
コード例 #4
0
 /**
  * Init the form to change the settings value type
  *
  * @return   object  property form to change settings type
  */
 function initSettingsTypeForm()
 {
     include_once "./Services/Administration/classes/class.ilSetting.php";
     $type = ilSetting::_getValueType();
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setId("settings_type");
     $form->setTitle($this->lng->txt("settings_type"));
     $form->setFormAction("setup.php?cmd=gateway");
     $item = new ilNonEditableValueGUI($this->lng->txt('settings_type_current'));
     $item->setValue(strtoupper($type));
     if ($type == "clob") {
         $item->setInfo($this->lng->txt('settings_info_clob'));
         $form->addCommandButton("showLongerSettings", $this->lng->txt("settings_show_longer"));
         $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_text"));
     } else {
         $item->setInfo($this->lng->txt('settings_info_text'));
         $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_clob"));
     }
     $form->addItem($item);
     if (is_array($this->longer_settings)) {
         $item = new ilCustomInputGUI($this->lng->txt('settings_longer_values'));
         if (count($this->longer_settings)) {
             foreach ($this->longer_settings as $row) {
                 $subitem = new ilCustomInputGUI(sprintf($this->lng->txt('settings_key_info'), $row['module'], $row['keyword']));
                 $subitem->setInfo($row['value']);
                 $item->addSubItem($subitem);
             }
         } else {
             $item->setHTML($this->lng->txt('settings_no_longer_values'));
         }
         $form->addItem($item);
     }
     return $form;
 }
コード例 #5
0
 /**
  * Show create/edit single link
  * @param int form mode
  * @return 
  */
 protected function initFormLink($a_mode)
 {
     global $ilTabs;
     $ilTabs->activateTab("id_content");
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     switch ($a_mode) {
         case self::LINK_MOD_CREATE:
             // Header
             $this->ctrl->setParameter($this, 'new_type', 'webr');
             $this->form->setTitle($this->lng->txt('webr_new_link'));
             $this->form->setTableWidth('600px');
             // Buttons
             $this->form->addCommandButton('save', $this->lng->txt('webr_add'));
             $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             break;
         case self::LINK_MOD_ADD:
             // Header
             $this->form->setTitle($this->lng->txt('webr_new_link'));
             // Buttons
             $this->form->addCommandButton('saveAddLink', $this->lng->txt('webr_add'));
             $this->form->addCommandButton('view', $this->lng->txt('cancel'));
             break;
         case self::LINK_MOD_EDIT:
             // Header
             $this->ctrl->setParameter($this, 'link_id', (int) $_REQUEST['link_id']);
             $this->form->setTitle($this->lng->txt('webr_edit'));
             // Buttons
             $this->form->addCommandButton('updateLink', $this->lng->txt('save'));
             $this->form->addCommandButton('view', $this->lng->txt('cancel'));
             break;
     }
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     if ($a_mode == self::LINK_MOD_ADD and $this->isContainerMetaDataRequired()) {
         ilUtil::sendInfo($this->lng->txt('webr_container_info'));
         $this->form->setTitle($this->lng->txt('webr_edit_list'));
         // List Title
         $title = new ilTextInputGUI($this->lng->txt('webr_list_title'), 'lti');
         $title->setRequired(true);
         $title->setSize(40);
         $title->setMaxLength(127);
         $this->form->addItem($title);
         // List Description
         $desc = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'), 'tde');
         $desc->setRows(3);
         $desc->setCols(40);
         $this->form->addItem($desc);
         // Addtional section
         $sect = new ilFormSectionHeaderGUI();
         $sect->setTitle($this->lng->txt('webr_add'));
         $this->form->addItem($sect);
     }
     // Target
     /*
     $tar = new ilTextInputGUI($this->lng->txt('webr_link_target'),'tar');
     $tar->setValue("http://");
     
     $tar->setSize(40);
     $tar->setMaxLength(500);
     */
     include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
     $tar = new ilLinkInputGUI($this->lng->txt('webr_link_target'), 'tar');
     $tar->setInternalLinkFilterTypes(array("PageObject", "GlossaryItem", "RepositoryItem"));
     $tar->setRequired(true);
     $this->form->addItem($tar);
     // Title
     $tit = new ilTextInputGUI($this->lng->txt('webr_link_title'), 'tit');
     $tit->setRequired(true);
     $tit->setSize(40);
     $tit->setMaxLength(127);
     $this->form->addItem($tit);
     // Description
     $des = new ilTextAreaInputGUI($this->lng->txt('description'), 'des');
     $des->setRows(3);
     $des->setCols(40);
     $this->form->addItem($des);
     if ($a_mode != self::LINK_MOD_CREATE) {
         // Active
         $act = new ilCheckboxInputGUI($this->lng->txt('active'), 'act');
         $act->setChecked(true);
         $act->setValue(1);
         $this->form->addItem($act);
         // Check
         $che = new ilCheckboxInputGUI($this->lng->txt('webr_disable_check'), 'che');
         $che->setValue(1);
         $this->form->addItem($che);
     }
     // Valid
     if ($a_mode == self::LINK_MOD_EDIT) {
         $val = new ilCheckboxInputGUI($this->lng->txt('valid'), 'vali');
         $this->form->addItem($val);
     }
     if (ilParameterAppender::_isEnabled() && $a_mode != self::LINK_MOD_CREATE) {
         $dyn = new ilNonEditableValueGUI($this->lng->txt('links_dyn_parameter'));
         $dyn->setInfo($this->lng->txt('links_dynamic_info'));
         if (count($links = ilParameterAppender::_getParams((int) $_GET['link_id']))) {
             $ex = new ilCustomInputGUI($this->lng->txt('links_existing_params'), 'ex');
             $dyn->addSubItem($ex);
             foreach ($links as $id => $link) {
                 $p = new ilCustomInputGUI();
                 $ptpl = new ilTemplate('tpl.link_dyn_param_edit.html', true, true, 'Modules/WebResource');
                 $ptpl->setVariable('INFO_TXT', ilParameterAppender::parameterToInfo($link['name'], $link['value']));
                 $this->ctrl->setParameter($this, 'param_id', $id);
                 $ptpl->setVariable('LINK_DEL', $this->ctrl->getLinkTarget($this, 'deleteParameterForm'));
                 $ptpl->setVariable('LINK_TXT', $this->lng->txt('delete'));
                 $p->setHtml($ptpl->get());
                 $dyn->addSubItem($p);
             }
         }
         // Existing parameters
         // New parameter
         if ($a_mode != self::LINK_MOD_CREATE) {
             #$new = new ilCustomInputGUI($this->lng->txt('links_add_param'),'');
             #$dyn->addSubItem($new);
         }
         // Dynyamic name
         $nam = new ilTextInputGUI($this->lng->txt('links_name'), 'nam');
         $nam->setSize(12);
         $nam->setMaxLength(128);
         $dyn->addSubItem($nam);
         // Dynamic value
         $val = new ilSelectInputGUI($this->lng->txt('links_value'), 'val');
         $val->setOptions(ilParameterAppender::_getOptionSelect());
         $val->setValue(0);
         $dyn->addSubItem($val);
         $this->form->addItem($dyn);
     }
 }
コード例 #6
0
 /**
  * Init cron jobs form.
  */
 public function initCronJobsForm()
 {
     global $lng, $ilSetting, $rbacreview, $ilObjDataCache;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $cls = new ilNonEditableValueGUI($this->lng->txt('cronjob_last_start'), 'cronjob_last_start');
     if ($ilSetting->get('last_cronjob_start_ts')) {
         include_once './Services/Calendar/classes/class.ilDatePresentation.php';
         $cls->setInfo(ilDatePresentation::formatDate(new ilDateTime($ilSetting->get('last_cronjob_start_ts'), IL_CAL_UNIX)));
     } else {
         $cls->setInfo($this->lng->txt('cronjob_last_start_unknown'));
     }
     $this->form->addItem($cls);
     // check user accounts
     $cb = new ilCheckboxInputGUI($this->lng->txt("check_user_accounts"), "cron_user_check");
     $cb->setInfo($this->lng->txt("check_user_accounts_desc"));
     if ($ilSetting->get("cron_user_check")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // delete inactive user accounts
     require_once 'Services/User/classes/class.ilCronDeleteInactiveUserAccounts.php';
     $cb = new ilCheckboxInputGUI($this->lng->txt("delete_inactive_user_accounts"), "cron_inactive_user_delete");
     $cb->setInfo($this->lng->txt("delete_inactive_user_accounts_desc"));
     if ($ilSetting->get("cron_inactive_user_delete", false)) {
         $cb->setChecked(true);
     }
     $sub_list = new ilSelectInputGUI($this->lng->txt('delete_inactive_user_accounts_interval'), 'cron_inactive_user_delete_interval');
     $sub_list->setInfo($this->lng->txt('delete_inactive_user_accounts_interval_desc'));
     $sub_list->setOptions(ilCronDeleteInactiveUserAccounts::getPossibleIntervalsArray());
     $sub_list->setValue($ilSetting->get('cron_inactive_user_delete_interval', ilCronDeleteInactiveUserAccounts::getDefaultIntervalKey()));
     $cb->addSubItem($sub_list);
     include_once 'Services/Form/classes/class.ilMultiSelectInputGUI.php';
     $sub_mlist = new ilMultiSelectInputGUI($this->lng->txt('delete_inactive_user_accounts_include_roles'), 'cron_inactive_user_delete_include_roles');
     $sub_mlist->setInfo($this->lng->txt('delete_inactive_user_accounts_include_roles_desc'));
     $roles = array();
     foreach ($rbacreview->getGlobalRoles() as $role_id) {
         if ($role_id != ANONYMOUS_ROLE_ID) {
             $roles[$role_id] = $ilObjDataCache->lookupTitle($role_id);
         }
     }
     $sub_mlist->setOptions($roles);
     $setting = $ilSetting->get('cron_inactive_user_delete_include_roles', null);
     if ($setting === null) {
         $setting = array();
     } else {
         $setting = explode(',', $setting);
     }
     $sub_mlist->setValue($setting);
     $sub_mlist->setWidth(300);
     #$sub_mlist->setHeight(100);
     $cb->addSubItem($sub_mlist);
     $default_setting = ilCronDeleteInactiveUserAccounts::DEFAULT_INACTIVITY_PERIOD;
     $sub_text = new ilTextInputGUI($this->lng->txt('delete_inactive_user_accounts_period'), 'cron_inactive_user_delete_period');
     $sub_text->setInfo($this->lng->txt('delete_inactive_user_accounts_period_desc'));
     $sub_text->setValue($ilSetting->get("cron_inactive_user_delete_period", $default_setting));
     $sub_text->setSize(2);
     $sub_text->setMaxLength(3);
     $cb->addSubItem($sub_text);
     /*		$default_setting = ilCronDeleteInactiveUserAccounts::DEFAULT_SETTING_INCLUDE_ADMINS;
     				$sub_cb = new ilCheckboxInputGUI($this->lng->txt('delete_inactive_user_accounts_include_admins'),'cron_inactive_user_delete_include_admins');
     				$sub_cb->setChecked($ilSetting->get("cron_inactive_user_delete_include_admins", $default_setting) ? 1 : 0 );
     				//$sub_cb->setOptionTitle($this->lng->txt('delete_inactive_user_accounts_include_admins'));
     				$sub_cb->setInfo($this->lng->txt('delete_inactive_user_accounts_include_admins_desc'));
     		$cb->addSubItem($sub_cb);
     		*/
     $this->form->addItem($cb);
     // delete inactivated user accounts
     require_once 'Services/User/classes/class.ilCronDeleteInactivatedUserAccounts.php';
     $cb = new ilCheckboxInputGUI($this->lng->txt("delete_inactivated_user_accounts"), "cron_inactivated_user_delete");
     $cb->setInfo($this->lng->txt("delete_inactivated_user_accounts_desc"));
     if ($ilSetting->get("cron_inactivated_user_delete", false)) {
         $cb->setChecked(true);
     }
     $sub_list = new ilSelectInputGUI($this->lng->txt('delete_inactivated_user_accounts_interval'), 'cron_inactivated_user_delete_interval');
     $sub_list->setInfo($this->lng->txt('delete_inactivated_user_accounts_interval_desc'));
     $sub_list->setOptions(ilCronDeleteInactiveUserAccounts::getPossibleIntervalsArray());
     $sub_list->setValue($ilSetting->get('cron_inactivated_user_delete_interval', ilCronDeleteInactiveUserAccounts::getDefaultIntervalKey()));
     $cb->addSubItem($sub_list);
     include_once 'Services/Form/classes/class.ilMultiSelectInputGUI.php';
     $sub_mlist = new ilMultiSelectInputGUI($this->lng->txt('delete_inactivated_user_accounts_include_roles'), 'cron_inactivated_user_delete_include_roles');
     $sub_mlist->setInfo($this->lng->txt('delete_inactivated_user_accounts_include_roles_desc'));
     $roles = array();
     foreach ($rbacreview->getGlobalRoles() as $role_id) {
         if ($role_id != ANONYMOUS_ROLE_ID) {
             $roles[$role_id] = $ilObjDataCache->lookupTitle($role_id);
         }
     }
     $sub_mlist->setOptions($roles);
     $setting = $ilSetting->get('cron_inactivated_user_delete_include_roles', null);
     if ($setting === null) {
         $setting = array();
     } else {
         $setting = explode(',', $setting);
     }
     $sub_mlist->setValue($setting);
     $sub_mlist->setWidth(300);
     #$sub_mlist->setHeight(100);
     $cb->addSubItem($sub_mlist);
     $default_setting = ilCronDeleteInactiveUserAccounts::DEFAULT_INACTIVITY_PERIOD;
     $sub_text = new ilTextInputGUI($this->lng->txt('delete_inactivated_user_accounts_period'), 'cron_inactivated_user_delete_period');
     $sub_text->setInfo($this->lng->txt('delete_inactivated_user_accounts_period_desc'));
     $sub_text->setValue($ilSetting->get("cron_inactivated_user_delete_period", $default_setting));
     $sub_text->setSize(2);
     $sub_text->setMaxLength(3);
     $cb->addSubItem($sub_text);
     /*		$default_setting = ilCronDeleteInactiveUserAccounts::DEFAULT_SETTING_INCLUDE_ADMINS;
     				$sub_cb = new ilCheckboxInputGUI($this->lng->txt('delete_inactivated_user_accounts_include_admins'),'cron_inactivated_user_delete_include_admins');
     				$sub_cb->setChecked($ilSetting->get("cron_inactivated_user_delete_include_admins", $default_setting) ? 1 : 0 );
     				//$sub_cb->setOptionTitle($this->lng->txt('delete_inactivated_user_accounts_include_admins'));
     				$sub_cb->setInfo($this->lng->txt('delete_inactivated_user_accounts_include_admins_desc'));
     		$cb->addSubItem($sub_cb);
     		*/
     $this->form->addItem($cb);
     // link check
     $cb = new ilCheckboxInputGUI($this->lng->txt("check_link"), "cron_link_check");
     $cb->setInfo($this->lng->txt("check_link_desc"));
     if ($ilSetting->get("cron_link_check")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // check web resources
     $options = array("0" => $lng->txt("never"), "1" => $lng->txt("daily"), "2" => $lng->txt("weekly"), "3" => $lng->txt("monthly"), "4" => $lng->txt("quarterly"));
     $si = new ilSelectInputGUI($this->lng->txt("check_web_resources"), "cron_web_resource_check");
     $si->setOptions($options);
     $si->setInfo($this->lng->txt("check_web_resources_desc"));
     $si->setValue($ilSetting->get("cron_web_resource_check"));
     $this->form->addItem($si);
     // update lucene
     $cb = new ilCheckboxInputGUI($this->lng->txt("cron_lucene_index"), "cron_lucene_index");
     $cb->setInfo($this->lng->txt("cron_lucene_index_info"));
     if ($ilSetting->get("cron_lucene_index")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // forum notifications
     $options = array("0" => $lng->txt("cron_forum_notification_never"), "1" => $lng->txt("cron_forum_notification_directly"), "2" => $lng->txt("cron_forum_notification_cron"));
     $si = new ilSelectInputGUI($this->lng->txt("cron_forum_notification"), "forum_notification");
     $si->setOptions($options);
     $si->setInfo($this->lng->txt("cron_forum_notification_desc"));
     $si->setValue($ilSetting->get("forum_notification"));
     $this->form->addItem($si);
     // mail notifications
     $options = array("0" => $lng->txt("cron_mail_notification_never"), "1" => $lng->txt("cron_mail_notification_cron"));
     $si = new ilSelectInputGUI($this->lng->txt("cron_mail_notification"), "mail_notification");
     $si->setOptions($options);
     $si->setInfo($this->lng->txt("cron_mail_notification_desc"));
     $si->setValue($ilSetting->get("mail_notification"));
     $this->form->addItem($si);
     if ($ilSetting->get("mail_notification") == '1') {
         $cb = new ilCheckboxInputGUI($this->lng->txt("cron_mail_notification_message"), "mail_notification_message");
         $cb->setInfo($this->lng->txt("cron_mail_notification_message_info"));
         if ($ilSetting->get("mail_notification_message")) {
             $cb->setChecked(true);
         }
         $this->form->addItem($cb);
     }
     // disk quota and disk quota reminder mail
     $dq_settings = new ilSetting('disk_quota');
     $cb = new ilCheckboxInputGUI($this->lng->txt("enable_disk_quota"), "enable_disk_quota");
     $cb->setInfo($this->lng->txt("enable_disk_quota_info"));
     if ($dq_settings->get('enabled')) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     $cb_reminder = new ilCheckboxInputGUI($this->lng->txt("enable_disk_quota_reminder_mail"), "enable_disk_quota_reminder_mail");
     $cb_reminder->setInfo($this->lng->txt("disk_quota_reminder_mail_desc"));
     if ($dq_settings->get('reminder_mail_enabled')) {
         $cb_reminder->setChecked(true);
     }
     $cb->addSubItem($cb_reminder);
     // Enable summary mail for certain users
     $cb_prop_summary = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_summary_mail"), "enable_disk_quota_summary_mail");
     $cb_prop_summary->setValue(1);
     $cb_prop_summary->setChecked((int) $dq_settings->get('summary_mail_enabled', 0) == 1);
     $cb_prop_summary->setInfo($lng->txt('enable_disk_quota_summary_mail_desc'));
     $cb->addSubItem($cb_prop_summary);
     // Edit disk quota recipients
     $summary_rcpt = new ilTextInputGUI($lng->txt("disk_quota_summary_rctp"), "disk_quota_summary_rctp");
     $summary_rcpt->setValue($dq_settings->get('summary_rcpt', ''));
     $summary_rcpt->setInfo($lng->txt('disk_quota_summary_rctp_desc'));
     $cb_prop_summary->addSubItem($summary_rcpt);
     // Enable payment notifications
     $payment_noti = new ilCheckboxInputGUI($lng->txt("payment_notification"), "payment_notification");
     $payment_noti->setValue(1);
     $payment_noti->setChecked((int) $ilSetting->get('payment_notification', 0) == 1);
     $payment_noti->setInfo($lng->txt('payment_notification_desc'));
     $num_days = new ilNumberInputGUI($this->lng->txt('payment_notification_days'), 'payment_notification_days');
     $num_days->setSize(3);
     $num_days->setMinValue(0);
     $num_days->setMaxValue(120);
     $num_days->setRequired(true);
     $num_days->setValue($ilSetting->get('payment_notification_days'));
     $num_days->setInfo($lng->txt('payment_notification_days_desc'));
     $payment_noti->addSubItem($num_days);
     $this->form->addItem($payment_noti);
     // reset payment incremental invoice number
     $inv_options = array("1" => $lng->txt("yearly"), "2" => $lng->txt("monthly"));
     include_once './Services/Payment/classes/class.ilUserDefinedInvoiceNumber.php';
     if (ilUserDefinedInvoiceNumber::_isUDInvoiceNumberActive()) {
         $inv_reset = new ilSelectInputGUI($this->lng->txt("invoice_number_reset_period"), "invoice_number_reset_period");
         $inv_reset->setOptions($inv_options);
         $inv_reset->setInfo($this->lng->txt("invoice_number_reset_period_desc"));
         $inv_reset->setValue(ilUserDefinedInvoiceNumber::_getResetPeriod());
         $this->form->addItem($inv_reset);
     } else {
         $inv_info = new ilNonEditableValueGUI($this->lng->txt('invoice_number_reset_period'), 'invoice_number_reset_period');
         $inv_info->setInfo($lng->txt('payment_userdefined_invoice_number_not_activated'));
         $this->form->addItem($inv_info);
     }
     // course/group notifications
     $crsgrp_ntf = new ilCheckboxInputGUI($this->lng->txt("enable_course_group_notifications"), "crsgrp_ntf");
     $crsgrp_ntf->setInfo($this->lng->txt("enable_course_group_notifications_desc"));
     if ($ilSetting->get('crsgrp_ntf')) {
         $crsgrp_ntf->setChecked(true);
     }
     $this->form->addItem($crsgrp_ntf);
     $this->form->addCommandButton("saveCronJobs", $lng->txt("save"));
     $this->form->setTitle($lng->txt("cron_jobs"));
     $this->form->setDescription($lng->txt("cron_jobs_desc"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
コード例 #7
0
 protected function initKeywordsForm()
 {
     global $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "saveKeywordsForm"));
     $form->setTitle($this->lng->txt("blog_edit_keywords"));
     $txt = new ilTextInputGUI($this->lng->txt("blog_keywords"), "keywords");
     // $txt->setRequired(true); #10504
     $txt->setMulti(true);
     $txt->setDataSource($this->ctrl->getLinkTarget($this, "keywordAutocomplete", "", true));
     $txt->setMaxLength(200);
     $txt->setSize(50);
     $txt->setInfo($this->lng->txt("blog_keywords_info"));
     $form->addItem($txt);
     $md_section = $this->getBlogPosting()->getMDSection();
     $keywords = array();
     foreach ($ids = $md_section->getKeywordIds() as $id) {
         $md_key = $md_section->getKeyword($id);
         if (trim($md_key->getKeyword()) != "") {
             $keywords[$md_key->getKeywordLanguageCode()][] = $md_key->getKeyword();
         }
     }
     // language is not "used" anywhere
     $ulang = $ilUser->getLanguage();
     if ($keywords[$ulang]) {
         asort($keywords[$ulang]);
         $txt->setValue($keywords[$ulang]);
     }
     // other keywords in blog
     $other = array();
     foreach (array_keys(ilBlogPosting::getAllPostings($this->getBlogPosting()->getBlogId())) as $posting_id) {
         if ($posting_id != $this->getBlogPosting()->getId()) {
             $other = array_merge($other, ilBlogPosting::getKeywords($this->getBlogPosting()->getBlogId(), $posting_id));
         }
     }
     if (is_array($keywords[$ulang])) {
         $other = array_diff($other, $keywords[$ulang]);
     }
     if (sizeof($other)) {
         $html = "";
         foreach ($other as $item) {
             $html .= '<span class="ilTag">' . $item . '</span>';
         }
         $info = new ilNonEditableValueGUI($this->lng->txt("blog_keywords_other"), "", true);
         $info->setInfo($this->lng->txt("blog_keywords_other_info"));
         $info->setValue($html);
         $form->addItem($info);
     }
     $form->addCommandButton("saveKeywordsForm", $this->lng->txt("save"));
     $form->addCommandButton("preview", $this->lng->txt("cancel"));
     return $form;
 }
コード例 #8
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"));
 }
コード例 #9
0
 /**
  * @param ilDataCollectionField $field
  *
  * @return ilCheckboxInputGUI|ilDateTimeInputGUI|ilFileInputGUI|ilTextInputGUI|NULL
  */
 static function getInputField(ilDataCollectionField $field)
 {
     global $lng;
     $type_id = $field->getDatatypeId();
     $title = $field->getTitle();
     $input = NULL;
     switch ($type_id) {
         case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
             $input = new ilTextInputGUI($title, 'field_' . $field->getId());
             if ($field->getTextArea()) {
                 $input = new ilTextAreaInputGUI($title, 'field_' . $field->getId());
             }
             if ($field->getLength()) {
                 $input->setInfo($lng->txt("dcl_max_text_length") . ": " . $field->getLength());
                 if (!$field->getTextArea()) {
                     $input->setMaxLength($field->getLength());
                 }
             }
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_NUMBER:
             $input = new ilTextInputGUI($title, 'field_' . $field->getId());
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN:
             $input = new ilDclCheckboxInputGUI($title, 'field_' . $field->getId());
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
             $input = new ilDateTimeInputGUI($title, 'field_' . $field->getId());
             $input->setStartYear(date("Y") - 100);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_FILE:
             $input = new ilFileInputGUI($title, 'field_' . $field->getId());
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_REFERENCE:
             if (!$field->isNRef()) {
                 $input = new ilSelectInputGUI($title, 'field_' . $field->getId());
             } else {
                 $input = new ilMultiSelectInputGUI($title, 'field_' . $field->getId());
             }
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_RATING:
             $input = new ilTextInputGUI($title, 'field_' . $field->getId());
             $input->setValue($lng->txt("dcl_editable_in_table_gui"));
             $input->setDisabled(true);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_ILIAS_REF:
             $input = new ilDataCollectionTreePickInputGUI($title, 'field_' . $field->getId());
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_MOB:
             $input = new ilFileInputGUI($title, 'field_' . $field->getId());
             $input->setSuffixes(self::$mob_suffixes);
             $input->setAllowDeletion(true);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_FORMULA:
             $input = new ilNonEditableValueGUI($title, 'field_' . $field->getId());
             $input->setValue('-');
             break;
     }
     if ($field->getDescription() && $input !== NULL) {
         $input->setInfo($field->getDescription() . ($input->getInfo() ? "<br>" . $input->getInfo() : ""));
     }
     return $input;
 }