本文整理汇总了PHP中html_writer::span方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::span方法的具体用法?PHP html_writer::span怎么用?PHP html_writer::span使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::span方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
/**
* Form definition
*/
public function definition()
{
$mform =& $this->_form;
$orphanedfiles = $this->_customdata['orphanedfiles'];
$filecount = count($orphanedfiles);
$directory = html_writer::span(get_string('directory', 'report_filetrash'), 'bold trashheader');
$name = html_writer::span(get_string('filename', 'report_filetrash'), 'bold trashheader');
$size = html_writer::span(get_string('filesize', 'report_filetrash'), 'bold trashheader');
$extensionheader = html_writer::span(get_string('extension', 'report_filetrash'), 'bold trashheader');
if ($filecount > 0) {
$i = 0;
$mform->addElement('checkbox', 'selectall', get_string('selectall', 'report_filetrash'));
foreach ($orphanedfiles as $file) {
$i++;
$filepath = $file['filepath'];
$filename = $file['filename'];
$filekey = $file['filekey'];
$filesize = $file['filesize'];
$extension = $file['extension'];
$link = new moodle_url('/report/filetrash/file.php', array('filepath' => $filepath, 'filename' => $filename));
$filelink = html_writer::link($link, $filename);
$header = html_writer::div($directory . $filepath);
$body = html_writer::div($name . $filelink);
if (empty($extension)) {
$extensiondetails = '';
} else {
$extensiondetails = html_writer::div($extensionheader . $extension);
}
$footer = html_writer::div($size . $filesize);
$filedetails = html_writer::div($header . $body . $extensiondetails . $footer, 'filetrashdetails');
$mform->addElement('checkbox', 'orphan_' . $filekey, $i . '. ', $filedetails);
}
$mform->addElement('submit', 'submit', get_string('delete'), 'submit', null);
} else {
$mform->addElement('static', 'nofiles', '', get_string('nofiles', 'report_filetrash'));
}
}
示例2: course_selector
/**
* Displays a course selector for restore
*
* @param moodle_url $nextstageurl
* @param bool $wholecourse true if we are restoring whole course (as with backup::TYPE_1COURSE), false otherwise
* @param restore_category_search $categories
* @param restore_course_search $courses
* @param int $currentcourse
* @return string
*/
public function course_selector(moodle_url $nextstageurl, $wholecourse = true, restore_category_search $categories = null, restore_course_search $courses = null, $currentcourse = null)
{
global $CFG, $PAGE;
require_once $CFG->dirroot . '/course/lib.php';
// These variables are used to check if the form using this function was submitted.
$target = optional_param('target', false, PARAM_INT);
$targetid = optional_param('targetid', null, PARAM_INT);
// Check if they submitted the form but did not provide all the data we need.
$missingdata = false;
if ($target and is_null($targetid)) {
$missingdata = true;
}
$nextstageurl->param('sesskey', sesskey());
$form = html_writer::start_tag('form', array('method' => 'post', 'action' => $nextstageurl->out_omit_querystring(), 'class' => 'mform'));
foreach ($nextstageurl->params() as $key => $value) {
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
}
$hasrestoreoption = false;
$html = html_writer::start_tag('div', array('class' => 'backup-course-selector backup-restore'));
if ($wholecourse && !empty($categories) && ($categories->get_count() > 0 || $categories->get_search())) {
// New course
$hasrestoreoption = true;
$html .= $form;
$html .= html_writer::start_tag('div', array('class' => 'bcs-new-course backup-section'));
$html .= $this->output->heading(get_string('restoretonewcourse', 'backup'), 2, array('class' => 'header'));
$html .= $this->backup_detail_input(get_string('restoretonewcourse', 'backup'), 'radio', 'target', backup::TARGET_NEW_COURSE, array('checked' => 'checked'));
$selectacategoryhtml = $this->backup_detail_pair(get_string('selectacategory', 'backup'), $this->render($categories));
// Display the category selection as required if the form was submitted but this data was not supplied.
if ($missingdata && $target == backup::TARGET_NEW_COURSE) {
$html .= html_writer::span(get_string('required'), 'error');
$html .= html_writer::start_tag('fieldset', array('class' => 'error'));
$html .= $selectacategoryhtml;
$html .= html_writer::end_tag('fieldset');
} else {
$html .= $selectacategoryhtml;
}
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
$html .= html_writer::end_tag('div');
$html .= html_writer::end_tag('form');
}
if ($wholecourse && !empty($currentcourse)) {
// Current course
$hasrestoreoption = true;
$html .= $form;
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'targetid', 'value' => $currentcourse));
$html .= html_writer::start_tag('div', array('class' => 'bcs-current-course backup-section'));
$html .= $this->output->heading(get_string('restoretocurrentcourse', 'backup'), 2, array('class' => 'header'));
$html .= $this->backup_detail_input(get_string('restoretocurrentcourseadding', 'backup'), 'radio', 'target', backup::TARGET_CURRENT_ADDING, array('checked' => 'checked'));
$html .= $this->backup_detail_input(get_string('restoretocurrentcoursedeleting', 'backup'), 'radio', 'target', backup::TARGET_CURRENT_DELETING);
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
$html .= html_writer::end_tag('div');
$html .= html_writer::end_tag('form');
}
// If we are restoring an activity, then include the current course.
if (!$wholecourse) {
$courses->invalidate_results();
// Clean list of courses.
$courses->set_include_currentcourse();
}
if (!empty($courses) && ($courses->get_count() > 0 || $courses->get_search())) {
// Existing course
$hasrestoreoption = true;
$html .= $form;
$html .= html_writer::start_tag('div', array('class' => 'bcs-existing-course backup-section'));
$html .= $this->output->heading(get_string('restoretoexistingcourse', 'backup'), 2, array('class' => 'header'));
if ($wholecourse) {
$html .= $this->backup_detail_input(get_string('restoretoexistingcourseadding', 'backup'), 'radio', 'target', backup::TARGET_EXISTING_ADDING, array('checked' => 'checked'));
$html .= $this->backup_detail_input(get_string('restoretoexistingcoursedeleting', 'backup'), 'radio', 'target', backup::TARGET_EXISTING_DELETING);
} else {
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'target', 'value' => backup::TARGET_EXISTING_ADDING));
}
$selectacoursehtml = $this->backup_detail_pair(get_string('selectacourse', 'backup'), $this->render($courses));
// Display the course selection as required if the form was submitted but this data was not supplied.
if ($missingdata && $target == backup::TARGET_EXISTING_ADDING) {
$html .= html_writer::span(get_string('required'), 'error');
$html .= html_writer::start_tag('fieldset', array('class' => 'error'));
$html .= $selectacoursehtml;
$html .= html_writer::end_tag('fieldset');
} else {
$html .= $selectacoursehtml;
}
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
$html .= html_writer::end_tag('div');
$html .= html_writer::end_tag('form');
}
if (!$hasrestoreoption) {
echo $this->output->notification(get_string('norestoreoptions', 'backup'));
}
$html .= html_writer::end_tag('div');
return $html;
//.........这里部分代码省略.........
示例3: search_listitem_actions
/**
* Renderers actions for individual course actions.
*
* @param course_in_list $course The course to renderer actions for.
* @return string
*/
public function search_listitem_actions(course_in_list $course)
{
$baseurl = new moodle_url('/course/managementsearch.php', array('courseid' => $course->id, 'categoryid' => $course->category, 'sesskey' => sesskey()));
$actions = array();
// Edit.
if ($course->can_access()) {
if ($course->can_edit()) {
$actions[] = $this->output->action_icon(new moodle_url('/course/edit.php', array('id' => $course->id)), new pix_icon('t/edit', get_string('edit')), null, array('class' => 'action-edit'));
}
// Show/Hide.
if ($course->can_change_visibility()) {
if ($course->visible) {
$actions[] = $this->output->action_icon(new moodle_url($baseurl, array('action' => 'hidecourse')), new pix_icon('t/show', get_string('hide')), null, array('data-action' => 'hide', 'class' => 'action-hide'));
} else {
$actions[] = $this->output->action_icon(new moodle_url($baseurl, array('action' => 'showcourse')), new pix_icon('t/hide', get_string('show')), null, array('data-action' => 'show', 'class' => 'action-show'));
}
}
}
if (empty($actions)) {
return '';
}
return html_writer::span(join('', $actions), 'course-item-actions item-actions');
}
示例4: display_add_field
function display_add_field($recordid = 0, $formdata = null)
{
global $DB, $OUTPUT;
if ($formdata) {
$fieldname = 'field_' . $this->field->id;
$content = $formdata->{$fieldname};
} else {
if ($recordid) {
$content = $DB->get_field('data_content', 'content', array('fieldid' => $this->field->id, 'recordid' => $recordid));
$content = trim($content);
} else {
$content = '';
}
}
$str = '<div title="' . s($this->field->description) . '">';
$options = array();
$rawoptions = explode("\n", $this->field->param1);
foreach ($rawoptions as $option) {
$option = trim($option);
if (strlen($option) > 0) {
$options[$option] = $option;
}
}
$str .= '<label for="' . 'field_' . $this->field->id . '">';
$str .= html_writer::span($this->field->name, 'accesshide');
if ($this->field->required) {
$image = html_writer::img($OUTPUT->pix_url('req'), get_string('requiredelement', 'form'), array('class' => 'req', 'title' => get_string('requiredelement', 'form')));
$str .= html_writer::div($image, 'inline-req');
}
$str .= '</label>';
$str .= html_writer::select($options, 'field_' . $this->field->id, $content, array('' => get_string('menuchoose', 'data')), array('id' => 'field_' . $this->field->id, 'class' => 'mod-data-input custom-select'));
$str .= '</div>';
return $str;
}
示例5: definition_after_data
/**
* This method implements changes to the form that need to be made once the form data is set.
*/
public function definition_after_data()
{
$mform = $this->_form;
if ($userfullnames = $mform->getElementValue('userfullnames')) {
$mform->getElement('selectednames')->setValue(\html_writer::span($userfullnames, 'selectednames'));
}
}
示例6: replacebookmarkplaceholder
private static function replacebookmarkplaceholder($template, $dataid)
{
$bookmarklink = \html_writer::link('#', get_string('bookmark', 'block_databasebookmarks'), array('class' => 'data_bookmark_link', 'data-moreurl' => '##moreurl##'));
$bookmarkspan = \html_writer::span($bookmarklink, 'data_bookmark_wrapper');
$template = str_replace('##bookmark##', $bookmarkspan, $template);
return $template;
}
示例7: 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()));
echo $OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null, null, array('aria-describedby' => 'overall'));
echo html_writer::span(get_string('overallcrit', 'badges'), '', array('id' => 'overall'));
} else {
echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
}
echo $OUTPUT->box_end();
}
}
示例8: selected_plugintype_mismatch
/**
* Warn that the selected plugin type does not match the detected one.
*
* @param string $detected detected plugin type
*/
public function selected_plugintype_mismatch($detected)
{
$mform = $this->_form;
$mform->addRule('plugintype', get_string('required'), 'required', null, 'client');
$mform->setAdvanced('plugintype', false);
$mform->setAdvanced('permcheck', false);
$mform->insertElementBefore($mform->createElement('static', 'selectedplugintypemismatch', '', html_writer::span(get_string('typedetectionmismatch', 'tool_installaddon', $detected), 'error')), 'permcheck');
}
示例9: detail_pair
protected function detail_pair($key, $value, $class = '')
{
$html = html_writer::start_div('detail-pair row ' . preg_replace('#[^a-zA-Z0-9_\\-]#', '-', $class));
$html .= html_writer::div(html_writer::span($key), 'pair-key col-sm-3');
$html .= html_writer::div(html_writer::span($value), 'pair-value col-sm-9');
$html .= html_writer::end_div();
return $html;
}
示例10: detail_pair
/**
* Renderers a key value pair of information for display.
*
* @param string $key
* @param string $value
* @param string $class
* @return string
*/
protected function detail_pair($key, $value, $class = '')
{
$html = html_writer::start_div('detail-pair row yui3-g ' . preg_replace('#[^a-zA-Z0-9_\\-]#', '-', $class));
$html .= html_writer::div(html_writer::span($key), 'pair-key span4 yui3-u-1-4');
$html .= html_writer::div(html_writer::span($value), 'pair-value span8 yui3-u-3-4');
$html .= html_writer::end_div();
return $html;
}
示例11: require_explicit_plugintype
/**
* Switch the form to a mode that requires manual selection of the plugin type
*/
public function require_explicit_plugintype()
{
$mform = $this->_form;
$mform->addRule('plugintype', get_string('required'), 'required', null, 'client');
$mform->setAdvanced('plugintype', false);
$mform->setAdvanced('permcheck', false);
$typedetectionfailed = $mform->createElement('static', 'typedetectionfailed', '', html_writer::span(get_string('typedetectionfailed', 'tool_installaddon'), 'error'));
$mform->insertElementBefore($typedetectionfailed, 'permcheck');
}
示例12: capability_comparison_table
/**
* Produces a table to visually compare roles and capabilities.
*
* @param array $capabilities An array of capabilities to show comparison for.
* @param int $contextid The context we are displaying for.
* @param array $roles An array of roles to show comparison for.
* @return string
*/
public function capability_comparison_table(array $capabilities, $contextid, array $roles)
{
$strpermissions = $this->get_permission_strings();
$permissionclasses = $this->get_permission_classes();
if ($contextid === context_system::instance()->id) {
$strpermissions[CAP_INHERIT] = new lang_string('notset', 'role');
}
$table = new html_table();
$table->attributes['class'] = 'comparisontable';
$table->head = array(' ');
foreach ($roles as $role) {
$url = new moodle_url('/admin/roles/define.php', array('action' => 'view', 'roleid' => $role->id));
$table->head[] = html_writer::div(html_writer::link($url, $role->localname));
}
$table->data = array();
foreach ($capabilities as $capability) {
$contexts = tool_capability_calculate_role_data($capability, $roles);
$captitle = new html_table_cell(get_capability_string($capability) . html_writer::span($capability));
$captitle->header = true;
$row = new html_table_row(array($captitle));
foreach ($roles as $role) {
if (isset($contexts[$contextid]->rolecapabilities[$role->id])) {
$permission = $contexts[$contextid]->rolecapabilities[$role->id];
} else {
$permission = CAP_INHERIT;
}
$cell = new html_table_cell($strpermissions[$permission]);
$cell->attributes['class'] = $permissionclasses[$permission];
$row->cells[] = $cell;
}
$table->data[] = $row;
}
// Start the list item, and print the context name as a link to the place to make changes.
if ($contextid == context_system::instance()->id) {
$url = new moodle_url('/admin/roles/manage.php');
$title = get_string('changeroles', 'tool_capability');
} else {
$url = new moodle_url('/admin/roles/override.php', array('contextid' => $contextid));
$title = get_string('changeoverrides', 'tool_capability');
}
$context = context::instance_by_id($contextid);
$html = $this->output->heading(html_writer::link($url, $context->get_context_name(), array('title' => $title)), 3);
$html .= html_writer::table($table);
// If there are any child contexts, print them recursively.
if (!empty($contexts[$contextid]->children)) {
foreach ($contexts[$contextid]->children as $childcontextid) {
$html .= $this->capability_comparison_table($capabilities, $childcontextid, $roles, true);
}
}
return $html;
}
示例13: display_add_field
function display_add_field($recordid = 0, $formdata = null) {
global $DB, $OUTPUT;
if ($formdata) {
$fieldname = 'field_' . $this->field->id;
if (isset($formdata->$fieldname)) {
$content = $formdata->$fieldname;
} else {
$content = array();
}
} else if ($recordid) {
$content = $DB->get_field('data_content', 'content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid));
$content = explode('##', $content);
} else {
$content = array();
}
$str = '<div title="'.s($this->field->description).'">';
$str .= '<input name="field_' . $this->field->id . '[xxx]" type="hidden" value="xxx"/>'; // hidden field - needed for empty selection
$str .= '<label for="field_' . $this->field->id . '" class="accesshide">';
$str .= html_writer::span($this->field->name);
if ($this->field->required) {
$str .= '<div class="inline-req">';
$str .= html_writer::img($OUTPUT->pix_url('req'), get_string('requiredelement', 'form'),
array('class' => 'req', 'title' => get_string('requiredelement', 'form')));
$str .= '</div>';
}
$str .= '</label>';
$str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '"';
$str .= ' multiple="multiple" class="mod-data-input form-control">';
foreach (explode("\n", $this->field->param1) as $option) {
$option = trim($option);
$str .= '<option value="' . s($option) . '"';
if (in_array($option, $content)) {
// Selected by user.
$str .= ' selected = "selected"';
}
$str .= '>';
$str .= $option . '</option>';
}
$str .= '</select>';
$str .= '</div>';
return $str;
}
示例14: eclass_header
public function eclass_header($columns)
{
global $CFG, $SITE;
$output = html_writer::start_tag('header', array("role" => "banner", "class" => "navbar navbar-fixed-top moodle-has-zindex"));
$output .= html_writer::start_tag('nav', array("role" => "navigation", "class" => "navbar-inner"));
$output .= html_writer::start_div("container-fluid");
$output .= html_writer::tag('img', '', array("src" => $this->pix_url('ua-logo', 'theme'), "class" => "uofa-logo", "height" => "40px"));
$output .= html_writer::div(html_writer::link($CFG->wwwroot, $SITE->shortname, array("class" => "brand")), 'nav-brand');
$output .= html_writer::start_div("pull-right");
$output .= $this->custom_menu();
$headingmenu = $this->page_heading_menu();
$output .= html_writer::alist(array($headingmenu), array("class" => "nav pull-right"));
$output .= html_writer::div(html_writer::span('', "glyphicons collapse_top"), "scroll-top pull-right", array("title" => "Scroll to top"));
$output .= $this->login_info();
$output .= html_writer::end_div();
$output .= html_writer::end_div();
$output .= html_writer::end_tag('nav');
// Mobile stuff.
$toggleleft = '<li><label class="toggle toggle-navigation" for="toggle-left" onclick>' . '<div class="mobile-nav-icon glyphicons list"></div><span>Navigation</span></label></li>';
$togglecenter = '<li><label class="toggle toggle-content" for="toggle-center" onclick>' . '<div class="mobile-nav-icon glyphicons book"></div><span>Content</span></label></li>';
$toggleright = '';
if ($this->page->blocks->region_has_content('side-post', $this)) {
$toggleright = '<li><label class="toggle toggle-blocks" for="toggle-right" onclick>' . '<div class="mobile-nav-icon glyphicons show_big_thumbnails"></div><span>Blocks</span></label></li>';
}
$toggleprofile = '<li><label class="toggle toggle-profile" for="toggle-profile" onclick>' . '<div class="mobile-nav-icon glyphicons user"></div><span>Profile</span></label></li>';
switch ($columns) {
default:
case 1:
$togglelist = $togglecenter . $toggleprofile;
break;
case 2:
$togglelist = $toggleleft . $togglecenter . $toggleprofile;
break;
case 3:
$togglelist = $toggleleft . $togglecenter . $toggleright . $toggleprofile;
break;
}
$togglelist .= html_writer::div('', 'active-indicator');
$output .= html_writer::start_tag('nav', array("class" => "mobile-nav"));
$output .= html_writer::tag('ul', $togglelist, array("class" => "view-selector"));
$output .= html_writer::end_tag('nav');
$output .= html_writer::end_tag('header');
return $output;
}
示例15: render_databasebookmarks
public function render_databasebookmarks($bookmarks)
{
$output = '';
$bookmarkslinks = array();
foreach ($bookmarks as $bookmark) {
$bookmarkmarkup = '';
$url = new moodle_url("/mod/data/view.php", array('d' => $bookmark->instanceid, 'rid' => $bookmark->recordid));
$label = $bookmark->bookmarkname;
$bookmarklink = html_writer::link($url, $label);
$bookmarkmarkup .= html_writer::span($bookmarklink, 'bookmarklink');
$iconenrolremove = $this->output->pix_url('t/delete');
$iconimg = html_writer::img($iconenrolremove, get_string('delete'));
$deletelink = html_writer::link('#', $iconimg, array('data-rid' => $bookmark->recordid, 'data-action' => 'delete', 'class' => 'data_deletebookmark_link'));
$bookmarkmarkup .= html_writer::span($deletelink, 'deletelink');
$bookmarkslinks[] = $bookmarkmarkup;
}
$output .= html_writer::alist($bookmarkslinks, array('class' => 'block_databasebookmarks_bookmarklist'));
return $output;
}