/**
  * @param array $data
  */
 public function fillRow(array $data)
 {
     $this->tpl->setVariable("LOGIN", $data['login']);
     $this->tpl->setVariable("NAME", $data['name']);
     $this->tpl->setVariable("STARTED", $data['started']);
     $this->tpl->setVariable("EXTRATIME", ilFormat::_secondsToString($data['extratime'] * 60));
 }
 public function send()
 {
     switch ($this->getType()) {
         case self::TYPE_NOTIFICATION_ACTIVATION:
             $additional_information = $this->getAdditionalInformation();
             /**
              * @var $user ilObjUser
              */
             $user = $additional_information['usr'];
             foreach ($this->getRecipients() as $rcp) {
                 try {
                     $this->handleCurrentRecipient($rcp);
                 } catch (ilMailException $e) {
                     continue;
                 }
                 $this->initMimeMail();
                 $this->setSubject($this->getLanguage()->txt('reg_mail_subject_confirmation'));
                 $this->setBody($this->getLanguage()->txt('reg_mail_body_salutation') . ' ' . $user->getFullname() . ',');
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguage()->txt('reg_mail_body_confirmation'));
                 $this->appendBody("\n");
                 $this->appendBody(ILIAS_HTTP_PATH . '/confirmReg.php?client_id=' . CLIENT_ID . '&rh=' . ilObjUser::_generateRegistrationHash($user->getId()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguage()->txt('reg_mail_body_2_confirmation'), ilFormat::_secondsToString($additional_information['hash_lifetime'])));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguage()->txt('reg_mail_body_3_confirmation'));
                 $this->appendBody(ilMail::_getInstallationSignature());
                 $this->sendMimeMail($this->getCurrentRecipient());
             }
             break;
     }
 }
 /**
  * Fill table row
  */
 protected function fillRow($data)
 {
     global $ilCtrl, $lng;
     if (!$this->isPercentageAvailable($data["obj_id"])) {
         $data["percentage"] = NULL;
     }
     foreach ($this->getSelectedColumns() as $c) {
         $val = trim($data[$c]) == "" ? " " : $data[$c];
         if ($data[$c] != "" || $c == "status") {
             switch ($c) {
                 case "first_access":
                     $val = ilDatePresentation::formatDate(new ilDateTime($data[$c], IL_CAL_DATETIME));
                     break;
                 case "last_access":
                     $val = ilDatePresentation::formatDate(new ilDateTime($data[$c], IL_CAL_UNIX));
                     break;
                 case "status":
                     include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
                     $path = ilLearningProgressBaseGUI::_getImagePathForStatus($data[$c]);
                     $text = ilLearningProgressBaseGUI::_getStatusText($data[$c]);
                     $val = ilUtil::img($path, $text);
                     if ($data["type"] != "lobj" && $data["type"] != "sco") {
                         $timing = $this->showTimingsWarning($data["ref_id"], $this->user_id);
                         if ($timing) {
                             if ($timing !== true) {
                                 $timing = ": " . ilDatePresentation::formatDate(new ilDate($timing, IL_CAL_UNIX));
                             } else {
                                 $timing = "";
                             }
                             $this->tpl->setCurrentBlock('warning_img');
                             $this->tpl->setVariable('WARNING_IMG', ilUtil::getImagePath('time_warn.png'));
                             $this->tpl->setVariable('WARNING_ALT', $this->lng->txt('trac_time_passed') . $timing);
                             $this->tpl->parseCurrentBlock();
                         }
                     }
                     break;
                 case "spent_seconds":
                     include_once "./Services/Utilities/classes/class.ilFormat.php";
                     $val = ilFormat::_secondsToString($data[$c]);
                     break;
                 case "percentage":
                     $val = $data[$c] . "%";
                     break;
             }
         }
         if ($c == "mark" && in_array($this->type, array("lm", "dbk"))) {
             $val = "-";
         }
         if ($c == "spent_seconds" && in_array($this->type, array("exc"))) {
             $val = "-";
         }
         if ($c == "percentage" && (in_array(strtolower($this->status_class), array("illpstatusmanual", "illpstatusscormpackage", "illpstatustestfinished")) || $this->type == "exc")) {
             $val = "-";
         }
         $this->tpl->setCurrentBlock("user_field");
         $this->tpl->setVariable("VAL_UF", $val);
         $this->tpl->parseCurrentBlock();
     }
     if ($data["title"] == "") {
         $data["title"] = "--" . $lng->txt("none") . "--";
     }
     $this->tpl->setVariable("ICON", ilObject::_getIcon("", "tiny", $data["type"]));
     $this->tpl->setVariable("ICON_ALT", $lng->txt($data["type"]));
     if (in_array($data['type'], array('fold', 'grp')) && $data['obj_id'] != $this->obj_id) {
         if ($data['type'] == 'fold') {
             $object_gui = 'ilobjfoldergui';
         } else {
             $object_gui = 'ilobjgroupgui';
         }
         $this->tpl->setCurrentBlock('title_linked');
         // link structure gets too complicated
         if ($_GET["baseClass"] != "ilPersonalDesktopGUI" && $_GET["baseClass"] != "ilAdministrationGUI") {
             $old = $ilCtrl->getParameterArrayByClass('illplistofobjectsgui');
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'ref_id', $data["ref_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'details_id', $data["ref_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'user_id', $this->user_id);
             $url = $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', $object_gui, 'illearningprogressgui', 'illplistofobjectsgui'), 'userdetails');
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'ref_id', $old["ref_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'details_id', $old["details_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'user_id', $old["user_id"]);
         } else {
             $url = "#";
         }
         $this->tpl->setVariable("URL_TITLE", $url);
         $this->tpl->setVariable("VAL_TITLE", $data["title"]);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock('title_plain');
         $this->tpl->setVariable("VAL_TITLE", $data["title"]);
         $this->tpl->parseCurrentBlock();
     }
     if (!in_array($data["type"], array("sco", "lobj")) && !$this->getPrintMode()) {
         $this->tpl->setCurrentBlock("item_command");
         $ilCtrl->setParameterByClass("illplistofobjectsgui", "userdetails_id", $data["ref_id"]);
         $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass("illplistofobjectsgui", 'edituser'));
         $this->tpl->setVariable("TXT_COMMAND", $lng->txt('edit'));
         $ilCtrl->setParameterByClass("illplistofobjectsgui", "userdetails_id", "");
         $this->tpl->parseCurrentBlock();
     }
 }
