本文整理汇总了PHP中Html::table方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::table方法的具体用法?PHP Html::table怎么用?PHP Html::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moreInfo_GET
/**
* Display member and permission infomation
*
* @param <type> $w
*/
function moreInfo_GET(Web &$w)
{
$option = $w->pathMatch("group_id");
$w->Admin->navigation($w, $w->Auth->getUser($option['group_id'])->login);
if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") {
$w->ctx("addMember", Html::box("/admin/groupmember/" . $option['group_id'], "New Member", true));
}
$w->ctx("editPermission", Html::b("/admin/permissionedit/" . $option['group_id'], "Edit Permissions"));
//fill in member table;
$table = array(array("Name", "Role", "Operations"));
$groupMembers = $w->Auth->getGroupMembers($option['group_id']);
if ($groupMembers) {
foreach ($groupMembers as $groupMember) {
$line = array();
$style = $groupMember->role == "owner" ? "<div style=\"color:red;\">" : "<div style=\"color:blue;\">";
$name = $groupMember->getUser()->is_group == 1 ? $groupMember->getUser()->login : $groupMember->getUser()->getContact()->getFullName();
$line[] = $style . $name . "</div>";
$line[] = $style . $groupMember->role . "</div>";
if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") {
$line[] = Html::a("/admin/memberdelete/" . $option['group_id'] . "/" . $groupMember->id, "Delete", null, null, "Are you sure you want to delete this member?");
} else {
$line[] = null;
}
$table[] = $line;
}
}
$w->ctx("memberList", Html::table($table, null, "tablesorter", true));
}
示例2: groups_GET
/**
* Display a list of all groups which are not deleted
*
* @param <type> $w
*/
function groups_GET(Web &$w)
{
$w->Admin->navigation($w, "Groups");
$table = array(array("Title", "Parent Groups", "Operations"));
$groups = $w->Auth->getGroups();
if ($groups) {
foreach ($groups as $group) {
$ancestors = array();
$line = array();
$line[] = $w->Auth->user()->is_admin ? Html::box($w->localUrl("/admin/groupedit/" . $group->id), "<u>" . $group->login . "</u>") : $group->login;
//if it is a sub group from other group;
$groupUsers = $group->isInGroups();
if ($groupUsers) {
foreach ($groupUsers as $groupUser) {
$ancestors[] = $groupUser->getGroup()->login;
}
}
$line[] = count($ancestors) > 0 ? "<div style=\"color:green;\">" . implode(", ", $ancestors) . "</div>" : "";
$operations = Html::b("/admin/moreInfo/" . $group->id, "More Info");
if ($w->Auth->user()->is_admin) {
$operations .= Html::b("/admin/groupdelete/" . $group->id, "Delete", "Are you sure you want to delete this group?");
}
$line[] = $operations;
$table[] = $line;
}
}
if ($w->Auth->user()->is_admin) {
$w->out(Html::box("/admin/groupadd", "New Group", true));
}
$w->out(Html::table($table, null, "tablesorter", true));
}
示例3: showarchive_ALL
function showarchive_ALL(Web $w)
{
$w->Inbox->navigation($w, "Archive");
$p = $w->pathMatch('num');
$num = $p['num'] ? $p['num'] : 1;
$new_arch = $w->Inbox->getMessages($num - 1, 40, $w->Auth->user()->id, 1, 1);
$arch = $w->Inbox->getMessages($num - 1, 40, $w->Auth->user()->id, 0, 1);
$arch_count = $w->Inbox->getArchCount($w->Auth->user()->id);
$table_header = array("<input style='margin: 0px;' type='checkbox' id='allChk' onclick='selectAll()' />", "Subject", "Date", "Sender");
$table_data = array();
if (!empty($new_arch)) {
foreach ($new_arch as $q) {
$table_data[] = array("<input style='margin: 0px;' type='checkbox' id='" . $q->id . "' value='" . $q->id . "' class='classChk'/>", Html::a(WEBROOT . "/inbox/view/new/" . $q->id, "<b>" . $q->subject . "</b>"), "<b>" . $q->getDate("dt_created", "d/m/Y H:i") . "</b>", "<b>" . ($q->sender_id ? $q->getSender()->getFullName() : "") . "</b>");
}
}
if (!empty($arch)) {
foreach ($arch as $q) {
$table_data[] = array("<input style='margin: 0px;' type='checkbox' id='" . $q->id . "' value='" . $q->id . "' class='classChk'/>", Html::a(WEBROOT . "/inbox/view/read/" . $q->id, $q->subject), "<b>" . $q->getDate("dt_created", "d/m/Y H:i") . "</b>", "<b>" . ($q->sender_id ? $q->getSender()->getFullName() : "") . "</b>");
}
}
$w->ctx("arch_table", Html::table($table_data, null, "tablesorter", $table_header));
$w->ctx('pgnum', $num);
$w->ctx("readtotal", $arch_count);
// $w->ctx("new_arch", $new_arch);
}
示例4: index_ALL
/**
* @hook example_add_row_action(array(<ExampleData> 'data', <String> 'actions')
* @param Web $w
*/
function index_ALL(Web $w)
{
// adding data to the template context
$w->ctx("message", "Example Data List");
// get the list of data objects
$listdata = $w->Example->getAllData();
// prepare table data
$t[] = array("Title", "Data", "Actions");
// table header
if (!empty($listdata)) {
foreach ($listdata as $d) {
$row = array();
$row[] = $d->title;
$row[] = $d->data;
// prepare action buttons for each row
$actions = array();
if ($d->canEdit($w->Auth->user())) {
$actions[] = Html::box("/example/edit/" . $d->id, "Edit", true);
}
if ($d->canDelete($w->Auth->user())) {
$actions[] = Html::b("/example/delete/" . $d->id, "Delete", "Really delete?");
}
// allow any other module to add actions here
$actions = $w->callHook("example", "add_row_action", array("data" => $d, "actions" => $actions));
$row[] = implode(" ", $actions);
$t[] = $row;
}
}
// create the html table and put into template context
$w->ctx("table", Html::table($t, "table", "tablesorter", true));
}
示例5: manage
/**
* Displays a table of pages, either for all users or the currently logged in users pages only
* based on permissions.
*
* Route: admin/pages/manage
*/
public static function manage()
{
// Check if user only has access to their pages
if (!User::current()->hasPermission('page.manage')) {
$pages = Page::page()->where('user_id', '=', User::current()->id)->orderBy('title')->all();
} else {
$pages = Page::page()->orderBy('title')->all();
}
$table = Html::table();
$header = $table->addHeader();
$header->addCol('Title');
$header->addCol('User', array('colspan' => 2));
if ($pages) {
MultiArray::load($pages, 'page_id');
$indentedPages = MultiArray::indent();
foreach ($indentedPages as $page) {
$user = User::user()->find($page->user_id);
$row = $table->addRow();
$row->addCol(Html::a()->get($page->indent . $page->title, 'admin/page/edit/' . $page->id));
$row->addCol($user->email);
$row->addCol(Html::a('Delete', 'admin/page/delete/' . $page->id, array('onclick' => "return confirm('Delete this page? All child pages will be deleted as well.')")), array('class' => 'right'));
}
} else {
$table->addRow()->addCol('<em>No pages</em>', array('colspan' => 2));
}
return array('title' => 'Manage Page', 'content' => $table->render());
}
示例6: output
/**
* Gets all the log types, checks if their configs are enabled but are not set to write to file
* and outputs them to the browser in their own tables.
*/
public static function output()
{
foreach (self::$_logs as $type => $logs) {
if (Config::get(sprintf('log.%s_enabled', $type)) && !Config::get(sprintf('log.%s_to_file', $type))) {
$table = Html::table(array('border' => '1', 'width' => '100%', 'class' => 'caffeine_' . $type));
$header = $table->addHeader();
$header->addCol(strtoupper($type), array('colspan' => 3));
$titles = $table->addRow();
$titles->addCol('<strong>Timestamp</strong>');
$titles->addCol('<strong>Module</strong>');
$titles->addCol('<strong>Message</strong>');
if ($logs) {
foreach ($logs as $l) {
$row = $table->addRow();
$row->addCol($l[0]);
// Timestamp
$row->addCol($l[1]);
// Module name
$row->addCol($l[2]);
// Message
}
} else {
$table->addRow()->addCol('<em>No logs.</em>', array('colspan' => 3));
}
echo $table->render();
}
}
}
示例7: lookup_ALL
function lookup_ALL(Web &$w)
{
$w->Admin->navigation($w, "Lookup");
$types = $w->Admin->getLookupTypes();
$typelist = Html::select("type", $types, $w->request('type'));
$w->ctx("typelist", $typelist);
// tab: Lookup List
$where = array();
if (NULL == $w->request('reset')) {
if ($w->request('type') != "") {
$where['type'] = $w->request('type');
}
} else {
// Reset called, unset vars
if ($w->request("type") !== null) {
unset($_REQUEST["type"]);
}
var_dump($_REQUEST);
}
$lookup = $w->Admin->getAllLookup($where);
$line[] = array("Type", "Code", "Title", "Actions");
if ($lookup) {
foreach ($lookup as $look) {
$line[] = array($look->type, $look->code, $look->title, Html::box($w->localUrl("/admin/editlookup/" . $look->id . "/" . urlencode($w->request('type'))), " Edit ", true) . " " . Html::b($w->webroot() . "/admin/deletelookup/" . $look->id . "/" . urlencode($w->request('type')), " Delete ", "Are you sure you wish to DELETE this Lookup item?"));
}
} else {
$line[] = array("No Lookup items to list", null, null, null);
}
// display list of items, if any
$w->ctx("listitem", Html::table($line, null, "tablesorter", true));
// tab: new lookup item
$types = $w->Admin->getLookupTypes();
$f = Html::form(array(array("Create a New Entry", "section"), array("Type", "select", "type", null, $types), array("or Add New Type", "text", "ntype"), array("Key", "text", "code"), array("Value", "text", "title")), $w->localUrl("/admin/newlookup/"), "POST", " Save ");
$w->ctx("newitem", $f);
}
示例8: printqueue_GET
function printqueue_GET(Web $w)
{
$print_folder = FILE_ROOT . "print";
$path = realpath($print_folder);
// Check if folder exists
if ($path === false) {
// Make print folder (If you specify a full path, use the recursion flag because it seems to crash without it in unix)
// Other wise you would need to chdir to the parent folder, create and change back to wherever execution currently was at
mkdir($print_folder, 0777, true);
$path = realpath($print_folder);
}
$exclude = array("THUMBS.db");
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
$table_data = array();
$table_header = array("Name", "Size", "Date Created", "Actions");
foreach ($objects as $name => $object) {
$filename = $object->getFilename();
// Ignore files starting with '.' and in exclude array
if ($filename[0] === '.' || in_array($filename, $exclude)) {
continue;
}
$table_data[] = array(Html::a("/uploads/print/" . $filename, $filename), humanReadableBytes($object->getSize()), date("H:i d/m/Y", filectime($name)), Html::box("/admin/printfile?filename=" . urlencode($name), "Print", true) . " " . Html::b("/admin/deleteprintfile?filename=" . urlencode($name), "Delete", "Are you sure you want to remove this file? (This is irreversible)"));
}
$w->out(Html::table($table_data, null, "tablesorter", $table_header));
}
示例9: viewtaskgrouptypes_ALL
function viewtaskgrouptypes_ALL(Web $w)
{
$w->Task->navigation($w, "Manage Task Groups");
History::add("Manage Task Groups");
$task_groups = $w->Task->getTaskGroups();
if ($task_groups) {
usort($task_groups, array("TaskService", "sortbyGroup"));
}
// prepare column headings for display
$line = array(array("Title", "Type", "Description", "Default Assignee"));
// if task group exists, display title, group type, description, default assignee and button for specific task group info
if ($task_groups) {
foreach ($task_groups as $group) {
$line[] = array(Html::a(WEBROOT . "/task-group/viewmembergroup/" . $group->id, $group->title), $group->getTypeTitle(), $group->description, $group->getDefaultAssigneeName());
}
} else {
// if no groups for this group type, say as much
$line[] = array("There are no Task Groups Configured. Please create a New Task Group.", "", "", "", "");
}
// display list of task groups in the target task group type
$w->ctx("dashboard", Html::table($line, null, "tablesorter", true));
// tab: new task group
// get generic task group permissions
$arrassign = $w->Task->getTaskGroupPermissions();
// unset 'ALL' given all can never assign a task
unset($arrassign[0]);
// set Is Task Active dropdown
$is_active = array(array("Yes", "1"), array("No", "0"));
$grouptypes = $w->Task->getAllTaskGroupTypes();
// build form to create a new task group within the target group type
$f = Html::form(array(array("Task Group Attributes", "section"), array("Task Group Type", "select", "task_group_type", null, $grouptypes), array("Title", "text", "title"), array("Who Can Assign", "select", "can_assign", null, $arrassign), array("Who Can View", "select", "can_view", null, $w->Task->getTaskGroupPermissions()), array("Who Can Create", "select", "can_create", null, $w->Task->getTaskGroupPermissions()), array("Active", "select", "is_active", null, $is_active), array("", "hidden", "is_deleted", "0"), array("Description", "textarea", "description", null, "26", "6"), array("Default Assignee", "select", "default_assignee_id", null, $w->Auth->getUsers())), $w->localUrl("/task-group/createtaskgroup"), "POST", "Save");
// display form
$w->ctx("creategroup", $f);
}
示例10: edit
/**
* Displays a form for updating a role name and a table of available permissions that
* can be checked to add to the role.
*/
public static function edit($id)
{
$role = User::role()->find($id);
if (isset($_POST['update_role'])) {
if ($_POST['name'] == $role->name || !User::role()->where('name', 'LIKE', $_POST['name'])->first()) {
$status = User::role()->where('id', '=', $id)->update(array('name' => $_POST['name']));
if ($status) {
Message::ok('Role updated successfully.');
$role->name = $_POST['name'];
// Set updated name for form
} else {
Message::info('Nothing changed.');
}
} else {
Message::error('A role with that name is already in use.');
}
}
if (isset($_POST['update_perms'])) {
User::permission()->where('role_id', '=', $role->id)->delete();
if (isset($_POST['permissions'])) {
foreach ($_POST['permissions'] as $permission) {
User::permission()->insert(array('role_id' => $id, 'permission' => $permission));
}
}
Message::ok('Permissions updated successfully.');
}
$fields[] = array('fields' => array('name' => array('title' => 'Name', 'type' => 'text', 'default_value' => $role->name, 'validate' => array('required')), 'update_role' => array('value' => 'Update Role', 'type' => 'submit')));
$formHtml = Html::form()->build($fields);
$table = Html::table();
$table->addHeader()->addCol('Module Roles', array('colspan' => 2));
$sortedPermissions = User::getSortedPermissions();
$setPermissions = User::permission()->where('role_id', '=', $id)->all();
$tmp = array();
foreach ($setPermissions as $ap) {
$tmp[] = $ap->permission;
}
$setPermissions = $tmp;
foreach ($sortedPermissions as $module => $modulePermissions) {
$nameRow = $table->addRow();
$nameRow->addCol(sprintf('<strong>%s</strong>', ucfirst($module)), array('colspan' => 2));
foreach ($modulePermissions as $permission => $desc) {
$fieldRow = $table->addRow();
$checked = in_array($permission, $setPermissions) ? ' checked="checked"' : '';
$fieldRow->addCol('<input type="checkbox" name="permissions[]" value="' . $permission . '"' . $checked . ' />', array('width' => 10));
$fieldRow->addCol($desc);
}
}
// TODO This is a bit hacky, figure a better way to make tables into forms
$tableHtml = Html::form()->open(null, 'post', false, array('name' => 'perms', 'id' => 'perms'));
$tableHtml .= $table->render();
$tableHtml .= '<div class="buttons">';
$tableHtml .= '<input type="hidden" name="update_perms" value="true" />';
$tableHtml .= '<a class="blue btn submitter" href="#">Update Permissions</a>';
$tableHtml .= '</div>';
$tableHtml .= Html::form()->close();
return array(array('title' => 'Edit Role', 'content' => $formHtml), array('title' => 'Edit Role Permissions', 'content' => $tableHtml));
}
示例11: index_GET
function index_GET($w)
{
$w->Admin->navigation($w, "Templates");
$templates = $w->Template->findTemplates();
$table_header = array("Title", "Module", "Category", array("Active?", true), array("Created", true), array("Modified", true), "Actions");
$table_data = array();
if (!empty($templates)) {
foreach ($templates as $t) {
$table_data[] = array($t->title, $t->module, $t->category, array($t->is_active ? "Active" : "Inactive", true), array(Date("H:i d-m-Y", $t->dt_created), true), array(Date("H:i d-m-Y", $t->dt_modified), true), Html::b("/admin-templates/edit/" . $t->id, "Edit", false));
}
}
$w->ctx("templates_table", Html::table($table_data, null, "tablesorter", $table_header));
}
示例12: index_ALL
function index_ALL(Web $w)
{
$connections = $w->Report->getConnections();
$table_header = array("Driver", "Host", "Database", "Port", "Username", "Actions");
$table_body = array();
if (!empty($connections)) {
foreach ($connections as $conn) {
$conn->decrypt();
$table_body[] = array($conn->db_driver, $conn->db_host, $conn->db_database, $conn->db_port, $conn->s_db_user, Html::box("/report-connections/test/{$conn->id}", "Test Connection", true) . Html::box("/report-connections/edit/{$conn->id}", "Edit", true) . Html::b("/report-connections/delete/{$conn->id}", "Delete", "Are you sure you want to remove this connection?"));
}
}
$w->ctx("connections_table", Html::table($table_body, null, "tablesorter", $table_header));
}
示例13: render
function render($array)
{
if (!is_array($array)) {
return false;
}
$table = '';
foreach ($array as $name => $value) {
if (is_array($value)) {
$table .= Html::tr(Html::td(Html::escape($name)) . Html::td($this->render($value)));
continue;
}
$table .= Html::tr(Html::td($this->html($name)) . Html::td($this->html($value)));
}
return Html::table($table);
}
示例14: manage
/**
* Displays a table of languages to be supported.
*
* Route: admin/multilanguage/languages/manage
*/
public static function manage()
{
$table = Html::table();
$table->addHeader()->addCol('Languages', array('colspan' => 2));
$langs = Multilanguage::language()->orderBy('name')->all();
if ($langs) {
foreach ($langs as $lang) {
$row = $table->addRow();
$row->addCol(Html::a()->get($lang->name, 'admin/multilanguage/languages/edit/' . $lang->id));
$row->addCol(Html::a('Delete', 'admin/multilanguage/languages/delete/' . $lang->id, array('onclick' => "return confirm('Delete this language?')")), array('class' => 'right'));
}
} else {
$table->addRow()->addCol('<em>No languages</em>', array('colspan' => 2));
}
return array('title' => 'Manage Languages', 'content' => $table->render());
}
示例15: viewmembergroup_GET
function viewmembergroup_GET(Web $w)
{
$p = $w->pathMatch("id");
// tab: Members
// get all members in a task group given a task group ID
$member_group = $w->Task->getMemberGroup($p['id']);
// get the group attributes given a task group ID
$group = $w->Task->getTaskGroup($p['id']);
// put the group title into the page heading
$w->Task->navigation($w, "Task Group - " . $group->title);
History::add("Task Group: " . $group->title);
// set columns headings for display of members
$line[] = array("Member", "Role", "");
// if their are members, display their full name, role and buttons to edit or delete the member
if ($member_group) {
foreach ($member_group as $member) {
$line[] = array($w->Task->getUserById($member->user_id), $member->role, Html::box(WEBROOT . "/task-group/viewmember/" . $member->id, " Edit ", true) . " " . Html::box(WEBROOT . "/task-group/deletegroupmember/" . $member->id, " Delete ", true));
}
} else {
// if there are no members, say as much
$line[] = array("Group currently has no members. Please Add New Members.", "", "");
}
// enter task group attributes sa query string for buttons providing group specific functions such as delete or add members
$w->ctx("taskgroup", $group->task_group_type);
$w->ctx("grpid", $group->id);
$w->ctx("groupid", $p['id']);
// display list of group members
$w->ctx("viewmembers", Html::table($line, null, "tablesorter", true));
// tab: Notify
$notify = $w->Task->getTaskGroupNotify($group->id);
if ($notify) {
foreach ($notify as $n) {
$v[$n->role][$n->type] = $n->value;
}
} else {
$v['guest']['creator'] = 0;
$v['member']['creator'] = 0;
$v['member']['assignee'] = 0;
$v['owner']['creator'] = 0;
$v['owner']['assignee'] = 0;
$v['owner']['other'] = 0;
}
$notifyForm['Task Group Notifications'] = array(array(array("", "hidden", "task_group_id", $group->id)), array(array("", "static", ""), array("Creator", "static", "creator"), array("Assignee", "static", "assignee"), array("All Others", "static", "others")), array(array("Guest", "static", "guest"), array("", "checkbox", "guest_creator", $v['guest']['creator'])), array(array("Member", "static", "member"), array("", "checkbox", "member_creator", $v['member']['creator']), array("", "checkbox", "member_assignee", $v['member']['assignee'])), array(array("Owner", "static", "owner"), array("", "checkbox", "owner_creator", $v['owner']['creator']), array("", "checkbox", "owner_assignee", $v['owner']['assignee']), array("", "checkbox", "owner_other", $v['owner']['other'])));
$w->ctx("notifymatrix", Html::multiColForm($notifyForm, $w->localUrl("/task-group/updategroupnotify/"), "POST", " Submit "));
}