@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Responses to AJAX calls |
|
5 | - */ |
|
4 | + * Responses to AJAX calls |
|
5 | + */ |
|
6 | 6 | require_once '../global.inc.php'; |
7 | 7 | |
8 | 8 | //@todo for some reason nanogong doesn't like this variables |
@@ -16,84 +16,84 @@ discard block |
||
16 | 16 | //Fix in order to add the exe_id |
17 | 17 | |
18 | 18 | if (isset($_REQUEST['from_htaccess'])) { |
19 | - if (isset($_REQUEST['file'])) { |
|
20 | - $fileinfo = pathinfo($_REQUEST['file']); |
|
21 | - $items = explode('-', $fileinfo['filename']); |
|
22 | - $_REQUEST['exe_id'] = $items[5]; |
|
23 | - } |
|
19 | + if (isset($_REQUEST['file'])) { |
|
20 | + $fileinfo = pathinfo($_REQUEST['file']); |
|
21 | + $items = explode('-', $fileinfo['filename']); |
|
22 | + $_REQUEST['exe_id'] = $items[5]; |
|
23 | + } |
|
24 | 24 | } |
25 | 25 | $nano = new Nanogong($_REQUEST); |
26 | 26 | $is_nano = false; |
27 | 27 | |
28 | 28 | if (isset($_REQUEST['is_nano'])) { |
29 | - $is_nano = true; |
|
29 | + $is_nano = true; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | switch ($action) { |
33 | - case 'get_file': |
|
34 | - if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) { |
|
35 | - $file_path = $nano->load_filename_if_exists(); |
|
36 | - //$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3'; |
|
37 | - if ($file_path) { |
|
38 | - $info = pathinfo($file_path); |
|
39 | - $user_info = api_get_user_info($nano->params['user_id']); |
|
40 | - $name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension']; |
|
41 | - $download = true; |
|
42 | - if (isset($_REQUEST['download']) && $_REQUEST['download'] == 0) { |
|
43 | - $download = false; |
|
44 | - } |
|
45 | - DocumentManager::file_send_for_download($file_path, $download); |
|
46 | - exit; |
|
47 | - } |
|
48 | - } |
|
49 | - break; |
|
50 | - case 'show_audio': |
|
51 | - if (!$is_nano) { |
|
52 | - echo $nano->return_js($_REQUEST); |
|
53 | - } |
|
54 | - echo $nano->show_audio_file($is_nano); |
|
55 | - break; |
|
56 | - case 'delete': |
|
57 | - $return = $nano->delete_files(); |
|
58 | - if ($return == 1) { |
|
59 | - //cant' do this because the post that nano send doesnt take into account the session |
|
60 | - Display::display_confirmation_message(get_lang('FileDeleted')); |
|
61 | - } else { |
|
62 | - Display::display_confirmation_message(get_lang('FileNotFound')); |
|
63 | - } |
|
64 | - break; |
|
65 | - case 'show_form': |
|
66 | - api_protect_course_script(true); |
|
67 | - Display::display_reduced_header(); |
|
68 | - echo $nano->return_js($_REQUEST); |
|
69 | - echo $nano->return_form(); |
|
70 | - break; |
|
33 | + case 'get_file': |
|
34 | + if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) { |
|
35 | + $file_path = $nano->load_filename_if_exists(); |
|
36 | + //$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3'; |
|
37 | + if ($file_path) { |
|
38 | + $info = pathinfo($file_path); |
|
39 | + $user_info = api_get_user_info($nano->params['user_id']); |
|
40 | + $name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension']; |
|
41 | + $download = true; |
|
42 | + if (isset($_REQUEST['download']) && $_REQUEST['download'] == 0) { |
|
43 | + $download = false; |
|
44 | + } |
|
45 | + DocumentManager::file_send_for_download($file_path, $download); |
|
46 | + exit; |
|
47 | + } |
|
48 | + } |
|
49 | + break; |
|
50 | + case 'show_audio': |
|
51 | + if (!$is_nano) { |
|
52 | + echo $nano->return_js($_REQUEST); |
|
53 | + } |
|
54 | + echo $nano->show_audio_file($is_nano); |
|
55 | + break; |
|
56 | + case 'delete': |
|
57 | + $return = $nano->delete_files(); |
|
58 | + if ($return == 1) { |
|
59 | + //cant' do this because the post that nano send doesnt take into account the session |
|
60 | + Display::display_confirmation_message(get_lang('FileDeleted')); |
|
61 | + } else { |
|
62 | + Display::display_confirmation_message(get_lang('FileNotFound')); |
|
63 | + } |
|
64 | + break; |
|
65 | + case 'show_form': |
|
66 | + api_protect_course_script(true); |
|
67 | + Display::display_reduced_header(); |
|
68 | + echo $nano->return_js($_REQUEST); |
|
69 | + echo $nano->return_form(); |
|
70 | + break; |
|
71 | 71 | case 'save_file': |
72 | - //User access same as upload.php |
|
72 | + //User access same as upload.php |
|
73 | 73 | |
74 | - $return = $nano->upload_file($is_nano); |
|
74 | + $return = $nano->upload_file($is_nano); |
|
75 | 75 | |
76 | - if ($is_nano) { |
|
77 | - //nano looks for numbers |
|
78 | - if ($return == 1) { |
|
79 | - //cant' do this because the post that nano send doesnt take into account the session |
|
80 | - echo 1; //Display::display_confirmation_message(get_lang('UplUploadSucceeded')); |
|
81 | - } else { |
|
82 | - echo 0; |
|
83 | - //Display::display_warning_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
84 | - } |
|
85 | - } else { |
|
86 | - Display::display_reduced_header(); |
|
87 | - echo $nano->return_js($_REQUEST); |
|
88 | - //normal form |
|
89 | - if ($return == 1) { |
|
90 | - //cant' do this because the post that nano send doesnt take into account the session |
|
91 | - $message = Display::return_message(get_lang('UplUploadSucceeded'), 'confirm'); |
|
92 | - } else { |
|
93 | - $message = Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'warning'); |
|
94 | - } |
|
95 | - echo $nano->return_form($message); |
|
96 | - } |
|
76 | + if ($is_nano) { |
|
77 | + //nano looks for numbers |
|
78 | + if ($return == 1) { |
|
79 | + //cant' do this because the post that nano send doesnt take into account the session |
|
80 | + echo 1; //Display::display_confirmation_message(get_lang('UplUploadSucceeded')); |
|
81 | + } else { |
|
82 | + echo 0; |
|
83 | + //Display::display_warning_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
84 | + } |
|
85 | + } else { |
|
86 | + Display::display_reduced_header(); |
|
87 | + echo $nano->return_js($_REQUEST); |
|
88 | + //normal form |
|
89 | + if ($return == 1) { |
|
90 | + //cant' do this because the post that nano send doesnt take into account the session |
|
91 | + $message = Display::return_message(get_lang('UplUploadSucceeded'), 'confirm'); |
|
92 | + } else { |
|
93 | + $message = Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'warning'); |
|
94 | + } |
|
95 | + echo $nano->return_form($message); |
|
96 | + } |
|
97 | 97 | break; |
98 | 98 | default: |
99 | 99 | echo ''; |
@@ -488,7 +488,7 @@ |
||
488 | 488 | $remind_list |
489 | 489 | ); |
490 | 490 | |
491 | - // Destruction of the Question object |
|
491 | + // Destruction of the Question object |
|
492 | 492 | unset($objQuestionTmp); |
493 | 493 | if ($debug) { |
494 | 494 | error_log(" -- end question -- "); |
@@ -258,13 +258,13 @@ |
||
258 | 258 | ), 'first'); |
259 | 259 | |
260 | 260 | $coachName = api_get_person_name($userResult['firstname'], $userResult['lastname']); |
261 | - } |
|
261 | + } |
|
262 | 262 | |
263 | - $courses[] = array( |
|
264 | - 'id' => $courseId, |
|
265 | - 'name' => $course['title'], |
|
266 | - 'coachName' => $coachName, |
|
267 | - ); |
|
263 | + $courses[] = array( |
|
264 | + 'id' => $courseId, |
|
265 | + 'name' => $course['title'], |
|
266 | + 'coachName' => $coachName, |
|
267 | + ); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | echo json_encode($courses); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | // @todo refactor this script, create a class that manage the jqgrid requests |
4 | 4 | /** |
5 | - * Responses to AJAX calls |
|
5 | + * Responses to AJAX calls |
|
6 | 6 | */ |
7 | 7 | $action = $_GET['a']; |
8 | 8 | |
@@ -63,39 +63,39 @@ discard block |
||
63 | 63 | echo json_encode($response_data); |
64 | 64 | } |
65 | 65 | break; |
66 | - case 'show_course_information' : |
|
67 | - require_once '../global.inc.php'; |
|
68 | - |
|
69 | - // Get the name of the database course. |
|
70 | - $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); |
|
71 | - $course_info = api_get_course_info($_GET['code']); |
|
72 | - |
|
73 | - if ($course_info['visibility'] != COURSE_VISIBILITY_OPEN_WORLD) { |
|
74 | - if (api_is_anonymous()) { |
|
75 | - exit; |
|
76 | - } |
|
77 | - } |
|
78 | - //echo Display::tag('h2', $course_info['name']); |
|
79 | - //echo '<br />'; |
|
80 | - |
|
81 | - $sql = "SELECT * FROM $tbl_course_description |
|
66 | + case 'show_course_information' : |
|
67 | + require_once '../global.inc.php'; |
|
68 | + |
|
69 | + // Get the name of the database course. |
|
70 | + $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); |
|
71 | + $course_info = api_get_course_info($_GET['code']); |
|
72 | + |
|
73 | + if ($course_info['visibility'] != COURSE_VISIBILITY_OPEN_WORLD) { |
|
74 | + if (api_is_anonymous()) { |
|
75 | + exit; |
|
76 | + } |
|
77 | + } |
|
78 | + //echo Display::tag('h2', $course_info['name']); |
|
79 | + //echo '<br />'; |
|
80 | + |
|
81 | + $sql = "SELECT * FROM $tbl_course_description |
|
82 | 82 | WHERE c_id = ".$course_info['real_id']." AND session_id = 0 |
83 | 83 | ORDER BY id"; |
84 | - $result = Database::query($sql); |
|
85 | - if (Database::num_rows($result) > 0 ) { |
|
86 | - while ($description = Database::fetch_object($result)) { |
|
87 | - $descriptions[$description->id] = $description; |
|
88 | - } |
|
84 | + $result = Database::query($sql); |
|
85 | + if (Database::num_rows($result) > 0 ) { |
|
86 | + while ($description = Database::fetch_object($result)) { |
|
87 | + $descriptions[$description->id] = $description; |
|
88 | + } |
|
89 | 89 | // Function that displays the details of the course description in html. |
90 | - echo CourseManager::get_details_course_description_html( |
|
90 | + echo CourseManager::get_details_course_description_html( |
|
91 | 91 | $descriptions, |
92 | 92 | api_get_system_encoding(), |
93 | 93 | false |
94 | 94 | ); |
95 | - } else { |
|
96 | - echo get_lang('NoDescription'); |
|
97 | - } |
|
98 | - break; |
|
95 | + } else { |
|
96 | + echo get_lang('NoDescription'); |
|
97 | + } |
|
98 | + break; |
|
99 | 99 | case 'session_courses_lp_default': |
100 | 100 | /** |
101 | 101 | * @todo this functions need to belong to a class or a special |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id'; |
111 | 111 | $sord = $_REQUEST['sord']; //asc or desc |
112 | 112 | if (!in_array($sord, array('asc','desc'))) { |
113 | - $sord = 'desc'; |
|
113 | + $sord = 'desc'; |
|
114 | 114 | } |
115 | 115 | $session_id = intval($_REQUEST['session_id']); |
116 | 116 | $course_id = intval($_REQUEST['course_id']); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $my_session_list[] = $item['id_session']; |
126 | 126 | } |
127 | 127 | if (!in_array($session_id, $my_session_list)) { |
128 | - break; |
|
128 | + break; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $date = '-'; |
311 | 311 | } |
312 | 312 | |
313 | - //Checking LP publicated and expired_on dates |
|
313 | + //Checking LP publicated and expired_on dates |
|
314 | 314 | |
315 | 315 | if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') { |
316 | 316 | $week_data = date('Y', api_strtotime($lp_item['publicated_on'], 'UTC')).' - '.get_week_from_day($lp_item['publicated_on']); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $date = '-'; |
439 | 439 | } |
440 | 440 | |
441 | - //Checking LP publicated and expired_on dates |
|
441 | + //Checking LP publicated and expired_on dates |
|
442 | 442 | if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') { |
443 | 443 | if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) { |
444 | 444 | continue; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | |
493 | 493 | echo json_encode($response); |
494 | 494 | break; |
495 | - default: |
|
496 | - echo ''; |
|
495 | + default: |
|
496 | + echo ''; |
|
497 | 497 | } |
498 | 498 | exit; |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | } |
732 | 732 | |
733 | 733 | break; |
734 | - case 'get_user_skill_ranking': |
|
734 | + case 'get_user_skill_ranking': |
|
735 | 735 | $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank'); |
736 | 736 | $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $whereCondition); |
737 | 737 | $result = msort($result, 'skills_acquired', 'asc'); |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | |
1282 | 1282 | if (!empty($item['certif_min_score']) && !empty($item['document_id'])) { |
1283 | 1283 | $item['certificates'] = Display::return_icon('accept.png', get_lang('WithCertificate'), array(), ICON_SIZE_SMALL); |
1284 | - $item['has_certificates'] = '1'; |
|
1284 | + $item['has_certificates'] = '1'; |
|
1285 | 1285 | } else { |
1286 | 1286 | $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), ICON_SIZE_SMALL); |
1287 | 1287 | $item['has_certificates'] = '0'; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Responses to AJAX calls |
|
5 | - */ |
|
4 | + * Responses to AJAX calls |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | require_once '../global.inc.php'; |
8 | 8 |
@@ -758,7 +758,7 @@ |
||
758 | 758 | // $gidReset = true; |
759 | 759 | } // end else |
760 | 760 | |
761 | - // Now check for anonymous user mode |
|
761 | + // Now check for anonymous user mode |
|
762 | 762 | if (isset($use_anonymous) && $use_anonymous) { |
763 | 763 | //if anonymous mode is set, then try to set the current user as anonymous |
764 | 764 | //if he doesn't have a login yet |
@@ -1229,13 +1229,13 @@ discard block |
||
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | /** |
1232 | - * Get the users by ID |
|
1233 | - * @param array $ids student ids |
|
1234 | - * @param string $active |
|
1235 | - * @param string $order |
|
1236 | - * @param string $limit |
|
1237 | - * @return array $result student information |
|
1238 | - */ |
|
1232 | + * Get the users by ID |
|
1233 | + * @param array $ids student ids |
|
1234 | + * @param string $active |
|
1235 | + * @param string $order |
|
1236 | + * @param string $limit |
|
1237 | + * @return array $result student information |
|
1238 | + */ |
|
1239 | 1239 | public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null) |
1240 | 1240 | { |
1241 | 1241 | if (empty($ids)) { |
@@ -3332,12 +3332,12 @@ discard block |
||
3332 | 3332 | if ($tag_id == 0) { |
3333 | 3333 | //the tag doesn't exist |
3334 | 3334 | $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)"; |
3335 | - Database::query($sql); |
|
3335 | + Database::query($sql); |
|
3336 | 3336 | $last_insert_id = Database::insert_id(); |
3337 | 3337 | } else { |
3338 | 3338 | //the tag exists we update it |
3339 | 3339 | $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id = $tag_id"; |
3340 | - Database::query($sql); |
|
3340 | + Database::query($sql); |
|
3341 | 3341 | $last_insert_id = $tag_id; |
3342 | 3342 | } |
3343 | 3343 | |
@@ -3532,9 +3532,9 @@ discard block |
||
3532 | 3532 | } |
3533 | 3533 | |
3534 | 3534 | /** |
3535 | - * Get extra filtrable user fields (only type select) |
|
3536 | - * @return array |
|
3537 | - */ |
|
3535 | + * Get extra filtrable user fields (only type select) |
|
3536 | + * @return array |
|
3537 | + */ |
|
3538 | 3538 | public static function get_extra_filtrable_fields() |
3539 | 3539 | { |
3540 | 3540 | $extraFieldList = UserManager::get_extra_fields(); |
@@ -3559,9 +3559,9 @@ discard block |
||
3559 | 3559 | } |
3560 | 3560 | |
3561 | 3561 | /** |
3562 | - * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3563 | - * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3564 | - */ |
|
3562 | + * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3563 | + * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3564 | + */ |
|
3565 | 3565 | public static function get_search_form_where_extra_fields() |
3566 | 3566 | { |
3567 | 3567 | $useExtraFields = false; |
@@ -3869,23 +3869,23 @@ discard block |
||
3869 | 3869 | } |
3870 | 3870 | |
3871 | 3871 | /** |
3872 | - * Get users followed by human resource manager |
|
3873 | - * @param int $userId |
|
3874 | - * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3875 | - * @param bool $getOnlyUserId |
|
3876 | - * @param bool $getSql |
|
3877 | - * @param bool $getCount |
|
3878 | - * @param int $from |
|
3879 | - * @param int $numberItems |
|
3880 | - * @param int $column |
|
3881 | - * @param string $direction |
|
3882 | - * @param int $active |
|
3883 | - * @param string $lastConnectionDate |
|
3884 | - * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3885 | - * @param string $keyword |
|
3872 | + * Get users followed by human resource manager |
|
3873 | + * @param int $userId |
|
3874 | + * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3875 | + * @param bool $getOnlyUserId |
|
3876 | + * @param bool $getSql |
|
3877 | + * @param bool $getCount |
|
3878 | + * @param int $from |
|
3879 | + * @param int $numberItems |
|
3880 | + * @param int $column |
|
3881 | + * @param string $direction |
|
3882 | + * @param int $active |
|
3883 | + * @param string $lastConnectionDate |
|
3884 | + * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3885 | + * @param string $keyword |
|
3886 | 3886 | * |
3887 | - * @return array user list |
|
3888 | - */ |
|
3887 | + * @return array user list |
|
3888 | + */ |
|
3889 | 3889 | public static function getUsersFollowedByUser( |
3890 | 3890 | $userId, |
3891 | 3891 | $userStatus = null, |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Integrate svg-edit with Chamilo |
|
4 | - * @author Juan Carlos Raña Trabado |
|
5 | - * @since 25/september/2010 |
|
6 | - */ |
|
3 | + * Integrate svg-edit with Chamilo |
|
4 | + * @author Juan Carlos Raña Trabado |
|
5 | + * @since 25/september/2010 |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | require_once '../../../inc/global.inc.php';//hack for Chamilo |
9 | 9 | api_protect_course_script(); |