@@ -95,7 +95,7 @@ |
||
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Get the progress of this learnpath. Only the last attempt are taken into account. |
| 98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
| 98 | + * @param integer $stud_id student id (default: all students who have results - then the average is returned) |
|
| 99 | 99 | * @return array (score, max) if student is given |
| 100 | 100 | * array (sum of scores, number of scores) otherwise |
| 101 | 101 | * or null if no scores available |
@@ -29,8 +29,9 @@ discard block |
||
| 29 | 29 | public function get_not_created_links() |
| 30 | 30 | { |
| 31 | 31 | return false; |
| 32 | - if (empty($this->course_code)) |
|
| 33 | - die('Error in get_not_created_links() : course code not set'); |
|
| 32 | + if (empty($this->course_code)) { |
|
| 33 | + die('Error in get_not_created_links() : course code not set'); |
|
| 34 | + } |
|
| 34 | 35 | |
| 35 | 36 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
| 36 | 37 | |
@@ -57,8 +58,9 @@ discard block |
||
| 57 | 58 | */ |
| 58 | 59 | public function get_all_links() |
| 59 | 60 | { |
| 60 | - if (empty($this->course_code)) |
|
| 61 | - die('Error in get_not_created_links() : course code not set'); |
|
| 61 | + if (empty($this->course_code)) { |
|
| 62 | + die('Error in get_not_created_links() : course code not set'); |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | $session_id = api_get_session_id(); |
| 64 | 66 | if (empty($session_id)) { |
@@ -111,8 +113,9 @@ discard block |
||
| 111 | 113 | lp_id = ".$this->get_ref_id()." AND |
| 112 | 114 | session_id = $session_id "; |
| 113 | 115 | |
| 114 | - if (isset($stud_id)) |
|
| 115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
| 116 | + if (isset($stud_id)) { |
|
| 117 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
| 118 | + } |
|
| 116 | 119 | |
| 117 | 120 | // order by id, that way the student's first attempt is accessed first |
| 118 | 121 | $sql .= ' ORDER BY view_count DESC'; |
@@ -122,8 +125,9 @@ discard block |
||
| 122 | 125 | if (isset($stud_id)) { |
| 123 | 126 | if ($data = Database::fetch_array($scores)) { |
| 124 | 127 | return array ($data['progress'], 100); |
| 125 | - } else |
|
| 126 | - return null; |
|
| 128 | + } else { |
|
| 129 | + return null; |
|
| 130 | + } |
|
| 127 | 131 | } else { |
| 128 | 132 | // all students -> get average |
| 129 | 133 | $students = array(); // user list, needed to make sure we only |
@@ -9,261 +9,261 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class LearnpathLink extends AbstractLink |
| 11 | 11 | { |
| 12 | - private $course_info = null; |
|
| 13 | - private $learnpath_table = null; |
|
| 14 | - private $learnpath_data = null; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * Constructor |
|
| 18 | - */ |
|
| 19 | - public function __construct() |
|
| 20 | - { |
|
| 21 | - parent::__construct(); |
|
| 22 | - $this->set_type(LINK_LEARNPATH); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
| 27 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 28 | - */ |
|
| 29 | - public function get_not_created_links() |
|
| 30 | - { |
|
| 31 | - return false; |
|
| 32 | - if (empty($this->course_code)) |
|
| 33 | - die('Error in get_not_created_links() : course code not set'); |
|
| 34 | - |
|
| 35 | - $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
| 36 | - |
|
| 37 | - $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
| 12 | + private $course_info = null; |
|
| 13 | + private $learnpath_table = null; |
|
| 14 | + private $learnpath_data = null; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * Constructor |
|
| 18 | + */ |
|
| 19 | + public function __construct() |
|
| 20 | + { |
|
| 21 | + parent::__construct(); |
|
| 22 | + $this->set_type(LINK_LEARNPATH); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
| 27 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 28 | + */ |
|
| 29 | + public function get_not_created_links() |
|
| 30 | + { |
|
| 31 | + return false; |
|
| 32 | + if (empty($this->course_code)) |
|
| 33 | + die('Error in get_not_created_links() : course code not set'); |
|
| 34 | + |
|
| 35 | + $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
| 36 | + |
|
| 37 | + $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
| 38 | 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
| 39 | - .' (SELECT ref_id FROM '.$tbl_grade_links |
|
| 40 | - .' WHERE type = '.LINK_LEARNPATH |
|
| 41 | - ." AND course_code = '".$this->get_course_code()."'" |
|
| 42 | - .') AND lp.session_id='.api_get_session_id().''; |
|
| 43 | - |
|
| 44 | - $result = Database::query($sql); |
|
| 45 | - |
|
| 46 | - $cats=array(); |
|
| 47 | - while ($data=Database::fetch_array($result)) { |
|
| 48 | - $cats[] = array ($data['id'], $data['name']); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - return $cats; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Generate an array of all learnpaths available. |
|
| 56 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 57 | - */ |
|
| 58 | - public function get_all_links() |
|
| 59 | - { |
|
| 60 | - if (empty($this->course_code)) |
|
| 61 | - die('Error in get_not_created_links() : course code not set'); |
|
| 62 | - |
|
| 63 | - $session_id = api_get_session_id(); |
|
| 64 | - if (empty($session_id)) { |
|
| 65 | - $session_condition = api_get_session_condition(0, true); |
|
| 66 | - } else { |
|
| 67 | - $session_condition = api_get_session_condition($session_id, true, true); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
| 39 | + .' (SELECT ref_id FROM '.$tbl_grade_links |
|
| 40 | + .' WHERE type = '.LINK_LEARNPATH |
|
| 41 | + ." AND course_code = '".$this->get_course_code()."'" |
|
| 42 | + .') AND lp.session_id='.api_get_session_id().''; |
|
| 43 | + |
|
| 44 | + $result = Database::query($sql); |
|
| 45 | + |
|
| 46 | + $cats=array(); |
|
| 47 | + while ($data=Database::fetch_array($result)) { |
|
| 48 | + $cats[] = array ($data['id'], $data['name']); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + return $cats; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Generate an array of all learnpaths available. |
|
| 56 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 57 | + */ |
|
| 58 | + public function get_all_links() |
|
| 59 | + { |
|
| 60 | + if (empty($this->course_code)) |
|
| 61 | + die('Error in get_not_created_links() : course code not set'); |
|
| 62 | + |
|
| 63 | + $session_id = api_get_session_id(); |
|
| 64 | + if (empty($session_id)) { |
|
| 65 | + $session_condition = api_get_session_condition(0, true); |
|
| 66 | + } else { |
|
| 67 | + $session_condition = api_get_session_condition($session_id, true, true); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
| 71 | 71 | WHERE c_id = '.$this->course_id.' '.$session_condition.' '; |
| 72 | - $result = Database::query($sql); |
|
| 72 | + $result = Database::query($sql); |
|
| 73 | 73 | |
| 74 | - $cats = array(); |
|
| 75 | - while ($data=Database::fetch_array($result)) { |
|
| 76 | - $cats[] = array ($data['id'], $data['name']); |
|
| 77 | - } |
|
| 74 | + $cats = array(); |
|
| 75 | + while ($data=Database::fetch_array($result)) { |
|
| 76 | + $cats[] = array ($data['id'], $data['name']); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - return $cats; |
|
| 80 | - } |
|
| 79 | + return $cats; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Has anyone used this learnpath yet ? |
|
| 85 | - */ |
|
| 86 | - public function has_results() |
|
| 87 | - { |
|
| 88 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 89 | - $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
| 83 | + /** |
|
| 84 | + * Has anyone used this learnpath yet ? |
|
| 85 | + */ |
|
| 86 | + public function has_results() |
|
| 87 | + { |
|
| 88 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 89 | + $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
| 90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
| 91 | - $result = Database::query($sql); |
|
| 92 | - $number = Database::fetch_array($result,'NUM'); |
|
| 93 | - return ($number[0] != 0); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
| 98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
| 99 | - * @return array (score, max) if student is given |
|
| 100 | - * array (sum of scores, number of scores) otherwise |
|
| 101 | - * or null if no scores available |
|
| 102 | - */ |
|
| 103 | - public function calc_score($stud_id = null, $type = null) |
|
| 104 | - { |
|
| 105 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 106 | - $session_id = api_get_session_id(); |
|
| 107 | - |
|
| 108 | - $sql = "SELECT * FROM $tbl_stats |
|
| 91 | + $result = Database::query($sql); |
|
| 92 | + $number = Database::fetch_array($result,'NUM'); |
|
| 93 | + return ($number[0] != 0); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
| 98 | + * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
| 99 | + * @return array (score, max) if student is given |
|
| 100 | + * array (sum of scores, number of scores) otherwise |
|
| 101 | + * or null if no scores available |
|
| 102 | + */ |
|
| 103 | + public function calc_score($stud_id = null, $type = null) |
|
| 104 | + { |
|
| 105 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 106 | + $session_id = api_get_session_id(); |
|
| 107 | + |
|
| 108 | + $sql = "SELECT * FROM $tbl_stats |
|
| 109 | 109 | WHERE |
| 110 | 110 | c_id = ".$this->course_id." AND |
| 111 | 111 | lp_id = ".$this->get_ref_id()." AND |
| 112 | 112 | session_id = $session_id "; |
| 113 | 113 | |
| 114 | - if (isset($stud_id)) |
|
| 115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
| 116 | - |
|
| 117 | - // order by id, that way the student's first attempt is accessed first |
|
| 118 | - $sql .= ' ORDER BY view_count DESC'; |
|
| 119 | - |
|
| 120 | - $scores = Database::query($sql); |
|
| 121 | - // for 1 student |
|
| 122 | - if (isset($stud_id)) { |
|
| 123 | - if ($data = Database::fetch_assoc($scores)) { |
|
| 124 | - return array ($data['progress'], 100); |
|
| 125 | - } else |
|
| 126 | - return null; |
|
| 127 | - } else { |
|
| 128 | - // all students -> get average |
|
| 129 | - $students = array(); // user list, needed to make sure we only |
|
| 130 | - // take first attempts into account |
|
| 131 | - $rescount = 0; |
|
| 132 | - $sum = 0; |
|
| 133 | - $bestResult = 0; |
|
| 134 | - $sumResult = 0; |
|
| 135 | - while ($data = Database::fetch_array($scores)) { |
|
| 136 | - if (!(array_key_exists($data['user_id'], $students))) { |
|
| 137 | - $students[$data['user_id']] = $data['progress']; |
|
| 138 | - $rescount++; |
|
| 139 | - $sum += $data['progress'] / 100; |
|
| 140 | - $sumResult += $data['progress']; |
|
| 141 | - |
|
| 142 | - if ($data['progress'] > $bestResult) { |
|
| 143 | - $bestResult = $data['progress']; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - if ($rescount == 0) { |
|
| 149 | - return null; |
|
| 150 | - } else { |
|
| 151 | - |
|
| 152 | - switch ($type) { |
|
| 153 | - case 'best': |
|
| 154 | - return array($bestResult, 100); |
|
| 155 | - break; |
|
| 156 | - case 'average': |
|
| 157 | - return array($sumResult/$rescount, 100); |
|
| 158 | - break; |
|
| 159 | - case 'ranking': |
|
| 160 | - return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
| 161 | - break; |
|
| 162 | - default: |
|
| 163 | - return array($sum, $rescount); |
|
| 164 | - break; |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Get URL where to go to if the user clicks on the link. |
|
| 172 | - */ |
|
| 173 | - public function get_link() |
|
| 174 | - { |
|
| 175 | - $session_id = api_get_session_id(); |
|
| 176 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
| 177 | - |
|
| 178 | - if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
| 179 | - $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
| 180 | - } else { |
|
| 181 | - $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
| 182 | - } |
|
| 183 | - return $url; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Get name to display: same as learnpath title |
|
| 188 | - */ |
|
| 189 | - public function get_name() |
|
| 190 | - { |
|
| 191 | - $data = $this->get_learnpath_data(); |
|
| 192 | - return $data['name']; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * Get description to display: same as learnpath description |
|
| 197 | - */ |
|
| 198 | - public function get_description() |
|
| 199 | - { |
|
| 200 | - $data = $this->get_learnpath_data(); |
|
| 201 | - return $data['description']; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * Check if this still links to a learnpath |
|
| 206 | - */ |
|
| 207 | - public function is_valid_link() { |
|
| 208 | - $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
| 114 | + if (isset($stud_id)) |
|
| 115 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
| 116 | + |
|
| 117 | + // order by id, that way the student's first attempt is accessed first |
|
| 118 | + $sql .= ' ORDER BY view_count DESC'; |
|
| 119 | + |
|
| 120 | + $scores = Database::query($sql); |
|
| 121 | + // for 1 student |
|
| 122 | + if (isset($stud_id)) { |
|
| 123 | + if ($data = Database::fetch_assoc($scores)) { |
|
| 124 | + return array ($data['progress'], 100); |
|
| 125 | + } else |
|
| 126 | + return null; |
|
| 127 | + } else { |
|
| 128 | + // all students -> get average |
|
| 129 | + $students = array(); // user list, needed to make sure we only |
|
| 130 | + // take first attempts into account |
|
| 131 | + $rescount = 0; |
|
| 132 | + $sum = 0; |
|
| 133 | + $bestResult = 0; |
|
| 134 | + $sumResult = 0; |
|
| 135 | + while ($data = Database::fetch_array($scores)) { |
|
| 136 | + if (!(array_key_exists($data['user_id'], $students))) { |
|
| 137 | + $students[$data['user_id']] = $data['progress']; |
|
| 138 | + $rescount++; |
|
| 139 | + $sum += $data['progress'] / 100; |
|
| 140 | + $sumResult += $data['progress']; |
|
| 141 | + |
|
| 142 | + if ($data['progress'] > $bestResult) { |
|
| 143 | + $bestResult = $data['progress']; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + if ($rescount == 0) { |
|
| 149 | + return null; |
|
| 150 | + } else { |
|
| 151 | + |
|
| 152 | + switch ($type) { |
|
| 153 | + case 'best': |
|
| 154 | + return array($bestResult, 100); |
|
| 155 | + break; |
|
| 156 | + case 'average': |
|
| 157 | + return array($sumResult/$rescount, 100); |
|
| 158 | + break; |
|
| 159 | + case 'ranking': |
|
| 160 | + return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
| 161 | + break; |
|
| 162 | + default: |
|
| 163 | + return array($sum, $rescount); |
|
| 164 | + break; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Get URL where to go to if the user clicks on the link. |
|
| 172 | + */ |
|
| 173 | + public function get_link() |
|
| 174 | + { |
|
| 175 | + $session_id = api_get_session_id(); |
|
| 176 | + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
| 177 | + |
|
| 178 | + if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
| 179 | + $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
| 180 | + } else { |
|
| 181 | + $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
| 182 | + } |
|
| 183 | + return $url; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Get name to display: same as learnpath title |
|
| 188 | + */ |
|
| 189 | + public function get_name() |
|
| 190 | + { |
|
| 191 | + $data = $this->get_learnpath_data(); |
|
| 192 | + return $data['name']; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * Get description to display: same as learnpath description |
|
| 197 | + */ |
|
| 198 | + public function get_description() |
|
| 199 | + { |
|
| 200 | + $data = $this->get_learnpath_data(); |
|
| 201 | + return $data['description']; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * Check if this still links to a learnpath |
|
| 206 | + */ |
|
| 207 | + public function is_valid_link() { |
|
| 208 | + $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
| 209 | 209 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
| 210 | - $result = Database::query($sql); |
|
| 211 | - $number = Database::fetch_row($result,'NUM'); |
|
| 212 | - return ($number[0] != 0); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - public function get_type_name() |
|
| 216 | - { |
|
| 217 | - return get_lang('LearningPaths'); |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - public function needs_name_and_description() |
|
| 221 | - { |
|
| 222 | - return false; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - public function needs_max() |
|
| 226 | - { |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - public function needs_results() |
|
| 231 | - { |
|
| 232 | - return false; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - public function is_allowed_to_change_name() |
|
| 236 | - { |
|
| 237 | - return false; |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - // INTERNAL FUNCTIONS |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * Lazy load function to get the database table of the learnpath |
|
| 244 | - */ |
|
| 245 | - private function get_learnpath_table() |
|
| 246 | - { |
|
| 247 | - $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
| 248 | - return $this->learnpath_table; |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * Lazy load function to get the database contents of this learnpath |
|
| 253 | - */ |
|
| 254 | - private function get_learnpath_data() |
|
| 255 | - { |
|
| 256 | - if (!isset($this->learnpath_data)) { |
|
| 257 | - $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
| 210 | + $result = Database::query($sql); |
|
| 211 | + $number = Database::fetch_row($result,'NUM'); |
|
| 212 | + return ($number[0] != 0); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + public function get_type_name() |
|
| 216 | + { |
|
| 217 | + return get_lang('LearningPaths'); |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + public function needs_name_and_description() |
|
| 221 | + { |
|
| 222 | + return false; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + public function needs_max() |
|
| 226 | + { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + public function needs_results() |
|
| 231 | + { |
|
| 232 | + return false; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + public function is_allowed_to_change_name() |
|
| 236 | + { |
|
| 237 | + return false; |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + // INTERNAL FUNCTIONS |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * Lazy load function to get the database table of the learnpath |
|
| 244 | + */ |
|
| 245 | + private function get_learnpath_table() |
|
| 246 | + { |
|
| 247 | + $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
| 248 | + return $this->learnpath_table; |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * Lazy load function to get the database contents of this learnpath |
|
| 253 | + */ |
|
| 254 | + private function get_learnpath_data() |
|
| 255 | + { |
|
| 256 | + if (!isset($this->learnpath_data)) { |
|
| 257 | + $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
| 258 | 258 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
| 259 | - $result = Database::query($sql); |
|
| 260 | - $this->learnpath_data = Database::fetch_array($result); |
|
| 261 | - } |
|
| 262 | - return $this->learnpath_data; |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - public function get_icon_name() |
|
| 266 | - { |
|
| 267 | - return 'learnpath'; |
|
| 268 | - } |
|
| 259 | + $result = Database::query($sql); |
|
| 260 | + $this->learnpath_data = Database::fetch_array($result); |
|
| 261 | + } |
|
| 262 | + return $this->learnpath_data; |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + public function get_icon_name() |
|
| 266 | + { |
|
| 267 | + return 'learnpath'; |
|
| 268 | + } |
|
| 269 | 269 | } |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $result = Database::query($sql); |
| 45 | 45 | |
| 46 | - $cats=array(); |
|
| 47 | - while ($data=Database::fetch_array($result)) { |
|
| 48 | - $cats[] = array ($data['id'], $data['name']); |
|
| 46 | + $cats = array(); |
|
| 47 | + while ($data = Database::fetch_array($result)) { |
|
| 48 | + $cats[] = array($data['id'], $data['name']); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | return $cats; |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | $result = Database::query($sql); |
| 73 | 73 | |
| 74 | 74 | $cats = array(); |
| 75 | - while ($data=Database::fetch_array($result)) { |
|
| 76 | - $cats[] = array ($data['id'], $data['name']); |
|
| 75 | + while ($data = Database::fetch_array($result)) { |
|
| 76 | + $cats[] = array($data['id'], $data['name']); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return $cats; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $sql = "SELECT count(id) AS number FROM $tbl_stats |
| 90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
| 91 | 91 | $result = Database::query($sql); |
| 92 | - $number = Database::fetch_array($result,'NUM'); |
|
| 92 | + $number = Database::fetch_array($result, 'NUM'); |
|
| 93 | 93 | return ($number[0] != 0); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | // for 1 student |
| 122 | 122 | if (isset($stud_id)) { |
| 123 | 123 | if ($data = Database::fetch_assoc($scores)) { |
| 124 | - return array ($data['progress'], 100); |
|
| 124 | + return array($data['progress'], 100); |
|
| 125 | 125 | } else |
| 126 | 126 | return null; |
| 127 | 127 | } else { |
| 128 | 128 | // all students -> get average |
| 129 | - $students = array(); // user list, needed to make sure we only |
|
| 129 | + $students = array(); // user list, needed to make sure we only |
|
| 130 | 130 | // take first attempts into account |
| 131 | 131 | $rescount = 0; |
| 132 | 132 | $sum = 0; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | return array($bestResult, 100); |
| 155 | 155 | break; |
| 156 | 156 | case 'average': |
| 157 | - return array($sumResult/$rescount, 100); |
|
| 157 | + return array($sumResult / $rescount, 100); |
|
| 158 | 158 | break; |
| 159 | 159 | case 'ranking': |
| 160 | 160 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | public function get_link() |
| 174 | 174 | { |
| 175 | 175 | $session_id = api_get_session_id(); |
| 176 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
| 176 | + $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
| 177 | 177 | |
| 178 | 178 | if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
| 179 | 179 | $url .= '&action=view&lp_id='.$this->get_ref_id(); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
| 209 | 209 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
| 210 | 210 | $result = Database::query($sql); |
| 211 | - $number = Database::fetch_row($result,'NUM'); |
|
| 211 | + $number = Database::fetch_row($result, 'NUM'); |
|
| 212 | 212 | return ($number[0] != 0); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -32,6 +32,8 @@ discard block |
||
| 32 | 32 | * @param array $evals |
| 33 | 33 | * @param array $links |
| 34 | 34 | * @param null $addparams |
| 35 | + * @param boolean $showTeacherView |
|
| 36 | + * @param integer $userId |
|
| 35 | 37 | */ |
| 36 | 38 | public function __construct( |
| 37 | 39 | $currentcat, |
@@ -895,7 +897,7 @@ discard block |
||
| 895 | 897 | |
| 896 | 898 | /** |
| 897 | 899 | * @param $item |
| 898 | - * @return mixed |
|
| 900 | + * @return string|null |
|
| 899 | 901 | */ |
| 900 | 902 | private function build_course_code($item) |
| 901 | 903 | { |
@@ -256,10 +256,11 @@ |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // Categories. |
| 259 | - if (!empty($data_array)) |
|
| 260 | - foreach ($data_array as $data) { |
|
| 259 | + if (!empty($data_array)) { |
|
| 260 | + foreach ($data_array as $data) { |
|
| 261 | 261 | // list of items inside the gradebook (exercises, lps, forums, etc) |
| 262 | 262 | $row = array(); |
| 263 | + } |
|
| 263 | 264 | /** @var AbstractLink $item */ |
| 264 | 265 | $item = $mainCategory = $data[0]; |
| 265 | 266 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->set_additional_parameters($addparams); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $column= 0; |
|
| 74 | + $column = 0; |
|
| 75 | 75 | if ($this->teacherView) { |
| 76 | 76 | if ($this->exportToPdf == false) { |
| 77 | 77 | $this->set_header($column++, '', '', 'width="25px"'); |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | $main_categories[$item->get_id()]['name'] = $item->get_name(); |
| 282 | 282 | } else { |
| 283 | 283 | $name = $this->build_name_link($item, $type); |
| 284 | - $row[] = $invisibility_span_open.$name. $invisibility_span_close; |
|
| 284 | + $row[] = $invisibility_span_open.$name.$invisibility_span_close; |
|
| 285 | 285 | $main_categories[$item->get_id()]['name'] = $name; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $this->dataForGraph['categories'][] = $item->get_name(); |
| 289 | 289 | |
| 290 | - $main_categories[$item->get_id()]['weight']= $item->get_weight(); |
|
| 290 | + $main_categories[$item->get_id()]['weight'] = $item->get_weight(); |
|
| 291 | 291 | $total_categories_weight += $item->get_weight(); |
| 292 | 292 | |
| 293 | 293 | // Description. |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | 309 | if ($this->teacherView) { |
| 310 | - $row[] = $invisibility_span_open .Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
| 310 | + $row[] = $invisibility_span_open.Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
| 311 | 311 | } else { |
| 312 | - $row[] = $invisibility_span_open .$weight.$invisibility_span_close; |
|
| 312 | + $row[] = $invisibility_span_open.$weight.$invisibility_span_close; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $category_weight = $item->get_weight(); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | if (!empty($score[1])) { |
| 337 | 337 | $completeScore = $scoredisplay->display_score($score, SCORE_DIV_PERCENT); |
| 338 | - $score = $score[0]/$score[1]*$item->get_weight(); |
|
| 338 | + $score = $score[0] / $score[1] * $item->get_weight(); |
|
| 339 | 339 | $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE); |
| 340 | 340 | $scoreToDisplay = Display::tip($score, $completeScore); |
| 341 | 341 | } else { |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $totalResultAverageValue = strip_tags($scoredisplay->display_score($totalResult, SCORE_AVERAGE)); |
| 372 | 372 | $this->dataForGraph['my_result'][] = str_replace('%', '', $totalResultAverageValue); |
| 373 | 373 | $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE)); |
| 374 | - $this->dataForGraph['average'][] = str_replace('%', '', $totalAverageValue); |
|
| 374 | + $this->dataForGraph['average'][] = str_replace('%', '', $totalAverageValue); |
|
| 375 | 375 | // Ranking |
| 376 | 376 | $row[] = $ranking; |
| 377 | 377 | // Best |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px')); |
| 454 | 454 | |
| 455 | 455 | // Name. |
| 456 | - $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type) . $invisibility_span_close; |
|
| 456 | + $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type).$invisibility_span_close; |
|
| 457 | 457 | |
| 458 | 458 | // Description. |
| 459 | 459 | if ($this->exportToPdf == false) { |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | // Students get the results and certificates columns |
| 492 | 492 | $eval_n_links = array_merge($alleval, $alllink); |
| 493 | 493 | |
| 494 | - if (count($eval_n_links)> 0) { |
|
| 494 | + if (count($eval_n_links) > 0) { |
|
| 495 | 495 | $value_data = isset($data[4]) ? $data[4] : null; |
| 496 | 496 | |
| 497 | 497 | if (!is_null($value_data)) { |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | $row = array( |
| 590 | 590 | null, |
| 591 | 591 | null, |
| 592 | - '<strong>' . get_lang('Total') . '</strong>', |
|
| 592 | + '<strong>'.get_lang('Total').'</strong>', |
|
| 593 | 593 | null, |
| 594 | 594 | $total |
| 595 | 595 | ); |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | if ($this->exportToPdf) { |
| 660 | 660 | $row = array( |
| 661 | 661 | null, |
| 662 | - '<h3>' . get_lang('Total') . '</h3>', |
|
| 662 | + '<h3>'.get_lang('Total').'</h3>', |
|
| 663 | 663 | $main_weight, |
| 664 | 664 | $totalResult, |
| 665 | 665 | $totalRanking, |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | } else { |
| 670 | 670 | $row = array( |
| 671 | 671 | null, |
| 672 | - '<h3>' . get_lang('Total') . '</h3>', |
|
| 672 | + '<h3>'.get_lang('Total').'</h3>', |
|
| 673 | 673 | null, |
| 674 | 674 | $main_weight, |
| 675 | 675 | $totalResult, |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | // Warning messages |
| 687 | - $view = isset($_GET['view']) ? $_GET['view']: null; |
|
| 687 | + $view = isset($_GET['view']) ? $_GET['view'] : null; |
|
| 688 | 688 | |
| 689 | 689 | if ($this->teacherView) { |
| 690 | 690 | if (isset($_GET['selectcat']) && |
@@ -695,14 +695,14 @@ discard block |
||
| 695 | 695 | $category = Category::load($id_cat); |
| 696 | 696 | $weight_category = intval($this->build_weight($category[0])); |
| 697 | 697 | $course_code = $this->build_course_code($category[0]); |
| 698 | - $weight_total_links = round($weight_total_links); |
|
| 698 | + $weight_total_links = round($weight_total_links); |
|
| 699 | 699 | |
| 700 | 700 | if ($weight_total_links > $weight_category || |
| 701 | 701 | $weight_total_links < $weight_category || |
| 702 | 702 | $weight_total_links > $weight_category |
| 703 | 703 | ) { |
| 704 | 704 | $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category); |
| 705 | - $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
| 705 | + $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
| 706 | 706 | Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>'; |
| 707 | 707 | $warning_message .= $modify_icons; |
| 708 | 708 | Display::display_warning_message($warning_message, false); |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | if (empty($certificate_min_score) || |
| 758 | 758 | ($certificate_min_score > $weight_category) |
| 759 | 759 | ) { |
| 760 | - $warning_message .= $course_code .' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
| 760 | + $warning_message .= $course_code.' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
| 761 | 761 | } |
| 762 | 762 | } |
| 763 | 763 | |
@@ -806,12 +806,12 @@ discard block |
||
| 806 | 806 | $pChart->Antialias = false; |
| 807 | 807 | |
| 808 | 808 | /* Add a border to the picture */ |
| 809 | - $pChart->drawRectangle(0,0,$xSize-10,$ySize-10,array("R"=>0,"G"=>0,"B"=>0)); |
|
| 810 | - $pChart->drawText(10,16,get_lang('Results'),array("FontSize"=>11,"Align"=> TEXT_ALIGN_BOTTOMMIDDLE)); |
|
| 811 | - $pChart->setGraphArea(50, 30, $xSize-50, $ySize-50); |
|
| 809 | + $pChart->drawRectangle(0, 0, $xSize - 10, $ySize - 10, array("R"=>0, "G"=>0, "B"=>0)); |
|
| 810 | + $pChart->drawText(10, 16, get_lang('Results'), array("FontSize"=>11, "Align"=> TEXT_ALIGN_BOTTOMMIDDLE)); |
|
| 811 | + $pChart->setGraphArea(50, 30, $xSize - 50, $ySize - 50); |
|
| 812 | 812 | $pChart->setFontProperties( |
| 813 | 813 | array( |
| 814 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
| 814 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
| 815 | 815 | 'FontSize' => 10, |
| 816 | 816 | ) |
| 817 | 817 | ); |
@@ -859,13 +859,13 @@ discard block |
||
| 859 | 859 | $chartHash = $myCache->getHash($dataSet); |
| 860 | 860 | |
| 861 | 861 | $myCache->writeToCache($chartHash, $pChart); |
| 862 | - $imgSysPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
| 862 | + $imgSysPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
| 863 | 863 | $myCache->saveFromCache($chartHash, $imgSysPath); |
| 864 | - $imgWebPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
| 864 | + $imgWebPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
| 865 | 865 | |
| 866 | 866 | if (file_exists($imgSysPath)) { |
| 867 | 867 | $result = '<div id="contentArea" style="text-align: center;" >'; |
| 868 | - $result .= '<img src="' . $imgWebPath.'" >'; |
|
| 868 | + $result .= '<img src="'.$imgWebPath.'" >'; |
|
| 869 | 869 | $result .= '</div>'; |
| 870 | 870 | return $result; |
| 871 | 871 | } |
@@ -910,13 +910,13 @@ discard block |
||
| 910 | 910 | switch ($item->get_item_type()) { |
| 911 | 911 | // category |
| 912 | 912 | case 'C': |
| 913 | - return 'CATE' . $item->get_id(); |
|
| 913 | + return 'CATE'.$item->get_id(); |
|
| 914 | 914 | // evaluation |
| 915 | 915 | case 'E': |
| 916 | - return 'EVAL' . $item->get_id(); |
|
| 916 | + return 'EVAL'.$item->get_id(); |
|
| 917 | 917 | // link |
| 918 | 918 | case 'L': |
| 919 | - return 'LINK' . $item->get_id(); |
|
| 919 | + return 'LINK'.$item->get_id(); |
|
| 920 | 920 | } |
| 921 | 921 | } |
| 922 | 922 | |
@@ -944,11 +944,11 @@ discard block |
||
| 944 | 944 | switch ($item->get_item_type()) { |
| 945 | 945 | // category |
| 946 | 946 | case 'C': |
| 947 | - $prms_uri='?selectcat=' . $item->get_id() . '&view='.$view; |
|
| 947 | + $prms_uri = '?selectcat='.$item->get_id().'&view='.$view; |
|
| 948 | 948 | |
| 949 | 949 | if (isset($_GET['isStudentView'])) { |
| 950 | - if ( isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) { |
|
| 951 | - $prms_uri=$prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
| 950 | + if (isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview')) { |
|
| 951 | + $prms_uri = $prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | return ' <a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">' |
| 958 | 958 | . $item->get_name() |
| 959 | 959 | . '</a>' |
| 960 | - . ($item->is_course() ? ' [' . $item->get_course_code() . ']'.$show_message : ''); |
|
| 960 | + . ($item->is_course() ? ' ['.$item->get_course_code().']'.$show_message : ''); |
|
| 961 | 961 | // evaluation |
| 962 | 962 | case 'E': |
| 963 | 963 | $cat = new Category(); |
@@ -965,10 +965,10 @@ discard block |
||
| 965 | 965 | $show_message = $cat->show_message_resource_delete($course_id); |
| 966 | 966 | |
| 967 | 967 | // course/platform admin can go to the view_results page |
| 968 | - if (api_is_allowed_to_edit() && $show_message===false) { |
|
| 968 | + if (api_is_allowed_to_edit() && $show_message === false) { |
|
| 969 | 969 | if ($item->get_type() == 'presence') { |
| 970 | 970 | return ' ' |
| 971 | - . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">' |
|
| 971 | + . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval='.$item->get_id().'">' |
|
| 972 | 972 | . $item->get_name() |
| 973 | 973 | . '</a>'; |
| 974 | 974 | } else { |
@@ -977,20 +977,20 @@ discard block |
||
| 977 | 977 | $extra = ''; |
| 978 | 978 | } |
| 979 | 979 | return ' ' |
| 980 | - . '<a href="gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
| 980 | + . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
| 981 | 981 | . $item->get_name() |
| 982 | 982 | . '</a> '.$extra; |
| 983 | 983 | } |
| 984 | - } elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) { |
|
| 984 | + } elseif (ScoreDisplay :: instance()->is_custom() && $show_message === false) { |
|
| 985 | 985 | // students can go to the statistics page (if custom display enabled) |
| 986 | 986 | return ' ' |
| 987 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
| 987 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
| 988 | 988 | . $item->get_name() |
| 989 | 989 | . '</a>'; |
| 990 | 990 | |
| 991 | 991 | } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay :: instance()->is_custom()) { |
| 992 | 992 | return ' ' |
| 993 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
| 993 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
| 994 | 994 | . $item->get_name() |
| 995 | 995 | . '</a>'; |
| 996 | 996 | } else { |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | $url = $item->get_link(); |
| 1006 | 1006 | |
| 1007 | 1007 | if (isset($url) && $show_message === false) { |
| 1008 | - $text = ' <a href="' . $item->get_link() . '">' |
|
| 1008 | + $text = ' <a href="'.$item->get_link().'">' |
|
| 1009 | 1009 | . $item->get_name() |
| 1010 | 1010 | . '</a>'; |
| 1011 | 1011 | } else { |
@@ -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 | /** |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | $html .= '<li>'; |
| 43 | 43 | } |
| 44 | 44 | $params['section'] = $section; |
| 45 | - $html .='<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
| 45 | + $html .= '<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $html .= '</ul><div class="tab-pane">'; |
| 49 | 49 | |
| 50 | - $data = call_user_func(array($this, 'get_' . $currentSection . '_data')); |
|
| 50 | + $data = call_user_func(array($this, 'get_'.$currentSection.'_data')); |
|
| 51 | 51 | echo $html; |
| 52 | 52 | |
| 53 | 53 | if ($currentSection != 'paths') { |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $array = array(); |
| 116 | 116 | $writable_folders = array( |
| 117 | - api_get_path(SYS_APP_PATH) .'cache', |
|
| 117 | + api_get_path(SYS_APP_PATH).'cache', |
|
| 118 | 118 | api_get_path(SYS_COURSE_PATH), |
| 119 | - api_get_path(SYS_APP_PATH) .'home', |
|
| 120 | - api_get_path(SYS_APP_PATH) .'upload/users/', |
|
| 121 | - api_get_path(SYS_PATH) .'main/default_course_document/images/', |
|
| 119 | + api_get_path(SYS_APP_PATH).'home', |
|
| 120 | + api_get_path(SYS_APP_PATH).'upload/users/', |
|
| 121 | + api_get_path(SYS_PATH).'main/default_course_document/images/', |
|
| 122 | 122 | ); |
| 123 | 123 | foreach ($writable_folders as $index => $folder) { |
| 124 | 124 | $writable = is_writable($folder); |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | $exists = file_exists(api_get_path(SYS_CODE_PATH).'install'); |
| 139 | 139 | $status = $exists ? self :: STATUS_WARNING : self :: STATUS_OK; |
| 140 | - $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists') . ': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved')); |
|
| 140 | + $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists').': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved')); |
|
| 141 | 141 | |
| 142 | 142 | $app_version = api_get_setting('chamilo_database_version'); |
| 143 | - $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version'); |
|
| 143 | + $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version'); |
|
| 144 | 144 | |
| 145 | 145 | $access_url_id = api_get_current_access_url_id(); |
| 146 | 146 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $message2 .= get_lang('SpaceUsedOnSystemCannotBeMeasuredOnWindows'); |
| 153 | 153 | } else { |
| 154 | 154 | $dir = api_get_path(SYS_PATH); |
| 155 | - $du = exec('du -sh ' . $dir, $err); |
|
| 155 | + $du = exec('du -sh '.$dir, $err); |
|
| 156 | 156 | list($size, $none) = explode("\t", $du); |
| 157 | 157 | $limit = $_configuration[$access_url_id]['hosting_limit_disk_space']; |
| 158 | 158 | $message2 .= sprintf(get_lang('TotalSpaceUsedByPortalXLimitIsYMB'), $size, $limit); |
@@ -236,33 +236,33 @@ discard block |
||
| 236 | 236 | $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')); |
| 237 | 237 | |
| 238 | 238 | $setting = ini_get('max_execution_time'); |
| 239 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
| 239 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
| 240 | 240 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 241 | 241 | $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')); |
| 242 | 242 | |
| 243 | 243 | $setting = ini_get('max_input_time'); |
| 244 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
| 244 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
| 245 | 245 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 246 | 246 | $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')); |
| 247 | 247 | |
| 248 | 248 | $setting = ini_get('memory_limit'); |
| 249 | 249 | $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M'; |
| 250 | 250 | $status = self :: STATUS_ERROR; |
| 251 | - if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
| 251 | + if ((float) $setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
| 252 | 252 | $status = self :: STATUS_OK; |
| 253 | 253 | $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')); |
| 254 | 254 | |
| 255 | 255 | $setting = ini_get('post_max_size'); |
| 256 | 256 | $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M'; |
| 257 | 257 | $status = self :: STATUS_ERROR; |
| 258 | - if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
| 258 | + if ((float) $setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
| 259 | 259 | $status = self :: STATUS_OK; |
| 260 | 260 | $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')); |
| 261 | 261 | |
| 262 | 262 | $setting = ini_get('upload_max_filesize'); |
| 263 | 263 | $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M'; |
| 264 | 264 | $status = self :: STATUS_ERROR; |
| 265 | - if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
| 265 | + if ((float) $setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
| 266 | 266 | $status = self :: STATUS_OK; |
| 267 | 267 | $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')); |
| 268 | 268 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 277 | 277 | $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')); |
| 278 | 278 | |
| 279 | - if (api_check_browscap()){$setting = true;}else{$setting=false;} |
|
| 279 | + if (api_check_browscap()) {$setting = true; } else {$setting = false; } |
|
| 280 | 280 | $req_setting = true; |
| 281 | 281 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 282 | 282 | $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')); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $loaded = extension_loaded($extension); |
| 334 | 334 | $status = $loaded ? self :: STATUS_OK : self :: STATUS_ERROR; |
| 335 | - $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension') . ': ' . $extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
| 335 | + $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension').': '.$extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | return $array; |
@@ -455,9 +455,9 @@ discard block |
||
| 455 | 455 | $formatted_expected_value = $expected_value; |
| 456 | 456 | |
| 457 | 457 | if ($formatter) { |
| 458 | - if (method_exists($this, 'format_' . $formatter)) { |
|
| 459 | - $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value); |
|
| 460 | - $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value); |
|
| 458 | + if (method_exists($this, 'format_'.$formatter)) { |
|
| 459 | + $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value); |
|
| 460 | + $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value); |
|
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | |
@@ -472,13 +472,13 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | public function get_link($title, $url) |
| 474 | 474 | { |
| 475 | - return '<a href="' . $url . '" target="about:bank">' . $title . '</a>'; |
|
| 475 | + return '<a href="'.$url.'" target="about:bank">'.$title.'</a>'; |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | public function format_yes_no_optional($value) |
| 479 | 479 | { |
| 480 | 480 | $return = ''; |
| 481 | - switch($value) { |
|
| 481 | + switch ($value) { |
|
| 482 | 482 | case 0: |
| 483 | 483 | $return = get_lang('No'); |
| 484 | 484 | break; |
@@ -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 | { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | if ($show_title) { |
| 67 | 67 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
| 68 | 68 | echo Display::div( |
| 69 | - $current_item . '. ' . $objQuestionTmp->selectTitle(), |
|
| 69 | + $current_item.'. '.$objQuestionTmp->selectTitle(), |
|
| 70 | 70 | array('class' => 'question_title') |
| 71 | 71 | ); |
| 72 | 72 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | <div class="clearfix"> |
| 111 | 111 | <ul class="exercise-draggable-answer ui-helper-reset ui-helper-clearfix list-inline">'; |
| 112 | 112 | } else { |
| 113 | - $s .= '<div id="drag' . $questionId . '_question" class="drag_question"> |
|
| 113 | + $s .= '<div id="drag'.$questionId.'_question" class="drag_question"> |
|
| 114 | 114 | <table class="data_table">'; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | } elseif ($answerType == FREE_ANSWER) { |
| 158 | 158 | $fck_content = isset($user_choice[0]) && !empty($user_choice[0]['answer']) ? $user_choice[0]['answer'] : null; |
| 159 | 159 | |
| 160 | - $form = new FormValidator('free_choice_' . $questionId); |
|
| 160 | + $form = new FormValidator('free_choice_'.$questionId); |
|
| 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 |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | echo $objQuestionTmp->returnRecorder(); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $form = new FormValidator('free_choice_' . $questionId); |
|
| 192 | + $form = new FormValidator('free_choice_'.$questionId); |
|
| 193 | 193 | $config = array( |
| 194 | 194 | 'ToolbarSet' => 'TestFreeAnswer' |
| 195 | 195 | ); |
| 196 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
| 196 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
| 197 | 197 | //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
| 198 | 198 | $s .= $form->returnForm(); |
| 199 | 199 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | case UNIQUE_ANSWER_NO_OPTION: |
| 279 | 279 | //no break |
| 280 | 280 | case UNIQUE_ANSWER_IMAGE: |
| 281 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 281 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 282 | 282 | |
| 283 | 283 | if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) { |
| 284 | 284 | $attributes = array( |
@@ -304,14 +304,14 @@ discard block |
||
| 304 | 304 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
| 305 | 305 | if ($show_comment) { |
| 306 | 306 | if (empty($comment)) { |
| 307 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 307 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 308 | 308 | . 'class="exercise-unique-answer-image" style="text-align: center">'; |
| 309 | 309 | } else { |
| 310 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 310 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 311 | 311 | . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">'; |
| 312 | 312 | } |
| 313 | 313 | } else { |
| 314 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 314 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 315 | 315 | . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">'; |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $s .= Display::input( |
| 322 | 322 | 'hidden', |
| 323 | - 'choice2[' . $questionId . ']', |
|
| 323 | + 'choice2['.$questionId.']', |
|
| 324 | 324 | '0' |
| 325 | 325 | ); |
| 326 | 326 | |
@@ -328,13 +328,13 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
| 330 | 330 | $attributes['style'] = 'display: none;'; |
| 331 | - $answer = '<div class="thumbnail">' . $answer . '</div>'; |
|
| 331 | + $answer = '<div class="thumbnail">'.$answer.'</div>'; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | $answer_input .= '<label class="radio">'; |
| 335 | 335 | $answer_input .= Display::input( |
| 336 | 336 | 'radio', |
| 337 | - 'choice[' . $questionId . ']', |
|
| 337 | + 'choice['.$questionId.']', |
|
| 338 | 338 | $numAnswer, |
| 339 | 339 | $attributes |
| 340 | 340 | ); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | case MULTIPLE_ANSWER_TRUE_FALSE: |
| 362 | 362 | //no break |
| 363 | 363 | case GLOBAL_MULTIPLE_ANSWER: |
| 364 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 364 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 365 | 365 | $answer = Security::remove_XSS($answer, STUDENT); |
| 366 | 366 | |
| 367 | 367 | if (in_array($numAnswer, $user_choice_array)) { |
@@ -382,12 +382,12 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
| 385 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 385 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 386 | 386 | |
| 387 | 387 | $answer_input = '<label class="checkbox">'; |
| 388 | 388 | $answer_input .= Display::input( |
| 389 | 389 | 'checkbox', |
| 390 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 390 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 391 | 391 | $numAnswer, |
| 392 | 392 | $attributes |
| 393 | 393 | ); |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | 'td', |
| 441 | 441 | Display::input( |
| 442 | 442 | 'radio', |
| 443 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 443 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 444 | 444 | $id, |
| 445 | 445 | $attributes |
| 446 | 446 | ), |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | break; |
| 460 | 460 | case MULTIPLE_ANSWER_COMBINATION: |
| 461 | 461 | // multiple answers |
| 462 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 462 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 463 | 463 | |
| 464 | 464 | if (in_array($numAnswer, $user_choice_array)) { |
| 465 | 465 | $attributes = array( |
@@ -479,11 +479,11 @@ discard block |
||
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | $answer = Security::remove_XSS($answer, STUDENT); |
| 482 | - $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 482 | + $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 483 | 483 | $answer_input .= '<label class="checkbox">'; |
| 484 | 484 | $answer_input .= Display::input( |
| 485 | 485 | 'checkbox', |
| 486 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 486 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 487 | 487 | 1, |
| 488 | 488 | $attributes |
| 489 | 489 | ); |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | } |
| 505 | 505 | break; |
| 506 | 506 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
| 507 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 507 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 508 | 508 | |
| 509 | 509 | $my_choice = array(); |
| 510 | 510 | if (!empty($user_choice_array)) { |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | 'td', |
| 540 | 540 | Display::input( |
| 541 | 541 | 'radio', |
| 542 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 542 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 543 | 543 | $key, |
| 544 | 544 | $attributes |
| 545 | 545 | ) |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | // may be "" if student viewed the question, but did not fill the blanks |
| 597 | 597 | $correctItem = $studentAnswerList[$i]; |
| 598 | 598 | } |
| 599 | - $attributes["style"] = "width:" . $listAnswerInformations["tabinputsize"][$i] . "px"; |
|
| 599 | + $attributes["style"] = "width:".$listAnswerInformations["tabinputsize"][$i]."px"; |
|
| 600 | 600 | $answer .= FillBlanks::getFillTheBlankHtml($separatorStartRegexp, $separatorEndRegexp, $correctItemRegexp, $questionId, $correctItem, $attributes, $answer, $listAnswerInformations, $displayForStudent, $i); |
| 601 | 601 | } |
| 602 | 602 | // display the last common word |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | // display the common words |
| 611 | 611 | $answer .= $listAnswerInformations["commonwords"][$i]; |
| 612 | 612 | // display the blank word |
| 613 | - $attributes["style"] = "width:" . $listAnswerInformations["tabinputsize"][$i] . "px"; |
|
| 613 | + $attributes["style"] = "width:".$listAnswerInformations["tabinputsize"][$i]."px"; |
|
| 614 | 614 | $correctItem = $listAnswerInformations["tabwords"][$i]; |
| 615 | 615 | $correctItemRegexp = $correctItem; |
| 616 | 616 | // replace / with \/ to allow the preg_replace bellow and all the regexp char |
@@ -634,8 +634,8 @@ discard block |
||
| 634 | 634 | if ($origin !== null) { |
| 635 | 635 | global $exe_id; |
| 636 | 636 | $trackAttempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
| 637 | - $sql = 'SELECT answer FROM ' . $trackAttempts . ' |
|
| 638 | - WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId; |
|
| 637 | + $sql = 'SELECT answer FROM '.$trackAttempts.' |
|
| 638 | + WHERE exe_id=' . $exe_id.' AND question_id='.$questionId; |
|
| 639 | 639 | $rsLastAttempt = Database::query($sql); |
| 640 | 640 | $rowLastAttempt = Database::fetch_array($rsLastAttempt); |
| 641 | 641 | $answer = $rowLastAttempt['answer']; |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | '', |
| 693 | 693 | $answerCorrected |
| 694 | 694 | ); |
| 695 | - $answerCorrected = '[' . $answerCorrected . ']'; |
|
| 695 | + $answerCorrected = '['.$answerCorrected.']'; |
|
| 696 | 696 | $studentAnswerList[] = $answerCorrected; |
| 697 | 697 | } |
| 698 | 698 | } |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | */ |
| 714 | 714 | $tabComments = api_preg_split( |
| 715 | 715 | '/\[[^]]+\]/', |
| 716 | - ' ' . $answer . ' ' |
|
| 716 | + ' '.$answer.' ' |
|
| 717 | 717 | ); |
| 718 | 718 | if (!empty($correctAnswerList) && !empty($studentAnswerList)) { |
| 719 | 719 | $answer = ""; |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | $size |
| 731 | 731 | ); |
| 732 | 732 | |
| 733 | - $answer .= $tabComments[$i] . |
|
| 733 | + $answer .= $tabComments[$i]. |
|
| 734 | 734 | Display::input( |
| 735 | 735 | 'text', |
| 736 | 736 | "choice[$questionId][]", |
@@ -777,12 +777,12 @@ discard block |
||
| 777 | 777 | $s .= '<tr><td width="45%" valign="top">'; |
| 778 | 778 | $parsed_answer = $answer; |
| 779 | 779 | //left part questions |
| 780 | - $s .= '<p class="indent">' . $lines_count . '. ' . $parsed_answer . '</p></td>'; |
|
| 780 | + $s .= '<p class="indent">'.$lines_count.'. '.$parsed_answer.'</p></td>'; |
|
| 781 | 781 | //middle part (matches selects) |
| 782 | 782 | |
| 783 | 783 | $s .= '<td width="10%" valign="top" align="center" > |
| 784 | 784 | <div class="select-matching"> |
| 785 | - <select name="choice[' . $questionId . '][' . $numAnswer . ']">'; |
|
| 785 | + <select name="choice[' . $questionId.']['.$numAnswer.']">'; |
|
| 786 | 786 | |
| 787 | 787 | // fills the list-box |
| 788 | 788 | foreach ($select_items as $key => $val) { |
@@ -798,14 +798,14 @@ discard block |
||
| 798 | 798 | if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) { |
| 799 | 799 | $selected = 'selected="selected"'; |
| 800 | 800 | } |
| 801 | - $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>'; |
|
| 801 | + $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>'; |
|
| 802 | 802 | |
| 803 | 803 | } // end foreach() |
| 804 | 804 | |
| 805 | 805 | $s .= '</select></div></td><td width="5%" class="separate"> </td>'; |
| 806 | 806 | $s .= '<td width="40%" valign="top" >'; |
| 807 | 807 | if (isset($select_items[$lines_count])) { |
| 808 | - $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'] . '. ' . $select_items[$lines_count]['answer'] . '</p></div>'; |
|
| 808 | + $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'</p></div>'; |
|
| 809 | 809 | } else { |
| 810 | 810 | $s .= ' '; |
| 811 | 811 | } |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | $s .= '<tr> |
| 821 | 821 | <td colspan="2"></td> |
| 822 | 822 | <td valign="top">'; |
| 823 | - $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer']; |
|
| 823 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer']; |
|
| 824 | 824 | $s .= "</td> |
| 825 | 825 | </tr>"; |
| 826 | 826 | $lines_count++; |
@@ -837,9 +837,9 @@ discard block |
||
| 837 | 837 | $data = $objAnswerTmp->getAnswerByAutoId($data['correct']); |
| 838 | 838 | $lines_count = $data['answer'];*/ |
| 839 | 839 | |
| 840 | - $windowId = $questionId . '_' . $lines_count; |
|
| 840 | + $windowId = $questionId.'_'.$lines_count; |
|
| 841 | 841 | |
| 842 | - $s .= '<li class="touch-items" id="' . $windowId . '">'; |
|
| 842 | + $s .= '<li class="touch-items" id="'.$windowId.'">'; |
|
| 843 | 843 | $s .= Display::div( |
| 844 | 844 | $parsed_answer, |
| 845 | 845 | [ |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | Display::tag( |
| 898 | 898 | 'b', |
| 899 | 899 | $select_items[$lines_count]['letter'] |
| 900 | - ) . $select_items[$lines_count]['answer'], |
|
| 900 | + ).$select_items[$lines_count]['answer'], |
|
| 901 | 901 | [ |
| 902 | 902 | 'id' => "window_{$windowId}_answer", |
| 903 | 903 | 'style' => 'display: none;' |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | |
| 1069 | 1069 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
| 1070 | 1070 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
| 1071 | - $windowId = $questionId . '_' . $counterAnswer; |
|
| 1071 | + $windowId = $questionId.'_'.$counterAnswer; |
|
| 1072 | 1072 | |
| 1073 | 1073 | if ($answerCorrect) { |
| 1074 | 1074 | $s .= Display::div( |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | $course = api_get_course_info(); |
| 1118 | 1118 | $doc_id = DocumentManager::get_document_id( |
| 1119 | 1119 | $course, |
| 1120 | - '/images/' . $pictureName |
|
| 1120 | + '/images/'.$pictureName |
|
| 1121 | 1121 | ); |
| 1122 | 1122 | if (is_numeric($doc_id)) { |
| 1123 | 1123 | $images_folder_visibility = api_get_item_visibility( |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | echo " |
| 1143 | 1143 | <script> |
| 1144 | 1144 | $(document).on('ready', function () { |
| 1145 | - new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion") . "({ |
|
| 1145 | + new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({ |
|
| 1146 | 1146 | questionId: $questionId, |
| 1147 | 1147 | exerciseId: $exerciseId, |
| 1148 | 1148 | selector: '#hotspot-preview-$questionId', |
@@ -1176,7 +1176,7 @@ discard block |
||
| 1176 | 1176 | if ($answerType != HOT_SPOT_DELINEATION) { |
| 1177 | 1177 | $answerList = ' |
| 1178 | 1178 | <div class="well well-sm"> |
| 1179 | - <h5 class="page-header">' . get_lang('HotspotZones') . '</h5> |
|
| 1179 | + <h5 class="page-header">' . get_lang('HotspotZones').'</h5> |
|
| 1180 | 1180 | <ol> |
| 1181 | 1181 | '; |
| 1182 | 1182 | |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | if (!$only_questions) { |
| 1202 | 1202 | if ($show_title) { |
| 1203 | 1203 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
| 1204 | - echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>'; |
|
| 1204 | + echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 1205 | 1205 | } |
| 1206 | 1206 | //@todo I need to the get the feedback type |
| 1207 | 1207 | echo <<<HOTSPOT |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | <div class=\"hotspot-image\"></div> |
| 1219 | 1219 | <script> |
| 1220 | 1220 | $(document).on('ready', function () { |
| 1221 | - new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({ |
|
| 1221 | + new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({ |
|
| 1222 | 1222 | questionId: $questionId, |
| 1223 | 1223 | exerciseId: $exe_id, |
| 1224 | 1224 | selector: '#question_div_' + $questionId + ' .hotspot-image', |
@@ -1339,11 +1339,11 @@ discard block |
||
| 1339 | 1339 | $lp_id = intval($lp_id); |
| 1340 | 1340 | $lp_item_id = intval($lp_item_id); |
| 1341 | 1341 | return |
| 1342 | - api_get_course_int_id() . '_' . |
|
| 1343 | - api_get_session_id() . '_' . |
|
| 1344 | - $exercise_id . '_' . |
|
| 1345 | - api_get_user_id() . '_' . |
|
| 1346 | - $lp_id . '_' . |
|
| 1342 | + api_get_course_int_id().'_'. |
|
| 1343 | + api_get_session_id().'_'. |
|
| 1344 | + $exercise_id.'_'. |
|
| 1345 | + api_get_user_id().'_'. |
|
| 1346 | + $lp_id.'_'. |
|
| 1347 | 1347 | $lp_item_id; |
| 1348 | 1348 | } |
| 1349 | 1349 | |
@@ -1457,14 +1457,14 @@ discard block |
||
| 1457 | 1457 | $res = Database::query($sql); |
| 1458 | 1458 | $result = array(); |
| 1459 | 1459 | $apiIsAllowedToEdit = api_is_allowed_to_edit(); |
| 1460 | - $urlBase = api_get_path(WEB_CODE_PATH) . |
|
| 1461 | - 'exercise/hotpotatoes_exercise_report.php?action=delete&' . |
|
| 1462 | - api_get_cidreq() . '&id='; |
|
| 1460 | + $urlBase = api_get_path(WEB_CODE_PATH). |
|
| 1461 | + 'exercise/hotpotatoes_exercise_report.php?action=delete&'. |
|
| 1462 | + api_get_cidreq().'&id='; |
|
| 1463 | 1463 | while ($data = Database::fetch_array($res)) { |
| 1464 | 1464 | $actions = null; |
| 1465 | 1465 | |
| 1466 | 1466 | if ($apiIsAllowedToEdit) { |
| 1467 | - $url = $urlBase . $data['id'] . '&path=' . $data['exe_name']; |
|
| 1467 | + $url = $urlBase.$data['id'].'&path='.$data['exe_name']; |
|
| 1468 | 1468 | $actions = Display::url( |
| 1469 | 1469 | Display::return_icon('delete.png', get_lang('Delete')), |
| 1470 | 1470 | $url |
@@ -1480,7 +1480,7 @@ discard block |
||
| 1480 | 1480 | GroupManager::get_user_group_name($data['user_id']) |
| 1481 | 1481 | ), |
| 1482 | 1482 | 'exe_date' => $data['exe_date'], |
| 1483 | - 'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'], |
|
| 1483 | + 'score' => $data['exe_result'].' / '.$data['exe_weighting'], |
|
| 1484 | 1484 | 'actions' => $actions, |
| 1485 | 1485 | ); |
| 1486 | 1486 | } |
@@ -1564,18 +1564,18 @@ discard block |
||
| 1564 | 1564 | $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
| 1565 | 1565 | $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
| 1566 | 1566 | |
| 1567 | - $session_id_and = ' AND te.session_id = ' . $sessionId . ' '; |
|
| 1567 | + $session_id_and = ' AND te.session_id = '.$sessionId.' '; |
|
| 1568 | 1568 | $exercise_id = intval($exercise_id); |
| 1569 | 1569 | |
| 1570 | 1570 | $exercise_where = ''; |
| 1571 | 1571 | if (!empty($exercise_id)) { |
| 1572 | - $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . ' '; |
|
| 1572 | + $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.' '; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | |
| 1575 | 1575 | $hotpotatoe_where = ''; |
| 1576 | 1576 | if (!empty($_GET['path'])) { |
| 1577 | 1577 | $hotpotatoe_path = Database::escape_string($_GET['path']); |
| 1578 | - $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '" '; |
|
| 1578 | + $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'" '; |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | // sql for chamilo-type tests for teacher / tutor view |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | WHERE |
| 1588 | 1588 | c_id = $course_id AND |
| 1589 | 1589 | exe_exo_id = $exercise_id AND |
| 1590 | - ttte.session_id = " . $sessionId . " |
|
| 1590 | + ttte.session_id = ".$sessionId." |
|
| 1591 | 1591 | )"; |
| 1592 | 1592 | |
| 1593 | 1593 | if ($is_allowedToEdit) { |
@@ -1610,9 +1610,9 @@ discard block |
||
| 1610 | 1610 | g.id as group_id |
| 1611 | 1611 | FROM $TBL_USER u |
| 1612 | 1612 | INNER JOIN $TBL_GROUP_REL_USER gru |
| 1613 | - ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ") |
|
| 1613 | + ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.") |
|
| 1614 | 1614 | INNER JOIN $TBL_GROUP g |
| 1615 | - ON (gru.group_id = g.id AND g.c_id=" . $course_id . ") |
|
| 1615 | + ON (gru.group_id = g.id AND g.c_id=".$course_id.") |
|
| 1616 | 1616 | )"; |
| 1617 | 1617 | } |
| 1618 | 1618 | |
@@ -1673,9 +1673,9 @@ discard block |
||
| 1673 | 1673 | g.id as group_id |
| 1674 | 1674 | FROM $TBL_USER u |
| 1675 | 1675 | LEFT OUTER JOIN $TBL_GROUP_REL_USER gru |
| 1676 | - ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " ) |
|
| 1676 | + ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." ) |
|
| 1677 | 1677 | LEFT OUTER JOIN $TBL_GROUP g |
| 1678 | - ON (gru.group_id = g.id AND g.c_id = " . $course_id . ") |
|
| 1678 | + ON (gru.group_id = g.id AND g.c_id = ".$course_id.") |
|
| 1679 | 1679 | )"; |
| 1680 | 1680 | } |
| 1681 | 1681 | |
@@ -1688,12 +1688,12 @@ discard block |
||
| 1688 | 1688 | ( |
| 1689 | 1689 | SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code |
| 1690 | 1690 | FROM $TBL_USER u |
| 1691 | - WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") |
|
| 1691 | + WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').") |
|
| 1692 | 1692 | )"; |
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru "; |
| 1696 | - $sqlWhereOption = " AND gru.c_id = " . $course_id . " AND gru.user_id = user.user_id "; |
|
| 1696 | + $sqlWhereOption = " AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id "; |
|
| 1697 | 1697 | $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname"; |
| 1698 | 1698 | |
| 1699 | 1699 | if ($get_count) { |
@@ -1730,9 +1730,9 @@ discard block |
||
| 1730 | 1730 | ON (user.user_id = exe_user_id) |
| 1731 | 1731 | WHERE |
| 1732 | 1732 | te.status != 'incomplete' AND |
| 1733 | - te.c_id = " . $course_id . " $session_id_and AND |
|
| 1733 | + te.c_id = ".$course_id." $session_id_and AND |
|
| 1734 | 1734 | ce.active <>-1 AND |
| 1735 | - ce.c_id = " . $course_id . " |
|
| 1735 | + ce.c_id = ".$course_id." |
|
| 1736 | 1736 | $exercise_where |
| 1737 | 1737 | $extra_where_conditions |
| 1738 | 1738 | "; |
@@ -1759,10 +1759,10 @@ discard block |
||
| 1759 | 1759 | $sqlFromOption |
| 1760 | 1760 | WHERE |
| 1761 | 1761 | user.user_id=tth.exe_user_id |
| 1762 | - AND tth.c_id = " . $course_id . " |
|
| 1762 | + AND tth.c_id = ".$course_id." |
|
| 1763 | 1763 | $hotpotatoe_where |
| 1764 | 1764 | $sqlWhereOption |
| 1765 | - AND user.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") |
|
| 1765 | + AND user.status NOT IN(".api_get_users_status_ignored_in_reports('string').") |
|
| 1766 | 1766 | ORDER BY |
| 1767 | 1767 | tth.c_id ASC, |
| 1768 | 1768 | tth.exe_date DESC"; |
@@ -1835,12 +1835,12 @@ discard block |
||
| 1835 | 1835 | |
| 1836 | 1836 | if ($from_gradebook && ($is_allowedToEdit)) { |
| 1837 | 1837 | if (in_array( |
| 1838 | - $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'], |
|
| 1838 | + $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'], |
|
| 1839 | 1839 | $users_array_id |
| 1840 | 1840 | )) { |
| 1841 | 1841 | continue; |
| 1842 | 1842 | } |
| 1843 | - $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname']; |
|
| 1843 | + $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname']; |
|
| 1844 | 1844 | } |
| 1845 | 1845 | |
| 1846 | 1846 | $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null; |
@@ -1849,7 +1849,7 @@ discard block |
||
| 1849 | 1849 | if ($lp_obj) { |
| 1850 | 1850 | $url = api_get_path( |
| 1851 | 1851 | WEB_CODE_PATH |
| 1852 | - ) . 'lp/lp_controller.php?' . api_get_cidreq() . '&action=view&lp_id=' . $results[$i]['orig_lp_id']; |
|
| 1852 | + ).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$results[$i]['orig_lp_id']; |
|
| 1853 | 1853 | $lp_name = Display::url( |
| 1854 | 1854 | $lp_obj['lp_name'], |
| 1855 | 1855 | $url, |
@@ -1867,7 +1867,7 @@ discard block |
||
| 1867 | 1867 | ); |
| 1868 | 1868 | |
| 1869 | 1869 | foreach ($group_list as $id) { |
| 1870 | - $group_name_list .= $clean_group_list[$id] . '<br/>'; |
|
| 1870 | + $group_name_list .= $clean_group_list[$id].'<br/>'; |
|
| 1871 | 1871 | } |
| 1872 | 1872 | $results[$i]['group_name'] = $group_name_list; |
| 1873 | 1873 | } |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | } |
| 1924 | 1924 | } |
| 1925 | 1925 | if ($revised) { |
| 1926 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=edit&id=$id'>" . |
|
| 1926 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq()."&action=edit&id=$id'>". |
|
| 1927 | 1927 | Display:: return_icon( |
| 1928 | 1928 | 'edit.png', |
| 1929 | 1929 | get_lang('Edit'), |
@@ -1932,7 +1932,7 @@ discard block |
||
| 1932 | 1932 | ); |
| 1933 | 1933 | $actions .= ' '; |
| 1934 | 1934 | } else { |
| 1935 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=qualify&id=$id'>" . |
|
| 1935 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq()."&action=qualify&id=$id'>". |
|
| 1936 | 1936 | Display:: return_icon( |
| 1937 | 1937 | 'quiz.png', |
| 1938 | 1938 | get_lang('Qualify') |
@@ -1942,11 +1942,11 @@ discard block |
||
| 1942 | 1942 | $actions .= "</a>"; |
| 1943 | 1943 | |
| 1944 | 1944 | if ($filter == 2) { |
| 1945 | - $actions .= ' <a href="exercise_history.php?' . api_get_cidreq() . '&exe_id=' . $id . '">' . |
|
| 1945 | + $actions .= ' <a href="exercise_history.php?'.api_get_cidreq().'&exe_id='.$id.'">'. |
|
| 1946 | 1946 | Display:: return_icon( |
| 1947 | 1947 | 'history.png', |
| 1948 | 1948 | get_lang('ViewHistoryChange') |
| 1949 | - ) . '</a>'; |
|
| 1949 | + ).'</a>'; |
|
| 1950 | 1950 | } |
| 1951 | 1951 | |
| 1952 | 1952 | //Admin can always delete the attempt |
@@ -1956,13 +1956,13 @@ discard block |
||
| 1956 | 1956 | date('Y-m-d h:i:s'), |
| 1957 | 1957 | false |
| 1958 | 1958 | ); |
| 1959 | - $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank"> |
|
| 1960 | - ' . Display::return_icon('info.png', $ip) . ' |
|
| 1959 | + $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank"> |
|
| 1960 | + ' . Display::return_icon('info.png', $ip).' |
|
| 1961 | 1961 | </a>'; |
| 1962 | 1962 | |
| 1963 | 1963 | |
| 1964 | - $recalculateUrl = api_get_path(WEB_CODE_PATH) . 'exercise/recalculate.php?' . |
|
| 1965 | - api_get_cidreq() . '&' . |
|
| 1964 | + $recalculateUrl = api_get_path(WEB_CODE_PATH).'exercise/recalculate.php?'. |
|
| 1965 | + api_get_cidreq().'&'. |
|
| 1966 | 1966 | http_build_query([ |
| 1967 | 1967 | 'id' => $id, |
| 1968 | 1968 | 'exercise' => $exercise_id, |
@@ -1979,27 +1979,27 @@ discard block |
||
| 1979 | 1979 | ] |
| 1980 | 1980 | ); |
| 1981 | 1981 | |
| 1982 | - $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 . '" |
|
| 1982 | + $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.'" |
|
| 1983 | 1983 | onclick="javascript:if(!confirm(\'' . sprintf( |
| 1984 | 1984 | get_lang('DeleteAttempt'), |
| 1985 | 1985 | $results[$i]['username'], |
| 1986 | 1986 | $dt |
| 1987 | - ) . '\')) return false;">' . Display:: return_icon( |
|
| 1987 | + ).'\')) return false;">'.Display:: return_icon( |
|
| 1988 | 1988 | 'delete.png', |
| 1989 | 1989 | get_lang('Delete') |
| 1990 | - ) . '</a>'; |
|
| 1990 | + ).'</a>'; |
|
| 1991 | 1991 | $delete_link = utf8_encode($delete_link); |
| 1992 | 1992 | |
| 1993 | 1993 | if (api_is_drh() && !api_is_platform_admin()) { |
| 1994 | 1994 | $delete_link = null; |
| 1995 | 1995 | } |
| 1996 | - $actions .= $delete_link . ' '; |
|
| 1996 | + $actions .= $delete_link.' '; |
|
| 1997 | 1997 | } |
| 1998 | 1998 | |
| 1999 | 1999 | } else { |
| 2000 | 2000 | $attempt_url = api_get_path( |
| 2001 | 2001 | WEB_CODE_PATH |
| 2002 | - ) . 'exercise/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; |
|
| 2002 | + ).'exercise/result.php?'.api_get_cidreq().'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId; |
|
| 2003 | 2003 | $attempt_link = Display::url( |
| 2004 | 2004 | get_lang('Show'), |
| 2005 | 2005 | $attempt_url, |
@@ -2058,7 +2058,7 @@ discard block |
||
| 2058 | 2058 | $hp_result = round( |
| 2059 | 2059 | ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100, |
| 2060 | 2060 | 2 |
| 2061 | - ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')'; |
|
| 2061 | + ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')'; |
|
| 2062 | 2062 | if ($is_allowedToEdit) { |
| 2063 | 2063 | $list_info[] = array( |
| 2064 | 2064 | $hpresults[$i][0], |
@@ -2132,13 +2132,13 @@ discard block |
||
| 2132 | 2132 | |
| 2133 | 2133 | $html = null; |
| 2134 | 2134 | if ($show_percentage) { |
| 2135 | - $parent = '(' . $score . ' / ' . $weight . ')'; |
|
| 2136 | - $html = $percentage . "% $parent"; |
|
| 2135 | + $parent = '('.$score.' / '.$weight.')'; |
|
| 2136 | + $html = $percentage."% $parent"; |
|
| 2137 | 2137 | if ($show_only_percentage) { |
| 2138 | - $html = $percentage . "% "; |
|
| 2138 | + $html = $percentage."% "; |
|
| 2139 | 2139 | } |
| 2140 | 2140 | } else { |
| 2141 | - $html = $score . ' / ' . $weight; |
|
| 2141 | + $html = $score.' / '.$weight; |
|
| 2142 | 2142 | } |
| 2143 | 2143 | $html = Display::span($html, array('class' => 'score_exercise')); |
| 2144 | 2144 | |
@@ -2232,7 +2232,7 @@ discard block |
||
| 2232 | 2232 | { |
| 2233 | 2233 | $return = '-'; |
| 2234 | 2234 | if ($value != '') { |
| 2235 | - $return = float_format($value * 100, 1) . ' %'; |
|
| 2235 | + $return = float_format($value * 100, 1).' %'; |
|
| 2236 | 2236 | } |
| 2237 | 2237 | return $return; |
| 2238 | 2238 | } |
@@ -2311,7 +2311,7 @@ discard block |
||
| 2311 | 2311 | } |
| 2312 | 2312 | |
| 2313 | 2313 | $needle_where = !empty($search) ? " AND title LIKE '?' " : ''; |
| 2314 | - $needle = !empty($search) ? "%" . $search . "%" : ''; |
|
| 2314 | + $needle = !empty($search) ? "%".$search."%" : ''; |
|
| 2315 | 2315 | |
| 2316 | 2316 | // Show courses by active status |
| 2317 | 2317 | $active_sql = ''; |
@@ -2326,7 +2326,7 @@ discard block |
||
| 2326 | 2326 | if ($search_all_sessions == true) { |
| 2327 | 2327 | $conditions = array( |
| 2328 | 2328 | 'where' => array( |
| 2329 | - $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2329 | + $active_sql.' c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2330 | 2330 | $course_id, |
| 2331 | 2331 | $needle |
| 2332 | 2332 | ) |
@@ -2337,7 +2337,7 @@ discard block |
||
| 2337 | 2337 | if ($session_id == 0) { |
| 2338 | 2338 | $conditions = array( |
| 2339 | 2339 | 'where' => array( |
| 2340 | - $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2340 | + $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2341 | 2341 | $session_id, |
| 2342 | 2342 | $course_id, |
| 2343 | 2343 | $needle |
@@ -2348,7 +2348,7 @@ discard block |
||
| 2348 | 2348 | } else { |
| 2349 | 2349 | $conditions = array( |
| 2350 | 2350 | 'where' => array( |
| 2351 | - $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2351 | + $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2352 | 2352 | $session_id, |
| 2353 | 2353 | $course_id, |
| 2354 | 2354 | $needle |
@@ -2529,7 +2529,7 @@ discard block |
||
| 2529 | 2529 | |
| 2530 | 2530 | if ($return_string) { |
| 2531 | 2531 | if (!empty($position) && !empty($my_ranking)) { |
| 2532 | - $return_value = $position . '/' . count($my_ranking); |
|
| 2532 | + $return_value = $position.'/'.count($my_ranking); |
|
| 2533 | 2533 | } else { |
| 2534 | 2534 | $return_value = '-'; |
| 2535 | 2535 | } |
@@ -2610,7 +2610,7 @@ discard block |
||
| 2610 | 2610 | |
| 2611 | 2611 | if ($return_string) { |
| 2612 | 2612 | if (!empty($position) && !empty($my_ranking)) { |
| 2613 | - return $position . '/' . count($my_ranking); |
|
| 2613 | + return $position.'/'.count($my_ranking); |
|
| 2614 | 2614 | } |
| 2615 | 2615 | } |
| 2616 | 2616 | return $return_value; |
@@ -3015,7 +3015,7 @@ discard block |
||
| 3015 | 3015 | $courseCondition = " |
| 3016 | 3016 | INNER JOIN $courseUser cu |
| 3017 | 3017 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 3018 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 3018 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 3019 | 3019 | } else { |
| 3020 | 3020 | $courseCondition = " |
| 3021 | 3021 | INNER JOIN $courseUserSession cu |
@@ -3091,7 +3091,7 @@ discard block |
||
| 3091 | 3091 | $courseCondition = " |
| 3092 | 3092 | INNER JOIN $courseUser cu |
| 3093 | 3093 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 3094 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 3094 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 3095 | 3095 | } else { |
| 3096 | 3096 | $courseCondition = " |
| 3097 | 3097 | INNER JOIN $courseUserSession cu |
@@ -3184,7 +3184,7 @@ discard block |
||
| 3184 | 3184 | $courseCondition = " |
| 3185 | 3185 | INNER JOIN $courseUser cu |
| 3186 | 3186 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 3187 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 3187 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 3188 | 3188 | } else { |
| 3189 | 3189 | $courseCondition = " |
| 3190 | 3190 | INNER JOIN $courseUserSession cu |
@@ -3366,7 +3366,7 @@ discard block |
||
| 3366 | 3366 | } |
| 3367 | 3367 | } |
| 3368 | 3368 | // adds the correct word, followed by ] to close the blank |
| 3369 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
| 3369 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
| 3370 | 3370 | if (isset ($real_text[$i + 1])) { |
| 3371 | 3371 | $answer .= $real_text[$i + 1]; |
| 3372 | 3372 | } |
@@ -3426,13 +3426,13 @@ discard block |
||
| 3426 | 3426 | // check the default value of option |
| 3427 | 3427 | $tabSelected = array($in_default => " selected='selected' "); |
| 3428 | 3428 | $res = ""; |
| 3429 | - $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >"; |
|
| 3430 | - $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang( |
|
| 3429 | + $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >"; |
|
| 3430 | + $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang( |
|
| 3431 | 3431 | 'AllGroups' |
| 3432 | - ) . " --</option>"; |
|
| 3433 | - $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang( |
|
| 3432 | + )." --</option>"; |
|
| 3433 | + $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang( |
|
| 3434 | 3434 | 'NotInAGroup' |
| 3435 | - ) . " -</option>"; |
|
| 3435 | + )." -</option>"; |
|
| 3436 | 3436 | $tabGroups = GroupManager::get_group_list(); |
| 3437 | 3437 | $currentCatId = 0; |
| 3438 | 3438 | for ($i = 0; $i < count($tabGroups); $i++) { |
@@ -3440,10 +3440,10 @@ discard block |
||
| 3440 | 3440 | $tabGroups[$i]['iid'] |
| 3441 | 3441 | ); |
| 3442 | 3442 | if ($tabCategory["id"] != $currentCatId) { |
| 3443 | - $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>"; |
|
| 3443 | + $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>"; |
|
| 3444 | 3444 | $currentCatId = $tabCategory["id"]; |
| 3445 | 3445 | } |
| 3446 | - $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>"; |
|
| 3446 | + $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>"; |
|
| 3447 | 3447 | } |
| 3448 | 3448 | $res .= "</select>"; |
| 3449 | 3449 | return $res; |
@@ -3678,14 +3678,14 @@ discard block |
||
| 3678 | 3678 | if ($show_results) { |
| 3679 | 3679 | $comnt = Event::get_comments($exe_id, $questionId); |
| 3680 | 3680 | if (!empty($comnt)) { |
| 3681 | - echo '<b>' . get_lang('Feedback') . '</b>'; |
|
| 3682 | - echo '<div id="question_feedback">' . $comnt . '</div>'; |
|
| 3681 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
| 3682 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 3683 | 3683 | } |
| 3684 | 3684 | } |
| 3685 | 3685 | |
| 3686 | 3686 | if ($show_results) { |
| 3687 | 3687 | $score = array( |
| 3688 | - 'result' => get_lang('Score') . " : " . self::show_score( |
|
| 3688 | + 'result' => get_lang('Score')." : ".self::show_score( |
|
| 3689 | 3689 | $my_total_score, |
| 3690 | 3690 | $my_total_weight, |
| 3691 | 3691 | false, |
@@ -3753,9 +3753,9 @@ discard block |
||
| 3753 | 3753 | } |
| 3754 | 3754 | |
| 3755 | 3755 | if ($show_all_but_expected_answer) { |
| 3756 | - $exercise_content .= "<div class='normal-message'>" . get_lang( |
|
| 3756 | + $exercise_content .= "<div class='normal-message'>".get_lang( |
|
| 3757 | 3757 | "ExerciseWithFeedbackWithoutCorrectionComment" |
| 3758 | - ) . "</div>"; |
|
| 3758 | + )."</div>"; |
|
| 3759 | 3759 | } |
| 3760 | 3760 | // Remove audio auto play from questions on results page - refs BT#7939 |
| 3761 | 3761 | $exercise_content = preg_replace( |
@@ -3855,11 +3855,11 @@ discard block |
||
| 3855 | 3855 | $ribbon_total_success_or_error = ' ribbon-total-error'; |
| 3856 | 3856 | } |
| 3857 | 3857 | } |
| 3858 | - $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">'; |
|
| 3858 | + $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">'; |
|
| 3859 | 3859 | } else { |
| 3860 | 3860 | $ribbon .= '<div class="total">'; |
| 3861 | 3861 | } |
| 3862 | - $ribbon .= '<h3>' . get_lang('YourTotalScore') . ": "; |
|
| 3862 | + $ribbon .= '<h3>'.get_lang('YourTotalScore').": "; |
|
| 3863 | 3863 | $ribbon .= self::show_score($score, $weight, false, true); |
| 3864 | 3864 | $ribbon .= '</h3>'; |
| 3865 | 3865 | $ribbon .= '</div>'; |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | { |
| 10 | 10 | /** |
| 11 | 11 | * @param $value array Uploaded file info (from $_FILES) |
| 12 | - * @param null $options |
|
| 13 | 12 | * @return bool |
| 14 | 13 | */ |
| 15 | 14 | public function validate($elementValue, $maxSize) |
@@ -7,22 +7,22 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class HTML_QuickForm_Rule_MaxFileSize extends HTML_QuickForm_Rule |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * @param $value array Uploaded file info (from $_FILES) |
|
| 12 | - * @param null $options |
|
| 13 | - * @return bool |
|
| 14 | - */ |
|
| 15 | - public function validate($elementValue, $maxSize) |
|
| 16 | - { |
|
| 17 | - if (!empty($elementValue['error']) && |
|
| 18 | - (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
| 19 | - ) { |
|
| 20 | - return false; |
|
| 21 | - } |
|
| 22 | - if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
| 23 | - return true; |
|
| 24 | - } |
|
| 10 | + /** |
|
| 11 | + * @param $value array Uploaded file info (from $_FILES) |
|
| 12 | + * @param null $options |
|
| 13 | + * @return bool |
|
| 14 | + */ |
|
| 15 | + public function validate($elementValue, $maxSize) |
|
| 16 | + { |
|
| 17 | + if (!empty($elementValue['error']) && |
|
| 18 | + (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
| 19 | + ) { |
|
| 20 | + return false; |
|
| 21 | + } |
|
| 22 | + if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
| 27 | - } |
|
| 26 | + return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @param string Mobile phone number to be validated |
| 18 | 18 | * @param string Not using it. Just to respect the declaration |
| 19 | - * @return boolean Returns true if valid, false otherwise. |
|
| 19 | + * @return integer Returns true if valid, false otherwise. |
|
| 20 | 20 | */ |
| 21 | 21 | function validate($mobilePhoneNumber, $options = null) |
| 22 | 22 | { |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Return a list an associative array where keys are the active hook observer class name |
| 141 | - * @param $eventName |
|
| 141 | + * @param string $eventName |
|
| 142 | 142 | * |
| 143 | 143 | * @return array |
| 144 | 144 | */ |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | public function listHookObservers($eventName) |
| 146 | 146 | { |
| 147 | 147 | $array = array(); |
| 148 | - $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' . |
|
| 149 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' . |
|
| 150 | - ' ON hc.hook_event_id = he.id ' . |
|
| 151 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' . |
|
| 148 | + $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'. |
|
| 149 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'. |
|
| 150 | + ' ON hc.hook_event_id = he.id '. |
|
| 151 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '. |
|
| 152 | 152 | ' ON hc.hook_observer_id = ho.id '; |
| 153 | 153 | $columns = 'ho.class_name, ho.path, ho.plugin_name, hc.enabled'; |
| 154 | 154 | $where = array('where' => array('he.class_name = ? ' => $eventName, 'AND hc.enabled = ? ' => 1)); |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | public function listAllHookCalls() |
| 203 | 203 | { |
| 204 | 204 | $array = array(); |
| 205 | - $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' . |
|
| 206 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' . |
|
| 207 | - ' ON hc.hook_event_id = he.id ' . |
|
| 208 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' . |
|
| 205 | + $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'. |
|
| 206 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'. |
|
| 207 | + ' ON hc.hook_event_id = he.id '. |
|
| 208 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '. |
|
| 209 | 209 | ' ON hc.hook_observer_id = ho.id '; |
| 210 | 210 | $columns = 'he.class_name AS event_class_name, ho.class_name AS observer_class_name, hc.id AS id, hc.type AS type'; |
| 211 | 211 | $rows = Database::select($columns, $joinTable); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if (isset($eventName) && !isset($this->hookEvents[$eventName])) { |
| 232 | 232 | $attributes = array( |
| 233 | 233 | 'class_name' => $eventName, |
| 234 | - 'description' => get_lang('HookDescription' . $eventName), |
|
| 234 | + 'description' => get_lang('HookDescription'.$eventName), |
|
| 235 | 235 | ); |
| 236 | 236 | $id = Database::insert($this->tables[TABLE_HOOK_EVENT], $attributes); |
| 237 | 237 | $this->hookEvents[$eventName] = $id; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | // Check if exists hook observer |
| 241 | 241 | if (isset($observerClassName) && |
| 242 | 242 | !isset($this->hookObservers[$observerClassName]) |
| 243 | - ){ |
|
| 243 | + ) { |
|
| 244 | 244 | $object = $observerClassName::create(); |
| 245 | 245 | $attributes = array( |
| 246 | 246 | 'class_name' => $observerClassName, |
@@ -338,10 +338,10 @@ discard block |
||
| 338 | 338 | $eventName = Database::escape_string($eventName); |
| 339 | 339 | $observerClassName($observerClassName); |
| 340 | 340 | $type = Database::escape_string($type); |
| 341 | - $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' . |
|
| 342 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' . |
|
| 343 | - ' ON hc.hook_event_id = he.id ' . |
|
| 344 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' . |
|
| 341 | + $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'. |
|
| 342 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'. |
|
| 343 | + ' ON hc.hook_event_id = he.id '. |
|
| 344 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '. |
|
| 345 | 345 | ' ON hc.hook_observer_id = ho.id '; |
| 346 | 346 | $row = Database::select( |
| 347 | 347 | 'id', |
@@ -266,6 +266,7 @@ discard block |
||
| 266 | 266 | * @global bool $is_platformAdmin |
| 267 | 267 | * @global bool $is_allowedCreateCourse |
| 268 | 268 | * @global object $_user |
| 269 | + * @param boolean $reset |
|
| 269 | 270 | */ |
| 270 | 271 | public static function init_user($user_id, $reset) |
| 271 | 272 | { |
@@ -355,7 +356,7 @@ discard block |
||
| 355 | 356 | * @global type $is_allowed_in_course |
| 356 | 357 | * |
| 357 | 358 | * @param type $course_id |
| 358 | - * @param type $reset |
|
| 359 | + * @param boolean $reset |
|
| 359 | 360 | */ |
| 360 | 361 | static function init_course($course_id, $reset) |
| 361 | 362 | { |
@@ -37,24 +37,24 @@ discard block |
||
| 37 | 37 | if ($by_username) { |
| 38 | 38 | $secret_word = self::get_secret_word($user['email']); |
| 39 | 39 | if ($reset) { |
| 40 | - $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $user['uid']; |
|
| 40 | + $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$user['uid']; |
|
| 41 | 41 | } else { |
| 42 | - $reset_link = get_lang('Pass') . " : $user[password]"; |
|
| 42 | + $reset_link = get_lang('Pass')." : $user[password]"; |
|
| 43 | 43 | } |
| 44 | - $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . ''; |
|
| 44 | + $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.''; |
|
| 45 | 45 | |
| 46 | 46 | if ($user_account_list) { |
| 47 | - $user_account_list = "\n-----------------------------------------------\n" . $user_account_list; |
|
| 47 | + $user_account_list = "\n-----------------------------------------------\n".$user_account_list; |
|
| 48 | 48 | } |
| 49 | 49 | } else { |
| 50 | 50 | foreach ($user as $this_user) { |
| 51 | 51 | $secret_word = self::get_secret_word($this_user['email']); |
| 52 | 52 | if ($reset) { |
| 53 | - $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $this_user['uid']; |
|
| 53 | + $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$this_user['uid']; |
|
| 54 | 54 | } else { |
| 55 | - $reset_link = get_lang('Pass') . " : $this_user[password]"; |
|
| 55 | + $reset_link = get_lang('Pass')." : $this_user[password]"; |
|
| 56 | 56 | } |
| 57 | - $user_account_list[] = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $this_user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . ''; |
|
| 57 | + $user_account_list[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$this_user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.''; |
|
| 58 | 58 | } |
| 59 | 59 | if ($user_account_list) { |
| 60 | 60 | $user_account_list = implode("\n-----------------------------------------------\n", $user_account_list); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | if (!$by_username) { |
| 65 | 65 | $user = $user[0]; |
| 66 | 66 | } |
| 67 | - $reset_link = get_lang('Pass') . " : $user[password]"; |
|
| 68 | - $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . $reset_link . ''; |
|
| 67 | + $reset_link = get_lang('Pass')." : $user[password]"; |
|
| 68 | + $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.''; |
|
| 69 | 69 | } |
| 70 | 70 | return $user_account_list; |
| 71 | 71 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function send_password_to_user($user, $by_username = false) |
| 80 | 80 | { |
| 81 | - $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT |
|
| 81 | + $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT |
|
| 82 | 82 | |
| 83 | 83 | if ($by_username) { // Show only for lost password |
| 84 | 84 | $user_account_list = self::get_user_account_list($user, false, $by_username); // BODY |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $email_body = get_lang('YourAccountParam') . " " . $portal_url . "\n\n$user_account_list"; |
|
| 100 | + $email_body = get_lang('YourAccountParam')." ".$portal_url."\n\n$user_account_list"; |
|
| 101 | 101 | // SEND MESSAGE |
| 102 | 102 | $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); |
| 103 | 103 | $email_admin = api_get_setting('emailAdministrator'); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public static function handle_encrypted_password($user, $by_username = false) |
| 133 | 133 | { |
| 134 | - $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT |
|
| 134 | + $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT |
|
| 135 | 135 | |
| 136 | 136 | if ($by_username) { |
| 137 | 137 | // Show only for lost password |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | $user_account_list = self::get_user_account_list($user, true); // BODY |
| 142 | 142 | $email_to = $user[0]['email']; |
| 143 | 143 | } |
| 144 | - $email_body = get_lang('DearUser') . " :\n" . get_lang('password_request') . "\n"; |
|
| 145 | - $email_body .= $user_account_list . "\n-----------------------------------------------\n\n"; |
|
| 144 | + $email_body = get_lang('DearUser')." :\n".get_lang('password_request')."\n"; |
|
| 145 | + $email_body .= $user_account_list."\n-----------------------------------------------\n\n"; |
|
| 146 | 146 | $email_body .= get_lang('PasswordEncryptedForSecurity'); |
| 147 | 147 | |
| 148 | - $email_body .= "\n\n" . get_lang('SignatureFormula') . ",\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('PlataformAdmin') . " - " . api_get_setting('siteName'); |
|
| 148 | + $email_body .= "\n\n".get_lang('SignatureFormula').",\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname')."\n".get_lang('PlataformAdmin')." - ".api_get_setting('siteName'); |
|
| 149 | 149 | |
| 150 | 150 | $sender_name = api_get_person_name( |
| 151 | 151 | api_get_setting('administratorName'), |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | username AS loginName, |
| 239 | 239 | password, |
| 240 | 240 | |
| 241 | - FROM " . $tbl_user . " |
|
| 241 | + FROM " . $tbl_user." |
|
| 242 | 242 | WHERE user_id = $id"; |
| 243 | 243 | $result = Database::query($sql); |
| 244 | 244 | $num_rows = Database::num_rows($result); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | ON user.user_id = a.user_id |
| 292 | 292 | LEFT JOIN $track_e_login login |
| 293 | 293 | ON user.user_id = login.login_user_id |
| 294 | - WHERE user.user_id = '" . $_user['user_id'] . "' |
|
| 294 | + WHERE user.user_id = '".$_user['user_id']."' |
|
| 295 | 295 | ORDER BY login.login_date DESC LIMIT 1"; |
| 296 | 296 | |
| 297 | 297 | $result = Database::query($sql); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | Session::write('is_platformAdmin', $is_platformAdmin); |
| 322 | 322 | Session::write('is_allowedCreateCourse', $is_allowedCreateCourse); |
| 323 | 323 | } else { |
| 324 | - header('location:' . api_get_path(WEB_PATH)); |
|
| 324 | + header('location:'.api_get_path(WEB_PATH)); |
|
| 325 | 325 | //exit("WARNING UNDEFINED UID !! "); |
| 326 | 326 | } |
| 327 | 327 | } else { // no uid => logout or Anonymous |
@@ -368,9 +368,9 @@ discard block |
||
| 368 | 368 | global $_course; |
| 369 | 369 | global $_real_cid; |
| 370 | 370 | |
| 371 | - global $is_courseAdmin; //course teacher |
|
| 372 | - global $is_courseTutor; //course teacher - some rights |
|
| 373 | - global $is_courseCoach; //course coach |
|
| 371 | + global $is_courseAdmin; //course teacher |
|
| 372 | + global $is_courseTutor; //course teacher - some rights |
|
| 373 | + global $is_courseCoach; //course coach |
|
| 374 | 374 | global $is_courseMember; //course student |
| 375 | 375 | global $is_sessionAdmin; |
| 376 | 376 | global $is_allowed_in_course; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | if (!empty($_GET['id_session'])) { |
| 429 | 429 | $_SESSION['id_session'] = intval($_GET['id_session']); |
| 430 | - $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"'; |
|
| 430 | + $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"'; |
|
| 431 | 431 | $rs = Database::query($sql); |
| 432 | 432 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
| 433 | 433 | } else { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | } else { |
| 445 | 445 | //exit("WARNING UNDEFINED CID !! "); |
| 446 | - header('location:' . api_get_path(WEB_PATH)); |
|
| 446 | + header('location:'.api_get_path(WEB_PATH)); |
|
| 447 | 447 | } |
| 448 | 448 | } else { |
| 449 | 449 | Session::erase('_cid'); |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | } else { |
| 471 | 471 | // Continue with the previous values |
| 472 | 472 | if (empty($_SESSION['_course']) OR empty($_SESSION['_cid'])) { //no previous values... |
| 473 | - $_cid = -1; //set default values that will be caracteristic of being unset |
|
| 473 | + $_cid = -1; //set default values that will be caracteristic of being unset |
|
| 474 | 474 | $_course = -1; |
| 475 | 475 | } else { |
| 476 | 476 | $_cid = $_SESSION['_cid']; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | // Moreover, if we want to track a course with another session it can be usefull |
| 481 | 481 | if (!empty($_GET['id_session'])) { |
| 482 | 482 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
| 483 | - $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"'; |
|
| 483 | + $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"'; |
|
| 484 | 484 | $rs = Database::query($sql); |
| 485 | 485 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
| 486 | 486 | $_SESSION['id_session'] = intval($_GET['id_session']); |
@@ -520,9 +520,9 @@ discard block |
||
| 520 | 520 | //But only if the login date is < than now + max_life_time |
| 521 | 521 | $sql = "SELECT course_access_id FROM $course_tracking_table |
| 522 | 522 | WHERE |
| 523 | - user_id = " . intval($_user ['user_id']) . " AND |
|
| 523 | + user_id = ".intval($_user ['user_id'])." AND |
|
| 524 | 524 | c_id = '".api_get_course_int_id()."' AND |
| 525 | - session_id = " . api_get_session_id() . " AND |
|
| 525 | + session_id = " . api_get_session_id()." AND |
|
| 526 | 526 | login_course_date > now() - INTERVAL $session_lifetime SECOND |
| 527 | 527 | ORDER BY login_course_date DESC LIMIT 0,1"; |
| 528 | 528 | $result = Database::query($sql); |
@@ -532,11 +532,11 @@ discard block |
||
| 532 | 532 | //We update the course tracking table |
| 533 | 533 | $sql = "UPDATE $course_tracking_table |
| 534 | 534 | SET logout_course_date = '$time', counter = counter+1 |
| 535 | - WHERE course_access_id = " . intval($i_course_access_id) . " AND session_id = " . api_get_session_id(); |
|
| 535 | + WHERE course_access_id = ".intval($i_course_access_id)." AND session_id = ".api_get_session_id(); |
|
| 536 | 536 | Database::query($sql); |
| 537 | 537 | } else { |
| 538 | - $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)" . |
|
| 539 | - "VALUES('" . api_get_course_int_id() . "', '" . $_user['user_id'] . "', '$time', '$time', '1','" . api_get_session_id() . "')"; |
|
| 538 | + $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)". |
|
| 539 | + "VALUES('".api_get_course_int_id()."', '".$_user['user_id']."', '$time', '$time', '1','".api_get_session_id()."')"; |
|
| 540 | 540 | Database::query($sql); |
| 541 | 541 | } |
| 542 | 542 | } |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
| 565 | 565 | $sql = "SELECT * FROM $course_user_table |
| 566 | 566 | WHERE |
| 567 | - user_id = '" . $user_id . "' AND |
|
| 568 | - relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND |
|
| 567 | + user_id = '".$user_id."' AND |
|
| 568 | + relation_type <> " . COURSE_RELATION_TYPE_RRHH." AND |
|
| 569 | 569 | course_code = '$course_id'"; |
| 570 | 570 | $result = Database::query($sql); |
| 571 | 571 | |
@@ -585,8 +585,8 @@ discard block |
||
| 585 | 585 | $session_id |
| 586 | 586 | ); |
| 587 | 587 | if (!$user_is_subscribed) { |
| 588 | - $url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $_course['code'] . '&session_id=' . $session_id; |
|
| 589 | - header('Location: ' . $url); |
|
| 588 | + $url = api_get_path(WEB_CODE_PATH).'course_info/legal.php?course_code='.$_course['code'].'&session_id='.$session_id; |
|
| 589 | + header('Location: '.$url); |
|
| 590 | 590 | exit; |
| 591 | 591 | } |
| 592 | 592 | } |
@@ -627,11 +627,11 @@ discard block |
||
| 627 | 627 | } else { |
| 628 | 628 | //Im a coach or a student? |
| 629 | 629 | $sql = "SELECT user_id, status |
| 630 | - FROM " . $tbl_session_course_user . " |
|
| 630 | + FROM " . $tbl_session_course_user." |
|
| 631 | 631 | WHERE |
| 632 | 632 | c_id = '$_cid' AND |
| 633 | - user_id = '" . $user_id . "' AND |
|
| 634 | - session_id = '" . $session_id . "' |
|
| 633 | + user_id = '".$user_id."' AND |
|
| 634 | + session_id = '" . $session_id."' |
|
| 635 | 635 | LIMIT 1"; |
| 636 | 636 | $result = Database::query($sql); |
| 637 | 637 | |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | if ($reset) { // session data refresh requested |
| 778 | 778 | if ($group_id && $_cid && !empty($_course['real_id'])) { // have keys to search data |
| 779 | 779 | $group_table = Database::get_course_table(TABLE_GROUP); |
| 780 | - $sql = "SELECT * FROM $group_table WHERE c_id = " . $_course['real_id'] . " AND id = '$group_id'"; |
|
| 780 | + $sql = "SELECT * FROM $group_table WHERE c_id = ".$_course['real_id']." AND id = '$group_id'"; |
|
| 781 | 781 | $result = Database::query($sql); |
| 782 | 782 | if (Database::num_rows($result) > 0) { // This group has recorded status related to this course |
| 783 | 783 | $gpData = Database::fetch_array($result); |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | */ |
| 831 | 831 | public static function get_user_accounts_by_username($username) |
| 832 | 832 | { |
| 833 | - if (strpos($username,'@')){ |
|
| 833 | + if (strpos($username, '@')) { |
|
| 834 | 834 | $username = api_strtolower($username); |
| 835 | 835 | $email = true; |
| 836 | 836 | } else { |
@@ -852,14 +852,14 @@ discard block |
||
| 852 | 852 | $email = false; |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - if ($email) { |
|
| 856 | - $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
| 857 | - } else { |
|
| 855 | + if ($email) { |
|
| 856 | + $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
| 857 | + } else { |
|
| 858 | 858 | $condition = "LOWER(username) = '".Database::escape_string($username)."'"; |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 862 | - $query = "SELECT |
|
| 861 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 862 | + $query = "SELECT |
|
| 863 | 863 | user_id AS uid, |
| 864 | 864 | lastname AS lastName, |
| 865 | 865 | firstname AS firstName, |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | auth_source |
| 875 | 875 | FROM $tbl_user |
| 876 | 876 | WHERE ( $condition AND active = 1) "; |
| 877 | - $result = Database::query($query); |
|
| 877 | + $result = Database::query($query); |
|
| 878 | 878 | $num_rows = Database::num_rows($result); |
| 879 | 879 | if ($result && $num_rows > 0) { |
| 880 | 880 | return Database::fetch_assoc($result); |
@@ -616,6 +616,8 @@ discard block |
||
| 616 | 616 | * @param int message id |
| 617 | 617 | * @param int message user id (receiver user id or sender user id) |
| 618 | 618 | * @param int group id (optional) |
| 619 | + * @param integer $message_id |
|
| 620 | + * @param integer $message_uid |
|
| 619 | 621 | * @return void |
| 620 | 622 | */ |
| 621 | 623 | public static function delete_message_attachment_file($message_id, $message_uid, $group_id = 0) |
@@ -660,7 +662,7 @@ discard block |
||
| 660 | 662 | * update messages by user id and message id |
| 661 | 663 | * @param int $user_id |
| 662 | 664 | * @param int $message_id |
| 663 | - * @return resource |
|
| 665 | + * @return false|null |
|
| 664 | 666 | */ |
| 665 | 667 | public static function update_message($user_id, $message_id) |
| 666 | 668 | { |
@@ -680,7 +682,7 @@ discard block |
||
| 680 | 682 | * @param int $user_id |
| 681 | 683 | * @param int $message_id |
| 682 | 684 | * @param string $type |
| 683 | - * @return bool |
|
| 685 | + * @return false|null |
|
| 684 | 686 | */ |
| 685 | 687 | public static function update_message_status($user_id, $message_id,$type) |
| 686 | 688 | { |
@@ -717,6 +719,7 @@ discard block |
||
| 717 | 719 | /** |
| 718 | 720 | * get messages by group id |
| 719 | 721 | * @param int group id |
| 722 | + * @param integer $group_id |
|
| 720 | 723 | * @return array |
| 721 | 724 | */ |
| 722 | 725 | public static function get_messages_by_group($group_id) |
@@ -1433,7 +1436,7 @@ discard block |
||
| 1433 | 1436 | * Sort date by desc from a multi-dimensional array |
| 1434 | 1437 | * @param array $array1 first array to compare |
| 1435 | 1438 | * @param array $array2 second array to compare |
| 1436 | - * @return bool |
|
| 1439 | + * @return integer |
|
| 1437 | 1440 | */ |
| 1438 | 1441 | public function order_desc_date($array1, $array2) |
| 1439 | 1442 | { |
@@ -1511,7 +1514,6 @@ discard block |
||
| 1511 | 1514 | /** |
| 1512 | 1515 | * @param $id |
| 1513 | 1516 | * @param array $params |
| 1514 | - * @param string $display |
|
| 1515 | 1517 | * @return string |
| 1516 | 1518 | */ |
| 1517 | 1519 | public static function generate_invitation_form($id, $params = array()) |
@@ -143,8 +143,9 @@ discard block |
||
| 143 | 143 | $direction = 'DESC'; |
| 144 | 144 | } else { |
| 145 | 145 | $column = intval($column); |
| 146 | - if (!in_array($direction, array('ASC', 'DESC'))) |
|
| 147 | - $direction = 'ASC'; |
|
| 146 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
| 147 | + $direction = 'ASC'; |
|
| 148 | + } |
|
| 148 | 149 | } |
| 149 | 150 | |
| 150 | 151 | $keyword = Session::read('message_search_keyword'); |
@@ -697,8 +698,9 @@ discard block |
||
| 697 | 698 | */ |
| 698 | 699 | public static function update_message($user_id, $message_id) |
| 699 | 700 | { |
| 700 | - if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) |
|
| 701 | - return false; |
|
| 701 | + if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) { |
|
| 702 | + return false; |
|
| 703 | + } |
|
| 702 | 704 | |
| 703 | 705 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
| 704 | 706 | $sql = "UPDATE $table_message SET msg_status = '0' |
@@ -738,8 +740,9 @@ discard block |
||
| 738 | 740 | */ |
| 739 | 741 | public static function get_message_by_user($user_id, $message_id) |
| 740 | 742 | { |
| 741 | - if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) |
|
| 742 | - return false; |
|
| 743 | + if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) { |
|
| 744 | + return false; |
|
| 745 | + } |
|
| 743 | 746 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
| 744 | 747 | $query = "SELECT * FROM $table_message |
| 745 | 748 | WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'"; |
@@ -864,8 +867,9 @@ discard block |
||
| 864 | 867 | */ |
| 865 | 868 | public static function exist_message($user_id, $id) |
| 866 | 869 | { |
| 867 | - if ($id != strval(intval($id)) || $user_id != strval(intval($user_id))) |
|
| 868 | - return false; |
|
| 870 | + if ($id != strval(intval($id)) || $user_id != strval(intval($user_id))) { |
|
| 871 | + return false; |
|
| 872 | + } |
|
| 869 | 873 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
| 870 | 874 | $query = "SELECT id FROM $table_message |
| 871 | 875 | WHERE |
@@ -896,8 +900,9 @@ discard block |
||
| 896 | 900 | $direction = 'DESC'; |
| 897 | 901 | } else { |
| 898 | 902 | $column = intval($column); |
| 899 | - if (!in_array($direction, array('ASC', 'DESC'))) |
|
| 900 | - $direction = 'ASC'; |
|
| 903 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
| 904 | + $direction = 'ASC'; |
|
| 905 | + } |
|
| 901 | 906 | } |
| 902 | 907 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
| 903 | 908 | $request = api_is_xml_http_request(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | $sql = "SELECT * FROM $table |
| 27 | 27 | WHERE |
| 28 | - user_receiver_id=" . api_get_user_id() . " AND |
|
| 28 | + user_receiver_id=".api_get_user_id()." AND |
|
| 29 | 29 | msg_status=" . MESSAGE_STATUS_UNREAD; |
| 30 | 30 | $result = Database::query($sql); |
| 31 | 31 | $i = Database::num_rows($result); |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
| 57 | 57 | if ($unread) { |
| 58 | - $condition_msg_status = ' msg_status = ' . MESSAGE_STATUS_UNREAD . ' '; |
|
| 58 | + $condition_msg_status = ' msg_status = '.MESSAGE_STATUS_UNREAD.' '; |
|
| 59 | 59 | } else { |
| 60 | - $condition_msg_status = ' msg_status IN(' . MESSAGE_STATUS_NEW . ',' . MESSAGE_STATUS_UNREAD . ') '; |
|
| 60 | + $condition_msg_status = ' msg_status IN('.MESSAGE_STATUS_NEW.','.MESSAGE_STATUS_UNREAD.') '; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $keyword = Session::read('message_search_keyword'); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $sql = "SELECT COUNT(*) as number_messages |
| 71 | 71 | FROM $table_message |
| 72 | 72 | WHERE $condition_msg_status AND |
| 73 | - user_receiver_id=" . api_get_user_id() . " |
|
| 73 | + user_receiver_id=".api_get_user_id()." |
|
| 74 | 74 | $keywordCondition |
| 75 | 75 | "; |
| 76 | 76 | $result = Database::query($sql); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $sql = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3, msg_status as col4 |
| 113 | 113 | FROM $table_message |
| 114 | 114 | WHERE |
| 115 | - user_receiver_id=" . api_get_user_id() . " AND |
|
| 115 | + user_receiver_id=".api_get_user_id()." AND |
|
| 116 | 116 | msg_status IN (0,1) |
| 117 | 117 | $keywordCondition |
| 118 | 118 | ORDER BY col$column $direction |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | $link = '&f=social'; |
| 138 | 138 | } |
| 139 | 139 | $userInfo = api_get_user_info($result[1]); |
| 140 | - $message[1] = '<a ' . $class . ' href="view_message.php?id=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name']; |
|
| 141 | - $message[3] = '<a href="new_message.php?re_id=' . $result[0] . $link . '">' . |
|
| 142 | - Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a>' . |
|
| 143 | - ' <a onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" href="inbox.php?action=deleteone&id=' . $result[0] . $link . '">' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>'; |
|
| 140 | + $message[1] = '<a '.$class.' href="view_message.php?id='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name']; |
|
| 141 | + $message[3] = '<a href="new_message.php?re_id='.$result[0].$link.'">'. |
|
| 142 | + Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a>'. |
|
| 143 | + ' <a onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" href="inbox.php?action=deleteone&id='.$result[0].$link.'">'.Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>'; |
|
| 144 | 144 | |
| 145 | 145 | $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same |
| 146 | 146 | foreach ($message as $key => $value) { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | //@todo it's possible to edit a message? yes, only for groups |
| 243 | 243 | if ($edit_message_id) { |
| 244 | 244 | $query = " UPDATE $table_message SET |
| 245 | - update_date = '" . $now . "', |
|
| 245 | + update_date = '".$now."', |
|
| 246 | 246 | content = '$clean_content' |
| 247 | 247 | WHERE id = '$edit_message_id' "; |
| 248 | 248 | Database::query($query); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $message = sprintf( |
| 414 | 414 | get_lang('CopyOfMessageSentToXUser'), |
| 415 | 415 | $userInfo['complete_name'] |
| 416 | - ) . ' <br />' . $message; |
|
| 416 | + ).' <br />'.$message; |
|
| 417 | 417 | |
| 418 | 418 | MessageManager::send_message_simple( |
| 419 | 419 | $drhInfo['user_id'], |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $row = Database::fetch_array($rs_msg_id); |
| 462 | 462 | |
| 463 | 463 | // update parent_id for other user receiver |
| 464 | - $sql = "UPDATE $table_message SET parent_id = " . $row['id'] . " |
|
| 464 | + $sql = "UPDATE $table_message SET parent_id = ".$row['id']." |
|
| 465 | 465 | WHERE id = $message_id"; |
| 466 | 466 | Database::query($sql); |
| 467 | 467 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | $user_receiver_id = intval($user_receiver_id); |
| 481 | 481 | $id = intval($id); |
| 482 | 482 | $sql = "SELECT * FROM $table_message |
| 483 | - WHERE id=" . $id . " AND msg_status<>4"; |
|
| 483 | + WHERE id=".$id." AND msg_status<>4"; |
|
| 484 | 484 | $rs = Database::query($sql); |
| 485 | 485 | |
| 486 | 486 | if (Database::num_rows($rs) > 0) { |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | self::delete_message_attachment_file($id, $user_receiver_id); |
| 489 | 489 | // delete message |
| 490 | 490 | $query = "UPDATE $table_message SET msg_status=3 |
| 491 | - WHERE user_receiver_id=" . $user_receiver_id . " AND id=" . $id; |
|
| 491 | + WHERE user_receiver_id=".$user_receiver_id." AND id=".$id; |
|
| 492 | 492 | $result = Database::query($query); |
| 493 | 493 | |
| 494 | 494 | return $result; |
@@ -576,13 +576,13 @@ discard block |
||
| 576 | 576 | $path_user_info['dir'] = UserManager::getUserPathById($message_user_id, 'system'); |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - $path_message_attach = $path_user_info['dir'] . 'message_attachments/'; |
|
| 579 | + $path_message_attach = $path_user_info['dir'].'message_attachments/'; |
|
| 580 | 580 | |
| 581 | 581 | // If this directory does not exist - we create it. |
| 582 | 582 | if (!file_exists($path_message_attach)) { |
| 583 | 583 | @mkdir($path_message_attach, api_get_permissions_for_new_directories(), true); |
| 584 | 584 | } |
| 585 | - $new_path = $path_message_attach . $new_file_name; |
|
| 585 | + $new_path = $path_message_attach.$new_file_name; |
|
| 586 | 586 | if (is_uploaded_file($file_attach['tmp_name'])) { |
| 587 | 587 | @copy($file_attach['tmp_name'], $new_path); |
| 588 | 588 | } |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | while ($row = Database::fetch_array($rs)) { |
| 618 | 618 | $path = $row['path']; |
| 619 | 619 | $attach_id = $row['id']; |
| 620 | - $new_path = $path . '_DELETED_' . $attach_id; |
|
| 620 | + $new_path = $path.'_DELETED_'.$attach_id; |
|
| 621 | 621 | |
| 622 | 622 | if (!empty($group_id)) { |
| 623 | 623 | $userGroup = new UserGroup(); |
@@ -633,9 +633,9 @@ discard block |
||
| 633 | 633 | ); |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - $path_message_attach = $path_user_info['dir'] . 'message_attachments/'; |
|
| 637 | - if (is_file($path_message_attach . $path)) { |
|
| 638 | - if (rename($path_message_attach . $path, $path_message_attach . $new_path)) { |
|
| 636 | + $path_message_attach = $path_user_info['dir'].'message_attachments/'; |
|
| 637 | + if (is_file($path_message_attach.$path)) { |
|
| 638 | + if (rename($path_message_attach.$path, $path_message_attach.$new_path)) { |
|
| 639 | 639 | $sql = "UPDATE $table_message_attach set path='$new_path' |
| 640 | 640 | WHERE id ='$attach_id'"; |
| 641 | 641 | Database::query($sql); |
@@ -659,8 +659,8 @@ discard block |
||
| 659 | 659 | $sql = "UPDATE $table_message SET msg_status = '0' |
| 660 | 660 | WHERE |
| 661 | 661 | msg_status<>4 AND |
| 662 | - user_receiver_id=" . intval($user_id) . " AND |
|
| 663 | - id='" . intval($message_id) . "'"; |
|
| 662 | + user_receiver_id=".intval($user_id)." AND |
|
| 663 | + id='" . intval($message_id)."'"; |
|
| 664 | 664 | Database::query($sql); |
| 665 | 665 | } |
| 666 | 666 | |
@@ -680,8 +680,8 @@ discard block |
||
| 680 | 680 | $sql = "UPDATE $table_message SET |
| 681 | 681 | msg_status = '$type' |
| 682 | 682 | WHERE |
| 683 | - user_receiver_id=" . intval($user_id) . " AND |
|
| 684 | - id='" . intval($message_id) . "'"; |
|
| 683 | + user_receiver_id=".intval($user_id)." AND |
|
| 684 | + id='" . intval($message_id)."'"; |
|
| 685 | 685 | Database::query($sql); |
| 686 | 686 | } |
| 687 | 687 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | return false; |
| 698 | 698 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
| 699 | 699 | $query = "SELECT * FROM $table_message |
| 700 | - WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'"; |
|
| 700 | + WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'"; |
|
| 701 | 701 | $result = Database::query($query); |
| 702 | 702 | |
| 703 | 703 | return $row = Database::fetch_array($result); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $sql = "SELECT * FROM $table_message |
| 720 | 720 | WHERE |
| 721 | 721 | group_id= $group_id AND |
| 722 | - msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "') |
|
| 722 | + msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."') |
|
| 723 | 723 | ORDER BY id"; |
| 724 | 724 | $rs = Database::query($sql); |
| 725 | 725 | $data = array(); |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | $sql = "SELECT * FROM $table_message |
| 748 | 748 | WHERE |
| 749 | 749 | group_id = $group_id AND |
| 750 | - msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "') |
|
| 750 | + msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."') |
|
| 751 | 751 | ORDER BY id "; |
| 752 | 752 | |
| 753 | 753 | $rs = Database::query($sql); |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | $sql = "SELECT * FROM $table_message |
| 797 | 797 | WHERE |
| 798 | 798 | parent_id='$parent_id' AND |
| 799 | - msg_status <> " . MESSAGE_STATUS_OUTBOX . " |
|
| 799 | + msg_status <> ".MESSAGE_STATUS_OUTBOX." |
|
| 800 | 800 | $condition_group_id |
| 801 | 801 | ORDER BY send_date DESC $condition_limit "; |
| 802 | 802 | $rs = Database::query($sql); |
@@ -824,8 +824,8 @@ discard block |
||
| 824 | 824 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
| 825 | 825 | $query = "SELECT id FROM $table_message |
| 826 | 826 | WHERE |
| 827 | - user_receiver_id = " . intval($user_id) . " AND |
|
| 828 | - id = '" . intval($id) . "'"; |
|
| 827 | + user_receiver_id = ".intval($user_id)." AND |
|
| 828 | + id = '" . intval($id)."'"; |
|
| 829 | 829 | $result = Database::query($query); |
| 830 | 830 | $num = Database::num_rows($result); |
| 831 | 831 | if ($num > 0) { |
@@ -868,8 +868,8 @@ discard block |
||
| 868 | 868 | id as col0, user_sender_id as col1, title as col2, send_date as col3, user_receiver_id as col4, msg_status as col5 |
| 869 | 869 | FROM $table_message |
| 870 | 870 | WHERE |
| 871 | - user_sender_id=" . api_get_user_id() . " AND |
|
| 872 | - msg_status=" . MESSAGE_STATUS_OUTBOX . " |
|
| 871 | + user_sender_id=".api_get_user_id()." AND |
|
| 872 | + msg_status=" . MESSAGE_STATUS_OUTBOX." |
|
| 873 | 873 | $keywordCondition |
| 874 | 874 | ORDER BY col$column $direction |
| 875 | 875 | LIMIT $from, $number_of_items"; |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | $message_list = array(); |
| 879 | 879 | while ($result = Database::fetch_row($sql_result)) { |
| 880 | 880 | if ($request === true) { |
| 881 | - $message[0] = '<input type="checkbox" value=' . $result[0] . ' name="out[]">'; |
|
| 881 | + $message[0] = '<input type="checkbox" value='.$result[0].' name="out[]">'; |
|
| 882 | 882 | } else { |
| 883 | 883 | $message[0] = ($result[0]); |
| 884 | 884 | } |
@@ -886,20 +886,20 @@ discard block |
||
| 886 | 886 | $result[2] = Security::remove_XSS($result[2]); |
| 887 | 887 | $userInfo = api_get_user_info($result[4]); |
| 888 | 888 | if ($request === true) { |
| 889 | - $message[1] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . $userInfo['complete_name'] . '</a>'; |
|
| 890 | - $message[2] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . str_replace("\\", "", $result[2]) . '</a>'; |
|
| 889 | + $message[1] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.$userInfo['complete_name'].'</a>'; |
|
| 890 | + $message[2] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\", "", $result[2]).'</a>'; |
|
| 891 | 891 | $message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same |
| 892 | - $message[4] = ' <a onclick="delete_one_message_outbox(' . $result[0] . ')" href="javascript:void(0)" >' . |
|
| 893 | - Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>'; |
|
| 892 | + $message[4] = ' <a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)" >'. |
|
| 893 | + Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>'; |
|
| 894 | 894 | } else { |
| 895 | 895 | $link = ''; |
| 896 | 896 | if (isset($_GET['f']) && $_GET['f'] == 'social') { |
| 897 | 897 | $link = '&f=social'; |
| 898 | 898 | } |
| 899 | - $message[1] = '<a ' . $class . ' onclick="show_sent_message (' . $result[0] . ')" href="../messages/view_message.php?id_send=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name']; |
|
| 899 | + $message[1] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name']; |
|
| 900 | 900 | $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same |
| 901 | - $message[3] = '<a href="outbox.php?action=deleteone&id=' . $result[0] . '&' . $link . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" >' . |
|
| 902 | - Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>'; |
|
| 901 | + $message[3] = '<a href="outbox.php?action=deleteone&id='.$result[0].'&'.$link.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" >'. |
|
| 902 | + Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>'; |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | foreach ($message as $key => $value) { |
@@ -931,8 +931,8 @@ discard block |
||
| 931 | 931 | |
| 932 | 932 | $sql = "SELECT COUNT(*) as number_messages FROM $table_message |
| 933 | 933 | WHERE |
| 934 | - msg_status=" . MESSAGE_STATUS_OUTBOX . " AND |
|
| 935 | - user_sender_id=" . api_get_user_id() . " |
|
| 934 | + msg_status=".MESSAGE_STATUS_OUTBOX." AND |
|
| 935 | + user_sender_id=" . api_get_user_id()." |
|
| 936 | 936 | $keywordCondition |
| 937 | 937 | "; |
| 938 | 938 | $result = Database::query($sql); |
@@ -957,25 +957,25 @@ discard block |
||
| 957 | 957 | if (isset($message_id) && is_numeric($message_id)) { |
| 958 | 958 | $query = "SELECT * FROM $table_message |
| 959 | 959 | WHERE |
| 960 | - user_sender_id = " . api_get_user_id() . " AND |
|
| 961 | - id = " . $message_id . " AND |
|
| 960 | + user_sender_id = ".api_get_user_id()." AND |
|
| 961 | + id = " . $message_id." AND |
|
| 962 | 962 | msg_status = 4;"; |
| 963 | 963 | $result = Database::query($query); |
| 964 | 964 | } |
| 965 | 965 | } else { |
| 966 | 966 | if (is_numeric($message_id) && !empty($message_id)) { |
| 967 | 967 | $query = "UPDATE $table_message SET |
| 968 | - msg_status = '" . MESSAGE_STATUS_NEW . "' |
|
| 968 | + msg_status = '".MESSAGE_STATUS_NEW."' |
|
| 969 | 969 | WHERE |
| 970 | - user_receiver_id=" . api_get_user_id() . " AND |
|
| 971 | - id='" . $message_id . "'"; |
|
| 970 | + user_receiver_id=" . api_get_user_id()." AND |
|
| 971 | + id='" . $message_id."'"; |
|
| 972 | 972 | Database::query($query); |
| 973 | 973 | |
| 974 | 974 | $query = "SELECT * FROM $table_message |
| 975 | 975 | WHERE |
| 976 | 976 | msg_status<>4 AND |
| 977 | - user_receiver_id=" . api_get_user_id() . " AND |
|
| 978 | - id='" . $message_id . "'"; |
|
| 977 | + user_receiver_id=".api_get_user_id()." AND |
|
| 978 | + id='" . $message_id."'"; |
|
| 979 | 979 | $result = Database::query($query); |
| 980 | 980 | } |
| 981 | 981 | } |
@@ -1012,8 +1012,8 @@ discard block |
||
| 1012 | 1012 | $message_content .= '</div>'; |
| 1013 | 1013 | |
| 1014 | 1014 | $message_content .= '<div class="col-md-4">'; |
| 1015 | - $message_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> '; |
|
| 1016 | - $message_content .= api_strtolower(get_lang('To')) . ' <b>' . $receiverUserInfo['complete_name']; |
|
| 1015 | + $message_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> '; |
|
| 1016 | + $message_content .= api_strtolower(get_lang('To')).' <b>'.$receiverUserInfo['complete_name']; |
|
| 1017 | 1017 | $message_content .= '</div>'; |
| 1018 | 1018 | |
| 1019 | 1019 | $message_content .= '<div class="col-md-2 col-md-offset-5">'; |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | $message_content .= '</div>'; |
| 1027 | 1027 | |
| 1028 | 1028 | $message_content .= '<div class="col-md-4">'; |
| 1029 | - $message_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> '; |
|
| 1029 | + $message_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> '; |
|
| 1030 | 1030 | $message_content .= '</div>'; |
| 1031 | 1031 | |
| 1032 | 1032 | $message_content .= '<div class="col-md-2 col-md-offset-5">'; |
@@ -1036,9 +1036,9 @@ discard block |
||
| 1036 | 1036 | $message_content .= '</div>'; |
| 1037 | 1037 | } else { |
| 1038 | 1038 | if ($source == 'outbox') { |
| 1039 | - $message_content .= get_lang('From') . ': ' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . $receiverUserInfo['complete_name'] . '</b>'; |
|
| 1039 | + $message_content .= get_lang('From').': '.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.$receiverUserInfo['complete_name'].'</b>'; |
|
| 1040 | 1040 | } else { |
| 1041 | - $message_content .= get_lang('From') . ': ' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . get_lang('Me') . '</b>'; |
|
| 1041 | + $message_content .= get_lang('From').': '.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>'; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | } |
| 1044 | 1044 | $message_content .= ' |
@@ -1046,26 +1046,26 @@ discard block |
||
| 1046 | 1046 | <hr style="color:#ddd" /> |
| 1047 | 1047 | <table width="100%"> |
| 1048 | 1048 | <tr> |
| 1049 | - <td valign=top class="view-message-content">' . str_replace("\\", "", $content) . '</td> |
|
| 1049 | + <td valign=top class="view-message-content">' . str_replace("\\", "", $content).'</td> |
|
| 1050 | 1050 | </tr> |
| 1051 | 1051 | </table> |
| 1052 | - <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div> |
|
| 1052 | + <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div> |
|
| 1053 | 1053 | <div style="padding: 15px 0px 5px 0px">'; |
| 1054 | 1054 | $social_link = ''; |
| 1055 | 1055 | if (isset($_GET['f']) && $_GET['f'] == 'social') { |
| 1056 | 1056 | $social_link = 'f=social'; |
| 1057 | 1057 | } |
| 1058 | 1058 | if ($source == 'outbox') { |
| 1059 | - $message_content .= '<a href="outbox.php?' . $social_link . '">' . |
|
| 1060 | - Display::return_icon('back.png', get_lang('ReturnToOutbox')) . '</a>  '; |
|
| 1059 | + $message_content .= '<a href="outbox.php?'.$social_link.'">'. |
|
| 1060 | + Display::return_icon('back.png', get_lang('ReturnToOutbox')).'</a>  '; |
|
| 1061 | 1061 | } else { |
| 1062 | - $message_content .= '<a href="inbox.php?' . $social_link . '">' . |
|
| 1063 | - Display::return_icon('back.png', get_lang('ReturnToInbox')) . '</a>  '; |
|
| 1064 | - $message_content .= '<a href="new_message.php?re_id=' . $message_id . '&' . $social_link . '">' . |
|
| 1065 | - Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a>  '; |
|
| 1062 | + $message_content .= '<a href="inbox.php?'.$social_link.'">'. |
|
| 1063 | + Display::return_icon('back.png', get_lang('ReturnToInbox')).'</a>  '; |
|
| 1064 | + $message_content .= '<a href="new_message.php?re_id='.$message_id.'&'.$social_link.'">'. |
|
| 1065 | + Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a>  '; |
|
| 1066 | 1066 | } |
| 1067 | - $message_content .= '<a href="inbox.php?action=deleteone&id=' . $message_id . '&' . $social_link . '" >' . |
|
| 1068 | - Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a> '; |
|
| 1067 | + $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'. |
|
| 1068 | + Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a> '; |
|
| 1069 | 1069 | |
| 1070 | 1070 | $message_content .= '</div></td> |
| 1071 | 1071 | <td width=10></td> |
@@ -1083,8 +1083,8 @@ discard block |
||
| 1083 | 1083 | public static function get_user_id_by_email($user_email) |
| 1084 | 1084 | { |
| 1085 | 1085 | $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
| 1086 | - $sql = 'SELECT user_id FROM ' . $tbl_user . ' |
|
| 1087 | - WHERE email="' . Database::escape_string($user_email) . '";'; |
|
| 1086 | + $sql = 'SELECT user_id FROM '.$tbl_user.' |
|
| 1087 | + WHERE email="' . Database::escape_string($user_email).'";'; |
|
| 1088 | 1088 | $rs = Database::query($sql); |
| 1089 | 1089 | $row = Database::fetch_array($rs, 'ASSOC'); |
| 1090 | 1090 | if (isset($row['user_id'])) { |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | |
| 1146 | 1146 | $items = $topic['count']; |
| 1147 | 1147 | $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies'); |
| 1148 | - $label = '<i class="fa fa-envelope"></i> ' . $items . ' ' . $reply_label; |
|
| 1148 | + $label = '<i class="fa fa-envelope"></i> '.$items.' '.$reply_label; |
|
| 1149 | 1149 | $topic['title'] = trim($topic['title']); |
| 1150 | 1150 | |
| 1151 | 1151 | if (empty($topic['title'])) { |
@@ -1157,31 +1157,31 @@ discard block |
||
| 1157 | 1157 | 'h4', |
| 1158 | 1158 | Display::url( |
| 1159 | 1159 | Security::remove_XSS($topic['title'], STUDENT, true), |
| 1160 | - api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $group_id . '&topic_id=' . $topic['id'] |
|
| 1160 | + api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$group_id.'&topic_id='.$topic['id'] |
|
| 1161 | 1161 | ), array('class' => 'title') |
| 1162 | 1162 | ); |
| 1163 | 1163 | $actions = ''; |
| 1164 | 1164 | if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || |
| 1165 | 1165 | $my_group_role == GROUP_USER_PERMISSION_MODERATOR |
| 1166 | 1166 | ) { |
| 1167 | - $actions = '<br />' . Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic['id'], array('class' => 'btn btn-default')); |
|
| 1167 | + $actions = '<br />'.Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH).'social/group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic['id'], array('class' => 'btn btn-default')); |
|
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | $date = ''; |
| 1171 | 1171 | if ($topic['send_date'] != $topic['update_date']) { |
| 1172 | 1172 | if (!empty($topic['update_date'])) { |
| 1173 | - $date .= '<i class="fa fa-calendar"></i> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']); |
|
| 1173 | + $date .= '<i class="fa fa-calendar"></i> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | } else { |
| 1176 | - $date .= '<i class="fa fa-calendar"></i> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']); |
|
| 1176 | + $date .= '<i class="fa fa-calendar"></i> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']); |
|
| 1177 | 1177 | } |
| 1178 | - $html .= '<div class="date">' . $label . ' - ' . $date . $actions . '</div>'; |
|
| 1178 | + $html .= '<div class="date">'.$label.' - '.$date.$actions.'</div>'; |
|
| 1179 | 1179 | $html .= '</div>'; |
| 1180 | 1180 | |
| 1181 | 1181 | $image = $user_sender_info['avatar']; |
| 1182 | 1182 | |
| 1183 | - $user_info = '<div class="author"><img class="img-responsive img-circle" src="' . $image . '" alt="' . $name . '" width="64" height="64" title="' . $name . '" /></div>'; |
|
| 1184 | - $user_info .= '<div class="name"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . ' </a></div>'; |
|
| 1183 | + $user_info = '<div class="author"><img class="img-responsive img-circle" src="'.$image.'" alt="'.$name.'" width="64" height="64" title="'.$name.'" /></div>'; |
|
| 1184 | + $user_info .= '<div class="name"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.' </a></div>'; |
|
| 1185 | 1185 | |
| 1186 | 1186 | $html .= '<div class="col-xs-4 col-md-2">'; |
| 1187 | 1187 | $html .= $user_info; |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | 'group_id' => $group_id, |
| 1260 | 1260 | 'message_id' => $main_message['id'], |
| 1261 | 1261 | 'action' => 'edit_message_group', |
| 1262 | - 'anchor_topic' => 'topic_' . $main_message['id'], |
|
| 1262 | + 'anchor_topic' => 'topic_'.$main_message['id'], |
|
| 1263 | 1263 | 'topics_page_nr' => $topic_page_nr, |
| 1264 | 1264 | 'items_page_nr' => $items_page_nr, |
| 1265 | 1265 | 'topic_id' => $main_message['id'] |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | if (api_is_platform_admin()) { |
| 1268 | 1268 | $links .= Display::url( |
| 1269 | 1269 | Display::returnFontAwesomeIcon('trash'), |
| 1270 | - 'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id, |
|
| 1270 | + 'group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic_id, |
|
| 1271 | 1271 | [ |
| 1272 | 1272 | 'class' => 'btn btn-default' |
| 1273 | 1273 | ] |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | 'group_id' => $group_id, |
| 1293 | 1293 | 'message_id' => $main_message['id'], |
| 1294 | 1294 | 'action' => 'reply_message_group', |
| 1295 | - 'anchor_topic' => 'topic_' . $main_message['id'], |
|
| 1295 | + 'anchor_topic' => 'topic_'.$main_message['id'], |
|
| 1296 | 1296 | 'topics_page_nr' => $topic_page_nr, |
| 1297 | 1297 | 'topic_id' => $main_message['id'] |
| 1298 | 1298 | ]); |
@@ -1310,36 +1310,36 @@ discard block |
||
| 1310 | 1310 | $links .= '</div>'; |
| 1311 | 1311 | $links .= '</div>'; |
| 1312 | 1312 | |
| 1313 | - $title = '<h4>' . Security::remove_XSS($main_message['title'], STUDENT, true) . $links . '</h4>'; |
|
| 1313 | + $title = '<h4>'.Security::remove_XSS($main_message['title'], STUDENT, true).$links.'</h4>'; |
|
| 1314 | 1314 | |
| 1315 | 1315 | $userPicture = $user_sender_info['avatar']; |
| 1316 | 1316 | $main_content .= '<div class="row">'; |
| 1317 | 1317 | $main_content .= '<div class="col-md-2">'; |
| 1318 | 1318 | $main_content .= '<div class="avatar-author">'; |
| 1319 | - $main_content .= '<img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" />'; |
|
| 1319 | + $main_content .= '<img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" />'; |
|
| 1320 | 1320 | $main_content .= '</div>'; |
| 1321 | 1321 | $main_content .= '</div>'; |
| 1322 | 1322 | |
| 1323 | 1323 | $date = ''; |
| 1324 | 1324 | if ($main_message['send_date'] != $main_message['update_date']) { |
| 1325 | 1325 | if (!empty($main_message['update_date'])) { |
| 1326 | - $date = '<div class="date"> '. Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>'; |
|
| 1326 | + $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($main_message['update_date']).'</div>'; |
|
| 1327 | 1327 | } |
| 1328 | 1328 | } else { |
| 1329 | - $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>'; |
|
| 1329 | + $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>'; |
|
| 1330 | 1330 | } |
| 1331 | - $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; |
|
| 1331 | + $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>'; |
|
| 1332 | 1332 | $main_content .= '<div class="col-md-10">'; |
| 1333 | - $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . '</a>'; |
|
| 1333 | + $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'</a>'; |
|
| 1334 | 1334 | $main_content .= '<div class="message-content"> '; |
| 1335 | - $main_content .= '<div class="username">' . $user_link . '</div>'; |
|
| 1336 | - $main_content .= $date ; |
|
| 1337 | - $main_content .= '<div class="message">'. $main_message['content'] . $attachment . '</div></div>'; |
|
| 1335 | + $main_content .= '<div class="username">'.$user_link.'</div>'; |
|
| 1336 | + $main_content .= $date; |
|
| 1337 | + $main_content .= '<div class="message">'.$main_message['content'].$attachment.'</div></div>'; |
|
| 1338 | 1338 | $main_content .= '</div>'; |
| 1339 | 1339 | $main_content .= '</div>'; |
| 1340 | 1340 | //$main_content = Security::remove_XSS($main_content, STUDENT, true); |
| 1341 | 1341 | |
| 1342 | - $html .= Display::div(Display::div($title . $main_content, array('class' => 'message-topic')), array('class' => 'sm-groups-message')); |
|
| 1342 | + $html .= Display::div(Display::div($title.$main_content, array('class' => 'message-topic')), array('class' => 'sm-groups-message')); |
|
| 1343 | 1343 | |
| 1344 | 1344 | $topic_id = $main_message['id']; |
| 1345 | 1345 | |
@@ -1350,7 +1350,7 @@ discard block |
||
| 1350 | 1350 | if (empty($topic['id'])) { |
| 1351 | 1351 | continue; |
| 1352 | 1352 | } |
| 1353 | - $items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null; |
|
| 1353 | + $items_page_nr = isset($_GET['items_'.$topic['id'].'_page_nr']) ? intval($_GET['items_'.$topic['id'].'_page_nr']) : null; |
|
| 1354 | 1354 | $links = ''; |
| 1355 | 1355 | $links .= '<div class="pull-right">'; |
| 1356 | 1356 | $html_items = ''; |
@@ -1360,36 +1360,36 @@ discard block |
||
| 1360 | 1360 | |
| 1361 | 1361 | $links .= '<div class="btn-group btn-group-sm">'; |
| 1362 | 1362 | if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) { |
| 1363 | - $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Edit') . '" title="' . get_lang('Edit') . '">' . |
|
| 1364 | - Display::returnFontAwesomeIcon('pencil') . '</a>'; |
|
| 1363 | + $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'. |
|
| 1364 | + Display::returnFontAwesomeIcon('pencil').'</a>'; |
|
| 1365 | 1365 | } |
| 1366 | - $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Reply') . '" title="' . get_lang('Reply') . '">'; |
|
| 1367 | - $links .= Display::returnFontAwesomeIcon('commenting') . '</a>'; |
|
| 1366 | + $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">'; |
|
| 1367 | + $links .= Display::returnFontAwesomeIcon('commenting').'</a>'; |
|
| 1368 | 1368 | $links .= '</div>'; |
| 1369 | 1369 | $links .= '</div>'; |
| 1370 | 1370 | |
| 1371 | 1371 | $userPicture = $user_sender_info['avatar']; |
| 1372 | - $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . ' </a>'; |
|
| 1372 | + $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.' </a>'; |
|
| 1373 | 1373 | $html_items .= '<div class="row">'; |
| 1374 | 1374 | $html_items .= '<div class="col-md-2">'; |
| 1375 | - $html_items .= '<div class="avatar-author"><img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" /></div>'; |
|
| 1375 | + $html_items .= '<div class="avatar-author"><img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" /></div>'; |
|
| 1376 | 1376 | $html_items .= '</div>'; |
| 1377 | 1377 | |
| 1378 | 1378 | $date = ''; |
| 1379 | 1379 | if ($topic['send_date'] != $topic['update_date']) { |
| 1380 | 1380 | if (!empty($topic['update_date'])) { |
| 1381 | - $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' '. get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>'; |
|
| 1381 | + $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</div>'; |
|
| 1382 | 1382 | } |
| 1383 | 1383 | } else { |
| 1384 | - $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>'; |
|
| 1384 | + $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>'; |
|
| 1385 | 1385 | } |
| 1386 | - $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; |
|
| 1386 | + $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>'; |
|
| 1387 | 1387 | $html_items .= '<div class="col-md-10">'; |
| 1388 | 1388 | $html_items .= '<div class="message-content">'; |
| 1389 | 1389 | $html_items .= $links; |
| 1390 | - $html_items .= '<div class="username">' . $user_link . '</div>'; |
|
| 1390 | + $html_items .= '<div class="username">'.$user_link.'</div>'; |
|
| 1391 | 1391 | $html_items .= $date; |
| 1392 | - $html_items .= '<div class="message">' . Security::remove_XSS($topic['content'], STUDENT, true) . '</div>' . $attachment . '</div>'; |
|
| 1392 | + $html_items .= '<div class="message">'.Security::remove_XSS($topic['content'], STUDENT, true).'</div>'.$attachment.'</div>'; |
|
| 1393 | 1393 | $html_items .= '</div>'; |
| 1394 | 1394 | $html_items .= '</div>'; |
| 1395 | 1395 | |
@@ -1401,8 +1401,8 @@ discard block |
||
| 1401 | 1401 | $indent = intval($topic['indent_cnt']) * $base_padding + $base_padding; |
| 1402 | 1402 | } |
| 1403 | 1403 | |
| 1404 | - $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_' . $topic['id'])); |
|
| 1405 | - $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:' . $indent . 'px')); |
|
| 1404 | + $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_'.$topic['id'])); |
|
| 1405 | + $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:'.$indent.'px')); |
|
| 1406 | 1406 | $array_html_items[] = array($html_items); |
| 1407 | 1407 | } |
| 1408 | 1408 | // grids for items with paginations |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | ); |
| 1416 | 1416 | if (!empty($array_html_items)) { |
| 1417 | 1417 | $html .= Display::return_sortable_grid( |
| 1418 | - 'items_' . $topic['id'], |
|
| 1418 | + 'items_'.$topic['id'], |
|
| 1419 | 1419 | array(), |
| 1420 | 1420 | $array_html_items, |
| 1421 | 1421 | $options, |
@@ -1505,14 +1505,14 @@ discard block |
||
| 1505 | 1505 | $rs_file = Database::query($sql); |
| 1506 | 1506 | if (Database::num_rows($rs_file) > 0) { |
| 1507 | 1507 | $attach_icon = Display::return_icon('attachment.gif', ''); |
| 1508 | - $archiveURL = api_get_path(WEB_CODE_PATH) . 'messages/download.php?type=' . $type . '&file='; |
|
| 1508 | + $archiveURL = api_get_path(WEB_CODE_PATH).'messages/download.php?type='.$type.'&file='; |
|
| 1509 | 1509 | while ($row_file = Database::fetch_array($rs_file)) { |
| 1510 | 1510 | $archiveFile = $row_file['path']; |
| 1511 | 1511 | $filename = $row_file['filename']; |
| 1512 | 1512 | $filesize = format_file_size($row_file['size']); |
| 1513 | 1513 | $filecomment = Security::remove_XSS($row_file['comment']); |
| 1514 | 1514 | $filename = Security::remove_XSS($filename); |
| 1515 | - $links_attach_file[] = $attach_icon . ' <a href="' . $archiveURL . $archiveFile . '">' . $filename . '</a> (' . $filesize . ')' . (!empty($filecomment) ? ' - <i>' . $filecomment . '</i>' : ''); |
|
| 1515 | + $links_attach_file[] = $attach_icon.' <a href="'.$archiveURL.$archiveFile.'">'.$filename.'</a> ('.$filesize.')'.(!empty($filecomment) ? ' - <i>'.$filecomment.'</i>' : ''); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | } |
| 1518 | 1518 | } |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | $tbl_message = Database::get_main_table(TABLE_MESSAGE); |
| 1530 | 1530 | $message_id = intval($message_id); |
| 1531 | 1531 | $sql = "SELECT * FROM $tbl_message |
| 1532 | - WHERE id = '$message_id' AND msg_status <> '" . MESSAGE_STATUS_DELETED . "' "; |
|
| 1532 | + WHERE id = '$message_id' AND msg_status <> '".MESSAGE_STATUS_DELETED."' "; |
|
| 1533 | 1533 | $res = Database::query($sql); |
| 1534 | 1534 | $item = array(); |
| 1535 | 1535 | if (Database::num_rows($res) > 0) { |
@@ -1655,7 +1655,7 @@ discard block |
||
| 1655 | 1655 | |
| 1656 | 1656 | Session::write('message_sent_search_keyword', $keyword); |
| 1657 | 1657 | |
| 1658 | - $success = get_lang('SelectedMessagesDeleted') . ' </b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>'; |
|
| 1658 | + $success = get_lang('SelectedMessagesDeleted').' </b><br /><a href="outbox.php?'.$social_link.'">'.get_lang('BackToOutbox').'</a>'; |
|
| 1659 | 1659 | |
| 1660 | 1660 | $html = null; |
| 1661 | 1661 | if (isset($_REQUEST['action'])) { |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | ON m.user_sender_id = u.user_id |
| 1766 | 1766 | WHERE |
| 1767 | 1767 | m.user_receiver_id = $userId AND |
| 1768 | - m.msg_status = " . MESSAGE_STATUS_UNREAD . " |
|
| 1768 | + m.msg_status = ".MESSAGE_STATUS_UNREAD." |
|
| 1769 | 1769 | AND m.id > $lastId |
| 1770 | 1770 | ORDER BY m.send_date DESC"; |
| 1771 | 1771 | |
@@ -1836,11 +1836,11 @@ discard block |
||
| 1836 | 1836 | $tplMailBody = new Template(null, false, false, false, false, false, false); |
| 1837 | 1837 | $tplMailBody->assign('user', $user); |
| 1838 | 1838 | $tplMailBody->assign('is_western_name_order', api_is_western_name_order()); |
| 1839 | - $tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH) . 'admin/user_edit.php?user_id=' . $user->getId()); |
|
| 1839 | + $tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user->getId()); |
|
| 1840 | 1840 | |
| 1841 | 1841 | $layoutContent = $tplMailBody->get_template('mail/new_user_mail_to_admin.tpl'); |
| 1842 | 1842 | |
| 1843 | - $emailsubject = '[' . get_lang('UserRegistered') . '] ' . $user->getUsername(); |
|
| 1843 | + $emailsubject = '['.get_lang('UserRegistered').'] '.$user->getUsername(); |
|
| 1844 | 1844 | $emailbody = $tplMailBody->fetch($layoutContent); |
| 1845 | 1845 | |
| 1846 | 1846 | $admins = UserManager::get_all_administrators(); |
@@ -1871,8 +1871,8 @@ discard block |
||
| 1871 | 1871 | */ |
| 1872 | 1872 | public static function failedSentMailErrors() |
| 1873 | 1873 | { |
| 1874 | - $base = api_get_path(SYS_ARCHIVE_PATH) . 'mail/'; |
|
| 1875 | - $mailq = $base . 'mailq'; |
|
| 1874 | + $base = api_get_path(SYS_ARCHIVE_PATH).'mail/'; |
|
| 1875 | + $mailq = $base.'mailq'; |
|
| 1876 | 1876 | |
| 1877 | 1877 | if (!file_exists($mailq) || !is_readable($mailq)) { |
| 1878 | 1878 | return false; |
@@ -1893,7 +1893,7 @@ discard block |
||
| 1893 | 1893 | $mail_queue[$i]['code'] = $codeMatches[2]; |
| 1894 | 1894 | } |
| 1895 | 1895 | |
| 1896 | - $fullMail = $base . $mail_queue[$i]['code']; |
|
| 1896 | + $fullMail = $base.$mail_queue[$i]['code']; |
|
| 1897 | 1897 | $mailFile = fopen($fullMail, 'r'); |
| 1898 | 1898 | |
| 1899 | 1899 | //Get the reason of mail fail |
@@ -1916,7 +1916,7 @@ discard block |
||
| 1916 | 1916 | |
| 1917 | 1917 | //Get the time of mail fail |
| 1918 | 1918 | if (preg_match('/^\s?(\d+)(\D+)\s+(.*)$/', $line, $timeMatches)) { |
| 1919 | - $mail_queue[$i]['time'] = $timeMatches[1] . $timeMatches[2]; |
|
| 1919 | + $mail_queue[$i]['time'] = $timeMatches[1].$timeMatches[2]; |
|
| 1920 | 1920 | } elseif (preg_match('/^(\s+)((.*)@(.*))\s+(.*)$/', $line, $emailMatches)) { |
| 1921 | 1921 | $mail_queue[$i]['mail'] = $emailMatches[2]; |
| 1922 | 1922 | $i++; |