예제 #4
0
 function showLearningProgress($a_tpl)
 {
     global $ilUser, $rbacsystem;
     if (!$rbacsystem->checkAccess('read', $this->gui_object->object->getRefId())) {
         return false;
     }
     if ($ilUser->getId() == ANONYMOUS_USER_ID) {
         return false;
     }
     include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
     if (!ilObjUserTracking::_enabledLearningProgress() and $ilUser->getId() != ANONYMOUS_USER_ID) {
         return false;
     }
     include_once './Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($this->gui_object->object->getId());
     if ($olp->getCurrentMode() != ilLPObjSettings::LP_MODE_MANUAL) {
         return false;
     }
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $this->lng->loadLanguageModule('trac');
     // section header
     //		$a_tpl->setCurrentBlock("header_row");
     $a_tpl->setVariable("TXT_SECTION", $this->lng->txt('learning_progress'));
     $a_tpl->parseCurrentBlock();
     // $a_tpl->touchBlock("row");
     // status
     $i_tpl = new ilTemplate("tpl.lp_edit_manual_info_page.html", true, true, "Services/Tracking");
     $i_tpl->setVariable("INFO_EDITED", $this->lng->txt("trac_info_edited"));
     $i_tpl->setVariable("SELECT_STATUS", ilUtil::formSelect((int) ilLPMarks::_hasCompleted($ilUser->getId(), $this->gui_object->object->getId()), 'lp_edit', array(0 => $this->lng->txt('trac_not_completed'), 1 => $this->lng->txt('trac_completed')), false, true));
     $i_tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
     $a_tpl->setCurrentBlock("pv");
     $a_tpl->setVariable("TXT_PROPERTY_VALUE", $i_tpl->get());
     $a_tpl->parseCurrentBlock();
     $a_tpl->setCurrentBlock("property_row");
     $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_status'));
     $a_tpl->parseCurrentBlock();
     // $a_tpl->touchBlock("row");
     // More infos for lm's
     if ($this->gui_object->object->getType() == 'lm' || $this->gui_object->object->getType() == 'htlm') {
         $a_tpl->setCurrentBlock("pv");
         include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
         $progress = ilLearningProgress::_getProgress($ilUser->getId(), $this->gui_object->object->getId());
         if ($progress['access_time']) {
             $a_tpl->setVariable("TXT_PROPERTY_VALUE", ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_DATETIME)));
         } else {
             $a_tpl->setVariable("TXT_PROPERTY_VALUE", $this->lng->txt('trac_not_accessed'));
         }
         $a_tpl->parseCurrentBlock();
         $a_tpl->setCurrentBlock("property_row");
         $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_last_access'));
         $a_tpl->parseCurrentBlock();
         // $a_tpl->touchBlock("row");
         // tags of all users
         $a_tpl->setCurrentBlock("pv");
         $a_tpl->setVariable("TXT_PROPERTY_VALUE", (int) $progress['visits']);
         $a_tpl->parseCurrentBlock();
         $a_tpl->setCurrentBlock("property_row");
         $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_visits'));
         $a_tpl->parseCurrentBlock();
         // $a_tpl->touchBlock("row");
         if ($this->gui_object->object->getType() == 'lm') {
             // tags of all users
             $a_tpl->setCurrentBlock("pv");
             $a_tpl->setVariable("TXT_PROPERTY_VALUE", ilFormat::_secondsToString($progress['spent_seconds']));
             $a_tpl->parseCurrentBlock();
             $a_tpl->setCurrentBlock("property_row");
             $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_spent_time'));
             $a_tpl->parseCurrentBlock();
             // $a_tpl->touchBlock("row");
         }
     }
     // #10493
     $a_tpl->touchBlock("row");
 }
    function getTrackingDataAgg($a_user_id, $raw = false)
    {
        global $ilDB;
        $scos = array();
        $data = array();
        //get all SCO's of this object
        $val_set = $ilDB->queryF('SELECT cp_node_id FROM cp_node 
			WHERE nodename = %s
			AND cp_node.slm_id = %s', array('text', 'integer'), array('item', $this->getId()));
        while ($val_rec = $ilDB->fetchAssoc($val_set)) {
            array_push($scos, $val_rec['cp_node_id']);
        }
        foreach ($scos as $sco) {
            $data_set = $ilDB->queryF('
				SELECT c_timestamp last_access, total_time, success_status, completion_status,
					   c_raw, scaled, cp_node_id
				FROM cmi_node 
				WHERE cp_node_id = %s
				AND user_id = %s', array('integer', 'integer'), array($sco, $a_user_id));
            while ($data_rec = $ilDB->fetchAssoc($data_set)) {
                if ($data_rec["success_status"] != "" && $data_rec["success_status"] != "unknown") {
                    $status = $data_rec["success_status"];
                } else {
                    if ($data_rec["completion_status"] == "") {
                        $status = "unknown";
                    } else {
                        $status = $data_rec["completion_status"];
                    }
                }
                if (!$raw) {
                    $time = ilFormat::_secondsToString(self::_ISODurationToCentisec($data_rec["total_time"]) / 100);
                    $score = "";
                    if ($data_rec["c_raw"] != null) {
                        $score = $data_rec["c_raw"];
                        if ($data_rec["scaled"] != null) {
                            $score .= " = ";
                        }
                    }
                    if ($data_rec["scaled"] != null) {
                        $score .= $data_rec["scaled"] * 100 . "%";
                    }
                    $title = self::_lookupItemTitle($data_rec["cp_node_id"]);
                    $last_access = ilDatePresentation::formatDate(new ilDateTime($data_rec['last_access'], IL_CAL_UNIX));
                    $data[] = array("user_id" => $data_rec["user_id"], "sco_id" => $data_rec["cp_node_id"], "score" => $score, "time" => $time, "status" => $status, "last_access" => $last_access, "title" => $title);
                } else {
                    $data_rec["session_time"] = self::_ISODurationToCentisec($data_rec["session_time"]) / 100;
                    $data[$data_rec["cp_node_id"]] = $data_rec;
                }
            }
        }
        return $data;
    }
 function __appendLPDetails(&$info, $item_id, $user_id)
 {
     global $ilObjDataCache;
     $type = $ilObjDataCache->lookupType($item_id);
     // Section learning_progress
     // $info->addSection($this->lng->txt('trac_learning_progress'));
     // see ilLPTableBaseGUI::parseTitle();
     $info->addSection($this->lng->txt("trac_progress") . ": " . ilObject::_lookupTitle($item_id));
     $olp = ilObjectLP::getInstance($item_id);
     $info->addProperty($this->lng->txt('trac_mode'), $olp->getModeText($olp->getCurrentMode()));
     switch ($type) {
         case 'lm':
         case 'htlm':
             include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
             $progress = ilLearningProgress::_getProgress($user_id, $item_id);
             if ($progress['access_time']) {
                 $info->addProperty($this->lng->txt('last_access'), ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_DATETIME)));
             } else {
                 $info->addProperty($this->lng->txt('last_access'), $this->lng->txt('trac_not_accessed'));
             }
             $info->addProperty($this->lng->txt('trac_visits'), (int) $progress['visits']);
             if ($type == 'lm') {
                 $info->addProperty($this->lng->txt('trac_spent_time'), ilFormat::_secondsToString($progress['spent_seconds']));
             }
             // fallthrough
         // fallthrough
         case 'exc':
         case 'tst':
         case 'crs':
         case 'sahs':
         case 'grp':
             // display status as image
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $status = $this->__readStatus($item_id, $user_id);
             $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
             $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
             $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text) . " " . $status_text);
             // #15334 - see ilLPTableBaseGUI::isPercentageAvailable()
             $mode = $olp->getCurrentMode();
             if (in_array($mode, array(ilLPObjSettings::LP_MODE_TLT, ilLPObjSettings::LP_MODE_VISITS, ilLPObjSettings::LP_MODE_SCORM, ilLPObjSettings::LP_MODE_TEST_PASSED))) {
                 include_once 'Services/Tracking/classes/class.ilLPStatus.php';
                 $perc = ilLPStatus::_lookupPercentage($item_id, $user_id);
                 $info->addProperty($this->lng->txt('trac_percentage'), (int) $perc . "%");
             }
             break;
     }
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     if (strlen($mark = ilLPMarks::_lookupMark($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_mark'), $mark);
     }
     if (strlen($comment = ilLPMarks::_lookupComment($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_comment'), $comment);
     }
 }
 /**
  * Init general settings form.
  *
  */
 public function initGeneralSettingsForm()
 {
     global $lng, $ilUser, $styleDefinition, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // language
     if ($this->userSettingVisible("language")) {
         $languages = $this->lng->getInstalledLanguages();
         $options = array();
         foreach ($languages as $lang_key) {
             $options[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
         }
         $si = new ilSelectInputGUI($this->lng->txt("language"), "language");
         $si->setOptions($options);
         $si->setValue($ilUser->getLanguage());
         $si->setDisabled($ilSetting->get("usr_settings_disable_language"));
         $this->form->addItem($si);
     }
     // skin/style
     include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
     if ($this->userSettingVisible("skin_style")) {
         $templates = $styleDefinition->getAllTemplates();
         if (is_array($templates)) {
             $si = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
             $options = array();
             foreach ($templates as $template) {
                 // get styles information of 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"];
                 }
             }
             $si->setOptions($options);
             $si->setValue($ilUser->skin . ":" . $ilUser->prefs["style"]);
             $si->setDisabled($ilSetting->get("usr_settings_disable_skin_style"));
             $this->form->addItem($si);
         }
     }
     // screen reader optimization
     if ($this->userSettingVisible("screen_reader_optimization")) {
         $cb = new ilCheckboxInputGUI($this->lng->txt("user_screen_reader_optimization"), "screen_reader_optimization");
         $cb->setChecked($ilUser->prefs["screen_reader_optimization"]);
         $cb->setDisabled($ilSetting->get("usr_settings_disable_screen_reader_optimization"));
         $cb->setInfo($this->lng->txt("user_screen_reader_optimization_info"));
         $this->form->addItem($cb);
     }
     // hits per page
     if ($this->userSettingVisible("hits_per_page")) {
         $si = new ilSelectInputGUI($this->lng->txt("hits_per_page"), "hits_per_page");
         $hits_options = array(10, 15, 20, 30, 40, 50, 100, 9999);
         $options = array();
         foreach ($hits_options as $hits_option) {
             $hstr = $hits_option == 9999 ? $this->lng->txt("no_limit") : $hits_option;
             $options[$hits_option] = $hstr;
         }
         $si->setOptions($options);
         $si->setValue($ilUser->prefs["hits_per_page"]);
         $si->setDisabled($ilSetting->get("usr_settings_disable_hits_per_page"));
         $this->form->addItem($si);
     }
     // Users Online
     if ($this->userSettingVisible("show_users_online")) {
         $si = new ilSelectInputGUI($this->lng->txt("show_users_online"), "show_users_online");
         $options = array("y" => $this->lng->txt("users_online_show_y"), "associated" => $this->lng->txt("users_online_show_associated"), "n" => $this->lng->txt("users_online_show_n"));
         $si->setOptions($options);
         $si->setValue($ilUser->prefs["show_users_online"]);
         $si->setDisabled($ilSetting->get("usr_settings_disable_show_users_online"));
         $this->form->addItem($si);
     }
     // Store last visited
     $lv = new ilSelectInputGUI($this->lng->txt("user_store_last_visited"), "store_last_visited");
     $options = array(0 => $this->lng->txt("user_lv_keep_entries"), 1 => $this->lng->txt("user_lv_keep_only_for_session"), 2 => $this->lng->txt("user_lv_do_not_store"));
     $lv->setOptions($options);
     $lv->setValue((int) $ilUser->prefs["store_last_visited"]);
     $this->form->addItem($lv);
     // hide_own_online_status
     if ($this->userSettingVisible("hide_own_online_status")) {
         $cb = new ilCheckboxInputGUI($this->lng->txt("hide_own_online_status"), "hide_own_online_status");
         $cb->setChecked($ilUser->prefs["hide_own_online_status"] == "y");
         $cb->setDisabled($ilSetting->get("usr_settings_disable_hide_own_online_status"));
         $this->form->addItem($cb);
     }
     include_once 'Services/Authentication/classes/class.ilSessionReminder.php';
     if (ilSessionReminder::isGloballyActivated()) {
         $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
         $cb->setInfo($this->lng->txt('session_reminder_info'));
         $cb->setValue(1);
         $cb->setChecked((int) $ilUser->getPref('session_reminder_enabled'));
         $expires = ilSession::getSessionExpireValue();
         $lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time');
         $lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilFormat::_secondsToString($expires, true)));
         $min_value = ilSessionReminder::MIN_LEAD_TIME;
         $max_value = max($min_value, (int) $expires / 60 - 1);
         $current_user_value = $ilUser->getPref('session_reminder_lead_time');
         if ($current_user_value < $min_value || $current_user_value > $max_value) {
             $current_user_value = ilSessionReminder::SUGGESTED_LEAD_TIME;
         }
         $value = min(max($min_value, $current_user_value), $max_value);
         $lead_time_gui->setValue($value);
         $lead_time_gui->setSize(3);
         $lead_time_gui->setMinValue($min_value);
         $lead_time_gui->setMaxValue($max_value);
         $cb->addSubItem($lead_time_gui);
         $this->form->addItem($cb);
     }
     // calendar settings (copied here to be reachable when calendar is inactive)
     // they cannot be hidden/deactivated
     include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
     include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
     $lng->loadLanguageModule("dateplaner");
     $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
     $select = new ilSelectInputGUI($lng->txt('cal_user_timezone'), 'timezone');
     $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
     $select->setInfo($lng->txt('cal_timezone_info'));
     $select->setValue($user_settings->getTimeZone());
     $this->form->addItem($select);
     $year = date("Y");
     $select = new ilSelectInputGUI($lng->txt('cal_user_date_format'), 'date_format');
     $select->setOptions(array(ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year, ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31", ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year));
     $select->setInfo($lng->txt('cal_date_format_info'));
     $select->setValue($user_settings->getDateFormat());
     $this->form->addItem($select);
     $select = new ilSelectInputGUI($lng->txt('cal_user_time_format'), 'time_format');
     $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm'));
     $select->setInfo($lng->txt('cal_time_format_info'));
     $select->setValue($user_settings->getTimeFormat());
     $this->form->addItem($select);
     // starting point
     include_once "Services/User/classes/class.ilUserUtil.php";
     if (ilUserUtil::hasPersonalStartingPoint()) {
         $this->lng->loadLanguageModule("administration");
         $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start");
         $si->setRequired(true);
         $si->setInfo($this->lng->txt("adm_user_starting_point_info"));
         foreach (ilUserUtil::getPossibleStartingPoints() as $value => $caption) {
             $si->addOption(new ilRadioOption($caption, $value));
         }
         $si->setValue(ilUserUtil::getPersonalStartingPoint());
         $this->form->addItem($si);
         // starting point: repository object
         $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
         $repobj_id = new ilTextInputGUI($lng->txt("adm_user_starting_point_ref_id"), "usr_start_ref_id");
         $repobj_id->setRequired(true);
         $repobj_id->setSize(5);
         if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) {
             $start_ref_id = ilUserUtil::getPersonalStartingObject();
             $repobj_id->setValue($start_ref_id);
             if ($start_ref_id) {
                 $start_obj_id = ilObject::_lookupObjId($start_ref_id);
                 if ($start_obj_id) {
                     $repobj_id->setInfo($lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) . ": " . ilObject::_lookupTitle($start_obj_id));
                 }
             }
         }
         $repobj->addSubItem($repobj_id);
         $si->addOption($repobj);
     }
     // selector for unicode characters
     global $ilSetting;
     if ($ilSetting->get('char_selector_availability') > 0) {
         require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
         $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_USER);
         $char_selector->getConfig()->setAvailability($ilUser->getPref('char_selector_availability'));
         $char_selector->getConfig()->setDefinition($ilUser->getPref('char_selector_definition'));
         $char_selector->addFormProperties($this->form);
         $char_selector->setFormValues($this->form);
     }
     $this->form->addCommandButton("saveGeneralSettings", $lng->txt("save"));
     $this->form->setTitle($lng->txt("general_settings"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
 /**
  * fill row
  *
  * @access protected
  * @param array set of data
  * @return
  */
 protected function fillRow($a_set)
 {
     if ($a_set['deletable']) {
         $this->tpl->setVariable('VAL_ID', $a_set['id']);
     }
     $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']);
     $this->tpl->setVariable('VAL_TITLE_LINK', $a_set['title']);
     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_set['id']);
     $this->tpl->setVariable('VAL_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
     switch ($a_set['frequence']) {
         case IL_CAL_FREQ_DAILY:
             $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_daily'));
             break;
         case IL_CAL_FREQ_WEEKLY:
             $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_weekly'));
             break;
         case IL_CAL_FREQ_MONTHLY:
             $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_monthly'));
             break;
         case IL_CAL_FREQ_YEARLY:
             $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_yearly'));
             break;
         default:
             //$this->tpl->setVariable('VAL_FREQUENCE',$this->lng->txt('cal_no_recurrence'));
             $this->tpl->setVariable('VAL_FREQUENCE', '');
             break;
     }
     $this->tpl->setVariable('VAL_BEGIN', $a_set['dt']);
     if ($a_set['duration']) {
         $this->tpl->setVariable('VAL_DURATION', ilFormat::_secondsToString($a_set['duration']));
     } else {
         $this->tpl->setVariable('VAL_DURATION', '');
     }
 }
예제 #9
0
 protected function parseValue($id, $value, $type)
 {
     global $lng;
     // get rid of aggregation
     $pos = strrpos($id, "_");
     if ($pos !== false) {
         $function = strtoupper(substr($id, $pos + 1));
         if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT"))) {
             $id = substr($id, 0, $pos);
         }
     }
     if (trim($value) == "" && $id != "status") {
         if ($id == "title" && get_class($this) != "ilTrObjectUsersPropsTableGUI" && get_class($this) != "ilTrMatrixTableGUI") {
             return "--" . $lng->txt("none") . "--";
         }
         return " ";
     }
     switch ($id) {
         case "first_access":
         case "create_date":
         case 'status_changed':
             $value = ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_DATETIME));
             break;
         case "last_access":
             $value = ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_UNIX));
             break;
         case "birthday":
             $value = ilDatePresentation::formatDate(new ilDate($value, IL_CAL_DATE));
             break;
         case "spent_seconds":
             if (in_array($type, array("exc"))) {
                 $value = "-";
             } else {
                 include_once "./Services/Utilities/classes/class.ilFormat.php";
                 $value = ilFormat::_secondsToString($value, $value < 3600 ? true : false);
                 // #14858
             }
             break;
         case "percentage":
             /* :TODO:
             			if(in_array(strtolower($this->status_class),
             					  array("illpstatusmanual", "illpstatusscormpackage", "illpstatustestfinished")) ||
             			$type == "exc"))
             			*/
             if (false) {
                 $value = "-";
             } else {
                 $value = $value . "%";
             }
             break;
         case "mark":
             if (in_array($type, array("lm", "dbk"))) {
                 $value = "-";
             }
             break;
         case "gender":
             $value = $lng->txt("gender_" . $value);
             break;
         case "status":
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $path = ilLearningProgressBaseGUI::_getImagePathForStatus($value);
             $text = ilLearningProgressBaseGUI::_getStatusText($value);
             $value = ilUtil::img($path, $text);
             break;
         case "language":
             $lng->loadLanguageModule("meta");
             $value = $lng->txt("meta_l_" . $value);
             break;
         case "sel_country":
             $value = $lng->txt("meta_c_" . $value);
             break;
     }
     return $value;
 }
 protected function parseValue($id, $value, $type)
 {
     global $lng;
     // get rid of aggregation
     $pos = strrpos($id, "_");
     if ($pos !== false) {
         $function = strtoupper(substr($id, $pos + 1));
         if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT"))) {
             $id = substr($id, 0, $pos);
         }
     }
     if (trim($value) == "") {
         if ($id == "title") {
             return "--" . $lng->txt("none") . "--";
         }
         return "";
     }
     switch ($id) {
         case 'status_changed':
         case "first_access":
         case "create_date":
             $value = ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_DATETIME));
             break;
         case "last_access":
             $value = ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_UNIX));
             break;
         case "spent_seconds":
         case "read_count_spent_seconds":
             if (in_array($type, array("exc"))) {
                 $value = "-";
             } else {
                 include_once "./Services/Utilities/classes/class.ilFormat.php";
                 $value = ilFormat::_secondsToString($value);
             }
             break;
         case "percentage":
             /* :TODO:
             			if(in_array(strtolower($this->status_class),
             					  array("illpstatusmanual", "illpstatusscormpackage", "illpstatustestfinished")) ||
             			$type == "exc"))
             			*/
             if (false) {
                 $value = "-";
             } else {
                 $value = $value . "%";
             }
             break;
         case "mark":
             if (in_array($type, array("lm", "dbk"))) {
                 $value = "-";
             }
             break;
     }
     return $value;
 }
 function __appendLPDetails(&$info, $item_id, $user_id)
 {
     global $ilObjDataCache;
     $type = $ilObjDataCache->lookupType($item_id);
     // Section learning_progress
     $info->addSection($this->lng->txt('trac_learning_progress'));
     switch ($type) {
         case 'lm':
         case 'htlm':
             include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
             $progress = ilLearningProgress::_getProgress($user_id, $item_id);
             if ($progress['access_time']) {
                 $info->addProperty($this->lng->txt('last_access'), ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_DATETIME)));
             } else {
                 $info->addProperty($this->lng->txt('last_access'), $this->lng->txt('trac_not_accessed'));
             }
             $info->addProperty($this->lng->txt('trac_visits'), (int) $progress['visits']);
             if ($type == 'lm') {
                 $info->addProperty($this->lng->txt('trac_spent_time'), ilFormat::_secondsToString($progress['spent_seconds']));
             }
             // display status as image
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $status = $this->__readStatus($item_id, $user_id);
             $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
             $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
             $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text) . " " . $status_text);
             break;
         case 'exc':
         case 'tst':
         case 'crs':
         case 'sahs':
         case 'grp':
             // display status as image
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $status = $this->__readStatus($item_id, $user_id);
             $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
             $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
             $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text) . " " . $status_text);
             break;
     }
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     if (strlen($mark = ilLPMarks::_lookupMark($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_mark'), $mark);
     }
     if (strlen($comment = ilLPMarks::_lookupComment($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_comment'), $comment);
     }
 }
 protected function showtlt()
 {
     global $lng, $ilCtrl, $tpl, $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "showtlt"));
     $form->setTitle($lng->txt("learning_progress"));
     $form->setDescription($lng->txt("trac_collection_tlt_learner_info"));
     $coll_items = array();
     include_once './Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($this->getObjId());
     $collection = $olp->getCollectionInstance();
     if ($collection) {
         $coll_items = $collection->getItems();
         $possible_items = $collection->getPossibleItems($this->getRefId());
         // for titles
     }
     include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
     $class = ilLPStatusFactory::_getClassById($this->getObjId(), ilLPObjSettings::LP_MODE_COLLECTION_TLT);
     $info = $class::_getStatusInfo($this->getObjId(), true);
     foreach ($coll_items as $item_id) {
         $field = new ilCustomInputGUI($possible_items[$item_id]["title"]);
         // lp status
         $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM;
         if (isset($info["completed"][$item_id]) && in_array($ilUser->getId(), $info["completed"][$item_id])) {
             $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
         } else {
             if (isset($info["in_progress"][$item_id]) && in_array($ilUser->getId(), $info["in_progress"][$item_id])) {
                 $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM;
             }
         }
         $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
         $text = ilLearningProgressBaseGUI::_getStatusText($status);
         $field->setHtml(ilUtil::img($path, $text));
         // stats
         $spent = 0;
         if (isset($info["tlt_users"][$item_id][$ilUser->getId()])) {
             $spent = $info["tlt_users"][$item_id][$ilUser->getId()];
         }
         $needed = $info["tlt"][$item_id];
         if ($needed) {
             $field->setInfo(sprintf($lng->txt("trac_collection_tlt_learner_subitem"), ilFormat::_secondsToString($spent), ilFormat::_secondsToString($needed), min(100, round(abs($spent) / $needed * 100))));
         }
         $form->addItem($field);
     }
     $tpl->setContent($form->getHTML());
 }
 /**
  * Init basic settings form.
  */
 public function initBasicSettingsForm()
 {
     global $lng, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $lng->loadLanguageModule("pd");
     // installation short title
     $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
     $ti->setMaxLength(200);
     $ti->setSize(40);
     $ti->setValue($ilSetting->get("short_inst_name"));
     $ti->setInfo($this->lng->txt("short_inst_name_info"));
     $this->form->addItem($ti);
     // public section
     $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
     $cb->setInfo($lng->txt("pub_section_info"));
     if ($ilSetting->get("pub_section")) {
         $cb->setChecked(true);
     }
     // search engine
     include_once 'Services/PrivacySecurity/classes/class.ilRobotSettings.php';
     $robot_settings = ilRobotSettings::_getInstance();
     $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
     $cb2->setInfo($this->lng->txt("enable_search_engine"));
     $cb->addSubItem($cb2);
     if (!$robot_settings->checkModRewrite()) {
         $cb2->setAlert($lng->txt("mod_rewrite_disabled"));
         $cb2->setChecked(false);
         $cb2->setDisabled(true);
     } elseif (!$robot_settings->checkRewrite()) {
         $cb2->setAlert($lng->txt("allow_override_alert"));
         $cb2->setChecked(false);
         $cb2->setDisabled(true);
     } else {
         if ($ilSetting->get("open_google")) {
             $cb2->setChecked(true);
         }
     }
     // Enable Global Profiles
     $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
     $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
     $cb_prop->setChecked($ilSetting->get('enable_global_profiles'));
     $cb->addSubItem($cb_prop);
     // activate captcha for anonymous wiki/forum editing
     include_once "./Services/Captcha/classes/class.ilCaptchaUtil.php";
     $cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_wiki_forum'), 'activate_captcha_anonym');
     $cap->setValue(1);
     if (ilCaptchaUtil::checkFreetype()) {
         $cap->setChecked($ilSetting->get('activate_captcha_anonym'));
     } else {
         $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
     }
     $cb->addSubItem($cap);
     $this->form->addItem($cb);
     // default repository view
     $options = array("flat" => $lng->txt("flatview"), "tree" => $lng->txt("treeview"));
     $si = new ilSelectInputGUI($this->lng->txt("def_repository_view"), "default_rep_view");
     $si->setOptions($options);
     $si->setInfo($this->lng->txt(""));
     if ($ilSetting->get("default_repository_view") == "tree") {
         $si->setValue("tree");
     } else {
         $si->setValue("flat");
     }
     $this->form->addItem($si);
     //
     $options = array("" => $lng->txt("adm_rep_tree_only_container"), "tree" => $lng->txt("adm_all_resource_types"));
     // repository tree
     $radg = new ilRadioGroupInputGUI($lng->txt("adm_rep_tree_presentation"), "tree_pres");
     $radg->setValue($ilSetting->get("repository_tree_pres"));
     $op1 = new ilRadioOption($lng->txt("adm_rep_tree_only_cntr"), "", $lng->txt("adm_rep_tree_only_cntr_info"));
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("adm_rep_tree_all_types"), "all_types", $lng->txt("adm_rep_tree_all_types_info"));
     // limit tree in courses and groups
     $cb = new ilCheckboxInputGUI($lng->txt("adm_rep_tree_limit_grp_crs"), "rep_tree_limit_grp_crs");
     $cb->setChecked($ilSetting->get("rep_tree_limit_grp_crs"));
     $cb->setInfo($lng->txt("adm_rep_tree_limit_grp_crs_info"));
     $op2->addSubItem($cb);
     $radg->addOption($op2);
     $this->form->addItem($radg);
     $sdesc = new ilCheckboxInputGUI($lng->txt("adm_rep_shorten_description"), "rep_shorten_description");
     $sdesc->setInfo($lng->txt("adm_rep_shorten_description_info"));
     $sdesc->setChecked($ilSetting->get("rep_shorten_description"));
     $this->form->addItem($sdesc);
     $sdesclen = new ilTextInputGUI($lng->txt("adm_rep_shorten_description_length"), "rep_shorten_description_length");
     $sdesclen->setValue($ilSetting->get("rep_shorten_description_length"));
     $sdesclen->setSize(3);
     $sdesc->addSubItem($sdesclen);
     // synchronize repository tree with main view
     $cb = new ilCheckboxInputGUI($lng->txt("adm_synchronize_rep_tree"), "rep_tree_synchronize");
     $cb->setInfo($lng->txt("adm_synchronize_rep_tree_info"));
     $cb->setChecked($ilSetting->get("rep_tree_synchronize"));
     $this->form->addItem($cb);
     // repository access check
     /*		$options = array(
     			0 => "0",
     			10 => "10",
     			30 => "30",
     			60 => "60",
     			120 => "120"
     			);
     		$si = new ilSelectInputGUI($this->lng->txt("adm_repository_cache_time"), "rep_cache");
     		$si->setOptions($options);
     		$si->setValue($ilSetting->get("rep_cache"));
     		$si->setInfo($this->lng->txt("adm_repository_cache_time_info")." ".
     			$this->lng->txt("adm_repository_cache_time_info2"));
     		$this->form->addItem($si);*/
     // load action commands asynchronously
     $cb = new ilCheckboxInputGUI($this->lng->txt("adm_item_cmd_asynch"), "item_cmd_asynch");
     $cb->setInfo($this->lng->txt("adm_item_cmd_asynch_info"));
     $cb->setChecked($ilSetting->get("item_cmd_asynch"));
     $this->form->addItem($cb);
     // locale
     $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
     $ti->setMaxLength(80);
     $ti->setSize(40);
     $ti->setInfo($this->lng->txt("adm_locale_info"));
     $ti->setValue($ilSetting->get("locale"));
     $this->form->addItem($ti);
     // trash
     $cb = new ilCheckboxInputGUI($this->lng->txt("enable_trash"), "enable_trash");
     $cb->setInfo($this->lng->txt("enable_trash_info"));
     if ($ilSetting->get("enable_trash")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // BEGIN SESSION SETTINGS
     // create session handling radio group
     $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type');
     $ssettings->setValue($ilSetting->get('session_handling_type', ilSession::SESSION_HANDLING_FIXED));
     // first option, fixed session duration
     $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED);
     // create session reminder subform
     $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled");
     $expires = ilSession::getSessionExpireValue();
     $time = ilFormat::_secondsToString($expires, true);
     $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" . sprintf($this->lng->txt('session_reminder_session_duration'), $time));
     if ((int) $ilSetting->get("session_reminder_enabled")) {
         $cb->setChecked(true);
     }
     $fixed->addSubItem($cb);
     // add session handling to radio group
     $ssettings->addOption($fixed);
     // second option, session control
     $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT);
     // add session control subform
     require_once 'Services/Authentication/classes/class.ilSessionControl.php';
     // this is the max count of active sessions
     // that are getting started simlutanously
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_count_info'));
     $sub_ti->setValue($ilSetting->get("session_max_count", ilSessionControl::DEFAULT_MAX_COUNT));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (min) idle time the session can be deleted,
     // if there are further requests for new sessions,
     // but max session count is reached yet
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_min_idle_info'));
     $sub_ti->setValue($ilSetting->get("session_min_idle", ilSessionControl::DEFAULT_MIN_IDLE));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (max) idle timeout the session expires
     // and become invalid, so it is not considered anymore
     // when calculating current count of active sessions
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_info'));
     $sub_ti->setValue($ilSetting->get("session_max_idle", ilSessionControl::DEFAULT_MAX_IDLE));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // this is the max duration that can elapse between the first and the secnd
     // request to the system before the session is immidietly deleted
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle_after_first_request'), 'session_max_idle_after_first_request');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info'));
     $sub_ti->setValue($ilSetting->get("session_max_idle_after_first_request", ilSessionControl::DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // add session control to radio group
     $ssettings->addOption($ldsh);
     // add radio group to form
     if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $this->form->addItem($ssettings);
     } else {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config");
         $ti->setValue($this->lng->txt('session_config_maintenance_disabled'));
         $ssettings->setDisabled(true);
         $ti->addSubItem($ssettings);
         $this->form->addItem($ti);
     }
     // END SESSION SETTINGS
     // password assistance
     $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance");
     if ($ilSetting->get("password_assistance")) {
         $cb->setChecked(true);
     }
     $cb->setInfo($this->lng->txt("password_assistance_info"));
     $this->form->addItem($cb);
     // password generation
     $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation"), "passwd_auto_generate");
     if ($ilSetting->get("passwd_auto_generate")) {
         $cb->setChecked(true);
     }
     $cb->setInfo($this->lng->txt("passwd_generation_info"));
     $this->form->addItem($cb);
     // dynamic web links
     $cb = new ilCheckboxInputGUI($this->lng->txt("links_dynamic"), "links_dynamic");
     $cb->setInfo($this->lng->txt("links_dynamic_info"));
     if ($ilSetting->get("links_dynamic")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // Learners View
     $pl = new ilCheckboxInputGUI($this->lng->txt('preview_learner'), 'preview_learner');
     $pl->setValue(1);
     $pl->setInfo($this->lng->txt('preview_learner_info'));
     $pl->setChecked($ilSetting->get('preview_learner'));
     $this->form->addItem($pl);
     // notes/comments/tagging
     $pl = new ilCheckboxInputGUI($this->lng->txt('adm_show_comments_tagging_in_lists'), 'comments_tagging_in_lists');
     $pl->setValue(1);
     $pl->setChecked($ilSetting->get('comments_tagging_in_lists'));
     $this->form->addItem($pl);
     // starting point
     include_once "Services/User/classes/class.ilUserUtil.php";
     $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start");
     $si->setRequired(true);
     $si->setInfo($this->lng->txt("adm_user_starting_point_info"));
     foreach (ilUserUtil::getPossibleStartingPoints() as $value => $caption) {
         $si->addOption(new ilRadioOption($caption, $value));
     }
     $si->setValue(ilUserUtil::getStartingPoint());
     $this->form->addItem($si);
     // starting point: repository object
     $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
     $repobj_id = new ilTextInputGUI($lng->txt("adm_user_starting_point_ref_id"), "usr_start_ref_id");
     $repobj_id->setRequired(true);
     $repobj_id->setSize(5);
     if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) {
         $start_ref_id = ilUserUtil::getStartingObject();
         $repobj_id->setValue($start_ref_id);
         if ($start_ref_id) {
             $start_obj_id = ilObject::_lookupObjId($start_ref_id);
             if ($start_obj_id) {
                 $repobj_id->setInfo($lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) . ": " . ilObject::_lookupTitle($start_obj_id));
             }
         }
     }
     $repobj->addSubItem($repobj_id);
     $si->addOption($repobj);
     // starting point: personal
     $startp = new ilCheckboxInputGUI($lng->txt("adm_user_starting_point_personal"), "usr_start_pers");
     $startp->setInfo($lng->txt("adm_user_starting_point_personal_info"));
     $startp->setChecked(ilUserUtil::hasPersonalStartingPoint());
     $si->addSubItem($startp);
     // save and cancel commands
     $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
     $this->form->setTitle($lng->txt("basic_settings"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
 /**
  * init general settings form
  * @return 
  */
 protected function initFormGeneralSettings()
 {
     global $ilSetting;
     $this->setSubTabs('settings');
     $this->tabs_gui->setTabActive('settings');
     $this->tabs_gui->setSubTabActive('general_settings');
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings'));
     $this->form->setTitle($this->lng->txt('general_settings'));
     $lua = new ilCheckboxInputGUI($this->lng->txt('enable_local_user_administration'), 'lua');
     $lua->setInfo($this->lng->txt('enable_local_user_administration_info'));
     $lua->setValue(1);
     $this->form->addItem($lua);
     $lrua = new ilCheckboxInputGUI($this->lng->txt('restrict_user_access'), 'lrua');
     $lrua->setInfo($this->lng->txt('restrict_user_access_info'));
     $lrua->setValue(1);
     $this->form->addItem($lrua);
     // enable alphabetical navigation in user administration
     $alph = new ilCheckboxInputGUI($this->lng->txt('user_adm_enable_alpha_nav'), 'user_adm_alpha_nav');
     //$alph->setInfo($this->lng->txt('restrict_user_access_info'));
     $alph->setValue(1);
     $this->form->addItem($alph);
     // account codes
     $code = new ilCheckboxInputGUI($this->lng->txt("user_account_code_setting"), "user_reactivate_code");
     $code->setInfo($this->lng->txt('user_account_code_setting_info'));
     $this->form->addItem($code);
     // delete own account
     $own = new ilCheckboxInputGUI($this->lng->txt("user_allow_delete_own_account"), "user_own_account");
     $this->form->addItem($own);
     $own_email = new ilEMailInputGUI($this->lng->txt("user_delete_own_account_notification_email"), "user_own_account_email");
     $own->addSubItem($own_email);
     // BEGIN SESSION SETTINGS
     // create session handling radio group
     $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type');
     // first option, fixed session duration
     $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED);
     // create session reminder subform
     $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled");
     $expires = ilSession::getSessionExpireValue();
     $time = ilFormat::_secondsToString($expires, true);
     $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" . sprintf($this->lng->txt('session_reminder_session_duration'), $time));
     $fixed->addSubItem($cb);
     // add session handling to radio group
     $ssettings->addOption($fixed);
     // second option, session control
     $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT);
     // add session control subform
     require_once 'Services/Authentication/classes/class.ilSessionControl.php';
     // this is the max count of active sessions
     // that are getting started simlutanously
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_count_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (min) idle time the session can be deleted,
     // if there are further requests for new sessions,
     // but max session count is reached yet
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_min_idle_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (max) idle timeout the session expires
     // and become invalid, so it is not considered anymore
     // when calculating current count of active sessions
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // this is the max duration that can elapse between the first and the secnd
     // request to the system before the session is immidietly deleted
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle_after_first_request'), 'session_max_idle_after_first_request');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // add session control to radio group
     $ssettings->addOption($ldsh);
     // add radio group to form
     if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $this->form->addItem($ssettings);
     } else {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config");
         $ti->setValue($this->lng->txt('session_config_maintenance_disabled'));
         $ssettings->setDisabled(true);
         $ti->addSubItem($ssettings);
         $this->form->addItem($ti);
     }
     // END SESSION SETTINGS
     $this->lng->loadLanguageModule('ps');
     $pass = new ilFormSectionHeaderGUI();
     $pass->setTitle($this->lng->txt('ps_password_settings'));
     $this->form->addItem($pass);
     // password generation
     $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation"), "passwd_auto_generate");
     $cb->setChecked($ilSetting->get("passwd_auto_generate"));
     $cb->setInfo($this->lng->txt("passwd_generation_info"));
     $this->form->addItem($cb);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'), 'password_change_on_first_login_enabled');
     $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info'));
     $this->form->addItem($check);
     include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_must_not_contain_loginame'), 'password_must_not_contain_loginame');
     $check->setInfo($this->lng->txt('ps_password_must_not_contain_loginame_info'));
     $this->form->addItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'), 'password_chars_and_numbers_enabled');
     //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled'));
     $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info'));
     $this->form->addItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'), 'password_special_chars_enabled');
     //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled'));
     $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info'));
     $this->form->addItem($check);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_min_length'), 'password_min_length');
     $text->setInfo($this->lng->txt('ps_password_min_length_info'));
     $text->setSize(1);
     $text->setMaxLength(2);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_length'), 'password_max_length');
     $text->setInfo($this->lng->txt('ps_password_max_length_info'));
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_uppercase_chars_num'), 'password_ucase_chars_num');
     $text->setInfo($this->lng->txt('ps_password_uppercase_chars_num_info'));
     $text->setMinValue(0);
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_lowercase_chars_num'), 'password_lowercase_chars_num');
     $text->setInfo($this->lng->txt('ps_password_lowercase_chars_num_info'));
     $text->setMinValue(0);
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_age'), 'password_max_age');
     $text->setInfo($this->lng->txt('ps_password_max_age_info'));
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     // password assistance
     $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance");
     $cb->setInfo($this->lng->txt("password_assistance_info"));
     $this->form->addItem($cb);
     $pass = new ilFormSectionHeaderGUI();
     $pass->setTitle($this->lng->txt('ps_security_protection'));
     $this->form->addItem($pass);
     $text = new ilNumberInputGUI($this->lng->txt('ps_login_max_attempts'), 'login_max_attempts');
     $text->setInfo($this->lng->txt('ps_login_max_attempts_info'));
     $text->setSize(1);
     $text->setMaxLength(2);
     $this->form->addItem($text);
     // prevent login from multiple pcs at the same time
     $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins');
     $objCb->setValue(1);
     $objCb->setInfo($this->lng->txt('ps_prevent_simultaneous_logins_info'));
     $this->form->addItem($objCb);
     $log = new ilFormSectionHeaderGUI();
     $log->setTitle($this->lng->txt('loginname_settings'));
     $this->form->addItem($log);
     $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname');
     $chbChangeLogin->setValue(1);
     $this->form->addItem($chbChangeLogin);
     $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname');
     $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info'));
     $chbCreateHistory->setValue(1);
     $chbChangeLogin->addSubItem($chbCreateHistory);
     $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames');
     $chbReuseLoginnames->setValue(1);
     $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info'));
     $chbChangeLogin->addSubItem($chbReuseLoginnames);
     $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time');
     $chbChangeBlockingTime->allowDecimals(true);
     $chbChangeBlockingTime->setSuffix($this->lng->txt('days'));
     $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info'));
     $chbChangeBlockingTime->setSize(10);
     $chbChangeBlockingTime->setMaxLength(10);
     $chbChangeLogin->addSubItem($chbChangeBlockingTime);
     $this->form->addCommandButton('saveGeneralSettings', $this->lng->txt('save'));
 }
    /**
     * @param int $sessionId
     * @return string
     */
    public function getJsonResponse($sessionId)
    {
        /**
         * @var $ilDB            ilDB
         * @var $ilUser          ilObjUser
         * @var $ilClientIniFile ilIniFile
         * @var $lng             ilLanguage
         */
        global $ilDB, $ilUser, $lng, $ilClientIniFile;
        include_once 'Services/JSON/classes/class.ilJsonUtil.php';
        $response = array('remind' => false);
        $res = $ilDB->queryF('
			SELECT expires, user_id, data
			FROM usr_session
			WHERE session_id = %s', array('text'), array($sessionId));
        $num = $ilDB->numRows($res);
        if ($num > 1) {
            $response['message'] = 'The determined session data is not unique.';
            return ilJsonUtil::encode($response);
        }
        if ($num == 0) {
            $response['message'] = 'ILIAS could not determine the session data.';
            return ilJsonUtil::encode($response);
        }
        $data = $ilDB->fetchAssoc($res);
        if (!$this->isAuthenticatedUsrSession($data)) {
            $response['message'] = 'ILIAS could not fetch the session data or the corresponding user is no more authenticated.';
            return ilJsonUtil::encode($response);
        }
        $session = ilUtil::unserializeSession($data['data']);
        $idletime = null;
        foreach ((array) $session as $key => $entry) {
            if (strpos($key, '_auth__') === 0) {
                $idletime = $entry['idle'];
                break;
            }
        }
        if (null === $idletime) {
            $response['message'] = 'ILIAS could not determine the idle time from the session data.';
            return ilJsonUtil::encode($response);
        }
        $expiretime = $idletime + ilSession::getIdleValue();
        if ($this->isSessionAlreadyExpired($expiretime)) {
            $response['message'] = 'The session is already expired. The client should have received a remind command before.';
            return ilJsonUtil::encode($response);
        }
        /**
         * @var $user ilObjUser
         */
        $ilUser = ilObjectFactory::getInstanceByObjId($data['user_id']);
        include_once './Services/Authentication/classes/class.ilSessionReminder.php';
        $remind_time = $expiretime - max(ilSessionReminder::MIN_LEAD_TIME, (double) $ilUser->getPref('session_reminder_lead_time')) * 60;
        if ($remind_time > time()) {
            // session will expire in <lead_time> minutes
            $response['message'] = 'Lead time not reached, yet. Current time: ' . date('Y-m-d H:i:s', time()) . ', Reminder time: ' . date('Y-m-d H:i:s', $remind_time);
            return ilJsonUtil::encode($response);
        }
        $dateTime = new ilDateTime($expiretime, IL_CAL_UNIX);
        switch ($ilUser->getTimeFormat()) {
            case ilCalendarSettings::TIME_FORMAT_12:
                $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone());
                break;
            case ilCalendarSettings::TIME_FORMAT_24:
            default:
                $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone());
                break;
        }
        $response = array('extend_url' => './ilias.php?baseClass=ilPersonalDesktopGUI', 'txt' => str_replace("\\n", '%0A', sprintf($lng->txt('session_reminder_alert'), ilFormat::_secondsToString($expiretime - time()), $formatted_expiration_time, $ilClientIniFile->readVariable('client', 'name') . ' | ' . ilUtil::_getHttpPath())), 'remind' => true);
        return ilJsonUtil::encode($response);
    }
 function __renderItem($item, $level)
 {
     global $ilUser, $ilAccess;
     include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
     include_once './Services/Link/classes/class.ilLink.php';
     include_once './Services/MetaData/classes/class.ilMDEducational.php';
     if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
         return false;
     }
     $this->lng->loadLanguageModule('meta');
     $usr_planed = new ilTimingPlaned($item['ref_id'], $ilUser->getId());
     for ($i = 0; $i < $level; $i++) {
         $this->tpl->touchBlock('start_indent');
         $this->tpl->touchBlock('end_indent');
     }
     if (strlen($item['description'])) {
         $this->tpl->setCurrentBlock("item_description");
         $this->tpl->setVariable("DESC", $item['description']);
         $this->tpl->parseCurrentBlock();
     }
     if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
         $this->tpl->setCurrentBlock("tlt");
         $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
         $this->tpl->setVariable("TLT_VAL", ilFormat::_secondsToString($tlt));
         $this->tpl->parseCurrentBlock();
     }
     if ($ilAccess->checkAccess('read', '', $item['ref_id'])) {
         $this->tpl->setCurrentBlock("title_as_link");
         $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
         $this->tpl->setVariable("TITLE_NAME", $item['title']);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock("title_plain");
         $this->tpl->setVariable("TITLE", $item['title']);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("container_standard_row");
     if (isset($this->invalid["{$item['ref_id']}"])) {
         $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
     } else {
         $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
     }
     #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.png'));
     $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'small'));
     $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
     if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
         $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX)));
         $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
     }
     if ($item['changeable']) {
         $item_prefix = "item[" . $item['ref_id'] . ']';
         if (is_array($_POST['item']["{$item['ref_id']}"]['own_start'])) {
             #echo "Start post<br>";
             $start = $this->__toUnix($_POST['item']["{$item['ref_id']}"]['own_start']);
         } elseif ($usr_planed->getPlanedStartingTime()) {
             #echo "Own start<br>";
             $start = $usr_planed->getPlanedStartingTime();
         } else {
             #echo "Empfehlung start<br>";
             $start = $item['suggestion_start'];
         }
         $date = $this->__prepareDateSelect($start);
         $this->tpl->setVariable("OWN_START", ilUtil::makeDateSelect($item_prefix . "[own_start]", $date['y'], $date['m'], $date['d'], date('Y', time()), false));
         if ($usr_planed->getPlanedEndingTime()) {
             #echo "Own End<br>";
             $end = $usr_planed->getPlanedEndingTime();
         } else {
             #echo "Empfehlung end<br>";
             $end = $item['suggestion_end'];
         }
         $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
         $this->tpl->setVariable("NAME_DURATION", $item_prefix . "[duration]");
         // Duration
         if (isset($_POST['item']["{$item['ref_id']}"]['duration'])) {
             $this->tpl->setVariable("VAL_DURATION", $_POST['item']["{$item['ref_id']}"]['duration']);
         } else {
             $this->tpl->setVariable("VAL_DURATION", intval(($end - $start) / (60 * 60 * 24)));
         }
         $this->tpl->setVariable('LIM_START', ilDatePresentation::formatDate(new ilDate($item['earliest_start'], IL_CAL_UNIX)));
         $this->tpl->setVariable('LIM_END', ilDatePresentation::formatDate(new ilDate($item['latest_end'], IL_CAL_UNIX)));
     }
     $this->tpl->parseCurrentBlock();
     if (!$_SESSION['crs_timings_user_hidden']) {
         return true;
     }
     foreach (ilObjectActivation::getTimingsItems($item['ref_id']) as $item_data) {
         $this->__renderItem($item_data, $level + 1);
     }
 }
 /**
  * Parse bookings
  * @param int $a_groupid
  * @param ilDate $start
  * @param ilDate $end
  *
  * throws ilViteroConnectionException
  */
 public function parse($a_groupid, ilDateTime $start, ilDateTime $end)
 {
     $booking_list = array();
     try {
         $con = new ilViteroBookingSoapConnector();
         $bookings = $con->getByGroupAndDate($a_groupid, $start, $end);
     } catch (Exception $e) {
         throw $e;
     }
     $booking_arr = array();
     if (is_object($bookings->booking)) {
         $booking_arr = array($bookings->booking);
     } elseif (is_array($bookings->booking)) {
         $booking_arr = $bookings->booking;
     }
     $counter = 0;
     foreach ($booking_arr as $booking) {
         $fstart = ilViteroUtils::parseSoapDate($booking->start);
         $fend = ilViteroUtils::parseSoapDate($booking->end);
         $duration = $fend->get(IL_CAL_UNIX) - $fstart->get(IL_CAL_UNIX);
         foreach (ilViteroUtils::calculateBookingAppointments($start, $end, $booking) as $dl) {
             $booking_list[$counter]['rec'] = $booking->repetitionpattern;
             $booking_list[$counter]['id'] = $booking->bookingid;
             $booking_list[$counter]['start'] = $dl;
             $booking_list[$counter]['startt'] = $dl->get(IL_CAL_UNIX);
             $bend = clone $dl;
             $bend->setDate($dl->get(IL_CAL_UNIX) + $duration, IL_CAL_UNIX);
             $booking_list[$counter]['end'] = $bend;
             if ($booking->cafe) {
                 $booking_list[$counter]['start'] = new ilDate($booking_list[$counter]['startt'], IL_CAL_UNIX);
                 $booking_list[$counter]['time'] = ilDatePresentation::formatDate($booking_list[$counter]['start']);
             } else {
                 $booking_list[$counter]['time'] = ilDatePresentation::formatPeriod($booking_list[$counter]['start'], $booking_list[$counter]['end']);
             }
             $booking_list[$counter]['duration'] = ilFormat::_secondsToString($booking_list[$counter]['end']->get(IL_CAL_UNIX) - $booking_list[$counter]['start']->get(IL_CAL_UNIX), false);
             if ($booking->repetitionpattern) {
                 $repend = ilViteroUtils::parseSoapDate($booking->repetitionenddate);
                 $booking_list[$counter]['ends'] = ilDatePresentation::formatDate(new ilDate($repend->get(IL_CAL_UNIX), IL_CAL_UNIX));
             }
             $counter++;
         }
     }
     $this->setMaxCount(count($booking_list));
     $this->setData($booking_list);
 }