@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | // Stored Value |
40 | 40 | $sv = array(); |
41 | 41 | foreach ($sv as $k => $v) { |
42 | - if (!isset($v['sql'])) |
|
43 | - $v['sql'] = 'FIELD'; |
|
42 | + if (!isset($v['sql'])) { |
|
43 | + $v['sql'] = 'FIELD'; |
|
44 | + } |
|
44 | 45 | $sqlField = str_replace('FIELD', 'sv.sv_value', $v['sql']); |
45 | 46 | $query = 'select '.$sqlField.' as "'.$v['title'].'" '; |
46 | 47 | // $query = 'select sec_to_time(sv.sv_value) as "'.$v.'" '; |
@@ -110,8 +111,9 @@ discard block |
||
110 | 111 | $query .= ' on u.user_id = lv.user_id and lv.lp_id = '.$v['lid']; |
111 | 112 | $query .= ' left outer join '.Database::get_course_table(TABLE_LP_ITEM_VIEW).' liv '; |
112 | 113 | $query .= ' on lv.id = liv.lp_view_id '; |
113 | - if ($v['target_view_count']) |
|
114 | - $query .= ' and liv.view_count = '.$v['target_view_count']; |
|
114 | + if ($v['target_view_count']) { |
|
115 | + $query .= ' and liv.view_count = '.$v['target_view_count']; |
|
116 | + } |
|
115 | 117 | $query .= ' and liv.lp_item_id = '.$v['liid'].' '; |
116 | 118 | $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') '; |
117 | 119 | $query .= ' group by u.user_id '; |
@@ -21,21 +21,25 @@ |
||
21 | 21 | 'where r.course_id=c.id and r.tool_id is null and r.child_id is null'. |
22 | 22 | ' order by c.title'; |
23 | 23 | $columns = Database::query($query); |
24 | - if (Database::num_rows($columns) == 0) |
|
25 | - die('<b>'.get_lang('no data found: '.$query).'</b>'); |
|
24 | + if (Database::num_rows($columns) == 0) { |
|
25 | + die('<b>'.get_lang('no data found: '.$query).'</b>'); |
|
26 | + } |
|
26 | 27 | $columns = Database::store_result($columns); |
27 | 28 | |
28 | 29 | // fetch data |
29 | 30 | $query = 'select u.lastname Name, u.firstname Firstname'; |
30 | - foreach ($columns as $key => $column) |
|
31 | - $query .= ', sec_to_time(k'.$key.'.report_time) as `'. |
|
32 | - $column['course'].'` '; |
|
31 | + foreach ($columns as $key => $column) { |
|
32 | + $query .= ', sec_to_time(k'.$key.'.report_time) as `'. |
|
33 | + $column['course'].'` '; |
|
34 | + } |
|
33 | 35 | $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
34 | - foreach ($columns as $key => $column) // fixme sessions |
|
36 | + foreach ($columns as $key => $column) { |
|
37 | + // fixme sessions |
|
35 | 38 | $query .= 'left outer join '. |
36 | 39 | Database::get_main_table(TABLE_MAIN_REPORTS_VALUES). |
37 | 40 | ' k'.$key. |
38 | 41 | ' on k'.$key.'.key_id = '.$column['kid']. |
39 | 42 | ' and k'.$key.'.user_id = u.user_id '; |
43 | + } |
|
40 | 44 | return $query; |
41 | 45 | } |
@@ -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); |
@@ -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"; |