@@ -1046,7 +1046,8 @@ |
||
1046 | 1046 | $di->addChunk($ic_slide); |
1047 | 1047 | |
1048 | 1048 | //index and return search engine document id |
1049 | - if (!empty($question_exercises)) { // if empty there is nothing to index |
|
1049 | + if (!empty($question_exercises)) { |
|
1050 | +// if empty there is nothing to index |
|
1050 | 1051 | $did = $di->index(); |
1051 | 1052 | unset($di); |
1052 | 1053 | } |
@@ -493,7 +493,7 @@ |
||
493 | 493 | * in this version, a question can only have 1 category |
494 | 494 | * if category is 0, then question has no category then delete the category entry |
495 | 495 | * @param int $categoryId |
496 | - * @return bool |
|
496 | + * @return null|boolean |
|
497 | 497 | * |
498 | 498 | * @author Hubert Borderiou 12-10-2011 |
499 | 499 | */ |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $res = Database::query($sql); |
533 | 533 | $row = Database::fetch_array($res); |
534 | 534 | if ($row['nb'] > 0) { |
535 | - $sql = "UPDATE $table |
|
535 | + $sql = "update $table |
|
536 | 536 | SET category_id = $categoryId |
537 | 537 | WHERE |
538 | 538 | question_id = $question_id AND |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | return false; |
851 | 851 | } |
852 | 852 | |
853 | - $sql = "UPDATE $TBL_QUESTIONS SET |
|
853 | + $sql = "update $TBL_QUESTIONS SET |
|
854 | 854 | picture = '".Database::escape_string($picture)."' |
855 | 855 | WHERE c_id = $course_id AND id='".intval($questionId)."'"; |
856 | 856 | Database::query($sql); |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | $this->id = Database::insert($TBL_QUESTIONS, $params); |
1015 | 1015 | |
1016 | 1016 | if ($this->id) { |
1017 | - $sql = "UPDATE $TBL_QUESTIONS SET id = iid WHERE iid = {$this->id}"; |
|
1017 | + $sql = "update $TBL_QUESTIONS SET id = iid WHERE iid = {$this->id}"; |
|
1018 | 1018 | Database::query($sql); |
1019 | 1019 | |
1020 | 1020 | api_item_property_update( |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | if (Database::num_rows($res) > 0) { |
1304 | 1304 | $row = Database::fetch_array($res); |
1305 | 1305 | if (!empty($row['question_order'])) { |
1306 | - $sql = "UPDATE $TBL_EXERCISE_QUESTION |
|
1306 | + $sql = "update $TBL_EXERCISE_QUESTION |
|
1307 | 1307 | SET question_order = question_order-1 |
1308 | 1308 | WHERE |
1309 | 1309 | c_id = $course_id |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | if (Database::num_rows($res) > 0) { |
1355 | 1355 | while ($row = Database::fetch_array($res)) { |
1356 | 1356 | if (!empty($row['question_order'])) { |
1357 | - $sql = "UPDATE $TBL_EXERCISE_QUESTION |
|
1357 | + $sql = "update $TBL_EXERCISE_QUESTION |
|
1358 | 1358 | SET question_order = question_order-1 |
1359 | 1359 | WHERE |
1360 | 1360 | c_id = $course_id AND |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | $newQuestionId = Database::insert($TBL_QUESTIONS, $params); |
1470 | 1470 | |
1471 | 1471 | if ($newQuestionId) { |
1472 | - $sql = "UPDATE $TBL_QUESTIONS |
|
1472 | + $sql = "update $TBL_QUESTIONS |
|
1473 | 1473 | SET id = iid |
1474 | 1474 | WHERE iid = $newQuestionId"; |
1475 | 1475 | Database::query($sql); |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | unset($item['iid']); |
1484 | 1484 | $id = Database::insert($TBL_QUESTION_OPTIONS, $item); |
1485 | 1485 | if ($id) { |
1486 | - $sql = "UPDATE $TBL_QUESTION_OPTIONS |
|
1486 | + $sql = "update $TBL_QUESTION_OPTIONS |
|
1487 | 1487 | SET id = iid |
1488 | 1488 | WHERE iid = $id"; |
1489 | 1489 | Database::query($sql); |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | $result = self::readQuestionOption($question_id, $course_id); |
1875 | 1875 | $last_id = Database::insert($table, $params); |
1876 | 1876 | if ($last_id) { |
1877 | - $sql = "UPDATE $table SET id = iid WHERE iid = $last_id"; |
|
1877 | + $sql = "update $table SET id = iid WHERE iid = $last_id"; |
|
1878 | 1878 | Database::query($sql); |
1879 | 1879 | } |
1880 | 1880 | |
@@ -2080,7 +2080,7 @@ discard block |
||
2080 | 2080 | $question_id = Database::insert($tbl_quiz_question, $params); |
2081 | 2081 | |
2082 | 2082 | if ($question_id) { |
2083 | - $sql = "UPDATE $tbl_quiz_question |
|
2083 | + $sql = "update $tbl_quiz_question |
|
2084 | 2084 | SET id = iid WHERE iid = $question_id"; |
2085 | 2085 | Database::query($sql); |
2086 | 2086 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | $htmlHeadXtra[] = $jscript2run; |
94 | 94 | Display::display_reduced_header(); |
95 | 95 | if (!empty($course_id) && !empty($learnpath_item_id) && !empty($lpViewId)) { |
96 | - $sql = "UPDATE $TABLE_LP_ITEM_VIEW SET |
|
96 | + $sql = "update $TABLE_LP_ITEM_VIEW SET |
|
97 | 97 | status = 'completed' |
98 | 98 | WHERE |
99 | 99 | c_id = $course_id AND |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | // update db |
47 | 47 | $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId]; |
48 | -$sql = "UPDATE $TBL_TRACK_E_HOTSPOT |
|
48 | +$sql = "update $TBL_TRACK_E_HOTSPOT |
|
49 | 49 | SET coordinate = '".Database::escape_string($coordinates)."' |
50 | 50 | WHERE id = ".intval($update_id)." |
51 | 51 | LIMIT 1"; |
@@ -18,13 +18,15 @@ |
||
18 | 18 | $objExercise = Session::read('objExercise'); |
19 | 19 | $hotspotId = $_GET['hotspotId']; |
20 | 20 | $exerciseId = $objExercise->selectId(); |
21 | -if ($_GET['answerId'] == "0") { // click is NOT on a hotspot |
|
21 | +if ($_GET['answerId'] == "0") { |
|
22 | +// click is NOT on a hotspot |
|
22 | 23 | $hit = 0; |
23 | 24 | $answerId = $hotspotId; |
24 | 25 | |
25 | 26 | // remove from session |
26 | 27 | unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
27 | -} else { // user clicked ON a hotspot |
|
28 | +} else { |
|
29 | +// user clicked ON a hotspot |
|
28 | 30 | $hit = 1; |
29 | 31 | $answerId = $hotspotId; |
30 | 32 |
@@ -169,7 +169,8 @@ |
||
169 | 169 | my_delete($document_sys_path.$uploadPath.'/'.$fld.'/'.$filename); |
170 | 170 | DocumentManager::updateDbInfo('delete', $uploadPath.'/'.$fld.'/'.$filename); |
171 | 171 | } |
172 | - if ($imgcount == 0) { // all image uploaded |
|
172 | + if ($imgcount == 0) { |
|
173 | +// all image uploaded |
|
173 | 174 | $finish = 1; |
174 | 175 | } |
175 | 176 | } else { |
@@ -196,7 +196,7 @@ |
||
196 | 196 | ENT_COMPAT, |
197 | 197 | api_get_system_encoding() |
198 | 198 | ); |
199 | - $query = "UPDATE $dbTable |
|
199 | + $query = "update $dbTable |
|
200 | 200 | SET comment='".Database::escape_string($title)."' |
201 | 201 | WHERE c_id = $course_id AND path=\"".$uploadPath."/".$fld."/".$filename."\""; |
202 | 202 | Database::query($query); |
@@ -11,7 +11,8 @@ discard block |
||
11 | 11 | </span> |
12 | 12 | '); |
13 | 13 | |
14 | -function reports_template_CourseArticulate_getSQL() { |
|
14 | +function reports_template_CourseArticulate_getSQL() |
|
15 | +{ |
|
15 | 16 | // settings |
16 | 17 | |
17 | 18 | |
@@ -23,7 +24,8 @@ discard block |
||
23 | 24 | $queries[0] = $query; |
24 | 25 | $extraFieldType = \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE; |
25 | 26 | // Custom Field |
26 | - foreach (array("tags" => "tags") as $k => $v) { // FIXME |
|
27 | + foreach (array("tags" => "tags") as $k => $v) { |
|
28 | +// FIXME |
|
27 | 29 | $query = 'select ufv.value as "'.$v.'" '; |
28 | 30 | $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
29 | 31 | $query .= 'left join'.Database::get_main_table(TABLE_EXTRA_FIELD).' uf '; |
@@ -39,8 +41,9 @@ discard block |
||
39 | 41 | // Stored Value |
40 | 42 | $sv = array(); |
41 | 43 | foreach ($sv as $k => $v) { |
42 | - if (!isset($v['sql'])) |
|
43 | - $v['sql'] = 'FIELD'; |
|
44 | + if (!isset($v['sql'])) { |
|
45 | + $v['sql'] = 'FIELD'; |
|
46 | + } |
|
44 | 47 | $sqlField = str_replace('FIELD', 'sv.sv_value', $v['sql']); |
45 | 48 | $query = 'select '.$sqlField.' as "'.$v['title'].'" '; |
46 | 49 | // $query = 'select sec_to_time(sv.sv_value) as "'.$v.'" '; |
@@ -110,8 +113,9 @@ discard block |
||
110 | 113 | $query .= ' on u.user_id = lv.user_id and lv.lp_id = '.$v['lid']; |
111 | 114 | $query .= ' left outer join '.Database::get_course_table(TABLE_LP_ITEM_VIEW).' liv '; |
112 | 115 | $query .= ' on lv.id = liv.lp_view_id '; |
113 | - if ($v['target_view_count']) |
|
114 | - $query .= ' and liv.view_count = '.$v['target_view_count']; |
|
116 | + if ($v['target_view_count']) { |
|
117 | + $query .= ' and liv.view_count = '.$v['target_view_count']; |
|
118 | + } |
|
115 | 119 | $query .= ' and liv.lp_item_id = '.$v['liid'].' '; |
116 | 120 | $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') '; |
117 | 121 | $query .= ' group by u.user_id '; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | </div> |
249 | 249 | </body> |
250 | 250 | </html> |
251 | -EOM; |
|
251 | +eom; |
|
252 | 252 | } else { |
253 | 253 | $global_error_message_page = |
254 | 254 | <<<EOM |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | </div> |
312 | 312 | </body> |
313 | 313 | </html> |
314 | -EOM; |
|
314 | +eom; |
|
315 | 315 | } |
316 | 316 | foreach ($global_error_message as $key => $value) { |
317 | 317 | $global_error_message_page = str_replace('{'.strtoupper($key).'}', $value, $global_error_message_page); |
@@ -120,7 +120,7 @@ |
||
120 | 120 | $url = Database::escape_string($resultUpload['url']); |
121 | 121 | $title = Database::escape_string($title); |
122 | 122 | |
123 | - $sql = "UPDATE $work_table SET |
|
123 | + $sql = "update $work_table SET |
|
124 | 124 | url_correction = '".$url."', |
125 | 125 | title_correction = '".$title."' |
126 | 126 | WHERE iid = $itemId"; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | api_protect_admin_script(); |
10 | 10 | |
11 | -switch ($action) { |
|
11 | +switch ($action) { |
|
12 | 12 | case 'getEventTypes': |
13 | 13 | $events = Event::get_all_event_types(); |
14 | 14 | print json_encode($events); |
@@ -76,7 +76,8 @@ |
||
76 | 76 | &$array, |
77 | 77 | $function, |
78 | 78 | $apply_to_keys_also = false |
79 | -) { |
|
79 | +) |
|
80 | +{ |
|
80 | 81 | static $recursive_counter = 0; |
81 | 82 | if (++$recursive_counter > 1000) { |
82 | 83 | die('possible deep recursion attack'); |
@@ -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 | /** |