Example #1
0
 public function navigation_menu()
 {
     global $PAGE, $COURSE, $OUTPUT, $CFG;
     $menu = new custom_menu();
     if (isloggedin() && !isguestuser()) {
         if (!empty($PAGE->theme->settings->enablehome)) {
             $branchtitle = get_string('home');
             $branchlabel = '<i class="fa fa-home"></i> ' . $branchtitle;
             $branchurl = new moodle_url('/');
             $branchsort = 9998;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
         if (!empty($PAGE->theme->settings->enablemyhome)) {
             $branchtitle = get_string('myhome');
             $branchlabel = '<i class="fa fa-dashboard"></i> ' . $branchtitle;
             $branchurl = new moodle_url('/my/index.php');
             $branchsort = 9999;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
         if (!empty($PAGE->theme->settings->enableevents)) {
             $branchtitle = get_string('events', 'theme_bcu');
             $branchlabel = '<i class="fa fa-calendar"></i> ' . $branchtitle;
             $branchurl = new moodle_url('/calendar/view.php');
             $branchsort = 10000;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
         if (!empty($PAGE->theme->settings->enablemysites)) {
             $branchtitle = get_string('mysites', 'theme_bcu');
             $branchlabel = '<i class="fa fa-briefcase"></i><span class="menutitle">' . $branchtitle . '</span>';
             $branchurl = new moodle_url('/my/index.php');
             $branchsort = 10001;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
             list($sortedcourses, $sitecourses, $totalcourses) = block_course_overview_get_sorted_courses();
             if ($sortedcourses) {
                 foreach ($sortedcourses as $course) {
                     if ($course->visible) {
                         $branch->add(format_string($course->fullname), new moodle_url('/course/view.php?id=' . $course->id), format_string($course->shortname));
                     }
                 }
             } else {
                 $noenrolments = get_string('noenrolments', 'theme_bcu');
                 $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments);
             }
         }
         if (!empty($PAGE->theme->settings->enablethiscourse)) {
             if (isset($COURSE->id) && $COURSE->id > 1) {
                 $branchtitle = get_string('thiscourse', 'theme_bcu');
                 $branchlabel = '<i class="fa fa-sitemap"></i><span class="menutitle">' . $branchtitle . '</span>';
                 $branchurl = new moodle_url('#');
                 $branch = $menu->add($branchlabel, $branchurl, $branchtitle, 10002);
                 $branchtitle = "People";
                 $branchlabel = '<i class="fa fa-users"></i>' . $branchtitle;
                 $branchurl = new moodle_url('/user/index.php', array('id' => $PAGE->course->id));
                 $branch->add($branchlabel, $branchurl, $branchtitle, 100003);
                 $branchtitle = get_string('grades');
                 $branchlabel = $OUTPUT->pix_icon('i/grades', '', '', array('class' => 'icon')) . $branchtitle;
                 $branchurl = new moodle_url('/grade/report/index.php', array('id' => $PAGE->course->id));
                 $branch->add($branchlabel, $branchurl, $branchtitle, 100004);
                 $data = theme_bcu_get_course_activities();
                 foreach ($data as $modname => $modfullname) {
                     if ($modname === 'resources') {
                         $icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon'));
                         $branch->add($icon . $modfullname, new moodle_url('/course/resources.php', array('id' => $PAGE->course->id)));
                     } else {
                         $icon = '<img src="' . $OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />';
                         $branch->add($icon . $modfullname, new moodle_url('/mod/' . $modname . '/index.php', array('id' => $PAGE->course->id)));
                     }
                 }
             }
         }
     }
     if (!empty($PAGE->theme->settings->enablehelp)) {
         $branchtitle = "Help";
         $branchlabel = '<i class="fa fa-life-ring"></i>' . $branchtitle;
         $branchurl = new moodle_url($PAGE->theme->settings->enablehelp);
         $branchsort = 10003;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     }
     return $this->render_custom_menu($menu);
 }
Example #2
0
 public function navigation_menu()
 {
     global $PAGE, $COURSE, $OUTPUT, $CFG;
     $menu = new custom_menu();
     if (isloggedin() && !isguestuser()) {
         if (!empty($PAGE->theme->settings->enablehome)) {
             $branchtitle = get_string('home');
             $branchlabel = '<i class="fa fa-home"></i>' . $branchtitle;
             $branchurl = new moodle_url('/');
             $branchsort = 9998;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
         if (!empty($PAGE->theme->settings->enablemyhome)) {
             //$branchtitle = get_string('myhome');
             $branchtitle = "Clases y Rutinas";
             $branchlabel = '<i class="fa fa-trophy"></i>' . $branchtitle;
             $branchurl = new moodle_url('');
             $branchsort = 9999;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
             $branch->add('<i class="fa fa-futbol-o"></i>' . format_string('Clases'), new moodle_url('/local/wellness/clases.php'), format_string('Clases'));
             $branch->add('<i class="fa fa-heartbeat"></i>' . format_string('Sala de Pesas'), new moodle_url('/local/wellness/salapesas.php'), format_string('Sala de Pesas'));
         }
         //             if (!empty($PAGE->theme->settings->enableevents)) {
         //                 //$branchtitle = get_string('events', 'theme_bcu');
         //             	$branchtitle = "Mis Estadisticas";
         //                 $branchlabel = '<i class="fa fa-calendar"></i> '.$branchtitle;
         //                 $branchurl   = new moodle_url('/local/wellness/estadisticas.php');
         //                 $branchsort  = 10000;
         //                 $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         //             }
         if (!empty($PAGE->theme->settings->enablemyhome)) {
             //$branchtitle = get_string('mysites', 'theme_bcu');
             $branchtitle = "Fitnessgram";
             $branchlabel = '<i class="fa fa-line-chart"></i>' . $branchtitle;
             $branchurl = new moodle_url('/local/wellness/fitnessgram.php');
             $branchsort = 10001;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
             //                 list($sortedcourses, $sitecourses, $totalcourses) = block_course_overview_get_sorted_courses();
             //                 if ($sortedcourses) {
             //                     foreach ($sortedcourses as $course) {
             //                         if ($course->visible) {
             //                             $branch->add(format_string($course->fullname), new moodle_url('/course/view.php?id='.$course->id),
             //                                     format_string($course->shortname));
             //                         }
             //                     }
             //                 } else {
             //                     $noenrolments = get_string('noenrolments', 'theme_bcu');
             //                     $branch->add('<em>'.$noenrolments.'</em>', new moodle_url('/'), $noenrolments);
             //                 }
         }
         if (!empty($PAGE->theme->settings->enableevents)) {
             //$branchtitle = get_string('events', 'theme_bcu');
             $branchtitle = "Asistencias";
             $branchlabel = '<i class="fa fa-check"></i>' . $branchtitle;
             $branchurl = new moodle_url('/local/wellness/asistencias.php');
             $branchsort = 10002;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
         if (!empty($PAGE->theme->settings->enableevents)) {
             //$branchtitle = get_string('events', 'theme_bcu');
             $branchtitle = "Eventos";
             $branchlabel = '<i class="fa fa-calendar"></i> ' . $branchtitle;
             $branchurl = new moodle_url('/calendar/view.php?view=month');
             $branchsort = 10003;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
         if (!empty($PAGE->theme->settings->enablethiscourse)) {
             if (isset($COURSE->id) && $COURSE->id > 1) {
                 $branchtitle = get_string('thiscourse', 'theme_bcu');
                 $branchlabel = '<i class="fa fa-sitemap"></i><span class="menutitle">' . $branchtitle . '</span>';
                 $branchurl = new moodle_url('#');
                 $branch = $menu->add($branchlabel, $branchurl, $branchtitle, 10002);
                 $branchtitle = "People";
                 $branchlabel = '<i class="fa fa-users"></i>' . $branchtitle;
                 $branchurl = new moodle_url('/user/index.php', array('id' => $PAGE->course->id));
                 $branch->add($branchlabel, $branchurl, $branchtitle, 100003);
                 $branchtitle = get_string('grades');
                 $branchlabel = $OUTPUT->pix_icon('i/grades', '', '', array('class' => 'icon')) . $branchtitle;
                 $branchurl = new moodle_url('/grade/report/index.php', array('id' => $PAGE->course->id));
                 $branch->add($branchlabel, $branchurl, $branchtitle, 100004);
                 $data = theme_bcu_get_course_activities();
                 foreach ($data as $modname => $modfullname) {
                     if ($modname === 'resources') {
                         $icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon'));
                         $branch->add($icon . $modfullname, new moodle_url('/course/resources.php', array('id' => $PAGE->course->id)));
                     } else {
                         $icon = '<img src="' . $OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />';
                         $branch->add($icon . $modfullname, new moodle_url('/mod/' . $modname . '/index.php', array('id' => $PAGE->course->id)));
                     }
                 }
             }
         }
     }
     if (!empty($PAGE->theme->settings->enablehelp)) {
         $branchtitle = "Help";
         $branchlabel = '<i class="fa fa-life-ring"></i>' . $branchtitle;
         $branchurl = new moodle_url($PAGE->theme->settings->enablehelp);
         $branchsort = 10003;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     }
     return $this->render_custom_menu($menu);
 }
Example #3
0
 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG, $PAGE, $OUTPUT, $COURSE;
     if (isloggedin() && !isguestuser()) {
         $branchtitle = get_string('home');
         $branchlabel = '<i class="fa fa-home"></i> ' . $branchtitle;
         $branchurl = new moodle_url('/');
         $branchsort = 9998;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         $branchtitle = get_string('myhome');
         $branchlabel = '<i class="fa fa-dashboard"></i> ' . $branchtitle;
         $branchurl = new moodle_url('/my/index.php');
         $branchsort = 9999;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         $mycoursetitle = "Events";
         $branchtitle = "Events";
         $branchlabel = '<i class="fa fa-calendar"></i> ' . $branchtitle;
         $branchurl = new moodle_url('/calendar/view.php');
         $branchsort = 10000;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         $mycoursetitle = "我的课程";
         $branchtitle = "我的课程";
         $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle;
         $branchurl = new moodle_url('/my/index.php');
         $branchsort = 10001;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         list($sortedcourses, $sitecourses, $totalcourses) = block_course_overview_get_sorted_courses();
         if ($sortedcourses) {
             foreach ($sortedcourses as $course) {
                 if ($course->visible) {
                     $branch->add(format_string($course->fullname), new moodle_url('/course/view.php?id=' . $course->id), format_string($course->shortname));
                 }
             }
         } else {
             $noenrolments = get_string('noenrolments', 'theme_bcu');
             $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments);
         }
         if (isset($COURSE->id) && $COURSE->id > 1) {
             $branchtitle = get_string('thiscourse', 'theme_bcu');
             $branchlabel = '<i class="fa fa-sitemap"></i>' . $branchtitle;
             $branchurl = new moodle_url('#');
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, 10002);
             $branchtitle = "People";
             $branchlabel = '<i class="fa fa-users"></i>' . $branchtitle;
             $branchurl = new moodle_url('/user/index.php', array('id' => $PAGE->course->id));
             $branch->add($branchlabel, $branchurl, $branchtitle, 100003);
             $branchtitle = "Grades";
             $branchlabel = $OUTPUT->pix_icon('i/grades', '', '', array('class' => 'icon')) . $branchtitle;
             $branchurl = new moodle_url('/grade/report/index.php', array('id' => $PAGE->course->id));
             $branch->add($branchlabel, $branchurl, $branchtitle, 100004);
             $data = theme_bcu_get_course_activities();
             foreach ($data as $modname => $modfullname) {
                 if ($modname === 'resources') {
                     $icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon'));
                     $branch->add($icon . $modfullname, new moodle_url('/course/resources.php', array('id' => $PAGE->course->id)));
                 } else {
                     $icon = '<img src="' . $OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />';
                     $branch->add($icon . $modfullname, new moodle_url('/mod/' . $modname . '/index.php', array('id' => $PAGE->course->id)));
                 }
             }
         }
         if (!empty($PAGE->theme->settings->enablehelp)) {
             $mycoursetitle = "Help";
             $branchtitle = "Help";
             $branchlabel = '<i class="fa fa-life-ring"></i>' . $branchtitle;
             $branchurl = new moodle_url($PAGE->theme->settings->enablehelp);
             $branchsort = 10003;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
     }
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if (!$menu->has_children() && $addlangmenu === false) {
         return '';
     }
     $content = '<ul class="nav">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }