// Grab the items to display
$this->content->items = array($this->page->navigation);
- $reloadlink = new html_link(new moodle_url($this->page->url, array('regenerate'=>'navigation')));
- $reloadlink->add_class('customcommand');
+ $reloadlink = new moodle_url($this->page->url, array('regenerate'=>'navigation'));
- $this->content->footer .= $OUTPUT->action_icon($reloadlink, get_string('reload'), 't/reload');
+ $this->content->footer .= $OUTPUT->action_icon($reloadlink, get_string('reload'), 't/reload', array('class'=>'customcommand'));
// Set content generated to true so that we know it has been done
$this->contentgenerated = true;
$this->content->footer = '';
}
- $reloadlink = new html_link(new moodle_url($this->page->url, array('regenerate'=>'navigation')));
- $reloadlink->add_class('customcommand');
- $this->content->footer .= $OUTPUT->action_icon($reloadlink, get_string('reload'), 't/reload');
+ $reloadlink = new moodle_url($this->page->url, array('regenerate'=>'navigation'));
+ $this->content->footer .= $OUTPUT->action_icon($reloadlink, get_string('reload'), 't/reload', array('class'=>'customcommand'));
if (!empty($this->config->enablesidebarpopout) && $this->config->enablesidebarpopout == 'yes') {
user_preference_allow_ajax_update('nav_in_tab_panel_settingsnav'.block_settings_navigation_tree::$navcount, PARAM_INT);
}
if (has_capability('coursereport/log:viewlive', $context)) {
$livelogs = get_string('livelogs');
- $link = html_link::make('/course/report/log/live.php?id='. $course->id, $livelogs);
+ $link = new moodle_url('/course/report/log/live.php', array('id'=>$course->id));
$link->add_action(new popup_action('click', $link->url, 'livelog', array('height' => 500, 'width' => 800)));
$navigation->add($livelogs, $link, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
}
$this->assertEqual('', $html);
}
- public function test_link_to_popup_empty_link() {
- // Empty link object: link MUST have a text value
- $link = new html_link();
- $popupaction = new popup_action('click', 'http://test.com', 'my_popup');
- $link->add_action($popupaction);
- $this->expectException();
- $html = $this->renderer->link_to_popup($link);
- }
-
- public function test_link_to_popup() {
- $link = new html_link();
- $link->text = 'Click here';
- $link->url = 'http://test.com';
- $link->title = 'Popup window';
- $popupaction = new popup_action('click', 'http://test.com', 'my_popup');
- $link->add_action($popupaction);
-
- $html = $this->renderer->link_to_popup($link);
- $expectedattributes = array('title' => 'Popup window', 'href' => 'http://test.com');
- $this->assert(new ContainsTagWithAttributes('a', $expectedattributes), $html);
- $this->assert(new ContainsTagWithContents('a', 'Click here'), $html);
-
- // Try a different url for the link than for the popup
- $link->url = 'http://otheraddress.com';
- $html = $this->renderer->link_to_popup($link);
-
- $this->assert(new ContainsTagWithAttribute('a', 'title', 'Popup window'), $html);
- $this->assert(new ContainsTagWithAttribute('a', 'href', 'http://otheraddress.com'), $html);
- $this->assert(new ContainsTagWithContents('a', 'Click here'), $html);
-
- // Give it a moodle_url object instead of a string
- $link->url = new moodle_url('http://otheraddress.com');
- $html = $this->renderer->link_to_popup($link);
- $this->assert(new ContainsTagWithAttribute('a', 'title', 'Popup window'), $html);
- $this->assert(new ContainsTagWithAttribute('a', 'href', 'http://otheraddress.com'), $html);
- $this->assert(new ContainsTagWithContents('a', 'Click here'), $html);
-
- }
-
public function test_paging_bar() {
global $CFG;
'scrollbars' => true,
'resizable' => true);
- $link = html_link::make("/message/history.php?user1=$userid1&user2=$userid2$keywords$position");
- $action = new popup_action('click', $link->url, "message_history_$userid1", $popupoptions);
+ $link = new moodle_url("/message/history.php?user1=$userid1&user2=$userid2$keywords$position");
+ $action = new popup_action('click', $link, "message_history_$userid1", $popupoptions);
$str = $OUTPUT->action_link($link, $fulllink, $action, array('title'=>$strmessagehistory));
$str = '<span class="history">'.$str.'</span>';
'scrollbars' => true,
'resizable' => true);
- $link = html_link::make("/message/discussion.php?id=$contact->id");
+ $link = new moodle_url("/message/discussion.php?id=$contact->id");
$action = new popup_action('click', $link, "message_$contact->id", $popupoptions);
echo $OUTPUT->action_link($link, $fullnamelink, $action, array('title'=>get_string('sendmessageto', 'message', $fullname)));
}
if ($this->notes_allowed() and !empty($submission->data1)) {
- $link = html_link::make("/mod/assignment/type/upload/notes.php?id=$this->cm->id&userid=$userid");
+ $link = new moodle_url("/mod/assignment/type/upload/notes.php", array('id'=>$this->cm->id, 'userid'=>$userid));
$action = new popup_action('click', $link, 'notes', array('height' => 500, 'width' => 780));
$output .= $OUTPUT->action_link($link, get_string('notes', 'assignment'), $action, array('title'=>get_string('notes', 'assignment')));