本文整理汇总了PHP中html_writer::alist方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::alist方法的具体用法?PHP html_writer::alist怎么用?PHP html_writer::alist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::alist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_details
/**
* Get criteria details for displaying to users
*
* @return string
*/
public function get_details($short = '')
{
global $DB, $OUTPUT;
$output = array();
foreach ($this->params as $p) {
$coursename = $DB->get_field('course', 'fullname', array('id' => $p['course']));
if (!$coursename) {
$str = $OUTPUT->error_text(get_string('error:nosuchcourse', 'badges'));
} else {
$str = html_writer::tag('b', '"' . $coursename . '"');
if (isset($p['bydate'])) {
$str .= get_string('criteria_descr_bydate', 'badges', userdate($p['bydate'], get_string('strftimedate', 'core_langconfig')));
}
if (isset($p['grade'])) {
$str .= get_string('criteria_descr_grade', 'badges', $p['grade']);
}
}
$output[] = $str;
}
if ($short) {
return implode(', ', $output);
} else {
return html_writer::alist($output, array(), 'ul');
}
}
示例2: toolbar
/**
* Return the toolbar
*
* @param bool $show_new whether show "New round" button
* return alist of links
*/
public function toolbar($show_new = true)
{
$output = '';
$toolbuttons = array();
// Print next/prev round bar
if ($this->hotquestion->get_prev_round() != null) {
$url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id, 'round' => $this->hotquestion->get_prev_round()->id));
$toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed_rtl', get_string('previousround', 'hotquestion')), array('class' => 'toolbutton'));
} else {
$toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty_rtl', ''), array('class' => 'dis_toolbutton'));
}
if ($this->hotquestion->get_next_round() != null) {
$url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id, 'round' => $this->hotquestion->get_next_round()->id));
$toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed', get_string('nextround', 'hotquestion')), array('class' => 'toolbutton'));
} else {
$toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty', ''), array('class' => 'dis_toolbutton'));
}
// Print new round bar
if ($show_new) {
$options = array();
$options['id'] = $this->hotquestion->cm->id;
$options['action'] = 'newround';
$url = new moodle_url('/mod/hotquestion/view.php', $options);
$toolbuttons[] = html_writer::link($url, $this->pix_icon('t/add', get_string('newround', 'hotquestion')), array('class' => 'toolbutton'));
}
// Print refresh button
$url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id));
$toolbuttons[] = html_writer::link($url, $this->pix_icon('t/reload', get_string('reload')), array('class' => 'toolbutton'));
// return all available toolbuttons
$output .= html_writer::alist($toolbuttons, array('id' => 'toolbar'));
return $output;
}
示例3: get_content
function get_content()
{
if ($this->content !== NULL) {
return $this->content;
}
$context = context_system::instance();
$this->content = new stdClass();
$this->content->footer = '';
$this->content->text = '';
$content = array();
$canview = has_capability('block/enrol_token_manager:viewtokens', $context) === true;
$cancreate = has_capability('block/enrol_token_manager:createtokens', $context) === true;
$canrevoke = has_capability('block/enrol_token_manager:revoketokens', $context) === true;
// view tokens link
if ($canview) {
$content[] = html_writer::link(new moodle_url('/blocks/enrol_token_manager/viewrevoke_tokens.php'), get_string('linkTextViewTokens', 'block_enrol_token_manager'));
}
// create tokens link
if ($cancreate) {
$content[] = html_writer::link(new moodle_url('/blocks/enrol_token_manager/create_tokens.php'), get_string('linkTextCreateTokens', 'block_enrol_token_manager'));
}
// revoke tokens link
if ($canrevoke) {
$content[] = html_writer::link(new moodle_url('/blocks/enrol_token_manager/viewrevoke_tokens.php'), get_string('linkTextRevokeTokens', 'block_enrol_token_manager'));
}
if ($cancreate || $canrevoke || $canview) {
$this->content->text = html_writer::alist($content);
}
return $this->content;
}
示例4: moodleorg_registration_message
/**
* Display message about the benefits of registering on Moodle.org
*
* @return string
*/
public function moodleorg_registration_message()
{
$moodleorgstatslink = html_writer::link('http://moodle.net/stats', get_string('statsmoodleorg', 'admin'), array('target' => '_blank'));
$moodleorgregmsg = get_string('registermoodleorg', 'admin');
$items = array(get_string('registermoodleorgli1', 'admin'), get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
$moodleorgregmsg .= html_writer::alist($items);
return $moodleorgregmsg;
}
示例5: moodleorg_registration_message
/**
* Display Moodle.org registration message about benefit to register on Moodle.org
*
* @return string
*/
public function moodleorg_registration_message()
{
$moodleorgurl = html_writer::link('http://moodle.org', 'Moodle.org');
$moodleorgstatsurl = html_writer::link('http://moodle.org/stats', get_string('statsmoodleorg', 'admin'));
$moochurl = html_writer::link(HUB_MOODLEORGHUBURL, get_string('moodleorghubname', 'admin'));
$moodleorgregmsg = get_string('registermoodleorg', 'admin', $moodleorgurl);
$items = array(get_string('registermoodleorgli1', 'admin'), get_string('registermoodleorgli2', 'admin', $moodleorgstatsurl), get_string('registermoodleorgli3', 'admin', $moochurl));
$moodleorgregmsg .= html_writer::alist($items);
return $moodleorgregmsg;
}
示例6: render_library_content
public function render_library_content($config, $id)
{
$this->page->requires->js('/blocks/library/module.js');
$html = html_writer::start_div('library-block');
// Build the Header.
$headerimage = html_writer::empty_tag('img', array('src' => '/blocks/library/pix/library-banner.jpg'));
$header = html_writer::link(get_string('universityhomelink', 'block_library'), $headerimage, array('target' => '_blank'));
$header .= html_writer::link(get_string('libraryloginlink', 'block_library'), get_string('librarylogin', 'block_library'), array('class' => 'my-account', 'target' => '_blank'));
// Library search.
if (empty($config) || $config->enablesearch == 1) {
$search = '';
$search .= html_writer::start_tag('form', array('onsubmit' => 'return M.block_library.ebscoHostSearchGo(this);', 'id' => 'ebscohostCustomSearchBox', 'class' => 'searcher', 'name' => 'ebscoSearch', 'method' => 'post'));
$search .= html_writer::tag('input', '', array('id' => 'ebscohostwindow', 'name' => 'ebscohostwindow', 'type' => 'hidden', 'value' => '0'));
$search .= html_writer::tag('input', '', array('id' => 'ebscohosturl', 'name' => 'ebscohosturl', 'type' => 'hidden', 'value' => get_string('ebscohosturl', 'block_library')));
$search .= html_writer::tag('input', '', array('id' => 'ebscohostsearchsrc', 'name' => 'ebscohostsearchsrc', 'type' => 'hidden', 'value' => 'db'));
$search .= html_writer::tag('input', '', array('id' => 'ebscohostsearchmode', 'name' => 'ebscohostsearchmode', 'type' => 'hidden', 'value' => '+'));
$search .= html_writer::tag('input', '', array('id' => 'ebscohostkeywords', 'name' => 'ebscohostkeywords', 'type' => 'hidden'));
$search .= html_writer::tag('input', '', array('id' => 'oversizeNiceInput', 'name' => 'ebscohostsearchtext', 'type' => 'text', 'class' => 'oversize input-text front', 'title' => get_string('searchtip', 'block_library'), 'placeholder' => get_string('findbooks', 'block_library')));
$search .= html_writer::tag('button', get_string('searchbuttontext', 'block_library'), array('type' => 'submit', 'value' => 'Search', 'class' => 'lib_button mleft', 'onclick' => '_gaq.push([\'_trackEvent\', \'eds\', \'clicked\'])'));
$search .= html_writer::end_tag('form');
}
$html .= $header;
$html .= $search;
// Library Links.
if (empty($config) || $config->enablelibrarylinks == 1) {
$llinks = '';
$llinks .= html_writer::tag('div', get_string('library_links', 'block_library'), array('class' => 'library-links'));
$html .= $llinks;
}
// Course links.
if (!empty($config->enablecourselinks) && $config->enablecourselinks == 1 && !empty($config->rawhtml['text'])) {
$clinks = '';
$clinks .= html_writer::start_tag('div');
$clinks .= html_writer::tag('p', get_string('librarycourse', 'block_library'), array('class' => 'library-coursetitle'));
$clinks .= $config->rawhtml['text'];
$clinks .= html_writer::end_tag('div');
$html .= $clinks;
}
// Build the footer content.
$listitems = array();
$askcontent = '';
if (empty($config) || $config->enableaskbubble == 1) {
$listitems[] = html_writer::link(get_string('asklibrarystafflink', 'block_library'), get_string('asklibrarystaff', 'block_library'), array('class' => 'ask-main', 'target' => '_blank'));
$listitems[] = html_writer::link(get_string('asklibrarystafflink', 'block_library'), get_string('textstaff', 'block_library'), array('target' => '_blank'));
$listitems[] = html_writer::link(get_string('chatwithstafflink', 'block_library'), get_string('chatwithstaff', 'block_library'), array('target' => '_blank'));
$listitems[] = html_writer::link(get_string('emailstafflink', 'block_library'), get_string('emailstaff', 'block_library'), array('target' => '_blank'));
$listitems[] = html_writer::link(get_string('asklibrarystafflink', 'block_library'), get_string('phonestaff', 'block_library'), array('class' => 'last', 'target' => '_blank'));
$askcontent = html_writer::alist($listitems, array('class' => 'ask'));
}
$footer = html_writer::tag('div', $askcontent, array('class' => 'library-bottom'));
$html .= $footer;
$html .= html_writer::end_div();
return $html;
}
示例7: render_usage_list
/**
* Output array of list_items
* @param array $content
* @param string $stringname - name of string to use for title and no content
* @param bool $heading - include a heading with help?
* @return string
*/
public function render_usage_list($content, $stringname, $heading = true)
{
$toreturn = '';
if ($heading) {
$toreturn .= $this->render_usage_list_heading($stringname);
}
if (!empty($content)) {
$toreturn .= html_writer::alist($content, array('class' => 'forumng_usage_list'), 'ol');
} else {
$toreturn .= html_writer::tag('p', get_string($stringname . '_none', 'forumngfeature_usage'));
}
return $toreturn;
}
示例8: get_content
function get_content()
{
// Check if we've already generated content
if (!empty($this->content)) {
return $this->content;
}
// Prep the content
$this->content = new stdClass();
/**
* Prepare the content for this block
*/
$options = blog_get_all_options($this->page);
if (count($options) == 0) {
// Don't display menu block if block is set at site level, and user is not logged in
$this->content->text = '';
if ($this->page->user_is_editing()) {
// If editing is enabled show an informative message
$this->content->text = get_string('blogdisable', 'blog');
}
return $this->content;
}
// Iterate the option types
$menulist = array();
foreach ($options as $types) {
foreach ($types as $link) {
$menulist[] = html_writer::link($link['link'], $link['string']);
}
$menulist[] = '<hr />';
}
// Remove the last element (will be an HR)
array_pop($menulist);
// Display the content as a list
$this->content->text = html_writer::alist($menulist, array('class' => 'list'));
/**
* Prepare the footer for this block
*/
if (has_capability('moodle/blog:search', get_context_instance(CONTEXT_SYSTEM))) {
// Full-text search field
$form = html_writer::tag('label', get_string('search', 'admin'), array('for' => 'blogsearchquery', 'class' => 'accesshide'));
$form .= html_writer::empty_tag('input', array('id' => 'blogsearchquery', 'type' => 'text', 'name' => 'search'));
$form .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('search')));
$this->content->footer = html_writer::tag('form', html_writer::tag('div', $form), array('class' => 'blogsearchform', 'method' => 'get', 'action' => new moodle_url('/blog/index.php')));
} else {
// No footer to display
$this->content->footer = '';
}
// Return the content object
return $this->content;
}
示例9: print_success_summary
/**
* Prints the summary of the made insertions.
*/
function print_success_summary()
{
echo html_writer::start_tag('h4');
echo get_string('success', 'block_mycourse_recommendations');
echo html_writer::end_tag('h4');
echo html_writer::start_tag('hr');
echo 'Summary of importation:';
echo html_writer::start_tag('br');
$insertedcourses = \block_mycourse_recommendations\csv_importer::get_lastinsertedcourses();
$insertedcourses = get_string('importedcourses', 'block_mycourse_recommendations') . $insertedcourses;
$insertedusers = \block_mycourse_recommendations\csv_importer::get_lastinsertedusers();
$insertedusers = get_string('importedusers', 'block_mycourse_recommendations') . $insertedusers;
$insertedlogs = \block_mycourse_recommendations\csv_importer::get_lastinsertedlogs();
$insertedlogs = get_string('importedlogs', 'block_mycourse_recommendations') . $insertedlogs;
echo html_writer::alist(array($insertedcourses, $insertedusers, $insertedlogs));
}
示例10: choose_export_method
public function choose_export_method()
{
global $PAGE;
$output = $this->box_start();
$output .= html_writer::tag('p', '准备将成绩导出到教务处成绩管理系统。');
$output .= html_writer::tag('p', '导出后的成绩只是“保存”在教务处网站,您还有机会审核、修正,然后再提交。');
$output .= html_writer::tag('p', '请选择导出方式:');
$links = array();
$url = $PAGE->url;
$url->params(array('action' => 'totalonly'));
$links[] = html_writer::link($url, '只导出总分');
$url->params(array('action' => 'all'));
$links[] = html_writer::link($url, '导出分项成绩和总分');
$output .= html_writer::alist($links);
$output .= $this->box_end();
return $output;
}
示例11: 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;
}
示例12: get_details
/**
* Get criteria description for displaying to users
*
* @return string
*/
public function get_details($short = '')
{
global $DB, $OUTPUT;
$output = array();
foreach ($this->params as $p) {
$mod = self::get_mod_instance($p['module']);
if (!$mod) {
$str = $OUTPUT->error_text(get_string('error:nosuchmod', 'badges'));
} else {
$str = html_writer::tag('b', '"' . ucfirst($mod->modname) . ' - ' . $mod->name . '"');
if (isset($p['bydate'])) {
$str .= get_string('criteria_descr_bydate', 'badges', userdate($p['bydate'], get_string('strftimedate', 'core_langconfig')));
}
}
$output[] = $str;
}
if ($short) {
return implode(', ', $output);
} else {
return html_writer::alist($output, array(), 'ul');
}
}
示例13: get_content
function get_content()
{
global $CFG, $USER, $DB;
if ($this->content !== NULL) {
return $this->content;
}
if (!isset($this->config->roleid) || empty($this->config->roleid)) {
$this->content->text = get_string('needsconfig', 'block_children');
} else {
// get all the mentees, i.e. users you have a direct assignment to
$contextparams = array($USER->id, CONTEXT_USER, $this->config->roleid);
if ($usercontexts = $DB->get_records_sql("SELECT c.instanceid, c.instanceid, u.firstname, u.lastname\n FROM {role_assignments} ra, {context} c, {user} u\n WHERE ra.userid = ?\n AND ra.contextid = c.id\n AND c.instanceid = u.id\n AND c.contextlevel = ?\n AND ra.roleid = ?\n ORDER BY u.lastname", $contextparams)) {
$users = array();
foreach ($usercontexts as $usercontext) {
$userurl = new moodle_url('/user/view.php', array('id' => $usercontext->instanceid, 'course' => SITEID));
$users[] = html_writer::link($userurl, fullname($usercontext));
}
$this->content->text = html_writer::alist($users);
}
}
$this->content->footer = '';
return $this->content;
}
示例14: review_list
function review_list($courseswithreviews)
{
$output = '';
foreach ($courseswithreviews as $session) {
if (!empty($session->courses)) {
$output .= $this->output->heading($session->name, 3);
$courselinks = array();
foreach ($session->courses as $course) {
if ($course->reviewtype == PROGRESSREVIEW_SUBJECT) {
$reviewurl = new moodle_url('/local/progressreview/subjectreview.php', array('sessionid' => $session->id, 'courseid' => $course->id));
} else {
if ($course->reviewtype == PROGRESSREVIEW_TUTOR) {
$reviewurl = new moodle_url('/local/progressreview/tutorreview.php', array('sessionid' => $session->id, 'courseid' => $course->id));
} else {
throw new coding_exception('Each course must have a reviewtype set to either PROGRESSREVIEW_SUBJECT or PROGRESSREVIEW_TUTOR');
}
}
$courselinks[] = html_writer::link($reviewurl, $course->fullname);
}
$output .= html_writer::alist($courselinks);
}
}
return $output;
}
示例15: get_content
function get_content()
{
global $CFG;
// detect if blog enabled
if ($this->content !== NULL) {
return $this->content;
}
if (empty($CFG->enableblogs)) {
$this->content = new stdClass();
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('blogdisable', 'blog');
}
return $this->content;
} else {
if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL and (!isloggedin() or isguestuser())) {
$this->content = new stdClass();
$this->content->text = '';
return $this->content;
}
}
// require necessary libs and get content
require_once $CFG->dirroot . '/blog/lib.php';
// Prep the content
$this->content = new stdClass();
$options = blog_get_all_options($this->page);
if (count($options) == 0) {
$this->content->text = '';
return $this->content;
}
// Iterate the option types
$menulist = array();
foreach ($options as $types) {
foreach ($types as $link) {
$menulist[] = html_writer::link($link['link'], $link['string']);
}
$menulist[] = '<hr />';
}
// Remove the last element (will be an HR)
array_pop($menulist);
// Display the content as a list
$this->content->text = html_writer::alist($menulist, array('class' => 'list'));
// Prepare the footer for this block
if (has_capability('moodle/blog:search', context_system::instance())) {
// Full-text search field
$form = html_writer::tag('label', get_string('search', 'admin'), array('for' => 'blogsearchquery', 'class' => 'accesshide'));
$form .= html_writer::empty_tag('input', array('id' => 'blogsearchquery', 'type' => 'text', 'name' => 'search'));
$form .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('search')));
$this->content->footer = html_writer::tag('form', html_writer::tag('div', $form), array('class' => 'blogsearchform', 'method' => 'get', 'action' => new moodle_url('/blog/index.php')));
} else {
// No footer to display
$this->content->footer = '';
}
// Return the content object
return $this->content;
}