/** * Show the edit screen */ function viewObject() { global $ilUser; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_edit_items.html", "Services/Language"); // set the language to compare with $compare = $this->getPar('compare', $this->lng->getDefaultLanguage()); // get the default values if the compare language is the same if ($compare == $this->object->key) { $compare_object = $this->object->getGlobalLanguageFile(); $compare_content = $compare_object->getAllValues(); $compare_comments = $compare_object->getAllComments(); $compare_note = " " . $this->lng->txt("language_default_entries"); } // get the remarks in database $remarks = $this->object->getAllRemarks(); // page translation mode: // - the table is filtered by a list of modules and topics // - all found entries are shown on the same page if ($this->_isPageTranslation()) { $offset = 0; $limit = 0; $modules = $this->getPar("page_modules", array()); $topics = $this->getPar("page_topics", array()); if (!isset($compare_content)) { $compare_content = ilObjLanguageExt::_getValues($compare, $modules, $topics); $compare_comments = ilObjLanguageExt::_getRemarks($compare); } $translations = ilObjLanguageExt::_getValues($this->object->key, $modules, $topics); } else { $offset = $this->getPar('offset', '0'); $limit = $ilUser->getPref("hits_per_page"); $filter_mode = $this->getPar('filter_mode', 'all'); $filter_pattern = $this->getPar('filter_pattern', ''); $filter_module = $this->getPar('filter_module', 'administration'); $filter_modules = $filter_module ? array($filter_module) : array(); if (!isset($compare_content)) { $compare_content = ilObjLanguageExt::_getValues($compare, $filter_modules); $compare_comments = ilObjLanguageExt::_getRemarks($compare); } switch ($filter_mode) { case "changed": $translations = $this->object->getChangedValues($filter_modules, $filter_pattern); break; case "added": //langmode only $translations = $this->object->getAddedValues($filter_modules, $filter_pattern); break; case "unchanged": $translations = $this->object->getUnchangedValues($filter_modules, $filter_pattern); break; case "commented": $translations = $this->object->getCommentedValues($filter_modules, $filter_pattern); break; case "dbremarks": $translations = $this->object->getAllValues($filter_modules, $filter_pattern); $translations = array_intersect_key($translations, $remarks); break; case "equal": $translations = $this->object->getAllValues($filter_modules, $filter_pattern); $translations = array_intersect_assoc($translations, $compare_content); break; case "different": $translations = $this->object->getAllValues($filter_modules, $filter_pattern); $translations = array_diff_assoc($translations, $compare_content); break; case "conflicts": $former_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang'; if (!is_readable($former_file)) { ilUtil::sendFailure(sprintf($this->lng->txt("language_former_file_missing"), $former_file) . '<br />' . $this->lng->txt("language_former_file_description"), false); $translations = array(); break; } $global_file_obj = $this->object->getGlobalLanguageFile(); $former_file_obj = new ilLanguageFile($former_file); $former_file_obj->read(); $global_changes = array_diff_assoc($global_file_obj->getAllValues(), $former_file_obj->getAllValues()); if (!count($global_changes)) { ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_equal"), $former_file) . '<br />' . $this->lng->txt("language_former_file_description"), false); $translations = array(); break; } $translations = $this->object->getChangedValues($filter_modules, $filter_pattern); $translations = array_intersect_key($translations, $global_changes); break; case "all": default: $translations = $this->object->getAllValues($filter_modules, $filter_pattern); } // show the filter section $this->tpl->setCurrentBlock("filter"); // filter by language module $options = array(); $options[""] = $this->lng->txt("language_all_modules"); $modules = ilObjLanguageExt::_getModules($this->object->key); foreach ($modules as $mod) { $options[$mod] = $mod; } $this->tpl->setVariable("SELECT_MODULE", ilUtil::formSelect($filter_module, "filter_module", $options, false, true)); // filter by mode $options = array(); $options["all"] = $this->lng->txt("language_scope_global"); $options["changed"] = $this->lng->txt("language_scope_local"); if ($this->langmode) { $options["added"] = $this->lng->txt("language_scope_added"); } $options["unchanged"] = $this->lng->txt("language_scope_unchanged"); $options["equal"] = $this->lng->txt("language_scope_equal"); $options["different"] = $this->lng->txt("language_scope_different"); $options["commented"] = $this->lng->txt("language_scope_commented"); if ($this->langmode) { $options["dbremarks"] = $this->lng->txt("language_scope_dbremarks"); } $options["conflicts"] = $this->lng->txt("language_scope_conflicts"); $this->tpl->setVariable("SELECT_MODE", ilUtil::formSelect($filter_mode, "filter_mode", $options, false, true)); // filter by pattern $this->tpl->setVariable("PATTERN_NAME", "filter_pattern"); $this->tpl->setVariable("PATTERN_VALUE", ilUtil::prepareFormOutput($filter_pattern)); // and general filter variables $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_FILTER", $this->lng->txt("filter")); $this->tpl->setVariable("OFFSET_NAME", "offset"); $this->tpl->setVariable("OFFSET_VALUE", "0"); $this->tpl->setVariable("TXT_APPLY_FILTER", $this->lng->txt("apply_filter")); $this->tpl->setVariable("CMD_FILTER", "view"); $this->tpl->parseCurrentBlock(); } // show the compare section $this->tpl->setCurrentBlock("compare"); $this->tpl->setVariable("COMPARE_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_COMPARE", $this->lng->txt("language_compare")); $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change")); $options = array(); $langlist = $this->lng->getInstalledLanguages(); foreach ($langlist as $lang_key) { $options[$lang_key] = $this->lng->txt("meta_l_" . $lang_key); } $this->tpl->setVariable("SELECT_COMPARE", ilUtil::formSelect($compare, "compare", $options, false, true, 1)); $this->tpl->setVariable("CMD_COMPARE", "view"); $this->tpl->parseCurrentBlock(); // prepare the dataset for the output table $sort_by = $this->getPar('sort_by', 'translation'); $sort_order = $this->getPar('sort_order', 'asc'); $list = array(); foreach ($translations as $name => $translation) { $keys = explode($this->lng->separator, $name); $data = array(); $data["module"] = $keys[0]; $data["topic"] = $keys[1]; $data["name"] = $name; $data["translation"] = $translation; $data["default"] = $compare_content[$name]; $data["default_comment"] = $compare_comments[$name]; $list[] = $data; } $list = ilUtil::sortArray($list, $sort_by, $sort_order); if ($limit > 0) { $list = array_slice($list, $offset, $limit); } // create and configure the table object include_once 'Services/Table/classes/class.ilTableGUI.php'; $tbl = new ilTableGUI(); $tbl->disable('title'); $tbl->setHeaderNames(array($this->lng->txt("module"), $this->lng->txt("identifier"), $this->lng->txt("meta_l_" . $this->object->key), $this->lng->txt("meta_l_" . $compare) . $compare_note)); $tbl->setHeaderVars(array("module", "topic", "translation", "default"), $this->ctrl->getParameterArray($this)); $tbl->setColumnWidth(array("10%", "20%", "40%", "30%")); $tbl->setOrderColumn($sort_by); $tbl->setOrderDirection($sort_order); $tbl->setLimit($limit); $tbl->setOffset($offset); $tbl->setMaxCount(count($translations)); // prepare the table template $tpl =& new ilTemplate("tpl.table.html", true, true); $tpl->setCurrentBlock("tbl_form_header"); $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("tbl_action_btn"); $tpl->setVariable("BTN_NAME", 'save'); $tpl->setVariable("BTN_VALUE", $this->lng->txt('save')); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("tbl_action_row"); $tpl->setVariable("COLUMN_COUNTS", "4"); $tpl->parseCurrentBlock(); // render the table rows $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.lang_items_row.html", "Services/Language"); foreach ($list as $data) { if ($this->langmode) { $tpl->setCurrentBlock('comment'); $tpl->setVariable("COM_ID", ilUtil::prepareFormOutput($data["name"] . $this->lng->separator . "comment")); $tpl->setVariable("COM_NAME", ilUtil::prepareFormOutput($data["name"] . $this->lng->separator . "comment")); $tpl->setVariable("COM_VALUE", ilUtil::prepareFormOutput($remarks[$data["name"]])); $tpl->setVariable("COM_SIZE", $this->commentsize); $tpl->setVariable("COM_MAX", 250); $tpl->setVariable("TXT_COMMENT", $this->lng->txt('comment')); $tpl->parseCurrentBlock(); } else { $tpl->setCurrentBlock('hidden_comment'); $tpl->setVariable("COM_NAME", ilUtil::prepareFormOutput($data["name"] . $this->lng->separator . "comment")); $tpl->setVariable("COM_VALUE", ilUtil::prepareFormOutput($remarks[$data["name"]])); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("row"); $tpl->setVariable("T_ROWS", ceil(strlen($data["translation"]) / $this->inputsize)); $tpl->setVariable("T_SIZE", $this->inputsize); $tpl->setVariable("T_NAME", ilUtil::prepareFormOutput($data["name"])); $tpl->setVariable("T_USER_VALUE", ilUtil::prepareFormOutput($data["translation"])); $tpl->setVariable("MODULE", ilUtil::prepareFormOutput($data["module"])); $tpl->setVariable("TOPIC", ilUtil::prepareFormOutput($data["topic"])); $tpl->setVariable("DEFAULT_VALUE", ilUtil::prepareFormOutput($data["default"])); $tpl->setVariable("COMMENT", ilUtil::prepareFormOutput($data["default_comment"])); $tpl->parseCurrentBlock(); } // render and show the table $tbl->setTemplate($tpl); $tbl->render(); $this->tpl->setVariable("TRANSLATION_TABLE", $tpl->get()); // $this->tpl->show(); }
/** * 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()); }
/** * 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 }
/** * 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 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(); } }
/** * get versions table */ function getVersionsTable($a_header_params, $a_user_comment = false) { global $ilCtrl; $ref_id = $a_header_params["ref_id"]; require_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(0, false); // table header $tbl->setTitle($this->lng->txt("versions")); $tbl->setHeaderNames(array($this->lng->txt("date") . "/" . $this->lng->txt("user"), $this->lng->txt("action"))); $tbl->setColumnWidth(array("40%", "60%")); $cols = array("date_user", "action"); if ($a_header_params == "") { $a_header_params = array(); } $header_params = $a_header_params; $tbl->setHeaderVars($cols, $header_params); // table variables $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // ??? $tbl->disable("header"); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); // get history entries $entries = ilHistory::_getEntriesForObject($this->obj_id, $this->obj_type); $tbl->setMaxCount(count($entries)); $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]); $this->tpl =& $tbl->getTemplateObject(); $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.history_row.html", "Services/History"); if (count($entries) > 0) { $i = 0; foreach ($entries as $entry) { $this->tpl->setCurrentBlock("tbl_content"); $css_row = $css_row != "tblrow1" ? "tblrow1" : "tblrow2"; $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable('TXT_DATE', ilDatePresentation::formatDate(new ilDateTime($entry['date'], IL_CAL_DATETIME))); $name = ilObjUser::_lookupName($entry["user_id"]); $this->tpl->setVariable("TXT_USER", $name["title"] . " " . $name["firstname"] . " " . $name["lastname"] . " [" . $entry["user_id"] . "]"); $info_params = explode(",", $entry["info_params"]); $info_text = $this->lng->txt("hist_" . $this->obj_type . "_" . $entry["action"]); $i = 1; foreach ($info_params as $info_param) { $info_text = str_replace("%" . $i, $info_param, $info_text); $i++; } $this->tpl->setVariable("TXT_ACTION", $info_text); if ($a_user_comment) { $this->tpl->setCurrentBlock("user_comment"); $this->tpl->setVariable("TXT_USER_COMMENT", $entry["user_comment"]); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_content"); } $this->tpl->setCurrentBlock("dl_link"); $this->tpl->setVariable("TXT_DL", $this->lng->txt("download")); $ilCtrl->setParameterByClass("ilobjfilegui", "hist_id", $entry["hist_entry_id"]); $this->tpl->setVariable("DL_LINK", $ilCtrl->getLinkTargetByClass("ilobjfilegui", "sendfile")); $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("tbl_content_cell"); $this->tpl->setVariable("TBL_CONTENT_CELL", $this->lng->txt("hist_no_entries")); $this->tpl->setVariable("TBL_COL_SPAN", 4); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_content_row"); $this->tpl->setVariable("ROWCOLOR", "tblrow1"); $this->tpl->parseCurrentBlock(); } $tbl->render(); //$this->tpl->parseCurrentBlock(); return $this->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(); } }
/** * 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(); } }
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(); }
/** * 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(); }
/** * show client list */ function showClientList() { global $tpl, $ilIliasIniFile, $ilCtrl; //echo "1"; if (!$ilIliasIniFile->readVariable("clients", "list")) { $this->processIndexPHP(); return; } //echo "2"; $tpl = new ilTemplate("tpl.main.html", true, true); $tpl->setAddFooter(false); // no client yet // to do: get standard style $tpl->setVariable("PAGETITLE", "Client List"); $tpl->setVariable("LOCATION_STYLESHEET", "./templates/default/delos.css"); // load client list template self::initStartUpTemplate("tpl.client_list.html"); // load template for table $tpl->addBlockfile("CLIENT_LIST", "client_list", "tpl.table.html"); // load template for table content data $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html"); // load table content data require_once "setup/classes/class.ilClientList.php"; require_once "setup/classes/class.ilClient.php"; require_once "setup/classes/class.ilDBConnections.php"; require_once "./Services/Table/classes/class.ilTableGUI.php"; $this->db_connections = new ilDBConnections(); $clientlist = new ilClientList($this->db_connections); $list = $clientlist->getClients(); if (count($list) == 0) { header("Location: ./setup/setup.php"); exit; } $hasPublicSection = false; foreach ($list as $key => $client) { $client->setDSN(); if ($client->checkDatabaseExists(true) and $client->ini->readVariable("client", "access") and $client->getSetting("setup_ok")) { $this->ctrl->setParameter($this, "client_id", $key); $tmp = array(); $tmp[] = $client->getName(); $tmp[] = "<a href=\"" . "login.php?cmd=force_login&client_id=" . urlencode($key) . "\">Login page</a>"; if ($client->getSetting('pub_section')) { $hasPublicSection = true; $tmp[] = "<a href=\"" . "ilias.php?baseClass=ilRepositoryGUI&client_id=" . urlencode($key) . "\">Start page</a>"; } else { $tmp[] = ''; } $data[] = $tmp; } } // create table $tbl = new ilTableGUI(); // title & header columns if ($hasPublicSection) { $tbl->setTitle("Available Clients"); $tbl->setHeaderNames(array("Installation Name", "Login", "Public Access")); $tbl->setHeaderVars(array("name", "index", "login")); $tbl->setColumnWidth(array("50%", "25%", "25%")); } else { $tbl->setTitle("Available Clients"); $tbl->setHeaderNames(array("Installation Name", "Login", '')); $tbl->setHeaderVars(array("name", "login", '')); $tbl->setColumnWidth(array("70%", "25%", '1px')); } // control $tbl->setOrderColumn($_GET["sort_by"], "name"); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); // content $tbl->setData($data); $tbl->disable("icon"); $tbl->disable("numinfo"); $tbl->disable("sort"); $tbl->disable("footer"); // render table $tbl->render(); $tpl->show("DEFAULT", true, true); }
/** * Show file list of available export files * * @access public * */ public function showFileList() { global $ilUser; if (!count($files = $this->fss_export->getMemberExportFiles())) { return false; } $a_tpl = new ilTemplate('tpl.table.html', true, true); $a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.member_export_file_row.html", "Modules/Course"); $a_tpl->setVariable('FORMACTION', $this->ctrl->getFormaction($this)); include_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(); // load template for table content data $tbl->setTitle($this->lng->txt("ps_export_files")); $tbl->setHeaderNames(array("", $this->lng->txt("type"), $this->lng->txt("ps_size"), $this->lng->txt("date"))); $cols = array("", "type", "size", "date"); $header_params = $this->ctrl->getParameterArray($this, 'show'); $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("1%", "9%", "45%", "45%")); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($ilUser->getPref('hits_per_page', 9999)); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount(count($files)); $tbl->disable("sort"); $a_tpl->setVariable("COLUMN_COUNTS", 4); $files = array_reverse($files); $files = array_slice($files, $_GET["offset"], $_GET["limit"]); $num = 0; $i = 0; foreach ($files as $exp_file) { $a_tpl->setCurrentBlock("tbl_content"); $a_tpl->setVariable("TXT_FILENAME", $exp_file["file"]); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $a_tpl->setVariable("CSS_ROW", $css_row); $a_tpl->setVariable("TXT_SIZE", $exp_file['size']); $a_tpl->setVariable("TXT_TYPE", strtoupper($exp_file["type"])); $a_tpl->setVariable("CHECKBOX_ID", $exp_file["timest"]); $a_tpl->setVariable("TXT_DATE", date("Y-m-d H:i", $exp_file['timest'])); $a_tpl->parseCurrentBlock(); } // delete button $a_tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png")); $a_tpl->setCurrentBlock("tbl_action_btn"); $a_tpl->setVariable("BTN_NAME", "confirmDeleteExportFile"); $a_tpl->setVariable("BTN_VALUE", $this->lng->txt("delete")); $a_tpl->parseCurrentBlock(); $a_tpl->setCurrentBlock("tbl_action_btn"); $a_tpl->setVariable("BTN_NAME", "downloadExportFile"); $a_tpl->setVariable("BTN_VALUE", $this->lng->txt("download")); $a_tpl->parseCurrentBlock(); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); //$tbl->disable("footer"); $tbl->setTemplate($a_tpl); $tbl->render(); #$this->tpl->setCurrentBlock('file_list'); $this->tpl->setVariable('FILE_LIST_TABLE', $a_tpl->get()); #$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 view() { global $ilAccess, $ilErr; // MINIMUM ACCESS LEVEL = 'write' if (!$ilAccess->checkAccess("read", '', $this->course_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->MESSAGE); } $this->is_tutor = $ilAccess->checkAccess('write', '', $this->course_obj->getRefId()); $this->download_allowed = ($this->is_tutor or $this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DOWNLOAD); $this->course_obj->initCourseArchiveObject(); $this->course_obj->archives_obj->initCourseFilesObject(); $archives = $this->is_tutor ? $this->course_obj->archives_obj->getArchives() : $this->course_obj->archives_obj->getPublicArchives(); require_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(); $this->__showArchivesMenu(); $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html"); $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_archives_row.html", 'Modules/Course'); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tbl->setTitle($this->lng->txt("crs_header_archives")); if ($this->download_allowed or $this->is_tutor) { $header_names = array('', $this->lng->txt("type"), $this->lng->txt("crs_file_name"), $this->lng->txt("crs_size"), $this->lng->txt("crs_create_date"), $this->lng->txt("crs_archive_lang")); $header_vars = array("", "type", "name", "size", "date", "lang"); $column_width = array("1%", "9%", "30%", "20%", "20%", "20%"); $this->tpl->setVariable("COLUMN_COUNTS", 6); } else { $header_names = array($this->lng->txt("type"), $this->lng->txt("crs_file_name"), $this->lng->txt("crs_create_date"), $this->lng->txt("crs_size"), $this->lng->txt("crs_archive_lang")); $header_vars = array("type", "name", "date", "size", "lang"); $column_width = array("10%", "30%", "20%", "20%", "20%"); $this->tpl->setVariable("COLUMN_COUNTS", 5); } $tbl->setHeaderNames($header_names); $tbl->setHeaderVars($header_vars, array("ref_id" => $this->course_obj->getRefId(), "cmd" => "view", "cmdClass" => strtolower(get_class($this)))); $tbl->setColumnWidth($column_width); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->disable("sort"); if ($this->download_allowed) { $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png")); if ($this->is_tutor) { // delete $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "confirmDeleteArchives"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete")); $this->tpl->parseCurrentBlock(); } // download $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "downloadArchives"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download")); $this->tpl->parseCurrentBlock(); } $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); $tbl->setMaxCount(count($archives)); $archives = array_slice($archives, $_GET['offset'], $_GET['limit']); $tbl->render(); if (!count($archives)) { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", 6); $this->tpl->parseCurrentBlock(); } $counter = 0; foreach ($archives as $archive_data) { $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2')); if ($this->download_allowed) { $this->tpl->setVariable("VAL_CHECK", ilUtil::formCheckbox(0, "archives[]", $archive_data['archive_id'])); } // Type switch ($archive_data["archive_type"]) { case $this->course_obj->archives_obj->ARCHIVE_XML: $type = $this->lng->txt("crs_xml"); break; case $this->course_obj->archives_obj->ARCHIVE_HTML: $type = $this->lng->txt("crs_html"); break; case $this->course_obj->archives_obj->ARCHIVE_PDF: $type = $this->lng->txt("crs_pdf"); break; } $this->tpl->setVariable("VAL_TYPE", $type); // Name if ($archive_data['archive_type'] == $this->course_obj->archives_obj->ARCHIVE_HTML) { $link = '<a href="' . $this->course_obj->archives_obj->course_files_obj->getOnlineLink($archive_data['archive_name']) . '"' . ' target="_blank">' . $archive_data["archive_name"] . '</a>'; } else { $link = $archive_data['archive_name']; } $this->tpl->setVariable("VAL_NAME", $link); $this->tpl->setVariable("VAL_SIZE", $archive_data['archive_size']); $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($archive_data['archive_name'], IL_CAL_UNIX))); if ($archive_data["archive_lang"]) { $this->tpl->setVariable("VAL_LANG", $this->lng->txt('lang_' . $archive_data["archive_lang"])); } else { $this->tpl->setVariable("VAL_LANG", $this->lng->txt('crs_not_available')); } $this->tpl->parseCurrentBlock(); } $this->tpl->parseCurrentBlock(); }
/** * 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(); } }
/** * 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)); }
/** * 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(); }