@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | echo "\n\n"; |
34 | 34 | |
35 | -if (array_key_exists('help', $options)) |
|
35 | +if (array_key_exists('help', $options)) { |
|
36 | 36 | echo "help message\n"; |
37 | -else if (array_key_exists('clearAll', $options)) { |
|
37 | +} else if (array_key_exists('clearAll', $options)) { |
|
38 | 38 | reports_clearAll(); |
39 | 39 | } else if (array_key_exists('build', $options)) { |
40 | 40 | reports_build(); |
@@ -51,8 +51,9 @@ discard block |
||
51 | 51 | $options['ssci'], $options['sscn'], |
52 | 52 | $options['link']); |
53 | 53 | echo "\n"; |
54 | -} else |
|
54 | +} else { |
|
55 | 55 | echo "action not found\n"; |
56 | +} |
|
56 | 57 | |
57 | 58 | echo "\n"; |
58 | 59 | ?> |
@@ -37,16 +37,18 @@ discard block |
||
37 | 37 | // converting post vars to get uri |
38 | 38 | $params = ''; |
39 | 39 | $kv = array(); |
40 | - foreach ($_POST as $key => $value) |
|
41 | - if ($key != 'format') |
|
40 | + foreach ($_POST as $key => $value) { |
|
41 | + if ($key != 'format') |
|
42 | 42 | $kv[] = $key.'='.urlencode($value); |
43 | + } |
|
43 | 44 | $query_string = join("&", $kv); |
44 | 45 | die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>'); |
45 | 46 | } |
46 | 47 | |
47 | 48 | if ($_REQUEST['format'] == 'directlink') { |
48 | - foreach (array('jquery.dataTables.min.js') as $js) |
|
49 | - $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n"; |
|
49 | + foreach (array('jquery.dataTables.min.js') as $js) { |
|
50 | + $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n"; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | $htmlCSSXtra[] = 'dataTable.css'; |
52 | 54 | |
@@ -72,9 +74,10 @@ discard block |
||
72 | 74 | // converting post vars to get uri |
73 | 75 | $params = ''; |
74 | 76 | $kv = array(); |
75 | - foreach ($_POST as $key => $value) |
|
76 | - if ($key != 'format') |
|
77 | + foreach ($_POST as $key => $value) { |
|
78 | + if ($key != 'format') |
|
77 | 79 | $kv[] = $key.'='.urlencode($value); |
80 | + } |
|
78 | 81 | $query_string = join("&", $kv); |
79 | 82 | die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>'); |
80 | 83 | } else if ($_REQUEST['format'] == 'downloadcsv') { |
@@ -82,8 +85,7 @@ discard block |
||
82 | 85 | header("Pragma: must-revalidate"); |
83 | 86 | header("Cache-Control: must-revalidate"); |
84 | 87 | header("Content-type: application/vnd.ms-excel"); |
85 | - } |
|
86 | - else { |
|
88 | + } else { |
|
87 | 89 | header("Content-type: text/csv"); |
88 | 90 | } |
89 | 91 | $date = date("Y-m-d"); |
@@ -96,10 +98,12 @@ discard block |
||
96 | 98 | |
97 | 99 | if (is_array($reports_template[$_REQUEST['type']])) { |
98 | 100 | $query = $reports_template[$_REQUEST['type']]['getSQL'](); |
99 | - if (! is_array($query)) |
|
100 | - $query = array($query); |
|
101 | - if ($_REQUEST['format'] == 'sql') |
|
102 | - die(var_export($query, true)); |
|
101 | + if (! is_array($query)) { |
|
102 | + $query = array($query); |
|
103 | + } |
|
104 | + if ($_REQUEST['format'] == 'sql') { |
|
105 | + die(var_export($query, true)); |
|
106 | + } |
|
103 | 107 | |
104 | 108 | $result = multiquery_query($query); |
105 | 109 | |
@@ -155,32 +159,35 @@ discard block |
||
155 | 159 | if (substr($columns[$i], -5, 5) != '_link') { |
156 | 160 | $column_islink[$i] = false; |
157 | 161 | echo '<th>'.$columns[$i].'</th>'; |
158 | - } else |
|
159 | - $columns_islink[$i] = true; |
|
162 | + } else { |
|
163 | + $columns_islink[$i] = true; |
|
164 | + } |
|
160 | 165 | } |
161 | 166 | |
162 | 167 | // checking resolving link column id |
163 | 168 | $columns_flip = array_flip($columns); |
164 | 169 | $columns_link = array(); |
165 | - for ($i=0; $i < $nfields; $i++) |
|
166 | - if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) |
|
170 | + for ($i=0; $i < $nfields; $i++) { |
|
171 | + if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) |
|
167 | 172 | $columns_link[$i] = $columns_flip[$columns[$i].'_link']; |
168 | - else |
|
169 | - $columns_link[$i] = ''; |
|
173 | + } |
|
174 | + else { |
|
175 | + $columns_link[$i] = ''; |
|
176 | + } |
|
170 | 177 | echo '</tr></thead><tbody>'; |
171 | 178 | while ($row = multiquery_fetch_row($result)) { |
172 | 179 | echo '<tr>'; |
173 | - for ($i = 0; $i<$nfields; $i++) |
|
174 | - if (!$columns_islink[$i]){ // ignore links |
|
180 | + for ($i = 0; $i<$nfields; $i++) { |
|
181 | + if (!$columns_islink[$i]){ // ignore links |
|
175 | 182 | if ($columns_link[$i] != '') // link is defined |
176 | 183 | if (substr($columns_link[$i],0,10) == 'javascript') { |
177 | 184 | echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
178 | - } |
|
179 | - else { |
|
185 | + } |
|
186 | + } else { |
|
180 | 187 | echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
181 | - } |
|
182 | - else |
|
183 | - echo '<td>'.$row[$i].'</td>'; |
|
188 | + } else { |
|
189 | + echo '<td>'.$row[$i].'</td>'; |
|
190 | + } |
|
184 | 191 | } |
185 | 192 | echo "</tr>\n"; |
186 | 193 | } |
@@ -206,18 +213,23 @@ discard block |
||
206 | 213 | if (substr($columns[$i], -5, 5) != '_link') { |
207 | 214 | $column_islink[$i] = false; |
208 | 215 | echo csv_escaping($columns[$i]).','; |
209 | - } else |
|
210 | - $columns_islink[$i] = true; |
|
216 | + } else { |
|
217 | + $columns_islink[$i] = true; |
|
218 | + } |
|
211 | 219 | } |
212 | 220 | |
213 | 221 | echo "\n"; |
214 | 222 | while ($row = multiquery_fetch_row($result)) { |
215 | - for ($i = 0; $i<$nfields; $i++) |
|
216 | - if (!$columns_islink[$i]) // ignore links |
|
217 | - echo csv_escaping($row[$i]).','; // fixme |
|
223 | + for ($i = 0; $i<$nfields; $i++) { |
|
224 | + if (!$columns_islink[$i]) // ignore links |
|
225 | + echo csv_escaping($row[$i]).','; |
|
226 | + } |
|
227 | + // fixme |
|
218 | 228 | echo "\n"; |
219 | 229 | } |
220 | -} else die(get_lang('UnknownFormat')); |
|
230 | +} else { |
|
231 | + die(get_lang('UnknownFormat')); |
|
232 | +} |
|
221 | 233 | |
222 | 234 | function csv_escaping($value, $csv_separator = ',') { |
223 | 235 | $value = str_replace('"','""',$value); |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | |
824 | 824 | if ($progress === null) { |
825 | 825 | $progress = '0%'; |
826 | - } else { |
|
826 | + } else { |
|
827 | 827 | $any_result = true; |
828 | 828 | } |
829 | 829 | |
@@ -853,7 +853,9 @@ discard block |
||
853 | 853 | $start_time = '-'; |
854 | 854 | } |
855 | 855 | |
856 | - if (!empty($total_time)) $any_result = true; |
|
856 | + if (!empty($total_time)) { |
|
857 | + $any_result = true; |
|
858 | + } |
|
857 | 859 | |
858 | 860 | // Quiz in lp |
859 | 861 | $score = Tracking::get_avg_student_score( |
@@ -873,8 +875,11 @@ discard block |
||
873 | 875 | true |
874 | 876 | ); |
875 | 877 | |
876 | - if ($i % 2 == 0) $css_class = "row_even"; |
|
877 | - else $css_class = "row_odd"; |
|
878 | + if ($i % 2 == 0) { |
|
879 | + $css_class = "row_even"; |
|
880 | + } else { |
|
881 | + $css_class = "row_odd"; |
|
882 | + } |
|
878 | 883 | |
879 | 884 | $i++; |
880 | 885 | |
@@ -1042,9 +1047,10 @@ discard block |
||
1042 | 1047 | $result_last_attempt = Database::query($sql); |
1043 | 1048 | if (Database :: num_rows($result_last_attempt) > 0) { |
1044 | 1049 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
1045 | - if ($count_attempts > 0) |
|
1046 | - echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1050 | + if ($count_attempts > 0) { |
|
1051 | + echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1047 | 1052 | <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>'; |
1053 | + } |
|
1048 | 1054 | } |
1049 | 1055 | echo '</td>'; |
1050 | 1056 |
@@ -1878,7 +1878,7 @@ discard block |
||
1878 | 1878 | $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />'; |
1879 | 1879 | if($session_id==0){ |
1880 | 1880 | $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />'; |
1881 | - }else{ |
|
1881 | + } else{ |
|
1882 | 1882 | $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />'; |
1883 | 1883 | } |
1884 | 1884 | $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />'; |
@@ -2261,8 +2261,7 @@ discard block |
||
2261 | 2261 | s1.reflink = s2.reflink AND |
2262 | 2262 | ".$groupfilter.$condition_session.")"; |
2263 | 2263 | // warning don't use group by reflink because don't return the last version |
2264 | - } |
|
2265 | - else { |
|
2264 | + } else { |
|
2266 | 2265 | $sql = " SELECT * FROM ".$tbl_wiki." s1 |
2267 | 2266 | WHERE |
2268 | 2267 | s1.c_id = $course_id AND |
@@ -3696,8 +3695,7 @@ discard block |
||
3696 | 3695 | '.api_htmlentities($obj->title).'</a>'; |
3697 | 3696 | if ($obj->user_id <>0) { |
3698 | 3697 | $row[] = UserManager::getUserProfileLink($userinfo); |
3699 | - } |
|
3700 | - else { |
|
3698 | + } else { |
|
3701 | 3699 | $row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; |
3702 | 3700 | } |
3703 | 3701 | $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get()); |
@@ -3932,8 +3930,7 @@ discard block |
||
3932 | 3930 | api_htmlentities($obj->title).'</a>'; |
3933 | 3931 | if ($obj->user_id <>0) { |
3934 | 3932 | $row[] = UserManager::getUserProfileLink($userinfo); |
3935 | - } |
|
3936 | - else { |
|
3933 | + } else { |
|
3937 | 3934 | $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')'; |
3938 | 3935 | } |
3939 | 3936 | $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds; |
@@ -527,14 +527,15 @@ |
||
527 | 527 | // Mark folders to import which are not selected by the user to import, |
528 | 528 | // but in which a document was selected. |
529 | 529 | $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
530 | - if (!empty($resources) && is_array($resources)) |
|
531 | - foreach ($resources as $id => $obj) { |
|
530 | + if (!empty($resources) && is_array($resources)) { |
|
531 | + foreach ($resources as $id => $obj) { |
|
532 | 532 | if (isset($obj->file_type) && $obj->file_type == 'folder' && |
533 | 533 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
534 | 534 | is_array($documents) |
535 | 535 | ) { |
536 | 536 | foreach ($documents as $id_to_check => $post_value) { |
537 | 537 | $obj_to_check = $resources[$id_to_check]; |
538 | + } |
|
538 | 539 | $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
539 | 540 | if ($id_to_check != $id && $obj->path == $shared_path_part) { |
540 | 541 | $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
@@ -512,7 +512,9 @@ discard block |
||
512 | 512 | |
513 | 513 | if (in_array($file_info['extension'], array('html', 'htm'))) { |
514 | 514 | $content = file_get_contents($path.$document->path); |
515 | - if (UTF8_CONVERT) $content = utf8_encode($content); |
|
515 | + if (UTF8_CONVERT) { |
|
516 | + $content = utf8_encode($content); |
|
517 | + } |
|
516 | 518 | $content = DocumentManager::replace_urls_inside_content_html_from_copy_course( |
517 | 519 | $content, |
518 | 520 | $this->course->code, |
@@ -2240,7 +2242,11 @@ discard block |
||
2240 | 2242 | c_id = ".$this->destination_course_id." AND |
2241 | 2243 | code='".self::DBUTF8escapestring($survey_code)."'"; |
2242 | 2244 | $result = Database::query($sql); |
2243 | - if (Database::num_rows($result) > 0) return false; else return true; |
|
2245 | + if (Database::num_rows($result) > 0) { |
|
2246 | + return false; |
|
2247 | + } else { |
|
2248 | + return true; |
|
2249 | + } |
|
2244 | 2250 | } |
2245 | 2251 | |
2246 | 2252 | /** |
@@ -2719,8 +2725,9 @@ discard block |
||
2719 | 2725 | echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>'; |
2720 | 2726 | }*/ |
2721 | 2727 | } elseif(is_dir($path)) { |
2722 | - if (!is_dir($dest . '/' . $file)) |
|
2723 | - mkdir($dest . '/' . $file); |
|
2728 | + if (!is_dir($dest . '/' . $file)) { |
|
2729 | + mkdir($dest . '/' . $file); |
|
2730 | + } |
|
2724 | 2731 | self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite); |
2725 | 2732 | } |
2726 | 2733 | } |
@@ -104,6 +104,8 @@ |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | $q = strtolower($_GET["q"]); |
107 | -if (!$q) return; |
|
107 | +if (!$q) { |
|
108 | + return; |
|
109 | +} |
|
108 | 110 | //echo $q . "| value\n"; |
109 | 111 | get_suggestions_from_search_engine($q); |
@@ -97,9 +97,11 @@ |
||
97 | 97 | echo "\t</tr>\n"; |
98 | 98 | |
99 | 99 | // the main area with the checkboxes or images |
100 | -foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
100 | +foreach ($tool_rights as $tool=>$rights) { |
|
101 | + // $tool_rights contains all the possible tools and their rights |
|
101 | 102 | { |
102 | 103 | echo "\t<tr>\n"; |
104 | +} |
|
103 | 105 | echo "\t\t<td>\n"; |
104 | 106 | echo get_lang($tool); |
105 | 107 | echo "\t\t</td>\n"; |
@@ -132,24 +132,20 @@ discard block |
||
132 | 132 | { |
133 | 133 | $table=Database::get_course_table(TABLE_PERMISSION_USER); |
134 | 134 | $id_field = 'user_id'; |
135 | - } |
|
136 | - elseif ($content == 'group') |
|
135 | + } elseif ($content == 'group') |
|
137 | 136 | { |
138 | 137 | $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
139 | 138 | $id_field = 'group_id'; |
140 | - } |
|
141 | - elseif ($content == 'role') |
|
139 | + } elseif ($content == 'role') |
|
142 | 140 | { |
143 | 141 | $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
144 | 142 | $id_field = 'role_id'; |
145 | - } |
|
146 | - elseif ($content == 'platform_role') |
|
143 | + } elseif ($content == 'platform_role') |
|
147 | 144 | { |
148 | 145 | $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
149 | 146 | $id_field = 'role_id'; |
150 | 147 | $course_id_condition = ''; |
151 | - } |
|
152 | - elseif ($content == 'task') |
|
148 | + } elseif ($content == 'task') |
|
153 | 149 | { |
154 | 150 | $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
155 | 151 | $id_field = 'task_id'; |
@@ -162,8 +158,9 @@ discard block |
||
162 | 158 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
163 | 159 | $result = Database::query($sql); |
164 | 160 | |
165 | - while($row = Database::fetch_array($result)) |
|
166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
161 | + while($row = Database::fetch_array($result)) { |
|
162 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
163 | + } |
|
167 | 164 | |
168 | 165 | return $currentpermissions; |
169 | 166 | } |
@@ -321,14 +318,12 @@ discard block |
||
321 | 318 | if ($course_admin) |
322 | 319 | { |
323 | 320 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
324 | - } |
|
325 | - else |
|
321 | + } else |
|
326 | 322 | { |
327 | 323 | if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
328 | 324 | { |
329 | 325 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
330 | - } |
|
331 | - else |
|
326 | + } else |
|
332 | 327 | { |
333 | 328 | if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
334 | 329 | { |
@@ -439,8 +434,7 @@ discard block |
||
439 | 434 | $checked='checked'; |
440 | 435 | $image='checkbox_on2.gif'; |
441 | 436 | $action='revoke'; |
442 | - } |
|
443 | - else |
|
437 | + } else |
|
444 | 438 | { |
445 | 439 | $checked=''; |
446 | 440 | $image='wrong.gif'; |