| Línea 25... |
Línea 25... |
| 25 |
if (!file_exists('./config.php')) {
|
25 |
if (!file_exists('./config.php')) {
|
| 26 |
header('Location: install.php');
|
26 |
header('Location: install.php');
|
| 27 |
die;
|
27 |
die;
|
| 28 |
}
|
28 |
}
|
| Línea -... |
Línea 29... |
| - |
|
29 |
|
| 29 |
|
30 |
|
| 30 |
require_once('config.php');
|
31 |
require_once('config.php');
|
| 31 |
require_once($CFG->dirroot .'/course/lib.php');
|
32 |
require_once($CFG->dirroot . '/course/lib.php');
|
| Línea 32... |
Línea 33... |
| 32 |
require_once($CFG->libdir .'/filelib.php');
|
33 |
require_once($CFG->libdir . '/filelib.php');
|
| Línea 33... |
Línea 34... |
| 33 |
|
34 |
|
| 34 |
redirect_if_major_upgrade_required();
|
35 |
redirect_if_major_upgrade_required();
|
| Línea 35... |
Línea 36... |
| 35 |
|
36 |
|
| - |
|
37 |
// Redirect logged-in users to homepage if required.
|
| 36 |
// Redirect logged-in users to homepage if required.
|
38 |
$redirect = optional_param('redirect', 1, PARAM_BOOL);
|
| 37 |
$redirect = optional_param('redirect', 1, PARAM_BOOL);
|
39 |
|
| 38 |
|
40 |
$urlparams = array();
|
| 39 |
$urlparams = array();
|
41 |
if (
|
| 40 |
if (!empty($CFG->defaulthomepage) &&
|
42 |
!empty($CFG->defaulthomepage) &&
|
| 41 |
($CFG->defaulthomepage == HOMEPAGE_MY || $CFG->defaulthomepage == HOMEPAGE_MYCOURSES) &&
|
43 |
($CFG->defaulthomepage == HOMEPAGE_MY || $CFG->defaulthomepage == HOMEPAGE_MYCOURSES) &&
|
| 42 |
$redirect === 0
|
44 |
$redirect === 0
|
| 43 |
) {
|
45 |
) {
|
| Línea 63... |
Línea 65... |
| 63 |
}
|
65 |
}
|
| Línea 64... |
Línea 66... |
| 64 |
|
66 |
|
| Línea 65... |
Línea 67... |
| 65 |
$hassiteconfig = has_capability('moodle/site:config', context_system::instance());
|
67 |
$hassiteconfig = has_capability('moodle/site:config', context_system::instance());
|
| 66 |
|
68 |
|
| 67 |
if ($hassiteconfig && moodle_needs_upgrading()) {
|
69 |
if ($hassiteconfig && moodle_needs_upgrading()) {
|
| Línea 68... |
Línea 70... |
| 68 |
redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php');
|
70 |
redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
|
| 69 |
}
|
71 |
}
|
| Línea 75... |
Línea 77... |
| 75 |
if ($homepage != HOMEPAGE_SITE) {
|
77 |
if ($homepage != HOMEPAGE_SITE) {
|
| 76 |
if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
|
78 |
if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
|
| 77 |
set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
|
79 |
set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
|
| 78 |
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) {
|
80 |
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) {
|
| 79 |
// At this point, dashboard is enabled so we don't need to check for it (otherwise, get_home_page() won't return it).
|
81 |
// At this point, dashboard is enabled so we don't need to check for it (otherwise, get_home_page() won't return it).
|
| 80 |
redirect($CFG->wwwroot .'/my/');
|
82 |
redirect($CFG->wwwroot . '/my/');
|
| 81 |
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MYCOURSES) && $redirect === 1) {
|
83 |
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MYCOURSES) && $redirect === 1) {
|
| 82 |
redirect($CFG->wwwroot .'/my/courses.php');
|
84 |
redirect($CFG->wwwroot . '/my/courses.php');
|
| 83 |
} else if ($homepage == HOMEPAGE_URL) {
|
85 |
} else if ($homepage == HOMEPAGE_URL) {
|
| 84 |
redirect(get_default_home_page_url());
|
86 |
redirect(get_default_home_page_url());
|
| 85 |
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) {
|
87 |
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) {
|
| 86 |
$frontpagenode = $PAGE->settingsnav->find('frontpage', null);
|
88 |
$frontpagenode = $PAGE->settingsnav->find('frontpage', null);
|
| 87 |
if ($frontpagenode) {
|
89 |
if ($frontpagenode) {
|
| 88 |
$frontpagenode->add(
|
90 |
$frontpagenode->add(
|
| 89 |
get_string('makethismyhome'),
|
91 |
get_string('makethismyhome'),
|
| 90 |
new moodle_url('/', array('setdefaulthome' => true)),
|
92 |
new moodle_url('/', array('setdefaulthome' => true)),
|
| 91 |
navigation_node::TYPE_SETTING);
|
93 |
navigation_node::TYPE_SETTING
|
| - |
|
94 |
);
|
| 92 |
} else {
|
95 |
} else {
|
| 93 |
$frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null);
|
96 |
$frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null);
|
| 94 |
$frontpagenode->force_open();
|
97 |
$frontpagenode->force_open();
|
| - |
|
98 |
$frontpagenode->add(
|
| 95 |
$frontpagenode->add(get_string('makethismyhome'),
|
99 |
get_string('makethismyhome'),
|
| 96 |
new moodle_url('/', array('setdefaulthome' => true)),
|
100 |
new moodle_url('/', array('setdefaulthome' => true)),
|
| 97 |
navigation_node::TYPE_SETTING);
|
101 |
navigation_node::TYPE_SETTING
|
| - |
|
102 |
);
|
| 98 |
}
|
103 |
}
|
| 99 |
}
|
104 |
}
|
| 100 |
}
|
105 |
}
|
| Línea 101... |
Línea 106... |
| 101 |
|
106 |
|
| Línea 133... |
Línea 138... |
| 133 |
$modnames = get_module_types_names();
|
138 |
$modnames = get_module_types_names();
|
| 134 |
$modnamesplural = get_module_types_names(true);
|
139 |
$modnamesplural = get_module_types_names(true);
|
| 135 |
$mods = $modinfo->get_cms();
|
140 |
$mods = $modinfo->get_cms();
|
| Línea 136... |
Línea 141... |
| 136 |
|
141 |
|
| 137 |
include($CFG->customfrontpageinclude);
|
- |
|
| 138 |
|
142 |
include($CFG->customfrontpageinclude);
|
| 139 |
} else if ($siteformatoptions['numsections'] > 0) {
|
143 |
} else if ($siteformatoptions['numsections'] > 0) {
|
| 140 |
echo $courserenderer->frontpage_section1();
|
144 |
echo $courserenderer->frontpage_section1();
|
| Línea 141... |
Línea 145... |
| 141 |
}
|
145 |
}
|