@@ -41,28 +41,35 @@ |
||
41 | 41 | 'where r.course_id=c.id and r.tool_id='. |
42 | 42 | reports_getToolId(TOOL_QUIZ). |
43 | 43 | ' order by r.course_id, r.child_name'); |
44 | - if (Database::num_rows($columns) == 0) |
|
45 | - die('<b>'.get_lang('no data found').'</b>'); |
|
44 | + if (Database::num_rows($columns) == 0) { |
|
45 | + die('<b>'.get_lang('no data found').'</b>'); |
|
46 | + } |
|
46 | 47 | $query = 'select u.lastname Name, u.firstname Firstname'; |
47 | 48 | $columns = Database::store_result($columns); |
48 | - if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') |
|
49 | - $function = $_REQUEST['tattempt']; |
|
50 | - else |
|
51 | - $function = 'avg'; |
|
52 | - foreach ($columns as $key => $column) |
|
53 | - $query .= ', '.$function.'(k'.$key.'.score) as `'. |
|
49 | + if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') { |
|
50 | + $function = $_REQUEST['tattempt']; |
|
51 | + } else { |
|
52 | + $function = 'avg'; |
|
53 | + } |
|
54 | + foreach ($columns as $key => $column) { |
|
55 | + $query .= ', '.$function.'(k'.$key.'.score) as `'. |
|
54 | 56 | $column['course'].' - '. |
55 | 57 | $column['test'].'` '; |
58 | + } |
|
56 | 59 | $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
57 | - foreach ($columns as $key => $column) // fixme sessions |
|
60 | + foreach ($columns as $key => $column) { |
|
61 | + // fixme sessions |
|
58 | 62 | $query .= 'left outer join '. |
59 | 63 | Database::get_main_table(TABLE_MAIN_REPORTS_VALUES). |
60 | 64 | ' k'.$key. |
61 | 65 | ' on k'.$key.'.key_id = '.$column['kid']. |
62 | 66 | ' and k'.$key.'.user_id = u.user_id '; |
67 | + } |
|
63 | 68 | $query .= ' group by '; |
64 | - foreach ($columns as $key => $column) // grouping attempt |
|
69 | + foreach ($columns as $key => $column) { |
|
70 | + // grouping attempt |
|
65 | 71 | $query .= 'k'.$key.'.attempt, '; |
72 | + } |
|
66 | 73 | $query = substr($query, 0, -2); // removing last ', '; |
67 | 74 | |
68 | 75 |
@@ -338,7 +338,7 @@ |
||
338 | 338 | |
339 | 339 | if (empty($certificatesItem) && empty($searchItem)) { |
340 | 340 | return null; |
341 | - }else{ |
|
341 | + } else{ |
|
342 | 342 | $content.= $certificatesItem; |
343 | 343 | $content.= $searchItem; |
344 | 344 | } |
@@ -29,14 +29,16 @@ |
||
29 | 29 | { |
30 | 30 | foreach ( $_POST as $key => $value ) |
31 | 31 | { |
32 | - if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) |
|
33 | - continue; |
|
32 | + if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) { |
|
33 | + continue; |
|
34 | + } |
|
34 | 35 | |
35 | - if ( get_magic_quotes_gpc() ) |
|
36 | - $value = htmlspecialchars( stripslashes((string)$value) ); |
|
37 | - else |
|
38 | - $value = htmlspecialchars( (string)$value ); |
|
39 | -?> |
|
36 | + if ( get_magic_quotes_gpc() ) { |
|
37 | + $value = htmlspecialchars( stripslashes((string)$value) ); |
|
38 | + } else { |
|
39 | + $value = htmlspecialchars( (string)$value ); |
|
40 | + } |
|
41 | + ?> |
|
40 | 42 | <tr> |
41 | 43 | <th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th> |
42 | 44 | <td><pre class="samples"><?php echo $value; ?></pre></td> |
@@ -74,8 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | $content = file($options['config']); |
76 | 76 | foreach($content as $l) { |
77 | - if (preg_match('/^\s+$/', $l)) continue; // Empty lines. |
|
78 | - if (preg_match('/^[#\/!;]/', $l)) continue; // Comments (any form). |
|
77 | + if (preg_match('/^\s+$/', $l)) { |
|
78 | + continue; |
|
79 | + } |
|
80 | + // Empty lines. |
|
81 | + if (preg_match('/^[#\/!;]/', $l)) { |
|
82 | + continue; |
|
83 | + } |
|
84 | + // Comments (any form). |
|
79 | 85 | if (preg_match('/^(.*?)=(.*)$/', $l, $matches)) { |
80 | 86 | if (in_array($matches[1], $expectedoptions)){ |
81 | 87 | $options[trim($matches[1])] = trim($matches[2]); |
@@ -90,16 +96,22 @@ discard block |
||
90 | 96 | require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php'); |
91 | 97 | |
92 | 98 | global $DB; |
93 | -if ($options['verbose']) echo "building database manager\n"; |
|
99 | +if ($options['verbose']) { |
|
100 | + echo "building database manager\n"; |
|
101 | +} |
|
94 | 102 | $DB = new DatabaseManager(); |
95 | -if ($options['verbose']) echo "building plugin vchamilo\n"; |
|
103 | +if ($options['verbose']) { |
|
104 | + echo "building plugin vchamilo\n"; |
|
105 | +} |
|
96 | 106 | $plugininstance = VChamiloPlugin::create(); |
97 | 107 | |
98 | 108 | if (empty($options['nodes'])) { |
99 | 109 | cli_error('Missing node definition. Halt.'); |
100 | 110 | } |
101 | 111 | |
102 | -if ($options['verbose']) echo "parsing nodelist\n"; |
|
112 | +if ($options['verbose']) { |
|
113 | + echo "parsing nodelist\n"; |
|
114 | +} |
|
103 | 115 | $nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugininstance); |
104 | 116 | |
105 | 117 | if ($options['lint']) { |
@@ -133,7 +133,9 @@ discard block |
||
133 | 133 | $key = $headers[$f]; |
134 | 134 | if (preg_match('/\|/', $key)) { |
135 | 135 | list($plugin, $variable) = explode('|', str_replace('plugin_', '', $key)); |
136 | - if (empty($variable)) die("Key error in CSV : $key "); |
|
136 | + if (empty($variable)) { |
|
137 | + die("Key error in CSV : $key "); |
|
138 | + } |
|
137 | 139 | if (!isset($vnode->$plugin)) { |
138 | 140 | $vnode->$plugin = new StdClass(); |
139 | 141 | } |
@@ -170,8 +172,13 @@ discard block |
||
170 | 172 | static $first = true; |
171 | 173 | |
172 | 174 | // We may have a risk the BOM is present on first line |
173 | - if ($resetfirst) $first = true; |
|
174 | - if (!isset($textlib)) $textlib = new textlib(); // Singleton |
|
175 | + if ($resetfirst) { |
|
176 | + $first = true; |
|
177 | + } |
|
178 | + if (!isset($textlib)) { |
|
179 | + $textlib = new textlib(); |
|
180 | + } |
|
181 | + // Singleton |
|
175 | 182 | $text = $textlib->trim_utf8_bom($text); |
176 | 183 | $first = false; |
177 | 184 |
@@ -91,25 +91,39 @@ |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions |
94 | -if ($options['verbose']) echo "loaded dbclass\n"; |
|
94 | +if ($options['verbose']) { |
|
95 | + echo "loaded dbclass\n"; |
|
96 | +} |
|
95 | 97 | require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions |
96 | -if ($options['verbose']) echo "loaded textlib\n"; |
|
98 | +if ($options['verbose']) { |
|
99 | + echo "loaded textlib\n"; |
|
100 | +} |
|
97 | 101 | require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API |
98 | -if ($options['verbose']) echo "loaded moodle wrapping\n"; |
|
102 | +if ($options['verbose']) { |
|
103 | + echo "loaded moodle wrapping\n"; |
|
104 | +} |
|
99 | 105 | require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php'); |
100 | -if ($options['verbose']) echo "loaded vchamilo plugin\n"; |
|
106 | +if ($options['verbose']) { |
|
107 | + echo "loaded vchamilo plugin\n"; |
|
108 | +} |
|
101 | 109 | |
102 | 110 | global $DB; |
103 | -if ($options['verbose']) echo "building database manager\n"; |
|
111 | +if ($options['verbose']) { |
|
112 | + echo "building database manager\n"; |
|
113 | +} |
|
104 | 114 | $DB = new DatabaseManager(); |
105 | -if ($options['verbose']) echo "building plugin vchamilo\n"; |
|
115 | +if ($options['verbose']) { |
|
116 | + echo "building plugin vchamilo\n"; |
|
117 | +} |
|
106 | 118 | $plugininstance = VChamiloPlugin::create(); |
107 | 119 | |
108 | 120 | if (empty($options['nodes'])) { |
109 | 121 | cli_error(get_string('climissingnodes', 'block_vmoodle')); |
110 | 122 | } |
111 | 123 | |
112 | -if ($options['verbose']) echo "parsing nodelist\n"; |
|
124 | +if ($options['verbose']) { |
|
125 | + echo "parsing nodelist\n"; |
|
126 | +} |
|
113 | 127 | $nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugininstance); |
114 | 128 | |
115 | 129 | if ($options['lint']) { |
@@ -65,8 +65,7 @@ |
||
65 | 65 | if (strpos($filename, "svg")){ |
66 | 66 | $new_sizes['width'] = 60; |
67 | 67 | $new_sizes['height'] = 60; |
68 | - } |
|
69 | - else { |
|
68 | + } else { |
|
70 | 69 | $new_sizes = api_resize_image($image, 60, 60); |
71 | 70 | } |
72 | 71 |
@@ -1701,7 +1701,9 @@ discard block |
||
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | global $_course; |
1704 | - if ($_course == '-1') $_course = array(); |
|
1704 | + if ($_course == '-1') { |
|
1705 | + $_course = array(); |
|
1706 | + } |
|
1705 | 1707 | return $_course; |
1706 | 1708 | } |
1707 | 1709 | |
@@ -4154,18 +4156,21 @@ discard block |
||
4154 | 4156 | switch ($lang_type) { |
4155 | 4157 | case 'platform_lang': |
4156 | 4158 | $temp_lang = api_get_setting('platformLanguage'); |
4157 | - if (!empty($temp_lang)) |
|
4158 | - $return = $temp_lang; |
|
4159 | + if (!empty($temp_lang)) { |
|
4160 | + $return = $temp_lang; |
|
4161 | + } |
|
4159 | 4162 | break; |
4160 | 4163 | case 'user_profil_lang': |
4161 | 4164 | $_user = api_get_user_info(); |
4162 | 4165 | |
4163 | - if (isset($_user['language']) && !empty($_user['language'])) |
|
4164 | - $return = $_user['language']; |
|
4166 | + if (isset($_user['language']) && !empty($_user['language'])) { |
|
4167 | + $return = $_user['language']; |
|
4168 | + } |
|
4165 | 4169 | break; |
4166 | 4170 | case 'user_selected_lang': |
4167 | - if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) |
|
4168 | - $return = $_SESSION['user_language_choice']; |
|
4171 | + if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) { |
|
4172 | + $return = $_SESSION['user_language_choice']; |
|
4173 | + } |
|
4169 | 4174 | break; |
4170 | 4175 | case 'course_lang': |
4171 | 4176 | global $_course; |
@@ -5434,8 +5439,7 @@ discard block |
||
5434 | 5439 | $is_courseAdmin = false; |
5435 | 5440 | $is_courseCoach = true; |
5436 | 5441 | $is_sessionAdmin = false; |
5437 | - } |
|
5438 | - elseif ($row[0]['session_admin_id'] == $userid) { |
|
5442 | + } elseif ($row[0]['session_admin_id'] == $userid) { |
|
5439 | 5443 | $is_courseMember = false; |
5440 | 5444 | $is_courseTutor = false; |
5441 | 5445 | $is_courseAdmin = false; |
@@ -5778,8 +5782,7 @@ discard block |
||
5778 | 5782 | elseif (isset($_ENV['OS'])) { |
5779 | 5783 | // Sometimes $_ENV['OS'] may not be present (bugs?) |
5780 | 5784 | $os = $_ENV['OS']; |
5781 | - } |
|
5782 | - elseif (defined('PHP_OS')) { |
|
5785 | + } elseif (defined('PHP_OS')) { |
|
5783 | 5786 | // PHP_OS means on which OS PHP was compiled, this is why |
5784 | 5787 | // using PHP_OS is the last choice for detection. |
5785 | 5788 | $os = PHP_OS; |
@@ -5843,12 +5846,10 @@ discard block |
||
5843 | 5846 | if ($delta_width > $delta_height) { |
5844 | 5847 | $result['width'] = ceil($image_width * $resize_factor_height); |
5845 | 5848 | $result['height'] = ceil($image_height * $resize_factor_height); |
5846 | - } |
|
5847 | - elseif ($delta_width < $delta_height) { |
|
5849 | + } elseif ($delta_width < $delta_height) { |
|
5848 | 5850 | $result['width'] = ceil($image_width * $resize_factor_width); |
5849 | 5851 | $result['height'] = ceil($image_height * $resize_factor_width); |
5850 | - } |
|
5851 | - else { |
|
5852 | + } else { |
|
5852 | 5853 | $result['width'] = ceil($target_width); |
5853 | 5854 | $result['height'] = ceil($target_height); |
5854 | 5855 | } |
@@ -6629,7 +6630,9 @@ discard block |
||
6629 | 6630 | } |
6630 | 6631 | $ip = trim($ip1); |
6631 | 6632 | } |
6632 | - if (!empty($debug)) error_log('Real IP: '.$ip); |
|
6633 | + if (!empty($debug)) { |
|
6634 | + error_log('Real IP: '.$ip); |
|
6635 | + } |
|
6633 | 6636 | return $ip; |
6634 | 6637 | } |
6635 | 6638 |
@@ -289,8 +289,9 @@ |
||
289 | 289 | |
290 | 290 | if ($start_date != '' || $end_date != '') { |
291 | 291 | $sql .= " HAVING "; |
292 | - if ($start_date != '') |
|
293 | - $sql .= " access_date >= '$start_date' "; |
|
292 | + if ($start_date != '') { |
|
293 | + $sql .= " access_date >= '$start_date' "; |
|
294 | + } |
|
294 | 295 | if ($end_date != '') { |
295 | 296 | $sql = ($start_date == '') ? $sql : ($sql . " AND "); |
296 | 297 | $sql .= " access_date <= '$end_date' "; |