Commit 710363c9 authored by Rossiani Wijaya's avatar Rossiani Wijaya
Browse files

MDL-6820 - make block icons clickable

parent 59e29380
......@@ -49,11 +49,11 @@ class block_activity_modules extends block_list {
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 @@ class block_community extends block_list {
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 @@ class block_course_list extends block_list {
$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 @@ class block_course_list extends block_list {
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 @@ class block_course_list extends block_list {
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 @@ class block_course_list extends block_list {
$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 @@ class block_course_list extends block_list {
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 @@ class block_course_list extends block_list {
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 @@ class block_course_list extends block_list {
$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 @@ class block_feedback extends block_base {
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 @@ class block_mnet_hosts extends block_list {
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 @@ class block_participants extends block_list {
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 @@ class block_private_files_renderer extends plugin_renderer_base {
$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 @@ class block_site_main_menu extends block_list {
} 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 @@ class block_site_main_menu extends block_list {
$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 @@ class block_social_activities extends block_list {
} 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 @@ class block_social_activities extends block_list {
$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;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment