@@ -471,7 +471,7 @@ |
||
471 | 471 | * Display a user icon that links to the user page |
472 | 472 | * |
473 | 473 | * @param integer $user_id the id of the user |
474 | - * @return html code |
|
474 | + * @return string code |
|
475 | 475 | * |
476 | 476 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
477 | 477 | * @version April 2008 |
@@ -1,8 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | -use ChamiloSession as Session; |
|
5 | - |
|
6 | 4 | /** |
7 | 5 | * Class ExerciseLib |
8 | 6 | * shows a question and its answers |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | require_once '../inc/global.inc.php'; |
13 | -$current_course_tool = TOOL_GROUP; |
|
13 | +$current_course_tool = TOOL_GROUP; |
|
14 | 14 | |
15 | 15 | // Notice for unauthorized people. |
16 | 16 | api_protect_course_script(true); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | echo '<div class="actions">'; |
71 | 71 | echo '<a href="group.php">'. |
72 | - Display::return_icon('back.png',get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM). |
|
72 | + Display::return_icon('back.png', get_lang('BackToGroupList'), '', ICON_SIZE_MEDIUM). |
|
73 | 73 | '</a>'; |
74 | 74 | |
75 | 75 | /* |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | $unsubscribe_group = ''; |
88 | 88 | if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) { |
89 | - $unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."'".')) return false;">'. |
|
89 | + $unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'. |
|
90 | 90 | get_lang("StudentUnsubscribe").'</a>'; |
91 | 91 | } |
92 | 92 | echo ' </div>'; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id()) |
99 | 99 | ) { |
100 | 100 | $my_origin = isset($origin) ? $origin : ''; |
101 | - $edit_url = '<a href="'.api_get_path(WEB_CODE_PATH).'group/settings.php?'.api_get_cidreq().'&origin='.$my_origin.'">'. |
|
102 | - Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>'; |
|
101 | + $edit_url = '<a href="'.api_get_path(WEB_CODE_PATH).'group/settings.php?'.api_get_cidreq().'&origin='.$my_origin.'">'. |
|
102 | + Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a>'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | echo Display::page_header( |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $forums_of_groups = get_forums_of_group($current_group['id']); |
217 | 217 | |
218 | 218 | if (is_array($forums_of_groups)) { |
219 | - if ( $current_group['forum_state'] == GroupManager::TOOL_PUBLIC) { |
|
219 | + if ($current_group['forum_state'] == GroupManager::TOOL_PUBLIC) { |
|
220 | 220 | foreach ($forums_of_groups as $key => $value) { |
221 | 221 | if ($value['forum_group_public_private'] == 'public') { |
222 | 222 | $actions_array[] = array( |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | if (count($tutors) == 0) { |
299 | 299 | $tutor_info = get_lang('GroupNoneMasc'); |
300 | 300 | } else { |
301 | - isset($origin) ? $my_origin = $origin:$my_origin=''; |
|
301 | + isset($origin) ? $my_origin = $origin : $my_origin = ''; |
|
302 | 302 | $tutor_info .= '<ul class="thumbnails">'; |
303 | 303 | foreach ($tutors as $index => $tutor) { |
304 | 304 | $userInfo = api_get_user_info($tutor['user_id']); |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | global $current_group; |
405 | 405 | |
406 | 406 | // Database table definition |
407 | - $table_group_user = Database :: get_course_table(TABLE_GROUP_USER); |
|
408 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
407 | + $table_group_user = Database :: get_course_table(TABLE_GROUP_USER); |
|
408 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
409 | 409 | |
410 | 410 | $course_id = api_get_course_int_id(); |
411 | 411 |
@@ -189,6 +189,8 @@ |
||
189 | 189 | * @param float Timeout |
190 | 190 | * @param bool Include HTTP Request headers? |
191 | 191 | * @param bool Include HTTP Response headers? |
192 | + * @param string $ip |
|
193 | + * @return string |
|
192 | 194 | */ |
193 | 195 | function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 5, $req_hdr = false, $res_hdr = false) |
194 | 196 | { |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $urlInfo['url'])); |
51 | 51 | $cleanUrl = str_replace('/', '-', $url); |
52 | 52 | |
53 | - $newUrlDir = api_get_path(SYS_APP_PATH) . "home/$cleanUrl/admin/"; |
|
53 | + $newUrlDir = api_get_path(SYS_APP_PATH)."home/$cleanUrl/admin/"; |
|
54 | 54 | } else { |
55 | - $newUrlDir = api_get_path(SYS_APP_PATH) . "home/admin/"; |
|
55 | + $newUrlDir = api_get_path(SYS_APP_PATH)."home/admin/"; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | if (!file_exists($newUrlDir)) { |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | if ($system_version != $version_info) { |
169 | - $output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>'; |
|
169 | + $output = '<br /><span style="color:red">'.get_lang('YourVersionNotUpToDate').'. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version.'</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>'; |
|
170 | 170 | } else { |
171 | 171 | $output = '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Chamilo '.$version_info.'</span>'; |
172 | 172 | } |
173 | 173 | } else { |
174 | - $output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>'; |
|
174 | + $output = '<span style="color:red">'.get_lang('ImpossibleToContactVersionServerPleaseTryAgain').'</span>'; |
|
175 | 175 | } |
176 | 176 | } else { |
177 | - $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>'; |
|
177 | + $output = '<span style="color:red">'.get_lang('AllowurlfopenIsSetToOff').'</span>'; |
|
178 | 178 | } |
179 | 179 | return $output; |
180 | 180 | } |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | $getdata_str = count($getdata) ? '?' : ''; |
198 | 198 | |
199 | 199 | foreach ($getdata as $k => $v) { |
200 | - $getdata_str .= urlencode($k) .'='. urlencode($v) . '&'; |
|
200 | + $getdata_str .= urlencode($k).'='.urlencode($v).'&'; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | $crlf = "\r\n"; |
204 | - $req = $verb .' '. $uri . $getdata_str .' HTTP/1.1' . $crlf; |
|
205 | - $req .= 'Host: '. $ip . $crlf; |
|
206 | - $req .= 'User-Agent: Mozilla/5.0 Firefox/3.6.12' . $crlf; |
|
207 | - $req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' . $crlf; |
|
208 | - $req .= 'Accept-Language: en-us,en;q=0.5' . $crlf; |
|
209 | - $req .= 'Accept-Encoding: deflate' . $crlf; |
|
210 | - $req .= 'Accept-Charset: utf-8;q=0.7,*;q=0.7' . $crlf; |
|
204 | + $req = $verb.' '.$uri.$getdata_str.' HTTP/1.1'.$crlf; |
|
205 | + $req .= 'Host: '.$ip.$crlf; |
|
206 | + $req .= 'User-Agent: Mozilla/5.0 Firefox/3.6.12'.$crlf; |
|
207 | + $req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'.$crlf; |
|
208 | + $req .= 'Accept-Language: en-us,en;q=0.5'.$crlf; |
|
209 | + $req .= 'Accept-Encoding: deflate'.$crlf; |
|
210 | + $req .= 'Accept-Charset: utf-8;q=0.7,*;q=0.7'.$crlf; |
|
211 | 211 | |
212 | 212 | $req .= $crlf; |
213 | 213 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * a given string |
23 | 23 | * @param string String to search for |
24 | 24 | * @param int Deprecated param |
25 | - * @return string A formatted, xajax answer block |
|
25 | + * @return xajaxResponse A formatted, xajax answer block |
|
26 | 26 | * @assert () === false |
27 | 27 | */ |
28 | 28 | function search_courses($needle, $id) |
@@ -44,17 +44,17 @@ |
||
44 | 44 | ORDER BY name, id |
45 | 45 | LIMIT 11'; |
46 | 46 | $rs = Database::query($sql); |
47 | - $i=0; |
|
47 | + $i = 0; |
|
48 | 48 | while ($session = Database :: fetch_array($rs)) { |
49 | 49 | $i++; |
50 | - if ($i<=10) { |
|
50 | + if ($i <= 10) { |
|
51 | 51 | $return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />'; |
52 | 52 | } else { |
53 | 53 | $return .= '...<br />'; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | - $xajax_response -> addAssign('ajax_list_courses','innerHTML',api_utf8_encode($return)); |
|
57 | + $xajax_response -> addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return)); |
|
58 | 58 | return $xajax_response; |
59 | 59 | } |
60 | 60 | } |
@@ -38,17 +38,17 @@ |
||
38 | 38 | $needle = Database::escape_string($needle); |
39 | 39 | // search courses where username or firstname or lastname begins likes $needle |
40 | 40 | $sql = 'SELECT code, title FROM '.$tbl_course.' u '. |
41 | - ' WHERE (title LIKE "'.$needle.'%" '. |
|
42 | - ' OR code LIKE "'.$needle.'%" '. |
|
43 | - ' ) '. |
|
44 | - ' ORDER BY title, code '. |
|
45 | - ' LIMIT 11'; |
|
41 | + ' WHERE (title LIKE "'.$needle.'%" '. |
|
42 | + ' OR code LIKE "'.$needle.'%" '. |
|
43 | + ' ) '. |
|
44 | + ' ORDER BY title, code '. |
|
45 | + ' LIMIT 11'; |
|
46 | 46 | $rs = Database::query($sql); |
47 | 47 | $i=0; |
48 | 48 | while ($course = Database :: fetch_array($rs)) { |
49 | 49 | $i++; |
50 | 50 | if ($i<=10) { |
51 | - $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />'; |
|
51 | + $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />'; |
|
52 | 52 | } else { |
53 | 53 | $return .= '...<br />'; |
54 | 54 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * search string |
24 | 24 | * @param string Search string |
25 | 25 | * @param int Deprecated param |
26 | - * @return string Xajax response block |
|
26 | + * @return xajaxResponse Xajax response block |
|
27 | 27 | * @assert () === false |
28 | 28 | */ |
29 | 29 | function search_users($needle, $id) |
@@ -43,22 +43,22 @@ |
||
43 | 43 | ' WHERE (username LIKE "'.$needle.'%" '. |
44 | 44 | ' OR firstname LIKE "'.$needle.'%" '. |
45 | 45 | ' OR lastname LIKE "'.$needle.'%") '. |
46 | - $order_clause . |
|
46 | + $order_clause. |
|
47 | 47 | ' LIMIT 11'; |
48 | 48 | |
49 | 49 | $rs = Database::query($sql); |
50 | - $i=0; |
|
50 | + $i = 0; |
|
51 | 51 | |
52 | 52 | while ($user = Database :: fetch_array($rs)) { |
53 | 53 | $i++; |
54 | - if ($i<=10) { |
|
54 | + if ($i <= 10) { |
|
55 | 55 | $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($user['user_id']).'\',\''.api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])).' ('.addslashes($user['username']).')'.'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />'; |
56 | 56 | } else { |
57 | 57 | $return .= '...<br />'; |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | - $xajax_response -> addAssign('ajax_list_users','innerHTML',api_utf8_encode($return)); |
|
61 | + $xajax_response -> addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return)); |
|
62 | 62 | return $xajax_response; |
63 | 63 | } |
64 | 64 | } |
@@ -40,11 +40,11 @@ |
||
40 | 40 | // search users where username or firstname or lastname begins likes $needle |
41 | 41 | $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
42 | 42 | $sql = 'SELECT u.user_id, username, lastname, firstname FROM '.$tbl_user.' u '. |
43 | - ' WHERE (username LIKE "'.$needle.'%" '. |
|
44 | - ' OR firstname LIKE "'.$needle.'%" '. |
|
45 | - ' OR lastname LIKE "'.$needle.'%") '. |
|
43 | + ' WHERE (username LIKE "'.$needle.'%" '. |
|
44 | + ' OR firstname LIKE "'.$needle.'%" '. |
|
45 | + ' OR lastname LIKE "'.$needle.'%") '. |
|
46 | 46 | $order_clause . |
47 | - ' LIMIT 11'; |
|
47 | + ' LIMIT 11'; |
|
48 | 48 | |
49 | 49 | $rs = Database::query($sql); |
50 | 50 | $i=0; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | /** |
191 | 191 | * Gets an array with all the course tables (deprecated?) |
192 | - * @return array |
|
192 | + * @return string[] |
|
193 | 193 | * @assert (null) !== null |
194 | 194 | */ |
195 | 195 | public static function get_course_tables() |
@@ -310,6 +310,8 @@ discard block |
||
310 | 310 | * @param string Complete path to directory we want to list |
311 | 311 | * @param array A list of files to which we want to add the files found |
312 | 312 | * @param string Type of base directory from which we want to recover the files |
313 | + * @param string $path |
|
314 | + * @param string $media |
|
313 | 315 | * @return array |
314 | 316 | * @assert (null,null,null) === false |
315 | 317 | * @assert ('abc',array(),'') === array() |
@@ -371,6 +373,7 @@ discard block |
||
371 | 373 | * Sorts pictures by type (used?) |
372 | 374 | * @param array List of files (sthg like array(0=>array('png'=>1))) |
373 | 375 | * @param string File type |
376 | + * @param string $type |
|
374 | 377 | * @return array The received array without files not matching type |
375 | 378 | * @assert (array(),null) === array() |
376 | 379 | */ |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | while (!$keys_are_unique) { |
47 | 47 | |
48 | - $keys_course_id = $prefix_for_all . $unique_prefix . $wanted_code . $final_suffix['CourseId']; |
|
48 | + $keys_course_id = $prefix_for_all.$unique_prefix.$wanted_code.$final_suffix['CourseId']; |
|
49 | 49 | //$keys_course_db_name = $prefix_for_base_name . $unique_prefix . strtoupper($keys_course_id) . $final_suffix['CourseDb']; |
50 | - $keys_course_repository = $prefix_for_path . $unique_prefix . $wanted_code . $final_suffix['CourseDir']; |
|
50 | + $keys_course_repository = $prefix_for_path.$unique_prefix.$wanted_code.$final_suffix['CourseDir']; |
|
51 | 51 | $keys_are_unique = true; |
52 | 52 | |
53 | 53 | // Check whether they are unique. |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | |
57 | 57 | if (Database::num_rows($result)) { |
58 | 58 | $keys_are_unique = false; |
59 | - $try_new_fsc_id ++; |
|
59 | + $try_new_fsc_id++; |
|
60 | 60 | $final_suffix['CourseId'] = substr(md5(uniqid(rand())), 0, 4); |
61 | 61 | } |
62 | 62 | if (file_exists(api_get_path(SYS_COURSE_PATH).$keys_course_repository)) { |
63 | 63 | $keys_are_unique = false; |
64 | - $try_new_fsc_dir ++; |
|
64 | + $try_new_fsc_dir++; |
|
65 | 65 | $final_suffix['CourseDir'] = substr(md5(uniqid(rand())), 0, 4); |
66 | 66 | } |
67 | 67 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | $perm = api_get_permissions_for_new_directories(); |
90 | 90 | $perm_file = api_get_permissions_for_new_files(); |
91 | 91 | $htmlpage = "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>Not authorized</title>\n </head>\n <body>\n </body>\n</html>"; |
92 | - $cp = api_get_path(SYS_COURSE_PATH) . $course_repository; |
|
92 | + $cp = api_get_path(SYS_COURSE_PATH).$course_repository; |
|
93 | 93 | |
94 | 94 | //Creating document folder |
95 | 95 | mkdir($cp, $perm); |
96 | - mkdir($cp . '/document', $perm); |
|
97 | - $cpt = $cp . '/document/index.html'; |
|
96 | + mkdir($cp.'/document', $perm); |
|
97 | + $cpt = $cp.'/document/index.html'; |
|
98 | 98 | $fd = fopen($cpt, 'w'); |
99 | 99 | fwrite($fd, $htmlpage); |
100 | 100 | fclose($fd); |
@@ -116,49 +116,49 @@ discard block |
||
116 | 116 | @copy($cpt, $cp . '/document/video/index.html'); */ |
117 | 117 | |
118 | 118 | //Creatind dropbox folder |
119 | - mkdir($cp . '/dropbox', $perm); |
|
120 | - $cpt = $cp . '/dropbox/index.html'; |
|
119 | + mkdir($cp.'/dropbox', $perm); |
|
120 | + $cpt = $cp.'/dropbox/index.html'; |
|
121 | 121 | $fd = fopen($cpt, 'w'); |
122 | 122 | fwrite($fd, $htmlpage); |
123 | 123 | fclose($fd); |
124 | 124 | @chmod($cpt, $perm_file); |
125 | - mkdir($cp . '/group', $perm); |
|
126 | - @copy($cpt, $cp . '/group/index.html'); |
|
127 | - mkdir($cp . '/page', $perm); |
|
128 | - @copy($cpt, $cp . '/page/index.html'); |
|
129 | - mkdir($cp . '/scorm', $perm); |
|
130 | - @copy($cpt, $cp . '/scorm/index.html'); |
|
131 | - mkdir($cp . '/upload', $perm); |
|
132 | - @copy($cpt, $cp . '/upload/index.html'); |
|
133 | - mkdir($cp . '/upload/forum', $perm); |
|
134 | - @copy($cpt, $cp . '/upload/forum/index.html'); |
|
135 | - mkdir($cp . '/upload/forum/images', $perm); |
|
136 | - @copy($cpt, $cp . '/upload/forum/images/index.html'); |
|
137 | - mkdir($cp . '/upload/test', $perm); |
|
138 | - @copy($cpt, $cp . '/upload/test/index.html'); |
|
139 | - mkdir($cp . '/upload/blog', $perm); |
|
140 | - @copy($cpt, $cp . '/upload/blog/index.html'); |
|
141 | - mkdir($cp . '/upload/learning_path', $perm); |
|
142 | - @copy($cpt, $cp . '/upload/learning_path/index.html'); |
|
143 | - mkdir($cp . '/upload/learning_path/images', $perm); |
|
144 | - @copy($cpt, $cp . '/upload/learning_path/images/index.html'); |
|
145 | - mkdir($cp . '/upload/calendar', $perm); |
|
146 | - @copy($cpt, $cp . '/upload/calendar/index.html'); |
|
147 | - mkdir($cp . '/upload/calendar/images', $perm); |
|
148 | - @copy($cpt, $cp . '/upload/calendar/images/index.html'); |
|
149 | - mkdir($cp . '/work', $perm); |
|
150 | - @copy($cpt, $cp . '/work/index.html'); |
|
151 | - mkdir($cp . '/upload/announcements', $perm); |
|
152 | - @copy($cpt, $cp . '/upload/announcements/index.html'); |
|
153 | - mkdir($cp . '/upload/announcements/images', $perm); |
|
154 | - @copy($cpt, $cp . '/upload/announcements/images/index.html'); |
|
125 | + mkdir($cp.'/group', $perm); |
|
126 | + @copy($cpt, $cp.'/group/index.html'); |
|
127 | + mkdir($cp.'/page', $perm); |
|
128 | + @copy($cpt, $cp.'/page/index.html'); |
|
129 | + mkdir($cp.'/scorm', $perm); |
|
130 | + @copy($cpt, $cp.'/scorm/index.html'); |
|
131 | + mkdir($cp.'/upload', $perm); |
|
132 | + @copy($cpt, $cp.'/upload/index.html'); |
|
133 | + mkdir($cp.'/upload/forum', $perm); |
|
134 | + @copy($cpt, $cp.'/upload/forum/index.html'); |
|
135 | + mkdir($cp.'/upload/forum/images', $perm); |
|
136 | + @copy($cpt, $cp.'/upload/forum/images/index.html'); |
|
137 | + mkdir($cp.'/upload/test', $perm); |
|
138 | + @copy($cpt, $cp.'/upload/test/index.html'); |
|
139 | + mkdir($cp.'/upload/blog', $perm); |
|
140 | + @copy($cpt, $cp.'/upload/blog/index.html'); |
|
141 | + mkdir($cp.'/upload/learning_path', $perm); |
|
142 | + @copy($cpt, $cp.'/upload/learning_path/index.html'); |
|
143 | + mkdir($cp.'/upload/learning_path/images', $perm); |
|
144 | + @copy($cpt, $cp.'/upload/learning_path/images/index.html'); |
|
145 | + mkdir($cp.'/upload/calendar', $perm); |
|
146 | + @copy($cpt, $cp.'/upload/calendar/index.html'); |
|
147 | + mkdir($cp.'/upload/calendar/images', $perm); |
|
148 | + @copy($cpt, $cp.'/upload/calendar/images/index.html'); |
|
149 | + mkdir($cp.'/work', $perm); |
|
150 | + @copy($cpt, $cp.'/work/index.html'); |
|
151 | + mkdir($cp.'/upload/announcements', $perm); |
|
152 | + @copy($cpt, $cp.'/upload/announcements/index.html'); |
|
153 | + mkdir($cp.'/upload/announcements/images', $perm); |
|
154 | + @copy($cpt, $cp.'/upload/announcements/images/index.html'); |
|
155 | 155 | |
156 | 156 | //Oral expression question type |
157 | - mkdir($cp . '/exercises', $perm); |
|
158 | - @copy($cpt, $cp . '/exercises/index.html'); |
|
157 | + mkdir($cp.'/exercises', $perm); |
|
158 | + @copy($cpt, $cp.'/exercises/index.html'); |
|
159 | 159 | |
160 | 160 | // Create .htaccess in the dropbox directory. |
161 | - $fp = fopen($cp . '/dropbox/.htaccess', 'w'); |
|
161 | + $fp = fopen($cp.'/dropbox/.htaccess', 'w'); |
|
162 | 162 | fwrite( |
163 | 163 | $fp, |
164 | 164 | "AuthName AllowLocalAccess |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | { |
302 | 302 | $list = self::get_course_tables(); |
303 | 303 | foreach ($list as $table) { |
304 | - $sql = "DROP TABLE IF EXISTS " . DB_COURSE_PREFIX . $table; |
|
304 | + $sql = "DROP TABLE IF EXISTS ".DB_COURSE_PREFIX.$table; |
|
305 | 305 | Database::query($sql); |
306 | 306 | } |
307 | 307 | } |
@@ -323,47 +323,47 @@ discard block |
||
323 | 323 | if ($media == 'images') { |
324 | 324 | $code_path = api_get_path( |
325 | 325 | SYS_CODE_PATH |
326 | - ) . 'default_course_document/images/'; |
|
326 | + ).'default_course_document/images/'; |
|
327 | 327 | } |
328 | 328 | if ($media == 'audio') { |
329 | 329 | $code_path = api_get_path( |
330 | 330 | SYS_CODE_PATH |
331 | - ) . 'default_course_document/audio/'; |
|
331 | + ).'default_course_document/audio/'; |
|
332 | 332 | } |
333 | 333 | if ($media == 'flash') { |
334 | 334 | $code_path = api_get_path( |
335 | 335 | SYS_CODE_PATH |
336 | - ) . 'default_course_document/flash/'; |
|
336 | + ).'default_course_document/flash/'; |
|
337 | 337 | } |
338 | 338 | if ($media == 'video') { |
339 | 339 | $code_path = api_get_path( |
340 | 340 | SYS_CODE_PATH |
341 | - ) . 'default_course_document/video/'; |
|
341 | + ).'default_course_document/video/'; |
|
342 | 342 | } |
343 | 343 | if ($media == 'certificates') { |
344 | 344 | $code_path = api_get_path( |
345 | 345 | SYS_CODE_PATH |
346 | - ) . 'default_course_document/certificates/'; |
|
346 | + ).'default_course_document/certificates/'; |
|
347 | 347 | } |
348 | 348 | if (is_dir($path)) { |
349 | 349 | $handle = opendir($path); |
350 | 350 | while (false !== ($file = readdir($handle))) { |
351 | - if (is_dir($path . $file) && strpos($file, '.') !== 0) { |
|
351 | + if (is_dir($path.$file) && strpos($file, '.') !== 0) { |
|
352 | 352 | $files[]['dir'] = str_replace( |
353 | 353 | $code_path, |
354 | 354 | '', |
355 | - $path . $file . '/' |
|
355 | + $path.$file.'/' |
|
356 | 356 | ); |
357 | 357 | $files = self::browse_folders( |
358 | - $path . $file . '/', |
|
358 | + $path.$file.'/', |
|
359 | 359 | $files, |
360 | 360 | $media |
361 | 361 | ); |
362 | - } elseif (is_file($path . $file) && strpos($file, '.') !== 0) { |
|
362 | + } elseif (is_file($path.$file) && strpos($file, '.') !== 0) { |
|
363 | 363 | $files[]['file'] = str_replace( |
364 | 364 | $code_path, |
365 | 365 | '', |
366 | - $path . $file |
|
366 | + $path.$file |
|
367 | 367 | ); |
368 | 368 | } |
369 | 369 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | |
552 | 552 | Database::query( |
553 | 553 | "INSERT INTO $TABLEGROUPCATEGORIES (c_id, id, title , description, max_student, self_reg_allowed, self_unreg_allowed, groups_per_user, display_order) |
554 | - VALUES ($course_id, '2', '" . self::lang2db(get_lang('DefaultGroupCategory')) . "', '', '8', '0', '0', '0', '0');" |
|
554 | + VALUES ($course_id, '2', '".self::lang2db(get_lang('DefaultGroupCategory'))."', '', '8', '0', '0', '0', '0');" |
|
555 | 555 | ); |
556 | 556 | |
557 | 557 | /* Example Material */ |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $perm = api_get_permissions_for_new_directories(); |
578 | 578 | $perm_file = api_get_permissions_for_new_files(); |
579 | 579 | |
580 | - $chat_path = $sys_course_path . $course_repository . '/document/chat_files'; |
|
580 | + $chat_path = $sys_course_path.$course_repository.'/document/chat_files'; |
|
581 | 581 | |
582 | 582 | if (!is_dir($chat_path)) { |
583 | 583 | @mkdir($chat_path, api_get_permissions_for_new_directories()); |
@@ -609,11 +609,11 @@ discard block |
||
609 | 609 | 'certificates', |
610 | 610 | ); |
611 | 611 | |
612 | - $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document/'; |
|
612 | + $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document/'; |
|
613 | 613 | |
614 | 614 | $default_document_array = array(); |
615 | 615 | foreach ($folders_to_copy_from_default_course as $folder) { |
616 | - $default_course_folder_path = $default_course_path . $folder . '/'; |
|
616 | + $default_course_folder_path = $default_course_path.$folder.'/'; |
|
617 | 617 | $files = self::browse_folders( |
618 | 618 | $default_course_folder_path, |
619 | 619 | array(), |
@@ -642,30 +642,30 @@ discard block |
||
642 | 642 | //hack until feature #5242 is implemented |
643 | 643 | if ($media_type == 'images') { |
644 | 644 | $media_type = 'images/gallery'; |
645 | - $images_folder = $sys_course_path . $course_repository . "/document/images/"; |
|
645 | + $images_folder = $sys_course_path.$course_repository."/document/images/"; |
|
646 | 646 | |
647 | 647 | if (!is_dir($images_folder)) { |
648 | 648 | //Creating index.html |
649 | 649 | mkdir($images_folder, $perm); |
650 | - $fd = fopen($images_folder . 'index.html', 'w'); |
|
650 | + $fd = fopen($images_folder.'index.html', 'w'); |
|
651 | 651 | fwrite($fd, $htmlpage); |
652 | - @chmod($images_folder . 'index.html', $perm_file); |
|
652 | + @chmod($images_folder.'index.html', $perm_file); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | |
656 | - $course_documents_folder = $sys_course_path . $course_repository . "/document/$media_type/"; |
|
657 | - $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document' . $path_documents; |
|
656 | + $course_documents_folder = $sys_course_path.$course_repository."/document/$media_type/"; |
|
657 | + $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document'.$path_documents; |
|
658 | 658 | |
659 | 659 | if (!is_dir($course_documents_folder)) { |
660 | 660 | // Creating index.html |
661 | 661 | mkdir($course_documents_folder, $perm); |
662 | 662 | $fd = fopen( |
663 | - $course_documents_folder . 'index.html', |
|
663 | + $course_documents_folder.'index.html', |
|
664 | 664 | 'w' |
665 | 665 | ); |
666 | 666 | fwrite($fd, $htmlpage); |
667 | 667 | @chmod( |
668 | - $course_documents_folder . 'index.html', |
|
668 | + $course_documents_folder.'index.html', |
|
669 | 669 | $perm_file |
670 | 670 | ); |
671 | 671 | } |
@@ -673,15 +673,15 @@ discard block |
||
673 | 673 | if (is_array($array_media) && count($array_media) > 0) { |
674 | 674 | foreach ($array_media as $key => $value) { |
675 | 675 | if (isset($value['dir']) && !empty($value['dir'])) { |
676 | - if (!is_dir($course_documents_folder . $value['dir'])) { |
|
676 | + if (!is_dir($course_documents_folder.$value['dir'])) { |
|
677 | 677 | //Creating folder |
678 | 678 | mkdir( |
679 | - $course_documents_folder . $value['dir'], |
|
679 | + $course_documents_folder.$value['dir'], |
|
680 | 680 | $perm |
681 | 681 | ); |
682 | 682 | |
683 | 683 | //Creating index.html (for light protection) |
684 | - $index_html = $course_documents_folder . $value['dir'] . '/index.html'; |
|
684 | + $index_html = $course_documents_folder.$value['dir'].'/index.html'; |
|
685 | 685 | $fd = fopen($index_html, 'w'); |
686 | 686 | fwrite($fd, $htmlpage); |
687 | 687 | @chmod($index_html, $perm_file); |
@@ -703,12 +703,12 @@ discard block |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | if ($media_type == 'images/gallery') { |
706 | - $folder_path = 'gallery/' . $folder_path; |
|
706 | + $folder_path = 'gallery/'.$folder_path; |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | Database::query( |
710 | 710 | "INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size) |
711 | - VALUES ($course_id,'$path_documents" . $folder_path . "','" . $title . "','folder','0')" |
|
711 | + VALUES ($course_id,'$path_documents".$folder_path."','".$title."','folder','0')" |
|
712 | 712 | ); |
713 | 713 | $image_id = Database:: insert_id(); |
714 | 714 | |
@@ -721,33 +721,33 @@ discard block |
||
721 | 721 | |
722 | 722 | if (isset($value['file']) && !empty($value['file'])) { |
723 | 723 | if (!file_exists( |
724 | - $course_documents_folder . $value['file'] |
|
724 | + $course_documents_folder.$value['file'] |
|
725 | 725 | ) |
726 | 726 | ) { |
727 | 727 | //Copying file |
728 | 728 | copy( |
729 | - $default_course_path . $value['file'], |
|
730 | - $course_documents_folder . $value['file'] |
|
729 | + $default_course_path.$value['file'], |
|
730 | + $course_documents_folder.$value['file'] |
|
731 | 731 | ); |
732 | 732 | chmod( |
733 | - $course_documents_folder . $value['file'], |
|
733 | + $course_documents_folder.$value['file'], |
|
734 | 734 | $perm_file |
735 | 735 | ); |
736 | 736 | //echo $default_course_path.$value['file']; echo ' - '; echo $course_documents_folder.$value['file']; echo '<br />'; |
737 | 737 | $temp = explode('/', $value['file']); |
738 | 738 | $file_size = filesize( |
739 | - $course_documents_folder . $value['file'] |
|
739 | + $course_documents_folder.$value['file'] |
|
740 | 740 | ); |
741 | 741 | |
742 | 742 | //hack until feature #5242 is implemented |
743 | 743 | if ($media_type == 'images/gallery') { |
744 | - $value["file"] = 'gallery/' . $value["file"]; |
|
744 | + $value["file"] = 'gallery/'.$value["file"]; |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | //Inserting file in the DB |
748 | 748 | Database::query( |
749 | 749 | "INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size) |
750 | - VALUES ($course_id,'$path_documents" . $value["file"] . "','" . $temp[count($temp) - 1] . "','file','$file_size')" |
|
750 | + VALUES ($course_id,'$path_documents".$value["file"]."','".$temp[count($temp) - 1]."','file','$file_size')" |
|
751 | 751 | ); |
752 | 752 | $image_id = Database:: insert_id(); |
753 | 753 | if ($image_id) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | $sql = "UPDATE $TABLETOOLDOCUMENT SET id = iid WHERE iid = $image_id"; |
756 | 756 | Database::query($sql); |
757 | 757 | |
758 | - if ($path_documents . $value['file'] == '/certificates/default.html') { |
|
758 | + if ($path_documents.$value['file'] == '/certificates/default.html') { |
|
759 | 759 | $example_cert_id = $image_id; |
760 | 760 | } |
761 | 761 | Database::query( |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | 'c_id' => $course_id, |
796 | 796 | 'url' => 'http://www.google.com', |
797 | 797 | 'title' => 'Google', |
798 | - 'description' => get_lang('Google') , |
|
798 | + 'description' => get_lang('Google'), |
|
799 | 799 | 'category_id' => 0, |
800 | 800 | 'on_homepage' => 0, |
801 | 801 | 'target' => '_self', |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | 'c_id' => $course_id, |
806 | 806 | 'url' => 'http://www.wikipedia.org', |
807 | 807 | 'title' => 'Wikipedia', |
808 | - 'description' => get_lang('Wikipedia') , |
|
808 | + 'description' => get_lang('Wikipedia'), |
|
809 | 809 | 'category_id' => 0, |
810 | 810 | 'on_homepage' => 0, |
811 | 811 | 'target' => '_self', |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | ] |
814 | 814 | ]; |
815 | 815 | |
816 | - foreach($links as $params) { |
|
816 | + foreach ($links as $params) { |
|
817 | 817 | $link->save($params); |
818 | 818 | } |
819 | 819 | |
@@ -832,8 +832,8 @@ discard block |
||
832 | 832 | /* Introduction text */ |
833 | 833 | |
834 | 834 | $intro_text = '<p style="text-align: center;"> |
835 | - <img src="' . api_get_path(REL_CODE_PATH) . 'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" /> |
|
836 | - <h2>' . self::lang2db(get_lang('IntroductionText')) . '</h2> |
|
835 | + <img src="' . api_get_path(REL_CODE_PATH).'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" /> |
|
836 | + <h2>' . self::lang2db(get_lang('IntroductionText')).'</h2> |
|
837 | 837 | </p>'; |
838 | 838 | |
839 | 839 | $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro(); |
@@ -869,9 +869,9 @@ discard block |
||
869 | 869 | $html = '<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
870 | 870 | <tr> |
871 | 871 | <td width="220" valign="top" align="left"> |
872 | - <img src="' . api_get_path(WEB_CODE_PATH) . 'default_course_document/images/mr_chamilo/doubts.png"> |
|
872 | + <img src="' . api_get_path(WEB_CODE_PATH).'default_course_document/images/mr_chamilo/doubts.png"> |
|
873 | 873 | </td> |
874 | - <td valign="top" align="left">' . get_lang('Antique') . '</td></tr> |
|
874 | + <td valign="top" align="left">' . get_lang('Antique').'</td></tr> |
|
875 | 875 | </table>'; |
876 | 876 | $exercise->type = 1; |
877 | 877 | $exercise->setRandom(0); |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | 'https://' |
1151 | 1151 | ) === false |
1152 | 1152 | ) { |
1153 | - $department_url = 'http://' . $department_url; |
|
1153 | + $department_url = 'http://'.$department_url; |
|
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | //just in case |
@@ -1204,12 +1204,12 @@ discard block |
||
1204 | 1204 | ); |
1205 | 1205 | |
1206 | 1206 | if (!empty($user_id)) { |
1207 | - $sql = "INSERT INTO " . $TABLECOURSUSER . " SET |
|
1208 | - c_id = '" . $course_id . "', |
|
1209 | - user_id = '" . intval($user_id) . "', |
|
1207 | + $sql = "INSERT INTO ".$TABLECOURSUSER." SET |
|
1208 | + c_id = '" . $course_id."', |
|
1209 | + user_id = '" . intval($user_id)."', |
|
1210 | 1210 | status = '1', |
1211 | 1211 | is_tutor = '0', |
1212 | - sort = '" . ($i_course_sort) . "', |
|
1212 | + sort = '" . ($i_course_sort)."', |
|
1213 | 1213 | relation_type = 0, |
1214 | 1214 | user_course_cat = '0'"; |
1215 | 1215 | Database::query($sql); |
@@ -1229,12 +1229,12 @@ discard block |
||
1229 | 1229 | if (empty($key)) { |
1230 | 1230 | continue; |
1231 | 1231 | } |
1232 | - $sql = "INSERT INTO " . $TABLECOURSUSER . " SET |
|
1233 | - c_id = '" . Database::escape_string($course_id) . "', |
|
1234 | - user_id = '" . Database::escape_string($key) . "', |
|
1232 | + $sql = "INSERT INTO ".$TABLECOURSUSER." SET |
|
1233 | + c_id = '" . Database::escape_string($course_id)."', |
|
1234 | + user_id = '" . Database::escape_string($key)."', |
|
1235 | 1235 | status = '1', |
1236 | 1236 | is_tutor = '0', |
1237 | - sort = '" . ($sort + 1) . "', |
|
1237 | + sort = '" . ($sort + 1)."', |
|
1238 | 1238 | relation_type = 0, |
1239 | 1239 | user_course_cat = '0'"; |
1240 | 1240 | Database::query($sql); |
@@ -1277,13 +1277,13 @@ discard block |
||
1277 | 1277 | api_get_setting('admin.administrator_surname') |
1278 | 1278 | ); |
1279 | 1279 | $iname = api_get_setting('platform.institution'); |
1280 | - $subject = get_lang('NewCourseCreatedIn') . ' ' . $siteName . ' - ' . $iname; |
|
1281 | - $message = get_lang('Dear') . ' ' . $recipient_name . ",\n\n" . |
|
1282 | - get_lang('MessageOfNewCourseToAdmin') . ' ' . $siteName . ' - ' . $iname . "\n"; |
|
1283 | - $message .= get_lang('CourseName') . ' ' . $title . "\n"; |
|
1284 | - $message .= get_lang('Category') . ' ' . $category_code . "\n"; |
|
1285 | - $message .= get_lang('Tutor') . ' ' . $tutor_name . "\n"; |
|
1286 | - $message .= get_lang('Language') . ' ' . $course_language; |
|
1280 | + $subject = get_lang('NewCourseCreatedIn').' '.$siteName.' - '.$iname; |
|
1281 | + $message = get_lang('Dear').' '.$recipient_name.",\n\n". |
|
1282 | + get_lang('MessageOfNewCourseToAdmin').' '.$siteName.' - '.$iname."\n"; |
|
1283 | + $message .= get_lang('CourseName').' '.$title."\n"; |
|
1284 | + $message .= get_lang('Category').' '.$category_code."\n"; |
|
1285 | + $message .= get_lang('Tutor').' '.$tutor_name."\n"; |
|
1286 | + $message .= get_lang('Language').' '.$course_language; |
|
1287 | 1287 | |
1288 | 1288 | $userInfo = api_get_user_info($user_id); |
1289 | 1289 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * Searches a course, given a search string and a type of search box |
11 | 11 | * @param string $needle Search string |
12 | 12 | * @param string $type Type of search box ('single' or anything else) |
13 | - * @return string XajaxResponse |
|
13 | + * @return xajaxResponse XajaxResponse |
|
14 | 14 | * @assert ('abc', 'single') !== null |
15 | 15 | * @assert ('abc', 'multiple') !== null |
16 | 16 | */ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $course_title = null; |
22 | 22 | $xajax_response = new xajaxResponse(); |
23 | 23 | $return = ''; |
24 | - if(!empty($needle) && !empty($type)) { |
|
24 | + if (!empty($needle) && !empty($type)) { |
|
25 | 25 | // xajax send utf8 datas... datas in db can be non-utf8 datas |
26 | 26 | $charset = api_get_system_encoding(); |
27 | 27 | $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | while ($row = Database::fetch_row($res)) { |
39 | 39 | $course_codes .= '\''.$row[0].'\','; |
40 | 40 | } |
41 | - $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
41 | + $course_codes = substr($course_codes, 0, (strlen($course_codes) - 1)); |
|
42 | 42 | |
43 | 43 | $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - if ($type=='single') { |
|
47 | + if ($type == 'single') { |
|
48 | 48 | // search users where username or firstname or lastname begins likes $needle |
49 | 49 | $sql = 'SELECT |
50 | 50 | course.code, |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | if (api_is_multiple_url_enabled()) { |
70 | 70 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
71 | 71 | $access_url_id = api_get_current_access_url_id(); |
72 | - if ($access_url_id != -1){ |
|
72 | + if ($access_url_id != -1) { |
|
73 | 73 | |
74 | - if ($type=='single') { |
|
74 | + if ($type == 'single') { |
|
75 | 75 | $sql = 'SELECT |
76 | 76 | course.code, |
77 | 77 | course.visual_code, |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | |
102 | 102 | $rs = Database::query($sql); |
103 | 103 | $course_list = array(); |
104 | - if ($type=='single') { |
|
104 | + if ($type == 'single') { |
|
105 | 105 | |
106 | - while($course = Database :: fetch_array($rs)) { |
|
106 | + while ($course = Database :: fetch_array($rs)) { |
|
107 | 107 | $course_list[] = $course['code']; |
108 | - $course_title=str_replace("'","\'",$course_title); |
|
108 | + $course_title = str_replace("'", "\'", $course_title); |
|
109 | 109 | $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['code'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />'; |
110 | 110 | } |
111 | - $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | + $xajax_response -> addAssign('ajax_list_courses_single', 'innerHTML', api_utf8_encode($return)); |
|
112 | 112 | } else { |
113 | 113 | $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
114 | - while($course = Database :: fetch_array($rs)) { |
|
114 | + while ($course = Database :: fetch_array($rs)) { |
|
115 | 115 | $course_list[] = $course['code']; |
116 | - $course_title=str_replace("'","\'",$course_title); |
|
117 | - $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
116 | + $course_title = str_replace("'", "\'", $course_title); |
|
117 | + $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')', ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
118 | 118 | } |
119 | 119 | $return .= '</select>'; |
120 | 120 | |
121 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
121 | + $xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return)); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | $_SESSION['course_list'] = $course_list; |
@@ -8,47 +8,47 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class AddCourseToSession |
10 | 10 | { |
11 | - /** |
|
12 | - * Searches a course, given a search string and a type of search box |
|
13 | - * @param string $needle Search string |
|
14 | - * @param string $type Type of search box ('single' or anything else) |
|
15 | - * @return string XajaxResponse |
|
16 | - * @assert ('abc', 'single') !== null |
|
17 | - * @assert ('abc', 'multiple') !== null |
|
18 | - */ |
|
19 | - public static function search_courses($needle, $type) |
|
20 | - { |
|
21 | - global $tbl_session_rel_course, $id_session; |
|
11 | + /** |
|
12 | + * Searches a course, given a search string and a type of search box |
|
13 | + * @param string $needle Search string |
|
14 | + * @param string $type Type of search box ('single' or anything else) |
|
15 | + * @return string XajaxResponse |
|
16 | + * @assert ('abc', 'single') !== null |
|
17 | + * @assert ('abc', 'multiple') !== null |
|
18 | + */ |
|
19 | + public static function search_courses($needle, $type) |
|
20 | + { |
|
21 | + global $tbl_session_rel_course, $id_session; |
|
22 | 22 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
23 | - $course_title = null; |
|
24 | - $xajax_response = new xajaxResponse(); |
|
25 | - $return = ''; |
|
26 | - if(!empty($needle) && !empty($type)) { |
|
27 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
28 | - $charset = api_get_system_encoding(); |
|
29 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
23 | + $course_title = null; |
|
24 | + $xajax_response = new xajaxResponse(); |
|
25 | + $return = ''; |
|
26 | + if(!empty($needle) && !empty($type)) { |
|
27 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
28 | + $charset = api_get_system_encoding(); |
|
29 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
30 | 30 | |
31 | - $cond_course_code = ''; |
|
32 | - if (!empty($id_session)) { |
|
33 | - $id_session = intval($id_session); |
|
34 | - // check course_code from session_rel_course table |
|
35 | - $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
31 | + $cond_course_code = ''; |
|
32 | + if (!empty($id_session)) { |
|
33 | + $id_session = intval($id_session); |
|
34 | + // check course_code from session_rel_course table |
|
35 | + $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
36 | 36 | WHERE session_id = '.$id_session; |
37 | - $res = Database::query($sql); |
|
38 | - $course_codes = ''; |
|
39 | - if (Database::num_rows($res) > 0) { |
|
40 | - while ($row = Database::fetch_row($res)) { |
|
41 | - $course_codes .= '\''.$row[0].'\','; |
|
42 | - } |
|
43 | - $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
37 | + $res = Database::query($sql); |
|
38 | + $course_codes = ''; |
|
39 | + if (Database::num_rows($res) > 0) { |
|
40 | + while ($row = Database::fetch_row($res)) { |
|
41 | + $course_codes .= '\''.$row[0].'\','; |
|
42 | + } |
|
43 | + $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
44 | 44 | |
45 | - $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
46 | - } |
|
47 | - } |
|
45 | + $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | - if ($type=='single') { |
|
50 | - // search users where username or firstname or lastname begins likes $needle |
|
51 | - $sql = 'SELECT |
|
49 | + if ($type=='single') { |
|
50 | + // search users where username or firstname or lastname begins likes $needle |
|
51 | + $sql = 'SELECT |
|
52 | 52 | course.code, |
53 | 53 | course.visual_code, |
54 | 54 | course.title, |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | WHERE |
61 | 61 | course.visual_code LIKE "'.$needle.'%" OR |
62 | 62 | course.title LIKE "'.$needle.'%"'; |
63 | - } else { |
|
64 | - $sql = 'SELECT course.code, course.visual_code, course.title |
|
63 | + } else { |
|
64 | + $sql = 'SELECT course.code, course.visual_code, course.title |
|
65 | 65 | FROM '.$tbl_course.' course |
66 | 66 | WHERE |
67 | 67 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
68 | 68 | ORDER BY course.code '; |
69 | - } |
|
69 | + } |
|
70 | 70 | |
71 | - if (api_is_multiple_url_enabled()) { |
|
72 | - $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
73 | - $access_url_id = api_get_current_access_url_id(); |
|
74 | - if ($access_url_id != -1){ |
|
71 | + if (api_is_multiple_url_enabled()) { |
|
72 | + $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
73 | + $access_url_id = api_get_current_access_url_id(); |
|
74 | + if ($access_url_id != -1){ |
|
75 | 75 | |
76 | - if ($type=='single') { |
|
77 | - $sql = 'SELECT |
|
76 | + if ($type=='single') { |
|
77 | + $sql = 'SELECT |
|
78 | 78 | course.code, |
79 | 79 | course.visual_code, |
80 | 80 | course.title, |
@@ -89,42 +89,42 @@ discard block |
||
89 | 89 | access_url_id = '.$access_url_id.' AND |
90 | 90 | (course.visual_code LIKE "'.$needle.'%" OR |
91 | 91 | course.title LIKE "'.$needle.'%" )'; |
92 | - } else { |
|
93 | - $sql = 'SELECT course.code, course.visual_code, course.title |
|
92 | + } else { |
|
93 | + $sql = 'SELECT course.code, course.visual_code, course.title |
|
94 | 94 | FROM '.$tbl_course.' course, '.$tbl_course_rel_access_url.' url_course |
95 | 95 | WHERE |
96 | 96 | url_course.c_id = course.id AND |
97 | 97 | access_url_id = '.$access_url_id.' AND |
98 | 98 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
99 | 99 | ORDER BY course.code '; |
100 | - } |
|
101 | - } |
|
102 | - } |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | 103 | |
104 | - $rs = Database::query($sql); |
|
105 | - $course_list = array(); |
|
106 | - if ($type=='single') { |
|
104 | + $rs = Database::query($sql); |
|
105 | + $course_list = array(); |
|
106 | + if ($type=='single') { |
|
107 | 107 | |
108 | - while($course = Database :: fetch_array($rs)) { |
|
109 | - $course_list[] = $course['code']; |
|
110 | - $course_title=str_replace("'","\'",$course_title); |
|
111 | - $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['code'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />'; |
|
112 | - } |
|
113 | - $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
114 | - } else { |
|
115 | - $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
116 | - while($course = Database :: fetch_array($rs)) { |
|
117 | - $course_list[] = $course['code']; |
|
118 | - $course_title=str_replace("'","\'",$course_title); |
|
119 | - $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
120 | - } |
|
121 | - $return .= '</select>'; |
|
108 | + while($course = Database :: fetch_array($rs)) { |
|
109 | + $course_list[] = $course['code']; |
|
110 | + $course_title=str_replace("'","\'",$course_title); |
|
111 | + $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['code'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />'; |
|
112 | + } |
|
113 | + $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
114 | + } else { |
|
115 | + $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
116 | + while($course = Database :: fetch_array($rs)) { |
|
117 | + $course_list[] = $course['code']; |
|
118 | + $course_title=str_replace("'","\'",$course_title); |
|
119 | + $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
120 | + } |
|
121 | + $return .= '</select>'; |
|
122 | 122 | |
123 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
124 | - } |
|
125 | - } |
|
126 | - Session::write('course_list', $course_list); |
|
123 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
124 | + } |
|
125 | + } |
|
126 | + Session::write('course_list', $course_list); |
|
127 | 127 | |
128 | - return $xajax_response; |
|
129 | - } |
|
128 | + return $xajax_response; |
|
129 | + } |
|
130 | 130 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * Search for a session based on a given search string |
18 | 18 | * @param string A search string |
19 | 19 | * @param string A search box type (single or anything else) |
20 | - * @return string XajaxResponse |
|
20 | + * @return xajaxResponse XajaxResponse |
|
21 | 21 | * @assert () !== '' |
22 | 22 | * @assert ('abc','single') !== '' |
23 | 23 | */ |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @assert () !== '' |
22 | 22 | * @assert ('abc','single') !== '' |
23 | 23 | */ |
24 | - function search_courses($needle,$type) |
|
24 | + function search_courses($needle, $type) |
|
25 | 25 | { |
26 | 26 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
27 | 27 | $xajax_response = new xajaxResponse(); |
28 | 28 | $return = ''; |
29 | - if(!empty($needle) && !empty($type)) { |
|
29 | + if (!empty($needle) && !empty($type)) { |
|
30 | 30 | // xajax send utf8 datas... datas in db can be non-utf8 datas |
31 | 31 | $charset = api_get_system_encoding(); |
32 | 32 | $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | $course_list = array(); |
39 | 39 | |
40 | 40 | $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
41 | - while($course = Database :: fetch_array($rs)) { |
|
41 | + while ($course = Database :: fetch_array($rs)) { |
|
42 | 42 | $course_list[] = $course['id']; |
43 | - $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
43 | + $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'], ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
44 | 44 | } |
45 | 45 | $return .= '</select>'; |
46 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
46 | + $xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return)); |
|
47 | 47 | } |
48 | 48 | $_SESSION['course_list'] = $course_list; |
49 | 49 | return $xajax_response; |
@@ -24,30 +24,30 @@ |
||
24 | 24 | function search_courses($needle,$type) |
25 | 25 | { |
26 | 26 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
27 | - $xajax_response = new xajaxResponse(); |
|
28 | - $return = ''; |
|
29 | - if(!empty($needle) && !empty($type)) { |
|
30 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
31 | - $charset = api_get_system_encoding(); |
|
32 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
33 | - $needle = Database::escape_string($needle); |
|
27 | + $xajax_response = new xajaxResponse(); |
|
28 | + $return = ''; |
|
29 | + if(!empty($needle) && !empty($type)) { |
|
30 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
31 | + $charset = api_get_system_encoding(); |
|
32 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
33 | + $needle = Database::escape_string($needle); |
|
34 | 34 | |
35 | - $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
35 | + $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
36 | 36 | |
37 | - $rs = Database::query($sql); |
|
38 | - $course_list = array(); |
|
37 | + $rs = Database::query($sql); |
|
38 | + $course_list = array(); |
|
39 | 39 | |
40 | - $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
41 | - while($course = Database :: fetch_array($rs)) { |
|
42 | - $course_list[] = $course['id']; |
|
43 | - $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
44 | - } |
|
45 | - $return .= '</select>'; |
|
46 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
47 | - } |
|
40 | + $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
41 | + while($course = Database :: fetch_array($rs)) { |
|
42 | + $course_list[] = $course['id']; |
|
43 | + $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
44 | + } |
|
45 | + $return .= '</select>'; |
|
46 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
47 | + } |
|
48 | 48 | |
49 | - Session::write('course_list', $course_list); |
|
49 | + Session::write('course_list', $course_list); |
|
50 | 50 | |
51 | - return $xajax_response; |
|
52 | - } |
|
51 | + return $xajax_response; |
|
52 | + } |
|
53 | 53 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * |
18 | 18 | * @param int|array $course |
19 | - * @param int|array $annoucement |
|
19 | + * @param integer $announcement |
|
20 | 20 | * |
21 | 21 | * @return AnnouncementEmail |
22 | 22 | */ |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param string $key |
52 | 52 | * |
53 | - * @return array |
|
53 | + * @return string|null |
|
54 | 54 | */ |
55 | 55 | public function course($key = '') |
56 | 56 | { |
@@ -196,7 +196,7 @@ |
||
196 | 196 | * |
197 | 197 | * @return array |
198 | 198 | */ |
199 | - public function sender($key = '', $userId = '') |
|
199 | + public function sender($key = '', $userId = '') |
|
200 | 200 | { |
201 | 201 | $_user = api_get_user_info($userId); |
202 | 202 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | - * @return array |
|
21 | + * @return string[] |
|
22 | 22 | */ |
23 | 23 | public static function get_tags() |
24 | 24 | { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param string $course_code |
41 | 41 | * @param int $session_id |
42 | 42 | * |
43 | - * @return mixed |
|
43 | + * @return string |
|
44 | 44 | */ |
45 | 45 | public static function parse_content($userId, $content, $course_code, $session_id = 0) |
46 | 46 | { |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @param array uploaded file $_FILES |
350 | 350 | * @param string Comment describing the attachment |
351 | 351 | * @param bool $sendToUsersInSession |
352 | - * @return int false on failure, ID of the announcement on success |
|
352 | + * @return false|string false on failure, ID of the announcement on success |
|
353 | 353 | */ |
354 | 354 | public static function add_announcement( |
355 | 355 | $emailTitle, |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @param $to_users |
461 | 461 | * @param array $file |
462 | 462 | * @param string $file_comment |
463 | - * @return bool|int |
|
463 | + * @return false|string |
|
464 | 464 | */ |
465 | 465 | public static function add_group_announcement( |
466 | 466 | $emailTitle, |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | |
700 | 700 | /** |
701 | 701 | * @param int $insert_id |
702 | - * @return bool |
|
702 | + * @return false|null |
|
703 | 703 | */ |
704 | 704 | public static function update_mail_sent($insert_id) |
705 | 705 | { |
@@ -719,6 +719,7 @@ discard block |
||
719 | 719 | * Gets all announcements from a user by course |
720 | 720 | * @param string course db |
721 | 721 | * @param int user id |
722 | + * @param integer $user_id |
|
722 | 723 | * @return array html with the content and count of announcements or false otherwise |
723 | 724 | */ |
724 | 725 | public static function get_all_annoucement_by_user_course($course_code, $user_id) |
@@ -1184,6 +1185,7 @@ discard block |
||
1184 | 1185 | * has been sent to |
1185 | 1186 | * @param string The tool (announcement, agenda, ...) |
1186 | 1187 | * @param int ID of the element of the corresponding type |
1188 | + * @param string $tool |
|
1187 | 1189 | * @return array Array of users and groups to whom the element has been sent |
1188 | 1190 | */ |
1189 | 1191 | public static function sent_to($tool, $id) |
@@ -1308,6 +1310,8 @@ discard block |
||
1308 | 1310 | * @param int attach id |
1309 | 1311 | * @param array uploaded file $_FILES |
1310 | 1312 | * @param string file comment |
1313 | + * @param integer $id_attach |
|
1314 | + * @param string $file_comment |
|
1311 | 1315 | * @return int |
1312 | 1316 | */ |
1313 | 1317 | public static function edit_announcement_attachment_file($id_attach, $file, $file_comment) |
@@ -1510,7 +1510,7 @@ |
||
1510 | 1510 | ip.to_user_id=$user_id OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) |
1511 | 1511 | ) "; |
1512 | 1512 | } else { |
1513 | - $cond_user_id = " AND ( |
|
1513 | + $cond_user_id = " AND ( |
|
1514 | 1514 | ip.to_user_id=$user_id OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".api_get_group_id().")) |
1515 | 1515 | )"; |
1516 | 1516 | } |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | announcement.id = '$announcement_id' AND |
217 | 217 | toolitemproperties.tool='announcement' AND |
218 | 218 | ( |
219 | - toolitemproperties.to_user_id='" . api_get_user_id() . "' OR |
|
220 | - toolitemproperties.to_group_id IN ('0', '" . implode("', '", $group_list) . "') OR |
|
219 | + toolitemproperties.to_user_id='".api_get_user_id()."' OR |
|
220 | + toolitemproperties.to_group_id IN ('0', '" . implode("', '", $group_list)."') OR |
|
221 | 221 | toolitemproperties.to_group_id IS NULL |
222 | 222 | ) AND |
223 | 223 | toolitemproperties.visibility='1' AND |
@@ -246,13 +246,13 @@ discard block |
||
246 | 246 | $title = $result['title']; |
247 | 247 | $content = $result['content']; |
248 | 248 | $html .= "<table height=\"100\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" class=\"data_table\">"; |
249 | - $html .= "<tr><td><h2>" . $title . "</h2></td></tr>"; |
|
249 | + $html .= "<tr><td><h2>".$title."</h2></td></tr>"; |
|
250 | 250 | |
251 | 251 | if (api_is_allowed_to_edit(false, true) || |
252 | 252 | (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) |
253 | 253 | ) { |
254 | - $modify_icons = "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=modify&id=" . $announcement_id . "\">" . |
|
255 | - Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>"; |
|
254 | + $modify_icons = "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=modify&id=".$announcement_id."\">". |
|
255 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>"; |
|
256 | 256 | if ($result['visibility'] == 1) { |
257 | 257 | $image_visibility = "visible"; |
258 | 258 | $alt_visibility = get_lang('Hide'); |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | } |
263 | 263 | global $stok; |
264 | 264 | |
265 | - $modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&origin=" . (!empty($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '') . "&action=showhide&id=" . $announcement_id . "&sec_token=" . $stok . "\">" . |
|
266 | - Display::return_icon($image_visibility . '.png', $alt_visibility, '', ICON_SIZE_SMALL) . "</a>"; |
|
265 | + $modify_icons .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&origin=".(!empty($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '')."&action=showhide&id=".$announcement_id."&sec_token=".$stok."\">". |
|
266 | + Display::return_icon($image_visibility.'.png', $alt_visibility, '', ICON_SIZE_SMALL)."</a>"; |
|
267 | 267 | |
268 | 268 | if (api_is_allowed_to_edit(false, true)) { |
269 | - $modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=delete&id=" . $announcement_id . "&sec_token=" . $stok . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "')) return false;\">" . |
|
270 | - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . |
|
269 | + $modify_icons .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete&id=".$announcement_id."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset))."')) return false;\">". |
|
270 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL). |
|
271 | 271 | "</a>"; |
272 | 272 | } |
273 | 273 | $html .= "<tr><th style='text-align:right'>$modify_icons</th></tr>"; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $content = self::parse_content($result['to_user_id'], $content, api_get_course_id(), api_get_session_id()); |
277 | 277 | |
278 | 278 | $html .= "<tr><td>$content</td></tr>"; |
279 | - $html .= "<tr><td class=\"announcements_datum\">" . get_lang('LastUpdateDate') . " : " . api_convert_and_format_date($result['insert_date'], DATE_TIME_FORMAT_LONG) . "</td></tr>"; |
|
279 | + $html .= "<tr><td class=\"announcements_datum\">".get_lang('LastUpdateDate')." : ".api_convert_and_format_date($result['insert_date'], DATE_TIME_FORMAT_LONG)."</td></tr>"; |
|
280 | 280 | |
281 | 281 | // User or group icon |
282 | 282 | $sent_to_icon = ''; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $sent_to_form = self::sent_to_form($sent_to); |
289 | 289 | $html .= Display::tag( |
290 | 290 | 'td', |
291 | - get_lang('SentTo') . ' : ' . $sent_to_form, |
|
291 | + get_lang('SentTo').' : '.$sent_to_form, |
|
292 | 292 | array('class' => 'announcements_datum') |
293 | 293 | ); |
294 | 294 | } |
@@ -298,15 +298,15 @@ discard block |
||
298 | 298 | $html .= "<tr><td>"; |
299 | 299 | $realname = $attachment_list['path']; |
300 | 300 | $user_filename = $attachment_list['filename']; |
301 | - $full_file_name = 'download.php?'.api_get_cidreq().'&file=' . $realname; |
|
301 | + $full_file_name = 'download.php?'.api_get_cidreq().'&file='.$realname; |
|
302 | 302 | $html .= '<br/>'; |
303 | 303 | $html .= Display::return_icon('attachment.gif', get_lang('Attachment')); |
304 | - $html .= '<a href="' . $full_file_name . ' "> ' . $user_filename . ' </a>'; |
|
305 | - $html .= ' - <span class="forum_attach_comment" >' . $attachment_list['comment'] . '</span>'; |
|
304 | + $html .= '<a href="'.$full_file_name.' "> '.$user_filename.' </a>'; |
|
305 | + $html .= ' - <span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>'; |
|
306 | 306 | if (api_is_allowed_to_edit(false, true)) { |
307 | 307 | $html .= Display::url( |
308 | 308 | Display::return_icon('delete.png', get_lang('Delete'), '', 16), |
309 | - api_get_self() . "?" . api_get_cidreq() . "&action=delete_attachment&id_attach=" . $attachment_list['id'] . "&sec_token=" . $stok |
|
309 | + api_get_self()."?".api_get_cidreq()."&action=delete_attachment&id_attach=".$attachment_list['id']."&sec_token=".$stok |
|
310 | 310 | ); |
311 | 311 | } |
312 | 312 | $html .= '</td></tr>'; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $order = 0; |
335 | 335 | if (Database::num_rows($res_max)) { |
336 | 336 | $row_max = Database::fetch_array($res_max); |
337 | - $order = intval($row_max[0])+1; |
|
337 | + $order = intval($row_max[0]) + 1; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | return $order; |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | $result = array(); |
755 | 755 | if ($num_rows > 0) { |
756 | 756 | while ($myrow = Database::fetch_array($rs)) { |
757 | - $content.= '<strong>' . $myrow['title'] . '</strong><br /><br />'; |
|
758 | - $content.= $myrow['content']; |
|
757 | + $content .= '<strong>'.$myrow['title'].'</strong><br /><br />'; |
|
758 | + $content .= $myrow['content']; |
|
759 | 759 | $i++; |
760 | 760 | } |
761 | 761 | $result['content'] = $content; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | echo "<table id=\"recipient_list\" >"; |
787 | 787 | echo '<tr>'; |
788 | 788 | echo '<td>'; |
789 | - echo '<label><input type="checkbox" id="send_to_all_users">'.get_lang('SendToAllUsers') . "</label>"; |
|
789 | + echo '<label><input type="checkbox" id="send_to_all_users">'.get_lang('SendToAllUsers')."</label>"; |
|
790 | 790 | echo "</td>"; |
791 | 791 | echo '</tr>'; |
792 | 792 | echo '<tr>'; |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | |
795 | 795 | // the form containing all the groups and all the users of the course |
796 | 796 | echo '<td>'; |
797 | - echo "<strong>" . get_lang('Users') . "</strong><br />"; |
|
797 | + echo "<strong>".get_lang('Users')."</strong><br />"; |
|
798 | 798 | |
799 | 799 | self::construct_not_selected_select_form($groupList, $userList, $to_already_selected); |
800 | 800 | echo "</td>"; |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | echo "<td>"; |
810 | 810 | |
811 | 811 | // the form containing the selected groups and users |
812 | - echo "<strong>" . get_lang('DestinationUsers') . "</strong><br />"; |
|
812 | + echo "<strong>".get_lang('DestinationUsers')."</strong><br />"; |
|
813 | 813 | self::construct_selected_select_form($groupList, $userList, $to_already_selected); |
814 | 814 | echo "</td>"; |
815 | 815 | echo "</tr>"; |
@@ -827,8 +827,8 @@ discard block |
||
827 | 827 | echo "<select id=\"not_selected_form\" name=\"not_selected_form[]\" size=5 style=\"width:200px\" multiple>"; |
828 | 828 | $group_users = GroupManager::getStudentsAndTutors($group_id); |
829 | 829 | foreach ($group_users as $user) { |
830 | - echo '<option value="' . $user['user_id'] . '" title="' . sprintf(get_lang('LoginX'), $user['username']) . '" >' . |
|
831 | - api_get_person_name($user['firstname'], $user['lastname']) . |
|
830 | + echo '<option value="'.$user['user_id'].'" title="'.sprintf(get_lang('LoginX'), $user['username']).'" >'. |
|
831 | + api_get_person_name($user['firstname'], $user['lastname']). |
|
832 | 832 | '</option>'; |
833 | 833 | } |
834 | 834 | echo '</select>'; |
@@ -866,12 +866,12 @@ discard block |
||
866 | 866 | if (!empty($groupList)) { |
867 | 867 | foreach ($groupList as $this_group) { |
868 | 868 | if (is_array($to_already_selected)) { |
869 | - if (!in_array("GROUP:" . $this_group['id'], $to_already_selected)) { |
|
869 | + if (!in_array("GROUP:".$this_group['id'], $to_already_selected)) { |
|
870 | 870 | // $to_already_selected is the array containing the groups (and users) that are already selected |
871 | - $user_label = ($this_group['userNb'] > 0) ? get_lang('Users') : get_lang('LowerCaseUser') ; |
|
872 | - $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled" ; |
|
873 | - echo "<option $user_disabled value=\"GROUP:" . $this_group['id'] . "\">", |
|
874 | - "G: ", $this_group['name'], " - " . $this_group['userNb'] . " " . $user_label . |
|
871 | + $user_label = ($this_group['userNb'] > 0) ? get_lang('Users') : get_lang('LowerCaseUser'); |
|
872 | + $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled"; |
|
873 | + echo "<option $user_disabled value=\"GROUP:".$this_group['id']."\">", |
|
874 | + "G: ", $this_group['name'], " - ".$this_group['userNb']." ".$user_label. |
|
875 | 875 | "</option>"; |
876 | 876 | } |
877 | 877 | } |
@@ -885,15 +885,15 @@ discard block |
||
885 | 885 | if (!empty($userList)) { |
886 | 886 | foreach ($userList as $user) { |
887 | 887 | if (is_array($to_already_selected)) { |
888 | - if (!in_array("USER:" . $user['user_id'], $to_already_selected)) { |
|
888 | + if (!in_array("USER:".$user['user_id'], $to_already_selected)) { |
|
889 | 889 | // $to_already_selected is the array containing the users (and groups) that are already selected |
890 | - echo "<option value=\"USER:" . $user['user_id'] . "\" title='" . sprintf(get_lang('LoginX'), $user['username']) . "'>", |
|
890 | + echo "<option value=\"USER:".$user['user_id']."\" title='".sprintf(get_lang('LoginX'), $user['username'])."'>", |
|
891 | 891 | "", api_get_person_name($user['firstname'], $user['lastname']), |
892 | 892 | "</option>"; |
893 | 893 | |
894 | 894 | if (isset($user['drh_list']) && !empty($user['drh_list'])) { |
895 | 895 | foreach ($user['drh_list'] as $drh) { |
896 | - echo "<option value=\"USER:" . $drh['user_id'] . "\" title='" . sprintf(get_lang('LoginX'), $drh['username']) . "'> ", |
|
896 | + echo "<option value=\"USER:".$drh['user_id']."\" title='".sprintf(get_lang('LoginX'), $drh['username'])."'> ", |
|
897 | 897 | "", api_get_person_name($drh['firstname'], $drh['lastname']), |
898 | 898 | "</option>"; |
899 | 899 | } |
@@ -925,16 +925,16 @@ discard block |
||
925 | 925 | foreach ($to_already_selected as $groupuser) { |
926 | 926 | list($type, $id) = explode(":", $groupuser); |
927 | 927 | if ($type == "GROUP") { |
928 | - echo "<option value=\"" . $groupuser . "\">G: " . $ref_array_groups[$id]['name'] . "</option>"; |
|
928 | + echo "<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>"; |
|
929 | 929 | } else { |
930 | 930 | foreach ($ref_array_users as $key => $value) { |
931 | 931 | if ($value['user_id'] == $id) { |
932 | - echo "<option value=\"" . $groupuser . "\" title='" . sprintf(get_lang('LoginX'), $value['username']) . "'>" . |
|
933 | - api_get_person_name($value['firstname'], $value['lastname']) . "</option>"; |
|
932 | + echo "<option value=\"".$groupuser."\" title='".sprintf(get_lang('LoginX'), $value['username'])."'>". |
|
933 | + api_get_person_name($value['firstname'], $value['lastname'])."</option>"; |
|
934 | 934 | |
935 | 935 | if (isset($value['drh_list']) && !empty($value['drh_list'])) { |
936 | 936 | foreach ($value['drh_list'] as $drh) { |
937 | - echo "<option value=\"USER:" . $drh['user_id'] . "\" title='" . sprintf(get_lang('LoginX'), $drh['username']) . "'> ", |
|
937 | + echo "<option value=\"USER:".$drh['user_id']."\" title='".sprintf(get_lang('LoginX'), $drh['username'])."'> ", |
|
938 | 938 | "", api_get_person_name($drh['firstname'], $drh['lastname']), |
939 | 939 | "</option>"; |
940 | 940 | } |
@@ -950,17 +950,17 @@ discard block |
||
950 | 950 | if (is_array($ref_array_groups)) { |
951 | 951 | foreach ($ref_array_groups as $this_group) { |
952 | 952 | //api_display_normal_message("group " . $thisGroup[id] . $thisGroup[name]); |
953 | - if (!is_array($to_already_selected) || !in_array("GROUP:" . $this_group['id'], $to_already_selected)) { // $to_already_selected is the array containing the groups (and users) that are already selected |
|
954 | - echo "<option value=\"GROUP:" . $this_group['id'] . "\">", |
|
955 | - "G: ", $this_group['name'], " – " . $this_group['userNb'] . " " . get_lang('Users') . |
|
953 | + if (!is_array($to_already_selected) || !in_array("GROUP:".$this_group['id'], $to_already_selected)) { // $to_already_selected is the array containing the groups (and users) that are already selected |
|
954 | + echo "<option value=\"GROUP:".$this_group['id']."\">", |
|
955 | + "G: ", $this_group['name'], " – ".$this_group['userNb']." ".get_lang('Users'). |
|
956 | 956 | "</option>"; |
957 | 957 | } |
958 | 958 | } |
959 | 959 | } |
960 | 960 | // adding the individual users to the select form |
961 | 961 | foreach ($ref_array_users as $this_user) { |
962 | - if (!is_array($to_already_selected) || !in_array("USER:" . $this_user['user_id'], $to_already_selected)) { // $to_already_selected is the array containing the users (and groups) that are already selected |
|
963 | - echo "<option value=\"USER:", $this_user['user_id'], "\" title='" . sprintf(get_lang('LoginX'), $this_user['username']) . "'>", |
|
962 | + if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'], $to_already_selected)) { // $to_already_selected is the array containing the users (and groups) that are already selected |
|
963 | + echo "<option value=\"USER:", $this_user['user_id'], "\" title='".sprintf(get_lang('LoginX'), $this_user['username'])."'>", |
|
964 | 964 | "", api_get_person_name($this_user['firstname'], $this_user['lastname']), |
965 | 965 | "</option>"; |
966 | 966 | } |
@@ -1073,14 +1073,14 @@ discard block |
||
1073 | 1073 | switch ($to_group) { |
1074 | 1074 | // it was send to one specific user |
1075 | 1075 | case null: |
1076 | - $to[] = "USER:" . $row['to_user_id']; |
|
1076 | + $to[] = "USER:".$row['to_user_id']; |
|
1077 | 1077 | break; |
1078 | 1078 | // it was sent to everyone |
1079 | 1079 | case 0: |
1080 | 1080 | return "everyone"; |
1081 | 1081 | break; |
1082 | 1082 | default: |
1083 | - $to[] = "GROUP:" . $row['to_group_id']; |
|
1083 | + $to[] = "GROUP:".$row['to_group_id']; |
|
1084 | 1084 | } |
1085 | 1085 | } |
1086 | 1086 | return $to; |
@@ -1161,10 +1161,10 @@ discard block |
||
1161 | 1161 | $sent_to_array['groups'][0] !== 0 |
1162 | 1162 | ) { |
1163 | 1163 | $group_id = $sent_to_array['groups'][0]; |
1164 | - $output[] = " " . $group_names[$group_id]['name']; |
|
1164 | + $output[] = " ".$group_names[$group_id]['name']; |
|
1165 | 1165 | } |
1166 | 1166 | if (empty($sent_to_array['groups']) and empty($sent_to_array['users'])) { |
1167 | - $output[] = " " . get_lang('Everybody'); |
|
1167 | + $output[] = " ".get_lang('Everybody'); |
|
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | |
1200 | 1200 | $sql = "SELECT to_group_id, to_user_id |
1201 | 1201 | FROM $tbl_item_property |
1202 | - WHERE c_id = $course_id AND tool = '$tool' AND ref=" . $id; |
|
1202 | + WHERE c_id = $course_id AND tool = '$tool' AND ref=".$id; |
|
1203 | 1203 | $result = Database::query($sql); |
1204 | 1204 | |
1205 | 1205 | while ($row = Database::fetch_array($result)) { |
@@ -1238,8 +1238,8 @@ discard block |
||
1238 | 1238 | $announcement_id = intval($announcement_id); |
1239 | 1239 | $course_id = api_get_course_int_id(); |
1240 | 1240 | $row = array(); |
1241 | - $sql = 'SELECT id, path, filename, comment FROM ' . $tbl_announcement_attachment . ' |
|
1242 | - WHERE c_id = ' . $course_id . ' AND announcement_id = ' . $announcement_id . ''; |
|
1241 | + $sql = 'SELECT id, path, filename, comment FROM '.$tbl_announcement_attachment.' |
|
1242 | + WHERE c_id = ' . $course_id.' AND announcement_id = '.$announcement_id.''; |
|
1243 | 1243 | $result = Database::query($sql); |
1244 | 1244 | if (Database::num_rows($result) != 0) { |
1245 | 1245 | $row = Database::fetch_array($result, 'ASSOC'); |
@@ -1264,9 +1264,9 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | if (is_array($file) && $file['error'] == 0) { |
1266 | 1266 | // TODO: This path is obsolete. The new document repository scheme should be kept in mind here. |
1267 | - $courseDir = $_course['path'] . '/upload/announcements'; |
|
1267 | + $courseDir = $_course['path'].'/upload/announcements'; |
|
1268 | 1268 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
1269 | - $updir = $sys_course_path . $courseDir; |
|
1269 | + $updir = $sys_course_path.$courseDir; |
|
1270 | 1270 | |
1271 | 1271 | // Try to add an extension to the file if it hasn't one |
1272 | 1272 | $new_file_name = add_ext_on_mime(stripslashes($file['name']), $file['type']); |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
1279 | 1279 | } else { |
1280 | 1280 | $new_file_name = uniqid(''); |
1281 | - $new_path = $updir . '/' . $new_file_name; |
|
1281 | + $new_path = $updir.'/'.$new_file_name; |
|
1282 | 1282 | move_uploaded_file($file['tmp_name'], $new_path); |
1283 | 1283 | |
1284 | 1284 | $params = [ |
@@ -1319,9 +1319,9 @@ discard block |
||
1319 | 1319 | |
1320 | 1320 | if (is_array($file) && $file['error'] == 0) { |
1321 | 1321 | // TODO: This path is obsolete. The new document repository scheme should be kept in mind here. |
1322 | - $courseDir = $_course['path'] . '/upload/announcements'; |
|
1322 | + $courseDir = $_course['path'].'/upload/announcements'; |
|
1323 | 1323 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
1324 | - $updir = $sys_course_path . $courseDir; |
|
1324 | + $updir = $sys_course_path.$courseDir; |
|
1325 | 1325 | |
1326 | 1326 | // Try to add an extension to the file if it hasn't one |
1327 | 1327 | $new_file_name = add_ext_on_mime(stripslashes($file['name']), $file['type']); |
@@ -1333,13 +1333,13 @@ discard block |
||
1333 | 1333 | Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
1334 | 1334 | } else { |
1335 | 1335 | $new_file_name = uniqid(''); |
1336 | - $new_path = $updir . '/' . $new_file_name; |
|
1336 | + $new_path = $updir.'/'.$new_file_name; |
|
1337 | 1337 | @move_uploaded_file($file['tmp_name'], $new_path); |
1338 | 1338 | $safe_file_comment = Database::escape_string($file_comment); |
1339 | 1339 | $safe_file_name = Database::escape_string($file_name); |
1340 | 1340 | $safe_new_file_name = Database::escape_string($new_file_name); |
1341 | 1341 | $id_attach = intval($id_attach); |
1342 | - $sql = "UPDATE $tbl_announcement_attachment SET filename = '$safe_file_name', comment = '$safe_file_comment', path = '$safe_new_file_name', size ='" . intval($file['size']) . "' |
|
1342 | + $sql = "UPDATE $tbl_announcement_attachment SET filename = '$safe_file_name', comment = '$safe_file_comment', path = '$safe_new_file_name', size ='".intval($file['size'])."' |
|
1343 | 1343 | WHERE c_id = $course_id AND id = '$id_attach'"; |
1344 | 1344 | $result = Database::query($sql); |
1345 | 1345 | if ($result === false) { |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | |
1442 | 1442 | //if (!empty($user_id)) { |
1443 | 1443 | if (0) { |
1444 | - if (is_array($group_memberships) && count($group_memberships) > 0 ) { |
|
1444 | + if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
1445 | 1445 | $sql = "SELECT $select |
1446 | 1446 | FROM $tbl_announcement announcement, $tbl_item_property ip |
1447 | 1447 | WHERE |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | } |
1525 | 1525 | } else { |
1526 | 1526 | // STUDENT |
1527 | - if (is_array($group_memberships) && count($group_memberships)>0) { |
|
1527 | + if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
1528 | 1528 | if ($allowUserEditSetting && !api_is_anonymous()) { |
1529 | 1529 | if (api_get_group_id() == 0) { |
1530 | 1530 | // No group |
@@ -1651,8 +1651,8 @@ discard block |
||
1651 | 1651 | $attachment_list = AnnouncementManager::get_attachment($myrow['id']); |
1652 | 1652 | |
1653 | 1653 | $attachment_icon = ''; |
1654 | - if (count($attachment_list)>0) { |
|
1655 | - $attachment_icon = ' '.Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
1654 | + if (count($attachment_list) > 0) { |
|
1655 | + $attachment_icon = ' '.Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
1656 | 1656 | } |
1657 | 1657 | |
1658 | 1658 | /* TITLE */ |
@@ -1671,16 +1671,16 @@ discard block |
||
1671 | 1671 | || (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) |
1672 | 1672 | ) { |
1673 | 1673 | $modify_icons = "<a href=\"".$actionUrl."&action=modify&id=".$myrow['id']."\">". |
1674 | - Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL)."</a>"; |
|
1675 | - if ($myrow['visibility']==1) { |
|
1676 | - $image_visibility="visible"; |
|
1677 | - $alt_visibility=get_lang('Hide'); |
|
1674 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>"; |
|
1675 | + if ($myrow['visibility'] == 1) { |
|
1676 | + $image_visibility = "visible"; |
|
1677 | + $alt_visibility = get_lang('Hide'); |
|
1678 | 1678 | } else { |
1679 | - $image_visibility="invisible"; |
|
1680 | - $alt_visibility=get_lang('Visible'); |
|
1679 | + $image_visibility = "invisible"; |
|
1680 | + $alt_visibility = get_lang('Visible'); |
|
1681 | 1681 | } |
1682 | - $modify_icons .= "<a href=\"".$actionUrl."&origin=".$origin."&action=showhide&id=".$myrow['id']."&sec_token=".$stok."\">". |
|
1683 | - Display::return_icon($image_visibility.'.png', $alt_visibility,'',ICON_SIZE_SMALL)."</a>"; |
|
1682 | + $modify_icons .= "<a href=\"".$actionUrl."&origin=".$origin."&action=showhide&id=".$myrow['id']."&sec_token=".$stok."\">". |
|
1683 | + Display::return_icon($image_visibility.'.png', $alt_visibility, '', ICON_SIZE_SMALL)."</a>"; |
|
1684 | 1684 | |
1685 | 1685 | // DISPLAY MOVE UP COMMAND only if it is not the top announcement |
1686 | 1686 | if ($iterator != 1) { |
@@ -1695,12 +1695,12 @@ discard block |
||
1695 | 1695 | } else { |
1696 | 1696 | $modify_icons .= Display::return_icon('down_na.gif', get_lang('Down')); |
1697 | 1697 | } |
1698 | - if (api_is_allowed_to_edit(false,true)) { |
|
1699 | - $modify_icons .= "<a href=\"".$actionUrl."&action=delete&id=".$myrow['id']."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,api_get_system_encoding()))."')) return false;\">". |
|
1700 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL). |
|
1698 | + if (api_is_allowed_to_edit(false, true)) { |
|
1699 | + $modify_icons .= "<a href=\"".$actionUrl."&action=delete&id=".$myrow['id']."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, api_get_system_encoding()))."')) return false;\">". |
|
1700 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL). |
|
1701 | 1701 | "</a>"; |
1702 | 1702 | } |
1703 | - $iterator ++; |
|
1703 | + $iterator++; |
|
1704 | 1704 | } else { |
1705 | 1705 | $modify_icons = Display::url( |
1706 | 1706 | Display::return_icon('default.png'), |
@@ -1730,7 +1730,7 @@ discard block |
||
1730 | 1730 | public static function getNumberAnnouncements() |
1731 | 1731 | { |
1732 | 1732 | // Maximum title messages to display |
1733 | - $maximum = '12'; |
|
1733 | + $maximum = '12'; |
|
1734 | 1734 | // Database Table Definitions |
1735 | 1735 | $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
1736 | 1736 | $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
@@ -1741,7 +1741,7 @@ discard block |
||
1741 | 1741 | $userId = api_get_user_id(); |
1742 | 1742 | $condition_session = api_get_session_condition($session_id, true, true, 'announcement.session_id'); |
1743 | 1743 | |
1744 | - if (api_is_allowed_to_edit(false,true)) { |
|
1744 | + if (api_is_allowed_to_edit(false, true)) { |
|
1745 | 1745 | // check teacher status |
1746 | 1746 | if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') { |
1747 | 1747 | |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | } |
1805 | 1805 | |
1806 | 1806 | // the user is member of several groups => display personal announcements AND his group announcements AND the general announcements |
1807 | - if (is_array($group_memberships) && count($group_memberships)>0) { |
|
1807 | + if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
1808 | 1808 | $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
1809 | 1809 | FROM $tbl_announcement announcement, $tbl_item_property ip |
1810 | 1810 | WHERE |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | } |
1855 | 1855 | |
1856 | 1856 | // the user is not identiefied => show only the general announcements |
1857 | - $sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
|
1857 | + $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
|
1858 | 1858 | FROM $tbl_announcement announcement, $tbl_item_property ip |
1859 | 1859 | WHERE |
1860 | 1860 | announcement.c_id = $course_id AND |