@@ -25,16 +25,16 @@ |
||
25 | 25 | $audioFileName = Database::escape_string($audioFileName); |
26 | 26 | $audioFileName = api_replace_dangerous_char($audioFileName); |
27 | 27 | $audioFileName = disable_dangerous_file($audioFileName); |
28 | -$audioDir = Security::remove_XSS($audioDir); |
|
28 | +$audioDir = Security::remove_XSS($audioDir); |
|
29 | 29 | |
30 | -$dirBaseDocuments = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'; |
|
31 | -$saveDir = $dirBaseDocuments . $audioDir; |
|
30 | +$dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'; |
|
31 | +$saveDir = $dirBaseDocuments.$audioDir; |
|
32 | 32 | |
33 | 33 | if (!is_dir($saveDir)) { |
34 | 34 | DocumentManager::createDefaultAudioFolder($courseInfo); |
35 | 35 | } |
36 | 36 | |
37 | -$documentPath = $saveDir . '/' . $audioFileName; |
|
37 | +$documentPath = $saveDir.'/'.$audioFileName; |
|
38 | 38 | |
39 | 39 | $file['file'] = $file; |
40 | 40 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | // Do not use here check Fileinfo method because return: text/plain |
49 | 49 | |
50 | 50 | $dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
51 | -$saveDir = $dirBaseDocuments . $wamidir; |
|
51 | +$saveDir = $dirBaseDocuments.$wamidir; |
|
52 | 52 | |
53 | 53 | if (!is_dir($saveDir)) { |
54 | 54 | DocumentManager::createDefaultAudioFolder($_course); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ob_start(); |
89 | 89 | |
90 | 90 | // Strangely the file path changes with a double extension |
91 | -copy($documentPath, $documentPath . '.wav'); |
|
91 | +copy($documentPath, $documentPath.'.wav'); |
|
92 | 92 | |
93 | 93 | $documentData = DocumentManager::upload_document( |
94 | 94 | $file, |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | ); |
150 | 150 | } |
151 | 151 | } else { |
152 | - foreach($document_data['parents'] as $document_sub_data) { |
|
153 | - if (!isset($_GET['createdir']) && $document_sub_data['id'] == $document_data['id']) { |
|
152 | + foreach ($document_data['parents'] as $document_sub_data) { |
|
153 | + if (!isset($_GET['createdir']) && $document_sub_data['id'] == $document_data['id']) { |
|
154 | 154 | $document_sub_data['document_url'] = '#'; |
155 | 155 | } |
156 | 156 | $interbreadcrumb[] = array( |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | $js_glossary_in_documents = ''; |
182 | 182 | |
183 | -$js_glossary_in_documents = ' |
|
183 | +$js_glossary_in_documents = ' |
|
184 | 184 | $.frameReady(function(){ |
185 | 185 | // $("<div>I am a div courses</div>").prependTo("body"); |
186 | 186 | }, "top.mainFrame", |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | // PDF should be displayed with viewerJS |
201 | 201 | $web_odf_supported_files[] = 'pdf'; |
202 | 202 | if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) { |
203 | - $show_web_odf = true; |
|
203 | + $show_web_odf = true; |
|
204 | 204 | /* |
205 | 205 | $htmlHeadXtra[] = api_get_js('webodf/webodf.js'); |
206 | 206 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/webodf/webodf.css'); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $htmlHeadXtra[] = api_get_js('highlight/highlight.pack.js'); |
244 | 244 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css'); |
245 | 245 | $htmlHeadXtra[] = api_get_css( |
246 | - api_get_path(WEB_LIBRARY_PATH) . 'javascript/highlight/styles/github.css' |
|
246 | + api_get_path(WEB_LIBRARY_PATH).'javascript/highlight/styles/github.css' |
|
247 | 247 | ); |
248 | 248 | $htmlHeadXtra[] = ' |
249 | 249 | <script> |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $execute_iframe = true; |
255 | 255 | if ($jplayer_supported) { |
256 | 256 | $extension = api_strtolower($pathinfo['extension']); |
257 | - if ($extension == 'mp4') { |
|
257 | + if ($extension == 'mp4') { |
|
258 | 258 | $extension = 'm4v'; |
259 | 259 | } |
260 | 260 | $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $execute_iframe = false; |
296 | 296 | } |
297 | 297 | |
298 | -$is_freemind_available = $pathinfo['extension']=='mm' && api_get_setting('enable_freemind') == 'true'; |
|
298 | +$is_freemind_available = $pathinfo['extension'] == 'mm' && api_get_setting('enable_freemind') == 'true'; |
|
299 | 299 | if ($is_freemind_available) { |
300 | 300 | $execute_iframe = false; |
301 | 301 | } |
@@ -339,18 +339,18 @@ discard block |
||
339 | 339 | $file_url_web = $file_url.'?'.api_get_cidreq(); |
340 | 340 | |
341 | 341 | if (in_array(strtolower($pathinfo['extension']), array('html', "htm"))) { |
342 | - echo '<a class="btn btn-default" href="' . $file_url_web . '" target="_blank">' . get_lang('CutPasteLink') . '</a>'; |
|
342 | + echo '<a class="btn btn-default" href="'.$file_url_web.'" target="_blank">'.get_lang('CutPasteLink').'</a>'; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | if ($show_web_odf) { |
346 | 346 | $browser = api_get_navigator(); |
347 | - $pdfUrl = api_get_path(WEB_LIBRARY_PATH) . 'javascript/ViewerJS/index.html#' . $file_url; |
|
347 | + $pdfUrl = api_get_path(WEB_LIBRARY_PATH).'javascript/ViewerJS/index.html#'.$file_url; |
|
348 | 348 | if ($browser['name'] == 'Mozilla' && preg_match('|.*\.pdf|i', $header_file)) { |
349 | 349 | $pdfUrl = $file_url; |
350 | 350 | } |
351 | 351 | echo '<div id="viewerJS">'; |
352 | 352 | echo '<iframe id="viewerJSContent" frameborder="0" allowfullscreen="allowfullscreen" webkitallowfullscreen style="width:100%;" |
353 | - src="' . $pdfUrl. '"> |
|
353 | + src="' . $pdfUrl.'"> |
|
354 | 354 | </iframe>'; |
355 | 355 | echo '</div>'; |
356 | 356 | } elseif (!$originIsLearnpath) { |
@@ -90,12 +90,12 @@ |
||
90 | 90 | $file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq(); |
91 | 91 | $pathinfo = pathinfo($header_file); |
92 | 92 | |
93 | -if ($pathinfo['extension']=='swf') { |
|
94 | - $width='83%'; |
|
95 | - $height='83%'; |
|
93 | +if ($pathinfo['extension'] == 'swf') { |
|
94 | + $width = '83%'; |
|
95 | + $height = '83%'; |
|
96 | 96 | } else { |
97 | - $width='100%'; |
|
98 | - $height='100%'; |
|
97 | + $width = '100%'; |
|
98 | + $height = '100%'; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | echo '<iframe border="0" frameborder="0" scrolling="no" style="width:'.$width.'; height:'.$height.';background-color:#ffffff;" id="mainFrame" name="mainFrame" src="'.$file_url_web.'?'.api_get_cidreq().'&rand='.mt_rand(1, 1000).'"></iframe>'; |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | //Add the JS needed to use the jqgrid |
16 | 16 | $htmlHeadXtra[] = api_get_jqgrid_js(); |
17 | 17 | // setting breadcrumbs |
18 | -$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
18 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | 19 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
20 | 20 | if ($action == 'add') { |
21 | - $interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes')); |
|
22 | - $interbreadcrumb[] = array('url' => '#','name' => get_lang('Add')); |
|
21 | + $interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes')); |
|
22 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add')); |
|
23 | 23 | } elseif ($action == 'edit') { |
24 | - $interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes')); |
|
25 | - $interbreadcrumb[] = array('url' => '#','name' => get_lang('Edit')); |
|
24 | + $interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes')); |
|
25 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit')); |
|
26 | 26 | } else { |
27 | - $interbreadcrumb[] = array('url' => '#','name' => get_lang('Classes')); |
|
27 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Classes')); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // The header. |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | ); |
56 | 56 | |
57 | 57 | //Column config |
58 | -$column_model = array( |
|
59 | - array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'), |
|
60 | - array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'), |
|
61 | - array('name'=>'courses', 'index'=>'courses', 'width'=>'15', 'align'=>'left'), |
|
62 | - array('name'=>'sessions', 'index'=>'sessions', 'width'=>'15', 'align'=>'left'), |
|
63 | - array('name'=>'group_type', 'index'=>'group_type', 'width'=>'15', 'align'=>'center'), |
|
64 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'center', 'sortable'=>'false','formatter'=>'action_formatter'), |
|
58 | +$column_model = array( |
|
59 | + array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'), |
|
60 | + array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'), |
|
61 | + array('name'=>'courses', 'index'=>'courses', 'width'=>'15', 'align'=>'left'), |
|
62 | + array('name'=>'sessions', 'index'=>'sessions', 'width'=>'15', 'align'=>'left'), |
|
63 | + array('name'=>'group_type', 'index'=>'group_type', 'width'=>'15', 'align'=>'center'), |
|
64 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'center', 'sortable'=>'false', 'formatter'=>'action_formatter'), |
|
65 | 65 | ); |
66 | 66 | |
67 | 67 | //Autowidth |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | //With this function we can add actions to the jgrid |
74 | 74 | $action_links = 'function action_formatter (cellvalue, options, rowObject) { |
75 | 75 | return \'' |
76 | - .' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('user_to_class.png', get_lang('SubscribeUsersToClass'), null, ICON_SIZE_MEDIUM) . '</a>' |
|
77 | - .' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('course_to_class.png', get_lang('SubscribeClassToCourses'), null, ICON_SIZE_MEDIUM) . '</a>' |
|
78 | - .' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('sessions_to_class.png', get_lang('SubscribeClassToSessions'), null, ICON_SIZE_MEDIUM) . '</a>' |
|
79 | - .' <a href="?action=edit&id=\'+options.rowId+\'">' . Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_SMALL) . '</a>' |
|
80 | - .' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'">' . Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_SMALL) . '</a>\'; |
|
76 | + .' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('user_to_class.png', get_lang('SubscribeUsersToClass'), null, ICON_SIZE_MEDIUM).'</a>' |
|
77 | + .' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('course_to_class.png', get_lang('SubscribeClassToCourses'), null, ICON_SIZE_MEDIUM).'</a>' |
|
78 | + .' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('sessions_to_class.png', get_lang('SubscribeClassToSessions'), null, ICON_SIZE_MEDIUM).'</a>' |
|
79 | + .' <a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_SMALL).'</a>' |
|
80 | + .' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_SMALL).'</a>\'; |
|
81 | 81 | }'; |
82 | 82 | |
83 | 83 | ?> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } else { |
129 | 129 | echo '<div class="actions">'; |
130 | 130 | echo '<a href="'.api_get_self().'">'. |
131 | - Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
131 | + Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
132 | 132 | echo '</div>'; |
133 | 133 | $token = Security::get_token(); |
134 | 134 | $form->addElement('hidden', 'sec_token'); |
@@ -8,47 +8,47 @@ discard block |
||
8 | 8 | */ |
9 | 9 | exit(); //not yet functional, needs to be revised |
10 | 10 | |
11 | -$cidReset=true; |
|
11 | +$cidReset = true; |
|
12 | 12 | |
13 | 13 | require('../inc/global.inc.php'); |
14 | 14 | $libpath = api_get_path(LIBRARY_PATH); |
15 | 15 | require_once('../auth/ldap/authldap.php'); |
16 | -$annee_base=date('Y'); |
|
16 | +$annee_base = date('Y'); |
|
17 | 17 | // setting the section (for the tabs) |
18 | 18 | $this_section = SECTION_PLATFORM_ADMIN; |
19 | 19 | //api_protect_admin_script(); // on vire la secu... qui n'a pas lieu d'etre ici (script de synchro) |
20 | 20 | |
21 | 21 | // setting breadcrumbs |
22 | -$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); |
|
23 | -$interbreadcrumb[]=array('url' => api_get_self(),"name" => "Liste des sessions"); |
|
22 | +$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
23 | +$interbreadcrumb[] = array('url' => api_get_self(), "name" => "Liste des sessions"); |
|
24 | 24 | |
25 | 25 | // Database Table Definitions |
26 | 26 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
27 | -$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); |
|
28 | -$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
29 | -$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
30 | -$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
|
31 | -$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
32 | -$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
33 | -$tbl_class = Database::get_main_table(TABLE_MAIN_CLASS); |
|
34 | -$tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER); |
|
27 | +$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); |
|
28 | +$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
29 | +$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
30 | +$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
|
31 | +$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
32 | +$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
33 | +$tbl_class = Database::get_main_table(TABLE_MAIN_CLASS); |
|
34 | +$tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER); |
|
35 | 35 | |
36 | -$tbl_session_rel_etape = "session_rel_etape"; |
|
36 | +$tbl_session_rel_etape = "session_rel_etape"; |
|
37 | 37 | |
38 | -$message=""; |
|
38 | +$message = ""; |
|
39 | 39 | |
40 | -$result=Database::query("SELECT id, name FROM $tbl_session"); |
|
41 | -$Sessions=Database::store_result($result); |
|
40 | +$result = Database::query("SELECT id, name FROM $tbl_session"); |
|
41 | +$Sessions = Database::store_result($result); |
|
42 | 42 | |
43 | -$result=Database::query($sql); |
|
44 | -$users=Database::store_result($result); |
|
43 | +$result = Database::query($sql); |
|
44 | +$users = Database::store_result($result); |
|
45 | 45 | |
46 | -foreach($Sessions as $session){ |
|
46 | +foreach ($Sessions as $session) { |
|
47 | 47 | $id_session = $session['id']; |
48 | 48 | $name_session = $session['name']; |
49 | - $UserList=array(); |
|
50 | - $UserUpdate=array(); |
|
51 | - $UserAdd=array(); |
|
49 | + $UserList = array(); |
|
50 | + $UserUpdate = array(); |
|
51 | + $UserAdd = array(); |
|
52 | 52 | |
53 | 53 | // Parse des code etape de la session |
54 | 54 | /* |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | { |
66 | 66 | $r = false; |
67 | 67 | $res = ldap_handle_bind($ds, $r); |
68 | - $UserList=array(); |
|
69 | - if($result !== false) |
|
68 | + $UserList = array(); |
|
69 | + if ($result !== false) |
|
70 | 70 | { |
71 | 71 | //while($row = Database::fetch_array($result)) |
72 | 72 | //{ |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "edupersonorgunitdn=ou=$etape,ou=$annee,ou=diploma,$LDAPbasedn"); |
82 | 82 | $sr = @ ldap_search($ds, $ldap_basedn, '(uid=*)'); |
83 | 83 | $info = ldap_get_entries($ds, $sr); |
84 | - for ($key = 0; $key < $info["count"]; $key ++) |
|
84 | + for ($key = 0; $key < $info["count"]; $key++) |
|
85 | 85 | { |
86 | 86 | echo "<pre>"; |
87 | 87 | print_r($info[$key]); |
@@ -90,28 +90,28 @@ discard block |
||
90 | 90 | $firstname = api_utf8_decode($info[$key]["givenname"][0]); |
91 | 91 | $email = $info[$key]["mail"][0]; |
92 | 92 | // Get uid from dn |
93 | - $dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
93 | + $dn_array = ldap_explode_dn($info[$key]["dn"], 1); |
|
94 | 94 | $username = $dn_array[0]; // uid is first key |
95 | 95 | $outab[] = $info[$key]["edupersonprimaryaffiliation"][0]; // Ici "student" |
96 | 96 | $val = ldap_get_values_len($ds, $sr, "userPassword"); |
97 | 97 | $password = $val[0]; |
98 | 98 | // Pour faciliter la gestion on ajoute le code "etape-annee" |
99 | - $official_code=$etape."-".$annee; |
|
100 | - $auth_source="ldap"; |
|
99 | + $official_code = $etape."-".$annee; |
|
100 | + $auth_source = "ldap"; |
|
101 | 101 | // Pas de date d'expiration d'etudiant (a recuperer par rapport au shadow expire LDAP) |
102 | - $expiration_date=''; |
|
103 | - $active=1; |
|
102 | + $expiration_date = ''; |
|
103 | + $active = 1; |
|
104 | 104 | // Ajout de l'utilisateur |
105 | 105 | if (UserManager::is_username_available($username)) { |
106 | - $user_id = UserManager::create_user($firstname,$lastname,$status,$email,$username,$password,$official_code,api_get_setting('platformLanguage'),$phone,$picture_uri,$auth_source,$expiration_date,$active); |
|
107 | - $UserAdd[]=$user_id; |
|
106 | + $user_id = UserManager::create_user($firstname, $lastname, $status, $email, $username, $password, $official_code, api_get_setting('platformLanguage'), $phone, $picture_uri, $auth_source, $expiration_date, $active); |
|
107 | + $UserAdd[] = $user_id; |
|
108 | 108 | } else { |
109 | 109 | $user = api_get_user_info_from_username($username); |
110 | - $user_id=$user['user_id']; |
|
110 | + $user_id = $user['user_id']; |
|
111 | 111 | UserManager::update_user($user_id, $firstname, $lastname, $username, null, null, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active); |
112 | - $UserUpdate[]=$user_id; |
|
112 | + $UserUpdate[] = $user_id; |
|
113 | 113 | } |
114 | - $UserList[]=$user_id; |
|
114 | + $UserList[] = $user_id; |
|
115 | 115 | } |
116 | 116 | //} |
117 | 117 | } |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | // Une fois les utilisateurs importer dans la base des utilisateurs, on peux les affecter la session |
128 | - $result=Database::query("SELECT c_id FROM $tbl_session_rel_course WHERE session_id='$id_session'"); |
|
129 | - $CourseList=array(); |
|
130 | - while($row=Database::fetch_array($result)) { |
|
131 | - $CourseList[]= $row['c_id']; |
|
128 | + $result = Database::query("SELECT c_id FROM $tbl_session_rel_course WHERE session_id='$id_session'"); |
|
129 | + $CourseList = array(); |
|
130 | + while ($row = Database::fetch_array($result)) { |
|
131 | + $CourseList[] = $row['c_id']; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | foreach ($CourseList as $enreg_course) { |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | VALUES('$id_session','$enreg_course','$enreg_user')"; |
139 | 139 | Database::query($sql); |
140 | 140 | } |
141 | - $sql = "SELECT COUNT(user_id) as nbUsers " . |
|
142 | - "FROM $tbl_session_rel_course_rel_user " . |
|
141 | + $sql = "SELECT COUNT(user_id) as nbUsers ". |
|
142 | + "FROM $tbl_session_rel_course_rel_user ". |
|
143 | 143 | "WHERE session_id='$id_session' AND c_id='$enreg_course'"; |
144 | 144 | $rs = Database::query($sql); |
145 | 145 | list($nbr_users) = Database::fetch_array($rs); |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | Database::query($sql); |
149 | 149 | } |
150 | 150 | // On ajoute la relation entre l'utilisateur et la session |
151 | - foreach($UserList as $enreg_user){ |
|
152 | - $sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at) " . |
|
153 | - "VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')"; |
|
151 | + foreach ($UserList as $enreg_user) { |
|
152 | + $sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at) ". |
|
153 | + "VALUES('$id_session','$enreg_user', '".api_get_utc_datetime()."')"; |
|
154 | 154 | Database::query($sql); |
155 | 155 | } |
156 | - $sql = "SELECT COUNT(user_id) as nbUsers " . |
|
157 | - "FROM $tbl_session_rel_user " . |
|
156 | + $sql = "SELECT COUNT(user_id) as nbUsers ". |
|
157 | + "FROM $tbl_session_rel_user ". |
|
158 | 158 | "WHERE session_id='$id_session' AND relation_type<>".SESSION_RELATION_TYPE_RRHH.""; |
159 | 159 | $rs = Database::query($sql); |
160 | 160 | list($nbr_users) = Database::fetch_array($rs); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | return $this->render( |
44 | 44 | '@ChamiloPage/latest.html.twig', |
45 | - [ 'pages' => $pagesToShow ] |
|
45 | + ['pages' => $pagesToShow] |
|
46 | 46 | ); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | public function get_foruns_id($username, $password, $course_code) |
21 | 21 | { |
22 | - if($this->verifyUserPass($username, $password) == "valid") |
|
22 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
23 | 23 | { |
24 | 24 | $course_db = CourseManager::get_course_information($course_code); |
25 | - $foruns_info = get_forums($id='', $course_db['code']); |
|
25 | + $foruns_info = get_forums($id = '', $course_db['code']); |
|
26 | 26 | $foruns_id = '#'; |
27 | 27 | foreach ($foruns_info as $forum) |
28 | 28 | { |
29 | - if( isset($forum['forum_id'])) |
|
29 | + if (isset($forum['forum_id'])) |
|
30 | 30 | { |
31 | 31 | $foruns_id .= $forum['forum_id']."#"; |
32 | 32 | } |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | |
39 | 39 | public function get_forum_title($username, $password, $course_code, $forum_id) |
40 | 40 | { |
41 | - if($this->verifyUserPass($username, $password) == "valid") |
|
41 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
42 | 42 | { |
43 | 43 | $course_db = CourseManager::get_course_information($course_code); |
44 | 44 | $table_forums = Database :: get_course_table(TABLE_FORUM, $course_db['db_name']); |
45 | 45 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']); |
46 | 46 | |
47 | - $sql="SELECT * FROM ".$table_forums." forums, ".$table_item_property." item_properties |
|
47 | + $sql = "SELECT * FROM ".$table_forums." forums, ".$table_item_property." item_properties |
|
48 | 48 | WHERE item_properties.tool='".TOOL_FORUM."' |
49 | 49 | AND item_properties.ref='".Database::escape_string($forum_id)."' |
50 | 50 | AND forums.forum_id='".Database::escape_string($forum_id)."'"; |
51 | - $result=Database::query($sql); |
|
52 | - $forum_info=Database::fetch_array($result); |
|
51 | + $result = Database::query($sql); |
|
52 | + $forum_info = Database::fetch_array($result); |
|
53 | 53 | $forum_info['approval_direct_post'] = 0; // we can't anymore change this option, so it should always be activated |
54 | 54 | |
55 | 55 | $forum_title = utf8_decode($forum_info['forum_title']); |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | |
61 | 61 | public function get_forum_threads_id($username, $password, $course_code, $forum_id) |
62 | 62 | { |
63 | - if($this->verifyUserPass($username, $password) == "valid") { |
|
63 | + if ($this->verifyUserPass($username, $password) == "valid") { |
|
64 | 64 | $threads_info = get_threads($forum_id, $course_code); |
65 | 65 | $threads_id = '#'; |
66 | 66 | foreach ($threads_info as $thread) |
67 | 67 | { |
68 | - if( isset($thread['thread_id'])) |
|
68 | + if (isset($thread['thread_id'])) |
|
69 | 69 | { |
70 | 70 | $threads_id .= $thread['thread_id']."#"; |
71 | 71 | } |
@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | |
80 | 80 | public function get_forum_thread_data($username, $password, $course_code, $thread_id, $field) |
81 | 81 | { |
82 | - if($this->verifyUserPass($username, $password) == "valid") |
|
82 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
83 | 83 | { |
84 | 84 | $course_db = CourseManager::get_course_information($course_code); |
85 | 85 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']); |
86 | 86 | $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']); |
87 | 87 | |
88 | - $sql="SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
88 | + $sql = "SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
89 | 89 | WHERE item_properties.tool='".TOOL_FORUM_THREAD."' |
90 | 90 | AND item_properties.ref='".Database::escape_string($thread_id)."' |
91 | 91 | AND threads.thread_id='".Database::escape_string($thread_id)."'"; |
92 | - $result=Database::query($sql); |
|
93 | - $thread_info=Database::fetch_array($result); |
|
92 | + $result = Database::query($sql); |
|
93 | + $thread_info = Database::fetch_array($result); |
|
94 | 94 | |
95 | 95 | switch ($field) |
96 | 96 | { |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | |
122 | 122 | public function get_forum_thread_title($username, $password, $course_code, $thread_id) |
123 | 123 | { |
124 | - if($this->verifyUserPass($username, $password) == "valid") |
|
124 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
125 | 125 | { |
126 | 126 | $course_db = CourseManager::get_course_information($course_code); |
127 | 127 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']); |
128 | 128 | $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']); |
129 | 129 | |
130 | - $sql="SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
130 | + $sql = "SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
131 | 131 | WHERE item_properties.tool='".TOOL_FORUM_THREAD."' |
132 | 132 | AND item_properties.ref='".Database::escape_string($thread_id)."' |
133 | 133 | AND threads.thread_id='".Database::escape_string($thread_id)."'"; |
134 | - $result=Database::query($sql); |
|
135 | - $thread_info=Database::fetch_array($result); |
|
134 | + $result = Database::query($sql); |
|
135 | + $thread_info = Database::fetch_array($result); |
|
136 | 136 | |
137 | 137 | $htmlcode = true; |
138 | 138 | $field_table = "thread_title"; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | public function get_posts_id($username, $password, $course_code, $thread_id) |
148 | 148 | { |
149 | - if($this->verifyUserPass($username, $password) == "valid") |
|
149 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
150 | 150 | { |
151 | 151 | $course_db = CourseManager::get_course_information($course_code); |
152 | 152 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']); |
155 | 155 | |
156 | 156 | // note: change these SQL so that only the relevant fields of the user table are used |
157 | - if (api_is_allowed_to_edit(null,true)) { |
|
157 | + if (api_is_allowed_to_edit(null, true)) { |
|
158 | 158 | $sql = "SELECT * FROM $table_posts posts |
159 | 159 | LEFT JOIN $table_users users |
160 | 160 | ON posts.poster_id=users.user_id |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | AND posts.visible='1' |
170 | 170 | ORDER BY posts.post_id ASC"; |
171 | 171 | } |
172 | - $result=Database::query($sql); |
|
173 | - while ($row=Database::fetch_array($result)) { |
|
174 | - $posts_info[]=$row; |
|
172 | + $result = Database::query($sql); |
|
173 | + while ($row = Database::fetch_array($result)) { |
|
174 | + $posts_info[] = $row; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $posts_id = '#'; |
178 | 178 | |
179 | 179 | foreach ($posts_info as $post) |
180 | 180 | { |
181 | - if( isset($post['post_id'])) |
|
181 | + if (isset($post['post_id'])) |
|
182 | 182 | { |
183 | 183 | $posts_id .= $post['post_id']."#"; |
184 | 184 | } |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | |
191 | 191 | public function get_post_data($username, $password, $course_code, $post_id, $field) |
192 | 192 | { |
193 | - if($this->verifyUserPass($username, $password) == "valid") |
|
193 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
194 | 194 | { |
195 | 195 | $course_db = CourseManager::get_course_information($course_code); |
196 | 196 | |
197 | 197 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']); |
198 | 198 | $table_users = Database :: get_main_table(TABLE_MAIN_USER); |
199 | 199 | |
200 | - $sql="SELECT * FROM ".$table_posts."posts, ".$table_users." users WHERE posts.poster_id=users.user_id AND posts.post_id='".Database::escape_string($post_id)."'"; |
|
201 | - $result=Database::query($sql); |
|
202 | - $post_info =Database::fetch_array($result); |
|
200 | + $sql = "SELECT * FROM ".$table_posts."posts, ".$table_users." users WHERE posts.poster_id=users.user_id AND posts.post_id='".Database::escape_string($post_id)."'"; |
|
201 | + $result = Database::query($sql); |
|
202 | + $post_info = Database::fetch_array($result); |
|
203 | 203 | |
204 | 204 | $htmlcode = false; |
205 | 205 | switch ($field) |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | public function send_post($username, $password, $course_code, $forum_id, $thread_id, $title, $content) |
234 | 234 | { |
235 | - if($this->verifyUserPass($username, $password) == "valid") |
|
235 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
236 | 236 | { |
237 | 237 | $em = Database::getManager(); |
238 | 238 | $course_db = CourseManager::get_course_information($course_code); |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']); |
242 | 242 | $forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT, $course_db['db_name']); |
243 | 243 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']); |
244 | - $post_date=date('Y-m-d H:i:s'); |
|
245 | - $visible=1; |
|
246 | - $has_attachment=false; |
|
244 | + $post_date = date('Y-m-d H:i:s'); |
|
245 | + $visible = 1; |
|
246 | + $has_attachment = false; |
|
247 | 247 | $my_post = ''; |
248 | 248 | $post_notification = ''; |
249 | 249 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $indent = $post['indent_cnt']; |
57 | 57 | |
58 | 58 | $html = ''; |
59 | - $html .= '<div class="col-md-offset-' . $indent . '" >'; |
|
59 | + $html .= '<div class="col-md-offset-'.$indent.'" >'; |
|
60 | 60 | $html .= '<div class="panel panel-default forum-post">'; |
61 | 61 | $html .= '<div class="panel-body">'; |
62 | 62 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | if ($origin != 'learnpath') { |
75 | 75 | if (api_get_course_setting('allow_user_image_forum')) { |
76 | - $html .= '<div class="thumbnail">' . display_user_image($post['user_id'], $name, $origin) . '</div>'; |
|
76 | + $html .= '<div class="thumbnail">'.display_user_image($post['user_id'], $name, $origin).'</div>'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $html .= Display::tag( |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ); |
84 | 84 | } else { |
85 | 85 | if (api_get_course_setting('allow_user_image_forum')) { |
86 | - $html .= '<div class="thumbnail">' . display_user_image($post['user_id'], $name, $origin) . '</div>'; |
|
86 | + $html .= '<div class="thumbnail">'.display_user_image($post['user_id'], $name, $origin).'</div>'; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $html .= Display::tag( |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) |
125 | 125 | ) { |
126 | 126 | if ($locked == false) { |
127 | - $iconEdit .= "<a href=\"editpost.php?" . api_get_cidreq() |
|
127 | + $iconEdit .= "<a href=\"editpost.php?".api_get_cidreq() |
|
128 | 128 | . "&forum=$clean_forum_id&thread=$clean_thread_id&post={$post['post_id']}&id_attach=$id_attach" |
129 | 129 | . "\">" |
130 | 130 | . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | !(api_is_course_coach() && $current_forum['session_id'] != $sessionId) |
139 | 139 | ) { |
140 | 140 | if ($locked == false) { |
141 | - $deleteUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
141 | + $deleteUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
142 | 142 | 'forum' => $clean_forum_id, |
143 | 143 | 'thread' => $clean_thread_id, |
144 | 144 | 'action' => 'delete', |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | if ($count > 0) { |
179 | - $iconEdit .= "<a href=\"viewthread.php?" . api_get_cidreq() |
|
179 | + $iconEdit .= "<a href=\"viewthread.php?".api_get_cidreq() |
|
180 | 180 | . "&forum=$clean_forum_id&thread=$clean_thread_id&action=move&origin=$origin&post={$post['post_id']}" |
181 | - . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>"; |
|
181 | + . "\">".Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL)."</a>"; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | '1', $post['user_id'], $_GET['thread'] |
198 | 198 | ); |
199 | 199 | if ($locked == false) { |
200 | - $iconEdit .= "<a href=\"forumqualify.php?" . api_get_cidreq() |
|
200 | + $iconEdit .= "<a href=\"forumqualify.php?".api_get_cidreq() |
|
201 | 201 | . "&forum=$clean_forum_id&thread=$clean_thread_id&action=list&post={$post['post_id']}" |
202 | 202 | . "&user={$post['user_id']}&user_id={$post['user_id']}&origin=$origin" |
203 | 203 | . "&idtextqualify=$current_qualify_thread" |
204 | - . "\" >" . Display::return_icon('quiz.gif', get_lang('Qualify')) . "</a>"; |
|
204 | + . "\" >".Display::return_icon('quiz.gif', get_lang('Qualify'))."</a>"; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $statusIcon = getPostStatus($current_forum, $post); |
210 | 210 | |
211 | 211 | if ($iconEdit != '') { |
212 | - $html .= '<div class="tools-icons">' . $iconEdit . ' '.$statusIcon.'</div>'; |
|
212 | + $html .= '<div class="tools-icons">'.$iconEdit.' '.$statusIcon.'</div>'; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | if (($current_forum_category && $current_forum_category['locked'] == 0) && |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { |
220 | 220 | $buttonReply = Display::toolbarButton( |
221 | 221 | get_lang('ReplyToMessage'), |
222 | - 'reply.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
222 | + 'reply.php?'.api_get_cidreq().'&'.http_build_query([ |
|
223 | 223 | 'forum' => $clean_forum_id, |
224 | 224 | 'thread' => $clean_thread_id, |
225 | 225 | 'post' => $post['post_id'], |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $buttonQuote = Display::toolbarButton( |
234 | 234 | get_lang('QuoteMessage'), |
235 | - 'reply.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
235 | + 'reply.php?'.api_get_cidreq().'&'.http_build_query([ |
|
236 | 236 | 'forum' => $clean_forum_id, |
237 | 237 | 'thread' => $clean_thread_id, |
238 | 238 | 'post' => $post['post_id'], |
@@ -248,21 +248,21 @@ discard block |
||
248 | 248 | if ($current_forum_category && $current_forum_category['locked'] == 1) { |
249 | 249 | $closedPost = Display::tag( |
250 | 250 | 'div', |
251 | - '<em class="fa fa-exclamation-triangle"></em> ' . get_lang('ForumcategoryLocked'), |
|
251 | + '<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumcategoryLocked'), |
|
252 | 252 | array('class' => 'alert alert-warning post-closed') |
253 | 253 | ); |
254 | 254 | } |
255 | 255 | if ($current_forum['locked'] == 1) { |
256 | 256 | $closedPost = Display::tag( |
257 | 257 | 'div', |
258 | - '<em class="fa fa-exclamation-triangle"></em> ' . get_lang('ForumLocked'), |
|
258 | + '<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumLocked'), |
|
259 | 259 | array('class' => 'alert alert-warning post-closed') |
260 | 260 | ); |
261 | 261 | } |
262 | 262 | if ($current_thread['locked'] == 1) { |
263 | 263 | $closedPost = Display::tag( |
264 | 264 | 'div', |
265 | - '<em class="fa fa-exclamation-triangle"></em> ' . get_lang('ThreadLocked'), |
|
265 | + '<em class="fa fa-exclamation-triangle"></em> '.get_lang('ThreadLocked'), |
|
266 | 266 | array('class' => 'alert alert-warning post-closed') |
267 | 267 | ); |
268 | 268 | } |
@@ -314,24 +314,24 @@ discard block |
||
314 | 314 | $html .= Display::return_icon('attachment.gif', get_lang('Attachment')); |
315 | 315 | $html .= '<a href="download.php?file='; |
316 | 316 | $html .= $realname; |
317 | - $html .= ' "> ' . $user_filename . ' </a>'; |
|
318 | - $html .= '<span class="forum_attach_comment" >' . $attachment['comment'] . '</span>'; |
|
317 | + $html .= ' "> '.$user_filename.' </a>'; |
|
318 | + $html .= '<span class="forum_attach_comment" >'.$attachment['comment'].'</span>'; |
|
319 | 319 | if (($current_forum['allow_edit'] == 1 && $post['user_id'] == $userId) || |
320 | 320 | (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) |
321 | 321 | ) { |
322 | - $html .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&origin=' |
|
323 | - . Security::remove_XSS($_GET['origin']) . '&action=delete_attach&id_attach=' |
|
324 | - . $attachment['iid'] . '&forum=' . $clean_forum_id . '&thread=' . $clean_thread_id |
|
322 | + $html .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&origin=' |
|
323 | + . Security::remove_XSS($_GET['origin']).'&action=delete_attach&id_attach=' |
|
324 | + . $attachment['iid'].'&forum='.$clean_forum_id.'&thread='.$clean_thread_id |
|
325 | 325 | . '" onclick="javascript:if(!confirm(\'' |
326 | - . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . '\')) return false;">' |
|
327 | - . Display::return_icon('delete.gif', get_lang('Delete')) . '</a><br />'; |
|
326 | + . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">' |
|
327 | + . Display::return_icon('delete.gif', get_lang('Delete')).'</a><br />'; |
|
328 | 328 | } |
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | 332 | $html .= '</div>'; |
333 | 333 | $html .= '<div class="col-md-6 text-right">'; |
334 | - $html .= $buttonReply . ' ' . $buttonQuote; |
|
334 | + $html .= $buttonReply.' '.$buttonQuote; |
|
335 | 335 | $html .= '</div>'; |
336 | 336 | $html .= '</div>'; |
337 | 337 | // The post has been displayed => it can be removed from the what's new array |