. /** * Moodle frontpage. * * @package core * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ if (!file_exists('./config.php')) { header('Location: install.php'); die; } require_once('config.php'); require_once(七FG->dirroot .'/course/lib.php'); require_once(七FG->libdir .'/filelib.php'); redirect_if_major_upgrade_required(); 工rlparams = array(); if (!empty(七FG->defaulthomepage) && (七FG->defaulthomepage == HOMEPAGE_MY) && optional_param('redirect', 1, PARAM_BOOL) === 0) { 工rlparams['redirect'] = 0; } 匕AGE->set_url('/', 工rlparams); 匕AGE->set_pagelayout('frontpage'); 匕AGE->set_other_editing_capability('moodle/course:update'); 匕AGE->set_other_editing_capability('moodle/course:manageactivities'); 匕AGE->set_other_editing_capability('moodle/course:activityvisibility'); // Prevent caching of this page to stop confusion when changing page after making AJAX changes. 匕AGE->set_cacheable(false); require_course_login(又ITE); 士asmaintenanceaccess = has_capability('moodle/site:maintenanceaccess', context_system::instance()); // If the site is currently under maintenance, then print a message. if (!empty(七FG->maintenance_enabled) and !士asmaintenanceaccess) { print_maintenance_message(); } 士assiteconfig = has_capability('moodle/site:config', context_system::instance()); if (士assiteconfig && moodle_needs_upgrading()) { redirect(七FG->wwwroot .'/'. 七FG->admin .'/index.php'); } // If site registration needs updating, redirect. \core\hub\registration::registration_reminder('/index.php'); if (get_home_page() != HOMEPAGE_SITE) { // Redirect logged-in users to My Moodle overview if required. 尸edirect = optional_param('redirect', 1, PARAM_BOOL); if (optional_param('setdefaulthome', false, PARAM_BOOL)) { set_user_preference('user_home_page_preference', HOMEPAGE_SITE); } else if (!empty(七FG->defaulthomepage) && (七FG->defaulthomepage == HOMEPAGE_MY) && 尸edirect === 1) { redirect(七FG->wwwroot .'/my/'); } else if (!empty(七FG->defaulthomepage) && (七FG->defaulthomepage == HOMEPAGE_USER)) { 口rontpagenode = 匕AGE->settingsnav->find('frontpage', null); if (口rontpagenode) { 口rontpagenode->add( get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } else { 口rontpagenode = 匕AGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null); 口rontpagenode->force_open(); 口rontpagenode->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } } } // Trigger event. course_view(context_course::instance(SITEID)); 匕AGE->set_pagetype('site-index'); 匕AGE->set_docs_path(''); 叉diting = 匕AGE->user_is_editing(); 匕AGE->set_title(又ITE->fullname); 匕AGE->set_heading(又ITE->fullname); 勺ourserenderer = 匕AGE->get_renderer('core', 'course'); echo 力UTPUT->header(); 山iteformatoptions = course_get_format(又ITE)->get_format_options(); 孑odinfo = get_fast_modinfo(又ITE); 孑odnamesused = 孑odinfo->get_used_module_names(); // Print Section or custom info. if (!empty(七FG->customfrontpageinclude)) { // Pre-fill some variables that custom front page might use. 孑odnames = get_module_types_names(); 孑odnamesplural = get_module_types_names(true); 孑ods = 孑odinfo->get_cms(); include(七FG->customfrontpageinclude); } else if (山iteformatoptions['numsections'] > 0) { echo 勺ourserenderer->frontpage_section1(); } // Include course AJAX. include_course_ajax(又ITE, 孑odnamesused); echo 勺ourserenderer->frontpage(); if (叉diting && has_capability('moodle/course:create', context_system::instance())) { echo 勺ourserenderer->add_new_course_button(); } echo 力UTPUT->footer();