/**
  * Show the license list
  * @access public
  */
 function showLicenses()
 {
     include_once './Services/License/classes/class.ilLicenseOverviewTableGUI.php';
     $tbl = new ilLicenseOverviewTableGUI($this, "showLicenses", $this->mode, $this->parent_gui);
     include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
     $panel = ilPanelGUI::getInstance();
     $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
     $panel->setBody('<div class="small">' . $this->lng->txt("used_licenses_explanation") . "<br/>" . $this->lng->txt("remaining_licenses_explanation") . "<br/>" . $this->lng->txt("potential_accesses_explanation") . "</div>");
     $this->tpl->setContent($tbl->getHTML() . "<br />" . $panel->getHTML());
 }
 /**
  * Get HTML
  */
 function getHTML()
 {
     global $lng;
     include_once "./Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
     $panel = ilPanelGUI::getInstance();
     $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
     $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
     $panel->setHeading($this->getHeading());
     include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php";
     $list = new ilGroupedListGUI();
     foreach ($this->items as $i) {
         $item_tpl = new ilTemplate("tpl.checklist_item.html", true, true, "Services/UIComponent/Checklist");
         if (!is_array($i["info"]) && $i["info"] != "") {
             $i["info"] = array($i["info"]);
         }
         if (is_array($i["info"]) && count($i["info"]) > 0) {
             foreach ($i["info"] as $info) {
                 $item_tpl->setCurrentBlock("info");
                 $item_tpl->setVariable("INFO_MSG", $info);
                 $item_tpl->parseCurrentBlock();
             }
         }
         $item_tpl->setVariable("TXT_STEP", $i["txt"]);
         switch ($i["status"]) {
             case self::STATUS_OK:
                 $item_tpl->setVariable("STATUS_IMG", ilUtil::getImagePath("icon_ok.svg"));
                 $item_tpl->setVariable("STATUS_ALT", $lng->txt("uic_checklist_ok"));
                 break;
             case self::STATUS_NOT_OK:
                 $item_tpl->setVariable("STATUS_IMG", ilUtil::getImagePath("icon_not_ok.svg"));
                 $item_tpl->setVariable("STATUS_ALT", $lng->txt("uic_checklist_not_ok"));
                 break;
         }
         $list->addEntry($item_tpl->get(), $i["href"], "", "", $i["highlighted"] ? "ilHighlighted" : "");
     }
     $ch_tpl = new ilTemplate("tpl.checklist.html", true, true, "Services/UIComponent/Checklist");
     $ch_tpl->setVariable("LIST", $list->getHTML());
     $panel->setBody($ch_tpl->get());
     return $panel->getHTML();
 }
 public function showPeerReviewOverviewObject()
 {
     global $ilCtrl, $ilTabs, $tpl;
     if (!$this->ass || !$this->ass->getPeerReview()) {
         $ilCtrl->redirect($this, "showOverview");
     }
     $this->checkPermission("write");
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($this->lng->txt("back"), $ilCtrl->getLinkTarget($this, "listAssignments"));
     include_once "Modules/Exercise/classes/class.ilExAssignmentPeerReviewOverviewTableGUI.php";
     $tbl = new ilExAssignmentPeerReviewOverviewTableGUI($this, "showPeerReviewOverview", $this->ass);
     $panel = "";
     $panel_data = $tbl->getPanelInfo();
     if (sizeof($panel_data)) {
         $ptpl = new ilTemplate("tpl.exc_peer_review_overview_panel.html", true, true, "Modules/Exercise");
         foreach ($panel_data as $item) {
             $ptpl->setCurrentBlock("user_bl");
             foreach ($item["value"] as $user) {
                 $ptpl->setVariable("USER", $user);
                 $ptpl->parseCurrentBlock();
             }
             $ptpl->setCurrentBlock("item_bl");
             $ptpl->setVariable("TITLE", $item["title"]);
             $ptpl->parseCurrentBlock();
         }
         include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
         $panel = ilPanelGUI::getInstance();
         $panel->setHeading($this->lng->txt("exc_peer_review_overview_invalid_users"));
         $panel->setBody($ptpl->get());
         $panel = $panel->getHTML();
     }
     $tpl->setContent($tbl->getHTML() . $panel);
 }
 /**
  * Add materials to a question
  */
 public function addMaterial()
 {
     global $tree, $ilTabs, $ilToolbar;
     $ilTabs->activateTab("material");
     $ilToolbar->addButton($this->lng->txt("cancel"), $this->ctrl->getLinkTarget($this, "material"));
     if (strlen($_SESSION["link_new_type"]) || !$this->material(true)) {
         include_once "./Modules/SurveyQuestionPool/classes/class.ilMaterialExplorer.php";
         switch ($_POST["internalLinkType"]) {
             case "lm":
                 $_SESSION["link_new_type"] = "lm";
                 $_SESSION["search_link_type"] = "lm";
                 break;
             case "glo":
                 $_SESSION["link_new_type"] = "glo";
                 $_SESSION["search_link_type"] = "glo";
                 break;
             case "st":
                 $_SESSION["link_new_type"] = "lm";
                 $_SESSION["search_link_type"] = "st";
                 break;
             case "pg":
                 $_SESSION["link_new_type"] = "lm";
                 $_SESSION["search_link_type"] = "pg";
                 break;
         }
         $exp = new ilMaterialExplorer($this, 'addMaterial', $_SESSION["link_new_type"]);
         $exp->setPathOpen((int) $_GET["ref_id"]);
         if (!$exp->handleCommand()) {
             include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
             $panel = ilPanelGUI::getInstance();
             $panel->setHeading($this->lng->txt("select_object_to_link"));
             $panel->setBody($exp->getHTML());
             $this->tpl->setContent($panel->getHTML());
         }
     }
 }
 /**
  * Get gap analysis html
  *
  * @param
  * @return
  */
 function getGapAnalysisHTML($a_user_id = 0, $a_skills = null)
 {
     global $ilUser, $lng;
     //		$this->setTabs("list_skills");
     if ($a_user_id == 0) {
         $user_id = $ilUser->getId();
     } else {
         $user_id = $a_user_id;
     }
     $skills = array();
     if ($this->getProfileId() > 0) {
         $profile = new ilSkillProfile($this->getProfileId());
         $this->profile_levels = $profile->getSkillLevels();
         foreach ($this->profile_levels as $l) {
             $skills[] = array("base_skill_id" => $l["base_skill_id"], "tref_id" => $l["tref_id"], "level_id" => $l["level_id"]);
         }
     } else {
         if (is_array($a_skills)) {
             $skills = $a_skills;
         }
     }
     // get actual levels for gap analysis
     $this->actual_levels = array();
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     foreach ($skills as $sk) {
         $bs = new ilBasicSkill($sk["base_skill_id"]);
         if ($this->gap_mode == "max_per_type") {
             $max = $bs->getMaxLevelPerType($sk["tref_id"], $this->gap_mode_type, $user_id);
             $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
         } else {
             if ($this->gap_mode == "max_per_object") {
                 $max = $bs->getMaxLevelPerObject($sk["tref_id"], $this->gap_mode_obj_id, $user_id);
                 $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
             }
         }
     }
     $incl_self_eval = false;
     if (count($this->getGapAnalysisSelfEvalLevels() > 0)) {
         $incl_self_eval = true;
         $self_vals = $this->getGapAnalysisSelfEvalLevels();
     }
     // output spider stuff
     if (count($skills) >= 3) {
         $max_cnt = 0;
         $leg_labels = array();
         //var_dump($this->profile_levels);
         //foreach ($this->profile_levels as $k => $l)
         // write target, actual and self counter to skill array
         foreach ($skills as $k => $l) {
             //$bs = new ilBasicSkill($l["base_skill_id"]);
             $bs = new ilBasicSkill($l["base_skill_id"]);
             $leg_labels[] = ilBasicSkill::_lookupTitle($l["base_skill_id"], $l["tref_id"]);
             $levels = $bs->getLevelData();
             $cnt = 0;
             foreach ($levels as $lv) {
                 $cnt++;
                 if ($l["level_id"] == $lv["id"]) {
                     $skills[$k]["target_cnt"] = $cnt;
                 }
                 if ($this->actual_levels[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"]) {
                     $skills[$k]["actual_cnt"] = $cnt;
                 }
                 if ($incl_self_eval) {
                     if ($self_vals[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"]) {
                         $skills[$k]["self_cnt"] = $cnt;
                     }
                 }
                 $max_cnt = max($max_cnt, $cnt);
             }
         }
         //			$leg_labels = array("AAAAA", "BBBBB", "CCCCC");
         //var_dump($this->profile_levels);
         //var_dump($this->actual_levels);
         include_once "./Services/Chart/classes/class.ilChart.php";
         $chart = ilChart::getInstanceByType(ilChart::TYPE_SPIDER, "gap_chart");
         $chart->setsize(800, 300);
         $chart->setYAxisMax($max_cnt);
         $chart->setLegLabels($leg_labels);
         // target level
         $cd = $chart->getDataInstance();
         $cd->setLabel($lng->txt("skmg_target_level"));
         $cd->setFill(true, "#A0A0A0");
         // other users
         $cd2 = $chart->getDataInstance();
         if ($this->gap_cat_title != "") {
             $cd2->setLabel($this->gap_cat_title);
         } else {
             if ($this->gap_mode == "max_per_type") {
                 $cd2->setLabel($lng->txt("objs_" . $this->gap_mode_type));
             } else {
                 if ($this->gap_mode == "max_per_object") {
                     $cd2->setLabel(ilObject::_lookupTitle($this->gap_mode_obj_id));
                 }
             }
         }
         $cd2->setFill(true, "#8080FF");
         // self evaluation
         if ($incl_self_eval) {
             $cd3 = $chart->getDataInstance();
             $cd3->setLabel($lng->txt("skmg_self_evaluation"));
             $cd3->setFill(true, "#FF8080");
         }
         // fill in data
         $cnt = 0;
         foreach ($skills as $pl) {
             $cd->addPoint($cnt, (int) $pl["target_cnt"]);
             $cd2->addPoint($cnt, (int) $pl["actual_cnt"]);
             if ($incl_self_eval) {
                 $cd3->addPoint($cnt, (int) $pl["self_cnt"]);
             }
             $cnt++;
         }
         // add data to chart
         if ($this->getProfileId() > 0) {
             $chart->addData($cd);
         }
         $chart->addData($cd2);
         if ($incl_self_eval && count($this->getGapAnalysisSelfEvalLevels()) > 0) {
             $chart->addData($cd3);
         }
         $lg = new ilChartLegend();
         $chart->setLegend($lg);
         $chart_html = $chart->getHTML();
         include_once "./Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
         $pan = ilPanelGUI::getInstance();
         $pan->setPanelStyle(ilPanelGUI::PANEL_STYLE_PRIMARY);
         $pan->setBody($chart_html);
         $chart_html = $pan->getHTML();
     }
     $stree = new ilSkillTree();
     $html = "";
     foreach ($skills as $s) {
         $path = $stree->getSkillTreePath($s["base_skill_id"]);
         // check draft
         foreach ($path as $p) {
             if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT) {
                 continue 2;
             }
         }
         $html .= $this->getSkillHTML($s["base_skill_id"], $user_id, false, $s["tref_id"]);
     }
     // list skills
     //		include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
     //		$sktab = new ilPersonalSkillTableGUI($this, "listSkills");
     return $chart_html . $html;
 }
 /**
  * Output of a summary of all test questions for test participants
  */
 public function outQuestionSummaryCmd($fullpage = true, $contextFinishTest = false, $obligationsNotAnswered = false, $obligationsFilter = false)
 {
     if ($fullpage) {
         $this->tpl->addBlockFile($this->getContentBlockName(), "adm_content", "tpl.il_as_tst_question_summary.html", "Modules/Test");
     }
     if ($obligationsNotAnswered) {
         ilUtil::sendFailure($this->lng->txt('not_all_obligations_answered'));
     }
     $active_id = $this->testSession->getActiveId();
     $result_array =& $this->testSequence->getSequenceSummary($obligationsFilter);
     $marked_questions = array();
     if ($this->object->getKioskMode() && $fullpage) {
         $head = $this->getKioskHead();
         if (strlen($head)) {
             $this->tpl->setCurrentBlock("kiosk_options");
             $this->tpl->setVariable("KIOSK_HEAD", $head);
             $this->tpl->parseCurrentBlock();
         }
     }
     if ($this->object->getShowMarker()) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         $marked_questions = ilObjTest::_getSolvedQuestions($active_id);
     }
     $data = array();
     foreach ($result_array as $key => $value) {
         $this->ctrl->setParameter($this, "sequence", $value["sequence"]);
         $href = $this->ctrl->getLinkTargetByClass(get_class($this), "gotoQuestion");
         $this->tpl->setVariable("VALUE_QUESTION_TITLE", "<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this), "gotoQuestion") . "\">" . $this->object->getQuestionTitle($value["title"]) . "</a>");
         $this->ctrl->setParameter($this, "sequence", $_GET["sequence"]);
         $description = "";
         if ($this->object->getListOfQuestionsDescription()) {
             $description = $value["description"];
         }
         $points = "";
         if (!$this->object->getTitleOutput()) {
             $points = $value["points"] . "&nbsp;" . $this->lng->txt("points_short");
         }
         $marked = false;
         if (count($marked_questions)) {
             if (array_key_exists($value["qid"], $marked_questions)) {
                 $obj = $marked_questions[$value["qid"]];
                 if ($obj["solved"] == 1) {
                     $marked = true;
                 }
             }
         }
         array_push($data, array('order' => $value["nr"], 'href' => $href, 'title' => $this->object->getQuestionTitle($value["title"]), 'description' => $description, 'worked_through' => $value["worked_through"] ? true : false, 'postponed' => $value["postponed"] ? $this->lng->txt("postponed") : '', 'points' => $points, 'marked' => $marked, 'sequence' => $value["sequence"], 'obligatory' => $value['obligatory'], 'isAnswered' => $value['isAnswered']));
     }
     $this->ctrl->setParameter($this, "sequence", $_GET["sequence"]);
     if ($fullpage) {
         include_once "./Modules/Test/classes/tables/class.ilListOfQuestionsTableGUI.php";
         $table_gui = new ilListOfQuestionsTableGUI($this, 'backFromSummary');
         $table_gui->setShowPointsEnabled(!$this->object->getTitleOutput());
         $table_gui->setShowMarkerEnabled($this->object->getShowMarker());
         $table_gui->setObligationsNotAnswered($obligationsNotAnswered);
         $table_gui->setShowObligationsEnabled($this->object->areObligationsEnabled());
         $table_gui->setObligationsFilterEnabled($obligationsFilter);
         $table_gui->init();
         $table_gui->setData($data);
         $this->tpl->setVariable('TABLE_LIST_OF_QUESTIONS', $table_gui->getHTML());
         if ($this->object->getEnableProcessingTime()) {
             $this->outProcessingTime($active_id);
         }
     } else {
         $template = new ilTemplate('tpl.il_as_tst_list_of_questions_short.html', true, true, 'Modules/Test');
         foreach ($data as $row) {
             if (strlen($row['description'])) {
                 $template->setCurrentBlock('description');
                 $template->setVariable("DESCRIPTION", $row['description']);
                 $template->parseCurrentBlock();
             }
             $active = $row['sequence'] == $this->sequence ? ' active' : '';
             $template->setCurrentBlock('item');
             $template->setVariable('CLASS', $row['walked_through'] ? 'answered' . $active : 'unanswered' . $active);
             $template->setVariable('ITEM', ilUtil::prepareFormOutput($row['title']));
             $template->setVariable('SEQUENCE', $row['sequence']);
             $template->parseCurrentBlock();
         }
         require_once 'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
         $panel = ilPanelGUI::getInstance();
         $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_SUBHEADING);
         $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
         $panel->setHeading($this->lng->txt('list_of_questions'));
         $panel->setBody($template->get());
         $this->tpl->setVariable('LIST_OF_QUESTIONS', $panel->getHTML());
     }
 }
 function __getLegendHTML()
 {
     global $lng;
     $tpl = new ilTemplate("tpl.lp_legend.html", true, true, "Services/Tracking");
     $tpl->setVariable("IMG_NOT_ATTEMPTED", ilUtil::getImagePath("scorm/not_attempted.svg"));
     $tpl->setVariable("IMG_IN_PROGRESS", ilUtil::getImagePath("scorm/incomplete.svg"));
     $tpl->setVariable("IMG_COMPLETED", ilUtil::getImagePath("scorm/completed.svg"));
     $tpl->setVariable("IMG_FAILED", ilUtil::getImagePath("scorm/failed.svg"));
     $tpl->setVariable("TXT_NOT_ATTEMPTED", $lng->txt("trac_not_attempted"));
     $tpl->setVariable("TXT_IN_PROGRESS", $lng->txt("trac_in_progress"));
     $tpl->setVariable("TXT_COMPLETED", $lng->txt("trac_completed"));
     $tpl->setVariable("TXT_FAILED", $lng->txt("trac_failed"));
     include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
     $panel = ilPanelGUI::getInstance();
     $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
     $panel->setBody($tpl->get());
     return $panel->getHTML();
 }
 /**
 * Creates the finished page for a running survey
 *
 * Creates the finished page for a running survey
 *
 * @access public
 */
 function runShowFinishedPage()
 {
     global $ilToolbar, $ilUser;
     $has_button = false;
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     if (!$this->preview) {
         if ($this->object->hasViewOwnResults()) {
             $button = ilLinkButton::getInstance();
             $button->setCaption("svy_view_own_results");
             $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
             $ilToolbar->addButtonInstance($button);
             $has_button = true;
         }
         if ($this->object->hasMailOwnResults()) {
             if ($has_button) {
                 $ilToolbar->addSeparator();
             }
             require_once "Services/Form/classes/class.ilTextInputGUI.php";
             $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
             $mail->setSize(25);
             if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                 $mail->setValue($ilUser->getEmail());
             }
             $ilToolbar->addInputItem($mail, true);
             $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
             include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
             $button = ilSubmitButton::getInstance();
             $button->setCaption("svy_mail_own_results");
             $button->setCommand("mailUserResults");
             $ilToolbar->addButtonInstance($button);
             $has_button = true;
         }
     }
     if (!$has_button && strlen($this->object->getOutro()) == 0) {
         $this->exitSurvey();
     } else {
         if ($has_button) {
             $ilToolbar->addSeparator();
         }
         $button = ilLinkButton::getInstance();
         $button->setCaption("survey_execution_exit");
         $button->setUrl($this->ctrl->getLinkTarget($this, "exitSurvey"));
         $ilToolbar->addButtonInstance($button);
         if (strlen($this->object->getOutro())) {
             include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
             $panel = ilPanelGUI::getInstance();
             $panel->setBody($this->object->prepareTextareaOutput($this->object->getOutro()));
             $this->tpl->setContent($panel->getHTML());
         }
     }
 }
 protected function view($a_is_initial = false)
 {
     global $tpl, $lng;
     $params = $this->viewToolbar($a_is_initial);
     if (is_array($params)) {
         // data
         $tfr = explode("-", (string) $params["month"]);
         $day_from = date("Y-m-d", mktime(0, 0, 1, $tfr[1] - ($params["scope"] - 1), 1, $tfr[0]));
         $day_to = date("Y-m-d", mktime(0, 0, 1, $tfr[1] + 1, 0, $tfr[0]));
         unset($tfr);
         $chart_data = $this->getChartData($params["figure"], $params["scope"], $day_from, $day_to);
         $list_data = $this->getListData();
         // render
         $vtpl = new ilTemplate("tpl.wiki_stat_list.html", true, true, "Modules/Wiki");
         include_once "./Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
         $chart_panel = ilPanelGUI::getInstance();
         $vtpl->setVariable("CHART", $this->renderGraph($params["figure"], $chart_data));
         $vtpl->setCurrentBlock("row_bl");
         $counter = 0;
         foreach ($list_data as $figure => $values) {
             $day = (int) substr($day, 8);
             $vtpl->setVariable("CSS_ROW", $counter++ % 2 ? "tblrow1" : "tblrow2");
             $vtpl->setVariable("FIGURE", $figure);
             $vtpl->setVariable("YESTERDAY_VALUE", $values["yesterday"]);
             $vtpl->setVariable("TODAY_VALUE", $values["today"]);
             $vtpl->parseCurrentBlock();
         }
         $vtpl->setVariable("FIGURE_HEAD", $lng->txt("wiki_stat_figure"));
         $vtpl->setVariable("YESTERDAY_HEAD", $lng->txt("yesterday"));
         $vtpl->setVariable("TODAY_HEAD", $lng->txt("today"));
         $chart_panel->setHeading($lng->txt("statistics"));
         $chart_panel->setBody($vtpl->get());
         $chart_panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_SUBHEADING);
         $tpl->setContent($chart_panel->getHTML());
     }
 }
 /**
  * Prepares and displays chatroom and connects user to it.
  * @param ilChatroom     $room
  * @param ilChatroomUser $chat_user
  */
 private function showRoom(ilChatroom $room, ilChatroomUser $chat_user)
 {
     /**
      * @var $tpl                 ilTemplate    $tpl
      * @var $ilUser              ilObjUser
      * @var $ilCtrl              ilCtrl
      * @var $rbacsystem          ilRbacSystem
      * @var $lng                 ilLanguage
      * @var $ilNavigationHistory ilNavigationHistory
      */
     global $tpl, $ilUser, $ilCtrl, $rbacsystem, $lng, $ilNavigationHistory;
     if (!ilChatroom::checkUserPermissions('read', $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass('ilrepositorygui', '');
     }
     $user_id = $chat_user->getUserId($ilUser);
     $ilNavigationHistory->addItem($_GET['ref_id'], $ilCtrl->getLinkTargetByClass('ilrepositorygui', 'view'), 'chtr');
     if ($room->isUserBanned($user_id)) {
         $this->cancelJoin($lng->txt('banned'));
         return;
     }
     $scope = $room->getRoomId();
     $connector = $this->gui->getConnector();
     $response = @$connector->connect($scope, $user_id);
     if (!$response) {
         ilUtil::sendFailure($lng->txt('unable_to_connect'), true);
         $ilCtrl->redirectByClass('ilinfoscreengui', 'info');
     }
     if (!$room->isSubscribed($chat_user->getUserId()) && $room->connectUser($chat_user)) {
         $messageObject = array('type' => 'connected', 'users' => array(array('login' => $chat_user->getUsername(), 'id' => $user_id)), 'timestamp' => time() * 1000);
         $message = json_encode($messageObject);
         $connector->sendMessage($scope, $message);
         $room->addHistoryEntry($messageObject);
     }
     $connection_info = json_decode($response);
     $settings = $connector->getSettings();
     $known_private_room = $room->getActivePrivateRooms($ilUser->getId());
     $initial = new stdClass();
     $initial->users = $room->getConnectedUsers();
     $initial->private_rooms = array_values($known_private_room);
     $initial->redirect_url = $ilCtrl->getLinkTarget($this->gui, 'view-lostConnection', '', false, false);
     $initial->private_rooms_enabled = (bool) $room->getSetting('private_rooms_enabled');
     $initial->userinfo = array('moderator' => $rbacsystem->checkAccess('moderate', (int) $_GET['ref_id']), 'userid' => $chat_user->getUserId());
     $smileys = array();
     include_once 'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
     if ($settings->getSmiliesEnabled()) {
         $smileys_array = ilChatroomSmilies::_getSmilies();
         foreach ($smileys_array as $smiley_array) {
             $new_keys = array();
             $new_val = '';
             foreach ($smiley_array as $key => $value) {
                 if ($key == 'smiley_keywords') {
                     $new_keys = explode("\n", $value);
                 }
                 if ($key == 'smiley_fullpath') {
                     $new_val = $value;
                 }
             }
             if (!$new_keys || !$new_val) {
                 continue;
             }
             foreach ($new_keys as $new_key) {
                 $smileys[$new_key] = $new_val;
             }
         }
         $initial->smileys = $smileys;
     } else {
         $initial->smileys = '{}';
     }
     $initial->messages = array();
     if (isset($_REQUEST['sub'])) {
         if ($known_private_room[$_REQUEST['sub']]) {
             if (!$room->isAllowedToEnterPrivateRoom($chat_user->getUserId(), $_REQUEST['sub'])) {
                 $initial->messages[] = array('type' => 'error', 'message' => $lng->txt('not_allowed_to_enter'));
             } else {
                 $scope = $room->getRoomId();
                 $params = array();
                 $params['user'] = $chat_user->getUserId();
                 $params['sub'] = $_REQUEST['sub'];
                 $params['message'] = json_encode(array('type' => 'private_room_entered', 'user' => $user_id));
                 $query = http_build_query($params);
                 $connector = $this->gui->getConnector();
                 $response = $connector->enterPrivateRoom($scope, $query);
                 $responseObject = json_decode($response);
                 if ($responseObject->success == true) {
                     $room->subscribeUserToPrivateRoom($params['sub'], $params['user']);
                 }
                 $message = json_encode(array('type' => 'private_room_entered', 'user' => $params['user'], 'sub' => $params['sub']));
                 $connector->sendMessage($room->getRoomId(), $message, array('public' => 1, 'sub' => $params['sub']));
                 $initial->enter_room = $_REQUEST['sub'];
                 $initial->messages[] = array('type' => 'notice', 'user' => $params['user'], 'sub' => $params['sub'], 'entersub' => 1);
             }
             if ($_SESSION['show_invitation_message']) {
                 $initial->messages[] = array('type' => 'notice', 'message' => $lng->txt('user_invited'), 'sub' => $_REQUEST['sub']);
                 unset($_SESSION['show_invitation_message']);
             }
         } else {
             $initial->messages[] = array('type' => 'error', 'message' => $lng->txt('user_invited'));
         }
     }
     if ((int) $room->getSetting('display_past_msgs')) {
         $initial->messages = array_merge($initial->messages, array_reverse($room->getLastMessages($room->getSetting('display_past_msgs'), $chat_user)));
     }
     $roomTpl = new ilTemplate('tpl.chatroom.html', true, true, 'Modules/Chatroom');
     $roomTpl->setVariable('SESSION_ID', $connection_info->{'session-id'});
     $roomTpl->setVariable('BASEURL', $settings->getBaseURL());
     $roomTpl->setVariable('INSTANCE', $settings->getInstance());
     $roomTpl->setVariable('SCOPE', $scope);
     $roomTpl->setVariable('MY_ID', $user_id);
     $roomTpl->setVariable('INITIAL_DATA', json_encode($initial));
     $roomTpl->setVariable('POSTURL', $ilCtrl->getLinkTarget($this->gui, 'postMessage', '', true, true));
     $roomTpl->setVariable('ACTIONS', $lng->txt('actions'));
     $roomTpl->setVariable('LBL_CREATE_PRIVATE_ROOM', $lng->txt('create_private_room_label'));
     $roomTpl->setVariable('LBL_USER', $lng->txt('user'));
     $roomTpl->setVariable('LBL_USER_TEXT', $lng->txt('invite_username'));
     $roomTpl->setVariable('LBL_AUTO_SCROLL', $lng->txt('auto_scroll'));
     $roomTpl->setVariable('INITIAL_USERS', json_encode($room->getConnectedUsers()));
     $this->renderFontSettings($roomTpl, array());
     $this->renderFileUploadForm($roomTpl);
     $this->renderSendMessageBox($roomTpl);
     $this->renderLanguageVariables($roomTpl);
     $roomRightTpl = new ilTemplate('tpl.chatroom_right.html', true, true, 'Modules/Chatroom');
     $this->renderRightUsersBlock($roomRightTpl);
     require_once 'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
     $right_content_panel = ilPanelGUI::getInstance();
     $right_content_panel->setHeading($lng->txt('users'));
     $right_content_panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
     $right_content_panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
     $right_content_panel->setBody($roomRightTpl->get());
     $tpl->setContent($roomTpl->get());
     $tpl->setRightContent($right_content_panel->getHTML());
 }
 /**
  * Build navigation blocks
  *
  * @param array $a_items
  * @param string $a_list_cmd
  * @param string $a_posting_cmd
  * @param bool $a_link_template
  * @param bool $a_show_inactive
  * @return string
  */
 function renderNavigation(array $a_items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false)
 {
     global $ilCtrl, $ilSetting;
     if ($this->object->getOrder()) {
         $order = array_flip($this->object->getOrder());
     } else {
         $order = array("navigation" => 0, "keywords" => 2, "authors" => 1);
     }
     $wtpl = new ilTemplate("tpl.blog_list_navigation.html", true, true, "Modules/Blog");
     $blocks = array();
     // by date
     if (sizeof($a_items)) {
         $blocks[$order["navigation"]] = array($this->lng->txt("blog_navigation"), $this->renderNavigationByDate($a_items, $a_list_cmd, $a_posting_cmd, $a_link_template, $a_show_inactive));
     }
     // authors
     if ($this->id_type == self::REPOSITORY_NODE_ID && $this->object->hasAuthors()) {
         $authors = $this->renderNavigationByAuthors($a_items, $a_list_cmd, $a_show_inactive);
         if ($authors) {
             $blocks[$order["authors"]] = array($this->lng->txt("blog_authors"), $authors);
         }
     }
     // is not part of (html) export
     if (!$a_link_template) {
         if ($this->object->hasKeywords()) {
             // keywords
             $may_edit_keywords = $_GET["blpg"] && $this->mayContribute($_GET["blpg"]) && $a_list_cmd != "preview" && $a_list_cmd != "gethtml";
             $keywords = $this->renderNavigationByKeywords($a_list_cmd, $a_show_inactive);
             if ($keywords || $may_edit_keywords) {
                 if (!$keywords) {
                     $keywords = $this->lng->txt("blog_no_keywords");
                 }
                 $cmd = null;
                 if ($may_edit_keywords) {
                     $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $_GET["blpg"]);
                     $cmd = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords");
                     $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", "");
                 }
                 $blocks[$order["keywords"]] = array($this->lng->txt("blog_keywords"), $keywords, $cmd ? array($cmd, $this->lng->txt("blog_edit_keywords")) : null);
             }
         }
         // rss
         if ($this->object->hasRSS() && $ilSetting->get('enable_global_profiles') && $a_list_cmd == "preview") {
             // #10827
             $blog_id = $this->node_id;
             if ($this->id_type != self::WORKSPACE_NODE_ID) {
                 $blog_id .= "_cll";
             }
             $url = ILIAS_HTTP_PATH . "/feed.php?blog_id=" . $blog_id . "&client_id=" . rawurlencode(CLIENT_ID);
             include_once "./Services/News/classes/class.ilRSSButtonGUI.php";
             $wtpl->setVariable("RSS_BUTTON", ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS, $url));
         }
     }
     if (sizeof($blocks)) {
         include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
         ksort($blocks);
         foreach ($blocks as $block) {
             $panel = ilPanelGUI::getInstance();
             $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
             $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
             $panel->setHeading($block[0]);
             $panel->setBody($block[1]);
             if (isset($block[2]) && is_array($block[2])) {
                 $panel->setFooter('<a href="' . $block[2][0] . '">' . $block[2][1] . '</a>');
             }
             $wtpl->setCurrentBlock("block_bl");
             $wtpl->setVariable("BLOCK", $panel->getHTML());
             $wtpl->parseCurrentBlock();
         }
     }
     return $wtpl->get();
 }