diff --git a/classes/output/courseformat/content.php b/classes/output/courseformat/content.php index 198cbf81884a0253bba2e5ca0976c0481d12b1a7..acceba7a9e7e0310d6fabed9756283f86fb77d88 100644 --- a/classes/output/courseformat/content.php +++ b/classes/output/courseformat/content.php @@ -46,7 +46,7 @@ class content extends content_base { */ public function export_for_template(\renderer_base $output) { global $CFG, $COURSE, $USER; - + $data=parent::export_for_template($output); //$section_entity = new course_format_iena_sections(); diff --git a/format.js b/format.js index e657204f864b420e8d1cc228d53b185018d2e947..26435a8779e7d110b153699c6889b28706034046 100644 --- a/format.js +++ b/format.js @@ -23,57 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -M.course = M.course || {}; -M.course.format = M.course.format || {}; - -M.course.format.get_config = function() { - return { - container_node: 'ul', - container_class: 'buttons', - section_node: 'li', - section_class: 'section' - }; -}; - -M.course.format.swap_sections = function(Y, node1, node2) { - var CSS = { - COURSECONTENT: 'course-content', - SECTIONADDMENUS: 'section_add_menus' - }; - var sectionlist = Y.Node.all('.' + CSS.COURSECONTENT + ' ' + M.course.format.get_section_selector(Y)); - // Swap the non-ajax menus, noting these are not always present (depends on theme and user prefs). - if (sectionlist.item(node1).one('.' + CSS.SECTIONADDMENUS)) { - sectionlist.item(node1).one('.' + CSS.SECTIONADDMENUS).swap(sectionlist.item(node2).one('.' + CSS.SECTIONADDMENUS)); - } -}; - -M.course.format.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) { - var CSS = { - SECTIONNAME: 'sectionname' - }, - SELECTORS = { - SECTIONLEFTSIDE: '.left .section-handle img' - }; - if (response.action == 'move') { - if (sectionfrom > sectionto) { - var temp = sectionto; - sectionto = sectionfrom; - sectionfrom = temp; - } - var ele, str, stridx, newstr; - for (var i = sectionfrom; i <= sectionto; i++) { - var content = Y.Node.create('<span>' + response.sectiontitles[i] + '</span>'); - sectionlist.item(i).all('.' + CSS.SECTIONNAME).setHTML(content); - ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE); - str = ele.getAttribute('alt'); - stridx = str.lastIndexOf(' '); - newstr = str.substr(0, stridx + 1) + i; - ele.setAttribute('alt', newstr); - ele.setAttribute('title', newstr); - } - } -}; (function () { $(".iena-description .description-inner").each(function(index){ diff --git a/format.php b/format.php index 4a23a59d00cce9cbe98718c79683ce3df0d76db8..39dfe7604b61e68e4ef06bc664da80a206a31b55 100644 --- a/format.php +++ b/format.php @@ -41,29 +41,6 @@ require_once($CFG->libdir . '/completionlib.php'); $PAGE->requires->js('/course/format/iena/js/jquery.min.js'); $PAGE->requires->js('/course/format/iena/format.js'); -/*if ($topic = optional_param('topic', 0, PARAM_INT)) { - $url = $PAGE->url; - $url->param('section', $topic); - debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER); - redirect($url); -} -$context = context_course::instance($course->id); -if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) { - $course->marker = $marker; - course_set_marker($course->id, $marker); -} -$course = course_get_format($course)->get_course(); -course_create_sections_if_missing($course, 0); -$renderer = $PAGE->get_renderer('format_iena'); -if (!empty($displaysection)) { - - $renderer->print_single_section_page($course, null, null, null, null, $displaysection); -} else { - $renderer->switch_mode($course); -}*/ - - - // Horrible backwards compatible parameter aliasing. if ($topic = optional_param('topic', 0, PARAM_INT)) { @@ -89,8 +66,8 @@ if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context course_create_sections_if_missing($course, 0); $renderer = $PAGE->get_renderer('format_iena'); -if (!empty($displaysection)) { - $format->set_section_number($displaysection); +if (!is_null($displaysection)) { + $format->set_sectionnum($displaysection); } $outputclass = $format->get_output_classname('content'); $widget = new $outputclass($format); diff --git a/lib.php b/lib.php index ad4fcd6b23e4432104f2d877cc0bf2b2e9fe3a0a..069bb0e5083c052e58fc23ab2c513af428983a7a 100644 --- a/lib.php +++ b/lib.php @@ -36,6 +36,7 @@ class format_iena extends format_topics { global $PAGE; static $courseformatoptions = false; if ($courseformatoptions === false) { + $courseformatoptions=array(); $courseformatoptions['allmodulesbreadcrum'] = array( 'default' => 0, 'type' => PARAM_INT, @@ -341,7 +342,10 @@ class format_iena extends format_topics { $url->param('section', $sectionno); } else { if (empty($CFG->linkcoursesections) && !empty($options['navigation'])) { - return null; + $sectioninfo = $this->get_section($sectionno); + //return new moodle_url('/course/section.php', ['id' => $sectioninfo->id]); + $url->set_anchor('section-' . $sectionno); + return $url; } $url->set_anchor('section-' . $sectionno); } diff --git a/renderer.php b/renderer.php index bdb75f0209fea0d531c03df44bb2a013cc14aaf0..41f71b41dff33839143fd813424f8e0b80ad22f0 100644 --- a/renderer.php +++ b/renderer.php @@ -21,7 +21,6 @@ defined('MOODLE_INTERNAL') || die(); -require_once($CFG->dirroot . '/course/format/topics/renderer.php'); /** * format_iena_renderer