@@ -108,24 +108,24 @@ |
||
108 | 108 | */ |
109 | 109 | function utf8_sort($array) |
110 | 110 | { |
111 | - $old_locale = setlocale(LC_ALL, null); |
|
112 | - $code = api_get_language_isocode(); |
|
113 | - $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8'); |
|
114 | - $try_sort = false; |
|
111 | + $old_locale = setlocale(LC_ALL, null); |
|
112 | + $code = api_get_language_isocode(); |
|
113 | + $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8'); |
|
114 | + $try_sort = false; |
|
115 | 115 | |
116 | - foreach($locale_list as $locale) { |
|
117 | - $my_local = setlocale(LC_COLLATE, $locale); |
|
118 | - if ($my_local) { |
|
119 | - $try_sort = true; |
|
120 | - break; |
|
121 | - } |
|
122 | - } |
|
116 | + foreach($locale_list as $locale) { |
|
117 | + $my_local = setlocale(LC_COLLATE, $locale); |
|
118 | + if ($my_local) { |
|
119 | + $try_sort = true; |
|
120 | + break; |
|
121 | + } |
|
122 | + } |
|
123 | 123 | |
124 | - if ($try_sort) { |
|
125 | - uasort($array, 'strcoll'); |
|
126 | - } |
|
127 | - setlocale(LC_COLLATE, $old_locale); |
|
128 | - return $array; |
|
124 | + if ($try_sort) { |
|
125 | + uasort($array, 'strcoll'); |
|
126 | + } |
|
127 | + setlocale(LC_COLLATE, $old_locale); |
|
128 | + return $array; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | { |
16 | 16 | } |
17 | 17 | |
18 | - /** |
|
19 | - * Add a new Term and Condition |
|
20 | - * @param int $language language id |
|
21 | - * @param string $content content |
|
22 | - * @param int $type term and condition type (0 or 1) |
|
23 | - * @param string $changes explain changes |
|
24 | - * @return boolean success |
|
25 | - */ |
|
26 | - public static function add($language, $content, $type, $changes) |
|
18 | + /** |
|
19 | + * Add a new Term and Condition |
|
20 | + * @param int $language language id |
|
21 | + * @param string $content content |
|
22 | + * @param int $type term and condition type (0 or 1) |
|
23 | + * @param string $changes explain changes |
|
24 | + * @return boolean success |
|
25 | + */ |
|
26 | + public static function add($language, $content, $type, $changes) |
|
27 | 27 | { |
28 | 28 | $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
29 | 29 | $last = self::get_last_condition($language); |
@@ -60,62 +60,62 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - public static function delete($id) |
|
63 | + public static function delete($id) |
|
64 | 64 | { |
65 | - /* |
|
65 | + /* |
|
66 | 66 | $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
67 | 67 | $id = intval($id); |
68 | 68 | $sql = "DELETE FROM $legal_table WHERE legal_id = '".$id."'"; |
69 | 69 | */ |
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * Gets the last version of a Term and condition by language |
|
74 | - * @param int $language language id |
|
75 | - * @return array all the info of a Term and condition |
|
76 | - */ |
|
77 | - public static function get_last_condition_version($language) |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * Gets the last version of a Term and condition by language |
|
74 | + * @param int $language language id |
|
75 | + * @return array all the info of a Term and condition |
|
76 | + */ |
|
77 | + public static function get_last_condition_version($language) |
|
78 | 78 | { |
79 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
80 | - $language= Database::escape_string($language); |
|
81 | - $sql = "SELECT version FROM $legal_conditions_table |
|
79 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
80 | + $language= Database::escape_string($language); |
|
81 | + $sql = "SELECT version FROM $legal_conditions_table |
|
82 | 82 | WHERE language_id = '".$language."' |
83 | 83 | ORDER BY legal_id DESC LIMIT 1 "; |
84 | - $result = Database::query($sql); |
|
85 | - $row = Database::fetch_array($result); |
|
84 | + $result = Database::query($sql); |
|
85 | + $row = Database::fetch_array($result); |
|
86 | 86 | if (Database::num_rows($result) > 0) { |
87 | 87 | |
88 | - return $row['version']; |
|
89 | - } else { |
|
88 | + return $row['version']; |
|
89 | + } else { |
|
90 | 90 | |
91 | - return 0; |
|
92 | - } |
|
93 | - } |
|
91 | + return 0; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Gets the data of a Term and condition by language |
|
97 | - * @param int $language language id |
|
98 | - * @return array all the info of a Term and condition |
|
99 | - */ |
|
100 | - public static function get_last_condition ($language) |
|
95 | + /** |
|
96 | + * Gets the data of a Term and condition by language |
|
97 | + * @param int $language language id |
|
98 | + * @return array all the info of a Term and condition |
|
99 | + */ |
|
100 | + public static function get_last_condition ($language) |
|
101 | 101 | { |
102 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
103 | - $language= Database::escape_string($language); |
|
104 | - $sql = "SELECT * FROM $legal_conditions_table |
|
102 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
103 | + $language= Database::escape_string($language); |
|
104 | + $sql = "SELECT * FROM $legal_conditions_table |
|
105 | 105 | WHERE language_id = '".$language."' |
106 | 106 | ORDER BY version DESC |
107 | 107 | LIMIT 1 "; |
108 | - $result = Database::query($sql); |
|
108 | + $result = Database::query($sql); |
|
109 | 109 | |
110 | - return Database::fetch_array($result); |
|
111 | - } |
|
110 | + return Database::fetch_array($result); |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Gets the last version of a Term and condition by language |
|
115 | - * @param int $language language id |
|
116 | - * @return boolean | int the version or false if does not exist |
|
117 | - */ |
|
118 | - public static function get_last_version($language) |
|
113 | + /** |
|
114 | + * Gets the last version of a Term and condition by language |
|
115 | + * @param int $language language id |
|
116 | + * @return boolean | int the version or false if does not exist |
|
117 | + */ |
|
118 | + public static function get_last_version($language) |
|
119 | 119 | { |
120 | 120 | $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
121 | 121 | $language = intval($language); |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | |
134 | 134 | return false; |
135 | 135 | } |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | - /** |
|
139 | - * Show the last condition |
|
140 | - * @param array with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
138 | + /** |
|
139 | + * Show the last condition |
|
140 | + * @param array with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
141 | 141 | * |
142 | - * @return string html preview |
|
143 | - */ |
|
144 | - public static function show_last_condition($term_preview) |
|
142 | + * @return string html preview |
|
143 | + */ |
|
144 | + public static function show_last_condition($term_preview) |
|
145 | 145 | { |
146 | 146 | $preview = ''; |
147 | 147 | switch ($term_preview['type']) { |
@@ -167,80 +167,80 @@ discard block |
||
167 | 167 | default: |
168 | 168 | break; |
169 | 169 | } |
170 | - return $preview; |
|
171 | - } |
|
172 | - |
|
173 | - /** |
|
174 | - * Get the terms and condition table (only for maintenance) |
|
175 | - * @param int offset |
|
176 | - * @param int number of items |
|
177 | - * @param int column |
|
178 | - * @return array |
|
179 | - */ |
|
180 | - public static function get_legal_data($from, $number_of_items, $column) |
|
170 | + return $preview; |
|
171 | + } |
|
172 | + |
|
173 | + /** |
|
174 | + * Get the terms and condition table (only for maintenance) |
|
175 | + * @param int offset |
|
176 | + * @param int number of items |
|
177 | + * @param int column |
|
178 | + * @return array |
|
179 | + */ |
|
180 | + public static function get_legal_data($from, $number_of_items, $column) |
|
181 | 181 | { |
182 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
183 | - $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
184 | - $from = intval($from); |
|
185 | - $number_of_items = intval($number_of_items); |
|
186 | - $column = intval($column); |
|
182 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
183 | + $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
184 | + $from = intval($from); |
|
185 | + $number_of_items = intval($number_of_items); |
|
186 | + $column = intval($column); |
|
187 | 187 | |
188 | - $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
188 | + $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
189 | 189 | FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) "; |
190 | - $sql .= "ORDER BY language, version ASC "; |
|
191 | - $sql .= "LIMIT $from, $number_of_items "; |
|
192 | - |
|
193 | - $result = Database::query($sql); |
|
194 | - $legals = array (); |
|
195 | - $versions = array (); |
|
196 | - while ($legal = Database::fetch_array($result)) { |
|
197 | - // max 2000 chars |
|
198 | - //echo strlen($legal[1]); echo '<br>'; |
|
199 | - $versions[]=$legal[0]; |
|
200 | - $languages[]=$legal[1]; |
|
201 | - if (strlen($legal[2])>2000) |
|
202 | - $legal[2]= substr($legal[2],0,2000).' ... '; |
|
203 | - if ($legal[4]==0) |
|
204 | - $legal[4]= get_lang('HTMLText'); |
|
205 | - elseif($legal[4]==1) |
|
206 | - $legal[4]=get_lang('PageLink'); |
|
207 | - $legals[] = $legal; |
|
208 | - } |
|
209 | - return $legals; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * Gets the number of terms and conditions available |
|
214 | - * @return int |
|
215 | - */ |
|
216 | - public static function count() |
|
190 | + $sql .= "ORDER BY language, version ASC "; |
|
191 | + $sql .= "LIMIT $from, $number_of_items "; |
|
192 | + |
|
193 | + $result = Database::query($sql); |
|
194 | + $legals = array (); |
|
195 | + $versions = array (); |
|
196 | + while ($legal = Database::fetch_array($result)) { |
|
197 | + // max 2000 chars |
|
198 | + //echo strlen($legal[1]); echo '<br>'; |
|
199 | + $versions[]=$legal[0]; |
|
200 | + $languages[]=$legal[1]; |
|
201 | + if (strlen($legal[2])>2000) |
|
202 | + $legal[2]= substr($legal[2],0,2000).' ... '; |
|
203 | + if ($legal[4]==0) |
|
204 | + $legal[4]= get_lang('HTMLText'); |
|
205 | + elseif($legal[4]==1) |
|
206 | + $legal[4]=get_lang('PageLink'); |
|
207 | + $legals[] = $legal; |
|
208 | + } |
|
209 | + return $legals; |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * Gets the number of terms and conditions available |
|
214 | + * @return int |
|
215 | + */ |
|
216 | + public static function count() |
|
217 | 217 | { |
218 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
219 | - $sql = "SELECT count(*) as count_result |
|
218 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
219 | + $sql = "SELECT count(*) as count_result |
|
220 | 220 | FROM $legal_conditions_table |
221 | 221 | ORDER BY legal_id DESC "; |
222 | - $result = Database::query($sql); |
|
223 | - $url = Database::fetch_array($result,'ASSOC'); |
|
224 | - $result = $url['count_result']; |
|
225 | - |
|
226 | - return $result; |
|
227 | - } |
|
228 | - |
|
229 | - /** |
|
230 | - * Get type of terms and conditions |
|
231 | - * @param int The legal id |
|
232 | - * @param int The language id |
|
233 | - * @return int The current type of terms and conditions |
|
234 | - */ |
|
235 | - public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
222 | + $result = Database::query($sql); |
|
223 | + $url = Database::fetch_array($result,'ASSOC'); |
|
224 | + $result = $url['count_result']; |
|
225 | + |
|
226 | + return $result; |
|
227 | + } |
|
228 | + |
|
229 | + /** |
|
230 | + * Get type of terms and conditions |
|
231 | + * @param int The legal id |
|
232 | + * @param int The language id |
|
233 | + * @return int The current type of terms and conditions |
|
234 | + */ |
|
235 | + public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
236 | 236 | { |
237 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
238 | - $legal_id = intval($legal_id); |
|
239 | - $language_id = intval($language_id); |
|
240 | - $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
237 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
238 | + $legal_id = intval($legal_id); |
|
239 | + $language_id = intval($language_id); |
|
240 | + $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
241 | 241 | WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"'; |
242 | - $rs = Database::query($sql); |
|
242 | + $rs = Database::query($sql); |
|
243 | 243 | |
244 | - return Database::result($rs,0,'type'); |
|
245 | - } |
|
244 | + return Database::result($rs,0,'type'); |
|
245 | + } |
|
246 | 246 | } |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - /** |
|
53 | - * Displays the page header |
|
54 | - * @param string The name of the page (will be showed in the page title) |
|
55 | - * @param string Optional help file name |
|
56 | - * @param string $page_header |
|
57 | - */ |
|
52 | + /** |
|
53 | + * Displays the page header |
|
54 | + * @param string The name of the page (will be showed in the page title) |
|
55 | + * @param string Optional help file name |
|
56 | + * @param string $page_header |
|
57 | + */ |
|
58 | 58 | public static function display_header($tool_name ='', $help = null, $page_header = null) |
59 | 59 | { |
60 | 60 | $origin = api_get_origin(); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
450 | 450 | { |
451 | - $message = self::return_message($message, 'normal', $filter); |
|
451 | + $message = self::return_message($message, 'normal', $filter); |
|
452 | 452 | if ($returnValue) { |
453 | 453 | return $message; |
454 | 454 | } else { |
@@ -524,22 +524,22 @@ discard block |
||
524 | 524 | public static function return_message($message, $type = 'normal', $filter = true) |
525 | 525 | { |
526 | 526 | if ($filter) { |
527 | - $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
527 | + $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | $class = ""; |
531 | 531 | switch($type) { |
532 | 532 | case 'warning': |
533 | 533 | $class .= 'alert alert-warning'; |
534 | - break; |
|
534 | + break; |
|
535 | 535 | case 'error': |
536 | 536 | $class .= 'alert alert-danger'; |
537 | - break; |
|
537 | + break; |
|
538 | 538 | case 'confirmation': |
539 | 539 | case 'confirm': |
540 | 540 | case 'success': |
541 | 541 | $class .= 'alert alert-success'; |
542 | - break; |
|
542 | + break; |
|
543 | 543 | case 'normal': |
544 | 544 | default: |
545 | 545 | $class .= 'alert alert-info'; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * @param array additional attributes (for instance height, width, onclick, ...) |
683 | 683 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
684 | 684 | * @return void |
685 | - */ |
|
685 | + */ |
|
686 | 686 | public static function display_icon( |
687 | 687 | $image, |
688 | 688 | $alt_text = '', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | * @author Julio Montoya 2010 Function improved, adding image constants |
706 | 706 | * @author Yannick Warnier 2011 Added size handler |
707 | 707 | * @version Feb 2011 |
708 | - */ |
|
708 | + */ |
|
709 | 709 | public static function return_icon( |
710 | 710 | $image, |
711 | 711 | $alt_text = '', |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | */ |
885 | 885 | public static function input($type, $name, $value, $attributes = array()) |
886 | 886 | { |
887 | - if (isset($type)) { |
|
888 | - $attributes['type']= $type; |
|
889 | - } |
|
890 | - if (isset($name)) { |
|
891 | - $attributes['name']= $name; |
|
892 | - } |
|
893 | - if (isset($value)) { |
|
894 | - $attributes['value']= $value; |
|
887 | + if (isset($type)) { |
|
888 | + $attributes['type']= $type; |
|
889 | + } |
|
890 | + if (isset($name)) { |
|
891 | + $attributes['name']= $name; |
|
892 | + } |
|
893 | + if (isset($value)) { |
|
894 | + $attributes['value']= $value; |
|
895 | 895 | } |
896 | 896 | return self::tag('input', '', $attributes); |
897 | 897 | } |
@@ -904,10 +904,10 @@ discard block |
||
904 | 904 | */ |
905 | 905 | public static function button($name, $value, $attributes = array()) |
906 | 906 | { |
907 | - if (!empty($name)) { |
|
907 | + if (!empty($name)) { |
|
908 | 908 | $attributes['name'] = $name; |
909 | - } |
|
910 | - return self::tag('button', $value, $attributes); |
|
909 | + } |
|
910 | + return self::tag('button', $value, $attributes); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * in the $htmlHeadXtra variable before the display_header |
975 | 975 | * Add this script |
976 | 976 | * @example |
977 | - * <script> |
|
977 | + * <script> |
|
978 | 978 | $(function() { |
979 | 979 | $( "#tabs" ).tabs(); |
980 | 980 | }); |
@@ -1035,20 +1035,20 @@ discard block |
||
1035 | 1035 | */ |
1036 | 1036 | public static function tabsOnlyLink($headers, $selected = null) |
1037 | 1037 | { |
1038 | - $id = uniqid(); |
|
1039 | - $i = 1; |
|
1040 | - $lis = null; |
|
1041 | - foreach ($headers as $item) { |
|
1038 | + $id = uniqid(); |
|
1039 | + $i = 1; |
|
1040 | + $lis = null; |
|
1041 | + foreach ($headers as $item) { |
|
1042 | 1042 | $class = null; |
1043 | 1043 | if ($i == $selected) { |
1044 | 1044 | $class = 'active'; |
1045 | 1045 | } |
1046 | - $item = self::tag( |
|
1047 | - 'a', |
|
1048 | - $item['content'], |
|
1049 | - array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1050 | - ); |
|
1051 | - $lis .= self::tag('li', $item, array('class' => $class)); |
|
1046 | + $item = self::tag( |
|
1047 | + 'a', |
|
1048 | + $item['content'], |
|
1049 | + array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1050 | + ); |
|
1051 | + $lis .= self::tag('li', $item, array('class' => $class)); |
|
1052 | 1052 | $i++; |
1053 | 1053 | } |
1054 | 1054 | return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin')); |
@@ -1260,8 +1260,8 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | public static function table($headers, $rows, $attributes = array()) |
1262 | 1262 | { |
1263 | - if (empty($attributes)) { |
|
1264 | - $attributes['class'] = 'data_table'; |
|
1263 | + if (empty($attributes)) { |
|
1264 | + $attributes['class'] = 'data_table'; |
|
1265 | 1265 | } |
1266 | 1266 | $table = new HTML_Table($attributes); |
1267 | 1267 | $row = 0; |
@@ -1269,17 +1269,17 @@ discard block |
||
1269 | 1269 | |
1270 | 1270 | // Course headers |
1271 | 1271 | if (!empty($headers)) { |
1272 | - foreach ($headers as $item) { |
|
1273 | - $table->setHeaderContents($row, $column, $item); |
|
1274 | - $column++; |
|
1275 | - } |
|
1276 | - $row = 1; |
|
1277 | - $column = 0; |
|
1272 | + foreach ($headers as $item) { |
|
1273 | + $table->setHeaderContents($row, $column, $item); |
|
1274 | + $column++; |
|
1275 | + } |
|
1276 | + $row = 1; |
|
1277 | + $column = 0; |
|
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | if (!empty($rows)) { |
1281 | - foreach($rows as $content) { |
|
1282 | - $table->setCellContents($row, $column, $content); |
|
1281 | + foreach($rows as $content) { |
|
1282 | + $table->setCellContents($row, $column, $content); |
|
1283 | 1283 | $row++; |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | //$item_property['tool'] != TOOL_DROPBOX && |
1386 | 1386 | $item_property['tool'] != TOOL_NOTEBOOK && |
1387 | 1387 | $item_property['tool'] != TOOL_CHAT) |
1388 | - ) |
|
1388 | + ) |
|
1389 | 1389 | ) |
1390 | 1390 | // Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset. |
1391 | 1391 | && ($item_property['visibility'] == '1' |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | ($item_property['to_user_id'] != $user_id) && |
1402 | 1402 | (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'], $group_ids))) |
1403 | 1403 | ) { |
1404 | - continue; |
|
1404 | + continue; |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // If it's a survey, make sure the user's invited. Otherwise drop it. |
@@ -1620,21 +1620,21 @@ discard block |
||
1620 | 1620 | * |
1621 | 1621 | * @param string id of the rating ul element |
1622 | 1622 | * @param string url that will be added (for jquery see hot_courses.tpl) |
1623 | - * @param string point info array see function CourseManager::get_course_ranking() |
|
1624 | - * @param bool add a div wrapper |
|
1625 | - * @todo use templates |
|
1623 | + * @param string point info array see function CourseManager::get_course_ranking() |
|
1624 | + * @param bool add a div wrapper |
|
1625 | + * @todo use templates |
|
1626 | 1626 | **/ |
1627 | 1627 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
1628 | 1628 | { |
1629 | - $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1630 | - $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1629 | + $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1630 | + $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1631 | 1631 | |
1632 | - if (!empty($percentage)) { |
|
1632 | + if (!empty($percentage)) { |
|
1633 | 1633 | $percentage = $percentage*125/100; |
1634 | 1634 | } |
1635 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1635 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1636 | 1636 | |
1637 | - $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1637 | + $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1638 | 1638 | |
1639 | 1639 | $html = '<ul id="'.$id.'" class="star-rating"> |
1640 | 1640 | <li class="current-rating" style="width:'.$percentage.'px;"></li> |
@@ -1645,26 +1645,26 @@ discard block |
||
1645 | 1645 | <li><a href="javascript:void(0);" data-link="'.$url.'&star=5" title="'.$star_label.'" class="five-stars">5</a></li> |
1646 | 1646 | </ul>'; |
1647 | 1647 | |
1648 | - $labels = array(); |
|
1648 | + $labels = array(); |
|
1649 | 1649 | |
1650 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1651 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1652 | - if (!empty($number_of_users_who_voted)) { |
|
1653 | - $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
1654 | - } |
|
1650 | + $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1651 | + $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1652 | + if (!empty($number_of_users_who_voted)) { |
|
1653 | + $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
1654 | + } |
|
1655 | 1655 | |
1656 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1656 | + $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1657 | 1657 | |
1658 | - if (!$add_div_wrapper && api_is_anonymous()) { |
|
1659 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1660 | - } |
|
1658 | + if (!$add_div_wrapper && api_is_anonymous()) { |
|
1659 | + $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1660 | + } |
|
1661 | 1661 | |
1662 | 1662 | $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
1663 | 1663 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
1664 | 1664 | |
1665 | 1665 | if ($add_div_wrapper) { |
1666 | - $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1667 | - } |
|
1666 | + $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1667 | + } |
|
1668 | 1668 | |
1669 | 1669 | return $html; |
1670 | 1670 | } |
@@ -1702,8 +1702,8 @@ discard block |
||
1702 | 1702 | return self::page_header($title, $second_title); |
1703 | 1703 | } |
1704 | 1704 | |
1705 | - public static function page_subheader_and_translate($title, $second_title = null) |
|
1706 | - { |
|
1705 | + public static function page_subheader_and_translate($title, $second_title = null) |
|
1706 | + { |
|
1707 | 1707 | $title = get_lang($title); |
1708 | 1708 | return self::page_subheader($title, $second_title); |
1709 | 1709 | } |
@@ -591,13 +591,13 @@ |
||
591 | 591 | |
592 | 592 | } |
593 | 593 | |
594 | - /** |
|
595 | - * Add a tab to platform |
|
596 | - * @param string $tabName |
|
597 | - * @param string $url |
|
598 | - * |
|
599 | - * @return boolean |
|
600 | - */ |
|
594 | + /** |
|
595 | + * Add a tab to platform |
|
596 | + * @param string $tabName |
|
597 | + * @param string $url |
|
598 | + * |
|
599 | + * @return boolean |
|
600 | + */ |
|
601 | 601 | public function addTab($tabName, $url) |
602 | 602 | { |
603 | 603 | $sql = "SELECT * FROM settings_current |
@@ -1679,7 +1679,7 @@ discard block |
||
1679 | 1679 | |
1680 | 1680 | // We get the coach for the given course in a given session. |
1681 | 1681 | $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . |
1682 | - ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1682 | + ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1683 | 1683 | $rs = Database::query($sql); |
1684 | 1684 | while ($user = Database::fetch_array($rs)) { |
1685 | 1685 | $user_info = api_get_user_info($user['user_id']); |
@@ -3972,7 +3972,7 @@ discard block |
||
3972 | 3972 | } |
3973 | 3973 | |
3974 | 3974 | $session_title .= isset($course['special_course']) ? ' ' . |
3975 | - Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
3975 | + Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
3976 | 3976 | |
3977 | 3977 | $params['title'] = $session_title; |
3978 | 3978 | $params['extra'] = ''; |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | if ($course_visibility != COURSE_VISIBILITY_HIDDEN && |
511 | 511 | ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) |
512 | 512 | ) { |
513 | - $result .= '<span class="title">' . $course_title . '<span>'; |
|
513 | + $result .= '<span class="title">' . $course_title . '<span>'; |
|
514 | 514 | } else { |
515 | 515 | $result .= $course_title." "." ".get_lang('CourseClosed').""; |
516 | 516 | } |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | } |
1415 | 1415 | $media .= '<div class="user-image">'; |
1416 | 1416 | $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] . |
1417 | - '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1417 | + '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1418 | 1418 | $media .= '</div>'; |
1419 | 1419 | $media .= '<div class="user-data">'; |
1420 | 1420 | $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a></div>'; |
@@ -1645,10 +1645,10 @@ discard block |
||
1645 | 1645 | return $name; |
1646 | 1646 | } |
1647 | 1647 | /** |
1648 | - * Delete messages delete logic |
|
1649 | - * @param int $id id message to delete. |
|
1650 | - * @return bool status query |
|
1651 | - */ |
|
1648 | + * Delete messages delete logic |
|
1649 | + * @param int $id id message to delete. |
|
1650 | + * @return bool status query |
|
1651 | + */ |
|
1652 | 1652 | public static function deleteMessage($id) |
1653 | 1653 | { |
1654 | 1654 | $id = intval($id); |
@@ -1532,7 +1532,7 @@ |
||
1532 | 1532 | |
1533 | 1533 | if (isset($_REQUEST['action'])) { |
1534 | 1534 | switch ($_REQUEST['action']) { |
1535 | - case 'mark_as_unread' : |
|
1535 | + case 'mark_as_unread' : |
|
1536 | 1536 | $number_of_selected_messages = count($_POST['id']); |
1537 | 1537 | if (is_array($_POST['id'])) { |
1538 | 1538 | foreach ($_POST['id'] as $index => $message_id) { |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | - * This function is for editing profile info from profile_id. |
|
37 | - * @param int $profileId |
|
38 | - * @param string $name |
|
39 | - * @param string $description |
|
40 | - */ |
|
36 | + * This function is for editing profile info from profile_id. |
|
37 | + * @param int $profileId |
|
38 | + * @param string $name |
|
39 | + * @param string $description |
|
40 | + */ |
|
41 | 41 | public function updateProfileInfo($profileId, $name, $description) |
42 | 42 | { |
43 | 43 | $profileId = intval($profileId); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * This function is for getting profile info from profile_id. |
|
132 | - * @param int $profileId |
|
133 | - */ |
|
131 | + * This function is for getting profile info from profile_id. |
|
132 | + * @param int $profileId |
|
133 | + */ |
|
134 | 134 | |
135 | 135 | public function getProfileInfo($profileId) |
136 | 136 | { |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $data = substr($png,$ipos,$chunk['size']); |
151 | 151 | $sections = explode("\0", $data); |
152 | 152 | if ($sections[0] == $key) { |
153 | - return $sections; |
|
153 | + return $sections; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | // Extract the data and the CRC |