@@ -7,40 +7,40 @@ |
||
7 | 7 | require_once '../inc/global.inc.php'; |
8 | 8 | api_block_anonymous_users(); |
9 | 9 | if (api_get_setting('allow_message_tool')!='true') { |
10 | - api_not_allowed(); |
|
10 | + api_not_allowed(); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') { |
14 | - $this_section = SECTION_SOCIAL; |
|
15 | - $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); |
|
16 | - $interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox')); |
|
14 | + $this_section = SECTION_SOCIAL; |
|
15 | + $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); |
|
16 | + $interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox')); |
|
17 | 17 | } else { |
18 | - $this_section = SECTION_MYPROFILE; |
|
19 | - $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile')); |
|
18 | + $this_section = SECTION_MYPROFILE; |
|
19 | + $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile')); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | $social_right_content = ''; |
23 | 23 | |
24 | 24 | if (isset($_GET['f']) && $_GET['f']=='social') { |
25 | - $social_parameter = '?f=social'; |
|
25 | + $social_parameter = '?f=social'; |
|
26 | 26 | } else { |
27 | - if (api_get_setting('extended_profile') == 'true') { |
|
28 | - $social_right_content .= '<div class="actions">'; |
|
27 | + if (api_get_setting('extended_profile') == 'true') { |
|
28 | + $social_right_content .= '<div class="actions">'; |
|
29 | 29 | |
30 | - if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') { |
|
31 | - $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'. |
|
30 | + if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') { |
|
31 | + $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'. |
|
32 | 32 | Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>'; |
33 | - } |
|
34 | - if (api_get_setting('allow_message_tool') === 'true') { |
|
35 | - $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. |
|
33 | + } |
|
34 | + if (api_get_setting('allow_message_tool') === 'true') { |
|
35 | + $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. |
|
36 | 36 | Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>'; |
37 | 37 | $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. |
38 | 38 | Display::return_icon('inbox.png',get_lang('Inbox')).'</a>'; |
39 | 39 | $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'. |
40 | 40 | Display::return_icon('outbox.png',get_lang('Outbox')).'</a>'; |
41 | - } |
|
42 | - $social_right_content .= '</div>'; |
|
43 | - } |
|
41 | + } |
|
42 | + $social_right_content .= '</div>'; |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if (empty($_GET['id'])) { |
@@ -67,37 +67,37 @@ discard block |
||
67 | 67 | * Shows the compose area + a list of users to select from. |
68 | 68 | */ |
69 | 69 | function show_compose_to_any($user_id) { |
70 | - $online_user_list = MessageManager::get_online_user_list($user_id); |
|
71 | - $default['user_list'] = 0; |
|
72 | - $online_user_list=null; |
|
73 | - $html = manage_form($default, $online_user_list); |
|
70 | + $online_user_list = MessageManager::get_online_user_list($user_id); |
|
71 | + $default['user_list'] = 0; |
|
72 | + $online_user_list=null; |
|
73 | + $html = manage_form($default, $online_user_list); |
|
74 | 74 | return $html; |
75 | 75 | } |
76 | 76 | |
77 | 77 | function show_compose_reply_to_message($message_id, $receiver_id) |
78 | 78 | { |
79 | - $table_message = Database::get_main_table(TABLE_MESSAGE); |
|
80 | - $query = "SELECT user_sender_id FROM $table_message |
|
79 | + $table_message = Database::get_main_table(TABLE_MESSAGE); |
|
80 | + $query = "SELECT user_sender_id FROM $table_message |
|
81 | 81 | WHERE user_receiver_id=".intval($receiver_id)." AND id='".intval($message_id)."';"; |
82 | - $result = Database::query($query); |
|
83 | - $row = Database::fetch_array($result,'ASSOC'); |
|
84 | - if (!isset($row['user_sender_id'])) { |
|
85 | - $html = get_lang('InvalidMessageId'); |
|
82 | + $result = Database::query($query); |
|
83 | + $row = Database::fetch_array($result,'ASSOC'); |
|
84 | + if (!isset($row['user_sender_id'])) { |
|
85 | + $html = get_lang('InvalidMessageId'); |
|
86 | 86 | |
87 | - return $html; |
|
88 | - } |
|
89 | - $userInfo = api_get_user_info($row['user_sender_id']); |
|
90 | - $default['users'] = array($row['user_sender_id']); |
|
91 | - $html = manage_form($default, null, $userInfo['complete_name']); |
|
87 | + return $html; |
|
88 | + } |
|
89 | + $userInfo = api_get_user_info($row['user_sender_id']); |
|
90 | + $default['users'] = array($row['user_sender_id']); |
|
91 | + $html = manage_form($default, null, $userInfo['complete_name']); |
|
92 | 92 | |
93 | 93 | return $html; |
94 | 94 | } |
95 | 95 | |
96 | 96 | function show_compose_to_user ($receiver_id) { |
97 | - $html = get_lang('To').': <strong>'.GetFullUserName($receiver_id).'</strong>'; |
|
98 | - $default['title'] = api_xml_http_response_encode(get_lang('EnterTitle')); |
|
99 | - $default['users'] = array($receiver_id); |
|
100 | - $html .= manage_form($default); |
|
97 | + $html = get_lang('To').': <strong>'.GetFullUserName($receiver_id).'</strong>'; |
|
98 | + $default['title'] = api_xml_http_response_encode(get_lang('EnterTitle')); |
|
99 | + $default['users'] = array($receiver_id); |
|
100 | + $html .= manage_form($default); |
|
101 | 101 | return $html; |
102 | 102 | } |
103 | 103 | |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | |
253 | 253 | /* MAIN SECTION */ |
254 | 254 | if ($socialToolIsActive) { |
255 | - $this_section = SECTION_SOCIAL; |
|
255 | + $this_section = SECTION_SOCIAL; |
|
256 | 256 | $interbreadcrumb[] = array( |
257 | 257 | 'url' => api_get_path(WEB_PATH).'main/social/home.php', |
258 | 258 | 'name' => get_lang('SocialNetwork'), |
259 | 259 | ); |
260 | 260 | } else { |
261 | - $this_section = SECTION_MYPROFILE; |
|
261 | + $this_section = SECTION_MYPROFILE; |
|
262 | 262 | $interbreadcrumb[] = array( |
263 | 263 | 'url' => api_get_path(WEB_PATH).'main/auth/profile.php', |
264 | 264 | 'name' => get_lang('Profile'), |
@@ -268,30 +268,30 @@ discard block |
||
268 | 268 | $group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null; |
269 | 269 | $social_right_content = null; |
270 | 270 | if ($group_id != 0) { |
271 | - $social_right_content .= '<div class=actions>'; |
|
272 | - $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'. |
|
273 | - Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>'; |
|
274 | - $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'. |
|
275 | - Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>'; |
|
276 | - $social_right_content .= '</div>'; |
|
271 | + $social_right_content .= '<div class=actions>'; |
|
272 | + $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'. |
|
273 | + Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>'; |
|
274 | + $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'. |
|
275 | + Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>'; |
|
276 | + $social_right_content .= '</div>'; |
|
277 | 277 | } else { |
278 | - if ($socialToolIsActive) { |
|
279 | - } else { |
|
280 | - $social_right_content .= '<div class=actions>'; |
|
281 | - if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') { |
|
282 | - $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'. |
|
278 | + if ($socialToolIsActive) { |
|
279 | + } else { |
|
280 | + $social_right_content .= '<div class=actions>'; |
|
281 | + if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') { |
|
282 | + $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'. |
|
283 | 283 | Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>'; |
284 | - } |
|
285 | - if (api_get_setting('allow_message_tool') === 'true') { |
|
286 | - $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. |
|
284 | + } |
|
285 | + if (api_get_setting('allow_message_tool') === 'true') { |
|
286 | + $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. |
|
287 | 287 | Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>'; |
288 | - $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. |
|
288 | + $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. |
|
289 | 289 | Display::return_icon('inbox.png',get_lang('Inbox')).'</a>'; |
290 | 290 | $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'. |
291 | 291 | Display::return_icon('outbox.png',get_lang('Outbox')).'</a>'; |
292 | - } |
|
293 | - $social_right_content .= '</div>'; |
|
294 | - } |
|
292 | + } |
|
293 | + $social_right_content .= '</div>'; |
|
294 | + } |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | // LEFT COLUMN |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $message .= '<p><a class="btn btn-primary" href="'.api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq().'">'. |
45 | 45 | get_lang('No').'</a> <a class="btn btn-danger" href="'.api_get_self().'?delete=yes&'.api_get_cidreq().'">'. |
46 | 46 | get_lang('Yes').'</a></p>'; |
47 | - $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); |
|
47 | + $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); |
|
48 | 48 | } |
49 | 49 | Display :: display_header($tool_name, 'Settings'); |
50 | 50 | echo Display::page_header($tool_name); |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | $this_section = SECTION_COURSES; |
11 | 11 | |
12 | 12 | if (isset($_GET['session']) && $_GET['session']) { |
13 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
14 | - $_cid = true; |
|
15 | - $is_courseAdmin = true; |
|
13 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
14 | + $_cid = true; |
|
15 | + $is_courseAdmin = true; |
|
16 | 16 | } else { |
17 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
17 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | $archive_file = isset($_GET['archive']) ? $_GET['archive'] : null; |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | list($extension) = getextension($archive_file); |
24 | 24 | |
25 | 25 | if (empty($extension) || !file_exists($archive_path.$archive_file)) { |
26 | - exit; |
|
26 | + exit; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $extension = strtolower($extension); |
30 | 30 | $content_type = ''; |
31 | 31 | |
32 | 32 | if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) { |
33 | - $content_type = 'application/force-download'; |
|
33 | + $content_type = 'application/force-download'; |
|
34 | 34 | } elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) { |
35 | - $content_type = 'application/force-download'; |
|
35 | + $content_type = 'application/force-download'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if (empty($content_type)) { |
@@ -20,32 +20,32 @@ discard block |
||
20 | 20 | $i=1; |
21 | 21 | echo '<div class="actions" style="margin-bottom:30px">'; |
22 | 22 | echo '<a href="index.php?'.api_get_cidreq().'">'. |
23 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | - '</a>'; |
|
23 | + Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | + '</a>'; |
|
25 | 25 | ksort($categories); |
26 | 26 | foreach ($categories as $id => $title) { |
27 | - if ($i == ADD_BLOCK) { |
|
28 | - echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
29 | - Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>'; |
|
30 | - break; |
|
31 | - } else { |
|
32 | - echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
33 | - Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | - $i++; |
|
35 | - } |
|
27 | + if ($i == ADD_BLOCK) { |
|
28 | + echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
29 | + Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>'; |
|
30 | + break; |
|
31 | + } else { |
|
32 | + echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
33 | + Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | + $i++; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | echo '</div>'; |
38 | 38 | |
39 | 39 | // error messages |
40 | 40 | if (isset($error) && intval($error) == 1) { |
41 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
41 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // default header title form |
45 | 45 | $header = ''; |
46 | 46 | $description_type = intval($description_type); |
47 | 47 | if ($description_type >= ADD_BLOCK) { |
48 | - $header = $default_description_titles[ADD_BLOCK]; |
|
48 | + $header = $default_description_titles[ADD_BLOCK]; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // display form |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | |
74 | 74 | // display default questions |
75 | 75 | if (isset ($question[$description_type])) { |
76 | - $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
77 | - $message .= $question[$description_type]; |
|
78 | - Display::display_normal_message($message, false); |
|
76 | + $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
77 | + $message .= $question[$description_type]; |
|
78 | + Display::display_normal_message($message, false); |
|
79 | 79 | } |
80 | 80 | $form->display(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $event = $agenda->get_event($id); |
44 | 44 | |
45 | 45 | if (!empty($event)) { |
46 | - define('ICAL_LANG',api_get_language_isocode()); |
|
46 | + define('ICAL_LANG',api_get_language_isocode()); |
|
47 | 47 | |
48 | 48 | $ical = new vcalendar(); |
49 | 49 | $ical->setConfig('unique_id',api_get_path(WEB_PATH)); |
@@ -137,6 +137,6 @@ discard block |
||
137 | 137 | die(); |
138 | 138 | } |
139 | 139 | } else { |
140 | - header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER'])); |
|
141 | - exit; |
|
140 | + header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER'])); |
|
141 | + exit; |
|
142 | 142 | } |
@@ -6,47 +6,47 @@ discard block |
||
6 | 6 | */ |
7 | 7 | class AddCourseToSession |
8 | 8 | { |
9 | - /** |
|
10 | - * Searches a course, given a search string and a type of search box |
|
11 | - * @param string $needle Search string |
|
12 | - * @param string $type Type of search box ('single' or anything else) |
|
13 | - * @return xajaxResponse XajaxResponse |
|
14 | - * @assert ('abc', 'single') !== null |
|
15 | - * @assert ('abc', 'multiple') !== null |
|
16 | - */ |
|
17 | - public static function search_courses($needle, $type) |
|
18 | - { |
|
19 | - global $tbl_session_rel_course, $id_session; |
|
9 | + /** |
|
10 | + * Searches a course, given a search string and a type of search box |
|
11 | + * @param string $needle Search string |
|
12 | + * @param string $type Type of search box ('single' or anything else) |
|
13 | + * @return xajaxResponse XajaxResponse |
|
14 | + * @assert ('abc', 'single') !== null |
|
15 | + * @assert ('abc', 'multiple') !== null |
|
16 | + */ |
|
17 | + public static function search_courses($needle, $type) |
|
18 | + { |
|
19 | + global $tbl_session_rel_course, $id_session; |
|
20 | 20 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
21 | - $course_title = null; |
|
22 | - $xajax_response = new xajaxResponse(); |
|
23 | - $return = ''; |
|
24 | - if(!empty($needle) && !empty($type)) { |
|
25 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
26 | - $charset = api_get_system_encoding(); |
|
27 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
21 | + $course_title = null; |
|
22 | + $xajax_response = new xajaxResponse(); |
|
23 | + $return = ''; |
|
24 | + if(!empty($needle) && !empty($type)) { |
|
25 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
26 | + $charset = api_get_system_encoding(); |
|
27 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
28 | 28 | |
29 | - $cond_course_code = ''; |
|
30 | - if (!empty($id_session)) { |
|
31 | - $id_session = intval($id_session); |
|
32 | - // check course_code from session_rel_course table |
|
33 | - $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
29 | + $cond_course_code = ''; |
|
30 | + if (!empty($id_session)) { |
|
31 | + $id_session = intval($id_session); |
|
32 | + // check course_code from session_rel_course table |
|
33 | + $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
34 | 34 | WHERE session_id = '.$id_session; |
35 | - $res = Database::query($sql); |
|
36 | - $course_codes = ''; |
|
37 | - if (Database::num_rows($res) > 0) { |
|
38 | - while ($row = Database::fetch_row($res)) { |
|
39 | - $course_codes .= '\''.$row[0].'\','; |
|
40 | - } |
|
41 | - $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
35 | + $res = Database::query($sql); |
|
36 | + $course_codes = ''; |
|
37 | + if (Database::num_rows($res) > 0) { |
|
38 | + while ($row = Database::fetch_row($res)) { |
|
39 | + $course_codes .= '\''.$row[0].'\','; |
|
40 | + } |
|
41 | + $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
42 | 42 | |
43 | - $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
44 | - } |
|
45 | - } |
|
43 | + $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | 47 | if ($type == 'single') { |
48 | - // search users where username or firstname or lastname begins likes $needle |
|
49 | - $sql = 'SELECT |
|
48 | + // search users where username or firstname or lastname begins likes $needle |
|
49 | + $sql = 'SELECT |
|
50 | 50 | course.code, |
51 | 51 | course.visual_code, |
52 | 52 | course.title, |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | WHERE |
59 | 59 | course.visual_code LIKE "'.$needle.'%" OR |
60 | 60 | course.title LIKE "'.$needle.'%"'; |
61 | - } else { |
|
62 | - $sql = 'SELECT course.code, course.visual_code, course.title |
|
61 | + } else { |
|
62 | + $sql = 'SELECT course.code, course.visual_code, course.title |
|
63 | 63 | FROM '.$tbl_course.' course |
64 | 64 | WHERE |
65 | 65 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
66 | 66 | ORDER BY course.code '; |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - if (api_is_multiple_url_enabled()) { |
|
70 | - $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
71 | - $access_url_id = api_get_current_access_url_id(); |
|
72 | - if ($access_url_id != -1){ |
|
69 | + if (api_is_multiple_url_enabled()) { |
|
70 | + $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
71 | + $access_url_id = api_get_current_access_url_id(); |
|
72 | + if ($access_url_id != -1){ |
|
73 | 73 | |
74 | - if ($type=='single') { |
|
75 | - $sql = 'SELECT |
|
74 | + if ($type=='single') { |
|
75 | + $sql = 'SELECT |
|
76 | 76 | course.code, |
77 | 77 | course.visual_code, |
78 | 78 | course.title, |
@@ -87,41 +87,41 @@ discard block |
||
87 | 87 | access_url_id = '.$access_url_id.' AND |
88 | 88 | (course.visual_code LIKE "'.$needle.'%" OR |
89 | 89 | course.title LIKE "'.$needle.'%" )'; |
90 | - } else { |
|
91 | - $sql = 'SELECT course.code, course.visual_code, course.title |
|
90 | + } else { |
|
91 | + $sql = 'SELECT course.code, course.visual_code, course.title |
|
92 | 92 | FROM '.$tbl_course.' course, '.$tbl_course_rel_access_url.' url_course |
93 | 93 | WHERE |
94 | 94 | url_course.c_id = course.id AND |
95 | 95 | access_url_id = '.$access_url_id.' AND |
96 | 96 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
97 | 97 | ORDER BY course.code '; |
98 | - } |
|
99 | - } |
|
100 | - } |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - $rs = Database::query($sql); |
|
103 | - $course_list = array(); |
|
102 | + $rs = Database::query($sql); |
|
103 | + $course_list = array(); |
|
104 | 104 | if ($type == 'single') { |
105 | - while ($course = Database :: fetch_array($rs)) { |
|
106 | - $course_list[] = $course['code']; |
|
107 | - $course_title=str_replace("'","\'",$course_title); |
|
108 | - $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 />'; |
|
109 | - } |
|
110 | - $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | - } else { |
|
112 | - $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
113 | - while($course = Database :: fetch_array($rs)) { |
|
114 | - $course_list[] = $course['code']; |
|
115 | - $course_title=str_replace("'","\'",$course_title); |
|
116 | - $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
117 | - } |
|
118 | - $return .= '</select>'; |
|
105 | + while ($course = Database :: fetch_array($rs)) { |
|
106 | + $course_list[] = $course['code']; |
|
107 | + $course_title=str_replace("'","\'",$course_title); |
|
108 | + $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 />'; |
|
109 | + } |
|
110 | + $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | + } else { |
|
112 | + $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
113 | + while($course = Database :: fetch_array($rs)) { |
|
114 | + $course_list[] = $course['code']; |
|
115 | + $course_title=str_replace("'","\'",$course_title); |
|
116 | + $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
117 | + } |
|
118 | + $return .= '</select>'; |
|
119 | 119 | |
120 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
121 | - } |
|
122 | - } |
|
123 | - $_SESSION['course_list'] = $course_list; |
|
120 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
121 | + } |
|
122 | + } |
|
123 | + $_SESSION['course_list'] = $course_list; |
|
124 | 124 | |
125 | - return $xajax_response; |
|
126 | - } |
|
125 | + return $xajax_response; |
|
126 | + } |
|
127 | 127 | } |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Export tabular data to XML-file |
|
119 | - * @param array Simple array of data to put in XML |
|
120 | - * @param string Name of file to be given to the user |
|
121 | - * @param string Name of common tag to place each line in |
|
122 | - * @param string Name of the root element. A root element should always be given. |
|
123 | - * @param string Encoding in which the data is provided |
|
124 | - */ |
|
118 | + * Export tabular data to XML-file |
|
119 | + * @param array Simple array of data to put in XML |
|
120 | + * @param string Name of file to be given to the user |
|
121 | + * @param string Name of common tag to place each line in |
|
122 | + * @param string Name of the root element. A root element should always be given. |
|
123 | + * @param string Encoding in which the data is provided |
|
124 | + */ |
|
125 | 125 | public static function arrayToXml( |
126 | 126 | $data, |
127 | 127 | $filename = 'export', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($data as $row) { |
201 | 201 | $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
202 | 202 | if (is_array($row['value'])) { |
203 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
203 | + $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
204 | 204 | $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
205 | 205 | } else { |
206 | 206 | $string .= $row['value']; |
@@ -25,29 +25,29 @@ |
||
25 | 25 | function search_courses($needle,$type) |
26 | 26 | { |
27 | 27 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
28 | - $xajax_response = new xajaxResponse(); |
|
29 | - $return = ''; |
|
30 | - if(!empty($needle) && !empty($type)) { |
|
31 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
32 | - $charset = api_get_system_encoding(); |
|
33 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
34 | - $needle = Database::escape_string($needle); |
|
28 | + $xajax_response = new xajaxResponse(); |
|
29 | + $return = ''; |
|
30 | + if(!empty($needle) && !empty($type)) { |
|
31 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
32 | + $charset = api_get_system_encoding(); |
|
33 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
34 | + $needle = Database::escape_string($needle); |
|
35 | 35 | |
36 | - $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
36 | + $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
37 | 37 | |
38 | - $rs = Database::query($sql); |
|
39 | - $course_list = array(); |
|
38 | + $rs = Database::query($sql); |
|
39 | + $course_list = array(); |
|
40 | 40 | |
41 | - $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
42 | - while($course = Database :: fetch_array($rs)) { |
|
43 | - $course_list[] = $course['id']; |
|
44 | - $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
45 | - } |
|
46 | - $return .= '</select>'; |
|
47 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
48 | - } |
|
49 | - $_SESSION['course_list'] = $course_list; |
|
41 | + $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
42 | + while($course = Database :: fetch_array($rs)) { |
|
43 | + $course_list[] = $course['id']; |
|
44 | + $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
45 | + } |
|
46 | + $return .= '</select>'; |
|
47 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
48 | + } |
|
49 | + $_SESSION['course_list'] = $course_list; |
|
50 | 50 | |
51 | - return $xajax_response; |
|
52 | - } |
|
51 | + return $xajax_response; |
|
52 | + } |
|
53 | 53 | } |