/**
  * Get multi language form
  */
 function getMultiLangForm()
 {
     global $tpl, $lng, $ilCtrl, $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     // master language
     include_once "./Services/MetaData/classes/class.ilMDLanguageItem.php";
     $options = ilMDLanguageItem::_getLanguages();
     $si = new ilSelectInputGUI($lng->txt("cont_master_lang"), "master_lang");
     $si->setOptions($options);
     $si->setValue($ilUser->getLanguage());
     $form->addItem($si);
     // additional languages
     include_once "./Services/MetaData/classes/class.ilMDLanguageItem.php";
     $options = ilMDLanguageItem::_getLanguages();
     $options = array("" => $lng->txt("please_select")) + $options;
     $si = new ilSelectInputGUI($lng->txt("cont_additional_langs"), "additional_langs");
     $si->setOptions($options);
     $si->setMulti(true);
     $form->addItem($si);
     $form->addCommandButton("saveMultilingualitySettings", $lng->txt("save"));
     $form->addCommandButton("cancel", $lng->txt("cancel"));
     $form->setTitle($lng->txt("cont_activate_multi_lang"));
     $form->setFormAction($ilCtrl->getFormAction($this));
     return $form;
 }
 /**
  * list fields
  */
 public function listFields()
 {
     global $tpl, $lng, $ilCtrl, $ilToolbar;
     // Show tables
     require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
     $tables = $this->parent_obj->object->getTables();
     foreach ($tables as $table) {
         $options[$table->getId()] = $table->getTitle();
     }
     include_once './Services/Form/classes/class.ilSelectInputGUI.php';
     $table_selection = new ilSelectInputGUI('', 'table_id');
     $table_selection->setOptions($options);
     $table_selection->setValue($this->table_id);
     $ilToolbar->setFormAction($ilCtrl->getFormActionByClass("ilDataCollectionFieldListGUI", "doTableSwitch"));
     $ilToolbar->addText($lng->txt("dcl_table"));
     $ilToolbar->addInputItem($table_selection);
     $ilToolbar->addFormButton($lng->txt('change'), 'doTableSwitch');
     $ilToolbar->addSeparator();
     $ilToolbar->addButton($lng->txt("dcl_add_new_table"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "create"));
     $ilToolbar->addSeparator();
     $ilCtrl->setParameterByClass("ildatacollectiontableeditgui", "table_id", $this->table_id);
     $ilToolbar->addButton($lng->txt("dcl_table_settings"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "edit"));
     $ilToolbar->addButton($lng->txt("dcl_delete_table"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "confirmDelete"));
     $ilToolbar->addButton($lng->txt("dcl_add_new_field"), $ilCtrl->getLinkTargetByClass("ildatacollectionfieldeditgui", "create"));
     // requested not to implement this way...
     //        $tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
     require_once './Modules/DataCollection/classes/class.ilDataCollectionFieldListTableGUI.php';
     $list = new ilDataCollectionFieldListTableGUI($this, $ilCtrl->getCmd(), $this->table_id);
     $tpl->setContent($list->getHTML());
 }
 /**
  * Add all fields to the form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $this->setTitle($this->lng->txt('orgu_settings'));
     $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $item->setRequired(true);
     $item->setValue($this->obj_orgu->getTitle());
     $this->addItem($item);
     $item = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $item->setValue($this->obj_orgu->getDescription());
     $this->addItem($item);
     $item = new ilFormSectionHeaderGUI();
     $item->setTitle($this->lng->txt('orgu_type'));
     $this->addItem($item);
     $types = ilOrgUnitType::getAllTypes();
     $options = array(0 => '');
     /** @var ilOrgUnitType $type */
     foreach ($types as $type) {
         $options[$type->getId()] = $type->getTitle();
     }
     asort($options);
     $item = new ilSelectInputGUI($this->lng->txt('orgu_type'), 'orgu_type');
     $item->setOptions($options);
     $item->setValue($this->obj_orgu->getOrgUnitTypeId());
     $this->addItem($item);
     $item = new ilFormSectionHeaderGUI();
     $item->setTitle($this->lng->txt('ext_id'));
     $this->addItem($item);
     $item = new ilTextInputGUI($this->lng->txt('ext_id'), 'ext_id');
     $item->setValue($this->obj_orgu->getImportId());
     $this->addItem($item);
     $this->addCommandButton('updateSettings', $this->lng->txt('save'));
 }
 /**
  * Init Filter
  */
 function initFilter()
 {
     global $lng, $ilUser;
     // period
     $per = $_SESSION["news_pd_news_per"] != "" ? $_SESSION["news_pd_news_per"] : ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
     $news_set = new ilSetting("news");
     $allow_shorter_periods = $news_set->get("allow_shorter_periods");
     $allow_longer_periods = $news_set->get("allow_longer_periods");
     $default_per = ilNewsItem::_lookupDefaultPDPeriod();
     $options = array(2 => sprintf($lng->txt("news_period_x_days"), 2), 3 => sprintf($lng->txt("news_period_x_days"), 3), 5 => sprintf($lng->txt("news_period_x_days"), 5), 7 => $lng->txt("news_period_1_week"), 14 => sprintf($lng->txt("news_period_x_weeks"), 2), 30 => $lng->txt("news_period_1_month"), 60 => sprintf($lng->txt("news_period_x_months"), 2), 120 => sprintf($lng->txt("news_period_x_months"), 4), 180 => sprintf($lng->txt("news_period_x_months"), 6), 366 => $lng->txt("news_period_1_year"));
     $unset = array();
     foreach ($options as $k => $opt) {
         if (!$allow_shorter_periods && $k < $default_per) {
             $unset[$k] = $k;
         }
         if (!$allow_longer_periods && $k > $default_per) {
             $unset[$k] = $k;
         }
     }
     foreach ($unset as $k) {
         unset($options[$k]);
     }
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $si = new ilSelectInputGUI($this->lng->txt("news_time_period"), "news_per");
     $si->setOptions($options);
     $si->setValue($per);
     $this->addFilterItem($si);
     // related to...
     $si = new ilSelectInputGUI($this->lng->txt("context"), "news_ref_id");
     $si->setOptions($this->contexts);
     $si->setValue($this->selected_context);
     $this->addFilterItem($si);
 }
 /**
  * Edit news settings.
  */
 public function editSettings()
 {
     global $ilCtrl, $lng, $ilSetting, $ilTabs, $ilToolbar;
     $ilTabs->activateTab("settings");
     if (OH_REF_ID > 0) {
         ilUtil::sendInfo("This installation is used for online help authoring. Help modules cannot be imported.");
         return;
     }
     if ($this->checkPermissionBool("write")) {
         // help file
         include_once "./Services/Form/classes/class.ilFileInputGUI.php";
         $fi = new ilFileInputGUI($lng->txt("help_help_file"), "help_file");
         $fi->setSuffixes(array("zip"));
         $ilToolbar->addInputItem($fi, true);
         $ilToolbar->addFormButton($lng->txt("upload"), "uploadHelpFile");
         $ilToolbar->addSeparator();
         // help mode
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $options = array("" => $lng->txt("help_tooltips_and_help"), "1" => $lng->txt("help_help_only"), "2" => $lng->txt("help_tooltips_only"));
         $si = new ilSelectInputGUI($this->lng->txt("help_mode"), "help_mode");
         $si->setOptions($options);
         $si->setValue($ilSetting->get("help_mode"));
         $ilToolbar->addInputItem($si);
         $ilToolbar->addFormButton($lng->txt("help_set_mode"), "setMode");
     }
     $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
     include_once "./Services/Help/classes/class.ilHelpModuleTableGUI.php";
     $tab = new ilHelpModuleTableGUI($this, "editSettings");
     $this->tpl->setContent($tab->getHTML());
 }
 public function parse($scoSelected, $report, $reports)
 {
     global $ilCtrl, $lng;
     $lng->loadLanguageModule("scormtrac");
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($ilCtrl->getFormAction($this->parent_obj));
     $options = array("all" => $lng->txt("all"));
     $scos = $this->parent_obj->object->getTrackedItems();
     foreach ($scos as $row) {
         $options[$row->getId()] = $row->getTitle();
     }
     $si = new ilSelectInputGUI($lng->txt("chapter"), "scoSelected");
     $si->setOptions($options);
     $si->setValue($scoSelected);
     $this->form->addItem($si);
     $options = array("choose" => $lng->txt("please_choose"));
     for ($i = 0; $i < count($reports); $i++) {
         $options[$reports[$i]] = $lng->txt(strtolower($reports[$i]));
     }
     $si = new ilSelectInputGUI($lng->txt("report"), "report");
     $si->setOptions($options);
     $si->setValue($report);
     $this->form->addItem($si);
     $this->form->addCommandButton($this->parent_cmd, $lng->txt("apply_filter"));
 }
 public function build()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parentGUI));
     $select = new ilSelectInputGUI($this->lng->txt("tst_analysis"), self::SKILL_PROFILE_PARAM);
     $select->setOptions($this->buildEvaluationModeOptionsArray());
     $select->setValue($this->getSelectedEvaluationMode());
     $this->addInputItem($select, true);
     $this->addFormButton($this->lng->txt("select"), $this->parentCMD);
 }
 protected function viewToolbar($a_is_initial = false)
 {
     global $ilToolbar, $lng, $ilCtrl;
     $current_figure = (int) $_POST["fig"];
     $current_time_frame = (string) $_POST["tfr"];
     $current_scope = (int) $_POST["scp"];
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $view = new ilSelectInputGUI($lng->txt("wiki_stat_figure"), "fig");
     $view->setOptions($this->page_id ? ilWikiStat::getFigureOptionsPage() : ilWikiStat::getFigureOptions());
     if ($current_figure) {
         $view->setValue($current_figure);
     } else {
         if ($a_is_initial) {
             // default
             $current_figure = $this->page_id ? ilWikiStat::KEY_FIGURE_WIKI_PAGE_CHANGES : ilWikiStat::KEY_FIGURE_WIKI_NUM_PAGES;
         }
     }
     $ilToolbar->addInputItem($view, true);
     $options = array();
     include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
     $lng->loadLanguageModule("dateplaner");
     foreach (ilWikiStat::getAvailableMonths($this->wiki_id) as $month) {
         $parts = explode("-", $month);
         $options[$month] = ilCalendarUtil::_numericMonthToString((int) $parts[1]) . " " . $parts[0];
     }
     krsort($options);
     $tframe = new ilSelectInputGUI($lng->txt("month"), "tfr");
     $tframe->setOptions($options);
     if ($current_time_frame) {
         $tframe->setValue($current_time_frame);
     } else {
         if ($a_is_initial) {
             $current_time_frame = array_shift(array_keys($options));
             // default
         }
     }
     $ilToolbar->addInputItem($tframe, true);
     $scope = new ilSelectInputGUI($lng->txt("wiki_stat_scope"), "scp");
     $scope->setOptions(array(1 => "1 " . $lng->txt("month"), 2 => "2 " . $lng->txt("months"), 3 => "3 " . $lng->txt("months"), 4 => "4 " . $lng->txt("months"), 5 => "5 " . $lng->txt("months"), 6 => "6 " . $lng->txt("months")));
     if ($current_scope) {
         $scope->setValue($current_scope);
     } else {
         if ($a_is_initial) {
             $current_scope = 1;
             // default
         }
     }
     $ilToolbar->addInputItem($scope, true);
     $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "view"));
     $ilToolbar->addFormButton($lng->txt("show"), "view");
     if ($current_figure && $current_time_frame && $current_scope) {
         $ilToolbar->addSeparator();
         $ilToolbar->addFormButton($lng->txt("export"), "export");
         return array("figure" => $current_figure, "month" => $current_time_frame, "scope" => $current_scope);
     }
 }
 public function addToForm()
 {
     global $lng;
     $def = $this->getADT()->getCopyOfDefinition();
     $options = $def->getOptions();
     asort($options);
     // ?
     $lng->loadLanguageModule("search");
     $options = array("" => $lng->txt("search_any")) + $options;
     $select = new ilSelectInputGUI($this->getTitle(), $this->getElementId());
     $select->setOptions($options);
     $select->setValue($this->getADT()->getSelection());
     $this->addToParentElement($select);
 }
 function showPersonalData()
 {
     // user_id $this->user_obj->getId()
     // all
     $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
     if (!count($items = $this->psc_obj->getEntries($this->pm_id))) {
         $this->tpl->setVariable("HEADER", $this->lng->txt('pay_bmf_your_order'));
         $this->tpl->touchBlock("stop_floating");
         ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
     } else {
         $this->tpl->setVariable("HEADER", $this->lng->txt('pay_step1'));
         $this->tpl->setVariable("TITLE", $this->lng->txt('pay_bmf_personal_data'));
         $this->tpl->setVariable("DESCRIPTION", $this->lng->txt('pay_bmf_description_personal_data'));
         $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
         $oForm = new ilPropertyFormGUI();
         $oForm->setFormAction($this->ctrl->getFormAction($this, 'getPersonalData'));
         $oForm->setTitle($this->lng->txt('pay_bmf_personal_data'));
         $oFirstname = new ilNonEditableValueGUI($this->lng->txt('firstname'));
         $oFirstname->setValue($this->user_obj->getFirstname());
         $oForm->addItem($oFirstname);
         $oLastname = new ilNonEditableValueGUI($this->lng->txt('lastname'));
         $oLastname->setValue($this->user_obj->getLastname());
         $oForm->addItem($oLastname);
         $oStreet = new ilTextInputGUI($this->lng->txt('street'), 'street');
         $oStreet->setValue($this->error != '' && isset($_POST['street']) ? ilUtil::prepareFormOutput($_POST['street'], true) : ilUtil::prepareFormOutput($_SESSION['bmf']['personal_data']['street'], true));
         $oForm->addItem($oStreet);
         $oHouseNumber = new ilTextInputGUI($this->lng->txt('pay_bmf_house_number'), 'house_number');
         $oHouseNumber->setValue($this->error != '' && isset($_POST['house_number']) ? ilUtil::prepareFormOutput($_POST['house_number'], true) : ilUtil::prepareFormOutput($_SESSION['bmf']['personal_data']['house_number'], true));
         $oForm->addItem($oHouseNumber);
         $oPoBox = new ilTextInputGUI($this->lng->txt('pay_bmf_or') . '  ' . $this->lng->txt('pay_bmf_po_box'), 'po_box');
         $oPoBox->setValue($this->error != '' && isset($_POST['po_box']) ? ilUtil::prepareFormOutput($_POST['po_box'], true) : ilUtil::prepareFormOutput($_SESSION['bmf']['personal_data']['po_box'], true));
         $oForm->addItem($oPoBox);
         $oZipCode = new ilTextInputGUI($this->lng->txt('zipcode'), 'zipcode');
         $oZipCode->setValue($this->error != '' && isset($_POST['zipcode']) ? ilUtil::prepareFormOutput($_POST['zipcode'], true) : ilUtil::prepareFormOutput($_SESSION['bmf']['personal_data']['zipcode'], true));
         $oForm->addItem($oZipCode);
         $oCity = new ilTextInputGUI($this->lng->txt('city'), 'city');
         $oCity->setValue($this->error != '' && isset($_POST['city']) ? ilUtil::prepareFormOutput($_POST['city'], true) : ilUtil::prepareFormOutput($_SESSION['bmf']['personal_data']['city'], true));
         $oForm->addItem($oCity);
         $oCountry = new ilSelectInputGUI($this->lng->txt('country'), 'country');
         $oCountry->setOptions($this->__getCountries());
         $oCountry->setValue($this->error != '' && isset($_POST['country']) ? $_POST['country'] : $_SESSION['bmf']['personal_data']['country']);
         $oForm->addItem($oCountry);
         $oEmail = new ilNonEditableValueGUI($this->lng->txt('email'));
         $oEmail->setValue($this->user_obj->getEmail());
         $oForm->addItem($oEmail);
         $oForm->addcommandButton('getPersonalData', ucfirst($this->lng->txt('next')));
         $this->tpl->setVariable('FORM', $oForm->getHTML());
     }
 }
 /**
  * List Records
  *
  *
  */
 public function listRecords()
 {
     global $ilTabs, $tpl, $lng, $ilCtrl, $ilToolbar;
     // Show tables
     require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
     if (ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id)) {
         $tables = $this->parent_obj->object->getTables();
     } else {
         $tables = $this->parent_obj->object->getVisibleTables();
     }
     foreach ($tables as $table) {
         $options[$table->getId()] = $table->getTitle();
     }
     $tpl->addCss("./Modules/DataCollection/css/dcl_reference_hover.css");
     if (count($options) > 0) {
         include_once './Services/Form/classes/class.ilSelectInputGUI.php';
         $table_selection = new ilSelectInputGUI('', 'table_id');
         $table_selection->setOptions($options);
         $table_selection->setValue($this->table_id);
         $ilToolbar->setFormAction($ilCtrl->getFormActionByClass("ilDataCollectionRecordListGUI", "doTableSwitch"));
         $ilToolbar->addText($lng->txt("dcl_table"));
         $ilToolbar->addInputItem($table_selection);
         $ilToolbar->addFormButton($lng->txt('change'), 'doTableSwitch');
         $ilToolbar->addSeparator();
     }
     if (($this->table_obj->getExportEnabled() || $this->table_obj->hasPermissionToFields($this->parent_obj->ref_id)) && count($this->table_obj->getExportableFields())) {
         $ilToolbar->addButton($lng->txt('dcl_export_table_excel'), $ilCtrl->getFormActionByClass("ildatacollectionrecordlistgui", "exportExcel"));
     }
     if ($this->table_obj->hasPermissionToAddRecord($this->parent_obj->ref_id) && $this->table_obj->hasCustomFields()) {
         $ilCtrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", null);
         $ilToolbar->addButton($lng->txt("dcl_import_records .xls"), $ilCtrl->getFormActionByClass("ildatacollectionrecordlistgui", "showImportExcel"));
         $ilToolbar->addButton($lng->txt("dcl_add_new_record"), $ilCtrl->getFormActionByClass("ildatacollectionrecordeditgui", "create"), "", "", "", "", "submit emphsubmit");
         // #11502
     }
     // requested not to implement this way...
     //$tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
     $tpl->addJavaScript("Modules/DataCollection/js/datacollection.js");
     if (count($this->table_obj->getRecordFields()) == 0) {
         ilUtil::sendInfo($lng->txt("dcl_no_fields_yet") . " " . ($this->table_obj->hasPermissionToFields($this->parent_obj->ref_id) ? $lng->txt("dcl_create_fields") : ""));
     }
     $list = new ilDataCollectionRecordListTableGUI($this, $ilCtrl->getCmd(), $this->table_obj);
     $tpl->getStandardTemplate();
     $tpl->setPermanentLink("dcl", $this->parent_obj->ref_id);
     if ($desc = $this->table_obj->getDescription()) {
         $desc = "<div class='ilDclTableDescription'>{$desc}</div>";
     }
     $tpl->setContent($desc . $list->getHTML());
 }
 public function build()
 {
     if ($this->isTestResultButtonEnabled()) {
         $link = ilLinkButton::getInstance();
         // always returns a new instance
         $link->setUrl($this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserResultsOverview'));
         $link->setCaption($this->lng->txt("tst_show_results"), false);
         $this->addButtonInstance($link);
         $this->addSeparator();
     }
     $this->setFormAction($this->ctrl->getFormAction($this->parentGUI));
     $select = new ilSelectInputGUI($this->lng->txt("tst_analysis"), self::SKILL_PROFILE_PARAM);
     $select->setOptions($this->buildEvaluationModeOptionsArray());
     $select->setValue($this->getSelectedEvaluationMode());
     $this->addInputItem($select, true);
     $this->addFormButton($this->lng->txt("select"), $this->parentCMD);
 }
 /**
  * initRecordListViewdefinitionForm
  *
  */
 public function initForm()
 {
     global $lng, $ilCtrl, $ilToolbar;
     // Show tables
     require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
     $arrTables = ilDataCollectionTable::getAll($this->obj_id);
     foreach ($arrTables as $table) {
         $options[$table['id']] = $table['title'];
     }
     include_once './Services/Form/classes/class.ilSelectInputGUI.php';
     $table_selection = new ilSelectInputGUI('', 'table_id');
     $table_selection->setOptions($options);
     $table_selection->setValue($this->table_id);
     $ilToolbar->setFormAction($ilCtrl->getFormActionByClass("ilDataCollectionRecordListViewdefinitionGUI", "doTableSwitch"));
     $ilToolbar->addInputItem($table_selection);
     $ilToolbar->addFormButton($lng->txt('change'), 'doTableSwitch');
     // Form
     require_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($ilCtrl->getFormAction($this), "save");
     $this->form->addCommandButton('save', $lng->txt('dcl_listviewdefinition_update'));
     $this->form->addCommandButton('cancel', $lng->txt('cancel'));
     //Table-ID
     $hidden_prop = new ilHiddenInputGUI("table_id");
     $hidden_prop->setValue($this->table_id);
     $this->form->addItem($hidden_prop);
     //Get fields
     require_once "./Modules/DataCollection/classes/class.ilDataCollectionField.php";
     $fields = ilDataCollectionField::getAll($this->table_id);
     $tabledefinition = array("id" => array("title" => $lng->txt("id")), "table_id" => array("title" => $lng->txt("dcl_table_id")), "create_date" => array("title" => $lng->txt("create_date")), "last_update" => array("title" => $lng->txt("last_update")), "owner" => array("title" => $lng->txt("owner")));
     //Array zusammenführen
     foreach ($fields as $key => $value) {
         $tabledefinition[$key] = $value;
     }
     foreach ($tabledefinition as $key => $field) {
         $chk_prop = new ilCheckboxInputGUI($field['title'], 'visible_' . $key);
         $chk_prop->setOptionTitle($lng->txt('visible'));
         $text_prop = new ilTextInputGUI($lng->txt('dcl_field_ordering'), 'order_' . $key);
         $chk_prop->addSubItem($text_prop);
         $this->form->addItem($chk_prop);
     }
     $this->form->setTitle($lng->txt('dcl_view_viewdefinition'));
 }
 public function showTopicsSettings()
 {
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $genSet = ilPaymentSettings::_getInstance();
     $genSetData = $genSet->getAll();
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'saveTopicsSettings'));
     $form->setTitle($this->lng->txt('pays_general_settings'));
     $form->addCommandButton('saveTopicsSettings', $this->lng->txt('save'));
     // use topics
     $formItem = new ilCheckboxInputGUI($this->lng->txt('enable_topics'), 'enable_topics');
     $formItem->setChecked((int) $genSetData['enable_topics']);
     $formItem->setInfo($this->lng->txt('enable_topics_info'));
     $form->addItem($formItem);
     // default sorting type
     $formItem = new ilSelectInputGUI($this->lng->txt('pay_topics_default_sorting_type'), 'topics_sorting_type');
     $formItem->setValue($genSetData['topics_sorting_type']);
     $options = array(1 => $this->lng->txt('pay_topics_sort_by_title'), 2 => $this->lng->txt('pay_topics_sort_by_date'), 3 => $this->lng->txt('pay_topics_sort_manually'));
     $formItem->setOptions($options);
     $form->addItem($formItem);
     // default sorting direction
     $formItem = new ilSelectInputGUI($this->lng->txt('pay_topics_default_sorting_direction'), 'topics_sorting_direction');
     $formItem->setValue($genSetData['topics_sorting_direction']);
     $options = array('asc' => $this->lng->txt('sort_asc'), 'desc' => $this->lng->txt('sort_desc'));
     $formItem->setOptions($options);
     $form->addItem($formItem);
     // topics custom sorting
     $formItem = new ilCheckboxInputGUI($this->lng->txt('pay_topics_allow_custom_sorting'), 'topics_allow_custom_sorting');
     $formItem->setChecked((int) $genSetData['topics_allow_custom_sorting']);
     $formItem->setInfo($this->lng->txt('pay_topics_allow_custom_sorting_info'));
     $form->addItem($formItem);
     // show topics filter
     $formItem = new ilCheckboxInputGUI($this->lng->txt('show_topics_filter'), 'show_topics_filter');
     $formItem->setChecked((int) $genSetData['show_topics_filter']);
     $formItem->setInfo($this->lng->txt('show_topics_filter_info'));
     $form->addItem($formItem);
     $this->tpl->setVariable('FORM', $form->getHTML());
     return true;
 }
 public static function getGeneralSettingsForm()
 {
     global $lng;
     $form = new ilPropertyFormGUI();
     require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
     $channels = ilNotificationDatabaseHandler::getAvailableChannels(array(), true);
     $options = array('set_by_user' => $lng->txt('set_by_user'), 'set_by_admin' => $lng->txt('set_by_admin'));
     /**
      * @todo dirty...
      */
     $form->restored_values = array();
     $store_values = array();
     foreach ($channels as $channel) {
         $chb = new ilCheckboxInputGUI($lng->txt('enable_' . $channel['name']), 'enable_' . $channel['name']);
         $store_values[] = 'enable_' . $channel['name'];
         $select = new ilSelectInputGUI($lng->txt('config_type'), 'notifications[' . $channel['name'] . ']');
         $select->setOptions($options);
         $select->setValue($channel['config_type']);
         $chb->addSubItem($select);
         /**
          * @todo dirty...
          */
         $form->restored_values['notifications[' . $channel['name'] . ']'] = $channel['config_type'];
         require_once $channel['include'];
         // let the channel display their own settings below the "enable channel"
         // checkbox
         $result = call_user_func(array($channel['handler'], 'showSettings'), $chb);
         if ($result) {
             $store_values = array_merge($result, $store_values);
         }
         $form->addItem($chb);
     }
     /**
      * @todo dirty...
      */
     $form->store_values = $store_values;
     return $form;
 }
 public function parse($userSelected, $report, $reports)
 {
     global $ilCtrl, $lng;
     $lng->loadLanguageModule("scormtrac");
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($ilCtrl->getFormAction($this->parent_obj));
     $options = array("all" => $lng->txt("all"));
     include_once "Services/Tracking/classes/class.ilTrQuery.php";
     $users = ilTrQuery::getParticipantsForObject($this->parent_obj->object->ref_id);
     include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     $allowExportPrivacy = $privacy->enabledExportSCORM();
     //$users = $this->parent_obj->object->getTrackedUsers("");
     foreach ($users as $user) {
         if (ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
             if ($allowExportPrivacy == true) {
                 $e_user = new ilObjUser($user);
                 $options[$user] = $e_user->getLastname() . ", " . $e_user->getFirstname();
             } else {
                 $options[$user] = 'User Id: ' . $user;
             }
         }
     }
     $si = new ilSelectInputGUI($lng->txt("user"), "userSelected");
     $si->setOptions($options);
     $si->setValue($userSelected);
     $this->form->addItem($si);
     $options = array("choose" => $lng->txt("please_choose"));
     for ($i = 0; $i < count($reports); $i++) {
         $options[$reports[$i]] = $lng->txt(strtolower($reports[$i]));
     }
     $si = new ilSelectInputGUI($lng->txt("report"), "report");
     $si->setOptions($options);
     $si->setValue($report);
     $this->form->addItem($si);
     $this->form->addCommandButton($this->parent_cmd, $lng->txt("apply_filter"));
 }
 /**
  * get html
  *
  * @access public
  * @param
  * @return
  */
 public function initForm()
 {
     $rec = new ilSelectInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
     $rec->setRequired(true);
     $rec->setOptions(array(0 => $this->lng->txt('cal_no_recurrence'), ilCalendarRecurrence::FREQ_DAILY => $this->lng->txt('cal_rec_daily'), ilCalendarRecurrence::FREQ_WEEKLY => $this->lng->txt('cal_rec_weekly'), ilCalendarRecurrence::FREQ_MONTHLY => $this->lng->txt('cal_rec_monthly'), ilCalendarRecurrence::FREQ_YEARLY => $this->lng->txt('cal_rec_yearly')));
     $rec->setValue($this->recurrence->getFrequenceType());
     $this->form->addItem($rec);
     // DAILY part
     $interval = new ilTextInputGUI($this->lng->txt('interval'), 'interval');
     $interval->setSize(2);
     $interval->setMaxLength(3);
     $interval->setValue($this->recurrence->getInterval() ? $this->recurrence->getInterval() : 1);
     $interval->setInfo($this->lng->txt('interval_info'));
     $rec->addSubItem($interval);
     // Weekly
     $check = new ilCheckboxInputGUI($this->lng->txt('Su_short'), 'w_day[0]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Mo_short'), 'w_day[1]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Tu_short'), 'w_day[2]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('We_short'), 'w_day[3]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Th_short'), 'w_day[4]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Fr_short'), 'w_day[5]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Sa_short'), 'w_day[6]');
     $check->setChecked(true);
     $rec->addSubItem($check);
 }
 public function appendToolbarSwitch(ilToolbarGUI $toolbar, $a_obj_type, $a_ref_id)
 {
     include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettings.php';
     $tpls = ilDidacticTemplateSettings::getInstanceByObjectType($a_obj_type)->getTemplates();
     if (!count($tpls)) {
         return false;
     }
     // Add template switch
     $toolbar->addText($this->lng->txt('didactic_selected_tpl_option'));
     // Show template options
     $options = array(0 => $this->lng->txt('didactic_default_type'));
     foreach ($tpls as $tpl) {
         $options[$tpl->getId()] = $tpl->getTitle();
     }
     include_once './Services/Form/classes/class.ilSelectInputGUI.php';
     include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
     $tpl_selection = new ilSelectInputGUI('', 'tplid');
     $tpl_selection->setOptions($options);
     $tpl_selection->setValue(ilDidacticTemplateObjSettings::lookupTemplateId($this->getParentObject()->object->getRefId()));
     $toolbar->addInputItem($tpl_selection);
     // Apply templates switch
     $toolbar->addFormButton($this->lng->txt('change'), 'confirmTemplateSwitch');
     return true;
 }
 /**
  * Add all fields to the form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $title = $this->type->getId() ? $this->lng->txt('orgu_type_edit') : $this->lng->txt('orgu_type_add');
     $this->setTitle($title);
     $item = new ilSelectInputGUI($this->lng->txt('default_language'), 'default_lang');
     $item->setValue($this->type->getDefaultLang());
     $languages = $this->lng->getInstalledLanguages();
     $options = array();
     foreach ($languages as $lang_code) {
         $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}");
     }
     $item->setOptions($options);
     $item->setRequired(true);
     $this->addItem($item);
     foreach ($languages as $lang_code) {
         $this->addTranslationInputs($lang_code);
     }
     if ($this->type->getId()) {
         $this->addCommandButton('update', $this->lng->txt('save'));
     } else {
         $this->addCommandButton('create', $this->lng->txt('create'));
     }
 }
 /**
  * Show Participant
  */
 function showParticipantObject()
 {
     global $rbacsystem, $tree, $tpl, $ilToolbar, $ilCtrl, $ilTabs, $lng;
     $this->checkPermission("write");
     $ilTabs->activateTab("grades");
     $this->addSubmissionSubTabs("participant");
     // participant selection
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     $ass = ilExAssignment::getAssignmentDataOfExercise($this->object->getId());
     $members = $this->object->members_obj->getMembers();
     if (count($members) == 0) {
         ilUtil::sendInfo($lng->txt("exc_no_participants"));
         return;
     }
     $mems = array();
     foreach ($members as $mem_id) {
         if (ilObject::_lookupType($mem_id) == "usr") {
             include_once "./Services/User/classes/class.ilObjUser.php";
             $name = ilObjUser::_lookupName($mem_id);
             $mems[$mem_id] = $name;
         }
     }
     $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true);
     if ($_GET["part_id"] == "" && count($mems) > 0) {
         $_GET["part_id"] = key($mems);
     }
     reset($mems);
     if (count($mems) > 1) {
         $options = array();
         foreach ($mems as $k => $m) {
             $options[$k] = $m["lastname"] . ", " . $m["firstname"] . " [" . $m["login"] . "]";
         }
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI($this->lng->txt(""), "part_id");
         $si->setOptions($options);
         $si->setValue($_GET["part_id"]);
         $ilToolbar->addInputItem($si);
         $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
         $ilToolbar->addFormButton($this->lng->txt("exc_select_part"), "selectParticipant");
     }
     if (count($mems) > 0) {
         include_once "./Modules/Exercise/classes/class.ilExParticipantTableGUI.php";
         $part_tab = new ilExParticipantTableGUI($this, "showParticipant", $this->object, $_GET["part_id"]);
         $tpl->setContent($part_tab->getHTML());
     } else {
         ilUtil::sendInfo($this->lng->txt("exc_no_assignments_available"));
     }
 }
 /**
  * Init login form
  */
 protected function initLoginForm()
 {
     global $rbacsystem, $lng, $ilSetting;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveLoginInfo'));
     $this->form->setTableWidth('80%');
     $this->form->setTitle($this->lng->txt('login_information'));
     $this->form->addCommandButton('saveLoginInfo', $this->lng->txt('save'));
     include_once 'Services/LDAP/classes/class.ilLDAPServer.php';
     include_once 'Services/Radius/classes/class.ilRadiusSettings.php';
     $rad_settings = ilRadiusSettings::_getInstance();
     if ($ldap_id = ilLDAPServer::_getFirstActiveServer() or $rad_settings->isActive()) {
         $select = new ilSelectInputGUI($this->lng->txt('default_auth_mode'), 'default_auth_mode');
         $select->setValue($ilSetting->get('default_auth_mode', AUTH_LOCAL));
         $select->setInfo($this->lng->txt('default_auth_mode_info'));
         $options[AUTH_LOCAL] = $this->lng->txt('auth_local');
         if ($ldap_id) {
             $options[AUTH_LDAP] = $this->lng->txt('auth_ldap');
         }
         if ($rad_settings->isActive()) {
             $options[AUTH_RADIUS] = $this->lng->txt('auth_radius');
         }
         $select->setOptions($options);
         $this->form->addItem($select);
     }
     if (!is_object($this->loginSettings)) {
         $this->loginSettings = new ilSetting("login_settings");
     }
     $login_settings = $this->loginSettings->getAll();
     $languages = $lng->getInstalledLanguages();
     $def_language = $lng->getDefaultLanguage();
     foreach ($this->setDefLangFirst($def_language, $languages) as $lang_key) {
         $add = "";
         if ($lang_key == $def_language) {
             $add = " (" . $lng->txt("default") . ")";
         }
         $textarea = new ilTextAreaInputGUI($lng->txt("meta_l_" . $lang_key) . $add, 'login_message_' . $lang_key);
         $textarea->setRows(10);
         $textarea->setValue($login_settings["login_message_" . $lang_key]);
         $textarea->setUseRte(true);
         $textarea->setRteTagSet("extended");
         $this->form->addItem($textarea);
         unset($login_settings["login_message_" . $lang_key]);
     }
     foreach ($login_settings as $key => $message) {
         $lang_key = substr($key, strrpos($key, "_") + 1, strlen($key) - strrpos($key, "_"));
         $textarea = new ilTextAreaInputGUI($lng->txt("meta_l_" . $lang_key) . $add, 'login_message_' . $lang_key);
         $textarea->setRows(10);
         $textarea->setValue($message);
         $textarea->setUseRte(true);
         $textarea->setRteTagSet("extended");
         if (!in_array($lang_key, $languages)) {
             $textarea->setAlert($lng->txt("not_installed"));
         }
         $this->form->addItem($textarea);
     }
 }
 /**
  * Render toolbar form
  *
  * @param array $a_pages
  */
 protected function renderToolbar($a_pages)
 {
     global $ilToolbar, $ilCtrl, $lng, $ilUser;
     if (!$this->has_datasets) {
         $ilToolbar->addButton($lng->txt("survey_add_new_question"), $ilCtrl->getLinkTarget($this, "addQuestionToolbarForm"));
         if ($this->object->isPoolActive()) {
             $ilToolbar->addSeparator();
             $last_on_page = 0;
             if ($a_pages) {
                 $last_on_page = $a_pages[$this->current_page - 1];
                 $last_on_page = array_pop($last_on_page);
                 $last_on_page = $last_on_page["question_id"];
             }
             $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
             $ilCtrl->setParameter($this->editor_gui, "pgov_pos", $last_on_page . "c");
             $cmd = $ilUser->getPref('svy_insert_type') == 1 || strlen($ilUser->getPref('svy_insert_type')) == 0 ? 'browseForQuestions' : 'browseForQuestionblocks';
             $ilToolbar->addButton($lng->txt("browse_for_questions"), $ilCtrl->getLinkTarget($this->editor_gui, $cmd));
             $ilCtrl->setParameter($this->editor_gui, "pgov", "");
             $ilCtrl->setParameter($this->editor_gui, "pgov_pos", "");
         }
         if ($a_pages) {
             $ilToolbar->addSeparator();
         }
     }
     // parse data for pages drop-down
     if ($a_pages) {
         // previous/next
         $ilCtrl->setParameter($this, "pg", $this->current_page - 1);
         $ilToolbar->addLink($lng->txt("survey_prev_question"), $ilCtrl->getLinkTarget($this, "renderPage"), !$this->has_previous_page);
         $ilCtrl->setParameter($this, "pg", $this->current_page + 1);
         $ilToolbar->addLink($lng->txt("survey_next_question"), $ilCtrl->getLinkTarget($this, "renderPage"), !$this->has_next_page);
         $ilCtrl->setParameter($this, "pg", $this->current_page);
         foreach ($a_pages as $idx => $questions) {
             $page = $questions;
             $page = array_shift($page);
             if ($page["questionblock_id"]) {
                 $pages_drop[$idx + 1] = $page["questionblock_title"];
                 if (sizeof($questions) > 1) {
                     foreach ($questions as $question) {
                         $pages_drop[$idx + 1 . "__" . $question["question_id"]] = "- " . $question["title"];
                     }
                 }
             } else {
                 $pages_drop[$idx + 1] = strip_tags($page["title"]);
             }
         }
     }
     // jump to page
     if (sizeof($pages_drop) > 1) {
         $ilToolbar->addSeparator();
         $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
         include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
         $si = new ilSelectInputGUI($lng->txt("survey_jump_to"), "jump");
         $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
         $si->setOptions($pages_drop);
         $si->setValue($this->current_page);
         $ilToolbar->addInputItem($si, true);
         // we need this to have to right cmd
         $cmd = new ilHiddenInputGUI("cmd[renderPage]");
         $cmd->setValue("1");
         $ilToolbar->addInputItem($cmd);
         if (!$this->has_datasets) {
             $ilToolbar->addSeparator();
             $ilCtrl->setParameter($this, "csum", md5(print_r($a_pages[$this->current_page - 1], true)));
             $ilToolbar->addButton($lng->txt("survey_delete_page"), $ilCtrl->getLinkTarget($this, "deleteBlock"));
             $ilCtrl->setParameter($this, "csum", "");
             $ilToolbar->addSeparator();
             $ilToolbar->addButton($lng->txt("survey_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
         }
     }
 }
 public function listRecords()
 {
     global $tpl, $lng, $ilToolbar;
     /**
      * @var $ilToolbar ilToolbarGUI
      * @var $ilToolbar ilToolbarGUI
      */
     // Show tables
     require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
     if (ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id)) {
         $tables = $this->parent_obj->object->getTables();
     } else {
         $tables = $this->parent_obj->object->getVisibleTables();
     }
     $options = array();
     foreach ($tables as $table) {
         $options[$table->getId()] = $table->getTitle();
     }
     $tpl->addCss("./Modules/DataCollection/css/dcl_reference_hover.css");
     $list = new ilDataCollectionRecordListTableGUI($this, "listRecords", $this->table_obj, $this->mode);
     $list->setExternalSegmentation(true);
     $list->setExternalSorting(true);
     $list->determineLimit();
     $list->determineOffsetAndOrder();
     $data = $this->table_obj->getPartialRecords($list->getOrderField(), $list->getOrderDirection(), $list->getLimit(), $list->getOffset(), $list->getFilter());
     $records = $data['records'];
     $total = $data['total'];
     $list->setMaxCount($total);
     $list->setRecordData($records);
     if (count($options) > 0) {
         include_once './Services/Form/classes/class.ilSelectInputGUI.php';
         $table_selection = new ilSelectInputGUI('', 'table_id');
         $table_selection->setOptions($options);
         $table_selection->setValue($this->table_id);
         $ilToolbar->setFormAction($this->ctrl->getFormActionByClass("ilDataCollectionRecordListGUI", "doTableSwitch"));
         $ilToolbar->addText($lng->txt("dcl_table"));
         $ilToolbar->addInputItem($table_selection);
         $ilToolbar->addFormButton($lng->txt('change'), 'doTableSwitch');
         $ilToolbar->addSeparator();
     }
     $permission_to_add_or_import = $this->table_obj->hasPermissionToAddRecord($this->parent_obj->ref_id) and $this->table_obj->hasCustomFields();
     if ($permission_to_add_or_import) {
         $this->ctrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", NULL);
         $add_new = ilLinkButton::getInstance();
         $add_new->setCaption("dcl_add_new_record");
         $add_new->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordeditgui", "create"));
         //			$add_new->addCSSClass('emphsubmit');
         $ilToolbar->addButtonInstance($add_new);
     }
     if ($this->table_obj->getExportEnabled() or $this->table_obj->hasPermissionToFields($this->parent_obj->ref_id)) {
         $export = ilDataCollectionLinkButton::getInstance();
         $export->setCaption("dcl_export_table_excel");
         $export->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordlistgui", "exportExcel"));
         if (count($this->table_obj->getExportableFields()) == 0 or $total == 0) {
             $export->setUseWrapper(true);
             $export->setDisabled(true);
             $export->addAttribute('data-toggle', 'datacollection-tooltip', true);
             $export->addAttribute('data-placement', 'bottom', true);
             $export->addAttribute('title', $lng->txt('dcl_no_exportable_fields_or_no_data'), true);
         }
         $ilToolbar->addButtonInstance($export);
     }
     if ($permission_to_add_or_import) {
         $this->ctrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", NULL);
         $import = ilLinkButton::getInstance();
         $import->setCaption("dcl_import_records .xls");
         $import->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordlistgui", "showImportExcel"));
         $ilToolbar->addButtonInstance($import);
     }
     // requested not to implement this way...
     //$tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
     if (count($this->table_obj->getRecordFields()) == 0) {
         ilUtil::sendInfo($lng->txt("dcl_no_fields_yet") . " " . ($this->table_obj->hasPermissionToFields($this->parent_obj->ref_id) ? $lng->txt("dcl_create_fields") : ""));
     }
     $tpl->getStandardTemplate();
     $tpl->setPermanentLink("dcl", $this->parent_obj->ref_id);
     if ($desc = $this->table_obj->getDescription()) {
         $desc = "<div class='ilDclTableDescription'>{$desc}</div>";
     }
     $tpl->setContent($desc . $list->getHTML());
 }
 /**
  * Prepares history table and displays it.
  *
  * @global ilTemplate $tpl
  * @global ilLanguage $lng
  * @param array $messages
  * @param ilPropertyFormGUI $durationForm
  */
 private function showMessages($messages, $durationForm, $export = false, $psessions = array(), $from, $to)
 {
     //global $tpl, $ilUser, $ilCtrl, $lng;
     global $tpl, $lng, $ilCtrl;
     include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     if (!ilChatroom::checkUserPermissions('read', $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass("ilrepositorygui", "");
     }
     $this->gui->switchToVisibleMode();
     $tpl->addCSS('Modules/Chatroom/templates/default/style.css');
     // should be able to grep templates
     if ($export) {
         $roomTpl = new ilTemplate('tpl.history_export.html', true, true, 'Modules/Chatroom');
     } else {
         $roomTpl = new ilTemplate('tpl.history.html', true, true, 'Modules/Chatroom');
     }
     $scopes = array();
     if ($export) {
         ilDatePresentation::setUseRelativeDates(false);
     }
     global $ilUser;
     $time_format = $ilUser->getTimeFormat();
     $prevDate = '';
     $messagesShown = 0;
     $lastDateTime = null;
     foreach ($messages as $message) {
         $message['message']->message = json_decode($message['message']->message);
         switch ($message['message']->type) {
             case 'message':
                 if ($_REQUEST['scope'] && $message['message']->sub == $_REQUEST['scope'] || !$_REQUEST['scope'] && !$message['message']->sub) {
                     $date = new ilDate($message['timestamp'], IL_CAL_UNIX);
                     $dateTime = new ilDateTime($message['timestamp'], IL_CAL_UNIX);
                     $currentDate = ilDatePresentation::formatDate($dateTime);
                     $roomTpl->setCurrentBlock('MESSAGELINE');
                     $roomTpl->setVariable('MESSAGECONTENT', $message['message']->message->content);
                     // oops... it is a message? ^^
                     $roomTpl->setVariable('MESSAGESENDER', $message['message']->user->username);
                     if (null == $lastDateTime || date('d', $lastDateTime->get(IL_CAL_UNIX)) != date('d', $dateTime->get(IL_CAL_UNIX)) || date('m', $lastDateTime->get(IL_CAL_UNIX)) != date('m', $dateTime->get(IL_CAL_UNIX)) || date('Y', $lastDateTime->get(IL_CAL_UNIX)) != date('Y', $dateTime->get(IL_CAL_UNIX))) {
                         $roomTpl->setVariable('MESSAGEDATE', ilDatePresentation::formatDate($date));
                     }
                     if ($prevDate != $currentDate) {
                         switch ($time_format) {
                             case ilCalendarSettings::TIME_FORMAT_24:
                                 $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone());
                                 break;
                             case ilCalendarSettings::TIME_FORMAT_12:
                                 $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone());
                                 break;
                         }
                         $roomTpl->setVariable('MESSAGETIME', $date_string);
                         $prevDate = $currentDate;
                     }
                     $roomTpl->parseCurrentBlock();
                     $lastDateTime = $dateTime;
                     ++$messagesShown;
                 }
                 break;
         }
     }
     foreach ($psessions as $session) {
         $scopes[$session['proom_id']] = $session['title'];
     }
     if (isset($scopes[''])) {
         unset($scopes['']);
     }
     if (!$messagesShown) {
         //$roomTpl->touchBlock('NO_MESSAGES');
         $roomTpl->setVariable('LBL_NO_MESSAGES', $lng->txt('no_messages'));
     }
     asort($scopes, SORT_STRING);
     $scopes = array($lng->txt('main')) + $scopes;
     if (count($scopes) > 1) {
         $select = new ilSelectInputGUI($lng->txt('scope'), 'scope');
         $select->setOptions($scopes);
         if (isset($_REQUEST['scope'])) {
             $select->setValue($_REQUEST['scope']);
         }
         $durationForm->addItem($select);
     }
     $room = ilChatroom::byObjectId($this->gui->object->getId());
     //if ($room->getSetting('private_rooms_enabled')) {
     $prevUseRelDates = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $unixFrom = $from->getUnixTime();
     $unixTo = $to->getUnixTime();
     if ($unixFrom == $unixTo) {
         $date = new ilDate($unixFrom, IL_CAL_UNIX);
         $date_sub = ilDatePresentation::formatDate($date);
     } else {
         $date1 = new ilDate($unixFrom, IL_CAL_UNIX);
         $date2 = new ilDate($unixTo, IL_CAL_UNIX);
         $date_sub = ilDatePresentation::formatPeriod($date1, $date2);
     }
     ilDatePresentation::setUseRelativeDates($prevUseRelDates);
     $isPrivateRoom = (bool) (int) $_REQUEST['scope'];
     if ($isPrivateRoom) {
         $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_private_room'), $scopes[(int) $_REQUEST['scope']]) . ' (' . $date_sub . ')');
     } else {
         $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_general'), $this->gui->object->getTitle()) . ' (' . $date_sub . ')');
     }
     //}
     if ($export) {
         header("Content-Type: text/html");
         header("Content-Disposition: attachment; filename=\"" . urlencode($scopes[(int) $_REQUEST['scope']] . '.html') . "\"");
         echo $roomTpl->get();
         exit;
     }
     $roomTpl->setVariable('PERIOD_FORM', $durationForm->getHTML());
     $tpl->setVariable('ADM_CONTENT', $roomTpl->get());
 }
 /**
  * Edit resources form.
  */
 function edit($a_insert = false)
 {
     global $ilCtrl, $tpl, $lng, $objDefinition;
     $this->displayValidationError();
     // edit form
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     if ($a_insert) {
         $form->setTitle($this->lng->txt("cont_insert_resources"));
     } else {
         $form->setTitle($this->lng->txt("cont_update_resources"));
     }
     // count number of existing objects per type and collect item groups
     $ref_id = (int) $_GET["ref_id"];
     $childs = $this->rep_tree->getChilds($ref_id);
     $type_counts = array();
     $item_groups = array();
     foreach ($childs as $c) {
         $type_counts[$c["type"]] += 1;
         if ($c["type"] == "itgr") {
             $item_groups[$c["ref_id"]] = $c["title"];
         }
     }
     if (count($item_groups) > 0) {
         // radio group for type selection
         $radg = new ilRadioGroupInputGUI($lng->txt("cont_resources"), "res_type");
         if (!$a_insert && $this->content_obj->getMainType() == "ItemGroup") {
             $radg->setValue("itgr");
         } else {
             $radg->setValue("by_type");
         }
         $op_type = new ilRadioOption($lng->txt("cont_resources_of_type"), "by_type", "");
         $radg->addOption($op_type);
         $op_itemgroup = new ilRadioOption($lng->txt("obj_itgr"), "itgr", "");
         $radg->addOption($op_itemgroup);
         $form->addItem($radg);
     }
     // type selection
     $type_prop = new ilSelectInputGUI($this->lng->txt("cont_type"), "type");
     $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
     $obj_type = ilObject::_lookupType($obj_id);
     $sub_objs = $objDefinition->getGroupedRepositoryObjectTypes($obj_type);
     $types = array();
     foreach ($sub_objs as $k => $so) {
         if ($k != "itgr") {
             $types[$k] = $this->lng->txt("objs_" . $k) . " (" . (int) $type_counts[$k] . ")";
         }
     }
     $type_prop->setOptions($types);
     $selected = $a_insert ? "" : $this->content_obj->getResourceListType();
     $type_prop->setValue($selected);
     if (count($item_groups) > 0) {
         $op_type->addSubItem($type_prop);
     } else {
         $form->addItem($type_prop);
     }
     if (count($item_groups) > 0) {
         // item groups
         $options = $item_groups;
         $si = new ilSelectInputGUI($this->lng->txt("obj_itgr"), "itgr");
         $si->setOptions($options);
         $selected = $a_insert ? "" : $this->content_obj->getItemGroupRefId();
         $op_itemgroup->addSubItem($si);
     }
     // save/cancel buttons
     if ($a_insert) {
         $form->addCommandButton("create_resources", $lng->txt("save"));
         $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
     } else {
         $form->addCommandButton("update_resources", $lng->txt("save"));
         $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
     }
     $html = $form->getHTML();
     $tpl->setContent($html);
     return $ret;
 }
 public function InvoiceNumberObject()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $invObj = new ilUserDefinedInvoiceNumber();
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
     $form_gui = new ilPropertyFormGUI();
     $form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveInvoiceNumber'));
     $form_gui->setTitle($this->lng->txt('invoice_number_setting'));
     // invoice_type
     $radio_group = new ilRadioGroupInputGUI($this->lng->txt('invoice_number'), 'ud_invoice_number');
     $radio_option_1 = new ilRadioOption($this->lng->txt('ilias_invoice_number'), '0');
     $radio_group->addOption($radio_option_1);
     $radio_option_2 = new ilRadioOption($this->lng->txt('userdefined_invoice_number'), '1');
     $radio_group->addOption($radio_option_2);
     $radio_group->setRequired(true);
     $radio_group->setValue($invObj->getUDInvoiceNumberActive(), '0');
     $radio_group->setPostVar('ud_invoice_number');
     $form_gui->addItem($radio_group);
     // incremental current value
     $cur_num = new ilNonEditableValueGUI($this->lng->txt('incremental_current_value'), 'inc_current_value');
     $cur_num->setValue(ilUserDefinedInvoiceNumber::_getIncCurrentValue(), 1);
     $radio_option_2->addSubItem($cur_num);
     // incremental start value
     $inc_num = new ilNumberInputGUI($this->lng->txt('incremental_start_value'), 'inc_start_value');
     $inc_num->setValue($this->error != "" && isset($_POST['incremental_start_value']) ? ilUtil::prepareFormOutput($_POST['incremental_start_value'], true) : ilUtil::prepareFormOutput($invObj->getIncStartValue(), true));
     $inc_num->setInfo($this->lng->txt('incremental_start_value_info'));
     $radio_option_2->addSubItem($inc_num);
     // reset period of current value
     $sel_reset = new ilSelectInputGUI($this->lng->txt('invoice_number_reset_period'), 'inc_reset_period');
     $sel_reset->setValue($this->error != "" && isset($_POST['inc_reset_period']) ? $_POST['inc_reset_period'] : $invObj->getIncResetPeriod());
     $reset_options = array(1 => $this->lng->txt('yearly'), 2 => $this->lng->txt('monthly'));
     $sel_reset->setOptions($reset_options);
     $radio_option_2->addSubItem($sel_reset);
     // invoice_number_text
     $inp = new ilTextAreaInputGUI($this->lng->txt('invoice_number_text'), 'invoice_number_text');
     $inp->setValue($this->error != "" && isset($_POST['invoice_number_text']) ? ilUtil::prepareFormOutput($_POST['invoice_number_text'], true) : ilUtil::prepareFormOutput($invObj->getInvoiceNumberText(), true));
     $inp->setRequired(false);
     $inp->setCols(60);
     $inp->setRows(3);
     $radio_option_2->addSubItem($inp);
     // PLACEHOLDERS
     $prop = new ilInvoiceNumberPlaceholdersPropertyGUI();
     $radio_option_2->addSubItem($prop);
     $form_gui->addCommandButton('saveInvoiceNumber', $this->lng->txt('save'));
     $this->tpl->setVariable('FORM', $form_gui->getHTML());
 }
 /**
  * Creates a form property for the precondition value
  *
  * @return The ILIAS form element
  * @access public
  */
 public function getPreconditionSelectValue($default = "", $title, $variable)
 {
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $step3 = new ilSelectInputGUI($title, $variable);
     $options = $this->getPreconditionOptions();
     $step3->setOptions($options);
     $step3->setValue($default);
     return $step3;
 }
 function initStylePropertiesForm()
 {
     global $ilSetting;
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->lng->loadLanguageModule("style");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $fixed_style = $ilSetting->get("fixed_content_style_id");
     $style_id = $this->object->getStyleSheetId();
     if ($fixed_style > 0) {
         $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
         $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" . $this->lng->txt("global_fixed") . ")");
         $form->addItem($st);
     } else {
         $st_styles = ilObjStyleSheet::_getStandardStyles(true, false, $_GET["ref_id"]);
         $st_styles[0] = $this->lng->txt("default");
         ksort($st_styles);
         if ($style_id > 0) {
             // individual style
             if (!ilObjStyleSheet::_lookupStandard($style_id)) {
                 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
                 $st->setValue(ilObject::_lookupTitle($style_id));
                 $form->addItem($st);
                 // delete command
                 $form->addCommandButton("editStyle", $this->lng->txt("style_edit_style"));
                 $form->addCommandButton("deleteStyle", $this->lng->txt("style_delete_style"));
             }
         }
         if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
             $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"), "style_id");
             $style_sel->setOptions($st_styles);
             $style_sel->setValue($style_id);
             $form->addItem($style_sel);
             $form->addCommandButton("saveStyleSettings", $this->lng->txt("save"));
             $form->addCommandButton("createStyle", $this->lng->txt("sty_create_ind_style"));
         }
     }
     $form->setTitle($this->lng->txt("blog_style"));
     $form->setFormAction($this->ctrl->getFormAction($this));
     return $form;
 }
 /**
  * Show export IDs overview
  *
  * @param
  * @return
  */
 function showTooltipList()
 {
     global $tpl, $ilToolbar, $ilCtrl, $lng;
     $this->setTabs();
     $this->setContentSubTabs("help_tooltips");
     $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
     $ti->setMaxLength(200);
     $ti->setSize(20);
     $ilToolbar->addInputItem($ti, true);
     $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
     $ilToolbar->addSeparator();
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $options = ilHelp::getTooltipComponents();
     if (ilSession::get("help_tt_comp") != "") {
         $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
     }
     $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
     $si->setOptions($options);
     $si->setValue(ilSession::get("help_tt_comp"));
     $ilToolbar->addInputItem($si, true);
     $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
     include_once "./Modules/LearningModule/classes/class.ilHelpTooltipTableGUI.php";
     $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", ilSession::get("help_tt_comp"));
     $tpl->setContent($tbl->getHTML());
 }
 public function showAssignmentForm()
 {
     global $ilUser, $ilErr;
     if (!$this->mlists->getCurrentMailingList()->getId()) {
         $this->showMembersList();
         return true;
     }
     if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId())) {
         $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
     }
     $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
     $form->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
     $form->setTitle($this->lng->txt('mail_assign_entry_to_mailing_list') . ' ' . $this->mlists->getCurrentMailingList()->getTitle());
     $options = array();
     $options[''] = $this->lng->txt('please_select');
     $all_entries = $this->abook->getEntries();
     if ((int) count($all_entries)) {
         foreach ($all_entries as $entry) {
             $options[$entry['addr_id']] = $entry['login'] != '' ? $entry['login'] : $entry['email'];
         }
     }
     $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
     if ((int) count($assigned_entries)) {
         foreach ($assigned_entries as $assigned_entry) {
             if (is_array($options) && array_key_exists($assigned_entry['addr_id'], $options)) {
                 unset($options[$assigned_entry['addr_id']]);
             }
         }
     }
     if (count($options) > 1) {
         $formItem = new ilSelectInputGUI($this->lng->txt('mail_entry_of_addressbook'), 'addr_id');
         $formItem->setOptions($options);
         $formItem->setValue($this->mlists->getCurrentMailingList()->getTitle());
         $form->addItem($formItem);
         $form->addCommandButton('saveAssignmentForm', $this->lng->txt('assign'));
     } else {
         if (count($options) == 1 && (int) count($all_entries)) {
             ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_all_addressbook_entries_assigned'));
         } else {
             if (!(int) count($all_entries)) {
                 ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_no_addressbook_entries'));
             }
         }
     }
     $form->addCommandButton('showMembersList', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form->getHTML());
     $this->tpl->show();
     return true;
 }