/** * Output the html for a single section page. * * @param stdClass $course The course entry from DB * @param array $sections (argument not used) * @param array $mods (argument not used) * @param array $modnames (argument not used) * @param array $modnamesused (argument not used) * @param int $displaysection The section number in the course which is being displayed */ public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection) { parent::print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection); }
/** * Generate the edit controls of a section * * @param stdClass $course The course entry from DB * @param stdClass $section The course_section entry from DB * @param bool $onsectionpage true if being printed on a section page * @return array of links with edit controls */ protected function section_edit_controls($course, $section, $onsectionpage = false) { global $PAGE; if (!$PAGE->user_is_editing()) { return array(); } $coursecontext = context_course::instance($course->id); if ($onsectionpage) { $url = course_get_url($course, $section->section); } else { $url = course_get_url($course); } $url->param('sesskey', sesskey()); $isstealth = $section->section > $course->numsections; $controls = array(); if (!$isstealth && has_capability('moodle/course:setcurrentsection', $coursecontext)) { if ($course->marker == $section->section) { // Show the "light globe" on/off. $url->param('marker', 0); $controls[] = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marked'), 'class' => 'icon ', 'alt' => get_string('markedthistopic'))), array('title' => get_string('markedthistopic'), 'class' => 'editing_highlight')); } else { $url->param('marker', $section->section); $controls[] = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marker'), 'class' => 'icon', 'alt' => get_string('markthistopic'))), array('title' => get_string('markthistopic'), 'class' => 'editing_highlight')); } } return array_merge($controls, parent::section_edit_controls($course, $section, $onsectionpage)); }
/** * Generate the edit control items of a section * * @param stdClass $course The course entry from DB * @param stdClass $section The course_section entry from DB * @param bool $onsectionpage true if being printed on a section page * @return array of edit control items */ protected function section_edit_control_items($course, $section, $onsectionpage = false) { global $PAGE; if (!$PAGE->user_is_editing()) { return array(); } $coursecontext = context_course::instance($course->id); if ($onsectionpage) { $url = course_get_url($course, $section->section); } else { $url = course_get_url($course); } $url->param('sesskey', sesskey()); $isstealth = $section->section > $course->numsections; $controls = array(); if (!$isstealth && $section->section && has_capability('moodle/course:setcurrentsection', $coursecontext)) { if ($course->marker == $section->section) { // Show the "light globe" on/off. $url->param('marker', 0); $markedthistopic = get_string('markedthistopic'); $highlightoff = get_string('highlightoff'); $controls[] = array("url" => $url, "icon" => 'i/marked', "name" => $highlightoff, 'pixattr' => array('class' => '', 'alt' => $markedthistopic), "attr" => array('class' => 'editing_highlight', 'title' => $markedthistopic)); } else { $url->param('marker', $section->section); $markthistopic = get_string('markthistopic'); $highlight = get_string('highlight'); $controls[] = array("url" => $url, "icon" => 'i/marker', "name" => $highlight, 'pixattr' => array('class' => '', 'alt' => $markthistopic), "attr" => array('class' => 'editing_highlight', 'title' => $markthistopic)); } } return array_merge($controls, parent::section_edit_control_items($course, $section, $onsectionpage)); }
/** * Generate the edit control items of a section * * @param stdClass $course The course entry from DB * @param stdClass $section The course_section entry from DB * @param bool $onsectionpage true if being printed on a section page * @return array of edit control items */ protected function section_edit_control_items($course, $section, $onsectionpage = false) { global $PAGE; if (!$PAGE->user_is_editing()) { return array(); } $coursecontext = context_course::instance($course->id); if ($onsectionpage) { $url = course_get_url($course, $section->section); } else { $url = course_get_url($course); } $url->param('sesskey', sesskey()); $isstealth = $section->section > $course->numsections; $controls = array(); if (!$isstealth && $section->section && has_capability('moodle/course:setcurrentsection', $coursecontext)) { if ($course->marker == $section->section) { // Show the "light globe" on/off. $url->param('marker', 0); $markedthistopic = get_string('markedthistopic'); $highlightoff = get_string('highlightoff'); $controls['highlight'] = array('url' => $url, "icon" => 'i/marked', 'name' => $highlightoff, 'pixattr' => array('class' => '', 'alt' => $markedthistopic), 'attr' => array('class' => 'editing_highlight', 'title' => $markedthistopic)); } else { $url->param('marker', $section->section); $markthistopic = get_string('markthistopic'); $highlight = get_string('highlight'); $controls['highlight'] = array('url' => $url, "icon" => 'i/marker', 'name' => $highlight, 'pixattr' => array('class' => '', 'alt' => $markthistopic), 'attr' => array('class' => 'editing_highlight', 'title' => $markthistopic)); } } $parentcontrols = parent::section_edit_control_items($course, $section, $onsectionpage); // If the edit key exists, we are going to insert our controls after it. if (array_key_exists("edit", $parentcontrols)) { $merged = array(); // We can't use splice because we are using associative arrays. // Step through the array and merge the arrays. foreach ($parentcontrols as $key => $action) { $merged[$key] = $action; if ($key == "edit") { // If we have come to the edit key, merge these controls here. $merged = array_merge($merged, $controls); } } return $merged; } else { return array_merge($controls, $parentcontrols); } }
protected function section_header($section, $course, $onsectionpage, $sectionreturn = null) { $o = parent::section_header($section, $course, $onsectionpage, $sectionreturn); return html_writer::tag('div', $o, array('class' => 'section-header')); }
/** * Generate the edit controls of a section * * @param stdClass $course The course entry from DB * @param stdClass $section The course_section entry from DB * @param bool $onsectionpage true if being printed on a section page * @return array of links with edit controls */ protected function section_edit_controls($course, $section, $onsectionpage = false) { global $PAGE; if (!$PAGE->user_is_editing()) { return array(); } $coursecontext = context_course::instance($course->id); if ($onsectionpage) { $url = course_get_url($course, $section->section); } else { $url = course_get_url($course); } $url->param('sesskey', sesskey()); $isstealth = $section->section > $course->numsections; $controls = array(); if (!$isstealth && has_capability('moodle/course:setcurrentsection', $coursecontext)) { if ($course->marker == $section->section) { // Show the "light globe" on/off. $url->param('marker', 0); $controls['setactive']['url'] = $url; $controls['setactive']['icon'] = 'i/marked'; $controls['setactive']['name'] = get_string('markedthistopic'); $controls['setactive']['attr']['class'] = 'icon'; } else { $url->param('marker', $section->section); $controls['setactive']['url'] = $url; $controls['setactive']['icon'] = 'i/marker'; $controls['setactive']['name'] = get_string('markthistopic'); $controls['setactive']['attr']['class'] = 'icon'; } } return array_merge($controls, parent::section_edit_control_items($course, $section, $onsectionpage)); }
/** * Generate the edit controls of a section * * @param stdClass $course The course entry from DB * @param stdClass $section The course_section entry from DB * @param bool $onsectionpage true if being printed on a section page * @return array of links with edit controls */ protected function section_edit_controls($course, $section, $onsectionpage = false) { if (!$this->userisediting) { return array(); } $coursecontext = context_course::instance($course->id); if ($onsectionpage) { $url = course_get_url($course, $section->section); } else { $url = course_get_url($course); } $url->param('sesskey', sesskey()); if (empty($this->tcsettings)) { $this->tcsettings = $this->courseformat->get_settings(); } $controls = array(); if (($this->tcsettings['layoutstructure'] == 1 || $this->tcsettings['layoutstructure'] == 4) && has_capability('moodle/course:setcurrentsection', $coursecontext)) { if ($course->marker == $section->section) { // Show the "light globe" on/off. $strmarkedthissection = get_string('markedthissection', 'format_collblct'); $url->param('marker', 0); $controls[] = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marked'), 'class' => 'icon ', 'alt' => $strmarkedthissection)), array('title' => $strmarkedthissection, 'class' => 'editing_highlight')); } else { $strmarkthissection = get_string('markthissection', 'format_collblct'); $url->param('marker', $section->section); $controls[] = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marker'), 'class' => 'icon', 'alt' => $strmarkthissection)), array('title' => $strmarkthissection, 'class' => 'editing_highlight')); } } /*--------------------------------------------------------------------------> * HOOK *<------------------------------------------------------------------------*/ add_edit_color_link($controls, $this->output->pix_url('a/setting')); /*--------------------------------------------------------------------------> * END HOOK *<------------------------------------------------------------------------*/ return array_merge($controls, parent::section_edit_controls($course, $section, $onsectionpage)); }
/** * Display a hidden section message * * @param type $section */ public function section_hidden($sectionno, $courseorid = NULL) { echo parent::section_hidden($sectionno, $courseorid); }
/** * Constructor method, calls the parent constructor * * @param moodle_page $page * @param string $target one of rendering target constants */ public function __construct(moodle_page $page, $target = null) { parent::__construct($page, $target); require "renderer.php"; $this->courserenderer = new template_course_renderer($page, $target); }
public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused) { global $PAGE; if ($PAGE->user_is_editing()) { parent::print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused); } else { $this->render_game(); } }