本文整理匯總了PHP中ilTemplate::addBlockfile方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilTemplate::addBlockfile方法的具體用法?PHP ilTemplate::addBlockfile怎麽用?PHP ilTemplate::addBlockfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilTemplate
的用法示例。
在下文中一共展示了ilTemplate::addBlockfile方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: assignRoles
function assignRoles()
{
global $rbacreview;
if (!$this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this, "");
}
$offset = $_GET["offset"];
// init sort_by (unfortunatly sort_by is preset with 'title'
if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"])) {
$_GET["sort_by"] = "login";
}
$order = $_GET["sort_by"];
$direction = $_GET["sort_order"];
include_once './Services/User/classes/class.ilLocalUser.php';
if (!isset($_GET['obj_id'])) {
ilUtil::sendFailure('no_user_selected');
$this->index();
return true;
}
$roles = $this->__getAssignableRoles();
$this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.cat_role_assignment.html', "Modules/Category");
$ass_roles = $rbacreview->assignedRoles($_GET['obj_id']);
$counter = 0;
foreach ($roles as $role) {
$role_obj =& ilObjectFactory::getInstanceByObjId($role['obj_id']);
$disabled = false;
$f_result[$counter][] = ilUtil::formCheckbox(in_array($role['obj_id'], $ass_roles) ? 1 : 0, 'role_ids[]', $role['obj_id'], $disabled);
$f_result[$counter][] = $role_obj->getTitle();
$f_result[$counter][] = $role_obj->getDescription();
$f_result[$counter][] = $role['role_type'] == 'global' ? $this->lng->txt('global') : $this->lng->txt('local');
unset($role_obj);
++$counter;
}
$this->__showRolesTable($f_result, "assignRolesObject");
}
示例2: viewDiskQuotaReport
/**
* 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');
//.........這裏部分代碼省略.........
示例3: showClientList
/**
* 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);
}
示例4: getHTML
/**
* get html
*/
function getHTML()
{
global $lng, $ilSetting, $tree, $ilAccess, $ilCtrl, $ilUser;
$tpl = new ilTemplate("tpl.infoscreen.html", true, true, "Services/InfoScreen");
// other class handles form action (@todo: this is not implemented/tested)
if ($this->form_action == "") {
$this->setFormAction($ilCtrl->getFormAction($this));
}
require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
iljQueryUtil::initjQuery();
if ($this->hidden) {
$tpl->touchBlock("hidden_js");
if ($this->show_hidden_toggle) {
$this->addButton($lng->txt("show_hidden_sections"), "JavaScript:toggleSections(this, '" . $lng->txt("show_hidden_sections") . "', '" . $lng->txt("hide_visible_sections") . "');");
}
}
// DEPRECATED - use ilToolbarGUI
// add top buttons
if (count($this->top_buttons) > 0) {
$tpl->addBlockfile("TOP_BUTTONS", "top_buttons", "tpl.buttons.html");
foreach ($this->top_buttons as $button) {
// view button
$tpl->setCurrentBlock("btn_cell");
$tpl->setVariable("BTN_LINK", $button["link"]);
$tpl->setVariable("BTN_TARGET", $button["target"]);
$tpl->setVariable("BTN_TXT", $button["title"]);
if ($button["primary"]) {
$tpl->setVariable("BTN_CLASS", " btn-primary");
}
$tpl->parseCurrentBlock();
}
}
// add top formbuttons
if (count($this->top_formbuttons) > 0 && strlen($this->form_action) > 0) {
$tpl->addBlockfile("TOP_FORMBUTTONS", "top_submitbuttons", "tpl.submitbuttons.html", "Services/InfoScreen");
foreach ($this->top_formbuttons as $button) {
// view button
$tpl->setCurrentBlock("btn_submit_cell");
$tpl->setVariable("BTN_COMMAND", $button["command"]);
$tpl->setVariable("BTN_NAME", $button["title"]);
$tpl->parseCurrentBlock();
}
}
// add form action
if (strlen($this->form_action) > 0) {
if ($this->open_form_tag) {
$tpl->setCurrentBlock("formtop");
$tpl->setVariable("FORMACTION", $this->form_action);
$tpl->parseCurrentBlock();
}
if ($this->close_form_tag) {
$tpl->touchBlock("formbottom");
}
}
if (count($this->hiddenelements)) {
foreach ($this->hiddenelements as $hidden) {
$tpl->setCurrentBlock("hidden_element");
$tpl->setVariable("HIDDEN_NAME", $hidden["name"]);
$tpl->setVariable("HIDDEN_VALUE", $hidden["value"]);
$tpl->parseCurrentBlock();
}
}
// learning progress
if ($this->learning_progress_enabled and $html = $this->showLearningProgress($tpl)) {
$tpl->setCurrentBlock("learning_progress");
$tpl->setVariable("LP_TABLE", $html);
$tpl->parseCurrentBlock();
}
// notes section
if ($this->private_notes_enabled && !$ilSetting->get('disable_notes')) {
$html = $this->showNotesSection();
$tpl->setCurrentBlock("notes");
$tpl->setVariable("NOTES", $html);
$tpl->parseCurrentBlock();
}
// tagging
if (is_object($this->gui_object->object)) {
$tags_set = new ilSetting("tags");
if ($tags_set->get("enable") && $ilUser->getId() != ANONYMOUS_USER_ID) {
$this->addTagging();
}
}
if (is_object($this->gui_object->object)) {
$this->addObjectSections();
}
// render all sections
for ($i = 1; $i <= $this->sec_nr; $i++) {
if (is_array($this->section[$i]["properties"])) {
// section properties
foreach ($this->section[$i]["properties"] as $property) {
if ($property["name"] != "") {
if ($property["link"] == "") {
$tpl->setCurrentBlock("pv");
$tpl->setVariable("TXT_PROPERTY_VALUE", $property["value"]);
$tpl->parseCurrentBlock();
} else {
$tpl->setCurrentBlock("lpv");
//.........這裏部分代碼省略.........
示例5: showFileList
/**
* 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();
}