mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
MDL-20204 converting link to html_writer or action_link
This commit is contained in:
parent
c80877aa0e
commit
75015e5fc1
@ -839,9 +839,7 @@
|
||||
echo '</form>';
|
||||
$preview_url = lang_help_preview_url($currentfile, !$uselocal);
|
||||
if ($preview_url) {
|
||||
$link = html_link::make($preview_url, get_string('preview'));
|
||||
$link->add_action(new popup_action('click', $link->url));
|
||||
echo $OUTPUT->link($link);
|
||||
echo $OUTPUT->action_link($preview_url, get_string('preview'), new popup_action('click', $preview_url));
|
||||
}
|
||||
echo '</fieldset>';
|
||||
}
|
||||
@ -859,9 +857,7 @@
|
||||
echo "</textarea>\n</div>\n";
|
||||
$preview_url = lang_help_preview_url($currentfile, $uselocal);
|
||||
if ($preview_url) {
|
||||
$link = html_link::make($preview_url, get_string('preview'));
|
||||
$link->add_action(new popup_action('click', $link->url));
|
||||
echo $OUTPUT->link($link);
|
||||
echo $OUTPUT->action_link($preview_url, get_string('preview'), new popup_action('click', $preview_url));
|
||||
}
|
||||
echo '</fieldset>';
|
||||
}
|
||||
@ -883,9 +879,7 @@
|
||||
echo "</textarea>\n</div>\n";
|
||||
$preview_url = lang_help_preview_url($currentfile, true, 'en_utf8'); // do not display en_utf8_local
|
||||
if ($preview_url) {
|
||||
$link = html_link::make($preview_url, get_string('preview'));
|
||||
$link->add_action(new popup_action('click', $link->url));
|
||||
echo $OUTPUT->link($link);
|
||||
echo $OUTPUT->action_link($preview_url, get_string('preview'), new popup_action('click', $preview_url));
|
||||
}
|
||||
echo '</fieldset>';
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ asort($plugins, SORT_LOCALE_STRING);
|
||||
|
||||
foreach ($plugins as $plugin => $name) {
|
||||
$delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
|
||||
$delete = $OUTPUT->link($delete, get_string('delete'));
|
||||
$delete = html_writer::link($delete, get_string('delete'));
|
||||
|
||||
$version = get_config('local_' . $plugin);
|
||||
if (!empty($version->version)) {
|
||||
|
@ -58,14 +58,14 @@ $original_theme = fullclone($THEME);
|
||||
|
||||
if (file_exists($CFG->themedir.'/'.$theme.'/README.html')) {
|
||||
$readme = '<li>'.
|
||||
$link = html_link::make($CFG->themewww .'/'. $theme .'/README.html', $strinfo);
|
||||
$link->add_action(new popup_action('click', $link->url, $theme, array('height' => 400, 'width' => 500)));
|
||||
echo $OUTPUT->link($link);
|
||||
$link = $CFG->themewww .'/'. $theme .'/README.html';
|
||||
$action = new popup_action('click', $link, $theme, array('height' => 400, 'width' => 500));
|
||||
echo $OUTPUT->action_link($link, strinfo, $action);
|
||||
} else if (file_exists($CFG->themedir.'/'.$theme.'/README.txt')) {
|
||||
$readme = '<li>'.
|
||||
$link = html_link::make($CFG->themewww .'/'. $theme .'/README.txt', $strinfo);
|
||||
$link->add_action(new popup_action('click', $link->url, $theme, array('height' => 400, 'width' => 500)));
|
||||
echo $OUTPUT->link($link);
|
||||
$link = $CFG->themewww .'/'. $theme .'/README.txt';
|
||||
$action = new popup_action('click', $link, $theme, array('height' => 400, 'width' => 500));
|
||||
echo $OUTPUT->action_link($link, $strinfo, $action);
|
||||
}
|
||||
if (file_exists("$theme/screenshot.png")) {
|
||||
$screenshotpath = "$theme/screenshot.png";
|
||||
|
@ -221,7 +221,7 @@ foreach($hosts as $host) {
|
||||
$hosturl = new moodle_url($baseurl, array('hostid' => $host->id));
|
||||
// process all hosts first since it's the easiest
|
||||
if ($host->id == $CFG->mnet_all_hosts_id) {
|
||||
$table->data[] = array($OUTPUT->link($hosturl, $host->name), '', '', '');
|
||||
$table->data[] = array(html_writer::tag('a', array('href'=>$hosturl), $host->name), '', '', '');
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -231,8 +231,8 @@ foreach($hosts as $host) {
|
||||
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
|
||||
}
|
||||
$table->data[] = array(
|
||||
$OUTPUT->link($hosturl, $host->name),
|
||||
$OUTPUT->link($hosturl, $host->wwwroot),
|
||||
html_writer::link($hosturl, $host->name),
|
||||
html_writer::link($hosturl, $host->wwwroot),
|
||||
$last_connect,
|
||||
$OUTPUT->single_button(new moodle_url('/admin/mnet/delete.php', array('hostid' => $host->id)), get_string('delete'))
|
||||
);
|
||||
|
@ -49,7 +49,7 @@ foreach ($hosts as $id => $host) {
|
||||
continue;
|
||||
}
|
||||
$newurl = new moodle_url($url, array('hostid' => $host->id));
|
||||
echo '<p>' . $OUTPUT->link($newurl, $host->wwwroot) . '</p>';
|
||||
echo '<p>' . html_writer::link($newurl, $host->wwwroot) . '</p>';
|
||||
}
|
||||
|
||||
if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
@ -118,7 +118,7 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
$servicedata['apiversion'],
|
||||
$yesno[$servicedata['publish']],
|
||||
$yesno[$servicedata['subscribe']],
|
||||
$OUTPUT->link($newurl, get_string('listservices', 'mnet'))
|
||||
html_writer::link($newurl, get_string('listservices', 'mnet'))
|
||||
);
|
||||
|
||||
}
|
||||
@ -153,7 +153,7 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
$newurl = new moodle_url($url, $params);
|
||||
$table->data[] = array(
|
||||
$method,
|
||||
$OUTPUT->link($newurl, get_string('inspect', 'mnet'))
|
||||
html_writer::link($newurl, get_string('inspect', 'mnet'))
|
||||
);
|
||||
}
|
||||
echo $OUTPUT->table($table);
|
||||
|
@ -250,10 +250,10 @@ class explain_capability_table extends capability_table_base {
|
||||
echo '<td>' . $result . '</td>';
|
||||
echo '<td>';
|
||||
|
||||
$link = html_link::make($this->baseurl . $capability->name, $this->strexplanation);
|
||||
$link->add_action(new popup_action('click', $link->url, 'hascapabilityexplanation', array('height' => 600, 'width' => 600)));
|
||||
$link->title = get_string($tooltip, 'role', $a);
|
||||
echo $OUTPUT->link($link);
|
||||
$url = $this->baseurl . $capability->name;
|
||||
echo $OUTPUT->action_link($url, $this->strexplanation,
|
||||
new popup_action('click', $url, 'hascapabilityexplanation', array('height' => 600, 'width' => 600)),
|
||||
array('title'=>get_string($tooltip, 'role', $a)));
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
@ -419,12 +419,9 @@ abstract class capability_table_with_risks extends capability_table_base {
|
||||
global $OUTPUT;
|
||||
if (!isset($this->riskicons[$type])) {
|
||||
$iconurl = $OUTPUT->pix_url('i/' . str_replace('risk', 'risk_', $type));
|
||||
|
||||
$link = html_link::make($this->risksurl, '<img src="' . $iconurl . '" alt="' . get_string($type . 'short', 'admin') . '" />');
|
||||
$link->add_action(new popup_action('click', $link->url, 'docspopup'));
|
||||
$link->title = get_string($type, 'admin');
|
||||
|
||||
$this->riskicons[$type] = $OUTPUT->link($link);
|
||||
$text = '<img src="' . $iconurl . '" alt="' . get_string($type . 'short', 'admin') . '" />';
|
||||
$action = new popup_action('click', $this->risksurl, 'docspopup');
|
||||
$this->riskicons[$type] = $OUTPUT->action_link($this->risksurl, $text, $action, array('title'=>get_string($type, 'admin')));
|
||||
}
|
||||
return $this->riskicons[$type];
|
||||
}
|
||||
|
@ -79,43 +79,44 @@ class block_blog_menu extends block_base {
|
||||
$menulist->add_class('list');
|
||||
|
||||
if (!empty($blogheaders['strview']) && $CFG->useblogassociations) {
|
||||
$url = html_link::make($blogheaders['url'], $blogheaders['strview']);
|
||||
if ($blogheaders['url']->compare($PAGE->url)) {
|
||||
$url->disabled = true;
|
||||
if ($blogheaders['url']->compare($PAGE->url) == URL_MATCH_EXACT) {
|
||||
$menulist->add_item(html_writer::tag('span', array('class'=>'current'), $blogheaders['strview']));
|
||||
} else {
|
||||
$menulist->add_item(html_writer::link($blogheaders['url'], $blogheaders['strview']));
|
||||
}
|
||||
$menulist->add_item($OUTPUT->link($url));
|
||||
}
|
||||
|
||||
// show View site entries link
|
||||
if ($CFG->bloglevel >= BLOG_SITE_LEVEL && $canviewblogs) {
|
||||
$viewsiteentriesurl = html_link::make($CFG->wwwroot .'/blog/index.php', get_string('viewsiteentries', 'blog'));
|
||||
if (!$PAGE->url->param('search') && !$PAGE->url->param('tag') && !$PAGE->url->param('tagid') &&
|
||||
!$PAGE->url->param('modid') && !$PAGE->url->param('courseid') && !$PAGE->url->param('userid') && !$PAGE->url->param('entryid')) {
|
||||
$viewsiteentriesurl->disableifcurrent = true;
|
||||
// no
|
||||
} else {
|
||||
$menulist->add_item(html_writer::add($CFG->wwwroot .'/blog/index.php', get_string('viewsiteentries', 'blog')));
|
||||
}
|
||||
$menulist->add_item($OUTPUT->link($viewsiteentriesurl));
|
||||
}
|
||||
|
||||
$output .= '';
|
||||
|
||||
// show View my entries link
|
||||
$myentrieslink = html_link::make(new moodle_url('/blog/index.php', array('userid' => $USER->id)), get_string('viewmyentries', 'blog'));
|
||||
$myentrieslink->url->params($blogheaders['url']->params());
|
||||
$myentrieslink->url->param('userid', $USER->id);
|
||||
$pageuserid = $PAGE->url->param('userid');
|
||||
if (!empty($pageuserid) && $pageuserid == $USER->id) {
|
||||
$myentrieslink->disabled = true;
|
||||
// no
|
||||
} else {
|
||||
$murl = new moodle_url('/blog/index.php', array('userid' => $USER->id));
|
||||
$murl->params($blogheaders['url']->params());
|
||||
$murl->param('userid', $USER->id);
|
||||
$menulist->add_item(html_writer::link($murl, get_string('viewmyentries', 'blog')));
|
||||
}
|
||||
|
||||
$menulist->add_item($OUTPUT->link($myentrieslink));
|
||||
|
||||
// show "Add entry" or "Blog about this" link
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (has_capability('moodle/blog:create', $sitecontext)) {
|
||||
$addentrylink = html_link::make(new moodle_url('/blog/edit.php', array('action' => 'add')), $blogheaders['stradd']);
|
||||
$addentrylink->url->params($blogheaders['url']->params());
|
||||
$addentrylink->disableifcurrent = true;
|
||||
$menulist->add_item($OUTPUT->link($addentrylink));
|
||||
$aurl = new moodle_url('/blog/edit.php', array('action' => 'add'));
|
||||
$aurl->params($blogheaders['url']->params());
|
||||
if ($PAGE->url->compare($aurl) != URL_MATCH_EXACT) {
|
||||
$menulist->add_item(html_writer::link($aurl, $blogheaders['stradd']));
|
||||
}
|
||||
}
|
||||
|
||||
// Full-text search field
|
||||
|
@ -135,7 +135,7 @@ echo '<div class="actionbuttons">' . $OUTPUT->single_button($url, get_string('ad
|
||||
|
||||
|
||||
if ($returnurl) {
|
||||
echo '<div class="backlink">' . $OUTPUT->link($returnurl, get_string('back')) . '</div>';
|
||||
echo '<div class="backlink">' . html_writer::link($returnurl, get_string('back')) . '</div>';
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -91,6 +91,6 @@ if (!empty($blogs)) {
|
||||
}
|
||||
|
||||
$newexternalurl = new moodle_url('/blog/external_blog_edit.php');
|
||||
echo $OUTPUT->link(html_link::make($newexternalurl, $straddnewexternalblog));
|
||||
echo html_writer::link($newexternalurl, $straddnewexternalblog);
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -412,10 +412,9 @@
|
||||
$OUTPUT->pix_url('i/key') . '" alt="'.$strrequireskey.'" /></a>';
|
||||
}
|
||||
if (!empty($acourse->summary)) {
|
||||
$link = html_link::make("/course/info.php?id=$acourse->id", '<img alt="'.get_string('info').'" class="icon" src="'.$OUTPUT->pix_url('i/info') . '" />');
|
||||
$link->add_action(new popup_action('click', $link->url, 'courseinfo'));
|
||||
$link->title = $strsummary;
|
||||
echo $OUTPUT->link($link);
|
||||
$link = new moodle_url("/course/info.php?id=$acourse->id");
|
||||
echo $OUTPUT->action_link($link, '<img alt="'.get_string('info').'" class="icon" src="'.$OUTPUT->pix_url('i/info') . '" />',
|
||||
new popup_action('click', $link, 'courseinfo'), array('title'=>$strsummary));
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
|
@ -403,19 +403,17 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
|
||||
|
||||
$row[] = userdate($log->time, '%a').' '.userdate($log->time, $strftimedatetime);
|
||||
|
||||
$link = html_link::make("/iplookup/index.php?ip=$log->ip&user=$log->userid", $log->ip);
|
||||
$link->add_action(new popup_action('click', $link->url, 'iplookup', array('height' => 440, 'width' => 700)));
|
||||
$row[] = $OUTPUT->link($link);
|
||||
$link = new moodle_url("/iplookup/index.php?ip=$log->ip&user=$log->userid");
|
||||
$row[] = $OUTPUT->action_link($link, $log->ip, new popup_action('click', $link, 'iplookup', array('height' => 440, 'width' => 700)));
|
||||
|
||||
$row[] = $OUTPUT->link(html_link::make("/user/view.php?id={$log->userid}&course={$log->course}", fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)))));
|
||||
$row[] = html_writer::link(new moodle_url("/user/view.php?id={$log->userid}&course={$log->course}", fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)))));
|
||||
|
||||
$displayaction="$log->module $log->action";
|
||||
if ($brokenurl) {
|
||||
$row[] = $displayaction;
|
||||
} else {
|
||||
$link = html_link::make(make_log_url($log->module,$log->url), $displayaction);
|
||||
$link->add_action(new popup_action('click', $link->url, 'fromloglive'), array('height' => 440, 'width' => 700));
|
||||
$row[] = $OUTPUT->link($link);
|
||||
$link = make_log_url($log->module,$log->url);
|
||||
$row[] = $OUTPUT->action_link($link, $displayaction, new popup_action('click', $link, 'fromloglive'), array('height' => 440, 'width' => 700));
|
||||
}
|
||||
$row[] = $log->info;
|
||||
$table->data[] = $row;
|
||||
@ -511,9 +509,8 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",
|
||||
echo "<td class=\"r$row c1\" align=\"right\">".userdate($log->time, '%a').
|
||||
' '.userdate($log->time, $strftimedatetime)."</td>\n";
|
||||
echo "<td class=\"r$row c2\" >\n";
|
||||
$link = html_link::make("/iplookup/index.php?ip=$log->ip&user=$log->userid", $log->ip);
|
||||
$link->add_action(new popup_action('click', $link->url, 'iplookup', array('height' => 400, 'width' => 700)));
|
||||
echo $OUTPUT->link($link);
|
||||
$link = new moodle_url("/iplookup/index.php?ip=$log->ip&user=$log->userid");
|
||||
echo $OUTPUT->action_link($link, $log->ip, new popup_action('click', $link, 'iplookup', array('height' => 400, 'width' => 700)));
|
||||
echo "</td>\n";
|
||||
$fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
echo "<td class=\"r$row c3\" >\n";
|
||||
@ -2000,10 +1997,10 @@ function print_category_info($category, $depth, $showcourses = false) {
|
||||
echo '<img alt="" style="width:18px;height:16px;" src="'.$OUTPUT->pix_url('spacer') . '" />';
|
||||
}
|
||||
if ($course->summary) {
|
||||
$link = html_link::make('/course/info.php?id='.$course->id, '<img alt="'.$strsummary.'" src="'.$OUTPUT->pix_url('i/info') . '" />');
|
||||
$link->add_action(new popup_action('click', $link->url, 'courseinfo', array('height' => 400, 'width' => 500)));
|
||||
$link->title = $strsummary;
|
||||
echo $OUTPUT->link($link);
|
||||
$link = new moodle_url('/course/info.php?id='.$course->id);
|
||||
echo $OUTPUT->action_link($link, '<img alt="'.$strsummary.'" src="'.$OUTPUT->pix_url('i/info') . '" />',
|
||||
new popup_action('click', $link, 'courseinfo', array('height' => 400, 'width' => 500)),
|
||||
array('title'=>$strsummary));
|
||||
} else {
|
||||
echo '<img alt="" style="width:18px;height:16px;" src="'.$OUTPUT->pix_url('spacer') . '" />';
|
||||
}
|
||||
|
@ -35,9 +35,8 @@
|
||||
echo $OUTPUT->heading(get_string('loglive', 'coursereport_log'));
|
||||
|
||||
echo $OUTPUT->container_start('info');
|
||||
$link = html_link::make('/course/report/log/live.php?id='. $course->id, get_string('livelogs'));
|
||||
$link->add_action(new popup_action('click', $link->url, 'livelog', array('height' => 500, 'width' => 800)));
|
||||
echo $OUTPUT->link($link);
|
||||
$link = new moodle_url('/course/report/log/live.php?id='. $course->id);
|
||||
echo $OUTPUT->action_link($link, get_string('livelogs'), new popup_action('click', $link, 'livelog', array('height' => 500, 'width' => 800)));
|
||||
echo $OUTPUT->container_end();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -16,9 +16,8 @@
|
||||
if (has_capability('coursereport/log:viewlive', $context)) {
|
||||
echo $OUTPUT->heading(get_string('chooselivelogs') .':');
|
||||
echo '<p>';
|
||||
$link = html_link::make('/course/report/log/live.php?id='. $course->id, get_string('livelogs'));
|
||||
$link->add_action(new popup_action('click', $link->url, 'livelog', array('height' => 500, 'width' => 800)));
|
||||
echo $OUTPUT->link($link);
|
||||
$link = new moodle_url('/course/report/log/live.php?id='. $course->id);
|
||||
echo $OUTPUT->action_link($link, get_string('livelogs'), new popup_action('click', $link, 'livelog', array('height' => 500, 'width' => 800)));
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
|
@ -298,9 +298,8 @@ function displaydir($file_info) {
|
||||
}
|
||||
|
||||
if ($viewurl = $child_info->get_url()) {
|
||||
$link = html_link::make($viewurl, "display", "<img src=\"" . $OUTPUT->pix_url('t/preview') . "\" class=\"iconsmall\" alt=\"$strfile\" /> ");
|
||||
$link->add_action(new popup_action('click', $link->url, 'display', array('height' => 480, 'width' => 640)));
|
||||
$viewurl = " ".$OUTPUT->link($link);
|
||||
$viewurl = " ".$OUTPUT->action_link($viewurl, "<img src=\"" . $OUTPUT->pix_url('t/preview') . "\" class=\"iconsmall\" alt=\"$strfile\" /> ",
|
||||
new popup_action('click', $viewurl, 'display', array('height' => 480, 'width' => 640)));
|
||||
} else {
|
||||
$viewurl = '';
|
||||
}
|
||||
|
@ -268,6 +268,6 @@ function grade_print_scale_link($courseid, $scale, $gpr) {
|
||||
global $CFG, $OUTPUT;
|
||||
$url = new moodle_url('/grade/edit/scale/edit.php', array('courseid' => $courseid, 'id' => $scale->id));
|
||||
$url = $gpr->add_url_params($url);
|
||||
return $OUTPUT->link($url, $scale->get_name());
|
||||
return html_writer::link($url, $scale->get_name());
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ abstract class grade_export {
|
||||
|
||||
$link = $CFG->wwwroot.'/grade/export/'.$this->plugin.'/dump.php'.$paraM.str.'&key='.$this->userkey;
|
||||
|
||||
echo get_string('download', 'admin').': ' . $OUTPUT->link($link, $link);
|
||||
echo get_string('download', 'admin').': ' . html_writer::link($link, $link);
|
||||
}
|
||||
echo $OUTPUT->container_end();
|
||||
}
|
||||
|
@ -325,10 +325,7 @@ abstract class grade_report {
|
||||
$strsort = $this->get_lang_string('sort' . $matrix[$direction]);
|
||||
|
||||
$arrow = print_arrow($direction, $strsort, true);
|
||||
$link = html_link::make($sortlink, $arrow);
|
||||
$link->title = $strsort;
|
||||
$html = $OUTPUT->link($link);
|
||||
return $html;
|
||||
return html_writer::link($sortlink, $arrow, array('title'=>$strsort));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -816,7 +816,7 @@ class block_manager {
|
||||
if ($content->blockinstanceid == $this->movingblock) {
|
||||
$content->add_class('beingmoved');
|
||||
$content->annotation .= get_string('movingthisblockcancel', 'block',
|
||||
$output->link($this->page->url, get_string('cancel')));
|
||||
html_writer::link($this->page->url, get_string('cancel')));
|
||||
}
|
||||
|
||||
$results[] = $content;
|
||||
|
@ -2446,9 +2446,9 @@ function print_table($table, $return=false) {
|
||||
* @return string html code to display a link to a popup window.
|
||||
*/
|
||||
function link_to_popup_window ($url, $name=null, $linkname=null, $height=400, $width=500, $title=null, $options=null, $return=false) {
|
||||
debugging('link_to_popup_window() has been removed. Please change your code to use $OUTPUT->link(). Please note popups are discouraged for accessibility reasons');
|
||||
debugging('link_to_popup_window() has been removed. Please change your code to use $OUTPUT->action_link(). Please note popups are discouraged for accessibility reasons');
|
||||
|
||||
return $OUTPUT->link($url, $name);
|
||||
return html_writer::link($url, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2481,7 +2481,7 @@ function button_to_popup_window ($url, $name=null, $linkname=null,
|
||||
}
|
||||
|
||||
if (empty($linkname)) {
|
||||
throw new coding_exception('A link must have a descriptive text value! See $OUTPUT->link() for usage.');
|
||||
throw new coding_exception('A link must have a descriptive text value! See $OUTPUT->action_link() for usage.');
|
||||
}
|
||||
|
||||
// Create a html_button object
|
||||
@ -2845,10 +2845,9 @@ function editorhelpbutton(){
|
||||
|
||||
$paramstring = join('&', $urlparams);
|
||||
$linkobject = '<img alt="'.$alttag.'" class="iconhelp" src="'.$OUTPUT->pix_url('help') . '" />';
|
||||
$link = html_link::make(s('/lib/form/editorhelp.php?'.$paramstring), $linkobject);
|
||||
$link->add_action(new popup_action('click', $link->url, 'popup', array('height' => 400, 'width' => 500)));
|
||||
$link->title = $alttag;
|
||||
return $OUTPUT->link($link);
|
||||
$link = moodle_url('/lib/form/editorhelp.php?'.$paramstring);
|
||||
$action = new popup_action('click', $link->url, 'popup', array('height' => 400, 'width' => 500));
|
||||
return $OUTPUT->action_link($link, $linkobject, $action, array('title'=>$alttag));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,11 +112,12 @@ class MoodleQuickForm_tags extends MoodleQuickForm_group {
|
||||
// If the user can manage official tags, give them a link to manage them.
|
||||
$label = get_string('otags', 'tag');
|
||||
if (has_capability('moodle/tag:manage', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$link = html_link::make($CFG->wwwroot .'/tag/manage.php', get_string('manageofficialtags', 'tag'));
|
||||
$link->add_action(new popup_action('click', $link->url, 'managetags'));
|
||||
$link->title = get_string('newwindow');
|
||||
|
||||
$label .= ' (' . $OUTPUT->link($link) . ')';
|
||||
$url = $CFG->wwwroot .'/tag/manage.php';
|
||||
$label .= ' (' . $OUTPUT->action_link(
|
||||
$url,
|
||||
get_string('manageofficialtags', 'tag'),
|
||||
new popup_action('click', $url, 'managetags'),
|
||||
array('title'=>get_string('newwindow'))) . ')';
|
||||
}
|
||||
|
||||
// Get the list of official tags.
|
||||
|
@ -606,44 +606,6 @@ class core_renderer_test extends UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
public function test_link() {
|
||||
$link = new html_link();
|
||||
$link->url = 'http://test.com';
|
||||
$link->text = 'Resource 1';
|
||||
|
||||
$html = $this->renderer->link($link);
|
||||
$this->assert(new ContainsTagWithAttribute('a', 'href', 'http://test.com'), $html);
|
||||
$this->assert(new ContainsTagWithContents('a', 'Resource 1'), $html);
|
||||
|
||||
// Add a title
|
||||
$link->title = 'Link to resource 1';
|
||||
$html = $this->renderer->link($link);
|
||||
$this->assert(new ContainsTagWithAttributes('a', array('title' => 'Link to resource 1', 'href' => 'http://test.com')), $html);
|
||||
$this->assert(new ContainsTagWithContents('a', 'Resource 1'), $html);
|
||||
|
||||
// Use a moodle_url object instead of string
|
||||
$link->url = new moodle_url($link->url);
|
||||
$html = $this->renderer->link($link);
|
||||
$this->assert(new ContainsTagWithAttributes('a', array('title' => 'Link to resource 1', 'href' => 'http://test.com')), $html);
|
||||
$this->assert(new ContainsTagWithContents('a', 'Resource 1'), $html);
|
||||
|
||||
// Add a few classes to the link object
|
||||
$link->add_classes('cool blue');
|
||||
$html = $this->renderer->link($link);
|
||||
$this->assert(new ContainsTagWithAttributes('a', array('title' => 'Link to resource 1', 'class' => 'cool blue', 'href' => 'http://test.com')), $html);
|
||||
$this->assert(new ContainsTagWithContents('a', 'Resource 1'), $html);
|
||||
|
||||
// Simple use of link() without a html_link object
|
||||
$html = $this->renderer->link($link->url->out(), $link->text);
|
||||
$expected_html = '<a href="http://test.com">Resource 1</a>';
|
||||
$this->assert(new ContainsTagWithAttribute('a', 'href', 'http://test.com'), $html);
|
||||
$this->assert(new ContainsTagWithContents('a', 'Resource 1'), $html);
|
||||
|
||||
// Missing second param when first is a string: exception
|
||||
$this->expectException();
|
||||
$html = $this->renderer->link($link->url->out());
|
||||
}
|
||||
|
||||
public function test_paging_bar() {
|
||||
global $CFG;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user