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
+ $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="" />';
- $this->content->items[] = '<a title="'.$cm->modplural.'" '.$linkcss.' '.$cm->extra.
- ' href="' . $url . '">' . $icon . $instancename . '</a>';
+ $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;
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(
'<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');
}
}
}