-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
170 lines (139 loc) · 6.84 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php // $Id: index.php 13027 2011-03-31 16:40:32Z abourguignon $
/**
* CLAROLINE
*
* Campus Home Page
*
* @version $Revision: 13027 $
* @copyright (c) 2001-2011, Universite catholique de Louvain (UCL)
* @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
* @package CLINDEX
* @author Claro Team <cvs@claroline.net>
*/
unset($includePath); // prevent hacking
// Flag forcing the 'current course' reset, as we're not anymore inside a course
$cidReset = true;
$tidReset = true;
$_SESSION['courseSessionCode'] = null;
// Include Library and configuration files
require './claroline/inc/claro_init_global.inc.php'; // main init
include claro_get_conf_repository() . 'CLHOME.conf.php'; // conf file
if (get_conf('display_former_homepage') || !claro_is_user_authenticated())
{
require_once get_path('incRepositorySys') . '/lib/courselist.lib.php';
JavascriptLoader::getInstance()->load('courseList');
// Main template
$template = new CoreTemplate('platform_index.tpl.php');
// Languages
$template->assign('languages', get_language_to_display_list());
$template->assign('currentLanguage', language::current_language());
// Category browser
$categoryId = ( !empty( $_REQUEST['category']) ) ? ( (int) $_REQUEST['category'] ) : ( 0 );
$categoryBrowser = new ClaroCategoriesBrowser( $categoryId, claro_get_current_user_id() );
$templateCategoryBrowser = $categoryBrowser->getTemplate();
$template->assign('templateCategoryBrowser', $templateCategoryBrowser);
// User course (activated and deactivated) lists
$userCourseList = render_user_course_list();
$userCourseListDesactivated = render_user_course_list_desactivated();
$templateMyCourses = new CoreTemplate('mycourses.tpl.php');
$templateMyCourses->assign('userCourseList', $userCourseList);
$templateMyCourses->assign('userCourseListDesactivated', $userCourseListDesactivated);
$template->assign('templateMyCourses', $templateMyCourses);
// Last user action
$lastUserAction = ($_SESSION['last_action'] != '1970-01-01 00:00:00') ?
$_SESSION['last_action'] :
date('Y-m-d H:i:s');
$template->assign('lastUserAction', $lastUserAction);
if (claro_is_user_authenticated())
{
$userCommands = array();
// User commands
$userCommands[] = '<a href="' . $_SERVER['PHP_SELF'] . '" class="userCommandsItem">'
. '<img src="' . get_icon_url('mycourses') . '" alt="" /> '
. get_lang('My course list')
. '</a>' . "\n";
// 'Create Course Site' command. Only available for teacher.
if (claro_is_allowed_to_create_course())
{
$userCommands[] = '<a href="claroline/course/create.php" class="userCommandsItem">'
. '<img src="' . get_icon_url('courseadd') . '" alt="" /> '
. get_lang('Create a course site')
. '</a>' . "\n";
}
elseif ( $GLOBALS['currentUser']->isCourseCreator )
{
$userCommands[] = '<span class="userCommandsItemDisabled">'
. '<img src="' . get_icon_url('courseadd') . '" alt="" /> '
. get_lang('Create a course site')
. '</span>' . "\n";
}
if (get_conf('allowToSelfEnroll',true))
{
$userCommands[] = '<a href="claroline/auth/courses.php?cmd=rqReg&categoryId=0" class="userCommandsItem">'
. '<img src="' . get_icon_url('enroll') . '" alt="" /> '
. get_lang('Enrol on a new course')
. '</a>' . "\n";
$userCommands[] = '<a href="claroline/auth/courses.php?cmd=rqUnreg" class="userCommandsItem">'
. '<img src="' . get_icon_url('unenroll') . '" alt="" /> '
. get_lang('Remove course enrolment')
. '</a>' . "\n";
}
$userCommands[] = '<a href="claroline/course/platform_courses.php" class="userCommandsItem">'
. '<img src="' . get_icon_url('course') . '" alt="" /> '
. get_lang('All platform courses')
. '</a>' . "\n";
$userCommands[] = '<a href="'.htmlspecialchars(Url::Contextualize( get_path('clarolineRepositoryWeb') . 'notification_date.php')).'" class="userCommandsItem">'
. '<img class="iconDefinitionList" src="'.get_icon_url('hot').'" alt="'.get_lang('New items').'" />'
. ' '.get_lang('New items').' '
. get_lang('to another date')
. ((substr($lastUserAction, strlen($lastUserAction) - 8) == '00:00:00' ) ?
(' ['.claro_html_localised_date(
get_locale('dateFormatNumeric'),
strtotime($lastUserAction)).']') :
(''))
. '</a>' . "\n";
$template->assign('userCommands', $userCommands);
// User profilebox
FromKernel::uses('display/userprofilebox.lib');
$userProfileBox = new UserProfileBox(false);
$template->assign('userProfileBox', $userProfileBox);
}
// Render
$claroline->display->body->setContent($template->render());
if (!(isset($_REQUEST['logout']) && isset($_SESSION['isVirtualUser'])))
{
echo $claroline->display->render();
}
}
else
{
require_once get_path('clarolineRepositorySys') . '/desktop/index.php';
}
// Logout request : delete session data
if (isset($_REQUEST['logout']))
{
if (isset($_SESSION['isVirtualUser']))
{
unset($_SESSION['isVirtualUser']);
claro_redirect(get_conf('rootWeb') . 'claroline/admin/admin_users.php');
exit();
}
// notify that a user has just loggued out
if (isset($logout_uid)) // Set by local_init
{
$eventNotifier->notifyEvent('user_logout', array('uid' => $logout_uid));
}
/* needed to be able to :
- log with claroline when 'magic login' has previously been clicked
- notify logout event
(logout from CAS has been commented in casProcess.inc.php)*/
if( get_conf('claro_CasEnabled', false) && ( get_conf('claro_CasGlobalLogout') && !phpCAS::checkAuthentication() ) )
{
phpCAS::logout((isset( $_SERVER['HTTPS']) && ($_SERVER['HTTPS']=='on'||$_SERVER['HTTPS']==1) ? 'https://' : 'http://')
. $_SERVER['HTTP_HOST'].get_conf('urlAppend').'/index.php');
}
session_destroy();
}
// Hide breadcrumbs and view mode on platform home page
// $claroline->display->banner->hideBreadcrumbLine();
?>