/** * show tracking data of item */ function showTrackingItem() { include_once "./Services/Table/classes/class.ilTableGUI.php"; // load template for table $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scorm2004_track_item.html", "Modules/Scorm2004"); $num = 2; $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=" . $this->ref_id . "{$obj_str}&cmd=gateway"); // create table $tbl = new ilTableGUI(); include_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php"; $sc_item =& new ilSCORMItem($_GET["obj_id"]); // title & header columns $user = new ilObjUser($_GET["user_id"]); $tbl->setTitle($user->getLastname() . ", " . $user->getFirstname()); $tbl->setHeaderNames(array($this->lng->txt("title"), $this->lng->txt("cont_status"), $this->lng->txt("cont_time"), $this->lng->txt("cont_score"))); $header_params = array("ref_id" => $this->ref_id, "cmd" => $_GET["cmd"], "cmdClass" => get_class($this), "obj_id" => $_GET["obj_id"], "baseClass" => "ilSAHSEditGUI", 'user_id' => $_GET["user_id"]); $cols = array("title", "status", "time", "score"); $tbl->setHeaderVars($cols, $header_params); //$tbl->setColumnWidth(array("25%",)); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); //$this->tpl->setVariable("COLUMN_COUNTS",count($this->data["cols"])); //$this->showActions(true); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); #$tbl->disable("footer"); $tr_data = $this->object->getTrackingDataAgg($_GET["user_id"]); //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]); $tbl->setMaxCount(count($tr_data)); $tr_data = array_slice($tr_data, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($tr_data) > 0) { foreach ($tr_data as $data) { $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("VAL_TITLE", $data["title"]); $this->ctrl->setParameter($this, "user_id", $_GET["user_id"]); $this->ctrl->setParameter($this, "obj_id", $data["sco_id"]); $this->tpl->setVariable("LINK_SCO", $this->ctrl->getLinkTarget($this, "showTrackingItemPerUser")); $this->tpl->setVariable("VAL_TIME", $data["time"]); $this->tpl->setVariable("VAL_STATUS", $data["status"]); $this->tpl->setVariable("VAL_SCORE", $data["score"]); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", $num); $this->tpl->parseCurrentBlock(); } }
function pages() { global $tree, $tpl, $ilToolbar, $ilCtrl, $lng; $this->setTabs(); $this->setContentSubTabs("pages"); if (!false) { $ilCtrl->setParameter($this, "backcmd", "pages"); $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg"); $ilToolbar->addButton($lng->txt("pg_add"), $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create")); $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", ""); include_once "./Modules/LearningModule/classes/class.ilLMPagesTableGUI.php"; $t = new ilLMPagesTableGUI($this, "pages", $this->object); $tpl->setContent($t->getHTML()); return; } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.all_pages.html", "Modules/LearningModule"); $num = 0; $this->tpl->setCurrentBlock("form"); $this->ctrl->setParameter($this, "backcmd", "pages"); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_pages")); $this->tpl->setVariable("CONTEXT", $this->lng->txt("cont_usage")); $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE); $cnt = 0; $pages = ilLMPageObject::getPageList($this->object->getId()); foreach ($pages as $page) { $this->tpl->setCurrentBlock("table_row"); // check activation include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_lookupActive($page["obj_id"], $this->object->getType(), $lm_set->get("time_scheduled_page_activation")); // is page scheduled? $img_sc = $lm_set->get("time_scheduled_page_activation") && ilLMPage::_isScheduledActivation($page["obj_id"], $this->object->getType()) ? "_sc" : ""; if (!$active) { $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg_d" . $img_sc . ".png")); $this->tpl->setVariable("IMG_ALT", $this->lng->txt("cont_page_deactivated")); } else { if (ilLMPage::_lookupContainsDeactivatedElements($page["obj_id"], $this->object->getType())) { $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg_del" . $img_sc . ".png")); $this->tpl->setVariable("IMG_ALT", $this->lng->txt("cont_page_deactivated_elements")); } else { $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg" . $img_sc . ".png")); $this->tpl->setVariable("IMG_ALT", $this->lng->txt("pg")); } } // color changing $css_row = ilUtil::switchColor($cnt++, "tblrow1", "tblrow2"); // checkbox $this->tpl->setVariable("CHECKBOX_ID", $page["obj_id"]); $this->tpl->setVariable("CSS_ROW", $css_row); // link $this->ctrl->setParameter($this, "backcmd", ""); $this->ctrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $page["obj_id"]); //echo "<br>:".$this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "view").":"; $this->tpl->setVariable("LINK_TARGET", $this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit")); // title $this->tpl->setVariable("TEXT_CONTENT", $page["title"]); // context if ($this->lm_tree->isInTree($page["obj_id"])) { $path_str = $this->getContextPath($page["obj_id"]); } else { $path_str = "---"; } // check whether page is header or footer $add_str = ""; if ($page["obj_id"] == $this->object->getHeaderPage()) { $add_str = " <b>(" . $this->lng->txt("cont_header") . ")</b>"; } if ($page["obj_id"] == $this->object->getFooterPage()) { $add_str = " <b>(" . $this->lng->txt("cont_footer") . ")</b>"; } $this->tpl->setVariable("TEXT_CONTEXT", $path_str . $add_str); $this->tpl->parseCurrentBlock(); } if ($cnt == 0) { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("NUM_COLS", 4); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->parseCurrentBlock(); } else { $acts = array("delete" => "delete", "movePage" => "movePage", "copyPage" => "copyPage", "selectHeader" => "selectHeader", "selectFooter" => "selectFooter", "activatePages" => "cont_de_activate"); if (ilEditClipboard::getContentObjectType() == "pg" && ilEditClipboard::getAction() == "copy") { $acts["pastePage"] = "pastePage"; } /* if (ilEditClipboard::getContentObjectType() == "st") { $acts["pasteChapter"] = "pasteChapter"; }*/ $this->tpl->setVariable("NUM_COLS", 4); $this->showActions($acts); // SHOW VALID ACTIONS /* $this->tpl->setCurrentBlock("operation_btn"); $this->tpl->setVariable("BTN_NAME", "delete"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete")); $this->tpl->parseCurrentBlock();*/ } // SHOW POSSIBLE SUB OBJECTS $this->tpl->setVariable("NUM_COLS", 4); //$this->showPossibleSubObjects("st"); $subobj = array("pg"); $opts = ilUtil::formSelect(12, "new_type", $subobj); $this->tpl->setCurrentBlock("add_object"); $this->tpl->setVariable("SELECT_OBJTYPE", $opts); $this->tpl->setVariable("BTN_NAME", "create"); $this->tpl->setVariable("TXT_ADD", $this->lng->txt("create")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("form"); $this->tpl->parseCurrentBlock(); }
function editRoleAccessLimitations() { global $lng, $ilAccess, $ilErr, $rbacreview; if (!$ilAccess->checkAccess('write', '', $this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE); } $this->__initRoleAccessLimitations(); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.reg_role_access_limitations.html', 'Services/Registration'); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_REG_ROLE_ACCESS_LIMITATIONS", $lng->txt('reg_role_access_limitations')); $this->tpl->setVariable("TXT_ROLE", $lng->txt('obj_role')); $this->tpl->setVariable("TXT_ACCESS_LIMITATION_MODE", $lng->txt('reg_access_limitation_mode')); $this->tpl->setVariable("BTN_SAVE", $lng->txt('save')); $this->tpl->setVariable("BTN_CANCEL", $lng->txt('cancel')); $counter = 0; include_once './Services/AccessControl/classes/class.ilObjRole.php'; foreach (ilObjRole::_lookupRegisterAllowed() as $role) { $this->tpl->setCurrentBlock("roles"); $this->tpl->setVariable("CSSROW", ilUtil::switchColor(++$counter, 'tblrow1', 'tblrow1')); $this->tpl->setVariable("ROLE_ID", $role['id']); $this->tpl->setVariable("ROLE_TITLE", $role['title']); $this->tpl->setVariable("SEL_ACCESS_LIMITATION", $this->__buildAccessLimitationSelection($role['id'])); $this->tpl->setVariable("CSS_DISPLAY_ABSOLUTE", $this->access_limitations_obj->getMode($role['id']) == 'absolute' ? 'inline' : 'none'); $this->tpl->setVariable("CSS_DISPLAY_RELATIVE", $this->access_limitations_obj->getMode($role['id']) == 'relative' ? 'inline' : 'none'); $this->tpl->setVariable("CSS_DISPLAY_UNLIMITED", $this->access_limitations_obj->getMode($role['id']) == 'unlimited' ? 'inline' : 'none'); $this->tpl->setVariable("TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt('reg_access_limitation_none')); $date = $this->__prepareDateSelect($this->access_limitations_obj->getAbsolute($role['id'])); $this->tpl->setVariable("SEL_ACCESS_LIMITATION_ABSOLUTE", ilUtil::makeDateSelect('access_limitation_absolute_' . $role['id'], $date['y'], $date['m'], $date['d'], '2007')); $this->tpl->setVariable("TXT_DAYS", $lng->txt('days')); $this->tpl->setVariable("TXT_MONTHS", $lng->txt('months')); $this->tpl->setVariable("TXT_YEARS", $lng->txt('years')); $this->tpl->setVariable("DAYS", $this->access_limitations_obj->getRelative($role['id'], 'd')); $this->tpl->setVariable("MONTHS", $this->access_limitations_obj->getRelative($role['id'], 'm')); $this->tpl->setVariable("YEARS", $this->access_limitations_obj->getRelative($role['id'], 'y')); $this->tpl->parseCurrentBlock(); } }
/** * render table * @access public */ function render() { if ($this->enabled['table']) { $this->tpl->setVariable("CSS_TABLE", $this->getStyle("table")); } // table title icon if ($this->enabled["icon"] && $this->enabled["title"]) { $this->tpl->setCurrentBlock("tbl_header_title_icon"); $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath($this->icon)); $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->icon_alt); $this->tpl->parseCurrentBlock(); } // table title help if ($this->enabled["help"] && $this->enabled["title"]) { $this->tpl->setCurrentBlock("tbl_header_title_help"); $this->tpl->setVariable("TBL_HELP_IMG", ilUtil::getImagePath($this->help_icon)); $this->tpl->setVariable("TBL_HELP_LINK", $this->help_page); $this->tpl->setVariable("TBL_HELP_IMG_ALT", $this->help_icon_alt); $this->tpl->parseCurrentBlock(); } // hits per page selector if ($this->enabled["hits"] && $this->enabled["title"]) { $this->tpl->setCurrentBlock("tbl_header_hits_page"); $this->tpl->setVariable("LIMIT", $_SESSION["tbl_limit"]); $this->tpl->setVariable("HITS_PER_PAGE", $this->lng->txt("hits_per_page")); $this->tpl->parseCurrentBlock(); } // table title if ($this->enabled["title"]) { $this->tpl->setCurrentBlock("tbl_header_title"); $this->tpl->setVariable("COLUMN_COUNT", $this->column_count); $this->tpl->setVariable("TBL_TITLE", $this->title); $this->tpl->parseCurrentBlock(); } // table header if ($this->enabled["header"]) { $this->renderHeader(); } // table data // the table content may be skipped to use an individual template blockfile // To do so don't set $this->data and parse your table content by yourself // The template block name for the blockfile MUST be 'TBL_CONTENT' if ($this->enabled["content"] && is_array($this->data)) { if ($this->enabled['auto_sort']) { $this->setMaxCount(count($this->data)); $this->sortData(); } $count = 0; foreach ($this->data as $tbl_content_row) { foreach ($tbl_content_row as $key => $tbl_content_cell) { if (is_array($tbl_content_cell)) { $this->tpl->setCurrentBlock("tbl_cell_subtitle"); $this->tpl->setVariable("TBL_CELL_SUBTITLE", $tbl_content_cell[1]); $this->tpl->parseCurrentBlock(); $tbl_content_cell = "<b>" . $tbl_content_cell[0] . "</b>"; } $this->tpl->setCurrentBlock("tbl_content_cell"); $this->tpl->setVariable("TBL_CONTENT_CELL", $tbl_content_cell); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_content_row"); $rowcolor = ilUtil::switchColor($count, "tblrow1", "tblrow2"); $this->tpl->setVariable("ROWCOLOR", $rowcolor); $this->tpl->parseCurrentBlock(); $count++; } } // select all checkbox if ($this->enabled["select_all"]) { if (strlen($this->getFormName()) && strlen($this->getSelectAllCheckbox())) { $this->tpl->setVariable('SELECT_PREFIX', $this->prefix); $this->tpl->setVariable("SELECT_ALL_TXT_SELECT_ALL", $this->lng->txt("select_all")); $this->tpl->setVariable("SELECT_ALL_CHECKBOX_NAME", $this->getSelectAllCheckbox()); $this->tpl->setVariable("SELECT_ALL_FORM_NAME", $this->getFormName()); if (!($this->enabled["numinfo"] && $this->enabled["footer"])) { $this->tpl->setVariable("COLUMN_COUNT", $this->getColumnCount()); } } } // table header numinfo if ($this->enabled["numinfo_header"]) { $start = $this->offset + 1; // compute num info $end = $this->offset + $this->limit; if ($end > $this->max_count or $this->limit == 0) { $end = $this->max_count; } if ($this->lang_support) { $numinfo = "(" . $this->lng->txt("dataset") . " " . $start . " - " . $end . " " . strtolower($this->lng->txt("of")) . " " . $this->max_count . ")"; } else { $numinfo = "(Dataset " . $start . " - " . $end . " of " . $this->max_count . ")"; } if ($this->max_count > 0) { //$numinfo = $this->lng->txt("no_datasets"); $this->tpl->setCurrentBlock("tbl_header_numinfo"); $this->tpl->setVariable("NUMINFO_HEADER", $numinfo); $this->tpl->setVariable("COLUMN_COUNT_HEADER", $this->getColumnCount()); $this->tpl->parseCurrentBlock(); } } // table footer numinfo if ($this->enabled["numinfo"] && $this->enabled["footer"]) { $start = $this->offset + 1; // compute num info $end = $this->offset + $this->limit; if ($end > $this->max_count or $this->limit == 0) { $end = $this->max_count; } if ($this->lang_support) { $numinfo = "(" . $this->lng->txt("dataset") . " " . $start . " - " . $end . " " . strtolower($this->lng->txt("of")) . " " . $this->max_count . ")"; } else { $numinfo = "(Dataset " . $start . " - " . $end . " of " . $this->max_count . ")"; } if ($this->max_count > 0) { //$numinfo = $this->lng->txt("no_datasets"); $this->tpl->setCurrentBlock("tbl_footer_numinfo"); $this->tpl->setVariable("NUMINFO", $numinfo); $this->tpl->parseCurrentBlock(); } } // table footer linkbar if ($this->enabled["linkbar"] && $this->enabled["footer"] && $this->limit != 0 && $this->max_count > 0) { $params = array($this->prefix . "sort_by" => $this->header_vars[$this->order_column], $this->prefix . "sort_order" => $this->order_direction); $params = array_merge($this->header_params, $params); $layout = array("link" => $this->footer_style, "prev" => $this->footer_previous, "next" => $this->footer_next); $base = $this->getBase() == "" ? basename($_SERVER["PHP_SELF"]) : $this->getBase(); $linkbar = ilUtil::Linkbar($base, $this->max_count, $this->limit, $this->offset, $params, $layout, $this->prefix); $this->tpl->setCurrentBlock("tbl_footer_linkbar"); $this->tpl->setVariable("LINKBAR", $linkbar); $this->tpl->parseCurrentBlock(); } // table footer if ($this->enabled["footer"] && $this->max_count > 0) { $this->tpl->setCurrentBlock("tbl_footer"); $this->tpl->setVariable("COLUMN_COUNT", $this->column_count); $this->tpl->parseCurrentBlock(); } // action buttons if ($this->enabled["action"]) { foreach ($this->action_buttons as $button) { $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", $button["name"]); $this->tpl->setVariable("BTN_VALUE", $button["value"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_action_row"); $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png")); $this->tpl->setVariable("ALT_ARROW", $this->lng->txt("arrow_downright.png")); $this->tpl->setVariable("COLUMN_COUNTS", $this->getColumnCount()); $this->tpl->parseCurrentBlock(); } if ($this->enabled["form"]) { $this->tpl->touchBlock("tbl_form_footer"); } if ($this->enabled['table']) { $this->tpl->touchBlock("tbl_table_end"); } if (!$this->global_tpl) { return $this->tpl->get(); } }
/** * Global user settings * * Allows to define global settings for user accounts * * Note: The Global user settings form allows to specify default values * for some user preferences. To avoid redundant implementations, * specification of default values can be done elsewhere in ILIAS * are not supported by this form. */ function exportObject() { global $ilias, $ilCtrl; if ($_POST["cmd"]["export"]) { $this->object->buildExportFile($_POST["export_type"]); $this->ctrl->redirectByClass("ilobjuserfoldergui", "export"); exit; } $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_export.html', 'Services/User'); $export_types = array("userfolder_export_excel_x86", "userfolder_export_csv", "userfolder_export_xml"); // create table include_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(); // load files templates $this->tpl->addBlockfile("EXPORT_FILES", "export_files", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.usr_export_file_row.html", "Services/User"); $num = 0; $tbl->setTitle($this->lng->txt("userfolder_export_files")); $tbl->setHeaderNames(array("", $this->lng->txt("userfolder_export_file"), $this->lng->txt("userfolder_export_file_size"), $this->lng->txt("date"))); $tbl->setHeaderVars(array(), $ilCtrl->getParameterArray($this, "export")); $tbl->enabled["sort"] = false; $tbl->setColumnWidth(array("1%", "49%", "25%", "25%")); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // ??? $this->tpl->setVariable("COLUMN_COUNTS", 4); // delete button $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png")); $this->tpl->setVariable("ALT_ARROW", $this->lng->txt("actions")); $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "downloadExportFile"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download")); $this->tpl->parseCurrentBlock(); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); //$tbl->disable("footer"); $export_files = $this->object->getExportFiles(); $tbl->setMaxCount(count($export_files)); $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($export_files) > 0) { $i = 0; foreach ($export_files as $exp_file) { $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("TXT_FILENAME", $exp_file["filename"]); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable("TXT_SIZE", $exp_file["filesize"]); $this->tpl->setVariable("CHECKBOX_ID", $exp_file["filename"]); $file_arr = explode("__", $exp_file["filename"]); $this->tpl->setVariable('TXT_DATE', ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX))); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("selectall"); $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all")); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } //if is_array /* else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", 3); $this->tpl->parseCurrentBlock(); } */ $this->tpl->parseCurrentBlock(); foreach ($export_types as $export_type) { $this->tpl->setCurrentBlock("option"); $this->tpl->setVariable("OPTION_VALUE", $export_type); $this->tpl->setVariable("OPTION_TEXT", $this->lng->txt($export_type)); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("EXPORT_BUTTON", $this->lng->txt("create_export_file")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); }
function subchap() { global $tree, $ilCtrl, $lng, $ilUser; $this->setTabs(); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule"); $num = 0; $this->tpl->setCurrentBlock("form"); $this->ctrl->setParameter($this, "backcmd", "subchap"); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_subchapters")); $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE); $cnt = 0; $childs = $this->tree->getChilds($this->obj->getId()); foreach ($childs as $child) { if ($child["type"] != "st") { continue; } $this->tpl->setCurrentBlock("table_row"); // color changing $css_row = ilUtil::switchColor($cnt++, "tblrow1", "tblrow2"); // checkbox $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.png")); // type $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]); $link = $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view"); $this->tpl->setVariable("LINK_TARGET", $link); // title $this->tpl->setVariable("TEXT_CONTENT", ilStructureObject::_getPresentationTitle($child["obj_id"], $this->content_object->isActiveNumbering())); $this->tpl->parseCurrentBlock(); } if ($cnt == 0) { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("NUM_COLS", 3); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->parseCurrentBlock(); } //else //{ // SHOW VALID ACTIONS $this->tpl->setVariable("NUM_COLS", 3); $acts = array("delete" => "delete", "cutChapter" => "cut", "copyChapter" => "copyChapter"); if ($ilUser->clipboardHasObjectsOfType("st")) { $acts["pasteChapter"] = "pasteChapter"; } $this->showActions($acts); //} // SHOW POSSIBLE SUB OBJECTS $this->tpl->setVariable("NUM_COLS", 3); //$this->showPossibleSubObjects("st"); $subobj = array("st"); $opts = ilUtil::formSelect(12, "new_type", $subobj); //$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png")); $this->tpl->setCurrentBlock("add_object"); $this->tpl->setVariable("SELECT_OBJTYPE", $opts); //$this->tpl->setVariable("FORMACTION_OBJ_ADD", "adm_object.php?cmd=create&ref_id=".$_GET["ref_id"]); $this->tpl->setVariable("BTN_NAME", "create"); $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert")); $this->tpl->parseCurrentBlock(); //$this->tpl->setVariable("NUM_COLS", 2); //$this->showPossibleSubObjects("st"); $this->tpl->setCurrentBlock("form"); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]); }
/** * show download list */ function showDownloadList() { global $ilBench, $ilAccess, $ilias, $lng, $ilTabs; if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.glo_download_list.html", "Modules/Glossary"); $this->setTabs(); $ilTabs->activateTab("download"); // set title header $this->tpl->setTitle($this->glossary->getTitle()); //$this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_glo_b.png")); $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo_b.png")); // create table require_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(); // load files templates $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/Glossary"); $export_files = array(); $types = array("xml", "html"); foreach ($types as $type) { if ($this->glossary->getPublicExportFile($type) != "") { $dir = $this->glossary->getExportDirectory($type); if (is_file($this->glossary->getExportDirectory($type) . "/" . $this->glossary->getPublicExportFile($type))) { $size = filesize($this->glossary->getExportDirectory($type) . "/" . $this->glossary->getPublicExportFile($type)); $export_files[] = array("type" => $type, "file" => $this->glossary->getPublicExportFile($type), "size" => $size); } } } $num = 0; $tbl->setTitle($this->lng->txt("download")); $tbl->setHeaderNames(array($this->lng->txt("cont_format"), $this->lng->txt("cont_file"), $this->lng->txt("size"), $this->lng->txt("date"), "")); $cols = array("format", "file", "size", "date", "download"); $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"], "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this))); $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("10%", "30%", "20%", "20%", "20%")); $tbl->disable("sort"); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // ??? $this->tpl->setVariable("COLUMN_COUNTS", 5); // footer //$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next")); $tbl->disable("footer"); $tbl->setMaxCount(count($export_files)); $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($export_files) > 0) { $i = 0; foreach ($export_files as $exp_file) { $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]); $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"])); $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"] . ":" . $exp_file["file"]); $file_arr = explode("__", $exp_file["file"]); $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s", $file_arr[0])); $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download")); $this->ctrl->setParameter($this, "type", $exp_file["type"]); $this->tpl->setVariable("LINK_DOWNLOAD", $this->ctrl->getLinkTarget($this, "downloadExportFile")); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", 5); $this->tpl->parseCurrentBlock(); } //$this->tpl->show(); }
/** * display form for category import (static, also called by RootFolderGUI) */ function _importCategoriesForm($a_ref_id, &$a_tpl) { global $lng, $rbacreview; $a_tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.cat_import_form.html", "Modules/Category"); $a_tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $a_tpl->setVariable("TXT_IMPORT_CATEGORIES", $lng->txt("import_categories")); $a_tpl->setVariable("TXT_HIERARCHY_OPTION", $lng->txt("import_cat_localrol")); $a_tpl->setVariable("TXT_IMPORT_FILE", $lng->txt("import_file")); $a_tpl->setVariable("TXT_IMPORT_TABLE", $lng->txt("import_cat_table")); $a_tpl->setVariable("BTN_IMPORT", $lng->txt("import")); $a_tpl->setVariable("BTN_CANCEL", $lng->txt("cancel")); // NEED TO FILL ADOPT_PERMISSIONS HTML FORM.... $parent_role_ids = $rbacreview->getParentRoleIds($a_ref_id, true); // sort output for correct color changing ksort($parent_role_ids); foreach ($parent_role_ids as $key => $par) { if ($par["obj_id"] != SYSTEM_ROLE_ID) { $check = ilUtil::formCheckbox(0, "adopt[]", $par["obj_id"], 1); $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2"); $output["adopt"][$key]["check_adopt"] = $check; $output["adopt"][$key]["role_id"] = $par["obj_id"]; $output["adopt"][$key]["type"] = $par["type"] == 'role' ? 'Role' : 'Template'; $output["adopt"][$key]["role_name"] = $par["title"]; } } //var_dump($output); // BEGIN ADOPT PERMISSIONS foreach ($output["adopt"] as $key => $value) { $a_tpl->setCurrentBlock("ADOPT_PERM_ROW"); $a_tpl->setVariable("CSS_ROW_ADOPT", $value["css_row_adopt"]); $a_tpl->setVariable("CHECK_ADOPT", $value["check_adopt"]); $a_tpl->setVariable("LABEL_ID", $value["role_id"]); $a_tpl->setVariable("TYPE", $value["type"]); $a_tpl->setVariable("ROLE_NAME", $value["role_name"]); $a_tpl->parseCurrentBlock(); } }
public function viewThreadObject() { /** * @var $tpl ilTemplate * @var $lng ilLanguage * @var $ilUser ilObjUser * @var $ilAccess ilAccessHandler * @var $rbacreview ilRbacReview * @var $ilNavigationHistory ilNavigationHistory * @var $ilCtrl ilCtrl * @var $ilToolbar ilToolbarGUI */ global $tpl, $lng, $ilUser, $ilAccess, $rbacreview, $ilNavigationHistory, $ilCtrl, $frm, $ilToolbar, $ilLocator; $tpl->addCss('./Modules/Forum/css/forum_tree.css'); if (!isset($_SESSION['viewmode'])) { $_SESSION['viewmode'] = $this->objProperties->getDefaultView(); } // quick and dirty: check for treeview if (!isset($_SESSION['thread_control']['old'])) { $_SESSION['thread_control']['old'] = $_GET['thr_pk']; $_SESSION['thread_control']['new'] = $_GET['thr_pk']; } else { if (isset($_SESSION['thread_control']['old']) && $_GET['thr_pk'] != $_SESSION['thread_control']['old']) { $_SESSION['thread_control']['new'] = $_GET['thr_pk']; } } if (isset($_GET['viewmode']) && $_GET['viewmode'] != $_SESSION['viewmode']) { $_SESSION['viewmode'] = $_GET['viewmode']; } if (isset($_GET['action']) && $_SESSION['viewmode'] != ilForumProperties::VIEW_DATE || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) { $_SESSION['viewmode'] = ilForumProperties::VIEW_TREE; } else { $_SESSION['viewmode'] = ilForumProperties::VIEW_DATE; } if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } // init objects $oForumObjects = $this->getForumObjects(); /** * @var $forumObj ilObjForum */ $forumObj = $oForumObjects['forumObj']; /** * @var $frm ilForum */ $frm = $oForumObjects['frm']; /** * @var $file_obj ilFileDataForum */ $file_obj = $oForumObjects['file_obj']; // download file if ($_GET['file']) { if (!($path = $file_obj->getFileDataByMD5Filename($_GET['file']))) { ilUtil::sendFailure($this->lng->txt('error_reading_file')); } else { ilUtil::deliverFile($path['path'], $path['clean_filename']); } } if (!$this->objCurrentTopic->getId()) { $ilCtrl->redirect($this, 'showThreads'); } // Set context for login $append = '_' . $this->objCurrentTopic->getId() . ($this->objCurrentPost->getId() ? '_' . $this->objCurrentPost->getId() : ''); $tpl->setLoginTargetPar('frm_' . $_GET['ref_id'] . $append); // delete temporary media object (not in case a user adds media objects and wants to save an invalid form) if ($_GET['action'] != 'showreply' && $_GET['action'] != 'showedit') { try { include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php'; $mobs = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId()); foreach ($mobs as $mob) { if (ilObjMediaObject::_exists($mob)) { ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId()); $mob_obj = new ilObjMediaObject($mob); $mob_obj->delete(); } } } catch (Exception $e) { } } require_once './Modules/Forum/classes/class.ilObjForum.php'; require_once './Modules/Forum/classes/class.ilFileDataForum.php'; $lng->loadLanguageModule('forum'); // add entry to navigation history if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $this->object->getRefId())) { $ilCtrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId()); $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this, 'showThreads'), 'frm'); } // save last access $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId()); $this->prepareThreadScreen($forumObj); $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_view.html', 'Modules/Forum'); if (isset($_GET['anchor'])) { $tpl->setVariable('JUMP2ANCHOR_ID', (int) $_GET['anchor']); } if ($_SESSION['viewmode'] == 'date' || $_SESSION['viewmode'] == ilForumProperties::VIEW_DATE) { $orderField = 'frm_posts_tree.fpt_date'; $this->objCurrentTopic->setOrderDirection(in_array($this->objProperties->getDefaultView(), array(ilForumProperties::VIEW_DATE_ASC, ilForumProperties::VIEW_TREE)) ? 'ASC' : 'DESC'); } else { $orderField = 'frm_posts_tree.rgt'; $this->objCurrentTopic->setOrderDirection('DESC'); } // get forum- and thread-data $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId())); if (is_array($topicData = $frm->getOneTopic())) { // Visit-Counter for topic $this->objCurrentTopic->updateVisits(); $tpl->setTitle($lng->txt('forums_thread') . " \"" . $this->objCurrentTopic->getSubject() . "\""); // ******************************************************************************** // build location-links $ilLocator->addRepositoryItems(); $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this, ""), "_top"); $tpl->setLocator(); // set tabs // menu template (contains linkbar) /** @var $menutpl ilTemplate */ $menutpl = new ilTemplate('tpl.forums_threads_menu.html', true, true, 'Modules/Forum'); include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; // mark all as read if ($ilUser->getId() != ANONYMOUS_USER_ID && $forumObj->getCountUnread($ilUser->getId(), (int) $this->objCurrentTopic->getId())) { $this->ctrl->setParameter($this, 'mark_read', '1'); $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId()); $ilToolbar->addButton($this->lng->txt('forums_mark_read'), $this->ctrl->getLinkTarget($this, 'viewThread'), '', ilAccessKey::MARK_ALL_READ); $this->ctrl->clearParameters($this); } // print thread $this->ctrl->setParameterByClass('ilforumexportgui', 'print_thread', $this->objCurrentTopic->getId()); $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_top_fk', $this->objCurrentTopic->getForumId()); $ilToolbar->addButton($this->lng->txt('forums_print_thread'), $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printThread')); $this->ctrl->clearParametersByClass('ilforumexportgui'); $this->addHeaderAction(); if ($_GET['mark_read']) { $forumObj->markThreadRead($ilUser->getId(), (int) $this->objCurrentTopic->getId()); ilUtil::sendInfo($lng->txt('forums_thread_marked'), true); } // delete post and its sub-posts require_once './Modules/Forum/classes/class.ilForum.php'; if ($_GET['action'] == 'ready_delete' && $_POST['confirm'] != '') { if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $this->objCurrentPost->isOwner($ilUser->getId()) && !$this->objCurrentPost->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) { $frm = new ilForum(); $frm->setForumId($forumObj->getId()); $frm->setForumRefId($forumObj->getRefId()); $dead_thr = $frm->deletePost($this->objCurrentPost->getId()); // if complete thread was deleted ... if ($dead_thr == $this->objCurrentTopic->getId()) { $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($forumObj->getId())); $topicData = $frm->getOneTopic(); ilUtil::sendInfo($lng->txt('forums_post_deleted'), true); if ($topicData['top_num_threads'] > 0) { $this->ctrl->redirect($this, 'showThreads'); } else { $this->ctrl->redirect($this, 'createThread'); } } ilUtil::sendInfo($lng->txt('forums_post_deleted')); } } // form processing (censor) if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'ready_censor') { if (($_POST['confirm'] != '' || $_POST['no_cs_change'] != '') && $_GET['action'] == 'ready_censor') { $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId(), 1); } else { if (($_POST['cancel'] != '' || $_POST['yes_cs_change'] != '') && $_GET['action'] == 'ready_censor') { $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId()); } } } // get complete tree of thread $first_node = $this->objCurrentTopic->getFirstPostNode(); $this->objCurrentTopic->setOrderField($orderField); $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node); // no posts if (!($posNum = count($subtree_nodes))) { ilUtil::sendInfo($this->lng->txt('forums_no_posts_available')); } $pageHits = $frm->getPageHits(); $z = 0; // navigation to browse if ($posNum > $pageHits) { $params = array('ref_id' => $_GET['ref_id'], 'thr_pk' => $this->objCurrentTopic->getId(), 'orderby' => $_GET['orderby']); if (!$_GET['offset']) { $Start = 0; } else { $Start = $_GET['offset']; } $linkbar = ilUtil::Linkbar($ilCtrl->getLinkTarget($this, 'viewThread'), $posNum, $pageHits, $Start, $params); if ($linkbar != '') { $menutpl->setCurrentBlock('linkbar'); $menutpl->setVariable('LINKBAR', $linkbar); $menutpl->parseCurrentBlock(); } } $tpl->setVariable('THREAD_MENU', $menutpl->get()); // assistance val for anchor-links $jump = 0; // generate post-dates foreach ($subtree_nodes as $node) { /** * @var $node ilForumPost */ $this->ctrl->clearParameters($this); if ($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId()) { $jump++; } if ($posNum > $pageHits && $z >= $Start + $pageHits) { // if anchor-link was not found ... if ($this->objCurrentPost->getId() && $jump < 1) { $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId()); $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId()); $this->ctrl->setParameter($this, 'offset', $Start + $pageHits); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->redirect($this, 'viewThread', $this->objCurrentPost->getId()); exit; } else { break; } } if ($posNum > $pageHits && $z >= $Start || $posNum <= $pageHits) { if ($this->objCurrentPost->getId() == $node->getId()) { # actions for "active" post if ($this->is_moderator || $node->isActivated()) { // reply/edit if (!$this->objCurrentTopic->isClosed() && ($_GET['action'] == 'showreply' || $_GET['action'] == 'showedit')) { if ($_GET['action'] == 'showedit' && (!$this->is_moderator && !$node->isOwner($ilUser->getId()) || $ilUser->getId() == ANONYMOUS_USER_ID || $node->isCensored())) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } else { if ($_GET['action'] == 'showreply' && !$ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id'])) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } } $tpl->setVariable('REPLY_ANKER', $this->objCurrentPost->getId()); $oEditReplyForm = $this->getReplyEditForm(); switch ($this->objProperties->getSubjectSetting()) { case 'add_re_to_subject': $subject = $this->getModifiedReOnSubject(true); break; case 'preset_subject': $subject = $this->objCurrentPost->getSubject(); break; case 'empty_subject': default: $subject = NULL; break; } switch ($_GET['action']) { case 'showreply': if ($this->ctrl->getCmd() == 'savePost') { $oEditReplyForm->setValuesByPost(); } else { if ($this->ctrl->getCmd() == 'quotePost') { require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getDisplayUserId(), $node->getUserAlias(), $node->getImportName()); $oEditReplyForm->setValuesByPost(); $oEditReplyForm->getItemByPostVar('message')->setValue(ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()) . "\n" . $oEditReplyForm->getInput('message'), 1)); } else { $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $subject, 'message' => '', 'notify' => 0, 'userfile' => '', 'del_file' => array())); } } $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId()); $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId()); $jsTpl = new ilTemplate('tpl.forum_post_quoation_ajax_handler.html', true, true, 'Modules/Forum/'); $jsTpl->setVariable('IL_FRM_QUOTE_CALLBACK_SRC', $this->ctrl->getLinkTarget($this, 'getQuotationHTMLAsynch', '', true)); $this->ctrl->clearParameters($this); $this->tpl->setVariable('FORM_ADDITIONAL_JS', $jsTpl->get()); break; case 'showedit': if ($this->ctrl->getCmd() == 'savePost') { $oEditReplyForm->setValuesByPost(); } else { $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $this->objCurrentPost->getSubject(), 'message' => ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($this->objCurrentPost->getMessage(), 2), 1), 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true : false, 'userfile' => '', 'del_file' => array())); } break; } $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId()); $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId()); $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'action', $_GET['action']); $tpl->setVariable('FORM', $oEditReplyForm->getHTML()); $this->ctrl->clearParameters($this); } else { if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'delete') { if ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies() && $ilUser->getId() != ANONYMOUS_USER_ID) { // confirmation: delete $tpl->setVariable('FORM', $this->getDeleteFormHTML()); } } else { if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'censor') { if ($this->is_moderator) { // confirmation: censor / remove censorship $tpl->setVariable('FORM', $this->getCensorshipFormHTML()); } } else { if (!$this->objCurrentTopic->isClosed() && $this->displayConfirmPostActivation()) { if ($this->is_moderator) { // confirmation: activate $tpl->setVariable('FORM', $this->getActivationFormHTML()); } } } } } } } // if ($this->objCurrentPost->getId() == $node->getId()) if ($this->objCurrentPost->getId() != $node->getId() || $_GET['action'] != 'showreply' && $_GET['action'] != 'showedit' && $_GET['action'] != 'censor' && $_GET['action'] != 'delete' && !$this->displayConfirmPostActivation()) { if ($this->is_moderator || $node->isActivated()) { // button: reply if (!$this->objCurrentTopic->isClosed() && $ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id']) && !$node->isCensored()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'showreply'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('reply')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: edit article if (!$this->objCurrentTopic->isClosed() && ($node->isOwner($ilUser->getId()) || $this->is_moderator) && !$node->isCensored() && $ilUser->getId() != ANONYMOUS_USER_ID) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'showedit'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('edit')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: print if (!$node->isCensored()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId()); $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId()); $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId()); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost')); $tpl->setVariable('COMMANDS_TXT', $lng->txt('print')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } # buttons for every post except the "active" if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) { // button: delete $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'delete'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('delete')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) { // button: censor $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'censor'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('censorship')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); // button: activation/deactivation $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); if (!$node->isActivated()) { $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'askForPostActivation', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('activate_post')); } $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: mark read if ($ilUser->getId() != ANONYMOUS_USER_ID && !$node->isPostRead()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('is_read')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: mark unread if ($ilUser->getId() != ANONYMOUS_USER_ID && $node->isPostRead()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostUnread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('unread')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } } } // if ($this->objCurrentPost->getId() != $node->getId()) // download post attachments $tmp_file_obj = new ilFileDataForum($forumObj->getId(), $node->getId()); if (count($tmp_file_obj->getFilesOfPost())) { if ($node->getId() != $this->objCurrentPost->getId() || $_GET['action'] != 'showedit') { foreach ($tmp_file_obj->getFilesOfPost() as $file) { $tpl->setCurrentBlock('attachment_download_row'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'file', $file['md5']); $tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread')); $tpl->setVariable('TXT_FILENAME', $file['name']); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('attachments'); $tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $lng->txt('forums_attachments')); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable('DOWNLOAD_IMG', ilGlyphGUI::get(ilGlyphGUI::ATTACHMENT, $lng->txt('forums_download_attachment'))); $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock('posts_row'); // anker for every post $tpl->setVariable('POST_ANKER', $node->getId()); //permanent link for every post // $tpl->setVariable('PERMA_LINK', ILIAS_HTTP_PATH."/goto.php?target="."frm"."_".$this->object->getRefId()."_".$node->getThreadId()."_".$node->getId()."&client_id=".CLIENT_ID); $tpl->setVariable('TXT_PERMA_LINK', $lng->txt('perma_link')); $tpl->setVariable('PERMA_TARGET', '_top'); if ($this->objProperties->getMarkModeratorPosts() == 1) { if ($node->getIsAuthorModerator() === null && ($is_moderator = ilForum::_isModerator($_GET['ref_id'], $node->getPosAuthorId()))) { $rowCol = 'ilModeratorPosting'; } elseif ($node->getIsAuthorModerator()) { $rowCol = 'ilModeratorPosting'; } else { $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2'); } } else { $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2'); } if ($_GET['action'] != 'delete' && $_GET['action'] != 'censor' && !$this->displayConfirmPostActivation() || $this->objCurrentPost->getId() != $node->getId()) { $tpl->setVariable('ROWCOL', ' ' . $rowCol); } else { // highlight censored posts $rowCol = 'tblrowmarked'; } // post is censored if ($node->isCensored()) { // display censorship advice if ($_GET['action'] != 'censor') { $tpl->setVariable('TXT_CENSORSHIP_ADVICE', $this->lng->txt('post_censored_comment_by_moderator')); } // highlight censored posts $rowCol = 'tblrowmarked'; } // set row color $tpl->setVariable('ROWCOL', ' ' . $rowCol); // if post is not activated display message for the owner if (!$node->isActivated() && $node->isOwner($ilUser->getId())) { $tpl->setVariable('POST_NOT_ACTIVATED_YET', $this->lng->txt('frm_post_not_activated_yet')); } // Author $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'backurl', $backurl); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'user', $node->getDisplayUserId()); require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getDisplayUserId(), $node->getUserAlias(), $node->getImportName(), array('href' => $this->ctrl->getLinkTarget($this, 'showUser'))); $this->ctrl->clearParameters($this); if ($authorinfo->hasSuffix()) { $tpl->setVariable('AUTHOR', $authorinfo->getSuffix()); $tpl->setVariable('USR_NAME', $node->getUserAlias()); } else { $tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName()); if ($authorinfo->getAuthorName(true)) { $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true)); } } $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture()); if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $node->getPosAuthorId())) { if ($authorinfo->getAuthor()->getGender() == 'f') { $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_f')); } else { if ($authorinfo->getAuthor()->getGender() == 'm') { $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_m')); } } } // get create- and update-dates if ($node->getUpdateUserId() > 0) { $spanClass = ''; // last update from moderator? $posMod = $frm->getModeratorFromPost($node->getId()); if (is_array($posMod) && $posMod['top_mods'] > 0) { $MODS = $rbacreview->assignedUsers($posMod['top_mods']); if (is_array($MODS)) { if (in_array($node->getUpdateUserId(), $MODS)) { $spanClass = 'moderator_small'; } } } $node->setChangeDate($node->getChangeDate()); if ($spanClass == '') { $spanClass = 'small'; } $this->ctrl->setParameter($this, 'backurl', $backurl); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'user', $node->getUpdateUserId()); require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getUpdateUserId(), '', '', array('href' => $this->ctrl->getLinkTarget($this, 'showUser'))); $this->ctrl->clearParameters($this); $tpl->setVariable('POST_UPDATE_TXT', $lng->txt('edited_on') . ': ' . $frm->convertDate($node->getChangeDate()) . ' - ' . strtolower($lng->txt('by'))); $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName()); if ($authorinfo->getAuthorName(true)) { $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true)); } } // if ($node->getUpdateUserId() > 0)*/ // Author end // prepare post $node->setMessage($frm->prepareText($node->getMessage())); if ($ilUser->getId() == ANONYMOUS_USER_ID || $node->isPostRead()) { $tpl->setVariable('SUBJECT', $node->getSubject()); } else { $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']); $mark_post_target = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId()); $tpl->setVariable('SUBJECT', "<a href=\"" . $mark_post_target . "\"><b>" . $node->getSubject() . "</b></a>"); } $tpl->setVariable('POST_DATE', $frm->convertDate($node->getCreateDate())); if (!$node->isCensored() || $this->objCurrentPost->getId() == $node->getId() && $_GET['action'] == 'censor') { // post from moderator? $modAuthor = $frm->getModeratorFromPost($node->getId()); $spanClass = ""; if (is_array($modAuthor) && $modAuthor['top_mods'] > 0) { unset($MODS); $MODS = $rbacreview->assignedUsers($modAuthor['top_mods']); if (is_array($MODS)) { if (in_array($node->getDisplayUserId(), $MODS)) { $spanClass = 'moderator'; } } } // possible bugfix for mantis #8223 if ($node->getMessage() == strip_tags($node->getMessage())) { // We can be sure, that there are not html tags $node->setMessage(nl2br($node->getMessage())); } if ($spanClass != "") { $tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1) . "</span>"); } else { $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1)); } } else { $tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($node->getCensorshipComment()) . "</span>"); } $tpl->parseCurrentBlock(); } $z++; } } else { $tpl->setCurrentBlock('posts_no'); $tpl->setVariable('TXT_MSG_NO_POSTS_AVAILABLE', $lng->txt('forums_posts_not_available')); $tpl->parseCurrentBlock(); } $oThreadToolbar = clone $ilToolbar; $oThreadToolbar->addSeparator(); $oThreadToolbar->addButton($this->lng->txt('top_of_page'), '#frm_page_top'); $tpl->setVariable('THREAD_TOOLBAR', $oThreadToolbar->getHTML()); $tpl->setVariable('TPLPATH', $tpl->vars['TPLPATH']); // permanent link include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php'; $permalink = new ilPermanentLinkGUI('frm', $this->object->getRefId(), '_' . $this->objCurrentTopic->getId()); $this->tpl->setVariable('PRMLINK', $permalink->getHTML()); // Render tree if ($_SESSION['viewmode'] == 'answers' || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) { $tpl->setLeftNavContent($this->getForumExplorer()); } return true; }
/** * quick term list */ function quickList() { global $ilUser, $tpl; return; include_once "./Modules/Glossary/classes/class.ilTermQuickListTableGUI.php"; $tab = new ilTermQuickListTableGUI($this, "listTerms"); $tpl->setLeftContent($tab->getHTML()); $this->tpl->addBlockFile("CONTENT", "content", "tpl.glossary_short_list.html", "Modules/Glossary"); // $this->tpl->addBlockFile("EXPLORER_TOP", "exp_top", "tpl.explorer_top.html"); // $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false)); $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("CMD_REFR", "quickList"); $this->tpl->setVariable("TXT_REFR", $this->lng->txt("refresh")); $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_terms")); include_once "./Services/Table/classes/class.ilTableGUI.php"; // glossary term list template // load template for table $this->tpl->addBlockfile("SHORT_LIST", "list", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_short_tbl_row.html", true); $num = 0; $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); // create table $tbl = new ilTableGUI(); // title & header columns //$tbl->setTitle($this->lng->txt("cont_terms")); //$tbl->setHelp("tbl_help.php","icon_help.png",$this->lng->txt("help")); $tbl->setHeaderNames(array($this->lng->txt("cont_term"))); $cols = array("term"); $header_params = $this->ctrl->getParameterArrayByClass("ilobjglossarygui", "listTerms"); $header_params["cmd"] = "quickList"; $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("100%")); $tbl->disable("title"); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->disable("header"); $term_list = $this->object->getTermList(); $tbl->setMaxCount(count($term_list)); $this->tpl->setVariable("COLUMN_COUNT", 1); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); // sorting array $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]); // render table $tbl->render(); if (count($term_list) > 0) { $i = 1; foreach ($term_list as $key => $term) { $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $sep = ": "; for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; // edit $this->tpl->setCurrentBlock("definition"); $this->tpl->setVariable("SEP", $sep); $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]); $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT_DEF", $this->ctrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); $this->tpl->setVariable("TEXT_DEF", $this->lng->txt("glo_definition_abbr") . ($j + 1)); $this->tpl->parseCurrentBlock(); $sep = ", "; } $this->tpl->setCurrentBlock("tbl_content"); $css_row = ilUtil::switchColor(++$i, "tblrow1", "tblrow2"); // edit term link $this->tpl->setVariable("TEXT_TERM", $term["term"]); $this->ctrl->setParameter($this, "term_id", $term["id"]); $this->tpl->setVariable("LINK_EDIT_TERM", $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } } else { //$this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", $num); //$this->tpl->parseCurrentBlock(); } }
/** * show tracking data */ function showTrackingItems() { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if (!$privacy->enabledSahsProtocolData()) { $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } include_once "./Services/Table/classes/class.ilTableGUI.php"; // load template for table $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scorm_track_items.html", "Modules/ScormAicc"); $num = 1; $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=" . $this->ref_id . "{$obj_str}&cmd=gateway"); // create table $tbl = new ilTableGUI(); // title & header columns $tbl->setTitle($this->lng->txt("cont_tracking_items")); $tbl->setHeaderNames(array($this->lng->txt("title"))); $header_params = array("ref_id" => $this->ref_id, "cmd" => $_GET["cmd"], "cmdClass" => get_class($this)); $cols = array("title"); $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("100%")); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); //$this->tpl->setVariable("COLUMN_COUNTS",count($this->data["cols"])); //$this->showActions(true); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); #$tbl->disable("footer"); //$items = $this->object->getTrackingItems(); $items = $this->object->getTrackedItems(); //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]); $tbl->setMaxCount(count($items)); $items = array_slice($items, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($items) > 0) { foreach ($items as $item) { $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("TXT_ITEM_TITLE", $item->getTitle()); $this->ctrl->setParameter($this, "obj_id", $item->getId()); $this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTarget($this, "showTrackingItem")); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", $num); $this->tpl->parseCurrentBlock(); } }
function askDeleteObjective() { global $rbacsystem; // MINIMUM ACCESS LEVEL = 'write' if (!$rbacsystem->checkAccess("write", $this->course_obj->getRefId())) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE); } if (!count($_POST['objective'])) { ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected')); $this->listObjectives(); return true; } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objectives.html", 'Modules/Course'); ilUtil::sendQuestion($this->lng->txt('crs_delete_objectve_sure')); $tpl =& new ilTemplate("tpl.table.html", true, true); $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_objectives_delete_row.html", 'Modules/Course'); $counter = 0; foreach ($_POST['objective'] as $objective_id) { $objective_obj = $this->__initObjectivesObject($objective_id); $tpl->setCurrentBlock("tbl_content"); $tpl->setVariable("ROWCOL", ilUtil::switchColor(++$counter, "tblrow2", "tblrow1")); $tpl->setVariable("TITLE", $objective_obj->getTitle()); $tpl->setVariable("DESCRIPTION", $objective_obj->getDescription()); $tpl->parseCurrentBlock(); } $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); // Show action row $tpl->setCurrentBlock("tbl_action_btn"); $tpl->setVariable("BTN_NAME", 'deleteObjectives'); $tpl->setVariable("BTN_VALUE", $this->lng->txt('delete')); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("tbl_action_btn"); $tpl->setVariable("BTN_NAME", 'listObjectives'); $tpl->setVariable("BTN_VALUE", $this->lng->txt('cancel')); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("tbl_action_row"); $tpl->setVariable("COLUMN_COUNTS", 1); $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png')); $tpl->parseCurrentBlock(); // create table $tbl = new ilTableGUI(); $tbl->setStyle('table', 'std'); // title & header columns $tbl->setTitle($this->lng->txt("crs_objectives"), "icon_lobj.png", $this->lng->txt("crs_objectives")); $tbl->setHeaderNames(array($this->lng->txt("title"))); $tbl->setHeaderVars(array("title"), array("ref_id" => $this->course_obj->getRefId(), "cmdClass" => "ilcourseobjectivesgui", "cmdNode" => $_GET["cmdNode"])); $tbl->setColumnWidth(array("50%")); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount(count($_POST['objective'])); // footer $tbl->disable("footer"); $tbl->disable('sort'); // render table $tbl->setTemplate($tpl); $tbl->render(); $this->tpl->setVariable("OBJECTIVES_TABLE", $tpl->get()); // Save marked objectives $_SESSION['crs_delete_objectives'] = $_POST['objective']; return true; }
/** * administrate files of media object */ function editFilesObject() { // standard item $std_item =& $this->object->getMediaItem("Standard"); if ($this->object->hasFullscreenItem()) { $full_item =& $this->object->getMediaItem("Fullscreen"); } // create table require_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(); // determine directory $cur_subdir = $_GET["cdir"]; if ($_GET["newdir"] == "..") { $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/")); } else { if (!empty($_GET["newdir"])) { if (!empty($cur_subdir)) { $cur_subdir = $cur_subdir . "/" . $_GET["newdir"]; } else { $cur_subdir = $_GET["newdir"]; } } } $cur_subdir = str_replace(".", "", $cur_subdir); $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId(); $cur_dir = !empty($cur_subdir) ? $mob_dir . "/" . $cur_subdir : $mob_dir; // load files templates $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.mob_files.html", "Services/MediaObjects"); $this->ctrl->setParameter($this, "cdir", urlencode($cur_subdir)); $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this)); //echo "--".$this->getTargetScript(). //"&hier_id=".$_GET["hier_id"]."&cdir=".$cur_subdir."&cmd=post"."--<br>"; $this->tpl->setVariable("TXT_NEW_DIRECTORY", $this->lng->txt("cont_new_dir")); $this->tpl->setVariable("TXT_NEW_FILE", $this->lng->txt("cont_new_file")); $this->tpl->setVariable("CMD_NEW_DIR", "createDirectory"); $this->tpl->setVariable("CMD_NEW_FILE", "uploadFile"); $this->tpl->setVariable("BTN_NEW_DIR", $this->lng->txt("create")); $this->tpl->setVariable("BTN_NEW_FILE", $this->lng->txt("upload")); // $this->tpl->addBlockfile("FILE_TABLE", "files", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mob_file_row.html", "Services/MediaObjects"); $num = 0; $obj_str = $this->call_by_reference ? "" : "&obj_id=" . $this->obj_id; $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tbl->setTitle($this->lng->txt("cont_files") . " " . $cur_subdir); //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help")); $tbl->setHeaderNames(array("", "", $this->lng->txt("cont_dir_file"), $this->lng->txt("cont_size"), $this->lng->txt("cont_purpose"))); $cols = array("", "", "dir_file", "size", "purpose"); $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"], "cmd" => "editFiles", "hier_id" => $_GET["hier_id"], "item_id" => $_GET["item_id"]); $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("1%", "1%", "33%", "33%", "32%")); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // ??? //$tbl->setMaxCount(30); // ??? $this->tpl->setVariable("COLUMN_COUNTS", 5); // delete button $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg")); $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "deleteFile"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "assignStandard"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_std")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "assignFullscreen"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_full")); $this->tpl->parseCurrentBlock(); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); //$tbl->disable("footer"); $entries = ilUtil::getDir($cur_dir); //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]); $tbl->setMaxCount(count($entries)); $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($entries) > 0) { $i = 0; foreach ($entries as $entry) { if ($entry["entry"] == "." || $entry["entry"] == ".." && empty($cur_subdir)) { continue; } //$this->tpl->setVariable("ICON", $obj["title"]); if ($entry["type"] == "dir") { $this->tpl->setCurrentBlock("FileLink"); $this->ctrl->setParameter($this, "cdir", $cur_subdir); $this->ctrl->setParameter($this, "newdir", rawurlencode($entry["entry"])); $this->tpl->setVariable("LINK_FILENAME", $this->ctrl->getLinkTarget($this, "editFiles")); $this->tpl->setVariable("TXT_FILENAME", $entry["entry"]); $this->tpl->parseCurrentBlock(); $this->tpl->setVariable("ICON", "<img src=\"" . ilUtil::getImagePath("icon_cat.svg") . "\">"); } else { $this->tpl->setCurrentBlock("File"); $this->tpl->setVariable("TXT_FILENAME2", $entry["entry"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_content"); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable("TXT_SIZE", $entry["size"]); $this->tpl->setVariable("CHECKBOX_ID", $entry["entry"]); $compare = !empty($cur_subdir) ? $cur_subdir . "/" . $entry["entry"] : $entry["entry"]; $purpose = array(); if ($std_item->getLocation() == $compare) { $purpose[] = $this->lng->txt("cont_std_view"); } if ($this->object->hasFullscreenItem()) { if ($full_item->getLocation() == $compare) { $purpose[] = $this->lng->txt("cont_fullscreen"); } } $this->tpl->setVariable("TXT_PURPOSE", implode($purpose, ", ")); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", 4); $this->tpl->parseCurrentBlock(); } $this->tpl->parseCurrentBlock(); }
/** * fill row * * @access protected * @param array row data * @return */ protected function fillRow($a_set) { static $row_counter = 1; $this->tpl->setVariable('VAL_TITLE', $a_set['title']); if (strlen($a_set['description'])) { $this->tpl->setVariable('VAL_DESC', $a_set['description']); } foreach ($a_set['self_tests'] as $tst) { foreach ($tst['questions'] as $qst) { $this->tpl->setCurrentBlock('self_qst'); $this->tpl->setVariable('SELF_QST_TITLE', $qst['title']); if (strlen($qst['description'])) { $this->tpl->setVariable('SELF_QST_DESCRIPTION', $qst['description']); } $this->tpl->setVariable('SELF_QST_POINTS', $qst['points']); $this->tpl->setVariable('SELF_QST_TXT_POINTS', $this->lng->txt('crs_objective_points')); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('self_tst'); $this->tpl->setVariable('SELF_TST_TITLE', $tst['title']); if (strlen($tst['description'])) { $this->tpl->setVariable('SELF_TST_DESC', $tst['description']); } $this->tpl->setVariable('SELF_TYPE_IMG', ilUtil::getImagePath('icon_tst.svg')); $this->tpl->setVariable('SELF_TYPE_ALT', $this->lng->txt('obj_tst')); $this->tpl->parseCurrentBlock(); } if (count($a_set['self_tests'])) { $this->tpl->setVariable('SELF_TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points')); $this->tpl->setVariable('SELF_TXT_POINTS', $this->lng->txt('crs_objective_points')); $this->tpl->setVariable('SELF_TXT_REQ_POINTS', $this->lng->txt('crs_obj_required_points')); $this->tpl->setVariable('SELF_POINTS', $a_set['self_max_points']); $this->tpl->setVariable('SELF_ID', $a_set['id']); $this->tpl->setVariable('SELF_LIMIT', $a_set['self_limit']); } foreach ($a_set['final_tests'] as $tst) { foreach ($tst['questions'] as $qst) { $this->tpl->setCurrentBlock('final_qst'); $this->tpl->setVariable('FINAL_QST_TITLE', $qst['title']); if (strlen($qst['description'])) { $this->tpl->setVariable('FINAL_QST_DESCRIPTION', $qst['description']); } $this->tpl->setVariable('FINAL_QST_POINTS', $qst['points']); $this->tpl->setVariable('FINAL_QST_TXT_POINTS', $this->lng->txt('crs_objective_points')); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('final_tst'); $this->tpl->setVariable('FINAL_TST_TITLE', $tst['title']); if (strlen($tst['description'])) { $this->tpl->setVariable('FINAL_TST_DESC', $tst['description']); } $this->tpl->setVariable('FINAL_TYPE_IMG', ilUtil::getImagePath('icon_tst.svg')); $this->tpl->setVariable('FINAL_TYPE_ALT', $this->lng->txt('obj_tst')); $this->tpl->parseCurrentBlock(); } if (count($a_set['final_tests'])) { $this->tpl->setVariable('FINAL_TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points')); $this->tpl->setVariable('FINAL_TXT_POINTS', $this->lng->txt('crs_objective_points')); $this->tpl->setVariable('FINAL_TXT_REQ_POINTS', $this->lng->txt('crs_obj_required_points')); $this->tpl->setVariable('FINAL_POINTS', $a_set['final_max_points']); $this->tpl->setVariable('FINAL_ID', $a_set['id']); $this->tpl->setVariable('FINAL_LIMIT', $a_set['final_limit']); } $this->tpl->setVariable('TST_CSS', ilUtil::switchColor($row_counter++, 'tblrow1', 'tblrow2')); }
/** * Export to HTML. * */ function exportHTML() { global $lng, $tpl, $ilUser, $ilAccess, $ilias; if (!$ilAccess->checkAccess('read,visible', '', $_GET['ref_id'])) { $ilias->raiseError($lng->txt('permission_denied'), $ilias->error_obj->MESSAGE); } $tplEx = new ilTemplate('tpl.forums_export_html.html', true, true, 'Modules/Forum'); // threads //for ($j = 0; $j < count($_POST['forum_id']); $j++) for ($j = 0; $j < count($_POST['thread_ids']); $j++) { //$objCurrentTopic = new ilForumTopic(addslashes($_POST['forum_id'][$j]), $ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id'])); $objCurrentTopic = new ilForumTopic(addslashes($_POST['thread_ids'][$j]), $ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id'])); // get forum- and thread-data $this->frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($objCurrentTopic->getForumId())); if (is_array($frmData = $this->frm->getOneTopic())) { $objFirstPostNode = $objCurrentTopic->getFirstPostNode(); $objCurrentTopic->setOrderField('frm_posts_tree.rgt'); $postTree = $objCurrentTopic->getPostTree($objFirstPostNode); $posNum = count($postTree); $z = 0; foreach ($postTree as $post) { $tplEx->setCurrentBlock('posts_row'); $rowCol = ilUtil::switchColor($z++, 'tblrow2', 'tblrow1'); $tplEx->setVariable('ROWCOL', $rowCol); $authorinfo = new ilForumAuthorInformation($post->getUserId(), $post->getUserAlias(), $post->getImportName()); $tplEx->setVariable('AUTHOR', $authorinfo->getAuthorName()); if ($post->getUserId()) { // get create- and update-dates if ($post->getUpdateUserId()) { $authorinfo = new ilForumAuthorInformation($post->getUpdateUserId(), '', ''); $tplEx->setVariable('POST_UPDATE', "<br />[" . $lng->txt('edited_on') . ": " . $this->frm->convertDate($post->getChangeDate()) . " - " . strtolower($lng->txt('from')) . " " . $authorinfo->getAuthorName() . "]"); } if ($authorinfo->getAuthor()->getPref('public_profile') != 'n') { $tplEx->setVariable('TXT_REGISTERED', $lng->txt('registered_since')); $tplEx->setVariable('REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate())); } if ($ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id'])) { $numPosts = $this->frm->countUserArticles($post->getUserId()); } else { $numPosts = $this->frm->countActiveUserArticles($post->getUserId()); } $tplEx->setVariable('TXT_NUM_POSTS', $lng->txt('forums_posts')); $tplEx->setVariable('NUM_POSTS', $numPosts); } $tplEx->setVariable('SUBJECT', $post->getSubject()); $tplEx->setVariable('TXT_CREATE_DATE', $lng->txt('forums_thread_create_date')); $tplEx->setVariable('POST_DATE', $this->frm->convertDate($post->getCreateDate())); $tplEx->setVariable('SPACER', "<hr noshade width=\"100%\" size=\"1\" align=\"center\" />"); if ($post->isCensored()) { $tplEx->setVariable('POST', nl2br(stripslashes($post->getCensorshipComment()))); } else { /** @todo mjansen: possible bugfix for mantis #8223 */ if ($post->getMessage() == strip_tags($post->getMessage())) { // We can be sure, that there are not html tags $post->setMessage(nl2br($post->getMessage())); } $tplEx->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($this->frm->prepareText($post->getMessage(), 0, '', 'export'), 1)); } $tplEx->parseCurrentBlock('posts_row'); unset($author); } // foreach ($postTree as $post) $tplEx->setCurrentBlock('posttable'); $tplEx->setVariable('TXT_AUTHOR', $lng->txt('author')); $tplEx->setVariable('TXT_POST', $lng->txt('forums_thread') . ': ' . $objCurrentTopic->getSubject()); $tplEx->parseCurrentBlock('posttable'); // Thread Headline $tplEx->setCurrentBlock('thread_headline'); $tplEx->setVariable('T_TITLE', $objCurrentTopic->getSubject()); if ($ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id'])) { $tplEx->setVariable('T_NUM_POSTS', $objCurrentTopic->countPosts()); } else { $tplEx->setVariable('T_NUM_POSTS', $objCurrentTopic->countActivePosts()); } $tplEx->setVariable('T_NUM_VISITS', $objCurrentTopic->getVisits()); $tplEx->setVariable('T_FORUM', $frmData['top_name']); $authorinfo = new ilForumAuthorInformation($objCurrentTopic->getUserId(), $objCurrentTopic->getUserAlias(), $objCurrentTopic->getImportName()); $tplEx->setVariable('T_AUTHOR', $authorinfo->getAuthorName()); $tplEx->setVariable('T_TXT_FORUM', $lng->txt('forum') . ': '); $tplEx->setVariable('T_TXT_TOPIC', $lng->txt('forums_thread') . ': '); $tplEx->setVariable('T_TXT_AUTHOR', $lng->txt('forums_thread_create_from') . ': '); $tplEx->setVariable('T_TXT_NUM_POSTS', $lng->txt('forums_articles') . ': '); $tplEx->setVariable('T_TXT_NUM_VISITS', $lng->txt('visits') . ': '); $tplEx->parseCurrentBlock('thread_headline'); $tplEx->setCurrentBlock('thread_block'); $tplEx->parseCurrentBlock('thread_block'); $tplEx->setCurrentBlock('forum_block'); $tplEx->parseCurrentBlock('forum_block'); } // if (is_array($frmData = $this->frm->getOneTopic())) } // for ($j = 0; $j < count($_POST["forum_id"]); $j++) ilUtil::deliverData($tplEx->get(), 'forum_html_export_' . $_GET['ref_id'] . '.html'); exit; }
/** * display permissions * * @access public */ function permObject() { global $rbacadmin, $rbacreview, $rbacsystem, $objDefinition; if (!$rbacsystem->checkAccess('write', $this->rolf_ref_id)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"), $this->ilias->error_obj->WARNING); exit; } $to_filter = $objDefinition->getSubobjectsToFilter(); $tpl_filter = array(); $internal_tpl = false; if ($internal_tpl = $this->object->isInternalTemplate()) { $tpl_filter = $this->object->getFilterOfInternalTemplate(); } $operation_info = $rbacreview->getOperationAssignment(); foreach ($operation_info as $info) { if ($objDefinition->getDevMode($info['type'])) { continue; } // FILTER SUBOJECTS OF adm OBJECT if (in_array($info['type'], $to_filter)) { continue; } if ($internal_tpl and $tpl_filter and !in_array($info['type'], $tpl_filter)) { continue; } $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'], "type" => $info['type']); $txt = $objDefinition->isPlugin($info['type']) ? ilPlugin::lookupTxt("rep_robj", $info['type'], $info['type'] . "_" . $info['operation']) : $this->lng->txt($info['type'] . "_" . $info['operation']); if (substr($info['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($info['operation'], 7))) { $txt = ilPlugin::lookupTxt("rep_robj", substr($info['operation'], 7), $info['type'] . "_" . $info['operation']); } elseif (substr($info['operation'], 0, 6) == 'create') { $txt = $this->lng->txt('rbac_' . $info['operation']); } $rbac_operations[$info['typ_id']][$info['ops_id']] = array("ops_id" => $info['ops_id'], "title" => $info['operation'], "name" => $txt); } foreach ($rbac_objects as $key => $obj_data) { if ($objDefinition->isPlugin($obj_data["type"])) { $rbac_objects[$key]["name"] = ilPlugin::lookupTxt("rep_robj", $obj_data["type"], "obj_" . $obj_data["type"]); } else { $rbac_objects[$key]["name"] = $this->lng->txt("obj_" . $obj_data["type"]); } $rbac_objects[$key]["ops"] = $rbac_operations[$key]; } sort($rbac_objects); foreach ($rbac_objects as $key => $obj_data) { sort($rbac_objects[$key]["ops"]); } // sort by (translated) name of object type $rbac_objects = ilUtil::sortArray($rbac_objects, "name", "asc"); // BEGIN CHECK_PERM foreach ($rbac_objects as $key => $obj_data) { $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data["type"], $this->rolf_ref_id); $arr_checked = array_intersect($arr_selected, array_keys($rbac_operations[$obj_data["obj_id"]])); foreach ($rbac_operations[$obj_data["obj_id"]] as $operation) { $checked = in_array($operation["ops_id"], $arr_checked); $disabled = false; // Es wird eine 2-dim Post Variable �bergeben: perm[rol_id][ops_id] $box = ilUtil::formCheckBox($checked, "template_perm[" . $obj_data["type"] . "][]", $operation["ops_id"], $disabled); $output["perm"][$obj_data["obj_id"]][$operation["ops_id"]] = $box; } } // END CHECK_PERM $output["col_anz"] = count($rbac_objects); $output["txt_save"] = $this->lng->txt("save"); $output["check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id, $this->object->getId()), "protected", 1); $output["text_protected"] = $this->lng->txt("role_protect_permissions"); /************************************/ /* adopt permissions form */ /************************************/ $output["message_middle"] = $this->lng->txt("adopt_perm_from_template"); // send message for system role if ($this->object->getId() == SYSTEM_ROLE_ID) { $output["adopt"] = array(); ilUtil::sendFailure($this->lng->txt("msg_sysrole_not_editable")); } else { // BEGIN ADOPT_PERMISSIONS $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id, true); // sort output for correct color changing ksort($parent_role_ids); foreach ($parent_role_ids as $key => $par) { if ($par["obj_id"] != SYSTEM_ROLE_ID) { $radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]); $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2"); $output["adopt"][$key]["check_adopt"] = $radio; $output["adopt"][$key]["type"] = $par["type"] == 'role' ? 'Role' : 'Template'; $output["adopt"][$key]["role_name"] = $par["title"]; } } $output["formaction_adopt"] = $this->ctrl->getFormAction($this); // END ADOPT_PERMISSIONS } $output["formaction"] = $this->ctrl->getFormAction($this); $this->data = $output; /************************************/ /* generate output */ /************************************/ $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html"); $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator"); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_perm_role.html", "Services/AccessControl"); foreach ($rbac_objects as $obj_data) { // BEGIN object_operations $this->tpl->setCurrentBlock("object_operations"); foreach ($obj_data["ops"] as $operation) { $ops_ids[] = $operation["ops_id"]; $css_row = ilUtil::switchColor($key, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable("PERMISSION", $operation["name"]); $this->tpl->setVariable("CHECK_PERMISSION", $this->data["perm"][$obj_data["obj_id"]][$operation["ops_id"]]); $this->tpl->parseCurrentBlock(); } // END object_operations // BEGIN object_type $this->tpl->setCurrentBlock("object_type"); $this->tpl->setVariable("TXT_OBJ_TYPE", $obj_data["name"]); // TODO: move this if in a function and query all objects that may be disabled or inactive if ($this->objDefinition->getDevMode($obj_data["type"])) { $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_implemented_yet") . ")"); } else { if ($obj_data["type"] == "icrs" and !$this->ilias->getSetting("ilinc_active")) { $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_enabled_or_configured") . ")"); } } // js checkbox toggles $this->tpl->setVariable("JS_VARNAME", "template_perm_" . $obj_data["type"]); $this->tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($ops_ids)); $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all")); $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all")); $this->tpl->parseCurrentBlock(); // END object_type } /* // BEGIN ADOPT PERMISSIONS foreach ($this->data["adopt"] as $key => $value) { $this->tpl->setCurrentBlock("ADOPT_PERM_ROW"); $this->tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]); $this->tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]); $this->tpl->setVariable("TYPE",$value["type"]); $this->tpl->setVariable("ROLE_NAME",$value["role_name"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("ADOPT_PERM_FORM"); $this->tpl->setVariable("MESSAGE_MIDDLE",$this->data["message_middle"]); $this->tpl->setVariable("FORMACTION_ADOPT",$this->data["formaction_adopt"]); $this->tpl->setVariable("ADOPT",$this->lng->txt('copy')); $this->tpl->parseCurrentBlock(); // END ADOPT PERMISSIONS */ $this->tpl->setCurrentBlock("tblfooter_protected"); $this->tpl->setVariable("COL_ANZ", 3); $this->tpl->setVariable("CHECK_BOTTOM", $this->data["check_protected"]); $this->tpl->setVariable("MESSAGE_TABLE", $this->data["text_protected"]); $this->tpl->parseCurrentBlock(); $this->tpl->setVariable("COL_ANZ_PLUS", 4); $this->tpl->setVariable("TXT_SAVE", $this->data["txt_save"]); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath("icon_" . $this->object->getType() . ".png")); $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt($this->object->getType())); $this->tpl->setVariable("TBL_HELP_IMG", ilUtil::getImagePath("icon_help.png")); $this->tpl->setVariable("TBL_HELP_LINK", "tbl_help.php"); $this->tpl->setVariable("TBL_HELP_IMG_ALT", $this->lng->txt("help")); // compute additional information in title if (substr($this->object->getTitle(), 0, 3) == "il_") { $desc = $this->lng->txt("predefined_template"); //$this->lng->txt("obj_".$parent_node['type'])." (".$parent_node['obj_id'].") : ".$parent_node['title']; } $description = "<br/> <span class=\"small\">" . $desc . "</span>"; // translation for autogenerated roles if (substr($this->object->getTitle(), 0, 3) == "il_") { include_once './Services/AccessControl/classes/class.ilObjRole.php'; $title = ilObjRole::_getTranslation($this->object->getTitle()) . " (" . $this->object->getTitle() . ")"; } else { $title = $this->object->getTitle(); } $this->tpl->setVariable("TBL_TITLE", $title . $description); $this->tpl->setVariable("TXT_PERMISSION", $this->data["txt_permission"]); $this->tpl->setVariable("FORMACTION", $this->data["formaction"]); $this->tpl->parseCurrentBlock(); }
/** * display object list * * @access public */ function displayList() { include_once "./Services/Table/classes/class.ilTableGUI.php"; return; // load template for table $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html"); $num = 0; $obj_str = $this->call_by_reference ? "" : "&obj_id=" . $this->obj_id; $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); // create table $tbl = new ilTableGUI(); // title & header columns $tbl->setTitle($this->object->getTitle()); foreach ($this->data["cols"] as $val) { $header_names[] = $this->lng->txt($val); } $tbl->setHeaderNames($header_names); //$header_params = array("ref_id" => $this->ref_id); $header_params = $this->ctrl->getParameterArray($this, "view"); $tbl->setHeaderVars($this->data["cols"], $header_params); $tbl->setColumnWidth(array("15", "75%", "25%")); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); //$tbl->disable("footer"); // render table $tbl->render(); if (is_array($this->data["data"][0])) { //table cell for ($i = 0; $i < count($this->data["data"]); $i++) { $data = $this->data["data"][$i]; $ctrl = $this->data["ctrl"][$i]; // color changing $css_row = ilUtil::switchColor($i + 1, "tblrow1", "tblrow2"); $this->tpl->setCurrentBlock("table_cell"); $this->tpl->setVariable("CELLSTYLE", "tblrow1"); $this->tpl->parseCurrentBlock(); foreach ($data as $key => $val) { //build link /* $n = 0; foreach ($ctrl as $key2 => $val2) { $link .= $key2."=".$val2; if ($n < count($ctrl)-1) { $link .= "&"; $n++; } } if ($key == "title") { $name_field = explode("#separator#",$val); } if ($key == "title" || $key == "type") { $this->tpl->setCurrentBlock("begin_link"); $this->tpl->setVariable("LINK_TARGET", $link); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("end_link"); } $this->tpl->setCurrentBlock("text"); if ($key == "type") { $val = ilUtil::getImageTagByType($val,$this->tpl->tplPath); } if ($key == "title") { $this->tpl->setVariable("TEXT_CONTENT", $name_field[0]); $this->tpl->setCurrentBlock("subtitle"); $this->tpl->setVariable("DESC", $name_field[1]); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setVariable("TEXT_CONTENT", $val); } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("table_cell"); $this->tpl->parseCurrentBlock(); */ } //foreach $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } //for } else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", $num); $this->tpl->parseCurrentBlock(); } }
function askDeleteDesktopItemObject() { global $rbacsystem; #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id)) if (!$this->checkAccess('edit_permission')) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } if (!$rbacsystem->checkAccess('push_desktop_items', USER_FOLDER_ID)) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } if (!count($_POST['del_desk_item'])) { ilUtil::sendFailure($this->lng->txt('role_select_one_item')); $this->listDesktopItemsObject(); return true; } ilUtil::sendQuestion($this->lng->txt('role_sure_delete_desk_items')); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.role_ask_delete_desktop_item.html", "Services/AccessControl"); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath('icon_role.png')); $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt('obj_role')); $this->tpl->setVariable("TBL_TITLE", $this->lng->txt('role_assigned_desk_items') . ' (' . $this->object->getTitle() . ')'); $this->tpl->setVariable("HEADER_DESC", $this->lng->txt('description')); $this->tpl->setVariable("BTN_DELETE", $this->lng->txt('delete')); $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt('cancel')); include_once 'Services/AccessControl/classes/class.ilRoleDesktopItem.php'; $role_desk_item_obj =& new ilRoleDesktopItem($this->object->getId()); $counter = 0; foreach ($_POST['del_desk_item'] as $role_item_id) { $item_data = $role_desk_item_obj->getItem($role_item_id); $tmp_obj =& ilObjectFactory::getInstanceByRefId($item_data['item_id']); if (strlen($desc = $tmp_obj->getDescription())) { $this->tpl->setCurrentBlock("description"); $this->tpl->setVariable("DESCRIPTION_DESK", $desc); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("desk_row"); $this->tpl->setVariable("DESK_TITLE", $tmp_obj->getTitle()); $this->tpl->setVariable("ROW_CLASS", ilUtil::switchColor(++$counter, 'tblrow1', 'tblrow2')); $this->tpl->parseCurrentBlock(); } $_SESSION['role_del_desk_items'] = $_POST['del_desk_item']; return true; }
/** * display edit form * * @access public */ function editObject() { global $rbacsystem, $rbacreview; if (!$rbacsystem->checkAccess("edit_permission", $_GET["ref_id"])) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } //prepare objectlist $this->data = array(); $this->data["data"] = array(); $this->data["ctrl"] = array(); $this->data["cols"] = array("type", "operation", "description", "status"); $ops_valid = $rbacreview->getOperationsOnType($this->obj_id); if ($ops_arr = ilRbacReview::_getOperationList('', $a_order, $a_direction)) { $options = array("e" => "enabled", "d" => "disabled"); foreach ($ops_arr as $key => $ops) { // BEGIN ROW if (in_array($ops["ops_id"], $ops_valid)) { $ops_status = 'e'; } else { $ops_status = 'd'; } $obj = $ops["ops_id"]; $ops_options = ilUtil::formSelect($ops_status, "id[{$obj}]", $options); //visible data part $this->data["data"][] = array("type" => "perm", "operation" => $ops["operation"], "description" => $ops["desc"], "status" => $ops_status, "status_html" => $ops_options, "obj_id" => $val["ops_id"]); } } //if typedata $this->maxcount = count($this->data["data"]); // sorting array $this->data["data"] = ilUtil::sortArray($this->data["data"], $_GET["sort_by"], $_GET["sort_order"]); // now compute control information foreach ($this->data["data"] as $key => $val) { $this->data["ctrl"][$key] = array("obj_id" => $val["obj_id"], "type" => $val["type"]); unset($this->data["data"][$key]["obj_id"]); $this->data["data"][$key]["status"] = $this->data["data"][$key]["status_html"]; unset($this->data["data"][$key]["status_html"]); } // build table include_once "./Services/Table/classes/class.ilTableGUI.php"; // load template for table $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html"); $num = 0; $obj_str = $this->call_by_reference ? "" : "&obj_id=" . $this->obj_id; $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=" . $this->ref_id . "{$obj_str}&cmd=save"); // create table $tbl = new ilTableGUI(); // title & header columns $tbl->setTitle($this->lng->txt("edit_operations") . " " . strtolower($this->lng->txt("of")) . " '" . $this->object->getTitle() . "'", "icon_" . $this->object->getType() . "_b.png", $this->lng->txt("obj_" . $this->object->getType())); $tbl->setHelp("tbl_help.php", "icon_help.png", $this->lng->txt("help")); foreach ($this->data["cols"] as $val) { $header_names[] = $this->lng->txt($val); } $tbl->setHeaderNames($header_names); $header_params = array("ref_id" => $this->ref_id, "obj_id" => $this->id, "cmd" => "edit"); $tbl->setHeaderVars($this->data["cols"], $header_params); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit(0); $tbl->setOffset(0); $tbl->setMaxCount($this->maxcount); // SHOW VALID ACTIONS $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png")); $this->tpl->setVariable("COLUMN_COUNTS", count($this->data["cols"])); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); //$tbl->disable("footer"); // render table $tbl->render(); if (is_array($this->data["data"][0])) { //table cell for ($i = 0; $i < count($this->data["data"]); $i++) { $data = $this->data["data"][$i]; $ctrl = $this->data["ctrl"][$i]; // color changing $css_row = ilUtil::switchColor($i + 1, "tblrow1", "tblrow2"); $this->tpl->setCurrentBlock("table_cell"); $this->tpl->setVariable("CELLSTYLE", "tblrow1"); $this->tpl->parseCurrentBlock(); foreach ($data as $key => $val) { $this->tpl->setCurrentBlock("text"); if ($key == "type") { $val = ilUtil::getImageTagByType($val, $this->tpl->tplPath); } $this->tpl->setVariable("TEXT_CONTENT", $val); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("table_cell"); $this->tpl->parseCurrentBlock(); } //foreach $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("save")); $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } //for } //if is_array }
/** * Confirm deletion of export files * * @access public * @param * */ public function confirmDeleteExportFile() { if (!count($_POST['files'])) { ilUtil::sendFailure($this->lng->txt('ps_select_one')); $this->show(); return false; } $_SESSION['il_del_member_export'] = $_POST['files']; ilUtil::sendQuestion($this->lng->txt("info_delete_sure")); $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.member_export_confirm_delete.html', 'Modules/Course'); $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this)); $this->tpl->setVariable('TEXT', $this->lng->txt('ps_delete_export_files')); $counter = 0; foreach ($this->fss_export->getMemberExportFiles() as $file) { if (!in_array($file['timest'], $_POST['files'])) { continue; } $this->tpl->setCurrentBlock('table_row'); $this->tpl->setVariable('CSS_ROW', ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2')); $this->tpl->setVariable('TEXT_TYPE', strtoupper($file['type'])); $this->tpl->setVariable('DATE', ilDatePresentation::formatDate(new ilDateTime($file['timest'], IL_CAL_UNIX))); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('operation_btn'); $this->tpl->setVariable('BTN_NAME', 'deleteExportFile'); $this->tpl->setVariable('BTN_VALUE', $this->lng->txt('delete')); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('operation_btn'); $this->tpl->setVariable('BTN_NAME', 'show'); $this->tpl->setVariable('BTN_VALUE', $this->lng->txt('cancel')); $this->tpl->parseCurrentBlock(); }
/** * The disk quota report list shows user accounts, their disk quota and their * disk usage, as well as the last time a reminder was sent. */ public function viewDiskQuotaReport() { global $rbacsystem, $ilErr, $ilSetting, $lng; if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) { $ilErr->raiseError($lng->txt("no_permission"), $ilErr->WARNING); } $this->tabs_gui->setTabActive('disk_quota'); $this->addDiskQuotaSubtabs('disk_quota_report'); // nothing to do if disk quota is not active require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; if (!ilDiskQuotaActivationChecker::_isActive()) { return; } // get the form $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.disk_quota_report.html', "Services/WebDAV"); // get the date of the last update require_once "./Services/WebDAV/classes/class.ilDiskQuotaChecker.php"; $last_update = ilDiskQuotaChecker::_lookupDiskUsageReportLastUpdate(); if ($last_update == null) { // nothing to do if disk usage report has not been run $this->tpl->setVariable('LAST_UPDATE_TEXT', $lng->txt('disk_quota_report_not_run_yet')); return; } else { $this->tpl->setVariable('LAST_UPDATE_TEXT', $lng->txt('last_update') . ': ' . ilFormat::formatDate($last_update, 'datetime', true)); } // Filter $_SESSION['quota_usage_filter'] = isset($_POST['usage_filter']) ? $_POST['usage_filter'] : $_SESSION['quota_usage_filter']; if ($_SESSION['quota_usage_filter'] == 0) { $_SESSION['quota_usage_filter'] = 4; } $_SESSION['quota_access_filter'] = isset($_POST['access_filter']) ? $_POST['access_filter'] : $_SESSION['quota_access_filter']; if ($_SESSION['quota_access_filter'] == 0) { $_SESSION['quota_access_filter'] = 1; } $usage_action[1] = $lng->txt('all_users'); $usage_action[2] = $lng->txt('filter_users_without_disk_usage'); $usage_action[3] = $lng->txt('filter_users_with_disk_usage'); $usage_action[4] = $lng->txt('filter_users_with_exceeded_disk_quota'); $access_action[1] = $lng->txt('all_users'); $access_action[2] = $lng->txt('filter_users_with_access'); $access_action[3] = $lng->txt('filter_users_without_access'); $select_usage_filter = ilUtil::formSelect($_SESSION['quota_usage_filter'], "usage_filter", $usage_action, false, true); $select_access_filter = ilUtil::formSelect($_SESSION['quota_access_filter'], "access_filter", $access_action, false, true); $this->tpl->setCurrentBlock("filter"); $this->tpl->setVariable("FILTER_TXT_FILTER", $lng->txt('filter')); $this->tpl->setVariable("SELECT_USAGE_FILTER", $select_usage_filter); $this->tpl->setVariable("SELECT_ACCESS_FILTER", $select_access_filter); $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getLinkTarget($this, 'viewDiskQuotaReport')); $this->tpl->setVariable("FILTER_NAME", 'view'); $this->tpl->setVariable("FILTER_VALUE", $lng->txt('apply_filter')); $this->tpl->parseCurrentBlock(); // load templates for table $a_tpl = new ilTemplate('tpl.table.html', true, true); $a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html"); // create table require_once './Services/Table/classes/class.ilTableGUI.php'; $tbl = new ilTableGUI(0, false); // title & header columns $header_vars = array('login', 'firstname', 'lastname', 'email', 'access_until', 'last_login', 'disk_quota', 'disk_usage', 'last_reminder'); $tbl->setHeaderNames(array($lng->txt('login'), $lng->txt('firstname'), $lng->txt('lastname'), $lng->txt('email'), $lng->txt('access_until'), $lng->txt('last_login'), $lng->txt('disk_quota'), $lng->txt('disk_usage'), $lng->txt('last_reminder'))); $tbl->setHeaderVars($header_vars, $this->ctrl->getParameterArray($this, 'viewDiskQuotaReport', false)); $tbl->enable("numinfo_header"); $tbl->setFormName("cmd"); $tbl->setSelectAllCheckbox("id"); // sorting $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); // fetch the data $data = ilDiskQuotaChecker::_fetchDiskQuotaReport($_SESSION['quota_usage_filter'], $_SESSION['quota_access_filter'], $header_vars[$tbl->getOrderColumn()], $tbl->getOrderDirection()); // paging $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount(count($data)); // footer $tbl->setFooter("tblfooter", $lng->txt("previous"), $lng->txt("next")); // render table $tbl->setTemplate($a_tpl); // render rows $count = 0; for ($i = $tbl->getOffset(); $i < count($data) && $i < $tbl->getOffset() + $tbl->getLimit(); $i++) { $row = $data[$i]; // build columns foreach ($header_vars as $key) { switch ($key) { case 'login': //build link $this->ctrl->setParameterByClass("ilobjusergui", "ref_id", "7"); $this->ctrl->setParameterByClass("ilobjusergui", "obj_id", $row["usr_id"]); $link = $this->ctrl->getLinkTargetByClass("ilobjusergui", "view"); $tbl_content_cell = '<a href="' . $link . '">' . htmlspecialchars($row[$key]) . '</a>'; break; case 'disk_quota': if ($row['role_id'] == SYSTEM_ROLE_ID) { $tbl_content_cell = "<span class=\"smallgreen\">" . $lng->txt('access_unlimited') . '</span>'; } else { $tbl_content_cell = ilFormat::formatSize($row[$key], 'short'); } break; case 'disk_usage': if ($row['last_update'] == null) { $tbl_content_cell = $lng->txt('unknown'); } else { if ($row['disk_usage'] > $row['disk_quota']) { $tbl_content_cell = "<span class=\"smallred\">" . ilFormat::formatSize($row[$key], 'short') . '</span>'; } else { $tbl_content_cell = ilFormat::formatSize($row[$key], 'short'); } } break; case 'access_until': if (!$row['active']) { $tbl_content_cell = "<span class=\"smallred\">" . $lng->txt('inactive') . '</span>'; } else { if ($row['time_limit_unlimited']) { $tbl_content_cell = "<span class=\"smallgreen\">" . $lng->txt('access_unlimited') . '</span>'; } else { if ($row['expired']) { $tbl_content_cell = "<span class=\"smallred\">" . $lng->txt('access_expired') . '</span>'; } else { $tbl_content_cell = ilFormat::formatDate($row[$key]); } } } break; case 'last_login': case 'last_reminder': if ($row[$key] == null) { $tbl_content_cell = $lng->txt('no_date'); } else { $tbl_content_cell = ilFormat::formatDate($row[$key]); } break; default: $tbl_content_cell = htmlspecialchars($row[$key]); } /* if (is_array($tbl_content_cell)) { $tbl->tpl->setCurrentBlock("tbl_cell_subtitle"); $tbl->tpl->setVariable("TBL_CELL_SUBTITLE",$tbl_content_cell[1]); $tbl->tpl->parseCurrentBlock(); $tbl_content_cell = "<b>".$tbl_content_cell[0]."</b>"; }*/ $tbl->tpl->setCurrentBlock("tbl_content_cell"); $tbl->tpl->setVariable("TBL_CONTENT_CELL", $tbl_content_cell); $tbl->tpl->parseCurrentBlock(); } $tbl->tpl->setCurrentBlock("tbl_content_row"); $rowcolor = ilUtil::switchColor($count, "tblrow1", "tblrow2"); $tbl->tpl->setVariable("ROWCOLOR", $rowcolor); $tbl->tpl->parseCurrentBlock(); $count++; } $tbl->render(); // Add table to page $this->tpl->setVariable("USER_TABLE", $a_tpl->get()); }
function sco_resources() { global $tpl, $lng, $ilCtrl; $this->setTabs(); $this->setLocator(); $i = 0; $export_files = $this->getExportResources(); // create table require_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(); // load files templates $tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html"); // load template for table content data $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/LearningModule"); $num = 0; $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tbl->setTitle($lng->txt("cont_files")); $tbl->setHeaderNames(array($lng->txt("cont_format"), $lng->txt("cont_file"), $lng->txt("size"), $lng->txt("date"), "")); $cols = array("format", "file", "size", "date", "download"); $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"], "cmd" => "sco_resources", "cmdClass" => strtolower(get_class($this)), "cmdNode" => $_GET["cmdNode"], "baseClass" => $_GET["baseClass"]); $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("10%", "30%", "20%", "20%", "20%")); $tbl->disable("sort"); $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // ??? $tbl->setMaxCount(count($export_files)); // footer $tbl->setFooter("tblfooter", $lng->txt("previous"), $lng->txt("next")); //$tbl->disable("footer"); $tbl->setMaxCount(count($export_files)); $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($export_files) > 0) { $i = 0; foreach ($export_files as $exp_file) { /* remote files (youtube videos) have no size, so we allow them now if (!$exp_file["size"] > 0) { continue; } */ $tpl->setCurrentBlock("tbl_content"); $tpl->setVariable("TXT_FILENAME", $exp_file["file"]); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $tpl->setVariable("CSS_ROW", $css_row); $tpl->setVariable("TXT_SIZE", $exp_file["size"]); $tpl->setVariable("TXT_FORMAT", $exp_file["type"]); $tpl->setVariable("TXT_DATE", $exp_file["date"]); if ($exp_file["size"] > 0) { $tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download")); $ilCtrl->setParameter($this, "resource", rawurlencode($exp_file["path"])); $ilCtrl->setParameter($this, "file_id", rawurlencode($exp_file["file_id"])); $tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this, "downloadResource")); } else { $tpl->setVariable("TXT_DOWNLOAD", $lng->txt("show")); $tpl->setVariable("LINK_TARGET", " target=\"_blank\""); $tpl->setVariable("LINK_DOWNLOAD", $exp_file["path"]); } $tpl->parseCurrentBlock(); } } //if is_array /* not found in template? else { $tpl->setCurrentBlock("notfound"); $tpl->setVariable("TXT_OBJECT_NOT_FOUND", $lng->txt("obj_not_found")); $tpl->setVariable("NUM_COLS", 4); $tpl->parseCurrentBlock(); } */ // $tpl->parseCurrentBlock(); }
function confirmDeleteArchives() { global $ilAccess, $ilErr; // MINIMUM ACCESS LEVEL = 'write' if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->MESSAGE); } if (!$_POST['archives']) { ilUtil::sendFailure($this->lng->txt("crs_no_archives_selected")); $this->view(); return false; } $_SESSION["crs_archives"] = $_POST["archives"]; ilUtil::sendQuestion($this->lng->txt("crs_sure_delete_selected_archives")); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_confirm_delete_archives.html', 'Modules/Course'); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_ARCHIVE_NAME", $this->lng->txt('crs_file_name')); $this->course_obj->initCourseArchiveObject(); $counter = 0; foreach ($_POST['archives'] as $archive_id) { $archive = $this->course_obj->archives_obj->getArchive($archive_id); $this->tpl->setCurrentBlock("archives"); $this->tpl->setVariable("ARCHIVE_NAME", $archive['archive_name']); $this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2')); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("DELETE", $this->lng->txt('delete')); $this->tpl->setVariable("CANCEL", $this->lng->txt('cancel')); return true; }
/** * show download list */ function showDownloadList() { //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true); $this->tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())); } else { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css"); } $this->tpl->parseCurrentBlock(); $this->renderPageTitle(); $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->getStandardTemplate(); $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode(), $this->getExportFormat(), "download", true)); $this->ilLocator(); //$this->tpl->stopTitleFloating(); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_download_list.html", "Modules/LearningModule"); // set title header $this->tpl->setTitle($this->lm->getTitle()); $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg")); /* $this->tpl->setVariable("TXT_BACK", $this->lng->txt("back")); $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]); $this->tpl->setVariable("LINK_BACK", $this->ctrl->getLinkTarget($this, "")); */ // output copyright information include_once 'Services/MetaData/classes/class.ilMD.php'; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); if (is_object($md_rights = $md->getRights())) { $copyright = $md_rights->getDescription(); include_once 'Services/MetaData/classes/class.ilMDUtils.php'; $copyright = ilMDUtils::_parseCopyright($copyright); if ($copyright != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("copyright"); $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright")); $this->tpl->setVariable("LM_COPYRIGHT", $copyright); $this->tpl->parseCurrentBlock(); } } // create table require_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(); // load files templates $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/LearningModule"); $export_files = array(); $types = array("xml", "html", "scorm"); foreach ($types as $type) { if ($this->lm->getPublicExportFile($type) != "") { if (is_file($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type))) { $dir = $this->lm->getExportDirectory($type); $size = filesize($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type)); $export_files[] = array("type" => $type, "file" => $this->lm->getPublicExportFile($type), "size" => $size); } } } $num = 0; $tbl->setTitle($this->lng->txt("download")); $tbl->setHeaderNames(array($this->lng->txt("cont_format"), $this->lng->txt("cont_file"), $this->lng->txt("size"), $this->lng->txt("date"), "")); $cols = array("format", "file", "size", "date", "download"); $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"], "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this))); $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("10%", "30%", "20%", "20%", "20%")); $tbl->disable("sort"); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // ??? //$this->tpl->setVariable("COLUMN_COUNTS", 5); // footer //$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next")); $tbl->disable("footer"); $tbl->setMaxCount(count($export_files)); $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($export_files) > 0) { $i = 0; foreach ($export_files as $exp_file) { if (!$exp_file["size"] > 0) { continue; } $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]); $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"])); $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"] . ":" . $exp_file["file"]); $file_arr = explode("__", $exp_file["file"]); $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s", $file_arr[0])); $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download")); $this->ctrl->setParameter($this, "type", $exp_file["type"]); $this->tpl->setVariable("LINK_DOWNLOAD", $this->ctrl->getLinkTarget($this, "downloadExportFile")); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", 5); $this->tpl->parseCurrentBlock(); } $this->tpl->show(); }
private function showCouponInput($payment_type = '') { include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $tpl = new ilTemplate('tpl.pay_shopping_cart_coupons.html', true, true, 'Services/Payment'); $tpl->setVariable('COUPON_FORMACTION', $this->ctrl->getFormAction($this)); $tpl->setVariable('TITLE', $this->lng->txt('paya_coupons_coupons')); $tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_pays_b.png')); $tpl->setVariable('ALT_IMG', $this->lng->txt('obj_usr')); $tpl->setVariable('TXT_CODE', $this->lng->txt('paya_coupons_code')); $tpl->setVariable('CMD_VALUE', $this->lng->txt('send')); $tpl->setVariable('CMD', 'setCoupon'); $tpl->setVariable('PAYMENT_TYPE', $payment_type); $coupon_session = $payment_type; if (!empty($_SESSION['coupons'][$coupon_session])) { $i = 0; foreach ($_SESSION['coupons'][$coupon_session] as $coupon) { $tpl->setCurrentBlock('loop'); $tpl->setVariable('LOOP_ROW', ilUtil::switchColor($i++, '1', '2')); $tpl->setVariable('LOOP_TXT_COUPON', $this->lng->txt('paya_coupons_coupon')); $tpl->setVariable('LOOP_CODE', $coupon['pcc_code']); $this->ctrl->setParameter($this, 'coupon_id', $coupon['pc_pk']); $this->ctrl->setParameter($this, 'payment_type', $_SESSION['bmf']['payment_type']); $tpl->setVariable('LOOP_TITLE', $coupon['pc_title']); if ($coupon['pc_description'] != '') { $tpl->setVariable('LOOP_DESCRIPTION', nl2br($coupon['pc_description'])); } $tpl->setVariable("LOOP_TYPE", sprintf($this->lng->txt('paya_coupons_' . ($coupon['pc_type'] == "fix" ? 'fix' : 'percentaged') . '_' . (count($coupon['objects']) == 0 ? 'all' : 'selected') . '_objects'), (double) $coupon['pc_value'] / round($coupon['pc_value'], 2) == 1 && $coupon['pc_type'] == "percent" ? round($coupon['pc_value'], 2) : number_format($coupon['pc_value'], 2, ',', '.'), $coupon['pc_type'] == "percent" ? "%" : $genSet->get('currency_unit'))); $tpl->setVariable("LOOP_REMOVE", "<div class=\"il_ContainerItemCommands\" style=\"float: right;\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, 'removeCoupon') . "\">" . $this->lng->txt('remove') . "</a></div>"); $tpl->parseCurrentBlock(); } } return $tpl->get(); }
/** * list sessions of all user * * @access public * @param * @return */ public function eventsListObject() { global $ilErr, $ilAccess, $ilUser, $tree; if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE); } $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'Modules/Session'); $this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export')); include_once 'Modules/Session/classes/class.ilEventParticipants.php'; $this->tpl->addBlockfile("EVENTS_TABLE", "events_table", "tpl.table.html"); $this->tpl->addBlockfile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'Modules/Session'); $members_obj = $this->initContainer(true); $members = $members_obj->getParticipants(); $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id'); // Table $tbl = new ilTableGUI(); $tbl->setTitle($this->lng->txt("event_overview"), 'icon_usr.png', $this->lng->txt('obj_usr')); $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']); $course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs'); $events = array(); foreach ($tree->getSubtree($tree->getNodeData($course_ref_id), false, 'sess') as $event_id) { $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false); if (!is_object($tmp_event) or $tmp_event->getType() != 'sess') { continue; } $events[] = $tmp_event; } $headerNames = array(); $headerVars = array(); $colWidth = array(); $headerNames[] = $this->lng->txt('name'); $headerVars[] = "name"; $colWidth[] = '20%'; for ($i = 1; $i <= count($events); $i++) { $headerNames[] = $i; $headerVars[] = "event_" . $i; $colWidth[] = 80 / count($events) . "%"; } $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tbl->setHeaderNames($headerNames); $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this, 'eventsList')); $tbl->setColumnWidth($colWidth); $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setOffset($_GET["offset"]); $tbl->setLimit($ilUser->getPref("hits_per_page")); $tbl->setMaxCount(count($members)); $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); $sliced_users = array_slice($members, $_GET['offset'], $_SESSION['tbl_limit']); $tbl->disable('sort'); $tbl->render(); $counter = 0; foreach ($sliced_users as $user_id) { foreach ($events as $event_obj) { $this->tpl->setCurrentBlock("eventcols"); $event_part = new ilEventParticipants($this->object->getId()); $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png')); $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ? $this->lng->txt('event_participated') : $this->lng->txt('event_not_participated')); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_content"); $name = ilObjUser::_lookupName($user_id); $this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2')); $this->tpl->setVariable("LASTNAME", $name['lastname']); $this->tpl->setVariable("FIRSTNAME", $name['firstname']); $this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id)); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend")); $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit")); $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event")); $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location")); $this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time")); $i = 1; foreach ($events as $event_obj) { $this->tpl->setCurrentBlock("legend_loop"); $this->tpl->setVariable("LEGEND_CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2')); $this->tpl->setVariable("LEGEND_DIGIT", $i++); $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle()); $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription()); $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation()); $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString()); $this->tpl->parseCurrentBlock(); } }
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); } }
/** * @param ilTemplate $tpl * @param ilForumPost $post * @param int $counter * @param int $mode */ protected function renderPostHtml(ilTemplate $tpl, ilForumPost $post, $counter, $mode) { /** * @var $lng ilLanguage * @var $rbacreview ilRbacReview * @var $ilUser ilObjUser * @var $ilObjDataCache ilObjectDataCache */ global $lng, $rbacreview, $ilUser, $ilObjDataCache; $tpl->setCurrentBlock('posts_row'); if (ilForumProperties::getInstance($ilObjDataCache->lookupObjId($_GET['ref_id']))->getMarkModeratorPosts() == 1) { if ($post->getIsAuthorModerator() === null && ($is_moderator = ilForum::_isModerator($_GET['ref_id'], $post->getPosAuthorId()))) { $rowCol = 'ilModeratorPosting'; } else { if ($post->getIsAuthorModerator()) { $rowCol = 'ilModeratorPosting'; } else { $rowCol = ilUtil::switchColor($counter, 'tblrow1', 'tblrow2'); } } } else { $rowCol = ilUtil::switchColor($counter, 'tblrow1', 'tblrow2'); } $tpl->setVariable('ROWCOL', ' ' . $rowCol); // post is censored if ($post->isCensored()) { // display censorship advice $tpl->setVariable('TXT_CENSORSHIP_ADVICE', $lng->txt('post_censored_comment_by_moderator')); // highlight censored posts $rowCol = 'tblrowmarked'; } // set row color $tpl->setVariable('ROWCOL', ' ' . $rowCol); // if post is not activated display message for the owner if (!$post->isActivated() && $post->isOwner($ilUser->getId())) { $tpl->setVariable('POST_NOT_ACTIVATED_YET', $lng->txt('frm_post_not_activated_yet')); } $authorinfo = new ilForumAuthorInformation($post->getPosAuthorId(), $post->getDisplayUserId(), $post->getUserAlias(), $post->getImportName()); if ($authorinfo->hasSuffix()) { $tpl->setVariable('AUTHOR', $authorinfo->getSuffix()); $tpl->setVariable('USR_NAME', $post->getUserAlias()); } else { $tpl->setVariable('AUTHOR', $authorinfo->getAuthorShortName()); if ($authorinfo->getAuthorName(true)) { $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true)); } } if (self::MODE_EXPORT_CLIENT == $mode) { if ($authorinfo->getAuthor()->getPref('public_profile') != 'n') { $tpl->setVariable('TXT_REGISTERED', $lng->txt('registered_since')); $tpl->setVariable('REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate())); } if ($post->getDisplayUserId()) { if ($this->is_moderator) { $num_posts = $this->frm->countUserArticles($post->getDisplayUserId()); } else { $num_posts = $this->frm->countActiveUserArticles($post->getDisplayUserId()); } $tpl->setVariable('TXT_NUM_POSTS', $lng->txt('forums_posts')); $tpl->setVariable('NUM_POSTS', $num_posts); } } $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture()); if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $post->getPosAuthorId())) { if ($authorinfo->getAuthor()->getGender() == 'f') { $tpl->setVariable('ROLE', $lng->txt('frm_moderator_f')); } else { if ($authorinfo->getAuthor()->getGender() == 'm') { $tpl->setVariable('ROLE', $lng->txt('frm_moderator_m')); } } } // get create- and update-dates if ($post->getUpdateUserId() > 0) { $spanClass = ''; // last update from moderator? $posMod = $this->frm->getModeratorFromPost($post->getId()); if (is_array($posMod) && $posMod['top_mods'] > 0) { $MODS = $rbacreview->assignedUsers($posMod['top_mods']); if (is_array($MODS)) { if (in_array($post->getUpdateUserId(), $MODS)) { $spanClass = 'moderator_small'; } } } $post->setChangeDate($post->getChangeDate()); if ($spanClass == '') { $spanClass = 'small'; } require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($post->getPosAuthorId(), $post->getUpdateUserId(), '', ''); $tpl->setVariable('POST_UPDATE_TXT', $lng->txt('edited_on') . ': ' . $this->frm->convertDate($post->getChangeDate()) . ' - ' . strtolower($lng->txt('by'))); $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName()); if ($authorinfo->getAuthorName(true)) { $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true)); } } // prepare post $post->setMessage($this->frm->prepareText($post->getMessage())); $tpl->setVariable('POST_DATE', $this->frm->convertDate($post->getCreateDate())); $tpl->setVariable('SUBJECT', $post->getSubject()); if (!$post->isCensored()) { // post from moderator? $modAuthor = $this->frm->getModeratorFromPost($post->getId()); $spanClass = ""; if (is_array($modAuthor) && $modAuthor['top_mods'] > 0) { $MODS = $rbacreview->assignedUsers($modAuthor['top_mods']); if (is_array($MODS) && in_array($post->getDisplayUserId(), $MODS)) { $spanClass = 'moderator'; } } // possible bugfix for mantis #8223 if ($post->getMessage() == strip_tags($post->getMessage())) { // We can be sure, that there are not html tags $post->setMessage(nl2br($post->getMessage())); } if ($spanClass != "") { $tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($post->getMessage(), 1) . "</span>"); } else { $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($post->getMessage(), 1)); } } else { $tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($post->getCensorshipComment()) . "</span>"); } $tpl->parseCurrentBlock('posts_row'); }