mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch '23178-29' of git://github.com/samhemelryk/moodle
This commit is contained in:
commit
fca0b79d18
2 changed files with 47 additions and 22 deletions
|
@ -56,26 +56,36 @@ class block_site_main_menu extends block_list {
|
|||
if (!$isediting) {
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
if (!empty($modinfo->sections[0])) {
|
||||
$options = array('overflowdiv'=>true);
|
||||
foreach($modinfo->sections[0] as $cmid) {
|
||||
$cm = $modinfo->cms[$cmid];
|
||||
if (!$cm->uservisible) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$content = $cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
|
||||
$instancename = $cm->get_formatted_name();
|
||||
|
||||
if (!($url = $cm->url)) {
|
||||
$this->content->items[] = $content;
|
||||
$this->content->icons[] = '';
|
||||
if ($cm->indent > 0) {
|
||||
$indent = '<div class="mod-indent mod-indent-'.$cm->indent.'"></div>';
|
||||
} else {
|
||||
$linkcss = $cm->visible ? '' : ' class="dimmed" ';
|
||||
//Accessibility: incidental image - should be empty Alt text
|
||||
$icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" />';
|
||||
$this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
|
||||
' href="' . $url . '">' . $icon . $instancename . '</a>';
|
||||
$indent = '';
|
||||
}
|
||||
|
||||
if (!empty($cm->url)) {
|
||||
$attrs = array();
|
||||
$attrs['title'] = $cm->modfullname;
|
||||
$attrs['class'] = $cm->extraclasses . ' activity-action';
|
||||
if ($cm->onclick) {
|
||||
$attrs['id'] = html_writer::random_id('onclick');
|
||||
$OUTPUT->add_action_handler(new component_action('click', $cm->onclick), $attrs['id']);
|
||||
}
|
||||
if (!$cm->visible) {
|
||||
$attrs['class'] .= ' dimmed';
|
||||
}
|
||||
$icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" />';
|
||||
$content = html_writer::link($cm->url, $icon . $cm->get_formatted_name(), $attrs);
|
||||
} else {
|
||||
$content = $cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
|
||||
}
|
||||
|
||||
$this->content->items[] = $indent.html_writer::div($content, 'main-menu-content');
|
||||
}
|
||||
}
|
||||
return $this->content;
|
||||
|
@ -112,7 +122,7 @@ class block_site_main_menu extends block_list {
|
|||
continue;
|
||||
}
|
||||
if (!$ismoving) {
|
||||
$actions = course_get_cm_edit_actions($mod, -1);
|
||||
$actions = course_get_cm_edit_actions($mod, $mod->indent);
|
||||
|
||||
// Prepend list of actions with the 'move' action.
|
||||
$actions = array('move' => new action_menu_link_primary(
|
||||
|
@ -137,19 +147,31 @@ class block_site_main_menu extends block_list {
|
|||
'<img style="height:16px; width:80px; border:0px" src="'.$OUTPUT->pix_url('movehere') . '" alt="'.$strmovehere.'" /></a>';
|
||||
$this->content->icons[] = '';
|
||||
}
|
||||
$content = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
|
||||
$instancename = $mod->get_formatted_name();
|
||||
$linkcss = $mod->visible ? '' : ' class="dimmed" ';
|
||||
|
||||
if (!($url = $mod->url)) {
|
||||
$this->content->items[] = $content . $editbuttons;
|
||||
$this->content->icons[] = '';
|
||||
if ($mod->indent > 0) {
|
||||
$indent = '<div class="mod-indent mod-indent-'.$mod->indent.'"></div>';
|
||||
} else {
|
||||
$indent = '';
|
||||
}
|
||||
$url = $mod->url;
|
||||
if (!$url) {
|
||||
$content = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
|
||||
} else {
|
||||
//Accessibility: incidental image - should be empty Alt text
|
||||
$attrs = array();
|
||||
$attrs['title'] = $mod->modfullname;
|
||||
$attrs['class'] = $mod->extraclasses . ' activity-action';
|
||||
if ($mod->onclick) {
|
||||
$attrs['id'] = html_writer::random_id('onclick');
|
||||
$OUTPUT->add_action_handler(new component_action('click', $mod->onclick), $attrs['id']);
|
||||
}
|
||||
if (!$mod->visible) {
|
||||
$attrs['class'] .= ' dimmed';
|
||||
}
|
||||
|
||||
$icon = '<img src="' . $mod->get_icon_url() . '" class="icon" alt="" />';
|
||||
$this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $mod->extra .
|
||||
' href="' . $url . '">' . $icon . $instancename . '</a>' . $editbuttons;
|
||||
$content = html_writer::link($url, $icon . $mod->get_formatted_name(), $attrs);
|
||||
}
|
||||
$this->content->items[] = $indent.html_writer::div($content . $editbuttons, 'main-menu-content');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,3 +5,6 @@
|
|||
.block_site_main_menu li .buttons a img{ vertical-align: text-bottom;}
|
||||
.block_site_main_menu .footer { margin-top: 1em; }
|
||||
.block_site_main_menu .section_add_menus noscript div { display: inline;}
|
||||
.block_site_main_menu .mod-indent,
|
||||
.block_site_main_menu .main-menu-content { display: table-cell; }
|
||||
.block_site_main_menu .main-menu-content > .activity-action { display: block; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue