本文整理汇总了PHP中html_writer::start_span方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::start_span方法的具体用法?PHP html_writer::start_span怎么用?PHP html_writer::start_span使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::start_span方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_form
public function search_form(moodle_url $formtarget, $searchvalue)
{
$content = html_writer::start_tag('form', array('class' => 'adminsearchform', 'method' => 'get', 'action' => $formtarget, 'role' => 'search'));
$content .= html_writer::start_div('input-group');
$content .= html_writer::empty_tag('input', array('id' => 'adminsearchquery', 'type' => 'text', 'name' => 'query', 'class' => 'form-control', 'placeholder' => s(get_string('searchinsettings', 'admin')), 'value' => s($searchvalue)));
$content .= html_writer::start_span('input-group-btn');
$content .= html_writer::tag('button', s(get_string('go')), array('type' => 'button', 'class' => 'btn btn-default'));
$content .= html_writer::end_span();
$content .= html_writer::end_div();
$content .= html_writer::end_tag('form');
return $content;
}
示例2: test_start_span
public function test_start_span()
{
// All options.
$this->assertSame('<span class="frog" id="kermit">', html_writer::start_span('frog', array('id' => 'kermit')));
// Combine class from attributes and $class.
$this->assertSame('<span class="amphibian frog">', html_writer::start_span('frog', array('class' => 'amphibian')));
// Class only.
$this->assertSame('<span class="frog">', html_writer::start_span('frog'));
// Attributes only.
$this->assertSame('<span id="kermit">', html_writer::start_span('', array('id' => 'kermit')));
// No options.
$this->assertSame('<span>', html_writer::start_span());
}
示例3: course_search_form
public function course_search_form($value = '', $format = 'plain')
{
static $count = 0;
$formid = 'coursesearch';
if (++$count > 1) {
$formid .= $count;
}
$inputid = 'coursesearchbox';
$inputsize = 30;
if ($format === 'navbar') {
$formid = 'coursesearchnavbar';
$inputid = 'navsearchbox';
}
$strsearchcourses = get_string("searchcourses");
$searchurl = new moodle_url('/course/search.php');
$form = array('id' => $formid, 'action' => $searchurl, 'method' => 'get', 'class' => "form-inline", 'role' => 'form');
$output = html_writer::start_tag('form', $form);
$output .= html_writer::start_div('input-group');
$output .= html_writer::tag('label', $strsearchcourses, array('for' => $inputid, 'class' => 'sr-only'));
$search = array('type' => 'text', 'id' => $inputid, 'size' => $inputsize, 'name' => 'search', 'class' => 'form-control', 'value' => s($value), 'placeholder' => $strsearchcourses);
$output .= html_writer::empty_tag('input', $search);
$button = array('type' => 'submit', 'class' => 'btn btn-default');
$output .= html_writer::start_span('input-group-btn');
$output .= html_writer::tag('button', get_string('go'), $button);
$output .= html_writer::end_span();
$output .= html_writer::end_div();
// Close form-group.
$output .= html_writer::end_tag('form');
return $output;
}
示例4: displaydir
//.........这里部分代码省略.........
$padunzip = html_writer::div($strunzip . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline'));
$padlist = html_writer::div($strlist . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline'));
$padrestore = html_writer::div($strrestore . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline'));
$padchoose = html_writer::div($strchoose . ' ','', array('style'=>'color: transparent; background-color:transparent; display:inline'));
$padfolder = html_writer::div($strfolder . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;'));
$padfile = html_writer::div($strfile . ' ','', array('style'=>'color:transparent; background-color; transparent; display:inline;'));
$padlink = html_writer::div($strlinktocourse . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;'));
*/
$gdocsstr = 'Google-Docs-Storage-for-';
// Set sort arguments so that clicking on a column that is already sorted reverses the sort order
$sortvalues = array(1, 2, 3);
foreach ($sortvalues as &$sortvalue) {
if ($sortvalue == $sort) {
$sortvalue = -$sortvalue;
}
}
$upload_max_filesize = get_max_upload_file_size($CFG->maxbytes);
// beginning of with selected files portion
echo html_writer::start_tag('table', array('border' => '0', 'cellspacing' => '2', 'cellpadding' => '2', 'style' => 'min-width: 900px; margin-left:auto; margin-right:auto', 'class' => 'files'));
if ($wdir !== '') {
echo html_writer::start_tag('tr');
//html_writer::table($table);
if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) {
echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'center'));
// move files to other folder form
echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get'));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'paste'));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey));
echo html_writer::tag('input', '', array('align' => 'center', 'type' => 'submit', 'value' => $strmovefilestohere));
//echo "<span> --> <b>$wdir</b></span><br />";
echo html_writer::start_span() . '-->' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::end_tag('br');
echo html_writer::end_tag('td');
echo html_writer::start_tag('td');
echo html_writer::end_tag('form');
// cancel moving form
echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get', 'align' => 'left'));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'cancel'));
echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strcancel, 'style' => 'color:red; margin-left:10px'));
echo html_writer::end_tag('form');
echo html_writer::end_tag('td');
} else {
if (has_capability('moodle/course:update', $coursecontext) || strpos($wdir, '-write')) {
echo html_writer::start_tag('tr', array('style' => 'background-color: #ffddbb;'));
echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'left', 'style' => 'background-color:#ffddbb; padding-left:5px;'));
// file upload form
// TODO: what if we're in the user or departmental dir?
echo html_writer::start_tag('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => 'morslefiles.php'));
echo html_writer::start_span() . ' ' . $struploadafile . ' (' . $strmaxsize . ') ' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::tag('br', '');
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'upload'));
echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey));
if (!isset($coursebytes)) {
$coursebytes = 0;
}
if (!isset($modbytes)) {
$modbytes = 0;
}
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $modbytes);
示例5: render_user_menu
protected function render_user_menu(custom_menu $menu)
{
global $CFG, $USER, $DB, $PAGE;
//Elegance add $PAGE;
$addusermenu = true;
$addlangmenu = true;
$addmessagemenu = true;
//Elegance add Check for messaging start
if (!$CFG->messaging) {
$addmessagemenu = false;
} else {
// Check whether or not the "popup" message output is enabled
// This is after we check if messaging is enabled to possibly save a DB query
$popup = $DB->get_record('message_processors', array('name' => 'popup'));
if (!$popup) {
$addmessagemenu = false;
}
}
//Elegance add Check for messaging end
if (!isloggedin() || isguestuser()) {
$addmessagemenu = false;
}
if ($addmessagemenu) {
$messages = $this->get_user_messages();
$messagecount = 0;
foreach ($messages as $message) {
if (!$message->from) {
// Workaround for issue #103.
continue;
}
$messagecount++;
}
$messagemenutext = $messagecount . ' ';
if ($messagecount == 1) {
$messagemenutext .= get_string('message', 'message');
} else {
$messagemenutext .= get_string('messages', 'message');
}
$messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
foreach ($messages as $message) {
if (!$message->from) {
// Workaround for issue #103.
continue;
}
$senderpicture = new user_picture($message->from);
$senderpicture->link = false;
$senderpicture = $this->render($senderpicture);
$messagecontent = $senderpicture;
$messagecontent .= html_writer::start_span('msg-body');
$messagecontent .= html_writer::start_span('msg-title');
$messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
$messagecontent .= $message->text;
$messagecontent .= html_writer::end_span();
$messagecontent .= html_writer::start_span('msg-time');
$messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
$messagecontent .= html_writer::span($message->date);
$messagecontent .= html_writer::end_span();
$messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
$messagemenu->add($messagecontent, $messageurl, $message->text);
}
}
$langs = get_string_manager()->get_list_of_translations();
if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
$addlangmenu = false;
}
if ($addlangmenu) {
$language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
foreach ($langs as $langtype => $langname) {
$language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}
if ($addusermenu) {
if (isloggedin()) {
$usermenu = $menu->add('<i class="fa fa-user"></i>' . fullname($USER), new moodle_url('#'), fullname($USER), 10001);
if (!empty($PAGE->theme->settings->enablemy)) {
$usermenu->add('<i class="fa fa-briefcase"></i>' . get_string('mydashboard', 'theme_elegance'), new moodle_url('/my', array('id' => $USER->id)), get_string('mydashboard', 'theme_elegance'));
}
if (!empty($PAGE->theme->settings->enableprofile)) {
$usermenu->add('<i class="fa fa-user"></i>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile'));
}
if (!empty($PAGE->theme->settings->enableeditprofile)) {
$usermenu->add('<i class="fa fa-cog"></i>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile'));
}
if (!empty($PAGE->theme->settings->enableprivatefiles)) {
$usermenu->add('<i class="fa fa-file"></i>' . get_string('privatefiles', 'block_private_files'), new moodle_url('/user/files.php', array('id' => $USER->id)), get_string('privatefiles', 'block_private_files'));
}
if (!empty($PAGE->theme->settings->enablebadges)) {
$usermenu->add('<i class="fa fa-certificate"></i>' . get_string('badges'), new moodle_url('/badges/mybadges.php', array('id' => $USER->id)), get_string('badges'));
}
if (!empty($PAGE->theme->settings->enablecalendar)) {
$usermenu->add('<i class="fa fa-calendar"></i>' . get_string('pluginname', 'block_calendar_month'), new moodle_url('/calendar/view.php', array('id' => $USER->id)), get_string('pluginname', 'block_calendar_month'));
}
// Add custom links to menu
$customlinksnum = empty($PAGE->theme->settings->usermenulinks) ? false : $PAGE->theme->settings->usermenulinks;
if ($customlinksnum != 0) {
foreach (range(1, $customlinksnum) as $customlinksnumber) {
$cli = "customlinkicon{$customlinksnumber}";
$cln = "customlinkname{$customlinksnumber}";
$clu = "customlinkurl{$customlinksnumber}";
if (!empty($PAGE->theme->settings->enablecalendar)) {
//.........这里部分代码省略.........
示例6: render_social_network
public function render_social_network($socialnetwork)
{
if (\theme_essential\toolbox::get_setting($socialnetwork)) {
$icon = $socialnetwork;
if ($socialnetwork === 'googleplus') {
$icon = 'google-plus';
} else {
if ($socialnetwork === 'website') {
$icon = 'globe';
} else {
if ($socialnetwork === 'ios') {
$icon = 'apple';
} else {
if ($socialnetwork === 'winphone') {
$icon = 'windows';
}
}
}
}
$socialhtml = html_writer::start_tag('li');
$socialhtml .= html_writer::start_tag('button', array('type' => "button", 'class' => 'socialicon ' . $socialnetwork, 'onclick' => "window.open('" . \theme_essential\toolbox::get_setting($socialnetwork) . "')", 'title' => get_string($socialnetwork, 'theme_essential')));
$socialhtml .= html_writer::start_tag('i', array('class' => 'fa fa-' . $icon));
$socialhtml .= html_writer::end_tag('i');
$socialhtml .= html_writer::start_span('sr-only') . html_writer::end_span();
$socialhtml .= html_writer::end_tag('button');
$socialhtml .= html_writer::end_tag('li');
return $socialhtml;
} else {
return false;
}
}
示例7: course_overview
/**
* Construct contents of course_overview block
*
* @param array $courses list of courses in sorted order
* @param array $overviews list of course overviews
* @return string html to be displayed in course_overview block
*/
public function course_overview($courses, $overviews)
{
global $DB;
$html = '';
$config = get_config('block_course_overview');
if ($config->showcategories != BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE) {
global $CFG;
require_once $CFG->libdir . '/coursecatlib.php';
}
/*echo '<pre>';
print_r($courses);*/
$ismovingcourse = false;
$courseordernumber = 0;
$maxcourses = count($courses);
$userediting = false;
// Intialise string/icon etc if user is editing and courses > 1
if ($this->page->user_is_editing() && count($courses) > 1) {
$userediting = true;
$this->page->requires->js_init_call('M.block_course_overview.add_handles');
// Check if course is moving
$ismovingcourse = optional_param('movecourse', FALSE, PARAM_BOOL);
$movingcourseid = optional_param('courseid', 0, PARAM_INT);
}
/**
* Indexador das categorias dos cursos
* @author Cássio Queiroz <Cruzz>
* @date 2015/12/26
*/
$catids = array();
foreach ($courses as $key => $course) {
$value = $DB->get_record_sql('SELECT id,name FROM {course_categories} WHERE id = ? ', array($course->category));
$catids[] = $value->id . '@' . $value->name;
}
$firstCat = explode("@", $catids[0]);
$catids = array_unique($catids);
// Render first movehere icon.
if ($ismovingcourse) {
// Remove movecourse param from url.
$this->page->ensure_param_not_in_url('movecourse');
// Show moving course notice, so user knows what is being moved.
$html .= $this->output->box_start('notice');
$a = new stdClass();
$a->fullname = $courses[$movingcourseid]->fullname;
$a->cancellink = html_writer::link($this->page->url, get_string('cancel'));
$html .= get_string('movingcourse', 'block_course_overview', $a);
$html .= $this->output->box_end();
$moveurl = new moodle_url('/blocks/course_overview/move.php', array('sesskey' => sesskey(), 'moveto' => 0, 'courseid' => $movingcourseid));
// Create move icon, so it can be used.
$movetofirsticon = html_writer::empty_tag('img', array('src' => $this->output->pix_url('movehere'), 'alt' => get_string('movetofirst', 'block_course_overview', $courses[$movingcourseid]->fullname), 'title' => get_string('movehere')));
$moveurl = html_writer::link($moveurl, $movetofirsticon);
$html .= html_writer::tag('div', $moveurl, array('class' => 'movehere'));
}
// @autor Cássio Queiroz <Cruzz>
$html .= html_writer::start_tag('div', array('class' => 'cat_navigation'));
$html .= html_writer::start_span('top-level') . 'Meus Cursos' . html_writer::end_span();
$html .= html_writer::start_tag('div', array('class' => 'cat_navs'));
$piper = '';
foreach ($catids as $cor) {
$name = explode('@', $cor);
$html .= $piper . html_writer::start_span('allcat category-' . $name[0]) . $name[1] . html_writer::end_span();
$piper = ' | ';
}
$html .= html_writer::end_tag('div');
// END cat_navs
$html .= html_writer::end_tag('div');
// END cat_navigation
foreach ($courses as $key => $course) {
// If moving course, then don't show course which needs to be moved.
if ($ismovingcourse && $course->id == $movingcourseid) {
continue;
}
$html .= html_writer::start_tag('div', array('class' => 'all cat_' . $course->category));
// @autor Cássio Queiroz <Cruzz>
$html .= $this->output->box_start('coursebox', "course-{$course->id}");
$html .= html_writer::start_tag('div', array('class' => 'course_title'));
// If user is editing, then add move icons.
if ($userediting && !$ismovingcourse) {
$moveicon = html_writer::empty_tag('img', array('src' => $this->pix_url('t/move')->out(false), 'alt' => get_string('movecourse', 'block_course_overview', $course->fullname), 'title' => get_string('move')));
$moveurl = new moodle_url($this->page->url, array('sesskey' => sesskey(), 'movecourse' => 1, 'courseid' => $course->id));
$moveurl = html_writer::link($moveurl, $moveicon);
$html .= html_writer::tag('div', $moveurl, array('class' => 'move'));
}
// No need to pass title through s() here as it will be done automatically by html_writer.
$attributes = array('title' => $course->fullname);
if ($course->id > 0) {
if (empty($course->visible)) {
$attributes['class'] = 'dimmed';
}
$courseurl = new moodle_url('/course/view.php', array('id' => $course->id));
$coursefullname = format_string(get_course_display_name_for_list($course), true, $course->id);
$link = html_writer::link($courseurl, $coursefullname, $attributes);
$html .= $this->output->heading($link, 2, 'title');
} else {
//.........这里部分代码省略.........
示例8: render_user_menu
protected function render_user_menu(custom_menu $menu)
{
global $CFG, $USER, $DB;
$addusermenu = true;
$addlangmenu = true;
$addmessagemenu = false;
if (!isloggedin() || isguestuser()) {
$addmessagemenu = false;
}
if ($addmessagemenu) {
$messages = $this->get_user_messages();
$messagecount = count($messages);
$messagemenu = $menu->add($messagecount . ' ' . get_string('messages', 'message'), new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
foreach ($messages as $message) {
if (!$message->from) {
// Workaround for issue #103.
continue;
}
$senderpicture = new user_picture($message->from);
$senderpicture->link = false;
$senderpicture = $this->render($senderpicture);
$messagecontent = $senderpicture;
$messagecontent .= html_writer::start_span('msg-body');
$messagecontent .= html_writer::start_span('msg-title');
$messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
$messagecontent .= $message->text;
$messagecontent .= html_writer::end_span();
$messagecontent .= html_writer::start_span('msg-time');
$messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
$messagecontent .= html_writer::span($message->date);
$messagecontent .= html_writer::end_span();
$messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
$messagemenu->add($messagecontent, $messageurl, $message->state);
}
}
$langs = get_string_manager()->get_list_of_translations();
if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
$addlangmenu = false;
}
if ($addlangmenu) {
$language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
foreach ($langs as $langtype => $langname) {
$language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}
if ($addusermenu) {
if (isloggedin()) {
$usermenu = $menu->add(fullname($USER), new moodle_url('#'), fullname($USER), 10001);
$usermenu->add('<span class="glyphicon glyphicon-off"></span>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'alt' => 'logout')), get_string('logout'));
$usermenu->add('<span class="glyphicon glyphicon-user"></span>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile'));
$usermenu->add('<span class="glyphicon glyphicon-cog"></span>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile'));
}
}
$content = '<ul class="nav navbar-nav navbar-right">';
foreach ($menu->get_children() as $item) {
$content .= $this->render_custom_menu_item($item, 1);
}
return $content . '</ul>';
}
示例9: moodle_url
$links[] = html_writer::link(new moodle_url('/mod/booking/teachers.php', array('id' => $id, 'optionid' => $optionid)), get_string('teachers', 'booking'), array());
}
if (has_capability('mod/booking:subscribeusers', $context)) {
$links[] = html_writer::link(new moodle_url('/mod/booking/subscribeusers.php', array('id' => $cm->id, 'optionid' => $optionid)), get_string('bookotherusers', 'booking'), array());
}
$links[] = '<a href="#" id="showHideSearch">' . get_string('search') . '</a>';
if (has_capability('mod/booking:communicate', context_module::instance($cm->id))) {
$links[] = html_writer::link(new moodle_url('/mod/booking/report.php', array('id' => $cm->id, 'optionid' => $optionid, 'action' => 'sendpollurlteachers')), get_string('booking:sendpollurltoteachers', 'booking'), array());
}
echo implode(" | ", $links);
if ($bookingData->option->courseid != 0) {
echo '<br>' . html_writer::start_span('') . get_string('associatedcourse', 'booking') . ': ' . html_writer::link(new moodle_url($bookingData->option->courseurl, array()), $bookingData->option->urltitle, array()) . html_writer::end_span() . '<br>';
}
$onlyOneURL = new moodle_url('/mod/booking/view.php', array('id' => $id, 'optionid' => $optionid, 'action' => 'showonlyone', 'whichview' => 'showonlyone'));
$onlyOneURL->set_anchor('goenrol');
echo '<br>' . html_writer::start_span('') . get_string('onlythisbookingurl', 'booking') . ': ' . html_writer::link($onlyOneURL, $onlyOneURL, array()) . html_writer::end_span() . '<br><br>';
$hidden = "";
foreach ($urlParams as $key => $value) {
if (!in_array($key, array('searchName', 'searchSurname', 'searchDate', 'searchFinished'))) {
$hidden .= '<input value="' . $value . '" type="hidden" name="' . $key . '">';
}
}
$row = new html_table_row(array(get_string('searchName', "booking"), '<form>' . $hidden . '<input value="' . $urlParams['searchName'] . '" id="searchName" type="text" name="searchName">', "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
$row = new html_table_row(array(get_string('searchSurname', "booking"), '<input value="' . $urlParams['searchSurname'] . '" id="searchSurname" type="text" name="searchSurname">', "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
$row = new html_table_row(array(get_string('searchDate', "booking"), html_writer::checkbox('searchDate', '1', $checked, '', array('id' => 'searchDate')) . html_writer::select_time('days', 'searchDateDay', $timestamp, 5) . ' ' . html_writer::select_time('months', 'searchDateMonth', $timestamp, 5) . ' ' . html_writer::select_time('years', 'searchDateYear', $timestamp, 5), "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
示例10: message_menu
/**
* Adds a simple message menu to the page navbar.
*/
private function message_menu()
{
global $USER, $PAGE, $CFG;
if (!isloggedin() || isguestuser()) {
return false;
}
// Check to see if messaging is enabled.
if (!$CFG->messaging) {
return false;
}
// Changed from $OUTPUT -> bsrender because of bug when selecting this theme
// for the first time.
$bsrender = $PAGE->get_renderer('theme_elegance', 'core');
$menu = new custom_menu();
$messages = $this->get_user_messages();
$messagecount = 0;
foreach ($messages as $message) {
if (!$message->from) {
// Workaround for issue #103.
continue;
}
$messagecount++;
}
if ($messagecount == 0) {
$messagemenutext = ' <i class="glyphicon glyphicon-inbox"></i>';
} else {
$messagemenutext = ' <i class="glyphicon glyphicon-envelope"></i>';
}
$messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
foreach ($messages as $message) {
if (!$message->from) {
// Workaround for issue #103.
continue;
}
$senderpicture = new user_picture($message->from);
$senderpicture->link = false;
$senderpicture = $bsrender->render($senderpicture);
$messagecontent = $senderpicture;
$messagecontent .= html_writer::start_span('msg-body');
$messagecontent .= html_writer::start_span('msg-title');
$messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
$messagecontent .= $message->text;
$messagecontent .= html_writer::end_span();
$messagecontent .= html_writer::start_span('msg-time');
$messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
$messagecontent .= html_writer::span($message->date);
$messagecontent .= html_writer::end_span();
$messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
$messagemenu->add($messagecontent, $messageurl, $message->text);
}
$content = '';
foreach ($menu->get_children() as $item) {
$content .= $bsrender->render_custom_menu_item($item, 1);
}
return $content;
}
示例11: view_edit_items
protected function view_edit_items()
{
global $OUTPUT;
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
$currindent = 0;
$addatend = true;
$focusitem = false;
$hasauto = false;
$thispage = new moodle_url('/mod/checklist/edit.php', array('id' => $this->cm->id, 'sesskey' => sesskey()));
if ($this->additemafter) {
$thispage->param('additemafter', $this->additemafter);
}
if ($this->editdates) {
$thispage->param('editdates', 'on');
}
if ($itemid = optional_param('itemid', null, PARAM_INT)) {
$thispage->param('itemid', $itemid);
}
if ($this->checklist->autoupdate && $this->checklist->autopopulate) {
if ($this->checklist->teacheredit == CHECKLIST_MARKING_STUDENT) {
echo '<p>' . get_string('autoupdatewarning_student', 'checklist') . '</p>';
} else {
if ($this->checklist->teacheredit == CHECKLIST_MARKING_TEACHER) {
echo '<p class="checklistwarning">' . get_string('autoupdatewarning_teacher', 'checklist') . '</p>';
} else {
echo '<p class="checklistwarning">' . get_string('autoupdatewarning_both', 'checklist') . '</p>';
}
}
}
echo '<ol class="checklist">';
if ($this->items) {
$lastitem = count($this->items);
$lastindent = 0;
echo html_writer::start_tag('form', array('action' => $thispage->out_omit_querystring(), 'method' => 'post'));
echo html_writer::input_hidden_params($thispage);
if ($this->checklist->autopopulate) {
echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'showhideitems', 'value' => get_string('showhidechecked', 'checklist')));
}
foreach ($this->items as $item) {
while ($item->indent > $currindent) {
$currindent++;
echo '<ol class="checklist">';
}
while ($item->indent < $currindent) {
$currindent--;
echo '</ol>';
}
$itemname = '"item' . $item->id . '"';
$thispage->param('itemid', $item->id);
switch ($item->colour) {
case 'red':
$itemcolour = 'itemred';
$nexticon = 'colour_orange';
break;
case 'orange':
$itemcolour = 'itemorange';
$nexticon = 'colour_green';
break;
case 'green':
$itemcolour = 'itemgreen';
$nexticon = 'colour_purple';
break;
case 'purple':
$itemcolour = 'itempurple';
$nexticon = 'colour_black';
break;
default:
$itemcolour = 'itemblack';
$nexticon = 'colour_red';
}
$autoitem = $this->checklist->autopopulate && $item->moduleid != 0;
if ($autoitem) {
$autoclass = ' itemauto';
} else {
$autoclass = '';
}
$hasauto = $hasauto || $item->moduleid != 0;
echo '<li>';
echo html_writer::start_span('', array('style' => 'display: inline-block; width: 16px;'));
if ($autoitem && $item->hidden != CHECKLIST_HIDDEN_BYMODULE) {
echo html_writer::checkbox('items[' . $item->id . ']', $item->id, false, '', array('title' => $item->displaytext));
}
echo html_writer::end_span();
if ($item->itemoptional == CHECKLIST_OPTIONAL_YES) {
$title = '"' . get_string('optionalitem', 'checklist') . '"';
echo '<a href="' . $thispage->out(true, array('action' => 'makeheading')) . '">';
echo '<img src="' . $OUTPUT->pix_url('empty_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' /></a> ';
$optional = ' class="itemoptional ' . $itemcolour . $autoclass . '" ';
} else {
if ($item->itemoptional == CHECKLIST_OPTIONAL_HEADING) {
if ($item->hidden) {
$title = '"' . get_string('headingitem', 'checklist') . '"';
echo '<img src="' . $OUTPUT->pix_url('no_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' /> ';
$optional = ' class="' . $itemcolour . $autoclass . ' itemdisabled"';
} else {
$title = '"' . get_string('headingitem', 'checklist') . '"';
if (!$autoitem) {
echo '<a href="' . $thispage->out(true, array('action' => 'makerequired')) . '">';
}
echo '<img src="' . $OUTPUT->pix_url('no_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' />';
//.........这里部分代码省略.........
示例12: render_user_menu
protected function render_user_menu(custom_menu $menu)
{
global $CFG, $USER, $DB, $PAGE;
$addusermenu = true;
$addlangmenu = true;
$addmessagemenu = true;
if (!isloggedin() || isguestuser()) {
$addmessagemenu = false;
}
if ($addmessagemenu) {
$messages = $this->get_user_messages();
$messagecount = count($messages);
$messagemenu = $menu->add('<i class="fa fa-envelope-o"></i>' . html_writer::tag('ot', $messagecount), new moodle_url('#'), get_string('messages', 'message'), 9999);
foreach ($messages as $message) {
if (!$message->from) {
continue;
}
$senderpicture = new user_picture($message->from);
$senderpicture->link = false;
$senderpicture = $this->render($senderpicture);
$messagecontent = $senderpicture;
$messagecontent .= html_writer::start_span('msg-body');
$messagecontent .= html_writer::start_span('msg-title');
$messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
$messagecontent .= $message->text;
$messagecontent .= html_writer::end_span();
$messagecontent .= html_writer::start_span('msg-time');
$messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
$messagecontent .= html_writer::span($message->date);
$messagecontent .= html_writer::end_span();
$messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
$messagemenu->add($messagecontent, $messageurl, $message->state);
}
}
$langs = get_string_manager()->get_list_of_translations();
if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
$addlangmenu = false;
}
if ($addlangmenu) {
$language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
foreach ($langs as $langtype => $langname) {
$language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}
if ($addusermenu) {
if (isloggedin() && !isguestuser()) {
$usermenu = $menu->add('<img class="profilepic" src="' . $CFG->wwwroot . '/user/pix.php?file=/' . $USER->id . '/f1.jpg" width="80" height="80" title="' . $USER->firstname . ' ' . $USER->lastname . '" alt="' . $USER->firstname . ' ' . $USER->lastname . '" />' . fullname($USER), new moodle_url('#'), fullname($USER), 10001);
if (!empty($PAGE->theme->settings->enablemy)) {
$usermenu->add('<i class="fa fa-file"></i>' . get_string('enablemy', 'theme_keats'), new moodle_url('/my', array('id' => $USER->id)), get_string('enablemy', 'theme_keats'));
}
if (!empty($PAGE->theme->settings->enableprofile)) {
$usermenu->add('<i class="fa fa-user"></i>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile'));
}
if (!empty($PAGE->theme->settings->enableeditprofile)) {
$usermenu->add('<i class="fa fa-cog"></i>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile'));
}
if (!empty($PAGE->theme->settings->enablemessages)) {
$usermenu->add('<i class="fa fa-comments"></i>' . get_string('enablemessages', 'theme_keats'), new moodle_url('/message/index.php', array()), get_string('enablemessages', 'theme_keats'));
}
if (!empty($PAGE->theme->settings->enableprivatefiles)) {
$usermenu->add('<i class="fa fa-file"></i>' . get_string('privatefiles', 'block_private_files'), new moodle_url('/user/files.php', array('id' => $USER->id)), get_string('privatefiles', 'block_private_files'));
}
if (!empty($PAGE->theme->settings->enablebadges)) {
$usermenu->add('<i class="fa fa-certificate"></i>' . get_string('badges'), new moodle_url('/badges/mybadges.php', array('id' => $USER->id)), get_string('badges'));
}
if (!empty($PAGE->theme->settings->enablecalendar)) {
$usermenu->add('<i class="fa fa-calendar"></i>' . get_string('pluginname', 'block_calendar_month'), new moodle_url('/calendar/view.php', array('id' => $USER->id)), get_string('pluginname', 'block_calendar_month'));
}
// Add custom links to menu
$customlinksnum = empty($PAGE->theme->settings->usermenulinks) ? false : $PAGE->theme->settings->usermenulinks;
if ($customlinksnum != 0) {
foreach (range(1, $customlinksnum) as $customlinksnumber) {
$cli = "customlinkicon{$customlinksnumber}";
$cln = "customlinkname{$customlinksnumber}";
$clu = "customlinkurl{$customlinksnumber}";
if (!empty($PAGE->theme->settings->enablecalendar)) {
$usermenu->add('<i class="fa fa-' . $PAGE->theme->settings->{$cli} . '"></i>' . $PAGE->theme->settings->{$cln}, new moodle_url($PAGE->theme->settings->{$clu}, array('id' => $USER->id)), $PAGE->theme->settings->{$cln});
}
}
}
$usermenu->add('<i class="fa fa-lock"></i>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'loginpage' => '1')), get_string('logout'));
} else {
echo '<a href="' . $CFG->wwwroot . '/login/index.php">' . get_string('login') . '</a>';
}
}
$content = '<ul class="nav navbar-nav navbar-right">';
foreach ($menu->get_children() as $item) {
$content .= $this->render_custom_menu_item($item, 1);
}
return $content . '</ul>';
}
示例13: message_menu
private function message_menu()
{
global $OUTPUT, $USER;
$menu = new custom_menu();
$messages = $this->get_user_messages();
$messagecount = 0;
foreach ($messages as $message) {
if (!$message->from) {
// Workaround for issue #103.
continue;
}
$messagecount++;
}
if ($messagecount == 0) {
$messagemenutext = ' <i class="glyphicon glyphicon-inbox"></i>';
} else {
$messagemenutext = ' <i class="glyphicon glyphicon-envelope"></i>';
}
$messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
foreach ($messages as $message) {
if (!$message->from) {
// Workaround for issue #103.
continue;
}
$senderpicture = new user_picture($message->from);
$senderpicture->link = false;
$senderpicture = $OUTPUT->render($senderpicture);
$messagecontent = $senderpicture;
$messagecontent .= html_writer::start_span('msg-body');
$messagecontent .= html_writer::start_span('msg-title');
$messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
$messagecontent .= $message->text;
$messagecontent .= html_writer::end_span();
$messagecontent .= html_writer::start_span('msg-time');
$messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
$messagecontent .= html_writer::span($message->date);
$messagecontent .= html_writer::end_span();
$messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
$messagemenu->add($messagecontent, $messageurl, $message->text);
}
$content = '';
foreach ($menu->get_children() as $item) {
$content .= $OUTPUT->render_custom_menu_item($item, 1);
}
return $content;
}
示例14: report_selector_form
/**
* This function is used to generate and display selector form
*
* @param report_log_renderable $reportlog log report.
*/
public function report_selector_form(report_log_renderable $reportlog) {
echo html_writer::start_tag('form', array('class' => 'logselecform', 'action' => $reportlog->url, 'method' => 'get'));
echo html_writer::start_div();
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'chooselog', 'value' => '1'));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showusers', 'value' => $reportlog->showusers));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showcourses',
'value' => $reportlog->showcourses));
$selectedcourseid = empty($reportlog->course) ? 0 : $reportlog->course->id;
// Add course selector.
$sitecontext = context_system::instance();
$courses = $reportlog->get_course_list();
if (!empty($courses) && $reportlog->showcourses) {
echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide'));
echo html_writer::select($courses, "id", $selectedcourseid, null);
} else {
$courses = array();
$courses[$selectedcourseid] = get_course_display_name_for_list($reportlog->course) . (($selectedcourseid == SITEID) ?
' (' . get_string('site') . ') ' : '');
echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide'));
echo html_writer::select($courses, "id", $selectedcourseid, false);
// Check if user is admin and this came because of limitation on number of courses to show in dropdown.
if (has_capability('report/log:view', $sitecontext)) {
$a = new stdClass();
$a->url = new moodle_url('/report/log/index.php', array('chooselog' => 0,
'group' => $reportlog->get_selected_group(), 'user' => $reportlog->userid,
'id' => $selectedcourseid, 'date' => $reportlog->date, 'modid' => $reportlog->modid,
'showcourses' => 1, 'showusers' => $reportlog->showusers));
$a->url = $a->url->out(false);
print_string('logtoomanycourses', 'moodle', $a);
}
}
// Add group selector.
$groups = $reportlog->get_group_list();
if (!empty($groups)) {
echo html_writer::label(get_string('selectagroup'), 'menugroup', false, array('class' => 'accesshide'));
echo html_writer::select($groups, "group", $reportlog->groupid, get_string("allgroups"));
}
// Add user selector.
$users = $reportlog->get_user_list();
if ($reportlog->showusers) {
echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide'));
echo html_writer::select($users, "user", $reportlog->userid, get_string("allparticipants"));
} else {
$users = array();
if (!empty($reportlog->userid)) {
$users[$reportlog->userid] = $reportlog->get_selected_user_fullname();
} else {
$users[0] = get_string('allparticipants');
}
echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide'));
echo html_writer::select($users, "user", $reportlog->userid, false);
$a = new stdClass();
$a->url = new moodle_url('/report/log/index.php', array('chooselog' => 0,
'group' => $reportlog->get_selected_group(), 'user' => $reportlog->userid,
'id' => $selectedcourseid, 'date' => $reportlog->date, 'modid' => $reportlog->modid,
'showusers' => 1, 'showcourses' => $reportlog->showcourses));
$a->url = $a->url->out(false);
echo html_writer::start_span('m-x-1');
print_string('logtoomanyusers', 'moodle', $a);
echo html_writer::end_span();
}
// Add date selector.
$dates = $reportlog->get_date_options();
echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide'));
echo html_writer::select($dates, "date", $reportlog->date, get_string("alldays"));
// Add activity selector.
$activities = $reportlog->get_activities_list();
echo html_writer::label(get_string('activities'), 'menumodid', false, array('class' => 'accesshide'));
echo html_writer::select($activities, "modid", $reportlog->modid, get_string("allactivities"));
// Add actions selector.
echo html_writer::label(get_string('actions'), 'menumodaction', false, array('class' => 'accesshide'));
echo html_writer::select($reportlog->get_actions(), 'modaction', $reportlog->action, get_string("allactions"));
// Add origin.
$origin = $reportlog->get_origin_options();
echo html_writer::label(get_string('origin', 'report_log'), 'menuorigin', false, array('class' => 'accesshide'));
echo html_writer::select($origin, 'origin', $reportlog->origin, false);
// Add edulevel.
$edulevel = $reportlog->get_edulevel_options();
echo html_writer::label(get_string('edulevel'), 'menuedulevel', false, array('class' => 'accesshide'));
echo html_writer::select($edulevel, 'edulevel', $reportlog->edulevel, false).$this->help_icon('edulevel');
// Add reader option.
// If there is some reader available then only show submit button.
$readers = $reportlog->get_readers(true);
if (!empty($readers)) {
//.........这里部分代码省略.........
示例15: get_string
if (has_capability('mod/booking:communicate', context_module::instance($cm->id))) {
echo '<input type="submit" name="sendpollurl" value="' . get_string('booking:sendpollurl', 'booking') . '" />';
echo '<input type="submit" name="sendcustommessage" value="' . get_string('sendcustommessage', 'booking') . '" />';
}
if (booking_check_if_teacher($bookingData->option, $USER) || has_capability('mod/booking:updatebooking', context_module::instance($cm->id))) {
echo '<input type="submit" name="activitycompletion" value="' . (empty($bookingData->booking->btncacname) ? get_string('confirmactivitycompletion', 'booking') : $bookingData->booking->btncacname) . '" />';
if ($bookingData->option->conectedoption > 0) {
echo '<input type="submit" name="booktootherbooking" value="' . get_string('booktootherbooking', 'booking') . '" />';
}
}
echo '</div>';
echo '</form>';
$onlyOneURL = new moodle_url('/mod/booking/view.php', array('id' => $id, 'optionid' => $optionid, 'action' => 'showonlyone', 'whichview' => 'showonlyone'));
$onlyOneURL->set_anchor('goenrol');
echo '<br>' . html_writer::start_span('') . get_string('onlythisbookingurl', 'booking') . ': ' . html_writer::link($onlyOneURL, $onlyOneURL, array()) . html_writer::end_span();
echo '<br>' . html_writer::start_span('') . get_string('pollurl', 'booking') . ': ' . html_writer::link($bookingData->option->pollurl, $bookingData->option->pollurl, array()) . ($bookingData->option->pollsend ? ' ✓' : '') . html_writer::end_span();
$PAGE->requires->js_init_call('M.mod_booking.init');
echo $OUTPUT->footer();
} else {
if ($download == "ods" or $download == "xls" && has_capability('mod/booking:downloadresponses', $context)) {
if ($action == "all") {
$filename = clean_filename("{$course->shortname} " . strip_tags(format_string($bookingData->booking->name, true)));
} else {
$optionname = $bookingData->option->text;
$filename = clean_filename(strip_tags(format_string($optionname, true)));
}
if ($download == "ods") {
require_once "{$CFG->libdir}/odslib.class.php";
$workbook = new MoodleODSWorkbook("-");
$filename .= '.ods';
} else {