Permalink
Browse files

MDL-6820 - make block icons clickable

  • Loading branch information...
1 parent 59e2938 commit 710363c97a235ccdfffb67f5874474473ceb77ad Rossiani Wijaya committed Aug 20, 2010
@@ -49,11 +49,11 @@ function get_content() {
foreach ($modfullnames as $modname => $modfullname) {
if ($modname === 'resources') {
- $this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/resources.php?id='.$course->id.'">'.$modfullname.'</a>';
- $this->content->icons[] = '<img src="'.$OUTPUT->pix_url('f/html') . '" class="icon" alt="" />';
+ $icon = '<img src="'.$OUTPUT->pix_url('f/html') . '" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/resources.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
} else {
- $this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$modfullname.'</a>';
- $this->content->icons[] = '<img src="'.$OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />';
+ $icon = '<img src="'.$OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
}
}
@@ -62,15 +62,14 @@ function get_content() {
if (!isloggedin()) {
return $this->content;
}
-
+
+ $icon = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/group'),
+ 'class' => 'icon', 'alt' => get_string('addcourse', 'block_community')));
$addcourseurl = new moodle_url('/blocks/community/communitycourse.php',
array('add' => true, 'courseid' => $this->page->course->id));
- $searchlink = html_writer::tag('a', get_string('addcourse', 'block_community'),
+ $searchlink = html_writer::tag('a', $icon .'&nbsp;'.get_string('addcourse', 'block_community'),
array('href' => $addcourseurl->out(false)));
$this->content->items[] = $searchlink;
- $icon = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/group'),
- 'class' => 'icon', 'alt' => get_string('addcourse', 'block_community')));
- $this->content->icons[] = $icon;
require_once($CFG->dirroot . '/blocks/community/locallib.php');
$communitymanager = new block_community_manager();
@@ -23,8 +23,7 @@ function get_content() {
$this->content->icons = array();
$this->content->footer = '';
- $icon = "<img src=\"" . $OUTPUT->pix_url('i/course') . "\"".
- " class=\"icon\" alt=\"".get_string("coursecategory")."\" />";
+ $icon = '<img src="' . $OUTPUT->pix_url('i/course') . '" class="icon" alt="" />&nbsp;';
$adminseesall = true;
if (isset($CFG->block_course_list_adminview)) {
@@ -39,8 +38,7 @@ function get_content() {
foreach ($courses as $course) {
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
$this->content->items[]="<a $linkcss title=\"" . format_string($course->shortname) . "\" ".
- "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">" . format_string($course->fullname) . "</a>";
- $this->content->icons[]=$icon;
+ "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">".$icon.format_string($course->fullname). "</a>";
}
$this->title = get_string('mycourses');
/// If we can update any course of the view all isn't hidden, show the view all courses link
@@ -59,8 +57,7 @@ function get_content() {
if (count($categories) > 1 || (count($categories) == 1 && $DB->count_records('course') > 200)) { // Just print top level category links
foreach ($categories as $category) {
$linkcss = $category->visible ? "" : " class=\"dimmed\" ";
- $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">" . format_string($category->name) . "</a>";
- $this->content->icons[]=$icon;
+ $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">".$icon . format_string($category->name) . "</a>";
}
/// If we can update any course of the view all isn't hidden, show the view all courses link
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
@@ -78,8 +75,7 @@ function get_content() {
$this->content->items[]="<a $linkcss title=\""
. format_string($course->shortname)."\" ".
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">"
- . format_string($course->fullname) . "</a>";
- $this->content->icons[]=$icon;
+ .$icon. format_string($course->fullname) . "</a>";
}
/// If we can update any course of the view all isn't hidden, show the view all courses link
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
@@ -110,7 +106,7 @@ function get_remote_courses() {
return;
}
- $icon = '<img src="'.$OUTPUT->pix_url('i/mnethost') . '" class="icon" alt="'.get_string('course').'" />';
+ $icon = '<img src="'.$OUTPUT->pix_url('i/mnethost') . '" class="icon" alt="" />&nbsp;';
// shortcut - the rest is only for logged in users!
if (!isloggedin() || isguestuser()) {
@@ -123,8 +119,7 @@ function get_remote_courses() {
foreach ($courses as $course) {
$this->content->items[]="<a title=\"" . format_string($course->shortname) . "\" ".
"href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&amp;wantsurl=/course/view.php?id={$course->remoteid}\">"
- . format_string($course->fullname) . "</a>";
- $this->content->icons[]=$icon;
+ .$icon. format_string($course->fullname) . "</a>";
}
// if we listed courses, we are done
return true;
@@ -134,8 +129,7 @@ function get_remote_courses() {
$this->content->items[] = get_string('remotehosts', 'mnet');
$this->content->icons[] = '';
foreach($USER->mnet_foreign_host_array as $somehost) {
- $this->content->items[] = $somehost['count'].get_string('courseson','mnet').'<a title="'.$somehost['name'].'" href="'.$somehost['url'].'">'.$somehost['name'].'</a>';
- $this->content->icons[] = $icon;
+ $this->content->items[] = $somehost['count'].get_string('courseson','mnet').'<a title="'.$somehost['name'].'" href="'.$somehost['url'].'">'.$icon.$somehost['name'].'</a>';
}
// if we listed hosts, done
return true;
@@ -47,8 +47,8 @@ function get_content() {
foreach ($feedbacks as $feedback) {
$url = new moodle_url($baseurl);
$url->params(array('id'=>$feedback->cmid, 'courseid'=>$courseid));
- $this->content->text = '<img src="'.$OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />';
- $this->content->text .= ' <a href="'.$url->out().'">'.$feedback->name.'</a>';
+ $icon = '<img src="'.$OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />&nbsp;';
+ $this->content->text = ' <a href="'.$url->out().'">'.$icon.$feedback->name.'</a>';
}
}
@@ -88,16 +88,15 @@ function get_content() {
if ($hosts) {
foreach ($hosts as $host) {
- $icon = '<img src="'.$OUTPUT->pix_url('i/'.$host->application.'_host') . '"'.
- ' class="icon" alt="'.get_string('server', 'block_mnet_hosts').'" />';
+ $icon = '<img src="'.$OUTPUT->pix_url('i/'.$host->application.'_host') . '"'.
+ ' class="icon" alt="'.get_string('server', 'block_mnet_hosts').'" />&nbsp;';
- $this->content->icons[]=$icon;
if ($host->id == $USER->mnethostid) {
$this->content->items[]="<a title=\"" .s($host->name).
- "\" href=\"{$host->wwwroot}\">". s($host->name) ."</a>";
+ "\" href=\"{$host->wwwroot}\">".$icon. s($host->name) ."</a>";
} else {
$this->content->items[]="<a title=\"" .s($host->name).
- "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" . s($host->name) ."</a>";
+ "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" .$icon. s($host->name) ."</a>";
}
}
}
@@ -33,10 +33,9 @@ function get_content() {
return $this->content;
}
}
-
+ $icon = '<img src="'.$OUTPUT->pix_url('i/users') . '" class="icon" alt="" />&nbsp;';
$this->content->items[] = '<a title="'.get_string('listofallpeople').'" href="'.
- $CFG->wwwroot.'/user/index.php?contextid='.$currentcontext->id.'">'.get_string('participants').'</a>';
- $this->content->icons[] = '<img src="'.$OUTPUT->pix_url('i/users') . '" class="icon" alt="" />';
+ $CFG->wwwroot.'/user/index.php?contextid='.$currentcontext->id.'">'.$icon.get_string('participants').'</a>';
return $this->content;
}
@@ -68,7 +68,7 @@ protected function htmllize_tree($tree, $dir) {
$filename = $file->get_filename();
$icon = mimeinfo("icon", $filename);
$image = $this->output->pix_icon("f/$icon", $filename, 'moodle', array('class'=>'icon'));
- $result .= '<li yuiConfig=\''.json_encode($yuiconfig).'\'><div>'.$image.' '.html_writer::link($url, $filename).'</div></li>';
+ $result .= '<li yuiConfig=\''.json_encode($yuiconfig).'\'><div>'.html_writer::link($url, $image.'&nbsp;'.$filename).'</div></li>';
}
$result .= '</ul>';
@@ -45,15 +45,15 @@ function get_content() {
} else {
$linkcss = $cm->visible ? '' : ' class="dimmed" ';
$instancename = format_string($cm->name, true, $course->id);
- $this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$instancename.'</a>';
//Accessibility: incidental image - should be empty Alt text
if (!empty($cm->icon)) {
$icon = $OUTPUT->pix_url($cm->icon);
} else {
$icon = $OUTPUT->pix_url('icon', $cm->modname);
}
- $this->content->icons[] = '<img src="'.$icon.'" class="icon" alt="" />';
+ $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
+ ' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$icon.$instancename.'</a>';
}
}
}
@@ -130,10 +130,10 @@ function get_content() {
$this->content->items[] = format_text($extra, FORMAT_HTML).$editbuttons;
$this->content->icons[] = '';
} else {
- $this->content->items[] = '<a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.$instancename.'</a>'.$editbuttons;
//Accessibility: incidental image - should be empty Alt text
- $this->content->icons[] = '<img src="'.$icon.'" class="icon" alt="" />';
+ $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
+ ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.$icon.$instancename.'</a>'.$editbuttons;
}
}
}
@@ -47,15 +47,15 @@ function get_content() {
} else {
$linkcss = $cm->visible ? '' : ' class="dimmed" ';
$instancename = format_string($cm->name, true, $course->id);
- $this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$instancename.'</a>';
//Accessibility: incidental image - should be empty Alt text
if (!empty($cm->icon)) {
$icon = $OUTPUT->pix_url($cm->icon);
} else {
$icon = $OUTPUT->pix_url('icon', $cm->modname);
}
- $this->content->icons[] = '<img src="'.$icon.'" class="icon" alt="" />';
+ $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
+ ' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$icon.$instancename.'</a>';
}
}
}
@@ -139,10 +139,10 @@ function get_content() {
$this->content->items[] = format_text($extra, FORMAT_HTML).$editbuttons;
$this->content->icons[] = '';
} else {
- $this->content->items[] = '<a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
- ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.$instancename.'</a>'.$editbuttons;
//Accessibility: incidental image - should be empty Alt text
- $this->content->icons[] = '<img src="'.$icon.'" class="icon" alt="" />';
+ $icon = '<img src="'.$icon.'" class="icon" alt="" />&nbsp;';
+ $this->content->items[] = '<a title="'.$mod->modfullname.'" '.$linkcss.' '.$extra.
+ ' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.$icon.$instancename.'</a>'.$editbuttons;
}
}
}

0 comments on commit 710363c

Please sign in to comment.