Example #1
0
 /**
  * Trigger the course viewed event.
  *
  * @param int $courseid id of course
  * @param int $sectionnumber sectionnumber (0, 1, 2...)
  * @return array of warnings and status result
  * @since Moodle 2.9
  * @throws moodle_exception
  */
 public static function view_course($courseid, $sectionnumber = 0)
 {
     global $CFG;
     require_once $CFG->dirroot . "/course/lib.php";
     $params = self::validate_parameters(self::view_course_parameters(), array('courseid' => $courseid, 'sectionnumber' => $sectionnumber));
     $warnings = array();
     $course = get_course($params['courseid']);
     $context = context_course::instance($course->id);
     self::validate_context($context);
     if (!empty($params['sectionnumber'])) {
         // Get section details and check it exists.
         $modinfo = get_fast_modinfo($course);
         $coursesection = $modinfo->get_section_info($params['sectionnumber'], MUST_EXIST);
         // Check user is allowed to see it.
         if (!$coursesection->uservisible) {
             require_capability('moodle/course:viewhiddensections', $context);
         }
     }
     course_view($context, $params['sectionnumber']);
     $result = array();
     $result['status'] = true;
     $result['warnings'] = $warnings;
     return $result;
 }
Example #2
0
        $('#page-content .summary div').css('display', 'none');
        $('#page-content .summary div').css('overflow', 'hidden');
        $('#page-content .summary div').css('transition', 'all 1s');
        $('#page-content .summary div').css('height', '66vh');
        var shortHeight = $('#page-content .summary div').height();
        if (fullHeight > shortHeight) {
            $('#page-content .summary div').after('<button id="read-more" style="margin: 10px; float: right;">Ler Mais</button>');
        }
        $('#page-content .summary div').css('display', 'block');
        $('body').on('click', '#read-more', function(){
           $('#page-content .summary div').css('height', fullHeight + 'px');
           $(this).remove();
        });
        $('.onetopic .nav-tabs li.active').attr('class', '');
        $('.onetopic .nav-tabs li').each(function(index) {
            if(index !== 0) {
                $(this).css('border-left', '1px solid #ddd');
            }
        });
    });
</script>
<?php 
// Content wrapper end.
echo html_writer::end_tag('div');
// Trigger course viewed event.
// We don't trust $context here. Course format inclusion above executes in the global space. We can't assume
// anything after that point.
course_view(context_course::instance($course->id), $section);
// Include course AJAX
include_course_ajax($course, $modnamesused);
echo $OUTPUT->footer();
Example #3
0
        } else {
            if (!empty($CFG->defaulthomepage) && $CFG->defaulthomepage == HOMEPAGE_USER) {
                $frontpagenode = $PAGE->settingsnav->find('frontpage', null);
                if ($frontpagenode) {
                    $frontpagenode->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING);
                } else {
                    $frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null);
                    $frontpagenode->force_open();
                    $frontpagenode->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING);
                }
            }
        }
    }
}
// Trigger event.
course_view(context_course::instance(SITEID));
// If the hub plugin is installed then we let it take over the homepage here.
if (file_exists($CFG->dirroot . '/local/hub/lib.php') and get_config('local_hub', 'hubenabled')) {
    require_once $CFG->dirroot . '/local/hub/lib.php';
    $hub = new local_hub();
    $continue = $hub->display_homepage();
    // Function display_homepage() returns true if the hub home page is not displayed
    // ...mostly when search form is not displayed for not logged users.
    if (empty($continue)) {
        exit;
    }
}
$PAGE->set_pagetype('site-index');
$PAGE->set_docs_path('');
$PAGE->set_pagelayout('frontpage');
$editing = $PAGE->user_is_editing();