本文整理汇总了PHP中html_writer::table方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::table方法的具体用法?PHP html_writer::table怎么用?PHP html_writer::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_files_tree_viewer
public function render_files_tree_viewer(files_tree_viewer $tree)
{
$html = $this->output->heading_with_help(get_string('coursefiles'), 'courselegacyfiles', 'moodle');
$html .= $this->output->container_start('coursefilesbreadcrumb');
foreach ($tree->path as $path) {
$html .= $path;
$html .= ' / ';
}
$html .= $this->output->container_end();
$html .= $this->output->box_start();
$table = new html_table();
$table->head = array(get_string('filename', 'backup'), get_string('size'), get_string('modified'));
$table->align = array('left', 'right', 'right');
$table->width = '100%';
$table->data = array();
foreach ($tree->tree as $file) {
if (!empty($file['isdir'])) {
$table->data[] = array(html_writer::link($file['url'], $this->output->pix_icon('f/folder', 'icon') . ' ' . $file['filename']), '', $file['filedate']);
} else {
$table->data[] = array(html_writer::link($file['url'], $this->output->pix_icon('f/' . mimeinfo('icon', $file['filename']), get_string('icon')) . ' ' . $file['filename']), $file['filesize'], $file['filedate']);
}
}
$html .= html_writer::table($table);
$html .= $this->output->single_button(new moodle_url('/files/coursefilesedit.php', array('contextid' => $tree->context->id)), get_string('coursefilesedit'), 'get');
$html .= $this->output->box_end();
return $html;
}
示例2: facetoface_send_admin_upgrade_msg
/**
*
* Sends message to administrator listing all updated
* duplicate custom fields
* @param array $data
*/
function facetoface_send_admin_upgrade_msg($data)
{
global $SITE;
// No data - no need to send email.
if (empty($data)) {
return;
}
$table = new html_table();
$table->head = array('Custom field ID', 'Custom field original shortname', 'Custom field new shortname');
$table->data = $data;
$table->align = array('center', 'center', 'center');
$title = "{$SITE->fullname}: Face to Face upgrade info";
$note = 'During the last site upgrade the face-to-face module has been modified. It now
requires session custom fields to have unique shortnames. Since some of your
custom fields had duplicate shortnames, they have been renamed to remove
duplicates (see table below). This could impact on your email messages if you
reference those custom fields in the message templates.';
$message = html_writer::start_tag('html');
$message .= html_writer::start_tag('head') . html_writer::tag('title', $title) . html_writer::end_tag('head');
$message .= html_writer::start_tag('body');
$message .= html_writer::tag('p', $note) . html_writer::table($table, true);
$message .= html_writer::end_tag('body');
$message .= html_writer::end_tag('html');
$admin = get_admin();
email_to_user($admin, $admin, $title, '', $message);
}
示例3: definition
function definition() {
$mform =& $this->_form;
$contextid = $this->_customdata['contextid'];
$export = $mform->addElement('hidden', 'export', ''); // Will be overwritten below
$table = new html_table();
/* Styling done using HTML table and CSS */
$table->attributes['class'] = 'export_form_table';
$table->align = array('left', 'left', 'left', 'center');
$table->wrap = array('nowrap', '', 'nowrap', 'nowrap');
$table->data = array();
$table->head = array(get_string('name'),
get_string('description'),
get_string('shortname'),
get_string('export', 'report_rolesmigration'));
$roles = get_all_roles();
foreach ($roles as $role) {
$row = array();
$roleurl = new moodle_url('/admin/roles/define.php', array('roleid' => $role->id, 'action' => 'view'));
$row[0] = '<a href="'.$roleurl.'">'.format_string($role->name).'</a>';
$row[1] = format_text($role->description, FORMAT_HTML);
$row[2] = ($role->shortname);
/* Export values are added from role checkboxes */
$row[3] = '<input type="checkbox" name="export[]" value="'.$role->shortname.'" />';
$table->data[] = $row;
}
$mform->addElement('html', html_writer::table($table));
$mform->addElement('hidden', 'contextid', $contextid);
$this->add_action_buttons(false, get_string('submitexport', 'report_rolesmigration'));
}
示例4: display_exams_list
/**
* Function to display a teacher's available exams. This uses all the
* courses that a teacher is enrolled in and checks which course has
* exams related to it. Shows the exam, the date and adds a
*/
function display_exams_list()
{
global $DB, $CFG, $USER;
$IP_Address = $tableName = 'Exams';
$user_table = 'user';
$table = new html_table();
$table->head = array('Course', 'Date', 'Navigation');
$table->tablealign = 'center';
$table->width = '100%';
$user_courses = enrol_get_users_courses($USER->id, true, '*', 'visible DESC,sortorder ASC');
/**
* Checks the teachers courses with available tests and if exists add to the main page.
*/
foreach ($user_courses as $uc) {
$rec = $DB->get_records_sql('SELECT booklet_id, year_semester_origin
FROM {mem_booklet_data}
WHERE course_id=?', array(intval($uc->id)));
$row_info = array();
if (count($rec) > 0) {
$row = new html_table_row(array($uc->fullname, current($rec)->year_semester_origin, '<div style="text-align: center"><a href=' . $CFG->wwwroot . '/local/memplugin/grid.php?course_id=' . intval($uc->id) . '>' . get_string('startmarking', 'local_memplugin') . '</a></div>'));
$table->data[] = $row;
}
}
echo html_writer::table($table);
}
示例5: class_settings_show_table
function class_settings_show_table($classes)
{
$table = new html_table();
//
$table->head[] = '#';
$table->align[] = 'center';
$table->size[] = '20px';
$table->wrap[] = 'nowrap';
$table->head[] = get_string('classname', 'block_autoattend');
$table->align[] = 'center';
$table->size[] = '60px';
$table->wrap[] = 'nowrap';
$table->head[] = get_string('delete');
$table->align[] = 'center';
$table->size[] = '60px';
$table->wrap[] = 'nowrap';
//
$i = 0;
foreach ($classes as $class) {
$classid_input = '<input type="hidden" name="classids[' . $i . ']" value="' . $class->id . '" />';
$table->data[$i][] = $i + 1;
$table->data[$i][] = '<input type="text" name="classnames[' . $i . ']" size="24" maxlength="32" value="' . $class->name . '" />';
$table->data[$i][] = '<input type="checkbox" name="classdels[' . $i . ']" value="1" />' . $classid_input;
$i++;
}
echo '<div align="center">';
echo html_writer::table($table);
echo '</div>';
return $i;
}
示例6: set_default_entry_template
/**
* Generates the default entry template for a new view instance or when reseting an existing instance.
*
* @return void
*/
public function set_default_entry_template($content = null)
{
// Get all the fields.
if (!($fields = $this->df->field_manager->get_fields())) {
return;
}
if ($content === null) {
// Set content.
$table = new html_table();
$table->attributes['align'] = 'center';
$table->attributes['cellpadding'] = '2';
// Fields.
foreach ($fields as $field) {
if ($field->id > 0) {
$name = new html_table_cell($field->name . ':');
$name->style = 'text-align:right;';
$content = new html_table_cell("[[{$field->name}]]");
$row = new html_table_row();
$row->cells = array($name, $content);
$table->data[] = $row;
}
}
// Actions.
$row = new html_table_row();
$entryactions = get_string('fieldname', 'dataformfield_entryactions');
$actions = new html_table_cell("[[{$entryactions}:edit]] [[{$entryactions}:delete]]");
$actions->colspan = 2;
$row->cells = array($actions);
$table->data[] = $row;
// Construct the table.
$entrydefault = html_writer::table($table);
$content = html_writer::tag('div', $entrydefault, array('class' => 'entry'));
}
$this->param2 = $content;
}
示例7: user_rss_token_box
/**
* Display user tokens with buttons to reset them
* @param object $tokens
* @param int $userid
* @return string html code
*/
public function user_rss_token_box($token) {
global $OUTPUT, $CFG;
// display strings
$stroperation = get_string('operation', 'webservice');
$strtoken = get_string('key', 'webservice');
$return = $OUTPUT->heading(get_string('rss'), 3, 'main', true);
$return .= $OUTPUT->box_start('generalbox webservicestokenui');
$return .= get_string('rsskeyshelp');
$table = new html_table();
$table->head = array($strtoken, $stroperation);
$table->align = array('left', 'center');
$table->width = '100%';
$table->data = array();
if (!empty($token)) {
$reset = "<a href=\"".$CFG->wwwroot."/user/managetoken.php?sesskey=".sesskey().
"&action=resetrsstoken\">".get_string('reset')."</a>";
$table->data[] = array($token, $reset);
$return .= html_writer::table($table);
} else {
$return .= get_string('notoken', 'webservice');
}
$return .= $OUTPUT->box_end();
return $return;
}
示例8: config_form_criteria
/**
* Add appropriate form elements to the criteria form
*
* @param stdClass $data details of overall criterion
*/
public function config_form_criteria($data)
{
global $OUTPUT;
$prefix = 'criteria-' . $this->id;
if (count($data->criteria) > 2) {
echo $OUTPUT->box_start();
if (!empty($this->description)) {
$badge = new badge($this->badgeid);
echo $OUTPUT->box(format_text($this->description, $this->descriptionformat, array('context' => $badge->get_context())), 'criteria-description');
}
echo $OUTPUT->heading($this->get_title(), 2);
$agg = $data->get_aggregation_methods();
if (!$data->is_locked() && !$data->is_active()) {
$editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
$editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
echo $OUTPUT->box($editaction, array('criteria-header'));
$url = new moodle_url('criteria.php', array('id' => $data->id, 'sesskey' => sesskey()));
$table = new html_table();
$table->attributes = array('class' => 'clearfix');
$table->colclasses = array('', 'activatebadge');
$table->data[] = array($OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null), get_string('overallcrit', 'badges'));
echo html_writer::table($table);
} else {
echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
}
echo $OUTPUT->box_end();
}
}
示例9: definition
public function definition()
{
global $USER, $cm;
if (is_array($locations = praxe_get_available_locations($USER->id, praxe_record::getData('isced'), praxe_record::getData('studyfield'))) && count($locations)) {
//$mform =& $this->_form;
$this->content_before_form .= get_string('assigntolocation_text_forstudents', 'praxe');
$form = '<form class="mform" action="' . praxe_get_base_url() . '" method="post">';
$form .= '<input type="hidden" name="post_form" value="assignlocation" />';
$form .= '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
$table = new stdClass();
$table->head = array('', get_string('school', 'praxe'), get_string('subject', 'praxe'), get_string('teacher', 'praxe'));
$table->align = array('center', 'left', 'center', 'center');
foreach ($locations as $loc) {
$row = array('<input id="praxe_loc_' . $loc->id . '" type="radio" name="location" value="' . $loc->id . '" />');
$sch = "<a href=\"" . praxe_get_base_url(array('viewaction' => 'viewschool', 'schoolid' => $loc->school)) . "\" title=\"" . get_string('school_detail', 'praxe') . "\">" . s($loc->name) . "</a>";
$sch .= "<div class=\"praxe_detail\">" . s($loc->street) . ', ' . s($loc->city) . "</div>";
$row[] = $sch;
$row[] = s($loc->subject);
if (!is_null($loc->teacherid)) {
$teacher = (object) array('id' => $loc->teacherid, 'firstname' => s($loc->teacher_name), 'lastname' => s($loc->teacher_lastname));
$row[] = praxe_get_user_fullname($teacher);
} else {
$row[] = '';
}
$table->data[] = $row;
//$row .= '<label for="praxe_loc_'.$loc->id.'">'.$text.'</label>';
//$form .= "<div class=\"tr\">$row</div>";
}
$form .= html_writer::table($table, true);
$form .= '<div class="fitem center" style="margin: 10px 0;">' . '<input type="submit" id="id_submitbutton" value="Submit" name="submitbutton" /> ' . '<input type="submit" id="id_cancel" onclick="skipClientValidation = true; return true;" value="Cancel" name="cancel" />' . '</div>';
$form .= '</form>';
$this->content .= "<div>{$form}</div>";
//$mform->addElement('header', null, get_string('locations', 'praxe'));
/*
$options = array();
$radioarray = array();
foreach($locations as $loc) {
//print_object($loc);
$link = "<a target='_blank' href='view.php?id=$cm->id&praxeaction=viewschool&schoolid=$loc->school' title='".get_string('school_detail','praxe')."'>".get_string('school_detail','praxe')."</a>";
$text = s($loc->name) . "($link) - " . s($loc->subject);
$text .= "<br>".s($loc->street).', '.s($loc->zip).' '.s($loc->city);
if(!is_null($loc->teacherid)) {
$teacher = (object) array('id' => $loc->teacherid, 'firstname' => s($loc->teacher_name), 'lastname' => s($loc->teacher_lastname));
$text .= " (".praxe_get_user_fullname($teacher).")";
}
$radioarray[] = $mform->createElement('radio', 'location', null, $text, $loc->id, array('class'=>'radio location'));
}
$mform->addGroup($radioarray, 'location', get_string('locations','praxe').':', '<hr>', false);
$mform->addRule('location', get_string('locationisrequired', 'praxe'), 'required', null, 'client');
$mform->addRule('location', get_string('locationisrequired', 'praxe'), 'required', null, 'server');
//$mform->addElement('select', 'location', get_string('chooselocation', 'praxe'), $options, array('size' => count($options) > 15 ? '15' : count($options)+1));
$mform->addElement('hidden', 'post_form', 'assigntolocation');
*/
//$this->add_action_buttons(true, get_string('submit'));
} else {
$this->content_before_form .= get_string('nolocationsavailable', 'praxe');
}
}
示例10: import_preview_page
/**
* A renderer for the CSV file preview.
*
* @param array $header Column headers from the CSV file.
* @param array $data The rest of the data from the CSV file.
* @return string html to be displayed.
*/
public function import_preview_page($header, $data)
{
$html = $this->output->heading(get_string('importpreview', 'grades'));
$table = new html_table();
$table->head = $header;
$table->data = $data;
$html .= html_writer::table($table);
return $html;
}
示例11: render_course_enrolment_users_table
public function render_course_enrolment_users_table(course_enrolment_users_table $table, moodleform $mform)
{
$table->initialise_javascript();
// Added for the Bootstrap theme. Make this table responsive.
$table->attributes['class'] .= ' table table-responsive';
$buttons = $table->get_manual_enrol_buttons();
$buttonhtml = '';
if (count($buttons) > 0) {
$buttonhtml .= html_writer::start_tag('div', array('class' => 'enrol_user_buttons'));
foreach ($buttons as $button) {
$buttonhtml .= $this->render($button);
}
$buttonhtml .= html_writer::end_tag('div');
}
$content = '';
if (!empty($buttonhtml)) {
$content .= $buttonhtml;
}
$content .= $mform->render();
$content .= $this->output->render($table->get_paging_bar());
// Check if the table has any bulk operations. If it does we want to wrap the table in a
// form so that we can capture and perform any required bulk operations.
if ($table->has_bulk_user_enrolment_operations()) {
$content .= html_writer::start_tag('form', array('action' => new moodle_url('/enrol/bulkchange.php'), 'method' => 'post'));
foreach ($table->get_combined_url_params() as $key => $value) {
if ($key == 'action') {
continue;
}
$content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
}
$content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'bulkchange'));
$content .= html_writer::table($table);
$content .= html_writer::start_tag('div', array('class' => 'singleselect bulkuserop'));
$content .= html_writer::start_tag('select', array('name' => 'bulkuserop'));
$content .= html_writer::tag('option', get_string('withselectedusers', 'enrol'), array('value' => ''));
$options = array('' => get_string('withselectedusers', 'enrol'));
foreach ($table->get_bulk_user_enrolment_operations() as $operation) {
$content .= html_writer::tag('option', $operation->get_title(), array('value' => $operation->get_identifier()));
}
$content .= html_writer::end_tag('select');
$content .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
$content .= html_writer::end_tag('div');
$content .= html_writer::end_tag('form');
} else {
// Added for the Bootstrap theme, a no-overflow wrapper.
$content .= html_writer::start_tag('div', array('class' => 'no-overflow'));
$content .= html_writer::table($table);
$content .= html_writer::end_tag('div');
}
$content .= $this->output->render($table->get_paging_bar());
if (!empty($buttonhtml)) {
$content .= $buttonhtml;
}
return $content;
}
示例12: gsaml_print_config_table
function gsaml_print_config_table($heading, $table_obj)
{
global $OUTPUT;
$OUTPUT->heading($heading);
$conf_table = new html_table();
$conf_table->head = array('Setting', 'Value');
$conf_table->align = array('left', 'left');
$conf_table->data = array();
foreach ($table_obj as $setting => $value) {
$conf_table->data[] = array($setting, $value);
}
echo html_writer::table($conf_table);
}
示例13: get_users_table
/**
* Generates an HTML table to display the users being affected by the bulk change.
*
* @param array $users
* @param array $statusoptions
* @return string
*/
protected function get_users_table(array $users, array $statusoptions)
{
$table = new html_table();
$table->head = array(get_string('name'), get_string('participationstatus', 'enrol'), get_string('enroltimestart', 'enrol'), get_string('enroltimeend', 'enrol'));
$table->data = array();
foreach ($users as $user) {
foreach ($user->enrolments as $enrolment) {
$input = html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'bulkuser[]', 'value' => $user->id));
$table->data[] = array(fullname($user) . $input, $statusoptions[$enrolment->status], !empty($enrolment->timestart) ? userdate($enrolment->timestart) : '', !empty($enrolment->timeend) ? userdate($enrolment->timeend) : '');
}
}
return html_writer::table($table);
}
示例14: render_servicelist
public function render_servicelist($servicelist)
{
$table = new html_table();
$table->head = array('Plugin', 'Service name', 'Class', 'Description', 'Variable');
foreach ($servicelist as $plugin => $pluginservices) {
foreach ($pluginservices as $name => $pluginservice) {
$row = new html_table_row(array($plugin, $name, $pluginservice['classname']));
$row->cells[] = new html_table_cell(get_string("local_nagios:{$name}:description", $plugin));
$row->cells[] = new html_table_cell(get_string("local_nagios:{$name}:variable", $plugin));
$table->data[] = $row;
}
}
return html_writer::table($table);
}
示例15: block_users_team_userdetails
function block_users_team_userdetails(){
global $USER, $DB, $CFG, $OUTPUT, $PAGE;
$systemcontext = context_system::instance();
$sql = 'SELECT DISTINCT(f.name) AS batchname, f.id AS batchid, f.enrolled_users AS enrolled,f.active AS batchstatus
FROM {local_userdata} AS ud
JOIN {local_batch_users} AS bu ON bu.userid = ud.userid
JOIN {facetoface} AS f ON f.id = bu.f2fid
WHERE ud.supervisorid = '.$USER->id;
$records = $DB->get_records_sql($sql);
$output = '';
if(!empty($records)){
$row = array();
foreach($records as $record){
$list = array();
if($record->batchstatus==1){
$stat='<img class="pull-left batch_status" src="'.$CFG->wwwroot.'/mod/facetoface/pix/Active.png" title="'.get_string('active_batch', 'facetoface').'" alt="'.get_string('active_batch', 'facetoface').'">';
}
if($record->batchstatus==2){
$stat='<img class="pull-left batch_status" src="'.$CFG->wwwroot.'/mod/facetoface/pix/cancel.png" title="'.get_string('cancelled_batch', 'facetoface').'" alt="'.get_string('cancelled_batch', 'facetoface').'">';
}
if($record->batchstatus==8){
$stat='<img class="pull-left batch_status" src="'.$CFG->wwwroot.'/mod/facetoface/pix/Completed.png" title="'.get_string('completed_batch', 'facetoface').'" alt="'.get_string('completed_batch', 'facetoface').'">';
}
if($record->batchstatus==0){
$stat='<img class="pull-left batch_status" src="'.$CFG->wwwroot.'/mod/facetoface/pix/new.png" title="'.get_string('new_batch', 'facetoface').'" alt="'.get_string('new_batch', 'facetoface').'">';
}
if($record->batchstatus==3){
$stat='<img class="pull-left batch_status" src="'.$CFG->wwwroot.'/mod/facetoface/pix/Hold.png" title="'.get_string('hold_batch', 'facetoface').'" alt="'.get_string('hold_batch', 'facetoface').'">';
}
$completedcount = $DB->get_record_sql("SELECT count(userid) as completioncount from {local_batch_users} where f2fid=$record->batchid and confirmation=1");
$list['batchname'.$record->batchid] = $stat.$record->batchname;
$list['enroll'.$record->batchid] = $record->enrolled;
$list['completion'.$record->batchid] = $completedcount->completioncount;
$row[] = $list;
}
$table = new html_table();
$table->id = 'employee_batch_status';
$table->head = array(get_string('batchname', 'block_users_team'),
get_string('enrolled', 'block_users_team'),
get_string('completed', 'block_users_team'));
$table->align = array('left', 'center', 'center');
//$table->size = array('80%', '10%','10%');
$table->data = $row;
$output .= html_writer::table($table);
}else{
$output .= html_writer::tag('span',get_string('noemployees', 'block_users_team'),array('class' => 'empty_data_message'));
}
return $output;
}