@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * @param int $status (optional) The user's status in the course |
717 | 717 | * @param int The user category in which this subscription will be classified |
718 | 718 | * |
719 | - * @return boolean true if subscription succeeds, boolean false otherwise. |
|
719 | + * @return false|string true if subscription succeeds, boolean false otherwise. |
|
720 | 720 | * @assert ('', '') === false |
721 | 721 | */ |
722 | 722 | public static function add_user_to_course($user_id, $courseCode, $status = STUDENT, $userCourseCategoryId = 0) |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * Checks wether a parameter exists. |
789 | 789 | * If it doesn't, the function displays an error message. |
790 | 790 | * |
791 | - * @return true if parameter is set and not empty, false otherwise |
|
791 | + * @return boolean if parameter is set and not empty, false otherwise |
|
792 | 792 | * @todo move function to better place, main_api ? |
793 | 793 | */ |
794 | 794 | public static function check_parameter($parameter, $error_message) |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | } |
813 | 813 | |
814 | 814 | /** |
815 | - * @return true if there already are one or more courses |
|
815 | + * @return boolean if there already are one or more courses |
|
816 | 816 | * with the same code OR visual_code (visualcode), false otherwise |
817 | 817 | */ |
818 | 818 | public static function course_code_exists($wanted_course_code) |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | /** |
986 | 986 | * @param int $userId |
987 | 987 | * @param array $courseInfo |
988 | - * @return bool |
|
988 | + * @return boolean|null |
|
989 | 989 | */ |
990 | 990 | public static function isUserSubscribedInCourseAsDrh($userId, $courseInfo) |
991 | 991 | { |
@@ -1091,10 +1091,10 @@ discard block |
||
1091 | 1091 | /** |
1092 | 1092 | * Is the user a teacher in the given course? |
1093 | 1093 | * |
1094 | - * @param $user_id , the id (int) of the user |
|
1094 | + * @param integer $user_id , the id (int) of the user |
|
1095 | 1095 | * @param $course_code , the course code |
1096 | 1096 | * |
1097 | - * @return true if the user is a teacher in the course, false otherwise |
|
1097 | + * @return boolean if the user is a teacher in the course, false otherwise |
|
1098 | 1098 | */ |
1099 | 1099 | public static function is_course_teacher($user_id, $course_code) |
1100 | 1100 | { |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | * @param int the id of the user |
1124 | 1124 | * @param int $courseId |
1125 | 1125 | * @deprecated linked_courses definition doesn't exists |
1126 | - * @return true if the user is registered in the real course or linked courses, false otherwise |
|
1126 | + * @return boolean if the user is registered in the real course or linked courses, false otherwise |
|
1127 | 1127 | */ |
1128 | 1128 | public static function is_user_subscribed_in_real_or_linked_course($user_id, $courseId, $session_id = '') |
1129 | 1129 | { |
@@ -1194,9 +1194,9 @@ discard block |
||
1194 | 1194 | * @param string $order_by the field to order the users by. |
1195 | 1195 | * Valid values are 'lastname', 'firstname', 'username', 'email', 'official_code' OR a part of a SQL statement |
1196 | 1196 | * that starts with ORDER BY ... |
1197 | - * @param null $filter_by_status if using the session_id: 0 or 2 (student, coach), |
|
1197 | + * @param integer|null $filter_by_status if using the session_id: 0 or 2 (student, coach), |
|
1198 | 1198 | * if using session_id = 0 STUDENT or COURSEMANAGER |
1199 | - * @param null $return_count |
|
1199 | + * @param boolean|null $return_count |
|
1200 | 1200 | * @param bool $add_reports |
1201 | 1201 | * @param bool $resumed_report |
1202 | 1202 | * @param array $extra_field |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | * @param int $courseId |
1944 | 1944 | * @param string $separator |
1945 | 1945 | * @param bool $add_link_to_profile |
1946 | - * @return null|string |
|
1946 | + * @return string |
|
1947 | 1947 | */ |
1948 | 1948 | public static function get_coachs_from_course_to_string( |
1949 | 1949 | $session_id = 0, |
@@ -2016,7 +2016,7 @@ discard block |
||
2016 | 2016 | * Get the list of groups from the course |
2017 | 2017 | * @param string $course_code |
2018 | 2018 | * @param int $session_id Session ID (optional) |
2019 | - * @param boolean $in_get_empty_group get empty groups (optional) |
|
2019 | + * @param integer $in_get_empty_group get empty groups (optional) |
|
2020 | 2020 | * @return array List of groups info |
2021 | 2021 | */ |
2022 | 2022 | public static function get_group_list_of_course($course_code, $session_id = 0, $in_get_empty_group = 0) |
@@ -2072,6 +2072,7 @@ discard block |
||
2072 | 2072 | * course. |
2073 | 2073 | * |
2074 | 2074 | * @param string The code of the course to delete |
2075 | + * @param string $code |
|
2075 | 2076 | * @todo When deleting a virtual course: unsubscribe users from that virtual |
2076 | 2077 | * course from the groups in the real course if they are not subscribed in |
2077 | 2078 | * that real course. |
@@ -2283,6 +2284,7 @@ discard block |
||
2283 | 2284 | * Sort courses for a specific user ?? |
2284 | 2285 | * @param int User ID |
2285 | 2286 | * @param string Course code |
2287 | + * @param integer $user_id |
|
2286 | 2288 | * @return int Minimum course order |
2287 | 2289 | * @todo Review documentation |
2288 | 2290 | */ |
@@ -2360,7 +2362,7 @@ discard block |
||
2360 | 2362 | * check if course exists |
2361 | 2363 | * @param string course_code |
2362 | 2364 | * @param string whether to accept virtual course codes or not |
2363 | - * @return true if exists, false else |
|
2365 | + * @return integer if exists, false else |
|
2364 | 2366 | */ |
2365 | 2367 | public static function course_exists($course_code, $accept_virtual = false) |
2366 | 2368 | { |
@@ -2379,9 +2381,9 @@ discard block |
||
2379 | 2381 | * Send an email to tutor after the auth-suscription of a student in your course |
2380 | 2382 | * @author Carlos Vargas <[email protected]>, Dokeos Latino |
2381 | 2383 | * @param int $user_id the id of the user |
2382 | - * @param string $course_code the course code |
|
2384 | + * @param string $courseId the course code |
|
2383 | 2385 | * @param bool $send_to_tutor_also |
2384 | - * @return string we return the message that is displayed when the action is successful |
|
2386 | + * @return false|null we return the message that is displayed when the action is successful |
|
2385 | 2387 | */ |
2386 | 2388 | public static function email_to_tutor($user_id, $courseId, $send_to_tutor_also = false) |
2387 | 2389 | { |
@@ -2624,6 +2626,7 @@ discard block |
||
2624 | 2626 | /** |
2625 | 2627 | * Get emails of tutors to course |
2626 | 2628 | * @param string Visual code |
2629 | + * @param integer $courseId |
|
2627 | 2630 | * @return array List of emails of tutors to course |
2628 | 2631 | * @author @author Carlos Vargas <[email protected]>, Dokeos Latino |
2629 | 2632 | * */ |
@@ -2647,6 +2650,7 @@ discard block |
||
2647 | 2650 | * Get coaches emails by session |
2648 | 2651 | * @param int session id |
2649 | 2652 | * @param int $courseId |
2653 | + * @param integer $session_id |
|
2650 | 2654 | * @return array array(email => name_tutor) by coach |
2651 | 2655 | * @author Carlos Vargas <[email protected]> |
2652 | 2656 | */ |
@@ -2695,7 +2699,9 @@ discard block |
||
2695 | 2699 | * @param string Field's internal variable name |
2696 | 2700 | * @param int Field's type |
2697 | 2701 | * @param string Field's language var name |
2698 | - * @return int new extra field id |
|
2702 | + * @param integer $fieldType |
|
2703 | + * @param string $default |
|
2704 | + * @return boolean new extra field id |
|
2699 | 2705 | */ |
2700 | 2706 | public static function create_course_extra_field($variable, $fieldType, $displayText, $default) |
2701 | 2707 | { |
@@ -2717,7 +2723,7 @@ discard block |
||
2717 | 2723 | * @param int Course id |
2718 | 2724 | * @param string Attribute name |
2719 | 2725 | * @param string Attribute value |
2720 | - * @return bool True if attribute was successfully updated, |
|
2726 | + * @return Doctrine\DBAL\Driver\Statement|null True if attribute was successfully updated, |
|
2721 | 2727 | * false if course was not found or attribute name is invalid |
2722 | 2728 | */ |
2723 | 2729 | public static function update_attribute($id, $name, $value) |
@@ -2735,7 +2741,7 @@ discard block |
||
2735 | 2741 | * |
2736 | 2742 | * @param int Course id |
2737 | 2743 | * @param array Associative array with field names as keys and field values as values |
2738 | - * @return bool True if update was successful, false otherwise |
|
2744 | + * @return Doctrine\DBAL\Driver\Statement|null True if update was successful, false otherwise |
|
2739 | 2745 | */ |
2740 | 2746 | public static function update_attributes($id, $attributes) |
2741 | 2747 | { |
@@ -2761,7 +2767,7 @@ discard block |
||
2761 | 2767 | * @param integer Course ID |
2762 | 2768 | * @param string Field variable name |
2763 | 2769 | * @param string Field value |
2764 | - * @return boolean true if field updated, false otherwise |
|
2770 | + * @return boolean|null true if field updated, false otherwise |
|
2765 | 2771 | */ |
2766 | 2772 | public static function update_course_extra_field_value($course_code, $variable, $value = '') |
2767 | 2773 | { |
@@ -3483,6 +3489,7 @@ discard block |
||
3483 | 3489 | * @uses displayCoursesInCategory() to display the courses themselves |
3484 | 3490 | * @param int user id |
3485 | 3491 | * @param bool Whether to show the document quick-loader or not |
3492 | + * @param integer $user_id |
|
3486 | 3493 | * @return string |
3487 | 3494 | */ |
3488 | 3495 | public static function display_courses($user_id, $load_dirs = false) |
@@ -4057,6 +4064,8 @@ discard block |
||
4057 | 4064 | * @param int source session id |
4058 | 4065 | * @param string destination course code |
4059 | 4066 | * @param int destination session id |
4067 | + * @param integer $source_session_id |
|
4068 | + * @param integer $destination_session_id |
|
4060 | 4069 | * @return bool |
4061 | 4070 | */ |
4062 | 4071 | public static function copy_course( |
@@ -4091,6 +4100,7 @@ discard block |
||
4091 | 4100 | * @param int source session id |
4092 | 4101 | * @param int destination session id |
4093 | 4102 | * @param bool new copied tools (Exercises and LPs)will be set to invisible by default? |
4103 | + * @param string $new_title |
|
4094 | 4104 | * |
4095 | 4105 | * @return array |
4096 | 4106 | */ |
@@ -4344,6 +4354,7 @@ discard block |
||
4344 | 4354 | * @param int course id |
4345 | 4355 | * @param int session id |
4346 | 4356 | * @param id url id |
4357 | + * @param integer $session_id |
|
4347 | 4358 | * @return array |
4348 | 4359 | **/ |
4349 | 4360 | public static function update_course_ranking( |
@@ -4426,7 +4437,7 @@ discard block |
||
4426 | 4437 | * @param int course id |
4427 | 4438 | * @param int session id |
4428 | 4439 | * @param int url id (access_url_id) |
4429 | - * @return mixed 'added', 'updated' or 'nothing' |
|
4440 | + * @return false|string 'added', 'updated' or 'nothing' |
|
4430 | 4441 | */ |
4431 | 4442 | public static function add_course_vote($user_id, $vote, $course_id, $session_id = null, $url_id = null) |
4432 | 4443 | { |
@@ -4681,6 +4692,7 @@ discard block |
||
4681 | 4692 | * Get courses count |
4682 | 4693 | * @param int Access URL ID (optional) |
4683 | 4694 | * @param int $visibility |
4695 | + * @param integer $access_url_id |
|
4684 | 4696 | * |
4685 | 4697 | * @return int Number of courses |
4686 | 4698 | */ |
@@ -4737,6 +4749,7 @@ discard block |
||
4737 | 4749 | /** |
4738 | 4750 | * Get available le courses count |
4739 | 4751 | * @param int Access URL ID (optional) |
4752 | + * @param integer $accessUrlId |
|
4740 | 4753 | * @return int Number of courses |
4741 | 4754 | */ |
4742 | 4755 | public static function countAvailableCourses($accessUrlId = null) |
@@ -4781,6 +4794,7 @@ discard block |
||
4781 | 4794 | * @param int User ID |
4782 | 4795 | * @param array Course details array |
4783 | 4796 | * @param array List of courses to which the user is subscribed (if not provided, will be generated) |
4797 | + * @param integer $uid |
|
4784 | 4798 | * @return mixed 'enter' for a link to go to the course or 'register' for a link to subscribe, or false if no access |
4785 | 4799 | */ |
4786 | 4800 | static function get_access_link_by_user($uid, $course, $user_courses = array()) |
@@ -4851,7 +4865,7 @@ discard block |
||
4851 | 4865 | * @param bool $deleteTeachersNotInList |
4852 | 4866 | * @param bool $editTeacherInSessions |
4853 | 4867 | * @param bool $deleteSessionTeacherNotInList |
4854 | - * @return bool |
|
4868 | + * @return false|null |
|
4855 | 4869 | */ |
4856 | 4870 | public static function updateTeachers( |
4857 | 4871 | $courseId, |
@@ -1679,7 +1679,7 @@ discard block |
||
1679 | 1679 | |
1680 | 1680 | // We get the coach for the given course in a given session. |
1681 | 1681 | $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . |
1682 | - ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1682 | + ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1683 | 1683 | $rs = Database::query($sql); |
1684 | 1684 | while ($user = Database::fetch_array($rs)) { |
1685 | 1685 | $user_info = api_get_user_info($user['user_id']); |
@@ -3972,7 +3972,7 @@ discard block |
||
3972 | 3972 | } |
3973 | 3973 | |
3974 | 3974 | $session_title .= isset($course['special_course']) ? ' ' . |
3975 | - Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
3975 | + Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
3976 | 3976 | |
3977 | 3977 | $params['title'] = $session_title; |
3978 | 3978 | $params['extra'] = ''; |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | $template = api_get_setting('course_creation_use_template'); |
129 | 129 | if (!empty($template)) { |
130 | 130 | // Include the necessary libraries to generate a course copy |
131 | - require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseBuilder.class.php'; |
|
132 | - require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseRestorer.class.php'; |
|
133 | - require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseSelectForm.class.php'; |
|
131 | + require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseBuilder.class.php'; |
|
132 | + require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseRestorer.class.php'; |
|
133 | + require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseSelectForm.class.php'; |
|
134 | 134 | // Call the course copy object |
135 | 135 | $originCourse = api_get_course_info_by_id($template); |
136 | 136 | $originCourse['official_code'] = $originCourse['code']; |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | { |
167 | 167 | return Database::fetch_array( |
168 | 168 | Database::query( |
169 | - "SELECT *, id as real_id FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
170 | - WHERE code='" . Database::escape_string($course_code) . "'"), 'ASSOC' |
|
169 | + "SELECT *, id as real_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." |
|
170 | + WHERE code='" . Database::escape_string($course_code)."'"), 'ASSOC' |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $alsoSearchCode = false, |
196 | 196 | $conditionsLike = array() |
197 | 197 | ) { |
198 | - $sql = "SELECT course.* FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " course "; |
|
198 | + $sql = "SELECT course.* FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." course "; |
|
199 | 199 | |
200 | 200 | if (!empty($urlId)) { |
201 | 201 | $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | if (!empty($startwith)) { |
206 | - $sql .= "WHERE (title LIKE '" . Database::escape_string($startwith) . "%' "; |
|
206 | + $sql .= "WHERE (title LIKE '".Database::escape_string($startwith)."%' "; |
|
207 | 207 | if ($alsoSearchCode) { |
208 | - $sql .= "OR code LIKE '" . Database::escape_string($startwith) . "%' "; |
|
208 | + $sql .= "OR code LIKE '".Database::escape_string($startwith)."%' "; |
|
209 | 209 | } |
210 | 210 | $sql .= ') '; |
211 | 211 | if ($visibility !== -1 && $visibility == strval(intval($visibility))) { |
@@ -239,19 +239,19 @@ discard block |
||
239 | 239 | $value = Database::escape_string($value); |
240 | 240 | $simple_like = false; |
241 | 241 | if ($simple_like) { |
242 | - $temp_conditions[] = $field . " LIKE '$value%'"; |
|
242 | + $temp_conditions[] = $field." LIKE '$value%'"; |
|
243 | 243 | } else { |
244 | - $temp_conditions[] = $field . ' LIKE \'%' . $value . '%\''; |
|
244 | + $temp_conditions[] = $field.' LIKE \'%'.$value.'%\''; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | $condition = ' AND '; |
248 | 248 | if (!empty($temp_conditions)) { |
249 | - $sql .= implode(' ' . $condition . ' ', $temp_conditions); |
|
249 | + $sql .= implode(' '.$condition.' ', $temp_conditions); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | 253 | if (!empty($orderby)) { |
254 | - $sql .= " ORDER BY " . Database::escape_string($orderby) . " "; |
|
254 | + $sql .= " ORDER BY ".Database::escape_string($orderby)." "; |
|
255 | 255 | } else { |
256 | 256 | $sql .= " ORDER BY 1 "; |
257 | 257 | } |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | if (!empty($howmany) && is_int($howmany) and $howmany > 0) { |
266 | - $sql .= ' LIMIT ' . Database::escape_string($howmany); |
|
266 | + $sql .= ' LIMIT '.Database::escape_string($howmany); |
|
267 | 267 | } else { |
268 | 268 | $sql .= ' LIMIT 1000000'; //virtually no limit |
269 | 269 | } |
270 | 270 | if (!empty($from)) { |
271 | 271 | $from = intval($from); |
272 | - $sql .= ' OFFSET ' . intval($from); |
|
272 | + $sql .= ' OFFSET '.intval($from); |
|
273 | 273 | } else { |
274 | 274 | $sql .= ' OFFSET 0'; |
275 | 275 | } |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | return Database::fetch_array( |
294 | 294 | Database::query( |
295 | 295 | "SELECT visibility, subscribe, unsubscribe |
296 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
297 | - WHERE code = '" . Database::escape_string($course_code) . "'" |
|
296 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." |
|
297 | + WHERE code = '" . Database::escape_string($course_code)."'" |
|
298 | 298 | ) |
299 | 299 | ); |
300 | 300 | } |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | $courseId = $courseInfo['real_id']; |
313 | 313 | $result = Database::fetch_array( |
314 | 314 | Database::query( |
315 | - "SELECT status FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
315 | + "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
316 | 316 | WHERE |
317 | 317 | c_id = $courseId AND |
318 | - user_id = " . intval($user_id) |
|
318 | + user_id = ".intval($user_id) |
|
319 | 319 | ) |
320 | 320 | ); |
321 | 321 | |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | |
334 | 334 | $result = Database::fetch_array( |
335 | 335 | Database::query(" |
336 | - SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
336 | + SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
337 | 337 | WHERE |
338 | - c_id = '" . intval($courseId). "' AND |
|
338 | + c_id = '" . intval($courseId)."' AND |
|
339 | 339 | user_id = " . intval($userId) |
340 | 340 | ) |
341 | 341 | ); |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | $result = Database::fetch_array( |
383 | 383 | Database::query(" |
384 | 384 | SELECT is_tutor |
385 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
385 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
386 | 386 | WHERE |
387 | - course_code = '" . Database::escape_string($course_code) . "' AND |
|
387 | + course_code = '" . Database::escape_string($course_code)."' AND |
|
388 | 388 | user_id = " . intval($user_id) |
389 | 389 | ) |
390 | 390 | ); |
@@ -437,17 +437,17 @@ discard block |
||
437 | 437 | $course_id = $course_info['real_id']; |
438 | 438 | |
439 | 439 | // Unsubscribe user from all groups in the course. |
440 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_GROUP_USER) . " |
|
441 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
440 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_GROUP_USER)." |
|
441 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
442 | 442 | Database::query($sql); |
443 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_GROUP_TUTOR) . " |
|
444 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
443 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_GROUP_TUTOR)." |
|
444 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
445 | 445 | Database::query($sql); |
446 | 446 | |
447 | 447 | // Erase user student publications (works) in the course - by André Boivin |
448 | 448 | |
449 | 449 | if (!empty($user_list)) { |
450 | - require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php'; |
|
450 | + require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php'; |
|
451 | 451 | foreach ($user_list as $userId) { |
452 | 452 | // Getting all work from user |
453 | 453 | $workList = getWorkPerUser($userId); |
@@ -466,74 +466,74 @@ discard block |
||
466 | 466 | } |
467 | 467 | |
468 | 468 | // Unsubscribe user from all blogs in the course. |
469 | - Database::query("DELETE FROM " . Database::get_course_table(TABLE_BLOGS_REL_USER) . " WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"); |
|
470 | - Database::query("DELETE FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"); |
|
469 | + Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_REL_USER)." WHERE c_id = $course_id AND user_id IN (".$user_ids.")"); |
|
470 | + Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." WHERE c_id = $course_id AND user_id IN (".$user_ids.")"); |
|
471 | 471 | |
472 | 472 | // Deleting users in forum_notification and mailqueue course tables |
473 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_FORUM_NOTIFICATION) . " |
|
474 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
473 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_FORUM_NOTIFICATION)." |
|
474 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
475 | 475 | Database::query($sql); |
476 | 476 | |
477 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_FORUM_MAIL_QUEUE) . " |
|
478 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
477 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_FORUM_MAIL_QUEUE)." |
|
478 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
479 | 479 | Database::query($sql); |
480 | 480 | |
481 | 481 | // Unsubscribe user from the course. |
482 | 482 | if (!empty($session_id)) { |
483 | 483 | |
484 | 484 | // Delete in table session_rel_course_rel_user |
485 | - $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
485 | + $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
486 | 486 | WHERE |
487 | - session_id ='" . $session_id . "' AND |
|
488 | - c_id = '" . $course_id . "' AND |
|
487 | + session_id ='" . $session_id."' AND |
|
488 | + c_id = '" . $course_id."' AND |
|
489 | 489 | user_id IN ($user_ids)"; |
490 | 490 | Database::query($sql); |
491 | 491 | |
492 | 492 | foreach ($user_list as $uid) { |
493 | 493 | // check if a user is register in the session with other course |
494 | - $sql = "SELECT user_id FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
494 | + $sql = "SELECT user_id FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
495 | 495 | WHERE session_id='$session_id' AND user_id='$uid'"; |
496 | 496 | $rs = Database::query($sql); |
497 | 497 | |
498 | 498 | if (Database::num_rows($rs) == 0) { |
499 | 499 | // Delete in table session_rel_user |
500 | - $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_SESSION_USER) . " |
|
500 | + $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_SESSION_USER)." |
|
501 | 501 | WHERE |
502 | - session_id ='" . $session_id . "' AND |
|
502 | + session_id ='" . $session_id."' AND |
|
503 | 503 | user_id = '$uid' AND |
504 | - relation_type<>" . SESSION_RELATION_TYPE_RRHH . ""; |
|
504 | + relation_type<>".SESSION_RELATION_TYPE_RRHH.""; |
|
505 | 505 | Database::query($sql); |
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
509 | 509 | // Update the table session |
510 | - $sql = "SELECT COUNT(*) FROM " . Database::get_main_table(TABLE_MAIN_SESSION_USER) . " |
|
511 | - WHERE session_id = '" . $session_id . "' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH; |
|
510 | + $sql = "SELECT COUNT(*) FROM ".Database::get_main_table(TABLE_MAIN_SESSION_USER)." |
|
511 | + WHERE session_id = '" . $session_id."' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH; |
|
512 | 512 | $row = Database::fetch_array(Database::query($sql)); |
513 | 513 | $count = $row[0]; |
514 | 514 | // number of users by session |
515 | - $sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_SESSION) . " SET nbr_users = '$count' |
|
516 | - WHERE id = '" . $session_id . "'"; |
|
515 | + $sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_SESSION)." SET nbr_users = '$count' |
|
516 | + WHERE id = '".$session_id."'"; |
|
517 | 517 | Database::query($sql); |
518 | 518 | |
519 | 519 | // Update the table session_rel_course |
520 | - $sql = "SELECT COUNT(*) FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
520 | + $sql = "SELECT COUNT(*) FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
521 | 521 | WHERE session_id = '$session_id' AND c_id = '$course_id' AND status<>2"; |
522 | 522 | $row = Database::fetch_array(@Database::query($sql)); |
523 | 523 | $count = $row[0]; |
524 | 524 | |
525 | 525 | // number of users by session and course |
526 | - $sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE) . " |
|
526 | + $sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE)." |
|
527 | 527 | SET nbr_users = '$count' |
528 | 528 | WHERE session_id = '$session_id' AND c_id = '$course_id'"; |
529 | 529 | Database::query($sql); |
530 | 530 | |
531 | 531 | } else { |
532 | - $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
532 | + $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
533 | 533 | WHERE |
534 | - user_id IN (" . $user_ids . ") AND |
|
535 | - relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
536 | - c_id = '" . $course_id . "'"; |
|
534 | + user_id IN (" . $user_ids.") AND |
|
535 | + relation_type<>" . COURSE_RELATION_TYPE_RRHH." AND |
|
536 | + c_id = '" . $course_id."'"; |
|
537 | 537 | Database::query($sql); |
538 | 538 | |
539 | 539 | // add event to system log |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | |
604 | 604 | // A preliminary check whether the user has bben already registered on the platform. |
605 | 605 | if (Database::num_rows(Database::query( |
606 | - "SELECT status FROM " . Database::get_main_table(TABLE_MAIN_USER) . " |
|
606 | + "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_USER)." |
|
607 | 607 | WHERE user_id = '$user_id' ")) == 0 |
608 | 608 | ) { |
609 | 609 | return false; // The user has not been registered to the platform. |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | |
614 | 614 | if (empty($session_id)) { |
615 | 615 | if (Database::num_rows(Database::query(" |
616 | - SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
617 | - WHERE user_id = '$user_id' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND c_id = '$courseId'")) > 0 |
|
616 | + SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
617 | + WHERE user_id = '$user_id' AND relation_type<>".COURSE_RELATION_TYPE_RRHH." AND c_id = '$courseId'")) > 0 |
|
618 | 618 | ) { |
619 | 619 | // The user has been already subscribed to the course. |
620 | 620 | return false; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $courseId = $courseInfo['real_id']; |
737 | 737 | |
738 | 738 | // Check in advance whether the user has already been registered on the platform. |
739 | - $sql = "SELECT status FROM " . $user_table . " WHERE user_id = $user_id "; |
|
739 | + $sql = "SELECT status FROM ".$user_table." WHERE user_id = $user_id "; |
|
740 | 740 | if (Database::num_rows(Database::query($sql)) == 0) { |
741 | 741 | if ($debug) { |
742 | 742 | error_log('The user has not been registered to the platform'); |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $sql = "SELECT * FROM $course_user_table |
749 | 749 | WHERE |
750 | 750 | user_id = $user_id AND |
751 | - relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND |
|
751 | + relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND |
|
752 | 752 | c_id = $courseId"; |
753 | 753 | if (Database::num_rows(Database::query($sql)) > 0) { |
754 | 754 | if ($debug) { |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | if (!api_is_course_admin()) { |
761 | 761 | // Check in advance whether subscription is allowed or not for this course. |
762 | 762 | $sql = "SELECT code, visibility FROM $course_table |
763 | - WHERE id = $courseId AND subscribe = '" . SUBSCRIBE_NOT_ALLOWED . "'"; |
|
763 | + WHERE id = $courseId AND subscribe = '".SUBSCRIBE_NOT_ALLOWED."'"; |
|
764 | 764 | if (Database::num_rows(Database::query($sql)) > 0) { |
765 | 765 | if ($debug) { |
766 | 766 | error_log('Subscription is not allowed for this course'); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | { |
820 | 820 | $wanted_course_code = Database::escape_string($wanted_course_code); |
821 | 821 | $sql = "SELECT COUNT(*) as number |
822 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
822 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." |
|
823 | 823 | WHERE code = '$wanted_course_code' OR visual_code = '$wanted_course_code'"; |
824 | 824 | $result = Database::fetch_array(Database::query($sql)); |
825 | 825 | |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $sql = "SELECT * FROM $table |
1006 | 1006 | WHERE |
1007 | 1007 | user_id = $userId AND |
1008 | - relation_type = " . COURSE_RELATION_TYPE_RRHH . " AND |
|
1008 | + relation_type = ".COURSE_RELATION_TYPE_RRHH." AND |
|
1009 | 1009 | c_id = $courseId"; |
1010 | 1010 | |
1011 | 1011 | $result = Database::fetch_array(Database::query($sql)); |
@@ -1044,13 +1044,13 @@ discard block |
||
1044 | 1044 | return false; |
1045 | 1045 | } |
1046 | 1046 | $courseId = $courseInfo['real_id']; |
1047 | - $condition_course = ' AND c_id = ' . $courseId; |
|
1047 | + $condition_course = ' AND c_id = '.$courseId; |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | - $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
1050 | + $sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
1051 | 1051 | WHERE |
1052 | 1052 | user_id = $user_id AND |
1053 | - relation_type<>" . COURSE_RELATION_TYPE_RRHH . " |
|
1053 | + relation_type<>".COURSE_RELATION_TYPE_RRHH." |
|
1054 | 1054 | $condition_course "; |
1055 | 1055 | |
1056 | 1056 | $result = Database::fetch_array(Database::query($sql)); |
@@ -1066,20 +1066,20 @@ discard block |
||
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | $tableSessionCourseUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1069 | - $sql = 'SELECT 1 FROM ' . $tableSessionCourseUser . |
|
1070 | - ' WHERE user_id = ' . $user_id . ' ' . $condition_course; |
|
1069 | + $sql = 'SELECT 1 FROM '.$tableSessionCourseUser. |
|
1070 | + ' WHERE user_id = '.$user_id.' '.$condition_course; |
|
1071 | 1071 | if (Database::num_rows(Database::query($sql)) > 0) { |
1072 | 1072 | return true; |
1073 | 1073 | } |
1074 | 1074 | |
1075 | - $sql = 'SELECT 1 FROM ' . $tableSessionCourseUser . |
|
1076 | - ' WHERE user_id = ' . $user_id . ' AND status=2 ' . $condition_course; |
|
1075 | + $sql = 'SELECT 1 FROM '.$tableSessionCourseUser. |
|
1076 | + ' WHERE user_id = '.$user_id.' AND status=2 '.$condition_course; |
|
1077 | 1077 | if (Database::num_rows(Database::query($sql)) > 0) { |
1078 | 1078 | return true; |
1079 | 1079 | } |
1080 | 1080 | |
1081 | - $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_SESSION) . |
|
1082 | - ' WHERE id = ' . $session_id . ' AND id_coach=' . $user_id; |
|
1081 | + $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_SESSION). |
|
1082 | + ' WHERE id = '.$session_id.' AND id_coach='.$user_id; |
|
1083 | 1083 | |
1084 | 1084 | if (Database::num_rows(Database::query($sql)) > 0) { |
1085 | 1085 | return true; |
@@ -1106,8 +1106,8 @@ discard block |
||
1106 | 1106 | $courseId = $courseInfo['real_id']; |
1107 | 1107 | |
1108 | 1108 | $result = Database::query( |
1109 | - 'SELECT status FROM ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . |
|
1110 | - ' WHERE c_id = ' . $courseId . ' AND user_id = ' . $user_id . '' |
|
1109 | + 'SELECT status FROM '.Database::get_main_table(TABLE_MAIN_COURSE_USER). |
|
1110 | + ' WHERE c_id = '.$courseId.' AND user_id = '.$user_id.'' |
|
1111 | 1111 | ); |
1112 | 1112 | |
1113 | 1113 | if (Database::num_rows($result) > 0) { |
@@ -1137,12 +1137,12 @@ discard block |
||
1137 | 1137 | $result = Database::fetch_array( |
1138 | 1138 | Database::query( |
1139 | 1139 | "SELECT * |
1140 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " course |
|
1141 | - LEFT JOIN " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " course_user |
|
1140 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." course |
|
1141 | + LEFT JOIN " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." course_user |
|
1142 | 1142 | ON course.id = course_user.c_id |
1143 | 1143 | WHERE |
1144 | 1144 | course_user.user_id = '$user_id' AND |
1145 | - course_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
1145 | + course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND |
|
1146 | 1146 | ( course.id = '$courseId')" |
1147 | 1147 | ) |
1148 | 1148 | ); |
@@ -1156,8 +1156,8 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | // A user? |
1158 | 1158 | if (Database::num_rows(Database::query("SELECT user_id |
1159 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
1160 | - WHERE session_id='" . $session_id . "' |
|
1159 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
1160 | + WHERE session_id='" . $session_id."' |
|
1161 | 1161 | AND user_id ='$user_id'")) |
1162 | 1162 | ) { |
1163 | 1163 | return true; |
@@ -1165,8 +1165,8 @@ discard block |
||
1165 | 1165 | |
1166 | 1166 | // A course coach? |
1167 | 1167 | if (Database::num_rows(Database::query("SELECT user_id |
1168 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
1169 | - WHERE session_id='" . $session_id . "' |
|
1168 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
1169 | + WHERE session_id='" . $session_id."' |
|
1170 | 1170 | AND user_id = '$user_id' AND status = 2 |
1171 | 1171 | AND c_id ='$courseId'")) |
1172 | 1172 | ) { |
@@ -1175,8 +1175,8 @@ discard block |
||
1175 | 1175 | |
1176 | 1176 | // A session coach? |
1177 | 1177 | if (Database::num_rows(Database::query("SELECT id_coach |
1178 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . " AS session |
|
1179 | - WHERE session.id='" . $session_id . "' |
|
1178 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION)." AS session |
|
1179 | + WHERE session.id='" . $session_id."' |
|
1180 | 1180 | AND id_coach='$user_id'")) |
1181 | 1181 | ) { |
1182 | 1182 | return true; |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | // we have to check if it is a valid field that can be sorted on |
1245 | 1245 | if (!strstr($order_by, 'ORDER BY')) { |
1246 | 1246 | if (!empty($order_by)) { |
1247 | - $order_by = 'ORDER BY ' . $order_by; |
|
1247 | + $order_by = 'ORDER BY '.$order_by; |
|
1248 | 1248 | } else { |
1249 | 1249 | $order_by = ''; |
1250 | 1250 | } |
@@ -1276,11 +1276,11 @@ discard block |
||
1276 | 1276 | if (!empty($courseCodeList)) { |
1277 | 1277 | $courseCodeListForSession = array_map(array('Database', 'escape_string'), $courseCodeList); |
1278 | 1278 | $courseCodeListForSession = implode('","', $courseCodeListForSession); |
1279 | - $courseCondition = ' course.code IN ("' . $courseCodeListForSession . '") '; |
|
1279 | + $courseCondition = ' course.code IN ("'.$courseCodeListForSession.'") '; |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | - $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user '; |
|
1283 | - $sql .= " LEFT JOIN ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " as session_course_user |
|
1282 | + $sql .= ' FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user '; |
|
1283 | + $sql .= " LEFT JOIN ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." as session_course_user |
|
1284 | 1284 | ON |
1285 | 1285 | user.user_id = session_course_user.user_id AND |
1286 | 1286 | $sessionCondition |
@@ -1322,14 +1322,14 @@ discard block |
||
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | |
1325 | - $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user '; |
|
1326 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1325 | + $sql .= ' FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user '; |
|
1326 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_COURSE_USER).' as course_rel_user |
|
1327 | 1327 | ON user.user_id = course_rel_user.user_id AND |
1328 | - course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH . ' '; |
|
1328 | + course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH.' '; |
|
1329 | 1329 | $sql .= " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
1330 | 1330 | |
1331 | 1331 | if (!empty($course_code)) { |
1332 | - $sql .= ' AND course_rel_user.c_id="' . $courseId . '"'; |
|
1332 | + $sql .= ' AND course_rel_user.c_id="'.$courseId.'"'; |
|
1333 | 1333 | } |
1334 | 1334 | $where[] = ' course_rel_user.c_id IS NOT NULL '; |
1335 | 1335 | |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | |
1342 | 1342 | $multiple_access_url = api_get_multiple_access_url(); |
1343 | 1343 | if ($multiple_access_url) { |
1344 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER) . ' au |
|
1344 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au |
|
1345 | 1345 | ON (au.user_id = user.user_id) '; |
1346 | 1346 | } |
1347 | 1347 | |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | } |
1362 | 1362 | } |
1363 | 1363 | |
1364 | - $sql .= ' WHERE ' . $filter_by_status_condition . ' ' . implode(' OR ', $where); |
|
1364 | + $sql .= ' WHERE '.$filter_by_status_condition.' '.implode(' OR ', $where); |
|
1365 | 1365 | |
1366 | 1366 | if ($multiple_access_url) { |
1367 | 1367 | $current_access_url_id = api_get_current_access_url_id(); |
@@ -1383,15 +1383,15 @@ discard block |
||
1383 | 1383 | if (!empty($userIdList)) { |
1384 | 1384 | $userIdList = array_map('intval', $userIdList); |
1385 | 1385 | $userIdList = implode('","', $userIdList); |
1386 | - $sql .= ' AND user.user_id IN ("' . $userIdList . '")'; |
|
1386 | + $sql .= ' AND user.user_id IN ("'.$userIdList.'")'; |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | if (isset($filterByActive)) { |
1390 | 1390 | $filterByActive = intval($filterByActive); |
1391 | - $sql .= ' AND user.active = ' . $filterByActive; |
|
1391 | + $sql .= ' AND user.active = '.$filterByActive; |
|
1392 | 1392 | } |
1393 | 1393 | |
1394 | - $sql .= ' ' . $order_by . ' ' . $limit; |
|
1394 | + $sql .= ' '.$order_by.' '.$limit; |
|
1395 | 1395 | |
1396 | 1396 | $rs = Database::query($sql); |
1397 | 1397 | $users = array(); |
@@ -1548,7 +1548,7 @@ discard block |
||
1548 | 1548 | ) |
1549 | 1549 | ); |
1550 | 1550 | $report_info['progress_100'] = $progress == 100 ? Display::label(get_lang('Yes'), 'success') : Display::label(get_lang('No')); |
1551 | - $report_info['progress'] = $progress . "%"; |
|
1551 | + $report_info['progress'] = $progress."%"; |
|
1552 | 1552 | |
1553 | 1553 | foreach ($extra_fields as $extra) { |
1554 | 1554 | $user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']); |
@@ -1617,32 +1617,32 @@ discard block |
||
1617 | 1617 | $courseInfo = api_get_course_info($course_code); |
1618 | 1618 | $courseId = $courseInfo['real_id']; |
1619 | 1619 | |
1620 | - $sql = 'SELECT DISTINCT count(*) as count FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user '; |
|
1620 | + $sql = 'SELECT DISTINCT count(*) as count FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user '; |
|
1621 | 1621 | $where = array(); |
1622 | 1622 | if (!empty($session_id)) { |
1623 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' as session_course_user |
|
1623 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).' as session_course_user |
|
1624 | 1624 | ON |
1625 | 1625 | user.user_id = session_course_user.user_id AND |
1626 | - session_course_user.c_id = "' . $courseId . '" AND |
|
1626 | + session_course_user.c_id = "' . $courseId.'" AND |
|
1627 | 1627 | session_course_user.session_id = ' . $session_id; |
1628 | 1628 | |
1629 | 1629 | $where[] = ' session_course_user.c_id IS NOT NULL '; |
1630 | 1630 | } else { |
1631 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1631 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_COURSE_USER).' as course_rel_user |
|
1632 | 1632 | ON |
1633 | 1633 | user.user_id = course_rel_user.user_id AND |
1634 | - course_rel_user.relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND |
|
1635 | - course_rel_user.c_id = ' . $courseId ; |
|
1634 | + course_rel_user.relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND |
|
1635 | + course_rel_user.c_id = ' . $courseId; |
|
1636 | 1636 | $where[] = ' course_rel_user.c_id IS NOT NULL '; |
1637 | 1637 | } |
1638 | 1638 | |
1639 | 1639 | $multiple_access_url = api_get_multiple_access_url(); |
1640 | 1640 | if ($multiple_access_url) { |
1641 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER) . ' au |
|
1641 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au |
|
1642 | 1642 | ON (au.user_id = user.user_id) '; |
1643 | 1643 | } |
1644 | 1644 | |
1645 | - $sql .= ' WHERE ' . implode(' OR ', $where); |
|
1645 | + $sql .= ' WHERE '.implode(' OR ', $where); |
|
1646 | 1646 | |
1647 | 1647 | if ($multiple_access_url) { |
1648 | 1648 | $current_access_url_id = api_get_current_access_url_id(); |
@@ -1678,8 +1678,8 @@ discard block |
||
1678 | 1678 | $users = array(); |
1679 | 1679 | |
1680 | 1680 | // We get the coach for the given course in a given session. |
1681 | - $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . |
|
1682 | - ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1681 | + $sql = 'SELECT user_id FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER). |
|
1682 | + ' WHERE session_id ="'.$session_id.'" AND c_id="'.$courseId.'" AND status = 2'; |
|
1683 | 1683 | $rs = Database::query($sql); |
1684 | 1684 | while ($user = Database::fetch_array($rs)) { |
1685 | 1685 | $user_info = api_get_user_info($user['user_id']); |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | |
1692 | 1692 | $table = Database::get_main_table(TABLE_MAIN_SESSION); |
1693 | 1693 | // We get the session coach. |
1694 | - $sql = 'SELECT id_coach FROM ' . $table . ' WHERE id=' . $session_id; |
|
1694 | + $sql = 'SELECT id_coach FROM '.$table.' WHERE id='.$session_id; |
|
1695 | 1695 | $rs = Database::query($sql); |
1696 | 1696 | $session_id_coach = Database::result($rs, 0, 'id_coach'); |
1697 | 1697 | $user_info = api_get_user_info($session_id_coach); |
@@ -1767,11 +1767,11 @@ discard block |
||
1767 | 1767 | $joinSession = ""; |
1768 | 1768 | //Session creation date |
1769 | 1769 | if (!empty($date_from) && !empty($date_to)) { |
1770 | - $joinSession = "INNER JOIN " . Database::get_main_table(TABLE_MAIN_SESSION) . " s"; |
|
1770 | + $joinSession = "INNER JOIN ".Database::get_main_table(TABLE_MAIN_SESSION)." s"; |
|
1771 | 1771 | } |
1772 | 1772 | |
1773 | 1773 | $sql_query = "SELECT * |
1774 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " scu |
|
1774 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." scu |
|
1775 | 1775 | $joinSession |
1776 | 1776 | INNER JOIN $userTable u ON scu.user_id = u.user_id |
1777 | 1777 | WHERE scu.c_id = '$courseId' AND scu.status <> 2"; |
@@ -1783,11 +1783,11 @@ discard block |
||
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | if ($session_id != 0) { |
1786 | - $sql_query .= ' AND scu.session_id = ' . $session_id; |
|
1786 | + $sql_query .= ' AND scu.session_id = '.$session_id; |
|
1787 | 1787 | } |
1788 | 1788 | |
1789 | 1789 | if (!$includeInvitedUsers) { |
1790 | - $sql_query .= " AND u.status != " . INVITEE; |
|
1790 | + $sql_query .= " AND u.status != ".INVITEE; |
|
1791 | 1791 | } |
1792 | 1792 | |
1793 | 1793 | $rs = Database::query($sql_query); |
@@ -1821,8 +1821,8 @@ discard block |
||
1821 | 1821 | u.email, |
1822 | 1822 | u.username, |
1823 | 1823 | u.status |
1824 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " cu |
|
1825 | - INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER) . " u |
|
1824 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." cu |
|
1825 | + INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER)." u |
|
1826 | 1826 | ON (cu.user_id = u.id) |
1827 | 1827 | WHERE |
1828 | 1828 | cu.c_id = $courseId AND |
@@ -1860,7 +1860,7 @@ discard block |
||
1860 | 1860 | $teacher['lastname'] |
1861 | 1861 | ); |
1862 | 1862 | if ($add_link_to_profile) { |
1863 | - $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $teacher['user_id']; |
|
1863 | + $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$teacher['user_id']; |
|
1864 | 1864 | $teacher_name = Display::url( |
1865 | 1865 | $teacher_name, |
1866 | 1866 | $url, |
@@ -1874,13 +1874,13 @@ discard block |
||
1874 | 1874 | } |
1875 | 1875 | |
1876 | 1876 | if (!empty($list)) { |
1877 | - if ($orderList === true){ |
|
1877 | + if ($orderList === true) { |
|
1878 | 1878 | $html .= '<ul class="user-teacher">'; |
1879 | - foreach ($list as $teacher){ |
|
1880 | - $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher); |
|
1879 | + foreach ($list as $teacher) { |
|
1880 | + $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY).' '.$teacher); |
|
1881 | 1881 | } |
1882 | 1882 | $html .= '</ul>'; |
1883 | - }else{ |
|
1883 | + } else { |
|
1884 | 1884 | $html .= array_to_string($list, $separator); |
1885 | 1885 | } |
1886 | 1886 | } |
@@ -1959,7 +1959,7 @@ discard block |
||
1959 | 1959 | foreach ($coachs_course as $coach_course) { |
1960 | 1960 | $coach_name = api_get_person_name($coach_course['firstname'], $coach_course['lastname']); |
1961 | 1961 | if ($add_link_to_profile) { |
1962 | - $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coach_course['user_id']; |
|
1962 | + $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coach_course['user_id']; |
|
1963 | 1963 | $coach_name = Display::url( |
1964 | 1964 | $coach_name, |
1965 | 1965 | $url, |
@@ -1975,10 +1975,10 @@ discard block |
||
1975 | 1975 | $coaches_to_string = null; |
1976 | 1976 | |
1977 | 1977 | if (!empty($course_coachs)) { |
1978 | - if ($orderList === true){ |
|
1978 | + if ($orderList === true) { |
|
1979 | 1979 | $html .= '<ul class="user-coachs">'; |
1980 | - foreach ($course_coachs as $coachs){ |
|
1981 | - $html .= Display::tag('li', Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY) . ' ' . $coachs); |
|
1980 | + foreach ($course_coachs as $coachs) { |
|
1981 | + $html .= Display::tag('li', Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY).' '.$coachs); |
|
1982 | 1982 | } |
1983 | 1983 | $html .= '</ul>'; |
1984 | 1984 | } else { |
@@ -2033,20 +2033,20 @@ discard block |
||
2033 | 2033 | } |
2034 | 2034 | |
2035 | 2035 | $group_list = array(); |
2036 | - $session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,' . intval($session_id) . ')' : $session_condition = ' WHERE g.session_id = 0'; |
|
2036 | + $session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0'; |
|
2037 | 2037 | |
2038 | 2038 | if ($in_get_empty_group == 0) { |
2039 | 2039 | // get only groups that are not empty |
2040 | 2040 | $sql = "SELECT DISTINCT g.id, g.name |
2041 | - FROM " . Database::get_course_table(TABLE_GROUP) . " AS g |
|
2042 | - INNER JOIN " . Database::get_course_table(TABLE_GROUP_USER) . " gu |
|
2041 | + FROM " . Database::get_course_table(TABLE_GROUP)." AS g |
|
2042 | + INNER JOIN " . Database::get_course_table(TABLE_GROUP_USER)." gu |
|
2043 | 2043 | ON (g.id = gu.group_id AND g.c_id = $course_id AND gu.c_id = $course_id) |
2044 | 2044 | $session_condition |
2045 | 2045 | ORDER BY g.name"; |
2046 | 2046 | } else { |
2047 | 2047 | // get all groups even if they are empty |
2048 | 2048 | $sql = "SELECT g.id, g.name |
2049 | - FROM " . Database::get_course_table(TABLE_GROUP) . " AS g |
|
2049 | + FROM " . Database::get_course_table(TABLE_GROUP)." AS g |
|
2050 | 2050 | $session_condition |
2051 | 2051 | AND c_id = $course_id"; |
2052 | 2052 | } |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | $table_stats_uploads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS); |
2102 | 2102 | |
2103 | 2103 | $codeFiltered = Database::escape_string($code); |
2104 | - $sql = "SELECT * FROM $table_course WHERE code='" . $codeFiltered . "'"; |
|
2104 | + $sql = "SELECT * FROM $table_course WHERE code='".$codeFiltered."'"; |
|
2105 | 2105 | $res = Database::query($sql); |
2106 | 2106 | |
2107 | 2107 | if (Database::num_rows($res) == 0) { |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | } |
2110 | 2110 | |
2111 | 2111 | $sql = "SELECT * FROM $table_course |
2112 | - WHERE code = '" . $codeFiltered . "'"; |
|
2112 | + WHERE code = '".$codeFiltered."'"; |
|
2113 | 2113 | $res = Database::query($sql); |
2114 | 2114 | $course = Database::fetch_array($res); |
2115 | 2115 | $courseId = $course['id']; |
@@ -2154,34 +2154,34 @@ discard block |
||
2154 | 2154 | } |
2155 | 2155 | } |
2156 | 2156 | |
2157 | - $course_dir = api_get_path(SYS_COURSE_PATH) . $course['directory']; |
|
2158 | - $archive_dir = api_get_path(SYS_ARCHIVE_PATH) . $course['directory'] . '_' . time(); |
|
2157 | + $course_dir = api_get_path(SYS_COURSE_PATH).$course['directory']; |
|
2158 | + $archive_dir = api_get_path(SYS_ARCHIVE_PATH).$course['directory'].'_'.time(); |
|
2159 | 2159 | if (is_dir($course_dir)) { |
2160 | 2160 | rename($course_dir, $archive_dir); |
2161 | 2161 | } |
2162 | 2162 | |
2163 | 2163 | // Unsubscribe all users from the course |
2164 | - $sql = "DELETE FROM $table_course_user WHERE c_id='" . $courseId . "'"; |
|
2164 | + $sql = "DELETE FROM $table_course_user WHERE c_id='".$courseId."'"; |
|
2165 | 2165 | Database::query($sql); |
2166 | 2166 | // Delete the course from the sessions tables |
2167 | - $sql = "DELETE FROM $table_session_course WHERE c_id='" . $courseId . "'"; |
|
2167 | + $sql = "DELETE FROM $table_session_course WHERE c_id='".$courseId."'"; |
|
2168 | 2168 | Database::query($sql); |
2169 | - $sql = "DELETE FROM $table_session_course_user WHERE c_id='" . $courseId . "'"; |
|
2169 | + $sql = "DELETE FROM $table_session_course_user WHERE c_id='".$courseId."'"; |
|
2170 | 2170 | Database::query($sql); |
2171 | 2171 | |
2172 | 2172 | // Delete from Course - URL |
2173 | - $sql = "DELETE FROM $table_course_rel_url WHERE c_id = '" . $courseId. "'"; |
|
2173 | + $sql = "DELETE FROM $table_course_rel_url WHERE c_id = '".$courseId."'"; |
|
2174 | 2174 | Database::query($sql); |
2175 | 2175 | |
2176 | - $sql = 'SELECT survey_id FROM ' . $table_course_survey . ' WHERE course_code="' . $codeFiltered . '"'; |
|
2176 | + $sql = 'SELECT survey_id FROM '.$table_course_survey.' WHERE course_code="'.$codeFiltered.'"'; |
|
2177 | 2177 | $result_surveys = Database::query($sql); |
2178 | 2178 | while ($surveys = Database::fetch_array($result_surveys)) { |
2179 | 2179 | $survey_id = $surveys[0]; |
2180 | - $sql = 'DELETE FROM ' . $table_course_survey_question . ' WHERE survey_id="' . $survey_id . '"'; |
|
2180 | + $sql = 'DELETE FROM '.$table_course_survey_question.' WHERE survey_id="'.$survey_id.'"'; |
|
2181 | 2181 | Database::query($sql); |
2182 | - $sql = 'DELETE FROM ' . $table_course_survey_question_option . ' WHERE survey_id="' . $survey_id . '"'; |
|
2182 | + $sql = 'DELETE FROM '.$table_course_survey_question_option.' WHERE survey_id="'.$survey_id.'"'; |
|
2183 | 2183 | Database::query($sql); |
2184 | - $sql = 'DELETE FROM ' . $table_course_survey . ' WHERE survey_id="' . $survey_id . '"'; |
|
2184 | + $sql = 'DELETE FROM '.$table_course_survey.' WHERE survey_id="'.$survey_id.'"'; |
|
2185 | 2185 | Database::query($sql); |
2186 | 2186 | } |
2187 | 2187 | |
@@ -2214,7 +2214,7 @@ discard block |
||
2214 | 2214 | Database::query($sql); |
2215 | 2215 | |
2216 | 2216 | // Delete the course from the database |
2217 | - $sql = "DELETE FROM $table_course WHERE code = '" . $codeFiltered . "'"; |
|
2217 | + $sql = "DELETE FROM $table_course WHERE code = '".$codeFiltered."'"; |
|
2218 | 2218 | Database::query($sql); |
2219 | 2219 | |
2220 | 2220 | // delete extra course fields |
@@ -2260,15 +2260,15 @@ discard block |
||
2260 | 2260 | while ($row = Database::fetch_array($res_table, 'ASSOC')) { |
2261 | 2261 | $row_to_save = array(); |
2262 | 2262 | foreach ($row as $key => $value) { |
2263 | - $row_to_save[$key] = $key . "='" . Database::escape_string($row[$key]) . "'"; |
|
2263 | + $row_to_save[$key] = $key."='".Database::escape_string($row[$key])."'"; |
|
2264 | 2264 | } |
2265 | - $sql_dump .= "\nINSERT INTO $table SET " . implode(', ', $row_to_save) . ';'; |
|
2265 | + $sql_dump .= "\nINSERT INTO $table SET ".implode(', ', $row_to_save).';'; |
|
2266 | 2266 | } |
2267 | 2267 | } |
2268 | 2268 | } |
2269 | 2269 | |
2270 | - if (is_dir(api_get_path(SYS_COURSE_PATH) . $course['directory'])) { |
|
2271 | - $file_name = api_get_path(SYS_COURSE_PATH) . $course['directory'] . '/mysql_dump.sql'; |
|
2270 | + if (is_dir(api_get_path(SYS_COURSE_PATH).$course['directory'])) { |
|
2271 | + $file_name = api_get_path(SYS_COURSE_PATH).$course['directory'].'/mysql_dump.sql'; |
|
2272 | 2272 | $handle = fopen($file_name, 'a+'); |
2273 | 2273 | if ($handle !== false) { |
2274 | 2274 | fwrite($handle, $sql_dump); |
@@ -2296,13 +2296,13 @@ discard block |
||
2296 | 2296 | $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE); |
2297 | 2297 | $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
2298 | 2298 | |
2299 | - $course_title = Database::result(Database::query('SELECT title FROM ' . $TABLECOURSE . ' WHERE code="' . $course_code . '"'), |
|
2299 | + $course_title = Database::result(Database::query('SELECT title FROM '.$TABLECOURSE.' WHERE code="'.$course_code.'"'), |
|
2300 | 2300 | 0, 0); |
2301 | 2301 | |
2302 | 2302 | $sql = 'SELECT course.code as code, course.title as title, cu.sort as sort |
2303 | - FROM ' . $TABLECOURSUSER . ' as cu, ' . $TABLECOURSE . ' as course |
|
2304 | - WHERE course.id = cu.c_id AND user_id = "' . $user_id . '" AND |
|
2305 | - cu.relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND |
|
2303 | + FROM ' . $TABLECOURSUSER.' as cu, '.$TABLECOURSE.' as course |
|
2304 | + WHERE course.id = cu.c_id AND user_id = "' . $user_id.'" AND |
|
2305 | + cu.relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND |
|
2306 | 2306 | user_course_cat = 0 |
2307 | 2307 | ORDER BY cu.sort'; |
2308 | 2308 | $result = Database::query($sql); |
@@ -2321,21 +2321,21 @@ discard block |
||
2321 | 2321 | $course_found = true; |
2322 | 2322 | $course_sort = $courses['sort']; |
2323 | 2323 | if ($counter == 0) { |
2324 | - $sql = 'UPDATE ' . $TABLECOURSUSER . ' |
|
2324 | + $sql = 'UPDATE '.$TABLECOURSUSER.' |
|
2325 | 2325 | SET sort = sort+1 |
2326 | 2326 | WHERE |
2327 | - user_id= "' . $user_id . '" AND |
|
2328 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
2327 | + user_id= "' . $user_id.'" AND |
|
2328 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
2329 | 2329 | AND user_course_cat="0" |
2330 | - AND sort > "' . $course_sort . '"'; |
|
2330 | + AND sort > "' . $course_sort.'"'; |
|
2331 | 2331 | $course_sort++; |
2332 | 2332 | } else { |
2333 | - $sql = 'UPDATE ' . $TABLECOURSUSER . ' SET sort = sort+1 |
|
2333 | + $sql = 'UPDATE '.$TABLECOURSUSER.' SET sort = sort+1 |
|
2334 | 2334 | WHERE |
2335 | - user_id= "' . $user_id . '" AND |
|
2336 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND |
|
2335 | + user_id= "' . $user_id.'" AND |
|
2336 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND |
|
2337 | 2337 | user_course_cat="0" AND |
2338 | - sort >= "' . $course_sort . '"'; |
|
2338 | + sort >= "' . $course_sort.'"'; |
|
2339 | 2339 | } |
2340 | 2340 | Database::query($sql); |
2341 | 2341 | break; |
@@ -2348,9 +2348,9 @@ discard block |
||
2348 | 2348 | |
2349 | 2349 | // We must register the course in the beginning of the list |
2350 | 2350 | if (!$course_found) { |
2351 | - $course_sort = Database::result(Database::query('SELECT min(sort) as min_sort FROM ' . $TABLECOURSUSER . ' WHERE user_id="' . $user_id . '" AND user_course_cat="0"'), |
|
2351 | + $course_sort = Database::result(Database::query('SELECT min(sort) as min_sort FROM '.$TABLECOURSUSER.' WHERE user_id="'.$user_id.'" AND user_course_cat="0"'), |
|
2352 | 2352 | 0, 0); |
2353 | - Database::query('UPDATE ' . $TABLECOURSUSER . ' SET sort = sort+1 WHERE user_id= "' . $user_id . '" AND user_course_cat="0"'); |
|
2353 | + Database::query('UPDATE '.$TABLECOURSUSER.' SET sort = sort+1 WHERE user_id= "'.$user_id.'" AND user_course_cat="0"'); |
|
2354 | 2354 | } |
2355 | 2355 | } |
2356 | 2356 | return $course_sort; |
@@ -2365,11 +2365,11 @@ discard block |
||
2365 | 2365 | public static function course_exists($course_code, $accept_virtual = false) |
2366 | 2366 | { |
2367 | 2367 | if ($accept_virtual === true) { |
2368 | - $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . ' |
|
2369 | - WHERE code="' . Database::escape_string($course_code) . '" OR visual_code="' . Database::escape_string($course_code) . '"'; |
|
2368 | + $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_COURSE).' |
|
2369 | + WHERE code="' . Database::escape_string($course_code).'" OR visual_code="'.Database::escape_string($course_code).'"'; |
|
2370 | 2370 | } else { |
2371 | - $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . ' |
|
2372 | - WHERE code="' . Database::escape_string($course_code) . '"'; |
|
2371 | + $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_COURSE).' |
|
2372 | + WHERE code="' . Database::escape_string($course_code).'"'; |
|
2373 | 2373 | } |
2374 | 2374 | |
2375 | 2375 | return Database::num_rows(Database::query($sql)); |
@@ -2395,7 +2395,7 @@ discard block |
||
2395 | 2395 | $student = api_get_user_info($user_id); |
2396 | 2396 | |
2397 | 2397 | $name_course = $information['title']; |
2398 | - $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " WHERE c_id ='" . $courseId . "'"; |
|
2398 | + $sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." WHERE c_id ='".$courseId."'"; |
|
2399 | 2399 | |
2400 | 2400 | // TODO: Ivan: This is a mistake, please, have a look at it. Intention here is diffcult to be guessed. |
2401 | 2401 | //if ($send_to_tutor_also = true) |
@@ -2410,18 +2410,18 @@ discard block |
||
2410 | 2410 | while ($row = Database::fetch_array($result)) { |
2411 | 2411 | $tutor = api_get_user_info($row['user_id']); |
2412 | 2412 | $emailto = $tutor['email']; |
2413 | - $emailsubject = get_lang('NewUserInTheCourse') . ': ' . $name_course; |
|
2414 | - $emailbody = get_lang('Dear') . ': ' . api_get_person_name($tutor['firstname'], $tutor['lastname']) . "\n"; |
|
2415 | - $emailbody .= get_lang('MessageNewUserInTheCourse') . ': ' . $name_course . "\n"; |
|
2416 | - $emailbody .= get_lang('UserName') . ': ' . $student['username'] . "\n"; |
|
2413 | + $emailsubject = get_lang('NewUserInTheCourse').': '.$name_course; |
|
2414 | + $emailbody = get_lang('Dear').': '.api_get_person_name($tutor['firstname'], $tutor['lastname'])."\n"; |
|
2415 | + $emailbody .= get_lang('MessageNewUserInTheCourse').': '.$name_course."\n"; |
|
2416 | + $emailbody .= get_lang('UserName').': '.$student['username']."\n"; |
|
2417 | 2417 | if (api_is_western_name_order()) { |
2418 | - $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n"; |
|
2419 | - $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n"; |
|
2418 | + $emailbody .= get_lang('FirstName').': '.$student['firstname']."\n"; |
|
2419 | + $emailbody .= get_lang('LastName').': '.$student['lastname']."\n"; |
|
2420 | 2420 | } else { |
2421 | - $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n"; |
|
2422 | - $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n"; |
|
2421 | + $emailbody .= get_lang('LastName').': '.$student['lastname']."\n"; |
|
2422 | + $emailbody .= get_lang('FirstName').': '.$student['firstname']."\n"; |
|
2423 | 2423 | } |
2424 | - $emailbody .= get_lang('Email') . ': <a href="mailto:' . $student['email'] . '">' . $student['email'] ."</a>\n\n"; |
|
2424 | + $emailbody .= get_lang('Email').': <a href="mailto:'.$student['email'].'">'.$student['email']."</a>\n\n"; |
|
2425 | 2425 | $recipient_name = api_get_person_name($tutor['firstname'], $tutor['lastname'], null, |
2426 | 2426 | PERSON_NAME_EMAIL_ADDRESS); |
2427 | 2427 | $sender_name = api_get_person_name(api_get_setting('administratorName'), |
@@ -2523,9 +2523,9 @@ discard block |
||
2523 | 2523 | |
2524 | 2524 | $with_special_courses = $without_special_courses = ''; |
2525 | 2525 | if (!empty($special_course_list)) { |
2526 | - $sc_string = '"' . implode('","', $special_course_list) . '"'; |
|
2527 | - $with_special_courses = ' course.code IN (' . $sc_string . ')'; |
|
2528 | - $without_special_courses = ' AND course.code NOT IN (' . $sc_string . ')'; |
|
2526 | + $sc_string = '"'.implode('","', $special_course_list).'"'; |
|
2527 | + $with_special_courses = ' course.code IN ('.$sc_string.')'; |
|
2528 | + $without_special_courses = ' AND course.code NOT IN ('.$sc_string.')'; |
|
2529 | 2529 | } |
2530 | 2530 | |
2531 | 2531 | if (!empty($with_special_courses)) { |
@@ -2569,8 +2569,8 @@ discard block |
||
2569 | 2569 | |
2570 | 2570 | if ($include_sessions === true) { |
2571 | 2571 | $sql = "SELECT DISTINCT(c.code), c.id as real_id |
2572 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " s, |
|
2573 | - " . Database::get_main_table(TABLE_MAIN_COURSE) . " c |
|
2572 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." s, |
|
2573 | + " . Database::get_main_table(TABLE_MAIN_COURSE)." c |
|
2574 | 2574 | WHERE user_id = $user_id AND s.c_id = c.id"; |
2575 | 2575 | $r = Database::query($sql); |
2576 | 2576 | while ($row = Database::fetch_array($r, 'ASSOC')) { |
@@ -2591,7 +2591,7 @@ discard block |
||
2591 | 2591 | public static function get_course_id_from_path($path) |
2592 | 2592 | { |
2593 | 2593 | $path = Database::escape_string(str_replace('.', '', str_replace('/', '', $path))); |
2594 | - $res = Database::query("SELECT code FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
2594 | + $res = Database::query("SELECT code FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." |
|
2595 | 2595 | WHERE directory LIKE BINARY '$path'"); |
2596 | 2596 | if ($res === false) { |
2597 | 2597 | return false; |
@@ -2613,8 +2613,8 @@ discard block |
||
2613 | 2613 | public static function get_courses_info_from_visual_code($code) |
2614 | 2614 | { |
2615 | 2615 | $result = array(); |
2616 | - $sql_result = Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
2617 | - WHERE visual_code = '" . Database::escape_string($code) . "'"); |
|
2616 | + $sql_result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." |
|
2617 | + WHERE visual_code = '" . Database::escape_string($code)."'"); |
|
2618 | 2618 | while ($virtual_course = Database::fetch_array($sql_result)) { |
2619 | 2619 | $result[] = $virtual_course; |
2620 | 2620 | } |
@@ -2630,10 +2630,10 @@ discard block |
||
2630 | 2630 | public static function get_emails_of_tutors_to_course($courseId) |
2631 | 2631 | { |
2632 | 2632 | $list = array(); |
2633 | - $res = Database::query("SELECT user_id FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
2634 | - WHERE c_id ='" . intval($courseId) . "' AND status=1"); |
|
2633 | + $res = Database::query("SELECT user_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
2634 | + WHERE c_id ='" . intval($courseId)."' AND status=1"); |
|
2635 | 2635 | while ($list_users = Database::fetch_array($res)) { |
2636 | - $result = Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_USER) . " |
|
2636 | + $result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_USER)." |
|
2637 | 2637 | WHERE user_id=" . $list_users['user_id']); |
2638 | 2638 | while ($row_user = Database::fetch_array($result)) { |
2639 | 2639 | $name_teacher = api_get_person_name($row_user['firstname'], $row_user['lastname']); |
@@ -2676,7 +2676,7 @@ discard block |
||
2676 | 2676 | } |
2677 | 2677 | |
2678 | 2678 | $sql = "SELECT firstname, lastname, email FROM $tbl_user |
2679 | - WHERE user_id IN (" . implode(",", $user_ids) . ")"; |
|
2679 | + WHERE user_id IN (".implode(",", $user_ids).")"; |
|
2680 | 2680 | $rs_user = Database::query($sql); |
2681 | 2681 | |
2682 | 2682 | while ($row_emails = Database::fetch_array($rs_user)) { |
@@ -2722,9 +2722,9 @@ discard block |
||
2722 | 2722 | */ |
2723 | 2723 | public static function update_attribute($id, $name, $value) |
2724 | 2724 | { |
2725 | - $id = (int)$id; |
|
2725 | + $id = (int) $id; |
|
2726 | 2726 | $table = Database::get_main_table(TABLE_MAIN_COURSE); |
2727 | - $sql = "UPDATE $table SET $name = '" . Database::escape_string($value) . "' |
|
2727 | + $sql = "UPDATE $table SET $name = '".Database::escape_string($value)."' |
|
2728 | 2728 | WHERE id = '$id';"; |
2729 | 2729 | return Database::query($sql); |
2730 | 2730 | } |
@@ -2739,7 +2739,7 @@ discard block |
||
2739 | 2739 | */ |
2740 | 2740 | public static function update_attributes($id, $attributes) |
2741 | 2741 | { |
2742 | - $id = (int)$id; |
|
2742 | + $id = (int) $id; |
|
2743 | 2743 | $table = Database::get_main_table(TABLE_MAIN_COURSE); |
2744 | 2744 | $sql = "UPDATE $table SET "; |
2745 | 2745 | $i = 0; |
@@ -2748,7 +2748,7 @@ discard block |
||
2748 | 2748 | if ($i > 0) { |
2749 | 2749 | $sql .= ", "; |
2750 | 2750 | } |
2751 | - $sql .= " $name = '" . Database::escape_string($value) . "'"; |
|
2751 | + $sql .= " $name = '".Database::escape_string($value)."'"; |
|
2752 | 2752 | $i++; |
2753 | 2753 | } |
2754 | 2754 | } |
@@ -2785,9 +2785,9 @@ discard block |
||
2785 | 2785 | { |
2786 | 2786 | return Database::result( |
2787 | 2787 | Database::query('SELECT sc.id session_category |
2788 | - FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY) . ' sc |
|
2789 | - INNER JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION) . ' s |
|
2790 | - ON sc.id=s.session_category_id WHERE s.id="' . Database::escape_string($session_id) . '"'), |
|
2788 | + FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY).' sc |
|
2789 | + INNER JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION).' s |
|
2790 | + ON sc.id=s.session_category_id WHERE s.id="' . Database::escape_string($session_id).'"'), |
|
2791 | 2791 | 0, |
2792 | 2792 | 'session_category' |
2793 | 2793 | ); |
@@ -2830,13 +2830,13 @@ discard block |
||
2830 | 2830 | $data .= '<div class="sectiontitle">'; |
2831 | 2831 | if (api_is_allowed_to_edit() && $action_show) { |
2832 | 2832 | //delete |
2833 | - $data .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=delete&description_id=' . $description->id . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), |
|
2834 | - ENT_QUOTES, $charset)) . '\')) return false;">'; |
|
2833 | + $data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), |
|
2834 | + ENT_QUOTES, $charset)).'\')) return false;">'; |
|
2835 | 2835 | $data .= Display::return_icon('delete.gif', get_lang('Delete'), |
2836 | 2836 | array('style' => 'vertical-align:middle;float:right;')); |
2837 | 2837 | $data .= '</a> '; |
2838 | 2838 | //edit |
2839 | - $data .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&description_id=' . $description->id . '">'; |
|
2839 | + $data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&description_id='.$description->id.'">'; |
|
2840 | 2840 | $data .= Display::return_icon('edit.png', get_lang('Edit'), |
2841 | 2841 | array('style' => 'vertical-align:middle;float:right; padding-right:4px;'), ICON_SIZE_SMALL); |
2842 | 2842 | $data .= '</a> '; |
@@ -2848,7 +2848,7 @@ discard block |
||
2848 | 2848 | $data .= '</div>'; |
2849 | 2849 | } |
2850 | 2850 | } else { |
2851 | - $data .= '<em>' . get_lang('ThisCourseDescriptionIsEmpty') . '</em>'; |
|
2851 | + $data .= '<em>'.get_lang('ThisCourseDescriptionIsEmpty').'</em>'; |
|
2852 | 2852 | } |
2853 | 2853 | |
2854 | 2854 | return $data; |
@@ -2915,11 +2915,11 @@ discard block |
||
2915 | 2915 | ON (a.c_id = s.c_id) |
2916 | 2916 | WHERE |
2917 | 2917 | user_id = $hr_manager_id AND |
2918 | - relation_type=" . COURSE_RELATION_TYPE_RRHH . " AND |
|
2919 | - access_url_id = " . api_get_current_access_url_id() . ""; |
|
2918 | + relation_type=".COURSE_RELATION_TYPE_RRHH." AND |
|
2919 | + access_url_id = " . api_get_current_access_url_id().""; |
|
2920 | 2920 | } else { |
2921 | 2921 | $sql = "SELECT c_id FROM $tbl_course_rel_user |
2922 | - WHERE user_id = $hr_manager_id AND relation_type=" . COURSE_RELATION_TYPE_RRHH . " "; |
|
2922 | + WHERE user_id = $hr_manager_id AND relation_type=".COURSE_RELATION_TYPE_RRHH." "; |
|
2923 | 2923 | } |
2924 | 2924 | $result = Database::query($sql); |
2925 | 2925 | if (Database::num_rows($result) > 0) { |
@@ -2928,7 +2928,7 @@ discard block |
||
2928 | 2928 | WHERE |
2929 | 2929 | c_id = '{$row['c_id']}' AND |
2930 | 2930 | user_id = $hr_manager_id AND |
2931 | - relation_type=" . COURSE_RELATION_TYPE_RRHH . " "; |
|
2931 | + relation_type=".COURSE_RELATION_TYPE_RRHH." "; |
|
2932 | 2932 | Database::query($sql); |
2933 | 2933 | } |
2934 | 2934 | } |
@@ -2939,7 +2939,7 @@ discard block |
||
2939 | 2939 | $courseInfo = api_get_course_info($course_code); |
2940 | 2940 | $courseId = $courseInfo['real_id']; |
2941 | 2941 | $sql = "INSERT IGNORE INTO $tbl_course_rel_user(c_id, user_id, status, relation_type) |
2942 | - VALUES($courseId, $hr_manager_id, '" . DRH . "', '" . COURSE_RELATION_TYPE_RRHH . "')"; |
|
2942 | + VALUES($courseId, $hr_manager_id, '".DRH."', '".COURSE_RELATION_TYPE_RRHH."')"; |
|
2943 | 2943 | $result = Database::query($sql); |
2944 | 2944 | if (Database::affected_rows($result)) { |
2945 | 2945 | $affected_rows++; |
@@ -3022,16 +3022,16 @@ discard block |
||
3022 | 3022 | case COURSEMANAGER: |
3023 | 3023 | $whereConditions .= " AND cru.user_id = '$user_id'"; |
3024 | 3024 | if (!$showAllAssignedCourses) { |
3025 | - $whereConditions .= " AND status = " . COURSEMANAGER; |
|
3025 | + $whereConditions .= " AND status = ".COURSEMANAGER; |
|
3026 | 3026 | } else { |
3027 | - $whereConditions .= " AND relation_type = " . COURSE_RELATION_TYPE_COURSE_MANAGER; |
|
3027 | + $whereConditions .= " AND relation_type = ".COURSE_RELATION_TYPE_COURSE_MANAGER; |
|
3028 | 3028 | } |
3029 | 3029 | break; |
3030 | 3030 | case DRH: |
3031 | 3031 | $whereConditions .= " AND |
3032 | 3032 | cru.user_id = '$user_id' AND |
3033 | - status = " . DRH . " AND |
|
3034 | - relation_type = '" . COURSE_RELATION_TYPE_RRHH . "' |
|
3033 | + status = ".DRH." AND |
|
3034 | + relation_type = '" . COURSE_RELATION_TYPE_RRHH."' |
|
3035 | 3035 | "; |
3036 | 3036 | break; |
3037 | 3037 | } |
@@ -3052,7 +3052,7 @@ discard block |
||
3052 | 3052 | ); |
3053 | 3053 | if (!empty($courseList)) { |
3054 | 3054 | $courseListToString = implode("','", array_keys($courseList)); |
3055 | - $whereConditions .= " AND c.id IN ('" . $courseListToString . "')"; |
|
3055 | + $whereConditions .= " AND c.id IN ('".$courseListToString."')"; |
|
3056 | 3056 | } |
3057 | 3057 | $tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
3058 | 3058 | $orderBy = ' ORDER BY position'; |
@@ -3068,7 +3068,7 @@ discard block |
||
3068 | 3068 | INNER JOIN $tbl_course_rel_access_url a ON (a.c_id = c.id) |
3069 | 3069 | $extraInnerJoin |
3070 | 3070 | WHERE |
3071 | - access_url_id = " . api_get_current_access_url_id() . " |
|
3071 | + access_url_id = ".api_get_current_access_url_id()." |
|
3072 | 3072 | $whereConditions |
3073 | 3073 | $orderBy |
3074 | 3074 | "; |
@@ -3128,10 +3128,10 @@ discard block |
||
3128 | 3128 | { |
3129 | 3129 | $course_info = api_get_course_info($course_code); |
3130 | 3130 | // course path |
3131 | - $store_path = api_get_path(SYS_COURSE_PATH) . $course_info['path']; |
|
3131 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; |
|
3132 | 3132 | // image name for courses |
3133 | - $course_image = $store_path . '/course-pic.png'; |
|
3134 | - $course_medium_image = $store_path . '/course-pic85x85.png'; |
|
3133 | + $course_image = $store_path.'/course-pic.png'; |
|
3134 | + $course_medium_image = $store_path.'/course-pic85x85.png'; |
|
3135 | 3135 | |
3136 | 3136 | if (file_exists($course_image)) { |
3137 | 3137 | unlink($course_image); |
@@ -3165,11 +3165,11 @@ discard block |
||
3165 | 3165 | { |
3166 | 3166 | $course_info = api_get_course_info($courseCode); |
3167 | 3167 | // course path |
3168 | - $storePath = api_get_path(SYS_COURSE_PATH) . $course_info['path']; |
|
3168 | + $storePath = api_get_path(SYS_COURSE_PATH).$course_info['path']; |
|
3169 | 3169 | // image name for courses |
3170 | - $courseImage = $storePath . '/course-pic.png'; |
|
3171 | - $courseMediumImage = $storePath . '/course-pic85x85.png'; |
|
3172 | - $courseSmallImage = $storePath . '/course-pic32.png'; |
|
3170 | + $courseImage = $storePath.'/course-pic.png'; |
|
3171 | + $courseMediumImage = $storePath.'/course-pic85x85.png'; |
|
3172 | + $courseSmallImage = $storePath.'/course-pic32.png'; |
|
3173 | 3173 | |
3174 | 3174 | if (file_exists($courseImage)) { |
3175 | 3175 | unlink($courseImage); |
@@ -3197,26 +3197,26 @@ discard block |
||
3197 | 3197 | |
3198 | 3198 | $notifications = isset($params['notifications']) ? $params['notifications'] : null; |
3199 | 3199 | |
3200 | - $html .= '<h3>' . $params['title'] . $notifications . '</h3> '; |
|
3200 | + $html .= '<h3>'.$params['title'].$notifications.'</h3> '; |
|
3201 | 3201 | |
3202 | 3202 | if (isset($params['description'])) { |
3203 | - $html .= '<p>' . $params['description'] . '</p>'; |
|
3203 | + $html .= '<p>'.$params['description'].'</p>'; |
|
3204 | 3204 | } |
3205 | 3205 | if (!empty($params['subtitle'])) { |
3206 | - $html .= '<small>' . $params['subtitle'] . '</small>'; |
|
3206 | + $html .= '<small>'.$params['subtitle'].'</small>'; |
|
3207 | 3207 | } |
3208 | 3208 | if (!empty($params['teachers'])) { |
3209 | - $html .= '<h5 class="teacher">' . Display::return_icon('teacher.png', get_lang('Teacher'), array(), |
|
3210 | - ICON_SIZE_TINY) . $params['teachers'] . '</h5>'; |
|
3209 | + $html .= '<h5 class="teacher">'.Display::return_icon('teacher.png', get_lang('Teacher'), array(), |
|
3210 | + ICON_SIZE_TINY).$params['teachers'].'</h5>'; |
|
3211 | 3211 | } |
3212 | 3212 | if (!empty($params['coaches'])) { |
3213 | - $html .= '<h5 class="teacher">' . Display::return_icon('teacher.png', get_lang('Coach'), array(), |
|
3214 | - ICON_SIZE_TINY) . $params['coaches'] . '</h5>'; |
|
3213 | + $html .= '<h5 class="teacher">'.Display::return_icon('teacher.png', get_lang('Coach'), array(), |
|
3214 | + ICON_SIZE_TINY).$params['coaches'].'</h5>'; |
|
3215 | 3215 | } |
3216 | 3216 | |
3217 | 3217 | $html .= '</div>'; |
3218 | 3218 | $params['right_actions'] = isset($params['right_actions']) ? $params['right_actions'] : null; |
3219 | - $html .= '<div class="pull-right course-box-actions">' . $params['right_actions'] . '</div>'; |
|
3219 | + $html .= '<div class="pull-right course-box-actions">'.$params['right_actions'].'</div>'; |
|
3220 | 3220 | $html .= '</div>'; |
3221 | 3221 | $html .= '</div>'; |
3222 | 3222 | return $html; |
@@ -3232,11 +3232,11 @@ discard block |
||
3232 | 3232 | $html = ''; |
3233 | 3233 | $html .= '<div class="row">'; |
3234 | 3234 | $html .= '<div class="col-md-2">'; |
3235 | - if (!empty($params['link'])){ |
|
3235 | + if (!empty($params['link'])) { |
|
3236 | 3236 | $html .= '<a class="thumbnail" href="'.$params['link'].'">'; |
3237 | 3237 | $html .= $params['icon']; |
3238 | 3238 | $html .= '</a>'; |
3239 | - }else{ |
|
3239 | + } else { |
|
3240 | 3240 | $html .= $params['icon']; |
3241 | 3241 | } |
3242 | 3242 | $html .= '</div>'; |
@@ -3263,13 +3263,13 @@ discard block |
||
3263 | 3263 | if ($is_sub_content) { |
3264 | 3264 | $class = "course_item"; |
3265 | 3265 | } |
3266 | - $html .= '<div class="' . $class . '">'; |
|
3266 | + $html .= '<div class="'.$class.'">'; |
|
3267 | 3267 | $html .= '<div class="panel-body">'; |
3268 | 3268 | $html .= '<div class="course-items">'; |
3269 | 3269 | $html .= ' <div class="row">'; |
3270 | 3270 | $html .= '<div class="col-md-2">'; |
3271 | 3271 | if (!empty($params['link'])) { |
3272 | - $html .= '<a class="thumbnail" href="' . $params['link'] . '">'; |
|
3272 | + $html .= '<a class="thumbnail" href="'.$params['link'].'">'; |
|
3273 | 3273 | $html .= $params['icon']; |
3274 | 3274 | $html .= '</a>'; |
3275 | 3275 | } else { |
@@ -3282,25 +3282,25 @@ discard block |
||
3282 | 3282 | $param_class = isset($params['class']) ? $params['class'] : ''; |
3283 | 3283 | $params['right_actions'] = isset($params['right_actions']) ? $params['right_actions'] : ''; |
3284 | 3284 | |
3285 | - $html .= '<div class="col-md-10 ' . $param_class . '">'; |
|
3286 | - $html .= '<div class="pull-right">' . $params['right_actions'] . '</div>'; |
|
3287 | - $html .= '<h4 class="course-items-title">' . $params['title'] . $notifications . '</h4> '; |
|
3285 | + $html .= '<div class="col-md-10 '.$param_class.'">'; |
|
3286 | + $html .= '<div class="pull-right">'.$params['right_actions'].'</div>'; |
|
3287 | + $html .= '<h4 class="course-items-title">'.$params['title'].$notifications.'</h4> '; |
|
3288 | 3288 | |
3289 | 3289 | if (isset($params['show_description'], $params['description']) && $params['show_description'] == 1) { |
3290 | - $html .= '<p class="description-session">' . $params['description'] . '</p>'; |
|
3290 | + $html .= '<p class="description-session">'.$params['description'].'</p>'; |
|
3291 | 3291 | } |
3292 | 3292 | if (!empty($params['subtitle'])) { |
3293 | - $html .= '<div class="subtitle-session">' . $params['subtitle'] . '</div>'; |
|
3293 | + $html .= '<div class="subtitle-session">'.$params['subtitle'].'</div>'; |
|
3294 | 3294 | } |
3295 | 3295 | if (!empty($params['teachers'])) { |
3296 | - $html .= '<h5 class="course-items-session">' . |
|
3297 | - Display::return_icon('teacher.png', get_lang('Teacher'), array(), ICON_SIZE_TINY) . |
|
3298 | - $params['teachers'] . '</h5>'; |
|
3296 | + $html .= '<h5 class="course-items-session">'. |
|
3297 | + Display::return_icon('teacher.png', get_lang('Teacher'), array(), ICON_SIZE_TINY). |
|
3298 | + $params['teachers'].'</h5>'; |
|
3299 | 3299 | } |
3300 | 3300 | if (!empty($params['coaches'])) { |
3301 | - $html .= '<h5 class="course-items-session">' . |
|
3302 | - Display::return_icon('teacher.png', get_lang('Coach'), array(), ICON_SIZE_TINY) . |
|
3303 | - $params['coaches'] . '</h5>'; |
|
3301 | + $html .= '<h5 class="course-items-session">'. |
|
3302 | + Display::return_icon('teacher.png', get_lang('Coach'), array(), ICON_SIZE_TINY). |
|
3303 | + $params['coaches'].'</h5>'; |
|
3304 | 3304 | } |
3305 | 3305 | |
3306 | 3306 | $html .= '</div>'; |
@@ -3321,7 +3321,7 @@ discard block |
||
3321 | 3321 | */ |
3322 | 3322 | public static function course_item_parent($main_content, $sub_content, $sub_sub_content = null) |
3323 | 3323 | { |
3324 | - return '<div class="panel panel-default">' . $main_content . $sub_content . $sub_sub_content . '</div>'; |
|
3324 | + return '<div class="panel panel-default">'.$main_content.$sub_content.$sub_sub_content.'</div>'; |
|
3325 | 3325 | } |
3326 | 3326 | |
3327 | 3327 | /** |
@@ -3343,7 +3343,7 @@ discard block |
||
3343 | 3343 | |
3344 | 3344 | $with_special_courses = $without_special_courses = ''; |
3345 | 3345 | if (!empty($special_course_list)) { |
3346 | - $with_special_courses = ' course.code IN ("' . implode('","', $special_course_list) . '")'; |
|
3346 | + $with_special_courses = ' course.code IN ("'.implode('","', $special_course_list).'")'; |
|
3347 | 3347 | } |
3348 | 3348 | $html = null; |
3349 | 3349 | $courseCount = 0; |
@@ -3394,14 +3394,14 @@ discard block |
||
3394 | 3394 | $params['right_actions'] = ''; |
3395 | 3395 | if (api_is_platform_admin()) { |
3396 | 3396 | if ($load_dirs) { |
3397 | - $params['right_actions'] .= '<a id="document_preview_' . $course['id'] . '_0" class="document_preview" href="javascript:void(0);">' . |
|
3397 | + $params['right_actions'] .= '<a id="document_preview_'.$course['id'].'_0" class="document_preview" href="javascript:void(0);">'. |
|
3398 | 3398 | Display::return_icon( |
3399 | 3399 | 'folder.png', |
3400 | 3400 | get_lang('Documents'), |
3401 | 3401 | array('align' => 'absmiddle'), |
3402 | 3402 | ICON_SIZE_SMALL |
3403 | 3403 | ).'</a>'; |
3404 | - $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . |
|
3404 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'. |
|
3405 | 3405 | Display::return_icon( |
3406 | 3406 | 'edit.png', |
3407 | 3407 | get_lang('Edit'), |
@@ -3409,13 +3409,13 @@ discard block |
||
3409 | 3409 | ICON_SIZE_SMALL |
3410 | 3410 | ).'</a>'; |
3411 | 3411 | $params['right_actions'] .= Display::div('', array( |
3412 | - 'id' => 'document_result_' . $course['id'] . '_0', |
|
3412 | + 'id' => 'document_result_'.$course['id'].'_0', |
|
3413 | 3413 | 'class' => 'document_preview_container' |
3414 | 3414 | )); |
3415 | 3415 | } else { |
3416 | - $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . |
|
3416 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'. |
|
3417 | 3417 | Display::return_icon('edit.png', |
3418 | - get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>'; |
|
3418 | + get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
3419 | 3419 | } |
3420 | 3420 | if ($course['status'] == COURSEMANAGER) { |
3421 | 3421 | //echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;')); |
@@ -3423,7 +3423,7 @@ discard block |
||
3423 | 3423 | } else { |
3424 | 3424 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) { |
3425 | 3425 | if ($load_dirs) { |
3426 | - $params['right_actions'] .= '<a id="document_preview_' . $course['id'] . '_0" class="document_preview" href="javascript:void(0);">' . |
|
3426 | + $params['right_actions'] .= '<a id="document_preview_'.$course['id'].'_0" class="document_preview" href="javascript:void(0);">'. |
|
3427 | 3427 | Display::return_icon( |
3428 | 3428 | 'folder.png', |
3429 | 3429 | get_lang('Documents'), |
@@ -3431,7 +3431,7 @@ discard block |
||
3431 | 3431 | ICON_SIZE_SMALL |
3432 | 3432 | ).'</a>'; |
3433 | 3433 | $params['right_actions'] .= Display::div('', array( |
3434 | - 'id' => 'document_result_' . $course['id'] . '_0', |
|
3434 | + 'id' => 'document_result_'.$course['id'].'_0', |
|
3435 | 3435 | 'class' => 'document_preview_container' |
3436 | 3436 | )); |
3437 | 3437 | } |
@@ -3439,14 +3439,14 @@ discard block |
||
3439 | 3439 | } |
3440 | 3440 | |
3441 | 3441 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) { |
3442 | - $course_title = '<a href="' . $course_info['course_public_url'] . '?id_session=0&autoreg=1">' . $course_info['title'] . '</a>'; |
|
3442 | + $course_title = '<a href="'.$course_info['course_public_url'].'?id_session=0&autoreg=1">'.$course_info['title'].'</a>'; |
|
3443 | 3443 | } else { |
3444 | - $course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'), |
|
3444 | + $course_title = $course_info['title']." ".Display::tag('span', get_lang('CourseClosed'), |
|
3445 | 3445 | array('class' => 'item_closed')); |
3446 | 3446 | } |
3447 | 3447 | |
3448 | 3448 | if (api_get_setting('display_coursecode_in_courselist') == 'true') { |
3449 | - $course_title .= ' (' . $course_info['visual_code'] . ') '; |
|
3449 | + $course_title .= ' ('.$course_info['visual_code'].') '; |
|
3450 | 3450 | } |
3451 | 3451 | if (api_get_setting('display_teacher_in_courselist') == 'true') { |
3452 | 3452 | $params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string( |
@@ -3495,7 +3495,7 @@ discard block |
||
3495 | 3495 | // Step 1: We get all the categories of the user |
3496 | 3496 | $table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
3497 | 3497 | $sql = "SELECT id, title FROM $table |
3498 | - WHERE user_id = '" . $user_id . "' |
|
3498 | + WHERE user_id = '".$user_id."' |
|
3499 | 3499 | ORDER BY sort ASC"; |
3500 | 3500 | $result = Database::query($sql); |
3501 | 3501 | $html = null; |
@@ -3556,7 +3556,7 @@ discard block |
||
3556 | 3556 | |
3557 | 3557 | $without_special_courses = ''; |
3558 | 3558 | if (!empty($special_course_list)) { |
3559 | - $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")'; |
|
3559 | + $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $special_course_list).'")'; |
|
3560 | 3560 | } |
3561 | 3561 | |
3562 | 3562 | //AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." |
@@ -3575,14 +3575,14 @@ discard block |
||
3575 | 3575 | WHERE |
3576 | 3576 | course.id = course_rel_user.c_id AND |
3577 | 3577 | url.c_id = course.id AND |
3578 | - course_rel_user.user_id = '" . $user_id . "' AND |
|
3579 | - course_rel_user.user_course_cat = '" . $user_category_id . "' |
|
3578 | + course_rel_user.user_id = '".$user_id."' AND |
|
3579 | + course_rel_user.user_course_cat = '" . $user_category_id."' |
|
3580 | 3580 | $without_special_courses "; |
3581 | 3581 | |
3582 | 3582 | // If multiple URL access mode is enabled, only fetch courses |
3583 | 3583 | // corresponding to the current URL. |
3584 | 3584 | if (api_get_multiple_access_url() && $current_url_id != -1) { |
3585 | - $sql .= " AND url.c_id = course.id AND access_url_id='" . $current_url_id . "'"; |
|
3585 | + $sql .= " AND url.c_id = course.id AND access_url_id='".$current_url_id."'"; |
|
3586 | 3586 | } |
3587 | 3587 | // Use user's classification for courses (if any). |
3588 | 3588 | $sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC"; |
@@ -3638,17 +3638,17 @@ discard block |
||
3638 | 3638 | |
3639 | 3639 | if (api_is_platform_admin()) { |
3640 | 3640 | if ($load_dirs) { |
3641 | - $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', |
|
3642 | - get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>'; |
|
3643 | - $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', |
|
3644 | - get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>'; |
|
3641 | + $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', |
|
3642 | + get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
3643 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', |
|
3644 | + get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
3645 | 3645 | $params['right_actions'] .= Display::div('', array( |
3646 | - 'id' => 'document_result_' . $course_info['real_id'] . '_0', |
|
3646 | + 'id' => 'document_result_'.$course_info['real_id'].'_0', |
|
3647 | 3647 | 'class' => 'document_preview_container' |
3648 | 3648 | )); |
3649 | 3649 | } else { |
3650 | - $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', |
|
3651 | - get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>'; |
|
3650 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', |
|
3651 | + get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
3652 | 3652 | } |
3653 | 3653 | |
3654 | 3654 | if ($course_info['status'] == COURSEMANAGER) { |
@@ -3657,16 +3657,16 @@ discard block |
||
3657 | 3657 | } else { |
3658 | 3658 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) { |
3659 | 3659 | if ($load_dirs) { |
3660 | - $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', |
|
3661 | - get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>'; |
|
3660 | + $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', |
|
3661 | + get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
3662 | 3662 | $params['right_actions'] .= Display::div('', array( |
3663 | - 'id' => 'document_result_' . $course_info['real_id'] . '_0', |
|
3663 | + 'id' => 'document_result_'.$course_info['real_id'].'_0', |
|
3664 | 3664 | 'class' => 'document_preview_container' |
3665 | 3665 | )); |
3666 | 3666 | } else { |
3667 | 3667 | if ($course_info['status'] == COURSEMANAGER) { |
3668 | - $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', |
|
3669 | - get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>'; |
|
3668 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', |
|
3669 | + get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
3670 | 3670 | } |
3671 | 3671 | } |
3672 | 3672 | } |
@@ -3674,16 +3674,16 @@ discard block |
||
3674 | 3674 | |
3675 | 3675 | $course_title_url = ''; |
3676 | 3676 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) { |
3677 | - $course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=0'; |
|
3677 | + $course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?id_session=0'; |
|
3678 | 3678 | $course_title = Display::url($course_info['title'], $course_title_url); |
3679 | 3679 | } else { |
3680 | - $course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'), |
|
3680 | + $course_title = $course_info['title']." ".Display::tag('span', get_lang('CourseClosed'), |
|
3681 | 3681 | array('class' => 'item_closed')); |
3682 | 3682 | } |
3683 | 3683 | |
3684 | 3684 | // Start displaying the course block itself |
3685 | 3685 | if (api_get_setting('display_coursecode_in_courselist') == 'true') { |
3686 | - $course_title .= ' (' . $course_info['visual_code'] . ') '; |
|
3686 | + $course_title .= ' ('.$course_info['visual_code'].') '; |
|
3687 | 3687 | } |
3688 | 3688 | |
3689 | 3689 | if (api_get_setting('display_teacher_in_courselist') == 'true') { |
@@ -3896,14 +3896,14 @@ discard block |
||
3896 | 3896 | } |
3897 | 3897 | |
3898 | 3898 | if ($user_in_course_status == COURSEMANAGER || $sessionCourseAvailable) { |
3899 | - $session_url = $course_info['course_public_url'] . '?id_session=' . $course_info['id_session']; |
|
3900 | - $session_title = '<h4><a href="' . $session_url. '">'. $course_info['name'] . '</a>'.$notifications.'</h4>'; |
|
3899 | + $session_url = $course_info['course_public_url'].'?id_session='.$course_info['id_session']; |
|
3900 | + $session_title = '<h4><a href="'.$session_url.'">'.$course_info['name'].'</a>'.$notifications.'</h4>'; |
|
3901 | 3901 | } else { |
3902 | 3902 | $session_title = $course_info['name']; |
3903 | 3903 | } |
3904 | 3904 | |
3905 | 3905 | } else { |
3906 | - $session_title = $course_info['name'] . ' ' . Display::tag('span', get_lang('CourseClosed'), |
|
3906 | + $session_title = $course_info['name'].' '.Display::tag('span', get_lang('CourseClosed'), |
|
3907 | 3907 | array('class' => 'item_closed')); |
3908 | 3908 | } |
3909 | 3909 | } else { |
@@ -3928,21 +3928,21 @@ discard block |
||
3928 | 3928 | $course_visibility != COURSE_VISIBILITY_HIDDEN |
3929 | 3929 | ) { |
3930 | 3930 | if ($load_dirs) { |
3931 | - $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview" href="javascript:void(0);">' . |
|
3931 | + $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_'.$course_info['id_session'].'" class="document_preview" href="javascript:void(0);">'. |
|
3932 | 3932 | Display::return_icon('folder.png', |
3933 | 3933 | get_lang('Documents'), |
3934 | 3934 | array('align' => 'absmiddle'), |
3935 | 3935 | ICON_SIZE_SMALL |
3936 | - ) . '</a>'; |
|
3936 | + ).'</a>'; |
|
3937 | 3937 | $params['right_actions'] .= Display::div('', array( |
3938 | - 'id' => 'document_result_' . $course_info['real_id'] . '_' . $course_info['id_session'], |
|
3938 | + 'id' => 'document_result_'.$course_info['real_id'].'_'.$course_info['id_session'], |
|
3939 | 3939 | 'class' => 'document_preview_container' |
3940 | 3940 | )); |
3941 | 3941 | } |
3942 | 3942 | } |
3943 | 3943 | |
3944 | 3944 | if (api_get_setting('display_coursecode_in_courselist') == 'true') { |
3945 | - $session_title .= ' (' . $course_info['visual_code'] . ') '; |
|
3945 | + $session_title .= ' ('.$course_info['visual_code'].') '; |
|
3946 | 3946 | } |
3947 | 3947 | |
3948 | 3948 | if (api_get_setting('display_teacher_in_courselist') == 'true') { |
@@ -3971,7 +3971,7 @@ discard block |
||
3971 | 3971 | } |
3972 | 3972 | } |
3973 | 3973 | |
3974 | - $session_title .= isset($course['special_course']) ? ' ' . |
|
3974 | + $session_title .= isset($course['special_course']) ? ' '. |
|
3975 | 3975 | Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
3976 | 3976 | |
3977 | 3977 | $params['title'] = $session_title; |
@@ -3987,12 +3987,12 @@ discard block |
||
3987 | 3987 | |
3988 | 3988 | // Request for the name of the general coach |
3989 | 3989 | $sql = 'SELECT lastname, firstname,sc.name |
3990 | - FROM ' . $tbl_session . ' ts |
|
3991 | - LEFT JOIN ' . $main_user_table . ' tu |
|
3990 | + FROM ' . $tbl_session.' ts |
|
3991 | + LEFT JOIN ' . $main_user_table.' tu |
|
3992 | 3992 | ON ts.id_coach = tu.user_id |
3993 | - INNER JOIN ' . $tbl_session_category . ' sc |
|
3993 | + INNER JOIN ' . $tbl_session_category.' sc |
|
3994 | 3994 | ON ts.session_category_id = sc.id |
3995 | - WHERE ts.id=' . (int)$course_info['id_session'] . ' |
|
3995 | + WHERE ts.id=' . (int) $course_info['id_session'].' |
|
3996 | 3996 | LIMIT 1'; |
3997 | 3997 | |
3998 | 3998 | $rs = Database::query($sql); |
@@ -4007,14 +4007,14 @@ discard block |
||
4007 | 4007 | //$session['dates'] = get_lang('WithoutTimeLimits'); |
4008 | 4008 | $session['dates'] = ''; |
4009 | 4009 | if (api_get_setting('show_session_coach') === 'true') { |
4010 | - $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'], |
|
4010 | + $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], |
|
4011 | 4011 | $sessioncoach['lastname']); |
4012 | 4012 | } |
4013 | 4013 | $active = true; |
4014 | 4014 | } else { |
4015 | - $session ['dates'] = ' - ' . get_lang('From') . ' ' . $course_info['access_start_date'] . ' ' . get_lang('To') . ' ' . $course_info['access_end_date']; |
|
4015 | + $session ['dates'] = ' - '.get_lang('From').' '.$course_info['access_start_date'].' '.get_lang('To').' '.$course_info['access_end_date']; |
|
4016 | 4016 | if (api_get_setting('show_session_coach') === 'true') { |
4017 | - $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'], |
|
4017 | + $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], |
|
4018 | 4018 | $sessioncoach['lastname']); |
4019 | 4019 | } |
4020 | 4020 | $active = ($date_start <= $now && $date_end >= $now); |
@@ -4066,9 +4066,9 @@ discard block |
||
4066 | 4066 | $destination_session_id, |
4067 | 4067 | $params = array() |
4068 | 4068 | ) { |
4069 | - require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseBuilder.class.php'; |
|
4070 | - require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseRestorer.class.php'; |
|
4071 | - require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseSelectForm.class.php'; |
|
4069 | + require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseBuilder.class.php'; |
|
4070 | + require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseRestorer.class.php'; |
|
4071 | + require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseSelectForm.class.php'; |
|
4072 | 4072 | |
4073 | 4073 | $course_info = api_get_course_info($source_course_code); |
4074 | 4074 | |
@@ -4141,7 +4141,7 @@ discard block |
||
4141 | 4141 | if (Database::num_rows($result) > 0) { |
4142 | 4142 | $row = Database::fetch_array($result); |
4143 | 4143 | $count = $row['count'] + 1; |
4144 | - $wanted_code = $wanted_code . '_' . $count; |
|
4144 | + $wanted_code = $wanted_code.'_'.$count; |
|
4145 | 4145 | $result = api_get_course_info($wanted_code); |
4146 | 4146 | if (empty($result)) { |
4147 | 4147 | return $wanted_code; |
@@ -4175,7 +4175,7 @@ discard block |
||
4175 | 4175 | $enabled = api_get_plugin_setting('courselegal', 'tool_enable'); |
4176 | 4176 | |
4177 | 4177 | if ($enabled == 'true') { |
4178 | - require_once api_get_path(SYS_PLUGIN_PATH) . 'courselegal/config.php'; |
|
4178 | + require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php'; |
|
4179 | 4179 | $plugin = CourseLegalPlugin::create(); |
4180 | 4180 | return $plugin->isUserAcceptedLegal($user_id, $course_code, $session_id); |
4181 | 4181 | } |
@@ -4220,7 +4220,7 @@ discard block |
||
4220 | 4220 | $enabled = api_get_plugin_setting('courselegal', 'tool_enable'); |
4221 | 4221 | |
4222 | 4222 | if ($enabled == 'true') { |
4223 | - require_once api_get_path(SYS_PLUGIN_PATH) . 'courselegal/config.php'; |
|
4223 | + require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php'; |
|
4224 | 4224 | $plugin = CourseLegalPlugin::create(); |
4225 | 4225 | return $plugin->saveUserLegal($user_id, $course_code, $session_id); |
4226 | 4226 | } |
@@ -4561,10 +4561,10 @@ discard block |
||
4561 | 4561 | INNER JOIN $table_course_url u |
4562 | 4562 | ON u.c_id = c.id |
4563 | 4563 | WHERE |
4564 | - u.access_url_id = " . api_get_current_access_url_id() . " AND |
|
4564 | + u.access_url_id = ".api_get_current_access_url_id()." AND |
|
4565 | 4565 | login_course_date <= '$now' AND |
4566 | 4566 | login_course_date > DATE_SUB('$now', INTERVAL $days DAY) AND |
4567 | - visibility <> '" . COURSE_VISIBILITY_CLOSED . "' AND visibility <> '" . COURSE_VISIBILITY_HIDDEN . "' |
|
4567 | + visibility <> '".COURSE_VISIBILITY_CLOSED."' AND visibility <> '".COURSE_VISIBILITY_HIDDEN."' |
|
4568 | 4568 | GROUP BY a.c_id |
4569 | 4569 | ORDER BY course_count DESC |
4570 | 4570 | LIMIT $limit |
@@ -4590,7 +4590,7 @@ discard block |
||
4590 | 4590 | { |
4591 | 4591 | $hotCourses = []; |
4592 | 4592 | |
4593 | - $ajax_url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=add_course_vote'; |
|
4593 | + $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; |
|
4594 | 4594 | |
4595 | 4595 | $stok = Security::get_existing_token(); |
4596 | 4596 | |
@@ -4612,7 +4612,7 @@ discard block |
||
4612 | 4612 | if ($access_link && in_array('register', $access_link)) { |
4613 | 4613 | $my_course['extra_info']['register_button'] = Display::url( |
4614 | 4614 | Display::returnFontAwesomeIcon('sign-in'), |
4615 | - api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?action=subscribe&sec_token=' . $stok, |
|
4615 | + api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?action=subscribe&sec_token='.$stok, |
|
4616 | 4616 | array('class' => 'btn btn-success btn-sm', 'title' => get_lang('Subscribe'))); |
4617 | 4617 | } |
4618 | 4618 | |
@@ -4621,14 +4621,14 @@ discard block |
||
4621 | 4621 | ) { |
4622 | 4622 | $my_course['extra_info']['go_to_course_button'] = Display::url( |
4623 | 4623 | Display::returnFontAwesomeIcon('share'), |
4624 | - api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php', |
|
4624 | + api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php', |
|
4625 | 4625 | array('class' => 'btn btn-default btn-sm', 'title' => get_lang('GoToCourse'))); |
4626 | 4626 | } |
4627 | 4627 | |
4628 | 4628 | if ($access_link && in_array('unsubscribe', $access_link)) { |
4629 | 4629 | $my_course['extra_info']['unsubscribe_button'] = Display::url( |
4630 | 4630 | Display::returnFontAwesomeIcon('sign-out'), |
4631 | - api_get_path(WEB_CODE_PATH) . 'auth/courses.php?action=unsubscribe&unsubscribe=' . $courseCode . '&sec_token=' . $stok . '&category_code=' . $categoryCode, |
|
4631 | + api_get_path(WEB_CODE_PATH).'auth/courses.php?action=unsubscribe&unsubscribe='.$courseCode.'&sec_token='.$stok.'&category_code='.$categoryCode, |
|
4632 | 4632 | array('class' => 'btn btn-danger btn-sm', 'title' => get_lang('Unreg'))); |
4633 | 4633 | } |
4634 | 4634 | |
@@ -4639,7 +4639,7 @@ discard block |
||
4639 | 4639 | ) { */ |
4640 | 4640 | $my_course['extra_info']['description_button'] = Display::url( |
4641 | 4641 | Display::returnFontAwesomeIcon('info-circle'), |
4642 | - api_get_path(WEB_AJAX_PATH) . 'course_home.ajax.php?a=show_course_information&code=' . $course_info['code'], |
|
4642 | + api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=show_course_information&code='.$course_info['code'], |
|
4643 | 4643 | [ |
4644 | 4644 | 'class' => 'btn btn-default btn-sm ajax', |
4645 | 4645 | 'data-title' => get_lang('Description'), |
@@ -4650,8 +4650,8 @@ discard block |
||
4650 | 4650 | /* get_lang('Description') */ |
4651 | 4651 | $my_course['extra_info']['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']); |
4652 | 4652 | $point_info = self::get_course_ranking($course_info['real_id'], 0); |
4653 | - $my_course['extra_info']['rating_html'] = Display::return_rating_system('star_' . $course_info['real_id'], |
|
4654 | - $ajax_url . '&course_id=' . $course_info['real_id'], $point_info); |
|
4653 | + $my_course['extra_info']['rating_html'] = Display::return_rating_system('star_'.$course_info['real_id'], |
|
4654 | + $ajax_url.'&course_id='.$course_info['real_id'], $point_info); |
|
4655 | 4655 | |
4656 | 4656 | $hotCourses[] = $my_course; |
4657 | 4657 | } |
@@ -4725,9 +4725,9 @@ discard block |
||
4725 | 4725 | WHERE |
4726 | 4726 | c.id = u.c_id AND |
4727 | 4727 | u.access_url_id = $urlId AND |
4728 | - visibility <> " . COURSE_VISIBILITY_HIDDEN; |
|
4728 | + visibility <> ".COURSE_VISIBILITY_HIDDEN; |
|
4729 | 4729 | } else { |
4730 | - $sql .= " WHERE visibility <> " . COURSE_VISIBILITY_HIDDEN; |
|
4730 | + $sql .= " WHERE visibility <> ".COURSE_VISIBILITY_HIDDEN; |
|
4731 | 4731 | } |
4732 | 4732 | $res = Database::query($sql); |
4733 | 4733 | $row = Database::fetch_row($res); |
@@ -4747,7 +4747,7 @@ discard block |
||
4747 | 4747 | |
4748 | 4748 | $withoutSpecialCourses = ''; |
4749 | 4749 | if (!empty($specialCourseList)) { |
4750 | - $withoutSpecialCourses = ' AND c.code NOT IN ("' . implode('","', $specialCourseList) . '")'; |
|
4750 | + $withoutSpecialCourses = ' AND c.code NOT IN ("'.implode('","', $specialCourseList).'")'; |
|
4751 | 4751 | } |
4752 | 4752 | |
4753 | 4753 | $visibilityCondition = null; |
@@ -4881,12 +4881,12 @@ discard block |
||
4881 | 4881 | if (count($teachers) > 0) { |
4882 | 4882 | foreach ($teachers as $key) { |
4883 | 4883 | $key = Database::escape_string($key); |
4884 | - $cond .= " AND user_id <> '" . $key . "'"; |
|
4884 | + $cond .= " AND user_id <> '".$key."'"; |
|
4885 | 4885 | } |
4886 | 4886 | } |
4887 | 4887 | |
4888 | - $sql = 'DELETE FROM ' . $course_user_table . ' |
|
4889 | - WHERE c_id ="' . $courseId . '" AND status="1" AND relation_type = 0 ' . $cond; |
|
4888 | + $sql = 'DELETE FROM '.$course_user_table.' |
|
4889 | + WHERE c_id ="' . $courseId.'" AND status="1" AND relation_type = 0 '.$cond; |
|
4890 | 4890 | Database::query($sql); |
4891 | 4891 | } |
4892 | 4892 | |
@@ -4894,12 +4894,12 @@ discard block |
||
4894 | 4894 | foreach ($teachers as $userId) { |
4895 | 4895 | $userId = intval($userId); |
4896 | 4896 | // We check if the teacher is already subscribed in this course |
4897 | - $sql = 'SELECT 1 FROM ' . $course_user_table . ' |
|
4898 | - WHERE user_id = "' . $userId . '" AND c_id = "' . $courseId . '" '; |
|
4897 | + $sql = 'SELECT 1 FROM '.$course_user_table.' |
|
4898 | + WHERE user_id = "' . $userId.'" AND c_id = "'.$courseId.'" '; |
|
4899 | 4899 | $result = Database::query($sql); |
4900 | 4900 | if (Database::num_rows($result)) { |
4901 | - $sql = 'UPDATE ' . $course_user_table . ' SET status = "1" |
|
4902 | - WHERE c_id = "' . $courseId . '" AND user_id = "' . $userId . '" '; |
|
4901 | + $sql = 'UPDATE '.$course_user_table.' SET status = "1" |
|
4902 | + WHERE c_id = "' . $courseId.'" AND user_id = "'.$userId.'" '; |
|
4903 | 4903 | } else { |
4904 | 4904 | $userCourseCategory = '0'; |
4905 | 4905 | if (isset($teacherBackup[$userId]) && |
@@ -4909,9 +4909,9 @@ discard block |
||
4909 | 4909 | $userCourseCategory = $courseUserData['user_course_cat']; |
4910 | 4910 | } |
4911 | 4911 | |
4912 | - $sql = "INSERT INTO " . $course_user_table . " SET |
|
4913 | - c_id = " . $courseId . ", |
|
4914 | - user_id = " . $userId . ", |
|
4912 | + $sql = "INSERT INTO ".$course_user_table." SET |
|
4913 | + c_id = " . $courseId.", |
|
4914 | + user_id = " . $userId.", |
|
4915 | 4915 | status = '1', |
4916 | 4916 | is_tutor = '0', |
4917 | 4917 | sort = '0', |
@@ -5247,8 +5247,8 @@ discard block |
||
5247 | 5247 | { |
5248 | 5248 | $tbl_main_categories = Database:: get_main_table(TABLE_MAIN_COURSE); |
5249 | 5249 | $sql = 'SELECT title |
5250 | - FROM ' . $tbl_main_categories . ' |
|
5251 | - WHERE code = "' . Database::escape_string($code) . '"'; |
|
5250 | + FROM ' . $tbl_main_categories.' |
|
5251 | + WHERE code = "' . Database::escape_string($code).'"'; |
|
5252 | 5252 | $result = Database::query($sql); |
5253 | 5253 | if ($col = Database::fetch_array($result)) { |
5254 | 5254 | return $col['title']; |
@@ -5431,7 +5431,7 @@ discard block |
||
5431 | 5431 | foreach ($group_list as $this_group) { |
5432 | 5432 | if (is_array($to_already_selected)) { |
5433 | 5433 | if (!in_array( |
5434 | - "GROUP:" . $this_group['id'], |
|
5434 | + "GROUP:".$this_group['id'], |
|
5435 | 5435 | $to_already_selected |
5436 | 5436 | ) |
5437 | 5437 | ) { // $to_already_selected is the array containing the groups (and users) that are already selected |
@@ -5439,8 +5439,8 @@ discard block |
||
5439 | 5439 | $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled"; |
5440 | 5440 | $result[] = array( |
5441 | 5441 | 'disabled' => $user_disabled, |
5442 | - 'value' => "GROUP:" . $this_group['id'], |
|
5443 | - 'content' => "G: " . $this_group['name'] . " - " . $this_group['userNb'] . " " . $user_label |
|
5442 | + 'value' => "GROUP:".$this_group['id'], |
|
5443 | + 'content' => "G: ".$this_group['name']." - ".$this_group['userNb']." ".$user_label |
|
5444 | 5444 | ); |
5445 | 5445 | } |
5446 | 5446 | } |
@@ -5452,13 +5452,13 @@ discard block |
||
5452 | 5452 | foreach ($user_list as $user) { |
5453 | 5453 | if (is_array($to_already_selected)) { |
5454 | 5454 | if (!in_array( |
5455 | - "USER:" . $user['user_id'], |
|
5455 | + "USER:".$user['user_id'], |
|
5456 | 5456 | $to_already_selected |
5457 | 5457 | ) |
5458 | 5458 | ) { // $to_already_selected is the array containing the users (and groups) that are already selected |
5459 | 5459 | |
5460 | 5460 | $result[] = array( |
5461 | - 'value' => "USER:" . $user['user_id'], |
|
5461 | + 'value' => "USER:".$user['user_id'], |
|
5462 | 5462 | 'content' => api_get_person_name($user['firstname'], $user['lastname']) |
5463 | 5463 | ); |
5464 | 5464 | } |
@@ -5487,7 +5487,7 @@ discard block |
||
5487 | 5487 | { |
5488 | 5488 | $category_id = intval($category_id); |
5489 | 5489 | $info = Database::fetch_array( |
5490 | - Database::query('SELECT course_code FROM ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY) . ' |
|
5490 | + Database::query('SELECT course_code FROM '.Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY).' |
|
5491 | 5491 | WHERE id=' . $category_id), 'ASSOC' |
5492 | 5492 | ); |
5493 | 5493 | return $info ? $info['course_code'] : false; |
@@ -5503,15 +5503,14 @@ discard block |
||
5503 | 5503 | public static function getCoursesWithoutSession($startDate = null, $endDate = null, $includeClosed = false) |
5504 | 5504 | { |
5505 | 5505 | $dateConditional = ($startDate && $endDate) ? |
5506 | - " WHERE session_id IN (SELECT id FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . |
|
5507 | - " WHERE access_start_date = '$startDate' AND access_end_date = '$endDate')" : |
|
5508 | - null; |
|
5506 | + " WHERE session_id IN (SELECT id FROM ".Database::get_main_table(TABLE_MAIN_SESSION). |
|
5507 | + " WHERE access_start_date = '$startDate' AND access_end_date = '$endDate')" : null; |
|
5509 | 5508 | $visibility = ($includeClosed ? '' : 'visibility NOT IN (0, 4) AND '); |
5510 | 5509 | |
5511 | 5510 | $query = "SELECT id, code, title |
5512 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE). " |
|
5511 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." |
|
5513 | 5512 | WHERE $visibility code NOT IN ( |
5514 | - SELECT DISTINCT course_code FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE) . $dateConditional . ") |
|
5513 | + SELECT DISTINCT course_code FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE).$dateConditional.") |
|
5515 | 5514 | ORDER BY id"; |
5516 | 5515 | |
5517 | 5516 | $result = Database::query($query); |
@@ -5544,7 +5543,7 @@ discard block |
||
5544 | 5543 | FROM $courseTable c |
5545 | 5544 | INNER JOIN $courseUserTable cru ON c.id = cru.c_id |
5546 | 5545 | WHERE ( |
5547 | - cru.user_id IN (" . implode(', ', $userIdList) . ") |
|
5546 | + cru.user_id IN (".implode(', ', $userIdList).") |
|
5548 | 5547 | AND cru.relation_type = 0 |
5549 | 5548 | )"; |
5550 | 5549 | |
@@ -5559,7 +5558,7 @@ discard block |
||
5559 | 5558 | INNER JOIN $courseAccessUrlTable crau ON c.id = crau.c_id |
5560 | 5559 | WHERE crau.access_url_id = $accessUrlId |
5561 | 5560 | AND ( |
5562 | - cru.id_user IN (" . implode(', ', $userIdList) . ") AND |
|
5561 | + cru.id_user IN (".implode(', ', $userIdList).") AND |
|
5563 | 5562 | cru.relation_type = 0 |
5564 | 5563 | )"; |
5565 | 5564 | } |
@@ -5668,7 +5667,7 @@ discard block |
||
5668 | 5667 | |
5669 | 5668 | $without_special_courses = ''; |
5670 | 5669 | if (!empty($special_course_list)) { |
5671 | - $without_special_courses = ' AND course.code NOT IN ("'.implode('","',$special_course_list).'")'; |
|
5670 | + $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $special_course_list).'")'; |
|
5672 | 5671 | } |
5673 | 5672 | |
5674 | 5673 | //AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." |
@@ -5724,11 +5723,11 @@ discard block |
||
5724 | 5723 | |
5725 | 5724 | if (api_is_platform_admin()) { |
5726 | 5725 | if ($loadDirs) { |
5727 | - $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5728 | - $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5726 | + $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5727 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5729 | 5728 | $params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container')); |
5730 | 5729 | } else { |
5731 | - $params['right_actions'].= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5730 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5732 | 5731 | } |
5733 | 5732 | |
5734 | 5733 | if ($course_info['status'] == COURSEMANAGER) { |
@@ -5737,11 +5736,11 @@ discard block |
||
5737 | 5736 | } else { |
5738 | 5737 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) { |
5739 | 5738 | if ($loadDirs) { |
5740 | - $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5739 | + $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5741 | 5740 | $params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container')); |
5742 | 5741 | } else { |
5743 | 5742 | if ($course_info['status'] == COURSEMANAGER) { |
5744 | - $params['right_actions'].= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5743 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5745 | 5744 | } |
5746 | 5745 | } |
5747 | 5746 | } |
@@ -5752,7 +5751,7 @@ discard block |
||
5752 | 5751 | $course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/?id_session=0'; |
5753 | 5752 | $course_title = Display::url($course_info['title'], $course_title_url); |
5754 | 5753 | } else { |
5755 | - $course_title = $course_info['title']." ".Display::tag('span',get_lang('CourseClosed'), array('class'=>'item_closed')); |
|
5754 | + $course_title = $course_info['title']." ".Display::tag('span', get_lang('CourseClosed'), array('class'=>'item_closed')); |
|
5756 | 5755 | } |
5757 | 5756 | |
5758 | 5757 | // Start displaying the course block itself |
@@ -1880,7 +1880,7 @@ discard block |
||
1880 | 1880 | $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher); |
1881 | 1881 | } |
1882 | 1882 | $html .= '</ul>'; |
1883 | - }else{ |
|
1883 | + } else{ |
|
1884 | 1884 | $html .= array_to_string($list, $separator); |
1885 | 1885 | } |
1886 | 1886 | } |
@@ -3236,7 +3236,7 @@ discard block |
||
3236 | 3236 | $html .= '<a class="thumbnail" href="'.$params['link'].'">'; |
3237 | 3237 | $html .= $params['icon']; |
3238 | 3238 | $html .= '</a>'; |
3239 | - }else{ |
|
3239 | + } else{ |
|
3240 | 3240 | $html .= $params['icon']; |
3241 | 3241 | } |
3242 | 3242 | $html .= '</div>'; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string $canHaveCourses |
112 | 112 | * @param int $parent_id |
113 | 113 | * |
114 | - * @return bool |
|
114 | + * @return false|string |
|
115 | 115 | */ |
116 | 116 | function addNode($code, $name, $canHaveCourses, $parent_id) |
117 | 117 | { |
@@ -306,8 +306,7 @@ discard block |
||
306 | 306 | /** |
307 | 307 | * Counts the number of children categories a category has |
308 | 308 | * @param int $categoryId The ID of the category of which we want to count the children |
309 | - * @param int $count The number of subcategories we counted this far |
|
310 | - * @return mixed The number of subcategories this category has |
|
309 | + * @return integer The number of subcategories this category has |
|
311 | 310 | */ |
312 | 311 | function courseCategoryChildrenCount($categoryId) |
313 | 312 | { |
@@ -474,7 +473,7 @@ discard block |
||
474 | 473 | /** |
475 | 474 | * @param int $id |
476 | 475 | * |
477 | - * @return bool |
|
476 | + * @return false|null |
|
478 | 477 | */ |
479 | 478 | function addToUrl($id) |
480 | 479 | { |
@@ -970,7 +969,7 @@ discard block |
||
970 | 969 | * Get Pagination HTML div |
971 | 970 | * @param $pageCurrent |
972 | 971 | * @param $pageLength |
973 | - * @param $pageTotal |
|
972 | + * @param integer $pageTotal |
|
974 | 973 | * @return string |
975 | 974 | */ |
976 | 975 | function getCataloguePagination($pageCurrent, $pageLength, $pageTotal) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | $parentIdCondition = " AND (t1.parent_id IS NULL OR t1.parent_id = '' )"; |
70 | 70 | if (!empty($category)) { |
71 | - $parentIdCondition = " AND t1.parent_id = '$category' "; |
|
71 | + $parentIdCondition = " AND t1.parent_id = '$category' "; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $sql = "SELECT |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $categories = Database::store_result($result); |
101 | 101 | foreach ($categories as $category) { |
102 | - $category['nbr_courses'] = 1; |
|
102 | + $category['nbr_courses'] = 1; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $categories; |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | if ($row = Database::fetch_array($result)) { |
197 | 197 | if (!empty($row['parent_id'])) { |
198 | 198 | Database::query("UPDATE $tbl_course SET category_code = '".$row['parent_id']."' WHERE category_code='$node'"); |
199 | - Database::query("UPDATE $tbl_category SET parent_id='" . $row['parent_id'] . "' WHERE parent_id='$node'"); |
|
199 | + Database::query("UPDATE $tbl_category SET parent_id='".$row['parent_id']."' WHERE parent_id='$node'"); |
|
200 | 200 | } else { |
201 | 201 | Database::query("UPDATE $tbl_course SET category_code='' WHERE category_code='$node'"); |
202 | 202 | Database::query("UPDATE $tbl_category SET parent_id=NULL WHERE parent_id='$node'"); |
203 | 203 | } |
204 | 204 | |
205 | - Database::query("UPDATE $tbl_category SET tree_pos=tree_pos-1 WHERE tree_pos > '" . $row['tree_pos'] . "'"); |
|
205 | + Database::query("UPDATE $tbl_category SET tree_pos=tree_pos-1 WHERE tree_pos > '".$row['tree_pos']."'"); |
|
206 | 206 | Database::query("DELETE FROM $tbl_category WHERE code='$node'"); |
207 | 207 | |
208 | 208 | if (!empty($row['parent_id'])) { |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | $sql = "UPDATE $tbl_category |
294 | - SET tree_pos ='" . $row['tree_pos'] . "' |
|
294 | + SET tree_pos ='".$row['tree_pos']."' |
|
295 | 295 | WHERE code='$code'"; |
296 | 296 | Database::query($sql); |
297 | 297 | |
298 | 298 | $sql = "UPDATE $tbl_category |
299 | 299 | SET tree_pos = '$tree_pos' |
300 | - WHERE code= '" . $row['code'] . "'"; |
|
300 | + WHERE code= '".$row['code']."'"; |
|
301 | 301 | Database::query($sql); |
302 | 302 | |
303 | 303 | return true; |
@@ -424,12 +424,12 @@ discard block |
||
424 | 424 | |
425 | 425 | $editIcon = Display::return_icon('edit.png', get_lang('EditNode'), null, ICON_SIZE_SMALL); |
426 | 426 | $deleteIcon = Display::return_icon('delete.png', get_lang('DeleteNode'), null, ICON_SIZE_SMALL); |
427 | - $moveIcon = Display::return_icon('up.png', get_lang('UpInSameLevel'), null, ICON_SIZE_SMALL); |
|
427 | + $moveIcon = Display::return_icon('up.png', get_lang('UpInSameLevel'), null, ICON_SIZE_SMALL); |
|
428 | 428 | |
429 | 429 | foreach ($categories as $category) { |
430 | 430 | |
431 | 431 | $editUrl = $mainUrl.'&id='.$category['code'].'&action=edit'; |
432 | - $moveUrl = $mainUrl.'&id='.$category['code'].'&action=moveUp&tree_pos='.$category['tree_pos']; |
|
432 | + $moveUrl = $mainUrl.'&id='.$category['code'].'&action=moveUp&tree_pos='.$category['tree_pos']; |
|
433 | 433 | $deleteUrl = $mainUrl.'&id='.$category['code'].'&action=delete'; |
434 | 434 | |
435 | 435 | $actions = Display::url($editIcon, $editUrl).Display::url($moveIcon, $moveUrl).Display::url($deleteIcon, $deleteUrl); |
@@ -563,12 +563,12 @@ discard block |
||
563 | 563 | |
564 | 564 | $count_courses = countCoursesInCategory(); |
565 | 565 | |
566 | - $categories[0][count($categories[0])+1] = array( |
|
566 | + $categories[0][count($categories[0]) + 1] = array( |
|
567 | 567 | 'id' =>0, |
568 | 568 | 'name' => get_lang('None'), |
569 | 569 | 'code' => 'NONE', |
570 | 570 | 'parent_id' => null, |
571 | - 'tree_pos' => $row['tree_pos']+1, |
|
571 | + 'tree_pos' => $row['tree_pos'] + 1, |
|
572 | 572 | 'children_count' => 0, |
573 | 573 | 'auth_course_child' => true, |
574 | 574 | 'auth_cat_child' => true, |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | * @param string $searchTerm |
584 | 584 | * @return int |
585 | 585 | */ |
586 | -function countCoursesInCategory($category_code="", $searchTerm = '') |
|
586 | +function countCoursesInCategory($category_code = "", $searchTerm = '') |
|
587 | 587 | { |
588 | 588 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
589 | 589 | $categoryCode = Database::escape_string($category_code); |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | $without_special_courses = ''; |
597 | 597 | if (!empty($specialCourseList)) { |
598 | - $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $specialCourseList) . '")'; |
|
598 | + $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $specialCourseList).'")'; |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | $visibilityCondition = null; |
@@ -609,15 +609,15 @@ discard block |
||
609 | 609 | if ($categoryCode == 'ALL') { |
610 | 610 | // Nothing to do |
611 | 611 | } elseif ($categoryCode == 'NONE') { |
612 | - $categoryFilter = ' AND category_code = "" '; |
|
612 | + $categoryFilter = ' AND category_code = "" '; |
|
613 | 613 | } else { |
614 | - $categoryFilter = ' AND category_code = "' . $categoryCode . '" '; |
|
614 | + $categoryFilter = ' AND category_code = "'.$categoryCode.'" '; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | if (!empty($searchTerm)) { |
618 | - $searchFilter = ' AND (code LIKE "%' . $searchTerm . '%" |
|
619 | - OR title LIKE "%' . $searchTerm . '%" |
|
620 | - OR tutor_name LIKE "%' . $searchTerm . '%") '; |
|
618 | + $searchFilter = ' AND (code LIKE "%'.$searchTerm.'%" |
|
619 | + OR title LIKE "%' . $searchTerm.'%" |
|
620 | + OR tutor_name LIKE "%' . $searchTerm.'%") '; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | $sql = "SELECT * FROM $tbl_course |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | |
669 | 669 | $without_special_courses = ''; |
670 | 670 | if (!empty($specialCourseList)) { |
671 | - $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $specialCourseList) . '")'; |
|
671 | + $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $specialCourseList).'")'; |
|
672 | 672 | } |
673 | 673 | $visibilityCondition = null; |
674 | 674 | $hidePrivate = api_get_setting('course_catalog_hide_private'); |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | $id_in = null; |
717 | 717 | while (list($id) = Database::fetch_row($result)) { |
718 | 718 | if ($id_in) { |
719 | - $id_in.=",$id"; |
|
719 | + $id_in .= ",$id"; |
|
720 | 720 | } else { |
721 | 721 | $id_in = "$id"; |
722 | 722 | } |
@@ -937,11 +937,9 @@ discard block |
||
937 | 937 | function getLimitArray() |
938 | 938 | { |
939 | 939 | $pageCurrent = isset($_REQUEST['pageCurrent']) ? |
940 | - intval($_GET['pageCurrent']) : |
|
941 | - 1; |
|
940 | + intval($_GET['pageCurrent']) : 1; |
|
942 | 941 | $pageLength = isset($_REQUEST['pageLength']) ? |
943 | - intval($_GET['pageLength']) : |
|
944 | - 10; |
|
942 | + intval($_GET['pageLength']) : 10; |
|
945 | 943 | return array( |
946 | 944 | 'start' => ($pageCurrent - 1) * $pageLength, |
947 | 945 | 'current' => $pageCurrent, |
@@ -960,7 +958,7 @@ discard block |
||
960 | 958 | if (!empty($limit) && is_array($limit)) { |
961 | 959 | $limitStart = isset($limit['start']) ? $limit['start'] : 0; |
962 | 960 | $limitLength = isset($limit['length']) ? $limit['length'] : 10; |
963 | - $limitFilter = 'LIMIT ' . $limitStart . ', ' . $limitLength; |
|
961 | + $limitFilter = 'LIMIT '.$limitStart.', '.$limitLength; |
|
964 | 962 | } |
965 | 963 | |
966 | 964 | return $limitFilter; |
@@ -977,7 +975,7 @@ discard block |
||
977 | 975 | { |
978 | 976 | // Start empty html |
979 | 977 | $pageDiv = ''; |
980 | - $html=''; |
|
978 | + $html = ''; |
|
981 | 979 | $pageBottom = max(1, $pageCurrent - 3); |
982 | 980 | $pageTop = min($pageTotal, $pageCurrent + 3); |
983 | 981 | |
@@ -1052,21 +1050,21 @@ discard block |
||
1052 | 1050 | $hiddenLinks = isset($hiddenLinks) ? Security::remove_XSS($hiddenLinksRequest) : $categoryCodeRequest; |
1053 | 1051 | |
1054 | 1052 | // Start URL with params |
1055 | - $pageUrl = api_get_self() . |
|
1056 | - '?action=' . $action . |
|
1057 | - '&category_code=' .$categoryCode. |
|
1058 | - '&hidden_links=' .$hiddenLinks. |
|
1059 | - '&pageCurrent=' . $pageCurrent . |
|
1060 | - '&pageLength=' . $pageLength |
|
1053 | + $pageUrl = api_get_self(). |
|
1054 | + '?action='.$action. |
|
1055 | + '&category_code='.$categoryCode. |
|
1056 | + '&hidden_links='.$hiddenLinks. |
|
1057 | + '&pageCurrent='.$pageCurrent. |
|
1058 | + '&pageLength='.$pageLength |
|
1061 | 1059 | ; |
1062 | 1060 | |
1063 | 1061 | switch ($action) { |
1064 | 1062 | case 'subscribe' : |
1065 | 1063 | // for search |
1066 | 1064 | $pageUrl .= |
1067 | - '&search_term=' . $searchTerm . |
|
1068 | - '&search_course=1' . |
|
1069 | - '&sec_token=' . $_SESSION['sec_token']; |
|
1065 | + '&search_term='.$searchTerm. |
|
1066 | + '&search_course=1'. |
|
1067 | + '&sec_token='.$_SESSION['sec_token']; |
|
1070 | 1068 | break; |
1071 | 1069 | case 'display_courses' : |
1072 | 1070 | // No break |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * Get all data by description and session id, |
96 | 96 | * first you must set session_id property with the object CourseDescription |
97 | 97 | * @param int $description_type Description type |
98 | - * @param string $course_code Course code (optional) |
|
98 | + * @param string $courseId Course code (optional) |
|
99 | 99 | * @param int $session_id Session id (optional) |
100 | 100 | * @return array List of fields from the descriptions found of the given type |
101 | 101 | */ |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | /** |
361 | 361 | * Get description titles by default |
362 | - * @return array |
|
362 | + * @return string[] |
|
363 | 363 | */ |
364 | 364 | public function get_default_description_title() |
365 | 365 | { |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Get description titles editable by default |
381 | - * @return array |
|
381 | + * @return boolean[] |
|
382 | 382 | */ |
383 | 383 | public function get_default_description_title_editable() |
384 | 384 | { |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | /** |
399 | 399 | * Get description icons by default |
400 | - * @return array |
|
400 | + * @return string[] |
|
401 | 401 | */ |
402 | 402 | public function get_default_description_icon() |
403 | 403 | { |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Get questions by default for help |
420 | - * @return array |
|
420 | + * @return string[] |
|
421 | 421 | */ |
422 | 422 | public function get_default_question() |
423 | 423 | { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | /** |
438 | 438 | * Get informations by default for help |
439 | - * @return array |
|
439 | + * @return string[] |
|
440 | 440 | */ |
441 | 441 | public function get_default_information() |
442 | 442 | { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $sql = "SELECT MAX(description_type) as MAX |
178 | 178 | FROM $tbl_course_description |
179 | - WHERE c_id = $course_id AND session_id='" . $this->session_id . "'"; |
|
179 | + WHERE c_id = $course_id AND session_id='".$this->session_id."'"; |
|
180 | 180 | $rs = Database::query($sql); |
181 | 181 | $max = Database::fetch_array($rs); |
182 | 182 | $description_type = $max['MAX'] + 1; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | 'session_id' => $this->session_id |
212 | 212 | ]; |
213 | 213 | |
214 | - $last_id = Database::insert($table, $params); |
|
214 | + $last_id = Database::insert($table, $params); |
|
215 | 215 | |
216 | 216 | if ($last_id > 0) { |
217 | 217 | $sql = "UPDATE $table SET id = iid WHERE iid = $last_id"; |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | $sql = "DELETE FROM $tbl_course_description |
320 | 320 | WHERE |
321 | 321 | c_id = $course_id AND |
322 | - id = '" . intval($this->id) . "' AND |
|
323 | - session_id = '" . intval($this->session_id) . "'"; |
|
322 | + id = '".intval($this->id)."' AND |
|
323 | + session_id = '" . intval($this->session_id)."'"; |
|
324 | 324 | $result = Database::query($sql); |
325 | 325 | $affected_rows = Database::affected_rows($result); |
326 | 326 | if ($this->id > 0) { |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $course_id = api_get_course_int_id(); |
350 | 350 | |
351 | 351 | $sql = "SELECT id FROM $tbl_course_description |
352 | - WHERE c_id = $course_id AND description_type = '" . intval($description_type) . "'"; |
|
352 | + WHERE c_id = $course_id AND description_type = '".intval($description_type)."'"; |
|
353 | 353 | $rs = Database::query($sql); |
354 | 354 | $row = Database::fetch_array($rs); |
355 | 355 | $description_id = $row['id']; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | /** |
214 | 214 | * Displays the tools of a certain category. |
215 | 215 | * |
216 | - * @return void |
|
216 | + * @return string |
|
217 | 217 | * @param string $course_tool_category contains the category of tools to display: |
218 | 218 | * "Public", "PublicButHide", "courseAdmin", "claroAdmin" |
219 | 219 | */ |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @param array $all_tools_list List of tools as returned by get_tools_category() |
651 | 651 | * @param bool $rows |
652 | 652 | * |
653 | - * @return void |
|
653 | + * @return string |
|
654 | 654 | */ |
655 | 655 | public static function show_tools_category($all_tools_list, $rows = false) |
656 | 656 | { |
@@ -1194,6 +1194,7 @@ discard block |
||
1194 | 1194 | |
1195 | 1195 | /** |
1196 | 1196 | * Show a toolbar with shortcuts to the course tool |
1197 | + * @param integer $orientation |
|
1197 | 1198 | */ |
1198 | 1199 | public static function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL) |
1199 | 1200 | { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | array(), |
352 | 352 | null, |
353 | 353 | ICON_SIZE_MEDIUM |
354 | - ) . ' ' . $tool_name . '</a>'; |
|
354 | + ).' '.$tool_name.'</a>'; |
|
355 | 355 | |
356 | 356 | // This part displays the links to hide or remove a tool. |
357 | 357 | // These links are only visible by the course manager. |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $session_id = api_get_session_id(); |
679 | 679 | $is_platform_admin = api_is_platform_admin(); |
680 | 680 | |
681 | - if ($session_id == 0 ) { |
|
681 | + if ($session_id == 0) { |
|
682 | 682 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true) && api_is_course_admin(); |
683 | 683 | } else { |
684 | 684 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true) && !api_is_coach(); |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | return array(); |
1256 | 1256 | } |
1257 | 1257 | |
1258 | - $table = Database::get_course_table(TABLE_TOOL_LIST); |
|
1258 | + $table = Database::get_course_table(TABLE_TOOL_LIST); |
|
1259 | 1259 | $sql = "SELECT * FROM $table |
1260 | 1260 | WHERE category in ('authoring','interaction') |
1261 | 1261 | AND c_id = $courseId |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | $temp = new Image($path); |
1362 | 1362 | $r = $temp->convert2bw(); |
1363 | 1363 | $ext = pathinfo($path, PATHINFO_EXTENSION); |
1364 | - $bwPath = substr($path,0,-(strlen($ext)+1)) . '_na.' . $ext; |
|
1364 | + $bwPath = substr($path, 0, -(strlen($ext) + 1)).'_na.'.$ext; |
|
1365 | 1365 | |
1366 | 1366 | if ($r === false) { |
1367 | 1367 | error_log('Conversion to B&W of '.$path.' failed in '.__FILE__.' at line '.__LINE__); |
@@ -1200,9 +1200,9 @@ |
||
1200 | 1200 | $navigation_items = self::get_navigation_items(false); |
1201 | 1201 | $html = ''; |
1202 | 1202 | if (!empty($navigation_items)) { |
1203 | - if ($orientation == SHORTCUTS_HORIZONTAL) |
|
1204 | - $style_id = "toolshortcuts_horizontal"; |
|
1205 | - else { |
|
1203 | + if ($orientation == SHORTCUTS_HORIZONTAL) { |
|
1204 | + $style_id = "toolshortcuts_horizontal"; |
|
1205 | + } else { |
|
1206 | 1206 | $style_id = "toolshortcuts_vertical"; |
1207 | 1207 | } |
1208 | 1208 | $html .= '<div id="'.$style_id.'">'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Checks whether a given course code has been already occupied. |
20 | 20 | * @param string $wanted_course_code The code to be checked. |
21 | - * @return string |
|
21 | + * @return boolean |
|
22 | 22 | * Returns TRUE if there is created: |
23 | 23 | * - a course with the same code OR visual_code (visualcode). |
24 | 24 | * - a course request with the same code as the given one, or |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * @param null $status |
|
371 | + * @param integer $status |
|
372 | 372 | * @return bool |
373 | 373 | */ |
374 | 374 | public static function count_course_requests($status = null) |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Gets all the information about a course request using its database id as an access key. |
393 | - * @param int/string $id The id (an integer number) of the corresponding database record. |
|
393 | + * @param integer $id The id (an integer number) of the corresponding database record. |
|
394 | 394 | * @return array/bool Returns the requested data as an array or FALSE on failure. |
395 | 395 | */ |
396 | 396 | public static function get_course_request_info($id) |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $exemplary_content |
66 | 66 | ) { |
67 | 67 | $wanted_code = trim($wanted_code); |
68 | - $user_id = (int)$user_id; |
|
69 | - $exemplary_content = (bool)$exemplary_content ? 1 : 0; |
|
68 | + $user_id = (int) $user_id; |
|
69 | + $exemplary_content = (bool) $exemplary_content ? 1 : 0; |
|
70 | 70 | |
71 | 71 | if ($wanted_code == '') { |
72 | 72 | return false; |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | $user_id, |
255 | 255 | $exemplary_content |
256 | 256 | ) { |
257 | - $id = (int)$id; |
|
257 | + $id = (int) $id; |
|
258 | 258 | $wanted_code = trim($wanted_code); |
259 | - $user_id = (int)$user_id; |
|
260 | - $exemplary_content = (bool)$exemplary_content ? 1 : 0; |
|
259 | + $user_id = (int) $user_id; |
|
260 | + $exemplary_content = (bool) $exemplary_content ? 1 : 0; |
|
261 | 261 | |
262 | 262 | if ($wanted_code == '') { |
263 | 263 | return false; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public static function delete_course_request($id) |
362 | 362 | { |
363 | - $id = (int)$id; |
|
363 | + $id = (int) $id; |
|
364 | 364 | $sql = "DELETE FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
365 | 365 | WHERE id = ".$id; |
366 | 366 | $result = Database::query($sql); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | if (is_null($status)) { |
378 | 378 | $sql = "SELECT COUNT(id) AS number FROM ".$course_table; |
379 | 379 | } else { |
380 | - $status = (int)$status; |
|
380 | + $status = (int) $status; |
|
381 | 381 | $sql = "SELECT COUNT(id) AS number FROM ".$course_table." |
382 | 382 | WHERE status = ".$status; |
383 | 383 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public static function get_course_request_info($id) |
397 | 397 | { |
398 | - $id = (int)$id; |
|
398 | + $id = (int) $id; |
|
399 | 399 | $sql = "SELECT * |
400 | 400 | FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
401 | 401 | WHERE id = ".$id; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public static function get_course_request_code($id) |
415 | 415 | { |
416 | - $id = (int)$id; |
|
416 | + $id = (int) $id; |
|
417 | 417 | $sql = "SELECT code |
418 | 418 | FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
419 | 419 | WHERE id = ".$id; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public static function accept_course_request($id) |
436 | 436 | { |
437 | - $id = (int)$id; |
|
437 | + $id = (int) $id; |
|
438 | 438 | |
439 | 439 | // Retrieve request's data |
440 | 440 | $course_request_info = self::get_course_request_info($id); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | return false; |
448 | 448 | }*/ |
449 | 449 | |
450 | - $user_id = (int)$course_request_info['user_id']; |
|
450 | + $user_id = (int) $course_request_info['user_id']; |
|
451 | 451 | if ($user_id <= 0) { |
452 | 452 | return false; |
453 | 453 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | */ |
532 | 532 | public static function reject_course_request($id) |
533 | 533 | { |
534 | - $id = (int)$id; |
|
534 | + $id = (int) $id; |
|
535 | 535 | // Retrieve request's data |
536 | 536 | $course_request_info = self::get_course_request_info($id); |
537 | 537 | if (!is_array($course_request_info)) { |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public static function ask_for_additional_info($id) |
611 | 611 | { |
612 | - $id = (int)$id; |
|
612 | + $id = (int) $id; |
|
613 | 613 | |
614 | 614 | // Retrieve request's data |
615 | 615 | $course_request_info = self::get_course_request_info($id); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | */ |
701 | 701 | public static function additional_info_asked($id) |
702 | 702 | { |
703 | - $id = (int)$id; |
|
703 | + $id = (int) $id; |
|
704 | 704 | $sql = "SELECT id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
705 | 705 | WHERE (id = ".$id." AND info > 0)"; |
706 | 706 | $result = Database::num_rows(Database::query($sql)); |
@@ -493,6 +493,7 @@ |
||
493 | 493 | * This function update extra user blocks data after closing a dashboard block |
494 | 494 | * @param int User id |
495 | 495 | * @param string plugin path |
496 | + * @param integer $user_id |
|
496 | 497 | * @return bool |
497 | 498 | */ |
498 | 499 | public static function close_user_block($user_id, $path) |
@@ -249,282 +249,282 @@ |
||
249 | 249 | return $affected_rows; |
250 | 250 | } |
251 | 251 | |
252 | - /** |
|
253 | - * Get all plugins path inside dashboard directory |
|
254 | - * @return array name plugins directories |
|
255 | - */ |
|
256 | - public static function getPossibleDashboardPluginsPath() |
|
252 | + /** |
|
253 | + * Get all plugins path inside dashboard directory |
|
254 | + * @return array name plugins directories |
|
255 | + */ |
|
256 | + public static function getPossibleDashboardPluginsPath() |
|
257 | 257 | { |
258 | - // get all plugins path inside plugin directory |
|
259 | - /* We scan the plugin directory. Each folder is a potential plugin. */ |
|
260 | - $possiblePlugins = array(); |
|
261 | - $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/'; |
|
262 | - $handle = @opendir($dashboard_pluginpath); |
|
263 | - while (false !== ($file = readdir($handle))) { |
|
264 | - if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) { |
|
265 | - $possiblePlugins[] = $file; |
|
266 | - } |
|
267 | - } |
|
268 | - @closedir($handle); |
|
269 | - |
|
270 | - return $possiblePlugins; |
|
271 | - } |
|
272 | - |
|
273 | - /** |
|
274 | - * Get all blocks data without plugin directory |
|
275 | - * @return array Block data |
|
276 | - */ |
|
277 | - public static function get_block_data_without_plugin() |
|
258 | + // get all plugins path inside plugin directory |
|
259 | + /* We scan the plugin directory. Each folder is a potential plugin. */ |
|
260 | + $possiblePlugins = array(); |
|
261 | + $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/'; |
|
262 | + $handle = @opendir($dashboard_pluginpath); |
|
263 | + while (false !== ($file = readdir($handle))) { |
|
264 | + if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) { |
|
265 | + $possiblePlugins[] = $file; |
|
266 | + } |
|
267 | + } |
|
268 | + @closedir($handle); |
|
269 | + |
|
270 | + return $possiblePlugins; |
|
271 | + } |
|
272 | + |
|
273 | + /** |
|
274 | + * Get all blocks data without plugin directory |
|
275 | + * @return array Block data |
|
276 | + */ |
|
277 | + public static function get_block_data_without_plugin() |
|
278 | 278 | { |
279 | - $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
280 | - $possibleplugins = self::getPossibleDashboardPluginsPath(); |
|
281 | - |
|
282 | - // We check if plugin exists inside directory for updating active field |
|
283 | - $sql = "SELECT * FROM $tbl_block"; |
|
284 | - $rs = Database::query($sql); |
|
285 | - if (Database::num_rows($rs) > 0){ |
|
286 | - while ($row = Database::fetch_array($rs)) { |
|
287 | - $path = $row['path']; |
|
288 | - if (!in_array($row['path'],$possibleplugins)) { |
|
289 | - $active = 0; |
|
290 | - } else { |
|
291 | - $active = 1; |
|
292 | - } |
|
293 | - // update active |
|
294 | - $upd = "UPDATE $tbl_block SET active = '$active' |
|
279 | + $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
280 | + $possibleplugins = self::getPossibleDashboardPluginsPath(); |
|
281 | + |
|
282 | + // We check if plugin exists inside directory for updating active field |
|
283 | + $sql = "SELECT * FROM $tbl_block"; |
|
284 | + $rs = Database::query($sql); |
|
285 | + if (Database::num_rows($rs) > 0){ |
|
286 | + while ($row = Database::fetch_array($rs)) { |
|
287 | + $path = $row['path']; |
|
288 | + if (!in_array($row['path'],$possibleplugins)) { |
|
289 | + $active = 0; |
|
290 | + } else { |
|
291 | + $active = 1; |
|
292 | + } |
|
293 | + // update active |
|
294 | + $upd = "UPDATE $tbl_block SET active = '$active' |
|
295 | 295 | WHERE path = '".$row['path']."'"; |
296 | - Database::query($upd); |
|
297 | - } |
|
298 | - } |
|
299 | - |
|
300 | - // get disabled block data |
|
301 | - $block_data = array(); |
|
302 | - $sql = "SELECT * FROM $tbl_block WHERE active = 0"; |
|
303 | - $rs_block = Database::query($sql); |
|
304 | - if (Database::num_rows($rs_block) > 0) { |
|
305 | - while ($row_block = Database::fetch_array($rs_block)) { |
|
306 | - $block_data[] = $row_block; |
|
307 | - } |
|
308 | - } |
|
309 | - |
|
310 | - return $block_data; |
|
311 | - |
|
312 | - } |
|
313 | - |
|
314 | - /** |
|
315 | - * get data about enabled dashboard block (stored insise block table) |
|
316 | - * @param string plugin path |
|
317 | - * @return array data |
|
318 | - */ |
|
319 | - public static function get_enabled_dashboard_blocks($path = '') |
|
296 | + Database::query($upd); |
|
297 | + } |
|
298 | + } |
|
299 | + |
|
300 | + // get disabled block data |
|
301 | + $block_data = array(); |
|
302 | + $sql = "SELECT * FROM $tbl_block WHERE active = 0"; |
|
303 | + $rs_block = Database::query($sql); |
|
304 | + if (Database::num_rows($rs_block) > 0) { |
|
305 | + while ($row_block = Database::fetch_array($rs_block)) { |
|
306 | + $block_data[] = $row_block; |
|
307 | + } |
|
308 | + } |
|
309 | + |
|
310 | + return $block_data; |
|
311 | + |
|
312 | + } |
|
313 | + |
|
314 | + /** |
|
315 | + * get data about enabled dashboard block (stored insise block table) |
|
316 | + * @param string plugin path |
|
317 | + * @return array data |
|
318 | + */ |
|
319 | + public static function get_enabled_dashboard_blocks($path = '') |
|
320 | 320 | { |
321 | - $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
322 | - $condition_path = ''; |
|
323 | - if (!empty($path)) { |
|
324 | - $path = Database::escape_string($path); |
|
325 | - $condition_path = ' AND path = "'.$path.'" '; |
|
326 | - } |
|
327 | - |
|
328 | - $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path "; |
|
329 | - $rs = Database::query($sql); |
|
330 | - $block_data = array(); |
|
331 | - if (Database::num_rows($rs) > 0) { |
|
332 | - while ($row = Database::fetch_array($rs)) { |
|
333 | - $block_data[$row['path']] = $row; |
|
334 | - } |
|
335 | - } |
|
336 | - return $block_data; |
|
337 | - } |
|
338 | - |
|
339 | - /** |
|
340 | - * display user dashboard list |
|
341 | - * @param int User id |
|
342 | - * @return void |
|
343 | - */ |
|
344 | - public static function display_user_dashboard_list($user_id) |
|
321 | + $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
322 | + $condition_path = ''; |
|
323 | + if (!empty($path)) { |
|
324 | + $path = Database::escape_string($path); |
|
325 | + $condition_path = ' AND path = "'.$path.'" '; |
|
326 | + } |
|
327 | + |
|
328 | + $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path "; |
|
329 | + $rs = Database::query($sql); |
|
330 | + $block_data = array(); |
|
331 | + if (Database::num_rows($rs) > 0) { |
|
332 | + while ($row = Database::fetch_array($rs)) { |
|
333 | + $block_data[$row['path']] = $row; |
|
334 | + } |
|
335 | + } |
|
336 | + return $block_data; |
|
337 | + } |
|
338 | + |
|
339 | + /** |
|
340 | + * display user dashboard list |
|
341 | + * @param int User id |
|
342 | + * @return void |
|
343 | + */ |
|
344 | + public static function display_user_dashboard_list($user_id) |
|
345 | 345 | { |
346 | - $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks(); |
|
347 | - $user_block_data = self::get_user_block_data($user_id); |
|
348 | - |
|
349 | - if (count($enabled_dashboard_plugins) > 0) { |
|
350 | - echo '<div style="margin-top:20px">'; |
|
351 | - echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />'; |
|
352 | - echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">'; |
|
353 | - echo '<table class="data_table">'; |
|
354 | - echo '<tr>'; |
|
355 | - echo '<th width="5%">'; |
|
356 | - echo get_lang('Enabled'); |
|
357 | - echo '</th>'; |
|
358 | - echo '<th width="30%">'; |
|
359 | - echo get_lang('Name'); |
|
360 | - echo '</th>'; |
|
361 | - echo '<th width="40%">'; |
|
362 | - echo get_lang('Description'); |
|
363 | - echo '</th>'; |
|
364 | - echo '<th>'; |
|
365 | - echo get_lang('ColumnPosition'); |
|
366 | - echo '</th>'; |
|
367 | - echo '</tr>'; |
|
368 | - |
|
369 | - // We display all enabled plugins and the checkboxes |
|
370 | - foreach ($enabled_dashboard_plugins as $block) { |
|
371 | - |
|
372 | - $path = $block['path']; |
|
373 | - $controller_class = $block['controller']; |
|
374 | - $filename_controller = $path.'.class.php'; |
|
375 | - $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/'; |
|
376 | - require_once $dashboard_plugin_path.$filename_controller; |
|
377 | - if (class_exists($controller_class)) { |
|
378 | - $obj_block = new $controller_class($user_id); |
|
379 | - |
|
380 | - // check if user is allowed to see the block |
|
381 | - if (method_exists($obj_block, 'is_block_visible_for_user')) { |
|
382 | - $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
|
383 | - if (!$is_block_visible_for_user) continue; |
|
384 | - } |
|
385 | - |
|
386 | - echo '<tr>'; |
|
387 | - // checkboxes |
|
388 | - self::display_user_dashboard_list_checkboxes($user_id, $block['id']); |
|
389 | - echo '<td>'.$block['name'].'</td>'; |
|
390 | - echo '<td>'.$block['description'].'</td>'; |
|
391 | - echo '<td> |
|
346 | + $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks(); |
|
347 | + $user_block_data = self::get_user_block_data($user_id); |
|
348 | + |
|
349 | + if (count($enabled_dashboard_plugins) > 0) { |
|
350 | + echo '<div style="margin-top:20px">'; |
|
351 | + echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />'; |
|
352 | + echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">'; |
|
353 | + echo '<table class="data_table">'; |
|
354 | + echo '<tr>'; |
|
355 | + echo '<th width="5%">'; |
|
356 | + echo get_lang('Enabled'); |
|
357 | + echo '</th>'; |
|
358 | + echo '<th width="30%">'; |
|
359 | + echo get_lang('Name'); |
|
360 | + echo '</th>'; |
|
361 | + echo '<th width="40%">'; |
|
362 | + echo get_lang('Description'); |
|
363 | + echo '</th>'; |
|
364 | + echo '<th>'; |
|
365 | + echo get_lang('ColumnPosition'); |
|
366 | + echo '</th>'; |
|
367 | + echo '</tr>'; |
|
368 | + |
|
369 | + // We display all enabled plugins and the checkboxes |
|
370 | + foreach ($enabled_dashboard_plugins as $block) { |
|
371 | + |
|
372 | + $path = $block['path']; |
|
373 | + $controller_class = $block['controller']; |
|
374 | + $filename_controller = $path.'.class.php'; |
|
375 | + $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/'; |
|
376 | + require_once $dashboard_plugin_path.$filename_controller; |
|
377 | + if (class_exists($controller_class)) { |
|
378 | + $obj_block = new $controller_class($user_id); |
|
379 | + |
|
380 | + // check if user is allowed to see the block |
|
381 | + if (method_exists($obj_block, 'is_block_visible_for_user')) { |
|
382 | + $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
|
383 | + if (!$is_block_visible_for_user) continue; |
|
384 | + } |
|
385 | + |
|
386 | + echo '<tr>'; |
|
387 | + // checkboxes |
|
388 | + self::display_user_dashboard_list_checkboxes($user_id, $block['id']); |
|
389 | + echo '<td>'.$block['name'].'</td>'; |
|
390 | + echo '<td>'.$block['description'].'</td>'; |
|
391 | + echo '<td> |
|
392 | 392 | <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']"> |
393 | 393 | <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option> |
394 | 394 | <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option> |
395 | 395 | </select> |
396 | 396 | </td>'; |
397 | - echo '</tr>'; |
|
398 | - } else { |
|
399 | - echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
400 | - } |
|
401 | - } |
|
402 | - |
|
403 | - echo '</table>'; |
|
404 | - echo '<div class="row"><div class="col-md-12">'; |
|
405 | - echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '. |
|
397 | + echo '</tr>'; |
|
398 | + } else { |
|
399 | + echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
400 | + } |
|
401 | + } |
|
402 | + |
|
403 | + echo '</table>'; |
|
404 | + echo '<div class="row"><div class="col-md-12">'; |
|
405 | + echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '. |
|
406 | 406 | get_lang('EnableDashboardBlock').'</button></form>'; |
407 | - echo '</div></div>'; |
|
408 | - } else { |
|
409 | - echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>'; |
|
410 | - if (api_is_platform_admin()) { |
|
411 | - echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'. |
|
407 | + echo '</div></div>'; |
|
408 | + } else { |
|
409 | + echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>'; |
|
410 | + if (api_is_platform_admin()) { |
|
411 | + echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'. |
|
412 | 412 | get_lang('ConfigureDashboardPlugin').'</a>'; |
413 | - } |
|
414 | - } |
|
415 | - } |
|
416 | - |
|
417 | - /** |
|
418 | - * display checkboxes for user dashboard list |
|
419 | - * @param int User id |
|
420 | - * @param int Block id |
|
421 | - * @return void |
|
422 | - */ |
|
423 | - public static function display_user_dashboard_list_checkboxes($user_id, $block_id) { |
|
424 | - |
|
425 | - $user_id = intval($user_id); |
|
426 | - $user_block_data = self::get_user_block_data($user_id); |
|
427 | - $enabled_blocks_id = array_keys($user_block_data); |
|
428 | - |
|
429 | - $checked = ''; |
|
430 | - if (in_array($block_id, $enabled_blocks_id)) { |
|
431 | - $checked = "checked"; |
|
432 | - } |
|
433 | - |
|
434 | - echo "<td align=\"center\">"; |
|
435 | - echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>'; |
|
436 | - echo "</td>"; |
|
437 | - } |
|
438 | - |
|
439 | - /** |
|
440 | - * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields |
|
441 | - * @param int User id |
|
442 | - * @param array selected blocks |
|
443 | - * @param array columns position |
|
444 | - * @return bool |
|
445 | - */ |
|
446 | - public static function store_user_blocks($user_id, $enabled_blocks, $columns) { |
|
447 | - $selected_blocks_id = array(); |
|
448 | - if (is_array($enabled_blocks) && count($enabled_blocks) > 0) { |
|
449 | - $selected_blocks_id = array_keys($enabled_blocks); |
|
450 | - } |
|
451 | - |
|
452 | - // build data for storing inside extra user field |
|
453 | - $fname = 'dashboard'; |
|
454 | - $fvalue = array(); |
|
455 | - foreach ($selected_blocks_id as $block_id) { |
|
456 | - $fvalue[] = $block_id.':'.$columns[$block_id]; |
|
457 | - } |
|
413 | + } |
|
414 | + } |
|
415 | + } |
|
416 | + |
|
417 | + /** |
|
418 | + * display checkboxes for user dashboard list |
|
419 | + * @param int User id |
|
420 | + * @param int Block id |
|
421 | + * @return void |
|
422 | + */ |
|
423 | + public static function display_user_dashboard_list_checkboxes($user_id, $block_id) { |
|
424 | + |
|
425 | + $user_id = intval($user_id); |
|
426 | + $user_block_data = self::get_user_block_data($user_id); |
|
427 | + $enabled_blocks_id = array_keys($user_block_data); |
|
428 | + |
|
429 | + $checked = ''; |
|
430 | + if (in_array($block_id, $enabled_blocks_id)) { |
|
431 | + $checked = "checked"; |
|
432 | + } |
|
433 | + |
|
434 | + echo "<td align=\"center\">"; |
|
435 | + echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>'; |
|
436 | + echo "</td>"; |
|
437 | + } |
|
438 | + |
|
439 | + /** |
|
440 | + * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields |
|
441 | + * @param int User id |
|
442 | + * @param array selected blocks |
|
443 | + * @param array columns position |
|
444 | + * @return bool |
|
445 | + */ |
|
446 | + public static function store_user_blocks($user_id, $enabled_blocks, $columns) { |
|
447 | + $selected_blocks_id = array(); |
|
448 | + if (is_array($enabled_blocks) && count($enabled_blocks) > 0) { |
|
449 | + $selected_blocks_id = array_keys($enabled_blocks); |
|
450 | + } |
|
451 | + |
|
452 | + // build data for storing inside extra user field |
|
453 | + $fname = 'dashboard'; |
|
454 | + $fvalue = array(); |
|
455 | + foreach ($selected_blocks_id as $block_id) { |
|
456 | + $fvalue[] = $block_id.':'.$columns[$block_id]; |
|
457 | + } |
|
458 | 458 | $upd_extra_field = UserManager::update_extra_field_value( |
459 | 459 | $user_id, |
460 | 460 | $fname, |
461 | 461 | $fvalue |
462 | 462 | ); |
463 | 463 | |
464 | - return $upd_extra_field; |
|
464 | + return $upd_extra_field; |
|
465 | 465 | |
466 | - } |
|
466 | + } |
|
467 | 467 | |
468 | - /** |
|
469 | - * This function get user block data (block id with its number of column) from extra user data |
|
470 | - * @param int User id |
|
471 | - * @return array data (block_id,column) |
|
472 | - */ |
|
473 | - public static function get_user_block_data($user_id) |
|
468 | + /** |
|
469 | + * This function get user block data (block id with its number of column) from extra user data |
|
470 | + * @param int User id |
|
471 | + * @return array data (block_id,column) |
|
472 | + */ |
|
473 | + public static function get_user_block_data($user_id) |
|
474 | 474 | { |
475 | - $user_id = intval($user_id); |
|
476 | - $field_variable = 'dashboard'; |
|
477 | - $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
|
478 | - $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
479 | - $data = array(); |
|
480 | - foreach ($extra_user_data as $extra) { |
|
481 | - $split_extra = explode(':',$extra); |
|
482 | - if (!empty($split_extra)) { |
|
483 | - $block_id = $split_extra[0]; |
|
484 | - $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
485 | - $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
486 | - } |
|
487 | - } |
|
488 | - |
|
489 | - return $data; |
|
490 | - } |
|
491 | - |
|
492 | - /** |
|
493 | - * This function update extra user blocks data after closing a dashboard block |
|
494 | - * @param int User id |
|
495 | - * @param string plugin path |
|
496 | - * @return bool |
|
497 | - */ |
|
498 | - public static function close_user_block($user_id, $path) |
|
475 | + $user_id = intval($user_id); |
|
476 | + $field_variable = 'dashboard'; |
|
477 | + $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
|
478 | + $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
479 | + $data = array(); |
|
480 | + foreach ($extra_user_data as $extra) { |
|
481 | + $split_extra = explode(':',$extra); |
|
482 | + if (!empty($split_extra)) { |
|
483 | + $block_id = $split_extra[0]; |
|
484 | + $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
485 | + $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
486 | + } |
|
487 | + } |
|
488 | + |
|
489 | + return $data; |
|
490 | + } |
|
491 | + |
|
492 | + /** |
|
493 | + * This function update extra user blocks data after closing a dashboard block |
|
494 | + * @param int User id |
|
495 | + * @param string plugin path |
|
496 | + * @return bool |
|
497 | + */ |
|
498 | + public static function close_user_block($user_id, $path) |
|
499 | 499 | { |
500 | - $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
501 | - $user_block_data = self::get_user_block_data($user_id); |
|
502 | - |
|
503 | - foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
504 | - unset($user_block_data[$enabled_block['id']]); |
|
505 | - } |
|
506 | - |
|
507 | - // get columns and blocks id for updating extra user data |
|
508 | - $columns = array(); |
|
509 | - $user_blocks_id = array(); |
|
510 | - foreach ($user_block_data as $data) { |
|
511 | - $user_blocks_id[$data['block_id']] = true; |
|
512 | - $columns[$data['block_id']] = $data['column']; |
|
513 | - } |
|
514 | - |
|
515 | - // update extra user blocks data |
|
516 | - $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
517 | - |
|
518 | - return $upd_extra_field; |
|
519 | - } |
|
520 | - |
|
521 | - /** |
|
522 | - * get links for styles from dashboard plugins |
|
523 | - * @return string links |
|
524 | - */ |
|
525 | - public static function get_links_for_styles_from_dashboard_plugins() { |
|
526 | - |
|
527 | - return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
528 | - } |
|
500 | + $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
501 | + $user_block_data = self::get_user_block_data($user_id); |
|
502 | + |
|
503 | + foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
504 | + unset($user_block_data[$enabled_block['id']]); |
|
505 | + } |
|
506 | + |
|
507 | + // get columns and blocks id for updating extra user data |
|
508 | + $columns = array(); |
|
509 | + $user_blocks_id = array(); |
|
510 | + foreach ($user_block_data as $data) { |
|
511 | + $user_blocks_id[$data['block_id']] = true; |
|
512 | + $columns[$data['block_id']] = $data['column']; |
|
513 | + } |
|
514 | + |
|
515 | + // update extra user blocks data |
|
516 | + $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
517 | + |
|
518 | + return $upd_extra_field; |
|
519 | + } |
|
520 | + |
|
521 | + /** |
|
522 | + * get links for styles from dashboard plugins |
|
523 | + * @return string links |
|
524 | + */ |
|
525 | + public static function get_links_for_styles_from_dashboard_plugins() { |
|
526 | + |
|
527 | + return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
528 | + } |
|
529 | 529 | |
530 | 530 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | echo '<tr>'; |
54 | 54 | self::display_dashboard_plugin_checkboxes($testplugin); |
55 | - for ($i = 0 ; $i < count($table_cols); $i++) { |
|
55 | + for ($i = 0; $i < count($table_cols); $i++) { |
|
56 | 56 | if (isset($plugin_info[strtolower($table_cols[$i])])) { |
57 | 57 | echo '<td>'; |
58 | 58 | echo $plugin_info[$table_cols[$i]]; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | echo Display::tag( |
68 | 68 | 'tr', |
69 | 69 | Display::tag('td', |
70 | - get_lang('CheckFilePermissions') . ' ' . Security::remove_XSS($plugin_info_file), |
|
70 | + get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file), |
|
71 | 71 | array('colspan' => '3')) |
72 | 72 | ); |
73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | foreach ($disabled_blocks_data as $disabled_block) { |
80 | 80 | echo '<tr style="background-color:#eee">'; |
81 | 81 | echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>'; |
82 | - for ($j = 0 ; $j < count($table_cols); $j++) { |
|
82 | + for ($j = 0; $j < count($table_cols); $j++) { |
|
83 | 83 | if (isset($disabled_block[strtolower($table_cols[$j])])) { |
84 | 84 | if ($j == 2) { |
85 | 85 | echo '<td>'; |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | } |
190 | 190 | // clean from block data |
191 | 191 | if (!empty($not_selected_blocks_id)) { |
192 | - $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")"; |
|
192 | + $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")"; |
|
193 | 193 | $rs_check = Database::query($sql_check); |
194 | 194 | if (Database::num_rows($rs_check) > 0) { |
195 | - $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")"; |
|
195 | + $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")"; |
|
196 | 196 | Database::query($del); |
197 | 197 | } |
198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $affected_rows = Database::affected_rows($result); |
213 | 213 | } else { |
214 | 214 | // insert |
215 | - $plugin_info_file = $dashboard_pluginpath . $testplugin . "/$testplugin.info"; |
|
215 | + $plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info"; |
|
216 | 216 | $plugin_info = array(); |
217 | 217 | if (file_exists($plugin_info_file)) { |
218 | 218 | $plugin_info = parse_info_file($plugin_info_file); |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | // We check if plugin exists inside directory for updating active field |
283 | 283 | $sql = "SELECT * FROM $tbl_block"; |
284 | 284 | $rs = Database::query($sql); |
285 | - if (Database::num_rows($rs) > 0){ |
|
285 | + if (Database::num_rows($rs) > 0) { |
|
286 | 286 | while ($row = Database::fetch_array($rs)) { |
287 | 287 | $path = $row['path']; |
288 | - if (!in_array($row['path'],$possibleplugins)) { |
|
288 | + if (!in_array($row['path'], $possibleplugins)) { |
|
289 | 289 | $active = 0; |
290 | 290 | } else { |
291 | 291 | $active = 1; |
@@ -390,13 +390,13 @@ discard block |
||
390 | 390 | echo '<td>'.$block['description'].'</td>'; |
391 | 391 | echo '<td> |
392 | 392 | <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']"> |
393 | - <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option> |
|
394 | - <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option> |
|
393 | + <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 1 ? 'selected' : '').' >1</option> |
|
394 | + <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 2 ? 'selected' : '').' >2</option> |
|
395 | 395 | </select> |
396 | 396 | </td>'; |
397 | 397 | echo '</tr>'; |
398 | 398 | } else { |
399 | - echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
399 | + echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -475,10 +475,10 @@ discard block |
||
475 | 475 | $user_id = intval($user_id); |
476 | 476 | $field_variable = 'dashboard'; |
477 | 477 | $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
478 | - $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
478 | + $extra_user_data = explode(';', $extra_user_data[$field_variable]); |
|
479 | 479 | $data = array(); |
480 | 480 | foreach ($extra_user_data as $extra) { |
481 | - $split_extra = explode(':',$extra); |
|
481 | + $split_extra = explode(':', $extra); |
|
482 | 482 | if (!empty($split_extra)) { |
483 | 483 | $block_id = $split_extra[0]; |
484 | 484 | $column = isset($split_extra[1]) ? $split_extra[1] : null; |
@@ -380,7 +380,9 @@ |
||
380 | 380 | // check if user is allowed to see the block |
381 | 381 | if (method_exists($obj_block, 'is_block_visible_for_user')) { |
382 | 382 | $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
383 | - if (!$is_block_visible_for_user) continue; |
|
383 | + if (!$is_block_visible_for_user) { |
|
384 | + continue; |
|
385 | + } |
|
384 | 386 | } |
385 | 387 | |
386 | 388 | echo '<tr>'; |
@@ -351,6 +351,12 @@ |
||
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Additional functions needed for fast integration |
354 | + * @param integer $status |
|
355 | + * @param string $section |
|
356 | + * @param string $title |
|
357 | + * @param string $url |
|
358 | + * @param string|null $formatter |
|
359 | + * @param string $comment |
|
354 | 360 | */ |
355 | 361 | public function build_setting($status, $section, $title, $url, $current_value, $expected_value, $formatter, $comment, $img_path = null) { |
356 | 362 | switch ($status) { |
@@ -401,19 +401,19 @@ |
||
401 | 401 | |
402 | 402 | public function format_yes_no_optional($value) |
403 | 403 | { |
404 | - $return = ''; |
|
405 | - switch($value) { |
|
406 | - case 0: |
|
407 | - $return = get_lang('No'); |
|
408 | - break; |
|
409 | - case 1: |
|
410 | - $return = get_lang('Yes'); |
|
411 | - break; |
|
412 | - case 2: |
|
413 | - $return = get_lang('Optional'); |
|
414 | - break; |
|
415 | - } |
|
416 | - return $return; |
|
404 | + $return = ''; |
|
405 | + switch($value) { |
|
406 | + case 0: |
|
407 | + $return = get_lang('No'); |
|
408 | + break; |
|
409 | + case 1: |
|
410 | + $return = get_lang('Yes'); |
|
411 | + break; |
|
412 | + case 2: |
|
413 | + $return = get_lang('Optional'); |
|
414 | + break; |
|
415 | + } |
|
416 | + return $return; |
|
417 | 417 | |
418 | 418 | } |
419 | 419 |
@@ -158,8 +158,9 @@ discard block |
||
158 | 158 | $array[] = $this->build_setting($status, '[INI]', 'display_errors', 'http://www.php.net/manual/en/ini.core.php#ini.display_errors', $setting, $req_setting, 'on_off', get_lang('DisplayErrorsInfo')); |
159 | 159 | |
160 | 160 | $setting = ini_get('default_charset'); |
161 | - if ($setting == '') |
|
162 | - $setting = null; |
|
161 | + if ($setting == '') { |
|
162 | + $setting = null; |
|
163 | + } |
|
163 | 164 | $req_setting = null; |
164 | 165 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_ERROR; |
165 | 166 | $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo')); |
@@ -177,22 +178,25 @@ discard block |
||
177 | 178 | $setting = ini_get('memory_limit'); |
178 | 179 | $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M'; |
179 | 180 | $status = self :: STATUS_ERROR; |
180 | - if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
181 | - $status = self :: STATUS_OK; |
|
181 | + if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) { |
|
182 | + $status = self :: STATUS_OK; |
|
183 | + } |
|
182 | 184 | $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo')); |
183 | 185 | |
184 | 186 | $setting = ini_get('post_max_size'); |
185 | 187 | $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M'; |
186 | 188 | $status = self :: STATUS_ERROR; |
187 | - if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
188 | - $status = self :: STATUS_OK; |
|
189 | + if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) { |
|
190 | + $status = self :: STATUS_OK; |
|
191 | + } |
|
189 | 192 | $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo')); |
190 | 193 | |
191 | 194 | $setting = ini_get('upload_max_filesize'); |
192 | 195 | $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M'; |
193 | 196 | $status = self :: STATUS_ERROR; |
194 | - if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
195 | - $status = self :: STATUS_OK; |
|
197 | + if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) { |
|
198 | + $status = self :: STATUS_OK; |
|
199 | + } |
|
196 | 200 | $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo')); |
197 | 201 | |
198 | 202 | $setting = ini_get('variables_order'); |
@@ -205,7 +209,7 @@ discard block |
||
205 | 209 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
206 | 210 | $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo')); |
207 | 211 | |
208 | - if (api_check_browscap()){$setting = true;}else{$setting=false;} |
|
212 | + if (api_check_browscap()){$setting = true;} else{$setting=false;} |
|
209 | 213 | $req_setting = true; |
210 | 214 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
211 | 215 | $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo')); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | const STATUS_OK = 1; |
17 | 17 | const STATUS_WARNING = 2; |
18 | - const STATUS_ERROR = 3; |
|
18 | + const STATUS_ERROR = 3; |
|
19 | 19 | const STATUS_INFORMATION = 4; |
20 | 20 | |
21 | 21 | /** |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | $html .= '<li>'; |
45 | 45 | } |
46 | 46 | $params['section'] = $section; |
47 | - $html .='<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
47 | + $html .= '<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $html .= '</ul><div class="tab-pane">'; |
51 | 51 | |
52 | - $data = call_user_func(array($this, 'get_' . $current_section . '_data')); |
|
52 | + $data = call_user_func(array($this, 'get_'.$current_section.'_data')); |
|
53 | 53 | echo $html; |
54 | 54 | $table = new SortableTableFromArray($data, 1, 100); |
55 | 55 | |
56 | - $table->set_header(0,'', false); |
|
57 | - $table->set_header(1,get_lang('Section'), false); |
|
58 | - $table->set_header(2,get_lang('Setting'), false); |
|
59 | - $table->set_header(3,get_lang('Current'), false); |
|
60 | - $table->set_header(4,get_lang('Expected'), false); |
|
61 | - $table->set_header(5,get_lang('Comment'), false); |
|
56 | + $table->set_header(0, '', false); |
|
57 | + $table->set_header(1, get_lang('Section'), false); |
|
58 | + $table->set_header(2, get_lang('Setting'), false); |
|
59 | + $table->set_header(3, get_lang('Current'), false); |
|
60 | + $table->set_header(4, get_lang('Expected'), false); |
|
61 | + $table->set_header(5, get_lang('Comment'), false); |
|
62 | 62 | |
63 | 63 | $table->display(); |
64 | 64 | echo '</div></div>'; |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | { |
73 | 73 | $array = array(); |
74 | 74 | $writable_folders = array( |
75 | - api_get_path(SYS_APP_PATH) .'cache', |
|
75 | + api_get_path(SYS_APP_PATH).'cache', |
|
76 | 76 | api_get_path(SYS_COURSE_PATH), |
77 | - api_get_path(SYS_APP_PATH) .'home', |
|
78 | - api_get_path(SYS_APP_PATH) .'upload/users/', |
|
79 | - api_get_path(SYS_PATH) .'main/default_course_document/images/', |
|
77 | + api_get_path(SYS_APP_PATH).'home', |
|
78 | + api_get_path(SYS_APP_PATH).'upload/users/', |
|
79 | + api_get_path(SYS_PATH).'main/default_course_document/images/', |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | foreach ($writable_folders as $index => $folder) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $array[] = $this->build_setting( |
100 | 100 | $status, |
101 | 101 | '[FILES]', |
102 | - get_lang('DirectoryExists') . ': /install', |
|
102 | + get_lang('DirectoryExists').': /install', |
|
103 | 103 | 'http://be2.php.net/file_exists', |
104 | 104 | $exists, |
105 | 105 | 0, |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $message2 .= get_lang('SpaceUsedOnSystemCannotBeMeasuredOnWindows'); |
130 | 130 | } else { |
131 | 131 | $dir = api_get_path(SYS_PATH); |
132 | - $du = exec('du -sh ' . $dir, $err); |
|
132 | + $du = exec('du -sh '.$dir, $err); |
|
133 | 133 | list($size, $none) = explode("\t", $du); |
134 | 134 | $limit = $_configuration[$access_url_id]['hosting_limit_disk_space']; |
135 | 135 | $message2 .= sprintf(get_lang('TotalSpaceUsedByPortalXLimitIsYMB'), $size, $limit); |
@@ -216,33 +216,33 @@ discard block |
||
216 | 216 | $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo')); |
217 | 217 | |
218 | 218 | $setting = ini_get('max_execution_time'); |
219 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
219 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
220 | 220 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
221 | 221 | $array[] = $this->build_setting($status, '[INI]', 'max_execution_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-execution-time', $setting, $req_setting, null, get_lang('MaxExecutionTimeInfo')); |
222 | 222 | |
223 | 223 | $setting = ini_get('max_input_time'); |
224 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
224 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
225 | 225 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
226 | 226 | $array[] = $this->build_setting($status, '[INI]', 'max_input_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-input-time', $setting, $req_setting, null, get_lang('MaxInputTimeInfo')); |
227 | 227 | |
228 | 228 | $setting = ini_get('memory_limit'); |
229 | 229 | $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M'; |
230 | 230 | $status = self :: STATUS_ERROR; |
231 | - if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
231 | + if ((float) $setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
232 | 232 | $status = self :: STATUS_OK; |
233 | 233 | $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo')); |
234 | 234 | |
235 | 235 | $setting = ini_get('post_max_size'); |
236 | 236 | $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M'; |
237 | 237 | $status = self :: STATUS_ERROR; |
238 | - if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
238 | + if ((float) $setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
239 | 239 | $status = self :: STATUS_OK; |
240 | 240 | $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo')); |
241 | 241 | |
242 | 242 | $setting = ini_get('upload_max_filesize'); |
243 | 243 | $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M'; |
244 | 244 | $status = self :: STATUS_ERROR; |
245 | - if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
245 | + if ((float) $setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
246 | 246 | $status = self :: STATUS_OK; |
247 | 247 | $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo')); |
248 | 248 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
257 | 257 | $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo')); |
258 | 258 | |
259 | - if (api_check_browscap()){$setting = true;}else{$setting=false;} |
|
259 | + if (api_check_browscap()) {$setting = true; } else {$setting = false; } |
|
260 | 260 | $req_setting = true; |
261 | 261 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
262 | 262 | $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo')); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | $loaded = extension_loaded($extension); |
314 | 314 | $status = $loaded ? self :: STATUS_OK : self :: STATUS_ERROR; |
315 | - $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension') . ': ' . $extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
315 | + $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension').': '.$extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | return $array; |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | $formatted_expected_value = $expected_value; |
436 | 436 | |
437 | 437 | if ($formatter) { |
438 | - if (method_exists($this, 'format_' . $formatter)) { |
|
439 | - $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value); |
|
440 | - $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value); |
|
438 | + if (method_exists($this, 'format_'.$formatter)) { |
|
439 | + $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value); |
|
440 | + $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function get_link($title, $url) |
454 | 454 | { |
455 | - return '<a href="' . $url . '" target="about:bank">' . $title . '</a>'; |
|
455 | + return '<a href="'.$url.'" target="about:bank">'.$title.'</a>'; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | public function format_yes_no_optional($value) |
459 | 459 | { |
460 | 460 | $return = ''; |
461 | - switch($value) { |
|
461 | + switch ($value) { |
|
462 | 462 | case 0: |
463 | 463 | $return = get_lang('No'); |
464 | 464 | break; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * @return array |
|
35 | + * @return string[] |
|
36 | 36 | */ |
37 | 37 | public static function toolList() |
38 | 38 | { |
@@ -290,7 +290,6 @@ discard block |
||
290 | 290 | * 'page_nr' = The page to display |
291 | 291 | * 'hide_navigation' = true to hide the navigation |
292 | 292 | * @param array $query_vars Additional variables to add in the query-string |
293 | - * @param array $form actions Additional variables to add in the query-string |
|
294 | 293 | * @param mixed An array with bool values to know which columns show. |
295 | 294 | * i.e: $visibility_options= array(true, false) we will only show the first column |
296 | 295 | * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing |
@@ -331,7 +330,6 @@ discard block |
||
331 | 330 | * 'page_nr' = The page to display |
332 | 331 | * 'hide_navigation' = true to hide the navigation |
333 | 332 | * @param array $query_vars Additional variables to add in the query-string |
334 | - * @param array $form actions Additional variables to add in the query-string |
|
335 | 333 | * @param mixed An array with bool values to know which columns show. i.e: |
336 | 334 | * $visibility_options= array(true, false) we will only show the first column |
337 | 335 | * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing |
@@ -388,10 +386,11 @@ discard block |
||
388 | 386 | * 'per_page' = number of items to show per page |
389 | 387 | * 'page_nr' = The page to display |
390 | 388 | * @param array $query_vars Additional variables to add in the query-string |
391 | - * @param array $column_show Array of binaries 1= show columns 0. hide a column |
|
389 | + * @param integer[] $column_show Array of binaries 1= show columns 0. hide a column |
|
392 | 390 | * @param array $column_order An array of integers that let us decide how the columns are going to be sort. |
393 | 391 | * i.e: $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column |
394 | 392 | * @param array $form_actions Set optional forms actions |
393 | + * @param string $table_name |
|
395 | 394 | * |
396 | 395 | * @author Julio Montoya |
397 | 396 | */ |
@@ -444,7 +443,7 @@ discard block |
||
444 | 443 | * @param bool $filter (true) or not (false) |
445 | 444 | * @param bool $returnValue |
446 | 445 | * |
447 | - * @return void |
|
446 | + * @return string|null |
|
448 | 447 | */ |
449 | 448 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
450 | 449 | { |
@@ -474,7 +473,7 @@ discard block |
||
474 | 473 | /** |
475 | 474 | * Displays an confirmation message. Use this if something has been done successfully |
476 | 475 | * @param bool Filter (true) or not (false) |
477 | - * @return void |
|
476 | + * @return string|null |
|
478 | 477 | */ |
479 | 478 | public static function display_confirmation_message ($message, $filter = true, $returnValue = false) |
480 | 479 | { |
@@ -491,7 +490,7 @@ discard block |
||
491 | 490 | * @param string $message - include any additional html |
492 | 491 | * tags if you need them |
493 | 492 | * @param bool Filter (true) or not (false) |
494 | - * @return void |
|
493 | + * @return string|null |
|
495 | 494 | */ |
496 | 495 | public static function display_error_message ($message, $filter = true, $returnValue = false) |
497 | 496 | { |
@@ -681,6 +680,7 @@ discard block |
||
681 | 680 | * @param string The alt text (probably a language variable) |
682 | 681 | * @param array additional attributes (for instance height, width, onclick, ...) |
683 | 682 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
683 | + * @param string $image |
|
684 | 684 | * @return void |
685 | 685 | */ |
686 | 686 | public static function display_icon( |
@@ -881,6 +881,7 @@ discard block |
||
881 | 881 | /** |
882 | 882 | * Displays an HTML input tag |
883 | 883 | * |
884 | + * @param string $type |
|
884 | 885 | */ |
885 | 886 | public static function input($type, $name, $value, $attributes = array()) |
886 | 887 | { |
@@ -897,8 +898,8 @@ discard block |
||
897 | 898 | } |
898 | 899 | |
899 | 900 | /** |
900 | - * @param $name |
|
901 | - * @param $value |
|
901 | + * @param string $name |
|
902 | + * @param string $value |
|
902 | 903 | * @param array $attributes |
903 | 904 | * @return string |
904 | 905 | */ |
@@ -913,6 +914,7 @@ discard block |
||
913 | 914 | /** |
914 | 915 | * Displays an HTML select tag |
915 | 916 | * |
917 | + * @param string $blank_item_text |
|
916 | 918 | */ |
917 | 919 | public static function select( |
918 | 920 | $name, |
@@ -983,6 +985,8 @@ discard block |
||
983 | 985 | * @param array content that will be showed |
984 | 986 | * @param string the id of the container of the tab in the example "tabs" |
985 | 987 | * @param array attributes for the ul |
988 | + * @param string[] $header_list |
|
989 | + * @param string[] $content_list |
|
986 | 990 | * |
987 | 991 | */ |
988 | 992 | public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array()) |
@@ -1029,7 +1033,7 @@ discard block |
||
1029 | 1033 | |
1030 | 1034 | /** |
1031 | 1035 | * @param $headers |
1032 | - * @param null $selected |
|
1036 | + * @param integer $selected |
|
1033 | 1037 | * |
1034 | 1038 | * @return string |
1035 | 1039 | */ |
@@ -1067,6 +1071,7 @@ discard block |
||
1067 | 1071 | * As you can see both function use the same "my_grid_name" this is very important otherwise nothing will work |
1068 | 1072 | * |
1069 | 1073 | * @param string the div id, this value must be the same with the first parameter of Display::grid_js() |
1074 | + * @param string $div_id |
|
1070 | 1075 | * @return string html |
1071 | 1076 | * |
1072 | 1077 | */ |
@@ -1622,6 +1627,8 @@ discard block |
||
1622 | 1627 | * @param string url that will be added (for jquery see hot_courses.tpl) |
1623 | 1628 | * @param string point info array see function CourseManager::get_course_ranking() |
1624 | 1629 | * @param bool add a div wrapper |
1630 | + * @param string $id |
|
1631 | + * @param string $url |
|
1625 | 1632 | * @todo use templates |
1626 | 1633 | **/ |
1627 | 1634 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
@@ -1717,6 +1724,9 @@ discard block |
||
1717 | 1724 | return '<'.$size.'>'.Security::remove_XSS($title).'</'.$size.'>'; |
1718 | 1725 | } |
1719 | 1726 | |
1727 | + /** |
|
1728 | + * @param string $title |
|
1729 | + */ |
|
1720 | 1730 | public static function page_subheader2($title, $second_title = null) |
1721 | 1731 | { |
1722 | 1732 | return self::page_header($title, $second_title, 'h4'); |
@@ -1947,6 +1957,7 @@ discard block |
||
1947 | 1957 | |
1948 | 1958 | /** |
1949 | 1959 | * @todo use twig |
1960 | + * @param string $title |
|
1950 | 1961 | */ |
1951 | 1962 | public static function group_button($title, $elements) |
1952 | 1963 | { |
@@ -2164,9 +2175,9 @@ discard block |
||
2164 | 2175 | |
2165 | 2176 | /** |
2166 | 2177 | * @param int $id |
2167 | - * @param array $content |
|
2178 | + * @param string[] $content |
|
2168 | 2179 | * @param int $col |
2169 | - * @param bool|true $right |
|
2180 | + * @param boolean $right |
|
2170 | 2181 | * @return string |
2171 | 2182 | */ |
2172 | 2183 | public static function toolbarAction($id, $content = array(), $col = 2, $right = true) |
@@ -2248,10 +2259,10 @@ discard block |
||
2248 | 2259 | /** |
2249 | 2260 | * @param string $title |
2250 | 2261 | * @param string $content |
2251 | - * @param null $id |
|
2262 | + * @param string $id |
|
2252 | 2263 | * @param array $params |
2253 | - * @param null $idAccordion |
|
2254 | - * @param null $idCollapse |
|
2264 | + * @param string $idAccordion |
|
2265 | + * @param string $idCollapse |
|
2255 | 2266 | * @param bool|true $open |
2256 | 2267 | * @param bool|false $fullClickable |
2257 | 2268 | * @return null|string |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - /** |
|
53 | - * Displays the page header |
|
54 | - * @param string The name of the page (will be showed in the page title) |
|
55 | - * @param string Optional help file name |
|
56 | - * @param string $page_header |
|
57 | - */ |
|
52 | + /** |
|
53 | + * Displays the page header |
|
54 | + * @param string The name of the page (will be showed in the page title) |
|
55 | + * @param string Optional help file name |
|
56 | + * @param string $page_header |
|
57 | + */ |
|
58 | 58 | public static function display_header($tool_name ='', $help = null, $page_header = null) |
59 | 59 | { |
60 | 60 | $origin = api_get_origin(); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
450 | 450 | { |
451 | - $message = self::return_message($message, 'normal', $filter); |
|
451 | + $message = self::return_message($message, 'normal', $filter); |
|
452 | 452 | if ($returnValue) { |
453 | 453 | return $message; |
454 | 454 | } else { |
@@ -524,22 +524,22 @@ discard block |
||
524 | 524 | public static function return_message($message, $type = 'normal', $filter = true) |
525 | 525 | { |
526 | 526 | if ($filter) { |
527 | - $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
527 | + $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | $class = ""; |
531 | 531 | switch($type) { |
532 | 532 | case 'warning': |
533 | 533 | $class .= 'alert alert-warning'; |
534 | - break; |
|
534 | + break; |
|
535 | 535 | case 'error': |
536 | 536 | $class .= 'alert alert-danger'; |
537 | - break; |
|
537 | + break; |
|
538 | 538 | case 'confirmation': |
539 | 539 | case 'confirm': |
540 | 540 | case 'success': |
541 | 541 | $class .= 'alert alert-success'; |
542 | - break; |
|
542 | + break; |
|
543 | 543 | case 'normal': |
544 | 544 | default: |
545 | 545 | $class .= 'alert alert-info'; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * @param array additional attributes (for instance height, width, onclick, ...) |
683 | 683 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
684 | 684 | * @return void |
685 | - */ |
|
685 | + */ |
|
686 | 686 | public static function display_icon( |
687 | 687 | $image, |
688 | 688 | $alt_text = '', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | * @author Julio Montoya 2010 Function improved, adding image constants |
706 | 706 | * @author Yannick Warnier 2011 Added size handler |
707 | 707 | * @version Feb 2011 |
708 | - */ |
|
708 | + */ |
|
709 | 709 | public static function return_icon( |
710 | 710 | $image, |
711 | 711 | $alt_text = '', |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | */ |
885 | 885 | public static function input($type, $name, $value, $attributes = array()) |
886 | 886 | { |
887 | - if (isset($type)) { |
|
888 | - $attributes['type']= $type; |
|
889 | - } |
|
890 | - if (isset($name)) { |
|
891 | - $attributes['name']= $name; |
|
892 | - } |
|
893 | - if (isset($value)) { |
|
894 | - $attributes['value']= $value; |
|
887 | + if (isset($type)) { |
|
888 | + $attributes['type']= $type; |
|
889 | + } |
|
890 | + if (isset($name)) { |
|
891 | + $attributes['name']= $name; |
|
892 | + } |
|
893 | + if (isset($value)) { |
|
894 | + $attributes['value']= $value; |
|
895 | 895 | } |
896 | 896 | return self::tag('input', '', $attributes); |
897 | 897 | } |
@@ -904,10 +904,10 @@ discard block |
||
904 | 904 | */ |
905 | 905 | public static function button($name, $value, $attributes = array()) |
906 | 906 | { |
907 | - if (!empty($name)) { |
|
907 | + if (!empty($name)) { |
|
908 | 908 | $attributes['name'] = $name; |
909 | - } |
|
910 | - return self::tag('button', $value, $attributes); |
|
909 | + } |
|
910 | + return self::tag('button', $value, $attributes); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * in the $htmlHeadXtra variable before the display_header |
975 | 975 | * Add this script |
976 | 976 | * @example |
977 | - * <script> |
|
977 | + * <script> |
|
978 | 978 | $(function() { |
979 | 979 | $( "#tabs" ).tabs(); |
980 | 980 | }); |
@@ -1035,20 +1035,20 @@ discard block |
||
1035 | 1035 | */ |
1036 | 1036 | public static function tabsOnlyLink($headers, $selected = null) |
1037 | 1037 | { |
1038 | - $id = uniqid(); |
|
1039 | - $i = 1; |
|
1040 | - $lis = null; |
|
1041 | - foreach ($headers as $item) { |
|
1038 | + $id = uniqid(); |
|
1039 | + $i = 1; |
|
1040 | + $lis = null; |
|
1041 | + foreach ($headers as $item) { |
|
1042 | 1042 | $class = null; |
1043 | 1043 | if ($i == $selected) { |
1044 | 1044 | $class = 'active'; |
1045 | 1045 | } |
1046 | - $item = self::tag( |
|
1047 | - 'a', |
|
1048 | - $item['content'], |
|
1049 | - array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1050 | - ); |
|
1051 | - $lis .= self::tag('li', $item, array('class' => $class)); |
|
1046 | + $item = self::tag( |
|
1047 | + 'a', |
|
1048 | + $item['content'], |
|
1049 | + array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1050 | + ); |
|
1051 | + $lis .= self::tag('li', $item, array('class' => $class)); |
|
1052 | 1052 | $i++; |
1053 | 1053 | } |
1054 | 1054 | return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin')); |
@@ -1260,8 +1260,8 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | public static function table($headers, $rows, $attributes = array()) |
1262 | 1262 | { |
1263 | - if (empty($attributes)) { |
|
1264 | - $attributes['class'] = 'data_table'; |
|
1263 | + if (empty($attributes)) { |
|
1264 | + $attributes['class'] = 'data_table'; |
|
1265 | 1265 | } |
1266 | 1266 | $table = new HTML_Table($attributes); |
1267 | 1267 | $row = 0; |
@@ -1269,17 +1269,17 @@ discard block |
||
1269 | 1269 | |
1270 | 1270 | // Course headers |
1271 | 1271 | if (!empty($headers)) { |
1272 | - foreach ($headers as $item) { |
|
1273 | - $table->setHeaderContents($row, $column, $item); |
|
1274 | - $column++; |
|
1275 | - } |
|
1276 | - $row = 1; |
|
1277 | - $column = 0; |
|
1272 | + foreach ($headers as $item) { |
|
1273 | + $table->setHeaderContents($row, $column, $item); |
|
1274 | + $column++; |
|
1275 | + } |
|
1276 | + $row = 1; |
|
1277 | + $column = 0; |
|
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | if (!empty($rows)) { |
1281 | - foreach($rows as $content) { |
|
1282 | - $table->setCellContents($row, $column, $content); |
|
1281 | + foreach($rows as $content) { |
|
1282 | + $table->setCellContents($row, $column, $content); |
|
1283 | 1283 | $row++; |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | //$item_property['tool'] != TOOL_DROPBOX && |
1386 | 1386 | $item_property['tool'] != TOOL_NOTEBOOK && |
1387 | 1387 | $item_property['tool'] != TOOL_CHAT) |
1388 | - ) |
|
1388 | + ) |
|
1389 | 1389 | ) |
1390 | 1390 | // Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset. |
1391 | 1391 | && ($item_property['visibility'] == '1' |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | ($item_property['to_user_id'] != $user_id) && |
1402 | 1402 | (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'], $group_ids))) |
1403 | 1403 | ) { |
1404 | - continue; |
|
1404 | + continue; |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // If it's a survey, make sure the user's invited. Otherwise drop it. |
@@ -1620,21 +1620,21 @@ discard block |
||
1620 | 1620 | * |
1621 | 1621 | * @param string id of the rating ul element |
1622 | 1622 | * @param string url that will be added (for jquery see hot_courses.tpl) |
1623 | - * @param string point info array see function CourseManager::get_course_ranking() |
|
1624 | - * @param bool add a div wrapper |
|
1625 | - * @todo use templates |
|
1623 | + * @param string point info array see function CourseManager::get_course_ranking() |
|
1624 | + * @param bool add a div wrapper |
|
1625 | + * @todo use templates |
|
1626 | 1626 | **/ |
1627 | 1627 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
1628 | 1628 | { |
1629 | - $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1630 | - $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1629 | + $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1630 | + $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1631 | 1631 | |
1632 | - if (!empty($percentage)) { |
|
1632 | + if (!empty($percentage)) { |
|
1633 | 1633 | $percentage = $percentage*125/100; |
1634 | 1634 | } |
1635 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1635 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1636 | 1636 | |
1637 | - $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1637 | + $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1638 | 1638 | |
1639 | 1639 | $html = '<ul id="'.$id.'" class="star-rating"> |
1640 | 1640 | <li class="current-rating" style="width:'.$percentage.'px;"></li> |
@@ -1645,26 +1645,26 @@ discard block |
||
1645 | 1645 | <li><a href="javascript:void(0);" data-link="'.$url.'&star=5" title="'.$star_label.'" class="five-stars">5</a></li> |
1646 | 1646 | </ul>'; |
1647 | 1647 | |
1648 | - $labels = array(); |
|
1648 | + $labels = array(); |
|
1649 | 1649 | |
1650 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1651 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1652 | - if (!empty($number_of_users_who_voted)) { |
|
1653 | - $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
1654 | - } |
|
1650 | + $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1651 | + $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1652 | + if (!empty($number_of_users_who_voted)) { |
|
1653 | + $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
1654 | + } |
|
1655 | 1655 | |
1656 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1656 | + $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1657 | 1657 | |
1658 | - if (!$add_div_wrapper && api_is_anonymous()) { |
|
1659 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1660 | - } |
|
1658 | + if (!$add_div_wrapper && api_is_anonymous()) { |
|
1659 | + $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1660 | + } |
|
1661 | 1661 | |
1662 | 1662 | $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
1663 | 1663 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
1664 | 1664 | |
1665 | 1665 | if ($add_div_wrapper) { |
1666 | - $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1667 | - } |
|
1666 | + $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1667 | + } |
|
1668 | 1668 | |
1669 | 1669 | return $html; |
1670 | 1670 | } |
@@ -1702,8 +1702,8 @@ discard block |
||
1702 | 1702 | return self::page_header($title, $second_title); |
1703 | 1703 | } |
1704 | 1704 | |
1705 | - public static function page_subheader_and_translate($title, $second_title = null) |
|
1706 | - { |
|
1705 | + public static function page_subheader_and_translate($title, $second_title = null) |
|
1706 | + { |
|
1707 | 1707 | $title = get_lang($title); |
1708 | 1708 | return self::page_subheader($title, $second_title); |
1709 | 1709 | } |
@@ -666,9 +666,10 @@ |
||
666 | 666 | $result = ''; |
667 | 667 | for ($i = $min; $i <= $max; $i ++) { |
668 | 668 | $result .= '<option value="'.$i.'"'; |
669 | - if (is_int($selected_num)) |
|
670 | - if ($selected_num == $i) { |
|
669 | + if (is_int($selected_num)) { |
|
670 | + if ($selected_num == $i) { |
|
671 | 671 | $result .= ' selected="selected"'; |
672 | + } |
|
672 | 673 | } |
673 | 674 | $result .= '>'.$i.'</option>'; |
674 | 675 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param string Optional help file name |
56 | 56 | * @param string $page_header |
57 | 57 | */ |
58 | - public static function display_header($tool_name ='', $help = null, $page_header = null) |
|
58 | + public static function display_header($tool_name = '', $help = null, $page_header = null) |
|
59 | 59 | { |
60 | 60 | $origin = api_get_origin(); |
61 | 61 | $showHeader = true; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $grid_class = array(), |
352 | 352 | $elementCount = 0 |
353 | 353 | ) { |
354 | - $column = 0; |
|
354 | + $column = 0; |
|
355 | 355 | $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20; |
356 | 356 | |
357 | 357 | $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name); |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @param bool Filter (true) or not (false) |
477 | 477 | * @return void |
478 | 478 | */ |
479 | - public static function display_confirmation_message ($message, $filter = true, $returnValue = false) |
|
479 | + public static function display_confirmation_message($message, $filter = true, $returnValue = false) |
|
480 | 480 | { |
481 | 481 | $message = self::return_message($message, 'confirm', $filter); |
482 | 482 | if ($returnValue) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @param bool Filter (true) or not (false) |
494 | 494 | * @return void |
495 | 495 | */ |
496 | - public static function display_error_message ($message, $filter = true, $returnValue = false) |
|
496 | + public static function display_error_message($message, $filter = true, $returnValue = false) |
|
497 | 497 | { |
498 | 498 | $message = self::return_message($message, 'error', $filter); |
499 | 499 | if ($returnValue) { |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @param string $type |
509 | 509 | * @param bool $filter |
510 | 510 | */ |
511 | - public static function return_message_and_translate($message, $type='normal', $filter = true) |
|
511 | + public static function return_message_and_translate($message, $type = 'normal', $filter = true) |
|
512 | 512 | { |
513 | 513 | $message = get_lang($message); |
514 | 514 | echo self::return_message($message, $type, $filter); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | $class = ""; |
535 | - switch($type) { |
|
535 | + switch ($type) { |
|
536 | 536 | case 'warning': |
537 | 537 | $class .= 'alert alert-warning'; |
538 | 538 | break; |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * @param string optional, class from stylesheet |
561 | 561 | * @return string encrypted mailto hyperlink |
562 | 562 | */ |
563 | - public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '') |
|
563 | + public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '') |
|
564 | 564 | { |
565 | 565 | if (is_null($clickable_text)) { |
566 | 566 | $clickable_text = $email; |
@@ -575,14 +575,14 @@ discard block |
||
575 | 575 | } |
576 | 576 | // Encrypt email |
577 | 577 | $hmail = ''; |
578 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
578 | + for ($i = 0; $i < strlen($email); $i++) { |
|
579 | 579 | $hmail .= '&#'.ord($email { |
580 | 580 | $i }).';'; |
581 | 581 | } |
582 | 582 | $hclickable_text = null; |
583 | 583 | // Encrypt clickable text if @ is present |
584 | 584 | if (strpos($clickable_text, '@')) { |
585 | - for ($i = 0; $i < strlen($clickable_text); $i ++) { |
|
585 | + for ($i = 0; $i < strlen($clickable_text); $i++) { |
|
586 | 586 | $hclickable_text .= '&#'.ord($clickable_text { |
587 | 587 | $i }).';'; |
588 | 588 | } |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | } |
615 | 615 | // Encrypt email |
616 | 616 | $hmail = ''; |
617 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
617 | + for ($i = 0; $i < strlen($email); $i++) { |
|
618 | 618 | $hmail .= '&#'.ord($email { |
619 | 619 | $i }).';'; |
620 | 620 | } |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | public static function get_alphabet_options($selected_letter = '') |
648 | 648 | { |
649 | 649 | $result = ''; |
650 | - for ($i = 65; $i <= 90; $i ++) { |
|
650 | + for ($i = 65; $i <= 90; $i++) { |
|
651 | 651 | $letter = chr($i); |
652 | 652 | $result .= '<option value="'.$letter.'"'; |
653 | 653 | if ($selected_letter == $letter) { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | public static function get_numeric_options($min, $max, $selected_num = 0) |
669 | 669 | { |
670 | 670 | $result = ''; |
671 | - for ($i = $min; $i <= $max; $i ++) { |
|
671 | + for ($i = $min; $i <= $max; $i++) { |
|
672 | 672 | $result .= '<option value="'.$i.'"'; |
673 | 673 | if (is_int($selected_num)) |
674 | 674 | if ($selected_num == $i) { |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $size = ICON_SIZE_SMALL; |
746 | 746 | } |
747 | 747 | |
748 | - $size_extra = $size . '/'; |
|
748 | + $size_extra = $size.'/'; |
|
749 | 749 | |
750 | 750 | // Checking the img/ folder |
751 | 751 | $icon = $w_code_path.'img/'.$image; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $theme = 'themes/chamilo/icons/'; |
754 | 754 | |
755 | 755 | if ($loadThemeIcon) { |
756 | - $theme = 'themes/' . api_get_visual_theme() . '/icons/'; |
|
756 | + $theme = 'themes/'.api_get_visual_theme().'/icons/'; |
|
757 | 757 | // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX |
758 | 758 | if (is_file($alternateCssPath.$theme.$size_extra.$image)) { |
759 | 759 | $icon = $alternateWebCssPath.$theme.$size_extra.$image; |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | } |
860 | 860 | } |
861 | 861 | //some tags don't have this </XXX> |
862 | - if (in_array($tag, array('img','input','br'))) { |
|
862 | + if (in_array($tag, array('img', 'input', 'br'))) { |
|
863 | 863 | $return_value = '<'.$tag.' '.$attribute_list.' />'; |
864 | 864 | } else { |
865 | 865 | $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>'; |
@@ -912,13 +912,13 @@ discard block |
||
912 | 912 | public static function input($type, $name, $value, $attributes = array()) |
913 | 913 | { |
914 | 914 | if (isset($type)) { |
915 | - $attributes['type']= $type; |
|
915 | + $attributes['type'] = $type; |
|
916 | 916 | } |
917 | 917 | if (isset($name)) { |
918 | - $attributes['name']= $name; |
|
918 | + $attributes['name'] = $name; |
|
919 | 919 | } |
920 | 920 | if (isset($value)) { |
921 | - $attributes['value']= $value; |
|
921 | + $attributes['value'] = $value; |
|
922 | 922 | } |
923 | 923 | return self::tag('input', '', $attributes); |
924 | 924 | } |
@@ -951,14 +951,14 @@ discard block |
||
951 | 951 | ) { |
952 | 952 | $html = ''; |
953 | 953 | $extra = ''; |
954 | - $default_id = 'id="' . $name . '" '; |
|
954 | + $default_id = 'id="'.$name.'" '; |
|
955 | 955 | foreach ($extra_attributes as $key => $parameter) { |
956 | 956 | if ($key == 'id') { |
957 | 957 | $default_id = ''; |
958 | 958 | } |
959 | - $extra .= $key . '="' . $parameter . '" '; |
|
959 | + $extra .= $key.'="'.$parameter.'" '; |
|
960 | 960 | } |
961 | - $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>'; |
|
961 | + $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>'; |
|
962 | 962 | |
963 | 963 | if ($show_blank_item) { |
964 | 964 | if (empty($blank_item_text)) { |
@@ -966,14 +966,14 @@ discard block |
||
966 | 966 | } else { |
967 | 967 | $blank_item_text = Security::remove_XSS($blank_item_text); |
968 | 968 | } |
969 | - $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1')); |
|
969 | + $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1')); |
|
970 | 970 | } |
971 | 971 | if ($values) { |
972 | 972 | foreach ($values as $key => $value) { |
973 | 973 | if (is_array($value) && isset($value['name'])) { |
974 | 974 | $value = $value['name']; |
975 | 975 | } |
976 | - $html .= '<option value="' . $key . '"'; |
|
976 | + $html .= '<option value="'.$key.'"'; |
|
977 | 977 | |
978 | 978 | if (is_array($default)) { |
979 | 979 | foreach ($default as $item) { |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | } |
989 | 989 | } |
990 | 990 | |
991 | - $html .= '>' . $value . '</option>'; |
|
991 | + $html .= '>'.$value.'</option>'; |
|
992 | 992 | } |
993 | 993 | } |
994 | 994 | $html .= '</select>'; |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | */ |
1015 | 1015 | public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array()) |
1016 | 1016 | { |
1017 | - if (empty($header_list) || count($header_list) == 0 ) { |
|
1017 | + if (empty($header_list) || count($header_list) == 0) { |
|
1018 | 1018 | return ''; |
1019 | 1019 | } |
1020 | 1020 | |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes); |
1053 | 1053 | |
1054 | - return $main_div ; |
|
1054 | + return $main_div; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | /** |
@@ -1099,8 +1099,8 @@ discard block |
||
1099 | 1099 | */ |
1100 | 1100 | public static function grid_html($div_id) |
1101 | 1101 | { |
1102 | - $table = self::tag('table','', array('id' => $div_id)); |
|
1103 | - $table .= self::tag('div','', array('id' => $div_id.'_pager')); |
|
1102 | + $table = self::tag('table', '', array('id' => $div_id)); |
|
1103 | + $table .= self::tag('div', '', array('id' => $div_id.'_pager')); |
|
1104 | 1104 | return $table; |
1105 | 1105 | } |
1106 | 1106 | |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | $obj->colNames = $column_names; |
1162 | 1162 | $obj->colModel = $column_model; |
1163 | 1163 | $obj->pager = '#'.$div_id.'_pager'; |
1164 | - $obj->datatype = 'json'; |
|
1164 | + $obj->datatype = 'json'; |
|
1165 | 1165 | $obj->viewrecords = 'true'; |
1166 | 1166 | |
1167 | 1167 | $all_value = 10000000; |
@@ -1222,10 +1222,10 @@ discard block |
||
1222 | 1222 | // Adding static data. |
1223 | 1223 | if (!empty($data)) { |
1224 | 1224 | $data_var = $div_id.'_data'; |
1225 | - $json.=' var '.$data_var.' = '.json_encode($data).';'; |
|
1225 | + $json .= ' var '.$data_var.' = '.json_encode($data).';'; |
|
1226 | 1226 | $obj->data = $data_var; |
1227 | 1227 | $obj->datatype = 'local'; |
1228 | - $json.="\n"; |
|
1228 | + $json .= "\n"; |
|
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | $obj->end = 'end'; |
@@ -1239,12 +1239,12 @@ discard block |
||
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | // Fixing true/false js values that doesn't need the "" |
1242 | - $json_encode = str_replace(':"true"',':true',$json_encode); |
|
1242 | + $json_encode = str_replace(':"true"', ':true', $json_encode); |
|
1243 | 1243 | // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text |
1244 | 1244 | $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode); |
1245 | - $json_encode = str_replace(':"false"',':false',$json_encode); |
|
1245 | + $json_encode = str_replace(':"false"', ':false', $json_encode); |
|
1246 | 1246 | $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode); |
1247 | - $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode); |
|
1247 | + $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode); |
|
1248 | 1248 | |
1249 | 1249 | // Creating the jqgrid element. |
1250 | 1250 | $json .= '$("#'.$div_id.'").jqGrid({'; |
@@ -1259,22 +1259,22 @@ discard block |
||
1259 | 1259 | $groups = ''; |
1260 | 1260 | foreach ($extra_params['groupHeaders'] as $group) { |
1261 | 1261 | //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" }, |
1262 | - $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText'] . '" },'; |
|
1262 | + $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },'; |
|
1263 | 1263 | |
1264 | 1264 | } |
1265 | 1265 | $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", { |
1266 | 1266 | "useColSpanStyle" : false, |
1267 | 1267 | "groupHeaders" : [ |
1268 | - ' . $groups . ' |
|
1268 | + ' . $groups.' |
|
1269 | 1269 | ] |
1270 | 1270 | });'; |
1271 | 1271 | } |
1272 | 1272 | |
1273 | 1273 | $all_text = addslashes(get_lang('All')); |
1274 | 1274 | $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");'; |
1275 | - $json.= "\n"; |
|
1275 | + $json .= "\n"; |
|
1276 | 1276 | // Adding edit/delete icons. |
1277 | - $json.= $formatter; |
|
1277 | + $json .= $formatter; |
|
1278 | 1278 | |
1279 | 1279 | return $json; |
1280 | 1280 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | if (!empty($rows)) { |
1308 | - foreach($rows as $content) { |
|
1308 | + foreach ($rows as $content) { |
|
1309 | 1309 | $table->setCellContents($row, $column, $content); |
1310 | 1310 | $row++; |
1311 | 1311 | } |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | |
1468 | 1468 | // Show all tool icons where there is something new. |
1469 | 1469 | $return = ' '; |
1470 | - foreach($notifications as $notification) { |
|
1470 | + foreach ($notifications as $notification) { |
|
1471 | 1471 | $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date'])); |
1472 | 1472 | $type = $notification['lastedit_type']; |
1473 | 1473 | $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)"; |
@@ -1510,9 +1510,9 @@ discard block |
||
1510 | 1510 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
1511 | 1511 | $active = false; |
1512 | 1512 | // Request for the name of the general coach |
1513 | - $sql ='SELECT tu.lastname, tu.firstname, ts.* |
|
1513 | + $sql = 'SELECT tu.lastname, tu.firstname, ts.* |
|
1514 | 1514 | FROM '.$tbl_session.' ts |
1515 | - LEFT JOIN '.$main_user_table .' tu |
|
1515 | + LEFT JOIN '.$main_user_table.' tu |
|
1516 | 1516 | ON ts.id_coach = tu.user_id |
1517 | 1517 | WHERE ts.id = '.intval($session_id); |
1518 | 1518 | $rs = Database::query($sql); |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | $session = array(); |
1523 | 1523 | $session['title'] = $session_info['name']; |
1524 | 1524 | $session['coach'] = ''; |
1525 | - $session['dates'] = ''; |
|
1525 | + $session['dates'] = ''; |
|
1526 | 1526 | |
1527 | 1527 | if ( |
1528 | 1528 | ( |
@@ -1604,8 +1604,8 @@ discard block |
||
1604 | 1604 | ); |
1605 | 1605 | } |
1606 | 1606 | |
1607 | - if ( api_get_setting('show_session_coach') === 'true' ) { |
|
1608 | - $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name( |
|
1607 | + if (api_get_setting('show_session_coach') === 'true') { |
|
1608 | + $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name( |
|
1609 | 1609 | $session_info['firstname'], |
1610 | 1610 | $session_info['lastname'] |
1611 | 1611 | ); |
@@ -1657,9 +1657,9 @@ discard block |
||
1657 | 1657 | $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
1658 | 1658 | |
1659 | 1659 | if (!empty($percentage)) { |
1660 | - $percentage = $percentage*125/100; |
|
1660 | + $percentage = $percentage * 125 / 100; |
|
1661 | 1661 | } |
1662 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1662 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1663 | 1663 | |
1664 | 1664 | $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
1665 | 1665 | |
@@ -1674,19 +1674,19 @@ discard block |
||
1674 | 1674 | |
1675 | 1675 | $labels = array(); |
1676 | 1676 | |
1677 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1678 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1677 | + $labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1678 | + $labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1679 | 1679 | if (!empty($number_of_users_who_voted)) { |
1680 | - $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
1680 | + $labels[] = get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
1681 | 1681 | } |
1682 | 1682 | |
1683 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1683 | + $labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] '; |
|
1684 | 1684 | |
1685 | 1685 | if (!$add_div_wrapper && api_is_anonymous()) { |
1686 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1686 | + $labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1687 | 1687 | } |
1688 | 1688 | |
1689 | - $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
1689 | + $html .= Display::div(implode(' | ', $labels), array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
1690 | 1690 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
1691 | 1691 | |
1692 | 1692 | if ($add_div_wrapper) { |
@@ -1764,8 +1764,8 @@ discard block |
||
1764 | 1764 | if (!empty($list)) { |
1765 | 1765 | $html = '<dl class="dl-horizontal">'; |
1766 | 1766 | foreach ($list as $item) { |
1767 | - $html .= '<dt>' . $item['title'] . '</dt>'; |
|
1768 | - $html .= '<dd>' . $item['content'] . '</dd>'; |
|
1767 | + $html .= '<dt>'.$item['title'].'</dt>'; |
|
1768 | + $html .= '<dd>'.$item['content'].'</dd>'; |
|
1769 | 1769 | } |
1770 | 1770 | $html .= '</dl>'; |
1771 | 1771 | } |
@@ -1807,7 +1807,7 @@ discard block |
||
1807 | 1807 | * @param string $type |
1808 | 1808 | * @return null|string |
1809 | 1809 | */ |
1810 | - public static function badge($count, $type ="warning") |
|
1810 | + public static function badge($count, $type = "warning") |
|
1811 | 1811 | { |
1812 | 1812 | $class = ''; |
1813 | 1813 | |
@@ -1883,7 +1883,7 @@ discard block |
||
1883 | 1883 | if (!empty($content)) { |
1884 | 1884 | $html = '<span class="label '.$class.'">'; |
1885 | 1885 | $html .= $content; |
1886 | - $html .='</span>'; |
|
1886 | + $html .= '</span>'; |
|
1887 | 1887 | } |
1888 | 1888 | |
1889 | 1889 | return $html; |
@@ -1904,7 +1904,7 @@ discard block |
||
1904 | 1904 | $class = 'class ="active"'; |
1905 | 1905 | } |
1906 | 1906 | |
1907 | - if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) { |
|
1907 | + if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) { |
|
1908 | 1908 | $class = 'class ="active"'; |
1909 | 1909 | } |
1910 | 1910 | $html .= "<li $class >"; |
@@ -2155,7 +2155,7 @@ discard block |
||
2155 | 2155 | } |
2156 | 2156 | $label = $nextValue + $localCounter + 1; |
2157 | 2157 | if ($isMedia) { |
2158 | - $label = ($fixedValue + 1) .' '.chr(97 + $localCounter); |
|
2158 | + $label = ($fixedValue + 1).' '.chr(97 + $localCounter); |
|
2159 | 2159 | $link_to_show = $link.$fixedValue.'#questionanchor'.$itemId; |
2160 | 2160 | } |
2161 | 2161 | $link = Display::url($label.' ', $link_to_show, $linkAttributes); |
@@ -2267,7 +2267,7 @@ discard block |
||
2267 | 2267 | */ |
2268 | 2268 | public static function getVCardUserLink($userId) |
2269 | 2269 | { |
2270 | - $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);; |
|
2270 | + $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ; |
|
2271 | 2271 | |
2272 | 2272 | return $vCardUrl; |
2273 | 2273 | } |
@@ -2285,7 +2285,7 @@ discard block |
||
2285 | 2285 | { |
2286 | 2286 | $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : ''; |
2287 | 2287 | $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : ''; |
2288 | - $styles = ['primary','success','info','warning','danger']; |
|
2288 | + $styles = ['primary', 'success', 'info', 'warning', 'danger']; |
|
2289 | 2289 | $style = !in_array($style, $styles) ? 'default' : $style; |
2290 | 2290 | |
2291 | 2291 | return ' |
@@ -2330,7 +2330,7 @@ discard block |
||
2330 | 2330 | $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass; |
2331 | 2331 | |
2332 | 2332 | if (!$includeText) { |
2333 | - $text = '<span class="sr-only">' . $text . '</span>'; |
|
2333 | + $text = '<span class="sr-only">'.$text.'</span>'; |
|
2334 | 2334 | } |
2335 | 2335 | |
2336 | 2336 | return self::url("$icon $text", $url, $attributes); |
@@ -2345,16 +2345,16 @@ discard block |
||
2345 | 2345 | */ |
2346 | 2346 | public static function toolbarAction($id, $content = array(), $col = 2, $right = true) |
2347 | 2347 | { |
2348 | - $columns = 12/$col; |
|
2348 | + $columns = 12 / $col; |
|
2349 | 2349 | $html = ''; |
2350 | - $html .= '<div id="' . $id . '" class="actions">'; |
|
2350 | + $html .= '<div id="'.$id.'" class="actions">'; |
|
2351 | 2351 | $html .= '<div class="row">'; |
2352 | 2352 | if ($col > 4) { |
2353 | 2353 | $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>'; |
2354 | 2354 | } else { |
2355 | - for ( $i = 0; $i < $col; $i++ ) { |
|
2356 | - $html .= '<div class="col-md-' . $columns . '">'; |
|
2357 | - if ( $col == 2 && $i == 1 ) { |
|
2355 | + for ($i = 0; $i < $col; $i++) { |
|
2356 | + $html .= '<div class="col-md-'.$columns.'">'; |
|
2357 | + if ($col == 2 && $i == 1) { |
|
2358 | 2358 | if ($right === true) { |
2359 | 2359 | $html .= '<div class="pull-right">'; |
2360 | 2360 | $html .= (isset($content[$i]) ? $content[$i] : ''); |
@@ -2469,9 +2469,9 @@ discard block |
||
2469 | 2469 | $params['class'] = 'panel panel-default'; |
2470 | 2470 | $html = null; |
2471 | 2471 | if (!empty($title)) { |
2472 | - $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL; |
|
2472 | + $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL; |
|
2473 | 2473 | } |
2474 | - $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
2474 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
2475 | 2475 | $html = Display::div($html, $params); |
2476 | 2476 | } |
2477 | 2477 | return $html; |
@@ -1255,6 +1255,7 @@ discard block |
||
1255 | 1255 | |
1256 | 1256 | /** |
1257 | 1257 | * Validates the time control key |
1258 | + * @param integer $exercise_id |
|
1258 | 1259 | */ |
1259 | 1260 | public static function exercise_time_control_is_valid( |
1260 | 1261 | $exercise_id, |
@@ -1388,7 +1389,7 @@ discard block |
||
1388 | 1389 | * @param int $in_direction |
1389 | 1390 | * @param string $in_hotpot_path |
1390 | 1391 | * @param bool $in_get_count |
1391 | - * @param null $where_condition |
|
1392 | + * @param string $where_condition |
|
1392 | 1393 | * @return array|int |
1393 | 1394 | */ |
1394 | 1395 | public static function get_exam_results_hotpotatoes_data( |
@@ -2179,7 +2180,7 @@ discard block |
||
2179 | 2180 | /** |
2180 | 2181 | * Return true if pass_pourcentage activated (we use the pass pourcentage feature |
2181 | 2182 | * return false if pass_percentage = 0 (we don't use the pass pourcentage feature |
2182 | - * @param $in_pass_pourcentage |
|
2183 | + * @param string $in_pass_pourcentage |
|
2183 | 2184 | * @return boolean |
2184 | 2185 | * In this version, pass_percentage and show_success_message are disabled if |
2185 | 2186 | * pass_percentage is set to 0 |
@@ -2192,7 +2193,7 @@ discard block |
||
2192 | 2193 | /** |
2193 | 2194 | * Converts a numeric value in a percentage example 0.66666 to 66.67 % |
2194 | 2195 | * @param $value |
2195 | - * @return float Converted number |
|
2196 | + * @return string Converted number |
|
2196 | 2197 | */ |
2197 | 2198 | public static function convert_to_percentage($value) |
2198 | 2199 | { |
@@ -2208,7 +2209,7 @@ discard block |
||
2208 | 2209 | * @param float $score |
2209 | 2210 | * @param float $weight |
2210 | 2211 | * @deprecated seem not to be used |
2211 | - * @return float the score rounded converted to the new range |
|
2212 | + * @return string|null the score rounded converted to the new range |
|
2212 | 2213 | */ |
2213 | 2214 | public static function convert_score($score, $weight) |
2214 | 2215 | { |
@@ -2759,6 +2760,7 @@ discard block |
||
2759 | 2760 | * @param int exercise id |
2760 | 2761 | * @param int $courseId |
2761 | 2762 | * @param int session id |
2763 | + * @param integer $user_count |
|
2762 | 2764 | * @return float Best average score |
2763 | 2765 | */ |
2764 | 2766 | public static function get_best_average_score_by_exercise( |
@@ -3198,8 +3200,9 @@ discard block |
||
3198 | 3200 | } |
3199 | 3201 | |
3200 | 3202 | /** |
3201 | - * @param array $answer |
|
3203 | + * @param string|null $answer |
|
3202 | 3204 | * @param string $user_answer |
3205 | + * @param string|null $current_answer |
|
3203 | 3206 | * @return array |
3204 | 3207 | */ |
3205 | 3208 | public static function check_fill_in_blanks($answer, $user_answer, $current_answer) |
@@ -3805,7 +3808,7 @@ discard block |
||
3805 | 3808 | |
3806 | 3809 | /** |
3807 | 3810 | * @param int $countLetter |
3808 | - * @return mixed |
|
3811 | + * @return string |
|
3809 | 3812 | */ |
3810 | 3813 | public static function detectInputAppropriateClass($countLetter) |
3811 | 3814 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($show_title) { |
66 | 66 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
67 | 67 | echo Display::div( |
68 | - $current_item . '. ' . $objQuestionTmp->selectTitle(), |
|
68 | + $current_item.'. '.$objQuestionTmp->selectTitle(), |
|
69 | 69 | array('class' => 'question_title') |
70 | 70 | ); |
71 | 71 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | $config = array( |
162 | 162 | 'ToolbarSet' => 'TestFreeAnswer' |
163 | 163 | ); |
164 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
165 | - $form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
|
164 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
165 | + $form->setDefaults(array("choice[".$questionId."]" => $fck_content)); |
|
166 | 166 | $s .= $form->returnForm(); |
167 | 167 | } elseif ($answerType == ORAL_EXPRESSION) { |
168 | 168 | // Add nanog |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $config = array( |
192 | 192 | 'ToolbarSet' => 'TestFreeAnswer' |
193 | 193 | ); |
194 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
194 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
195 | 195 | //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
196 | 196 | $s .= $form->returnForm(); |
197 | 197 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | // Unique answer |
274 | 274 | if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) { |
275 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
275 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
276 | 276 | if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) { |
277 | 277 | $attributes = array( |
278 | 278 | 'id' => $input_id, |
@@ -297,14 +297,14 @@ discard block |
||
297 | 297 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
298 | 298 | if ($show_comment) { |
299 | 299 | if (empty($comment)) { |
300 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
300 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
301 | 301 | . 'class="exercise-unique-answer-image" style="text-align: center">'; |
302 | 302 | } else { |
303 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
303 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
304 | 304 | . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">'; |
305 | 305 | } |
306 | 306 | } else { |
307 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
307 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
308 | 308 | . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">'; |
309 | 309 | } |
310 | 310 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $answer = Security::remove_XSS($answer, STUDENT); |
313 | 313 | $s .= Display::input( |
314 | 314 | 'hidden', |
315 | - 'choice2[' . $questionId . ']', |
|
315 | + 'choice2['.$questionId.']', |
|
316 | 316 | '0' |
317 | 317 | ); |
318 | 318 | |
@@ -320,13 +320,13 @@ discard block |
||
320 | 320 | |
321 | 321 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
322 | 322 | $attributes['style'] = 'display: none;'; |
323 | - $answer = '<div class="thumbnail">' . $answer . '</div>'; |
|
323 | + $answer = '<div class="thumbnail">'.$answer.'</div>'; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | $answer_input .= '<label class="radio">'; |
327 | 327 | $answer_input .= Display::input( |
328 | 328 | 'radio', |
329 | - 'choice[' . $questionId . ']', |
|
329 | + 'choice['.$questionId.']', |
|
330 | 330 | $numAnswer, |
331 | 331 | $attributes |
332 | 332 | ); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $answerType == MULTIPLE_ANSWER_TRUE_FALSE || |
354 | 354 | $answerType == GLOBAL_MULTIPLE_ANSWER |
355 | 355 | ) { |
356 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
356 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
357 | 357 | $answer = Security::remove_XSS($answer, STUDENT); |
358 | 358 | |
359 | 359 | if (in_array($numAnswer, $user_choice_array)) { |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
377 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
377 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
378 | 378 | |
379 | 379 | $answer_input = '<label class="checkbox">'; |
380 | 380 | $answer_input .= Display::input( |
381 | 381 | 'checkbox', |
382 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
382 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
383 | 383 | $numAnswer, |
384 | 384 | $attributes |
385 | 385 | ); |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | 'td', |
433 | 433 | Display::input( |
434 | 434 | 'radio', |
435 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
435 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
436 | 436 | $id, |
437 | 437 | $attributes |
438 | 438 | ), |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | } |
451 | 451 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
452 | 452 | // multiple answers |
453 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
453 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
454 | 454 | |
455 | 455 | if (in_array($numAnswer, $user_choice_array)) { |
456 | 456 | $attributes = array( |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | } |
471 | 471 | |
472 | 472 | $answer = Security::remove_XSS($answer, STUDENT); |
473 | - $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
473 | + $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
474 | 474 | $answer_input .= '<label class="checkbox">'; |
475 | 475 | $answer_input .= Display::input( |
476 | 476 | 'checkbox', |
477 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
477 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
478 | 478 | 1, |
479 | 479 | $attributes |
480 | 480 | ); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
498 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
498 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
499 | 499 | |
500 | 500 | $my_choice = array(); |
501 | 501 | if (!empty($user_choice_array)) { |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | 'td', |
531 | 531 | Display::input( |
532 | 532 | 'radio', |
533 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
533 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
534 | 534 | $key, |
535 | 535 | $attributes |
536 | 536 | ) |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | $trackAttempts = Database::get_main_table( |
627 | 627 | TABLE_STATISTIC_TRACK_E_ATTEMPT |
628 | 628 | ); |
629 | - $sql = 'SELECT answer FROM ' . $trackAttempts . ' |
|
630 | - WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId; |
|
629 | + $sql = 'SELECT answer FROM '.$trackAttempts.' |
|
630 | + WHERE exe_id=' . $exe_id.' AND question_id='.$questionId; |
|
631 | 631 | $rsLastAttempt = Database::query($sql); |
632 | 632 | $rowLastAttempt = Database::fetch_array($rsLastAttempt); |
633 | 633 | $answer = $rowLastAttempt['answer']; |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | '', |
698 | 698 | $answerCorrected |
699 | 699 | ); |
700 | - $answerCorrected = '[' . $answerCorrected . ']'; |
|
700 | + $answerCorrected = '['.$answerCorrected.']'; |
|
701 | 701 | $studentAnswerList[] = $answerCorrected; |
702 | 702 | } |
703 | 703 | } |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | */ |
719 | 719 | $tabComments = api_preg_split( |
720 | 720 | '/\[[^]]+\]/', |
721 | - ' ' . $answer . ' ' |
|
721 | + ' '.$answer.' ' |
|
722 | 722 | ); |
723 | 723 | if (!empty($correctAnswerList) && !empty($studentAnswerList)) { |
724 | 724 | $answer = ""; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $size |
736 | 736 | ); |
737 | 737 | |
738 | - $answer .= $tabComments[$i] . |
|
738 | + $answer .= $tabComments[$i]. |
|
739 | 739 | Display::input( |
740 | 740 | 'text', |
741 | 741 | "choice[$questionId][]", |
@@ -781,12 +781,12 @@ discard block |
||
781 | 781 | $s .= '<tr><td width="45%" valign="top">'; |
782 | 782 | $parsed_answer = $answer; |
783 | 783 | //left part questions |
784 | - $s .= '<p class="indent">' . $lines_count . '. ' . $parsed_answer . '</p></td>'; |
|
784 | + $s .= '<p class="indent">'.$lines_count.'. '.$parsed_answer.'</p></td>'; |
|
785 | 785 | //middle part (matches selects) |
786 | 786 | |
787 | 787 | $s .= '<td width="10%" valign="top" align="center" > |
788 | 788 | <div class="select-matching"> |
789 | - <select name="choice[' . $questionId . '][' . $numAnswer . ']">'; |
|
789 | + <select name="choice[' . $questionId.']['.$numAnswer.']">'; |
|
790 | 790 | |
791 | 791 | // fills the list-box |
792 | 792 | foreach ($select_items as $key => $val) { |
@@ -802,14 +802,14 @@ discard block |
||
802 | 802 | if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) { |
803 | 803 | $selected = 'selected="selected"'; |
804 | 804 | } |
805 | - $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>'; |
|
805 | + $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>'; |
|
806 | 806 | |
807 | 807 | } // end foreach() |
808 | 808 | |
809 | 809 | $s .= '</select></div></td><td width="5%" class="separate"> </td>'; |
810 | 810 | $s .= '<td width="40%" valign="top" >'; |
811 | 811 | if (isset($select_items[$lines_count])) { |
812 | - $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'. '. $select_items[$lines_count]['answer'].'</p></div>'; |
|
812 | + $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'</p></div>'; |
|
813 | 813 | } else { |
814 | 814 | $s .= ' '; |
815 | 815 | } |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | $s .= '<tr> |
825 | 825 | <td colspan="2"></td> |
826 | 826 | <td valign="top">'; |
827 | - $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer']; |
|
827 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer']; |
|
828 | 828 | $s .= "</td> |
829 | 829 | </tr>"; |
830 | 830 | $lines_count++; |
@@ -840,9 +840,9 @@ discard block |
||
840 | 840 | $data = $objAnswerTmp->getAnswerByAutoId($data['correct']); |
841 | 841 | $lines_count = $data['answer'];*/ |
842 | 842 | |
843 | - $windowId = $questionId . '_' . $lines_count; |
|
843 | + $windowId = $questionId.'_'.$lines_count; |
|
844 | 844 | |
845 | - $s .= '<li class="touch-items" id="' . $windowId . '">'; |
|
845 | + $s .= '<li class="touch-items" id="'.$windowId.'">'; |
|
846 | 846 | $s .= Display::div( |
847 | 847 | $parsed_answer, |
848 | 848 | [ |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | Display::tag( |
901 | 901 | 'b', |
902 | 902 | $select_items[$lines_count]['letter'] |
903 | - ) . $select_items[$lines_count]['answer'], |
|
903 | + ).$select_items[$lines_count]['answer'], |
|
904 | 904 | [ |
905 | 905 | 'id' => "window_{$windowId}_answer", |
906 | 906 | 'style' => 'display: none;' |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | |
1045 | 1045 | if ($show_comment) { |
1046 | 1046 | $s .= '</table>'; |
1047 | - } elseif( |
|
1047 | + } elseif ( |
|
1048 | 1048 | in_array( |
1049 | 1049 | $answerType, |
1050 | 1050 | [ |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | |
1070 | 1070 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
1071 | 1071 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
1072 | - $windowId = $questionId . '_' . $counterAnswer; |
|
1072 | + $windowId = $questionId.'_'.$counterAnswer; |
|
1073 | 1073 | |
1074 | 1074 | if ($answerCorrect) { |
1075 | 1075 | $s .= Display::div( |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | $course = api_get_course_info(); |
1115 | 1115 | $doc_id = DocumentManager::get_document_id( |
1116 | 1116 | $course, |
1117 | - '/images/' . $pictureName |
|
1117 | + '/images/'.$pictureName |
|
1118 | 1118 | ); |
1119 | 1119 | if (is_numeric($doc_id)) { |
1120 | 1120 | $images_folder_visibility = api_get_item_visibility( |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | echo " |
1140 | 1140 | <script> |
1141 | 1141 | $(document).on('ready', function () { |
1142 | - new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion" ) . "({ |
|
1142 | + new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({ |
|
1143 | 1143 | questionId: $questionId, |
1144 | 1144 | exerciseId: $exerciseId, |
1145 | 1145 | selector: '#hotspot-preview-$questionId', |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | if ($answerType != HOT_SPOT_DELINEATION) { |
1174 | 1174 | $answerList = ' |
1175 | 1175 | <div class="well well-sm"> |
1176 | - <h5 class="page-header">' . get_lang('HotspotZones') . '</h5> |
|
1176 | + <h5 class="page-header">' . get_lang('HotspotZones').'</h5> |
|
1177 | 1177 | <ol> |
1178 | 1178 | '; |
1179 | 1179 | |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | if (!$only_questions) { |
1199 | 1199 | if ($show_title) { |
1200 | 1200 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
1201 | - echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>'; |
|
1201 | + echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
1202 | 1202 | } |
1203 | 1203 | //@todo I need to the get the feedback type |
1204 | 1204 | echo <<<HOTSPOT |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | <div class=\"hotspot-image\"></div> |
1217 | 1217 | <script> |
1218 | 1218 | $(document).on('ready', function () { |
1219 | - new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({ |
|
1219 | + new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({ |
|
1220 | 1220 | questionId: $questionId, |
1221 | 1221 | exerciseId: $exe_id, |
1222 | 1222 | selector: '#question_div_' + $questionId + ' .hotspot-image', |
@@ -1335,11 +1335,11 @@ discard block |
||
1335 | 1335 | $lp_id = intval($lp_id); |
1336 | 1336 | $lp_item_id = intval($lp_item_id); |
1337 | 1337 | return |
1338 | - api_get_course_int_id() . '_' . |
|
1339 | - api_get_session_id() . '_' . |
|
1340 | - $exercise_id . '_' . |
|
1341 | - api_get_user_id() . '_' . |
|
1342 | - $lp_id . '_' . |
|
1338 | + api_get_course_int_id().'_'. |
|
1339 | + api_get_session_id().'_'. |
|
1340 | + $exercise_id.'_'. |
|
1341 | + api_get_user_id().'_'. |
|
1342 | + $lp_id.'_'. |
|
1343 | 1343 | $lp_item_id; |
1344 | 1344 | } |
1345 | 1345 | |
@@ -1451,14 +1451,14 @@ discard block |
||
1451 | 1451 | $res = Database::query($sql); |
1452 | 1452 | $result = array(); |
1453 | 1453 | $apiIsAllowedToEdit = api_is_allowed_to_edit(); |
1454 | - $urlBase = api_get_path(WEB_CODE_PATH) . |
|
1455 | - 'exercice/hotpotatoes_exercise_report.php?action=delete&' . |
|
1456 | - api_get_cidreq() . '&id='; |
|
1454 | + $urlBase = api_get_path(WEB_CODE_PATH). |
|
1455 | + 'exercice/hotpotatoes_exercise_report.php?action=delete&'. |
|
1456 | + api_get_cidreq().'&id='; |
|
1457 | 1457 | while ($data = Database::fetch_array($res)) { |
1458 | 1458 | $actions = null; |
1459 | 1459 | |
1460 | 1460 | if ($apiIsAllowedToEdit) { |
1461 | - $url = $urlBase . $data['id'] . '&path=' . $data['exe_name']; |
|
1461 | + $url = $urlBase.$data['id'].'&path='.$data['exe_name']; |
|
1462 | 1462 | $actions = Display::url( |
1463 | 1463 | Display::return_icon('delete.png', get_lang('Delete')), |
1464 | 1464 | $url |
@@ -1474,7 +1474,7 @@ discard block |
||
1474 | 1474 | GroupManager::get_user_group_name($data['user_id']) |
1475 | 1475 | ), |
1476 | 1476 | 'exe_date' => $data['exe_date'], |
1477 | - 'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'], |
|
1477 | + 'score' => $data['exe_result'].' / '.$data['exe_weighting'], |
|
1478 | 1478 | 'actions' => $actions, |
1479 | 1479 | ); |
1480 | 1480 | } |
@@ -1557,18 +1557,18 @@ discard block |
||
1557 | 1557 | $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
1558 | 1558 | $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
1559 | 1559 | |
1560 | - $session_id_and = ' AND te.session_id = ' . $sessionId . ' '; |
|
1560 | + $session_id_and = ' AND te.session_id = '.$sessionId.' '; |
|
1561 | 1561 | $exercise_id = intval($exercise_id); |
1562 | 1562 | |
1563 | 1563 | $exercise_where = ''; |
1564 | 1564 | if (!empty($exercise_id)) { |
1565 | - $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . ' '; |
|
1565 | + $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.' '; |
|
1566 | 1566 | } |
1567 | 1567 | |
1568 | 1568 | $hotpotatoe_where = ''; |
1569 | 1569 | if (!empty($_GET['path'])) { |
1570 | 1570 | $hotpotatoe_path = Database::escape_string($_GET['path']); |
1571 | - $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '" '; |
|
1571 | + $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'" '; |
|
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | // sql for chamilo-type tests for teacher / tutor view |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | WHERE |
1581 | 1581 | c_id = $course_id AND |
1582 | 1582 | exe_exo_id = $exercise_id AND |
1583 | - ttte.session_id = " . $sessionId . " |
|
1583 | + ttte.session_id = ".$sessionId." |
|
1584 | 1584 | )"; |
1585 | 1585 | |
1586 | 1586 | if ($is_allowedToEdit) { |
@@ -1603,9 +1603,9 @@ discard block |
||
1603 | 1603 | g.id as group_id |
1604 | 1604 | FROM $TBL_USER u |
1605 | 1605 | INNER JOIN $TBL_GROUP_REL_USER gru |
1606 | - ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ") |
|
1606 | + ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.") |
|
1607 | 1607 | INNER JOIN $TBL_GROUP g |
1608 | - ON (gru.group_id = g.id AND g.c_id=" . $course_id . ") |
|
1608 | + ON (gru.group_id = g.id AND g.c_id=".$course_id.") |
|
1609 | 1609 | )"; |
1610 | 1610 | } |
1611 | 1611 | |
@@ -1667,9 +1667,9 @@ discard block |
||
1667 | 1667 | g.id as group_id |
1668 | 1668 | FROM $TBL_USER u |
1669 | 1669 | LEFT OUTER JOIN $TBL_GROUP_REL_USER gru |
1670 | - ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " ) |
|
1670 | + ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." ) |
|
1671 | 1671 | LEFT OUTER JOIN $TBL_GROUP g |
1672 | - ON (gru.group_id = g.id AND g.c_id = " . $course_id . ") |
|
1672 | + ON (gru.group_id = g.id AND g.c_id = ".$course_id.") |
|
1673 | 1673 | )"; |
1674 | 1674 | } |
1675 | 1675 | |
@@ -1682,12 +1682,12 @@ discard block |
||
1682 | 1682 | ( |
1683 | 1683 | SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code |
1684 | 1684 | FROM $TBL_USER u |
1685 | - WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") |
|
1685 | + WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').") |
|
1686 | 1686 | )"; |
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru "; |
1690 | - $sqlWhereOption = " AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id "; |
|
1690 | + $sqlWhereOption = " AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id "; |
|
1691 | 1691 | $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname"; |
1692 | 1692 | |
1693 | 1693 | if ($get_count) { |
@@ -1724,8 +1724,8 @@ discard block |
||
1724 | 1724 | ON (user.user_id = exe_user_id) |
1725 | 1725 | WHERE |
1726 | 1726 | te.status != 'incomplete' AND |
1727 | - te.c_id = " . $course_id . " $session_id_and AND |
|
1728 | - ce.active <>-1 AND ce.c_id = " . $course_id . " |
|
1727 | + te.c_id = ".$course_id." $session_id_and AND |
|
1728 | + ce.active <>-1 AND ce.c_id = ".$course_id." |
|
1729 | 1729 | $exercise_where |
1730 | 1730 | $extra_where_conditions |
1731 | 1731 | "; |
@@ -1752,12 +1752,12 @@ discard block |
||
1752 | 1752 | $sqlFromOption |
1753 | 1753 | WHERE |
1754 | 1754 | user.user_id=tth.exe_user_id |
1755 | - AND tth.c_id = " . $course_id . " |
|
1755 | + AND tth.c_id = ".$course_id." |
|
1756 | 1756 | $hotpotatoe_where |
1757 | 1757 | $sqlWhereOption |
1758 | - AND user.status NOT IN(" . api_get_users_status_ignored_in_reports( |
|
1758 | + AND user.status NOT IN(".api_get_users_status_ignored_in_reports( |
|
1759 | 1759 | 'string' |
1760 | - ) . ") |
|
1760 | + ).") |
|
1761 | 1761 | ORDER BY |
1762 | 1762 | tth.c_id ASC, |
1763 | 1763 | tth.exe_date DESC"; |
@@ -1830,12 +1830,12 @@ discard block |
||
1830 | 1830 | |
1831 | 1831 | if ($from_gradebook && ($is_allowedToEdit)) { |
1832 | 1832 | if (in_array( |
1833 | - $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'], |
|
1833 | + $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'], |
|
1834 | 1834 | $users_array_id |
1835 | 1835 | )) { |
1836 | 1836 | continue; |
1837 | 1837 | } |
1838 | - $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname']; |
|
1838 | + $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname']; |
|
1839 | 1839 | } |
1840 | 1840 | |
1841 | 1841 | $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null; |
@@ -1844,8 +1844,8 @@ discard block |
||
1844 | 1844 | if ($lp_obj) { |
1845 | 1845 | $url = api_get_path( |
1846 | 1846 | WEB_CODE_PATH |
1847 | - ) . 'newscorm/lp_controller.php?' . api_get_cidreq( |
|
1848 | - ) . '&action=view&lp_id=' . $results[$i]['orig_lp_id']; |
|
1847 | + ).'newscorm/lp_controller.php?'.api_get_cidreq( |
|
1848 | + ).'&action=view&lp_id='.$results[$i]['orig_lp_id']; |
|
1849 | 1849 | $lp_name = Display::url( |
1850 | 1850 | $lp_obj['lp_name'], |
1851 | 1851 | $url, |
@@ -1863,7 +1863,7 @@ discard block |
||
1863 | 1863 | ); |
1864 | 1864 | |
1865 | 1865 | foreach ($group_list as $id) { |
1866 | - $group_name_list .= $clean_group_list[$id] . '<br/>'; |
|
1866 | + $group_name_list .= $clean_group_list[$id].'<br/>'; |
|
1867 | 1867 | } |
1868 | 1868 | $results[$i]['group_name'] = $group_name_list; |
1869 | 1869 | } |
@@ -1919,8 +1919,8 @@ discard block |
||
1919 | 1919 | } |
1920 | 1920 | } |
1921 | 1921 | if ($revised) { |
1922 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
1923 | - ) . "&action=edit&id=$id'>" . |
|
1922 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
1923 | + )."&action=edit&id=$id'>". |
|
1924 | 1924 | Display:: return_icon( |
1925 | 1925 | 'edit.png', |
1926 | 1926 | get_lang('Edit'), |
@@ -1929,8 +1929,8 @@ discard block |
||
1929 | 1929 | ); |
1930 | 1930 | $actions .= ' '; |
1931 | 1931 | } else { |
1932 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
1933 | - ) . "&action=qualify&id=$id'>" . |
|
1932 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
1933 | + )."&action=qualify&id=$id'>". |
|
1934 | 1934 | Display:: return_icon( |
1935 | 1935 | 'quiz.gif', |
1936 | 1936 | get_lang('Qualify') |
@@ -1940,12 +1940,12 @@ discard block |
||
1940 | 1940 | $actions .= "</a>"; |
1941 | 1941 | |
1942 | 1942 | if ($filter == 2) { |
1943 | - $actions .= ' <a href="exercise_history.php?' . api_get_cidreq( |
|
1944 | - ) . '&exe_id=' . $id . '">' . |
|
1943 | + $actions .= ' <a href="exercise_history.php?'.api_get_cidreq( |
|
1944 | + ).'&exe_id='.$id.'">'. |
|
1945 | 1945 | Display:: return_icon( |
1946 | 1946 | 'history.gif', |
1947 | 1947 | get_lang('ViewHistoryChange') |
1948 | - ) . '</a>'; |
|
1948 | + ).'</a>'; |
|
1949 | 1949 | } |
1950 | 1950 | |
1951 | 1951 | //Admin can always delete the attempt |
@@ -1957,32 +1957,32 @@ discard block |
||
1957 | 1957 | date('Y-m-d h:i:s'), |
1958 | 1958 | false |
1959 | 1959 | ); |
1960 | - $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank"> |
|
1960 | + $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank"> |
|
1961 | 1961 | '.Display::return_icon('info.png', $ip).' |
1962 | 1962 | </a>'; |
1963 | 1963 | |
1964 | - $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '" |
|
1964 | + $delete_link = '<a href="exercise_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'" |
|
1965 | 1965 | onclick="javascript:if(!confirm(\'' . sprintf( |
1966 | 1966 | get_lang('DeleteAttempt'), |
1967 | 1967 | $results[$i]['username'], |
1968 | 1968 | $dt |
1969 | - ) . '\')) return false;">' . Display:: return_icon( |
|
1969 | + ).'\')) return false;">'.Display:: return_icon( |
|
1970 | 1970 | 'delete.png', |
1971 | 1971 | get_lang('Delete') |
1972 | - ) . '</a>'; |
|
1972 | + ).'</a>'; |
|
1973 | 1973 | $delete_link = utf8_encode($delete_link); |
1974 | 1974 | |
1975 | 1975 | if (api_is_drh() && !api_is_platform_admin()) { |
1976 | 1976 | $delete_link = null; |
1977 | 1977 | } |
1978 | - $actions .= $delete_link . ' '; |
|
1978 | + $actions .= $delete_link.' '; |
|
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | } else { |
1982 | 1982 | $attempt_url = api_get_path( |
1983 | 1983 | WEB_CODE_PATH |
1984 | - ) . 'exercice/result.php?' . api_get_cidreq( |
|
1985 | - ) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; |
|
1984 | + ).'exercice/result.php?'.api_get_cidreq( |
|
1985 | + ).'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId; |
|
1986 | 1986 | $attempt_link = Display::url( |
1987 | 1987 | get_lang('Show'), |
1988 | 1988 | $attempt_url, |
@@ -2039,7 +2039,7 @@ discard block |
||
2039 | 2039 | $hp_result = round( |
2040 | 2040 | ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100, |
2041 | 2041 | 2 |
2042 | - ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')'; |
|
2042 | + ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')'; |
|
2043 | 2043 | if ($is_allowedToEdit) { |
2044 | 2044 | $list_info[] = array( |
2045 | 2045 | $hpresults[$i][0], |
@@ -2112,13 +2112,13 @@ discard block |
||
2112 | 2112 | |
2113 | 2113 | $html = null; |
2114 | 2114 | if ($show_percentage) { |
2115 | - $parent = '(' . $score . ' / ' . $weight . ')'; |
|
2116 | - $html = $percentage . "% $parent"; |
|
2115 | + $parent = '('.$score.' / '.$weight.')'; |
|
2116 | + $html = $percentage."% $parent"; |
|
2117 | 2117 | if ($show_only_percentage) { |
2118 | - $html = $percentage . "% "; |
|
2118 | + $html = $percentage."% "; |
|
2119 | 2119 | } |
2120 | 2120 | } else { |
2121 | - $html = $score . ' / ' . $weight; |
|
2121 | + $html = $score.' / '.$weight; |
|
2122 | 2122 | } |
2123 | 2123 | $html = Display::span($html, array('class' => 'score_exercise')); |
2124 | 2124 | |
@@ -2212,7 +2212,7 @@ discard block |
||
2212 | 2212 | { |
2213 | 2213 | $return = '-'; |
2214 | 2214 | if ($value != '') { |
2215 | - $return = float_format($value * 100, 1) . ' %'; |
|
2215 | + $return = float_format($value * 100, 1).' %'; |
|
2216 | 2216 | } |
2217 | 2217 | return $return; |
2218 | 2218 | } |
@@ -2290,7 +2290,7 @@ discard block |
||
2290 | 2290 | } |
2291 | 2291 | |
2292 | 2292 | $needle_where = !empty($search) ? " AND title LIKE '?' " : ''; |
2293 | - $needle = !empty($search) ? "%" . $search . "%" : ''; |
|
2293 | + $needle = !empty($search) ? "%".$search."%" : ''; |
|
2294 | 2294 | |
2295 | 2295 | // Show courses by active status |
2296 | 2296 | $active_sql = ''; |
@@ -2305,7 +2305,7 @@ discard block |
||
2305 | 2305 | if ($search_all_sessions == true) { |
2306 | 2306 | $conditions = array( |
2307 | 2307 | 'where' => array( |
2308 | - $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array( |
|
2308 | + $active_sql.' c_id = ? '.$needle_where.$time_conditions => array( |
|
2309 | 2309 | $course_id, |
2310 | 2310 | $needle |
2311 | 2311 | ) |
@@ -2316,7 +2316,7 @@ discard block |
||
2316 | 2316 | if ($session_id == 0) { |
2317 | 2317 | $conditions = array( |
2318 | 2318 | 'where' => array( |
2319 | - $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
2319 | + $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array( |
|
2320 | 2320 | $session_id, |
2321 | 2321 | $course_id, |
2322 | 2322 | $needle |
@@ -2327,7 +2327,7 @@ discard block |
||
2327 | 2327 | } else { |
2328 | 2328 | $conditions = array( |
2329 | 2329 | 'where' => array( |
2330 | - $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
2330 | + $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array( |
|
2331 | 2331 | $session_id, |
2332 | 2332 | $course_id, |
2333 | 2333 | $needle |
@@ -2506,7 +2506,7 @@ discard block |
||
2506 | 2506 | |
2507 | 2507 | if ($return_string) { |
2508 | 2508 | if (!empty($position) && !empty($my_ranking)) { |
2509 | - $return_value = $position . '/' . count($my_ranking); |
|
2509 | + $return_value = $position.'/'.count($my_ranking); |
|
2510 | 2510 | } else { |
2511 | 2511 | $return_value = '-'; |
2512 | 2512 | } |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | |
2587 | 2587 | if ($return_string) { |
2588 | 2588 | if (!empty($position) && !empty($my_ranking)) { |
2589 | - return $position . '/' . count($my_ranking); |
|
2589 | + return $position.'/'.count($my_ranking); |
|
2590 | 2590 | } |
2591 | 2591 | } |
2592 | 2592 | return $return_value; |
@@ -2986,7 +2986,7 @@ discard block |
||
2986 | 2986 | $courseCondition = " |
2987 | 2987 | INNER JOIN $courseUser cu |
2988 | 2988 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
2989 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
2989 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
2990 | 2990 | } else { |
2991 | 2991 | $courseCondition = " |
2992 | 2992 | INNER JOIN $courseUserSession cu |
@@ -3061,7 +3061,7 @@ discard block |
||
3061 | 3061 | $courseCondition = " |
3062 | 3062 | INNER JOIN $courseUser cu |
3063 | 3063 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
3064 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
3064 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
3065 | 3065 | } else { |
3066 | 3066 | $courseCondition = " |
3067 | 3067 | INNER JOIN $courseUserSession cu |
@@ -3153,7 +3153,7 @@ discard block |
||
3153 | 3153 | $courseCondition = " |
3154 | 3154 | INNER JOIN $courseUser cu |
3155 | 3155 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
3156 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
3156 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
3157 | 3157 | } else { |
3158 | 3158 | $courseCondition = " |
3159 | 3159 | INNER JOIN $courseUserSession cu |
@@ -3335,7 +3335,7 @@ discard block |
||
3335 | 3335 | } |
3336 | 3336 | } |
3337 | 3337 | // adds the correct word, followed by ] to close the blank |
3338 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
3338 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
3339 | 3339 | if (isset ($real_text[$i + 1])) { |
3340 | 3340 | $answer .= $real_text[$i + 1]; |
3341 | 3341 | } |
@@ -3394,13 +3394,13 @@ discard block |
||
3394 | 3394 | // check the default value of option |
3395 | 3395 | $tabSelected = array($in_default => " selected='selected' "); |
3396 | 3396 | $res = ""; |
3397 | - $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >"; |
|
3398 | - $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang( |
|
3397 | + $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >"; |
|
3398 | + $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang( |
|
3399 | 3399 | 'AllGroups' |
3400 | - ) . " --</option>"; |
|
3401 | - $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang( |
|
3400 | + )." --</option>"; |
|
3401 | + $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang( |
|
3402 | 3402 | 'NotInAGroup' |
3403 | - ) . " -</option>"; |
|
3403 | + )." -</option>"; |
|
3404 | 3404 | $tabGroups = GroupManager::get_group_list(); |
3405 | 3405 | $currentCatId = 0; |
3406 | 3406 | for ($i = 0; $i < count($tabGroups); $i++) { |
@@ -3408,10 +3408,10 @@ discard block |
||
3408 | 3408 | $tabGroups[$i]["id"] |
3409 | 3409 | ); |
3410 | 3410 | if ($tabCategory["id"] != $currentCatId) { |
3411 | - $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>"; |
|
3411 | + $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>"; |
|
3412 | 3412 | $currentCatId = $tabCategory["id"]; |
3413 | 3413 | } |
3414 | - $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>"; |
|
3414 | + $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>"; |
|
3415 | 3415 | } |
3416 | 3416 | $res .= "</select>"; |
3417 | 3417 | return $res; |
@@ -3643,14 +3643,14 @@ discard block |
||
3643 | 3643 | if ($show_results) { |
3644 | 3644 | $comnt = Event::get_comments($exe_id, $questionId); |
3645 | 3645 | if (!empty($comnt)) { |
3646 | - echo '<b>' . get_lang('Feedback') . '</b>'; |
|
3647 | - echo '<div id="question_feedback">' . $comnt . '</div>'; |
|
3646 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
3647 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
3648 | 3648 | } |
3649 | 3649 | } |
3650 | 3650 | |
3651 | 3651 | if ($show_results) { |
3652 | 3652 | $score = array( |
3653 | - 'result' => get_lang('Score') . " : " . self::show_score( |
|
3653 | + 'result' => get_lang('Score')." : ".self::show_score( |
|
3654 | 3654 | $my_total_score, |
3655 | 3655 | $my_total_weight, |
3656 | 3656 | false, |
@@ -3724,13 +3724,13 @@ discard block |
||
3724 | 3724 | } |
3725 | 3725 | |
3726 | 3726 | if ($show_all_but_expected_answer) { |
3727 | - $exercise_content .= "<div class='normal-message'>" . get_lang( |
|
3727 | + $exercise_content .= "<div class='normal-message'>".get_lang( |
|
3728 | 3728 | "ExerciseWithFeedbackWithoutCorrectionComment" |
3729 | - ) . "</div>"; |
|
3729 | + )."</div>"; |
|
3730 | 3730 | } |
3731 | 3731 | // Remove audio auto play from questions on results page - refs BT#7939 |
3732 | 3732 | $exercise_content = preg_replace( |
3733 | - ['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'], |
|
3733 | + ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'], |
|
3734 | 3734 | '', |
3735 | 3735 | $exercise_content |
3736 | 3736 | ); |
@@ -3824,11 +3824,11 @@ discard block |
||
3824 | 3824 | $ribbon_total_success_or_error = ' ribbon-total-error'; |
3825 | 3825 | } |
3826 | 3826 | } |
3827 | - $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">'; |
|
3827 | + $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">'; |
|
3828 | 3828 | } else { |
3829 | 3829 | $ribbon .= '<div class="total">'; |
3830 | 3830 | } |
3831 | - $ribbon .= '<h3>' . get_lang('YourTotalScore') . ": "; |
|
3831 | + $ribbon .= '<h3>'.get_lang('YourTotalScore').": "; |
|
3832 | 3832 | $ribbon .= self::show_score($score, $weight, false, true); |
3833 | 3833 | $ribbon .= '</h3>'; |
3834 | 3834 | $ribbon .= '</div>'; |