Proyectos de Subversion Moodle

Rev

Rev 1 | Rev 1442 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 31... Línea 31...
31
require_once($CFG->dirroot .'/course/lib.php');
31
require_once($CFG->dirroot .'/course/lib.php');
32
require_once($CFG->libdir .'/filelib.php');
32
require_once($CFG->libdir .'/filelib.php');
Línea 33... Línea 33...
33
 
33
 
Línea -... Línea 34...
-
 
34
redirect_if_major_upgrade_required();
-
 
35
 
-
 
36
// Redirect logged-in users to homepage if required.
34
redirect_if_major_upgrade_required();
37
$redirect = optional_param('redirect', 1, PARAM_BOOL);
35
 
38
 
36
$urlparams = array();
39
$urlparams = array();
37
if (!empty($CFG->defaulthomepage) &&
40
if (!empty($CFG->defaulthomepage) &&
38
        ($CFG->defaulthomepage == HOMEPAGE_MY || $CFG->defaulthomepage == HOMEPAGE_MYCOURSES) &&
41
        ($CFG->defaulthomepage == HOMEPAGE_MY || $CFG->defaulthomepage == HOMEPAGE_MYCOURSES) &&
39
        optional_param('redirect', 1, PARAM_BOOL) === 0
42
        $redirect === 0
40
) {
43
) {
41
    $urlparams['redirect'] = 0;
44
    $urlparams['redirect'] = 0;
42
}
45
}
Línea 66... Línea 69...
66
}
69
}
Línea 67... Línea 70...
67
 
70
 
68
// If site registration needs updating, redirect.
71
// If site registration needs updating, redirect.
Línea -... Línea 72...
-
 
72
\core\hub\registration::registration_reminder('/index.php');
69
\core\hub\registration::registration_reminder('/index.php');
73
 
70
 
-
 
71
if (get_home_page() != HOMEPAGE_SITE) {
-
 
72
    // Redirect logged-in users to My Moodle overview if required.
74
$homepage = get_home_page();
73
    $redirect = optional_param('redirect', 1, PARAM_BOOL);
75
if ($homepage != HOMEPAGE_SITE) {
74
    if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
76
    if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
75
        set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
77
        set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
76
    } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) {
78
    } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) {
77
        // At this point, dashboard is enabled so we don't need to check for it (otherwise, get_home_page() won't return it).
79
        // At this point, dashboard is enabled so we don't need to check for it (otherwise, get_home_page() won't return it).
78
        redirect($CFG->wwwroot .'/my/');
80
        redirect($CFG->wwwroot .'/my/');
-
 
81
    } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MYCOURSES) && $redirect === 1) {
-
 
82
        redirect($CFG->wwwroot .'/my/courses.php');
79
    } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MYCOURSES) && $redirect === 1) {
83
    } else if ($homepage == HOMEPAGE_URL) {
80
        redirect($CFG->wwwroot .'/my/courses.php');
84
        redirect(get_default_home_page_url());
81
    } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) {
85
    } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) {
82
        $frontpagenode = $PAGE->settingsnav->find('frontpage', null);
86
        $frontpagenode = $PAGE->settingsnav->find('frontpage', null);
83
        if ($frontpagenode) {
87
        if ($frontpagenode) {
Línea 103... Línea 107...
103
$editing = $PAGE->user_is_editing();
107
$editing = $PAGE->user_is_editing();
104
$PAGE->set_title(get_string('home'));
108
$PAGE->set_title(get_string('home'));
105
$PAGE->set_heading($SITE->fullname);
109
$PAGE->set_heading($SITE->fullname);
106
$PAGE->set_secondary_active_tab('coursehome');
110
$PAGE->set_secondary_active_tab('coursehome');
Línea -... Línea 111...
-
 
111
 
-
 
112
$siteformatoptions = course_get_format($SITE)->get_format_options();
-
 
113
$modinfo = get_fast_modinfo($SITE);
-
 
114
$modnamesused = $modinfo->get_used_module_names();
-
 
115
 
-
 
116
// The home page can have acitvities in the block aside. We should
-
 
117
// initialize the course editor before the page structure is rendered.
-
 
118
include_course_ajax($SITE, $modnamesused);
107
 
119
 
Línea 108... Línea 120...
108
$courserenderer = $PAGE->get_renderer('core', 'course');
120
$courserenderer = $PAGE->get_renderer('core', 'course');
109
 
121
 
110
if ($hassiteconfig) {
122
if ($hassiteconfig) {
111
    $editurl = new moodle_url('/course/view.php', ['id' => SITEID, 'sesskey' => sesskey()]);
123
    $editurl = new moodle_url('/course/view.php', ['id' => SITEID, 'sesskey' => sesskey()]);
112
    $editbutton = $OUTPUT->edit_button($editurl);
124
    $editbutton = $OUTPUT->edit_button($editurl);
Línea 113... Línea 125...
113
    $PAGE->set_button($editbutton);
125
    $PAGE->set_button($editbutton);
Línea 114... Línea -...
114
}
-
 
115
 
-
 
116
echo $OUTPUT->header();
-
 
117
 
-
 
118
$siteformatoptions = course_get_format($SITE)->get_format_options();
126
}
119
$modinfo = get_fast_modinfo($SITE);
127
 
120
$modnamesused = $modinfo->get_used_module_names();
128
echo $OUTPUT->header();
121
 
129
 
122
// Print Section or custom info.
130
// Print Section or custom info.
Línea 129... Línea 137...
129
    include($CFG->customfrontpageinclude);
137
    include($CFG->customfrontpageinclude);
Línea 130... Línea 138...
130
 
138
 
131
} else if ($siteformatoptions['numsections'] > 0) {
139
} else if ($siteformatoptions['numsections'] > 0) {
132
    echo $courserenderer->frontpage_section1();
140
    echo $courserenderer->frontpage_section1();
133
}
-
 
134
// Include course AJAX.
-
 
Línea 135... Línea 141...
135
include_course_ajax($SITE, $modnamesused);
141
}
Línea 136... Línea 142...
136
 
142
 
137
echo $courserenderer->frontpage();
143
echo $courserenderer->frontpage();