/** * Either returns the parent version of the header bar, or a version with the logo replacing the header. * * @since Moodle 2.9 * @param array $headerinfo An array of header information, dependant on what type of header is being displayed. The following * array example is user specific. * heading => Override the page heading. * user => User object. * usercontext => user context. * @param int $headinglevel What level the 'h' tag will be. * @return string HTML for the header bar. */ public function context_header($headerinfo = null, $headinglevel = 1) { if ($this->should_render_logo($headinglevel)) { return html_writer::tag('div', '', array('class' => 'logo')); } return parent::context_header($headerinfo, $headinglevel); }
/** * Either returns the parent version of the header bar, or a version with the logo replacing the header. * * @since Moodle 2.9 * @param array $headerinfo An array of header information, dependant on what type of header is being displayed. The following * array example is user specific. * heading => Override the page heading. * user => User object. * usercontext => user context. * @param int $headinglevel What level the 'h' tag will be. * @return string HTML for the header bar. */ public function context_header($headerinfo = null, $headinglevel = 1) { if ($headinglevel == 1 && !empty($this->page->theme->settings->logo)) { return html_writer::tag('div', '', array('class' => 'logo')); } return parent::context_header($headerinfo, $headinglevel); }
protected function render_custom_menu(custom_menu $menu) { /* * This code replaces adds the current enrolled * courses to the custommenu. */ $hasdisplaymycourses = empty($this->page->theme->settings->displaymycourses) ? false : $this->page->theme->settings->displaymycourses; if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $mycoursetitle = $this->page->theme->settings->mycoursetitle; if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_evolved'); } else { if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_evolved'); } else { if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_evolved'); } else { $branchtitle = get_string('mycourses', 'theme_evolved'); } } } $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($courses = enrol_get_my_courses(NULL, 'fullname ASC')) { foreach ($courses 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_evolved'); $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments); } } /* * This code replaces adds the My Dashboard * functionality to the custommenu. */ $hasdisplaymydashboard = empty($this->page->theme->settings->displaymydashboard) ? false : $this->page->theme->settings->displaymydashboard; if (isloggedin() && !isguestuser() && $hasdisplaymydashboard) { $branchlabel = '<i class="fa fa-dashboard"></i>' . get_string('mydashboard', 'theme_evolved'); $branchurl = new moodle_url('/my/index.php'); $branchtitle = get_string('mydashboard', 'theme_evolved'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); $branch->add(get_string('profile') . '</em>', new moodle_url('/user/profile.php'), get_string('profile')); $branch->add(get_string('pluginname', 'block_calendar_month') . '</em>', new moodle_url('/calendar/view.php'), get_string('pluginname', 'block_calendar_month')); $branch->add(get_string('pluginname', 'block_messages') . '</em>', new moodle_url('/message/index.php'), get_string('pluginname', 'block_messages')); $branch->add(get_string('badges') . '</em>', new moodle_url('/badges/mybadges.php'), get_string('badges')); $branch->add(get_string('privatefiles', 'block_private_files') . '</em>', new moodle_url('/user/files.php'), get_string('privatefiles', 'block_private_files')); $branch->add(get_string('logout') . '</em>', new moodle_url('/login/logout.php'), get_string('logout')); } return parent::render_custom_menu($menu); }
/** * Either returns the parent version of the header bar, or a version with the logo replacing the header. * * @since Moodle 2.9 * @param array $headerinfo An array of header information, dependant on what type of header is being displayed. The following * array example is user specific. * heading => Override the page heading. * user => User object. * usercontext => user context. * @param int $headinglevel What level the 'h' tag will be. * @return string HTML for the header bar. */ public function context_header($headerinfo = null, $headinglevel = 1) { $html = parent::context_header($headerinfo, $headinglevel); if ($headinglevel == 1) { # replace only the overarching header $thtml = preg_replace('/(class="page-context-header)(")/', '${1} span8${2}', $html); $html = isset($thtml) && !empty($thtml) ? $thtml : $html; } return $html; }
public function login_info($withlinks = null) { $login_info = parent::login_info($withlinks); $wrap_start = ""; if (isloggedin()) { if (isguestuser()) { $wrap_start .= "<div id='is-guest'>"; } else { $wrap_start .= "<div id='is-logged-in'>"; } } else { $wrap_start .= "<div id='not-logged-in'>"; } $wrap_end = "</div>"; $wrapped_info = $wrap_start . $login_info . $wrap_end; return $wrapped_info; }
protected function render_custom_menu(custom_menu $menu) { global $CFG; $hasdisplaymycourses = theme_lambda_get_setting('mycourses_dropdown'); if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $branchlabel = get_string('mycourses'); $branchurl = new moodle_url('#'); $branchtitle = $branchlabel; $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) { foreach ($mycourses as $mycourse) { $branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname); } } else { $hometext = get_string('myhome'); $homelabel = $hometext; $branch->add($homelabel, new moodle_url('/my/index.php'), $hometext); } } return parent::render_custom_menu($menu); }
/** * Returns HTML attributes to use within the body tag. This includes an ID and classes. * * @since Moodle 2.5.1 2.6 * @param string|array $additionalclasses Any additional classes to give the body tag, * @return string */ public function body_attributes($additionalclasses = array()) { if ($this->page->pagelayout == 'login') { $hidelocallogin = !isset($this->page->theme->settings->hidelocallogin) ? false : $this->page->theme->settings->hidelocallogin; if ($hidelocallogin) { $additionalclasses[] = 'hidelocallogin'; } } return parent::body_attributes($additionalclasses); }
protected function render_pix_icon(pix_icon $icon) { if (self::replace_moodle_icon($icon->pix) !== false && $icon->attributes['alt'] === '') { $newicon = self::replace_moodle_icon($icon->pix, $icon->attributes['alt']) . parent::render_pix_icon($icon) . "</i>"; return $newicon; } else { return parent::render_pix_icon($icon); } }
protected function render_custom_menu(custom_menu $menu) { /* * This code replaces adds the current enrolled * courses to the custommenu. */ $hasdisplaymycourses = empty($this->page->theme->settings->displaymycourses) ? false : $this->page->theme->settings->displaymycourses; if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $mycoursetitle = $this->page->theme->settings->mycoursetitle; if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_evolved'); } else { if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_evolved'); } else { if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_evolved'); } else { $branchtitle = get_string('mycourses', 'theme_evolved'); } } } $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($courses = enrol_get_my_courses(NULL, 'fullname ASC')) { foreach ($courses 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_evolved'); $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments); } } return parent::render_custom_menu($menu); }
protected function render_custom_menu(custom_menu $menu) { /* * This code replaces adds the current enrolled * courses to the custommenu. */ $hasdisplaymycourses = empty($this->page->theme->settings->displaymycourses) ? false : $this->page->theme->settings->displaymycourses; if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { //Disable course section for Site Admin global $USER; $context = get_context_instance(CONTEXT_SYSTEM); $roles = get_user_roles($context, $USER->id, false); $role = key($roles); $roleid = $roles[$role]->roleid; if ($roleid != '14') { $mycoursetitle = $this->page->theme->settings->mycoursetitle; if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_gourmet'); } else { if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_gourmet'); } else { if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_gourmet'); } else { $branchtitle = get_string('mycourses', 'theme_gourmet'); } } } $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($courses = enrol_get_my_courses(NULL, 'fullname ASC')) { foreach ($courses 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_gourmet'); $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments); } } } /* * This code replaces adds the My Dashboard * functionality to the custommenu. */ $hasdisplaymydashboard = empty($this->page->theme->settings->displaymydashboard) ? false : $this->page->theme->settings->displaymydashboard; if (isloggedin() && !isguestuser() && $hasdisplaymydashboard) { $branchlabel = '<i class="fa fa-dashboard"></i>' . get_string('mydashboard', 'theme_gourmet'); $branchurl = new moodle_url('/my/index.php'); $branchtitle = get_string('mydashboard', 'theme_gourmet'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); $branch->add('<em><i class="fa fa-home"></i>' . get_string('myhome') . '</em>', new moodle_url('/my/index.php'), get_string('myhome')); $branch->add('<em><i class="fa fa-user"></i>' . get_string('profile') . '</em>', new moodle_url('/user/profile.php'), get_string('profile')); //GWL - Remove Items From Menu //$branch->add('<em><i class="fa fa-calendar"></i>'.get_string('pluginname', 'block_calendar_month').'</em>',new moodle_url('/calendar/view.php'),get_string('pluginname', 'block_calendar_month')); // GWL - Remove calendar from Menu //$branch->add('<em><i class="fa fa-envelope"></i>'.get_string('pluginname', 'block_messages').'</em>',new moodle_url('/message/index.php'),get_string('pluginname', 'block_messages')); // Remove message from menu //$branch->add('<em><i class="fa fa-certificate"></i>'.get_string('badges').'</em>',new moodle_url('/badges/mybadges.php'),get_string('badges')); // GWL - Remove Badges from menu //$branch->add('<em><i class="fa fa-file"></i>'.get_string('privatefiles', 'block_private_files').'</em>',new moodle_url('/user/files.php'),get_string('privatefiles', 'block_private_files')); // GWL - Remove Private Files from menu $branch->add('<em><i class="fa fa-sign-out"></i>' . get_string('logout') . '</em>', new moodle_url('/login/logout.php'), get_string('logout')); } return parent::render_custom_menu($menu); }
/** * Return the theme's compact logo URL, else the site's compact logo URL, if any. * * Note that maximum sizes are not applied to the theme logo. * * @param int $maxwidth The maximum width, or null when the maximum width does not matter. * @param int $maxheight The maximum height, or null when the maximum height does not matter. * @return moodle_url|false */ public function get_compact_logo_url($maxwidth = 100, $maxheight = 100) { if (!empty($this->page->theme->settings->smalllogo)) { return $this->page->theme->setting_file_url('smalllogo', 'smalllogo'); } return parent::get_compact_logo_url($maxwidth, $maxheight); }
/** * overridding user_profile_picture function. */ public function user_profile_picture() { GLOBAL $USER; $userpic = parent::user_picture($USER, array('link' => false, 'size' => 28)); return $userpic; }