本文整理汇总了PHP中html_writer::link方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::link方法的具体用法?PHP html_writer::link怎么用?PHP html_writer::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_replacements
/**
*
*/
public function get_replacements(array $patterns, $entry = null, array $options = array())
{
global $CFG, $OUTPUT;
$replacements = parent::get_replacements($patterns, $entry, $options);
$view = $this->_view;
$df = $view->get_df();
$filter = $view->get_filter();
$baseurl = new moodle_url($view->get_baseurl());
$baseurl->param('sesskey', sesskey());
foreach ($patterns as $pattern) {
switch ($pattern) {
case '##exportall##':
$actionurl = new moodle_url($baseurl, array('pdfexportall' => true));
$label = html_writer::tag('span', get_string('exportall', 'dataformview_pdf'));
$replacements[$pattern] = html_writer::link($actionurl, $label, array('class' => 'actionlink exportall'));
break;
case '##exportpage##':
$actionurl = new moodle_url($baseurl, array('pdfexportpage' => true));
$label = html_writer::tag('span', get_string('exportpage', 'dataformview_pdf'));
$replacements[$pattern] = html_writer::link($actionurl, $label, array('class' => 'actionlink exportpage'));
break;
case '##pagebreak##':
$replacements[$pattern] = $view::PAGE_BREAK;
break;
}
}
return $replacements;
}
示例2: get_content
function get_content() {
global $USER,$DB;
if ($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass();
$this->content->items = array();
$is_manager = $DB->record_exists_sql("select cp.* from {local_costcenter_permissions} as cp
JOIN {role_assignments} as ra ON ra.userid=cp.userid and cp.userid=$USER->id
JOIN {role} as r ON r.id=ra.roleid
where r.archetype='manager'");
$is_teammanager = $DB->record_exists('local_teammanager_employee', array('teammanagerid'=>$USER->id));
if($is_manager || is_siteadmin())
$link = array(html_writer::link(new moodle_url('/local/users/index.php'),get_string('pluginname','local_users')));
if(is_siteadmin())
$link[] = html_writer::link(new moodle_url('/local/costcenter/index.php'),get_string('pluginname','local_costcenter'));
if($is_manager || is_siteadmin())
$link[] = html_writer::link(new moodle_url('/local/teammanager/index.php'),get_string('pluginname', 'local_teammanager'));
if($is_teammanager && !is_siteadmin())
$link[] = html_writer::link(new moodle_url('/local/teammanager/myteam.php'),get_string('viewmyteam', 'local_teammanager'));
if($is_manager || is_siteadmin())
$link[] = html_writer::link(new moodle_url('/local/costcenter/courses.php'),get_string('course'));
$this->content->items = $link;
$this->content->icons = '';
$this->content->footer = '';
return $this->content;
}
示例3: render_section_links
/**
* Render a series of section links.
*
* @param stdClass $course The course we are rendering for.
* @param array $sections An array of section objects to render.
* @param bool|int The section to provide a jump to link for.
* @return string The HTML to display.
*/
public function render_section_links(stdClass $course, array $sections, $jumptosection = false)
{
$html = html_writer::start_tag('ol', array('class' => 'inline-list'));
foreach ($sections as $section) {
$attributes = array();
if (!$section->visible) {
$attributes['class'] = 'dimmed';
}
$html .= html_writer::start_tag('li');
$sectiontext = $section->section;
if ($section->highlight) {
$sectiontext = html_writer::tag('strong', $sectiontext);
}
$html .= html_writer::link(course_get_url($course, $section->section), $sectiontext, $attributes);
$html .= html_writer::end_tag('li') . ' ';
}
$html .= html_writer::end_tag('ol');
if ($jumptosection && isset($sections[$jumptosection])) {
if ($course->format == 'weeks') {
$linktext = new lang_string('jumptocurrentweek', 'block_section_links');
} else {
if ($course->format == 'topics') {
$linktext = new lang_string('jumptocurrenttopic', 'block_section_links');
}
}
$attributes = array();
if (!$sections[$jumptosection]->visible) {
$attributes['class'] = 'dimmed';
}
$html .= html_writer::link(course_get_url($course, $jumptosection), $linktext, $attributes);
}
return $html;
}
示例4: display_browse_field
public function display_browse_field($recordid, $template)
{
global $DB, $CFG;
if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
if (empty($content->content)) {
return false;
}
$options = explode("\n", $this->field->param1);
$options = array_map('trim', $options);
$contentarray = explode('##', $content->content);
$str = '';
foreach ($contentarray as $line) {
if (!in_array($line, $options)) {
// Somebody edited the field definition.
continue;
}
$params = array("f_{$this->field->id}" => $line, 'd' => $this->data->id, 'advanced' => 1);
$url = new moodle_url('/mod/data/view.php', $params);
$link = html_writer::link($url, $line);
$str .= $link . "<br />\n";
}
return $str;
}
return false;
}
示例5: htmllize_tree
/**
* Internal function - creates htmls structure suitable for YUI tree.
*/
protected function htmllize_tree($tree, $dir)
{
global $CFG;
$yuiconfig = array();
$yuiconfig['type'] = 'html';
if (empty($dir['subdirs']) and empty($dir['files'])) {
return '';
}
$result = '<ul>';
foreach ($dir['subdirs'] as $subdir) {
$image = $this->output->pix_icon("f/folder", $subdir['dirname'], 'moodle', array('class' => 'icon'));
$result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'><div>' . $image . ' ' . s($subdir['dirname']) . '</div> ' . $this->htmllize_tree($tree, $subdir) . '</li>';
}
foreach ($dir['files'] as $file) {
$url = file_encode_url("{$CFG->wwwroot}/blocks/csv_enrol/getfile.php", '/' . $tree->context->id . '/user/csvenrol' . $file->get_filepath() . $file->get_filename(), true);
$filename = $file->get_filename();
$icon = mimeinfo("icon", $filename);
if (strlen($filename) > 10) {
$pi = pathinfo($filename);
$txt = $pi['filename'];
$ext = $pi['extension'];
$filename = substr($filename, 0, 14) . '...' . $ext;
}
$image = $this->output->pix_icon("f/{$icon}", $filename, 'moodle', array('class' => 'icon'));
$result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'><div>' . html_writer::link($url, $image . ' ' . $filename) . '</div></li>';
}
$result .= '</ul>';
return $result;
}
示例6: glossary_show_entry_entrylist
function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode = '', $hook = '', $printicons = 1, $aliases = true)
{
global $USER, $OUTPUT;
$return = false;
echo '<table class="glossarypost entrylist" cellspacing="0">';
echo '<tr valign="top">';
echo '<td class="entry">';
if ($entry) {
glossary_print_entry_approval($cm, $entry, $mode);
$anchortagcontents = glossary_print_entry_concept($entry, true);
$link = new moodle_url('/mod/glossary/showentry.php', array('courseid' => $course->id, 'eid' => $entry->id, 'displayformat' => 'dictionary'));
$anchor = html_writer::link($link, $anchortagcontents);
echo "<div class=\"concept\">{$anchor}</div> ";
echo '</td><td align="right" class="entrylowersection">';
if ($printicons) {
glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook, 'print');
}
if (!empty($entry->rating)) {
echo '<br />';
echo '<span class="ratings">';
$return = glossary_print_entry_ratings($course, $entry);
echo '</span>';
}
echo '<br />';
} else {
echo '<div style="text-align:center">';
print_string('noentry', 'glossary');
echo '</div>';
}
echo '</td></tr>';
echo "</table>\n";
return $return;
}
示例7: get_content
public function get_content()
{
global $CFG, $OUTPUT, $USER, $PAGE, $DB;
if ($this->content !== null) {
return $this->content;
}
$config = turnitintooltwo_admin_config();
$output = '';
// Show link to Helpdesk wizard if enabled and the logged in user is an instrutor.
if (!empty($USER->id) && $config->helpdeskwizard && has_capability('moodle/course:manageactivities', context_system::instance())) {
$output = $OUTPUT->box(html_writer::tag('p', html_writer::link($CFG->wwwroot . '/mod/turnitintooltwo/extras.php?cmd=supportwizard', get_string('helpdesklink', 'block_turnitin'))));
}
if (!empty($USER->id) && has_capability('moodle/course:create', context_system::instance())) {
$PAGE->requires->jquery();
$PAGE->requires->jquery_plugin('block-turnitin', 'block_turnitin');
$cssurl = new moodle_url($CFG->wwwroot . '/mod/turnitintooltwo/css/styles_block.css');
$PAGE->requires->css($cssurl);
$output .= $OUTPUT->box($OUTPUT->pix_icon('loader', '', 'mod_turnitintooltwo'), 'centered_cell', 'block_loading');
$output .= html_writer::link($CFG->wwwroot . '/mod/turnitintooltwo/extras.php?cmd=courses', html_writer::tag('noscript', get_string('coursestomigrate', 'block_turnitin', '')), array('id' => 'block_migrate_content'));
}
$this->content = new stdClass();
$this->content->text = $output;
$this->content->footer = '';
return $this->content;
}
示例8: definition_inner
protected function definition_inner($mform)
{
global $PAGE, $CFG;
$PAGE->requires->css('/question/type/easyoselectjs/easyoselectjs_styles.css');
$marvinjsconfig = get_config('qtype_easyoselectjs_options');
$marvinjspath = $marvinjsconfig->path;
$protocol = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://';
$PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/promise-0.1.1.min.js'));
$PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/marvinjslauncher.js'));
$mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'qtype_easyoselectjs'), get_string('filloutoneanswer', 'qtype_easyoselectjs'));
$mform->closeHeaderBefore('answersinstruct');
$mform->setType('structure', PARAM_RAW);
$mform->addElement('hidden', 'structure', "", array('id' => 'id_structure'));
$mform->addElement('html', html_writer::start_tag('div', array('id' => 'appletdiv', 'class' => 'easyomechjs resizable')));
$mform->addElement('html', html_writer::start_tag('div', array('style' => 'float: left;font-style: italic ;')));
$mform->addElement('html', html_writer::start_tag('small'));
$easyoselectjshomeurl = 'http://www.chemaxon.com';
$mform->addElement('html', html_writer::link($easyoselectjshomeurl, get_string('easyoselectjseditor', 'qtype_easyoselectjs')));
$mform->addElement('html', html_writer::empty_tag('br'));
$mform->addElement('html', html_writer::tag('span', get_string('author', 'qtype_easyoselectjs'), array('class' => 'easyoselectjsauthor')));
$mform->addElement('html', html_writer::end_tag('small'));
$mform->addElement('html', html_writer::end_tag('div'));
$mform->addElement('html', html_writer::end_tag('div'));
$marvinconfig = get_config('qtype_easyoselectjs_options');
$marvinpath = $marvinconfig->path;
$PAGE->requires->js_init_call('M.qtype_easyoselectjs.insert_applet', array($CFG->wwwroot, $marvinpath));
$this->add_per_answer_fields($mform, get_string('answerno', 'qtype_easyoselectjs', '{no}'), question_bank::fraction_options());
$this->add_interactive_settings();
$PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_getanswerstring', array($CFG->version));
$PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_viewanswerstring', array($CFG->version));
}
示例9: get_content
public function get_content()
{
global $CFG, $OUTPUT, $USER, $PAGE, $DB;
if ($this->content !== null) {
return $this->content;
}
$output = '';
if (!empty($USER->id) && has_capability('moodle/course:create', context_system::instance())) {
if ($CFG->branch <= 25) {
$jsurl = new moodle_url($CFG->wwwroot . '/mod/turnitintooltwo/jquery/jquery-1.8.2.min.js');
$PAGE->requires->js($jsurl, true);
$jsurl = new moodle_url($CFG->wwwroot . '/mod/turnitintooltwo/jquery/block_turnitin.js');
$PAGE->requires->js($jsurl, true);
} else {
$PAGE->requires->jquery();
$PAGE->requires->jquery_plugin('turnitintooltwo-block', 'mod_turnitintooltwo');
}
$cssurl = new moodle_url($CFG->wwwroot . '/mod/turnitintooltwo/css/styles_block.css');
$PAGE->requires->css($cssurl);
$output .= $OUTPUT->box($OUTPUT->pix_icon('loader', '', 'mod_turnitintooltwo'), 'centered_cell', 'block_loading');
$output .= html_writer::link($CFG->wwwroot . '/mod/turnitintooltwo/extras.php?cmd=courses', html_writer::tag('noscript', get_string('coursestomigrate', 'mod_turnitintooltwo', '')), array('id' => 'block_migrate_content'));
}
$this->content = new stdClass();
$this->content->text = $output;
$this->content->footer = '';
return $this->content;
}
示例10: get_content
public function get_content()
{
global $USER;
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass();
$this->content->items = array();
$this->content->icons = array();
$managecourses = new moodle_url('/blocks/ps_selfstudy/managecourses.php');
$viewrequests = new moodle_url('/blocks/ps_selfstudy/viewrequests.php');
$myrequests = new moodle_url('/blocks/ps_selfstudy/myrequests.php');
$viewcompletion = new moodle_url('/blocks/ps_selfstudy/viewcompletion.php');
$context = context_system::instance();
if (has_capability('block/ps_selfstudy:managecourses', $context, $USER->id)) {
$this->content->items[] = html_writer::link($managecourses, get_string('link_managecourses', 'block_ps_selfstudy'));
}
if (has_capability('block/ps_selfstudy:viewrequests', $context, $USER->id)) {
$this->content->items[] = html_writer::link($viewrequests, get_string('link_requests', 'block_ps_selfstudy'));
}
if (has_capability('block/ps_selfstudy:viewrequests', $context, $USER->id)) {
$this->content->items[] = html_writer::link($viewcompletion, get_string('link_completion', 'block_ps_selfstudy'));
}
if (has_capability('block/ps_selfstudy:myrequests', $context, $USER->id)) {
$this->content->items[] = html_writer::link($myrequests, get_string('link_myrequests', 'block_ps_selfstudy'));
}
return $this->content;
}
示例11: __construct
/**
* Constructor
*
* @param string|moodle_url $pageurl
*/
public function __construct($pageurl)
{
global $OUTPUT;
parent::__construct();
$this->attributes['class'] = 'generaltable tag-areas-table';
$this->head = array(get_string('tagareaname', 'core_tag'), get_string('component', 'tag'), get_string('tagareaenabled', 'core_tag'), get_string('tagcollection', 'tag'));
$this->data = array();
$this->rowclasses = array();
$tagareas = core_tag_area::get_areas();
$tagcollections = core_tag_collection::get_collections_menu(true);
$tagcollectionsall = core_tag_collection::get_collections_menu();
foreach ($tagareas as $itemtype => $it) {
foreach ($it as $component => $record) {
$areaname = core_tag_area::display_name($record->component, $record->itemtype);
$baseurl = new moodle_url($pageurl, array('ta' => $record->id, 'sesskey' => sesskey()));
if ($record->enabled) {
$enableurl = new moodle_url($baseurl, array('action' => 'areadisable'));
$enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/hide', get_string('disable')));
} else {
$enableurl = new moodle_url($baseurl, array('action' => 'areaenable'));
$enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/show', get_string('enable')));
}
if ($record->enabled && empty($record->locked) && count($tagcollections) > 1) {
$changecollurl = new moodle_url($baseurl, array('action' => 'areasetcoll'));
$select = new single_select($changecollurl, 'areacollid', $tagcollections, $record->tagcollid, null);
$select->set_label(get_string('changetagcoll', 'core_tag', $areaname), array('class' => 'accesshide'));
$collectionselect = $OUTPUT->render($select);
} else {
$collectionselect = $tagcollectionsall[$record->tagcollid];
}
$this->data[] = array($areaname, $record->component === 'core' || preg_match('/^core_/', $record->component) ? get_string('coresystem') : get_string('pluginname', $record->component), $enabled, $collectionselect);
$this->rowclasses[] = $record->enabled ? '' : 'dimmed_text';
}
}
}
示例12: get_content
public function get_content()
{
global $CFG, $PAGE;
?>
<script src="<?php
echo $CFG->wwwroot . '/blocks/my_enrolled_courses/js/jquery-1.10.2.js';
?>
"></script>
<script src="<?php
echo $CFG->wwwroot . '/blocks/my_enrolled_courses/js/jquery-ui.min.js';
?>
"></script>
<?php
$PAGE->requires->js('/blocks/my_enrolled_courses/js/sorting.js');
$PAGE->requires->data_for_js('wwwroot', $CFG->wwwroot);
$PAGE->requires->css('/blocks/my_enrolled_courses/style.css');
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass();
$html = block_my_enrolled_courses_visible_in_block();
$this->content->text = $html;
$url = new moodle_url($CFG->wwwroot . '/blocks/my_enrolled_courses/showhide.php', array('contextid' => $this->context->id));
$showhidetext = get_string('showhide', 'block_my_enrolled_courses');
$link = html_writer::link($url, $showhidetext);
$this->content->footer = $link;
return $this->content;
}
示例13: htmllize_tree
/**
* Internal function - creates htmls structure suitable for YUI tree.
*/
protected function htmllize_tree($tree, $dir) {
global $CFG;
if (empty($dir['subdirs']) and empty($dir['files'])) {
return '';
}
$browser = get_file_browser();
$result = '<ul>';
foreach ($dir['subdirs'] as $subdir) {
$image = $this->output->pix_icon(file_folder_icon(24), $subdir['dirname'], 'moodle');
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', s($subdir['dirname']), array('class' => 'fp-filename'));
$filename = html_writer::tag('div', $filename, array('class' => 'fp-filename-icon'));
$result .= html_writer::tag('li', $filename. $this->htmllize_tree($tree, $subdir));
}
foreach ($dir['files'] as $file) {
$fileinfo = $browser->get_file_info($tree->context, $file->get_component(),
$file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $file->get_filename());
$url = $fileinfo->get_url(true);
$filename = $file->get_filename();
if ($imageinfo = $fileinfo->get_imageinfo()) {
$fileurl = new moodle_url($fileinfo->get_url());
$image = $fileurl->out(false, array('preview' => 'tinyicon', 'oid' => $fileinfo->get_timemodified()));
$image = html_writer::empty_tag('img', array('src' => $image));
} else {
$image = $this->output->pix_icon(file_file_icon($file, 24), $filename, 'moodle');
}
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', $filename, array('class' => 'fp-filename'));
$filename = html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'fp-filename-icon'));
$result .= html_writer::tag('li', $filename);
}
$result .= '</ul>';
return $result;
}
示例14: 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;
}
示例15: 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;
}