@@ -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 | $plugin = 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'], $plugin); |
104 | 116 | |
105 | 117 | if ($options['lint']) { |
@@ -92,25 +92,39 @@ |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions |
95 | -if ($options['verbose']) echo "loaded dbclass\n"; |
|
95 | +if ($options['verbose']) { |
|
96 | + echo "loaded dbclass\n"; |
|
97 | +} |
|
96 | 98 | require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions |
97 | -if ($options['verbose']) echo "loaded textlib\n"; |
|
99 | +if ($options['verbose']) { |
|
100 | + echo "loaded textlib\n"; |
|
101 | +} |
|
98 | 102 | require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API |
99 | -if ($options['verbose']) echo "loaded moodle wrapping\n"; |
|
103 | +if ($options['verbose']) { |
|
104 | + echo "loaded moodle wrapping\n"; |
|
105 | +} |
|
100 | 106 | require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php'); |
101 | -if ($options['verbose']) echo "loaded vchamilo plugin\n"; |
|
107 | +if ($options['verbose']) { |
|
108 | + echo "loaded vchamilo plugin\n"; |
|
109 | +} |
|
102 | 110 | |
103 | 111 | global $DB; |
104 | -if ($options['verbose']) echo "building database manager\n"; |
|
112 | +if ($options['verbose']) { |
|
113 | + echo "building database manager\n"; |
|
114 | +} |
|
105 | 115 | $DB = new DatabaseManager(); |
106 | -if ($options['verbose']) echo "building plugin vchamilo\n"; |
|
116 | +if ($options['verbose']) { |
|
117 | + echo "building plugin vchamilo\n"; |
|
118 | +} |
|
107 | 119 | $plugin = VChamiloPlugin::create(); |
108 | 120 | |
109 | 121 | if (empty($options['nodes'])) { |
110 | 122 | cli_error(get_string('climissingnodes', 'block_vmoodle')); |
111 | 123 | } |
112 | 124 | |
113 | -if ($options['verbose']) echo "parsing nodelist\n"; |
|
125 | +if ($options['verbose']) { |
|
126 | + echo "parsing nodelist\n"; |
|
127 | +} |
|
114 | 128 | $nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugin); |
115 | 129 | |
116 | 130 | if ($options['lint']) { |
@@ -73,10 +73,11 @@ discard block |
||
73 | 73 | $data = curl_exec( $ch ); |
74 | 74 | curl_close( $ch ); |
75 | 75 | |
76 | - if($data) |
|
77 | - return (new SimpleXMLElement($data)); |
|
78 | - else |
|
79 | - return false; |
|
76 | + if($data) { |
|
77 | + return (new SimpleXMLElement($data)); |
|
78 | + } else { |
|
79 | + return false; |
|
80 | + } |
|
80 | 81 | } |
81 | 82 | return (simplexml_load_file($url)); |
82 | 83 | } |
@@ -85,11 +86,9 @@ discard block |
||
85 | 86 | /* Process required params and throw errors if we don't get values */ |
86 | 87 | if ((isset($param)) && ($param != '')) { |
87 | 88 | return $param; |
88 | - } |
|
89 | - elseif (!isset($param)) { |
|
89 | + } elseif (!isset($param)) { |
|
90 | 90 | throw new Exception('Missing parameter.'); |
91 | - } |
|
92 | - else { |
|
91 | + } else { |
|
93 | 92 | throw new Exception(''.$param.' is required.'); |
94 | 93 | } |
95 | 94 | } |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | /* Don't know if we'll use this one, but let's build it in case. */ |
100 | 99 | if ((isset($param)) && ($param != '')) { |
101 | 100 | return $param; |
102 | - } |
|
103 | - else { |
|
101 | + } else { |
|
104 | 102 | $param = ''; |
105 | 103 | return $param; |
106 | 104 | } |
@@ -137,8 +135,9 @@ discard block |
||
137 | 135 | '&duration='.urlencode($creationParams['duration']); |
138 | 136 | //'&meta_category='.urlencode($creationParams['meta_category']); |
139 | 137 | $welcomeMessage = $creationParams['welcomeMsg']; |
140 | - if(trim($welcomeMessage)) |
|
141 | - $params .= '&welcome='.urlencode($welcomeMessage); |
|
138 | + if(trim($welcomeMessage)) { |
|
139 | + $params .= '&welcome='.urlencode($welcomeMessage); |
|
140 | + } |
|
142 | 141 | // Return the complete URL: |
143 | 142 | return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
144 | 143 | } |
@@ -165,8 +164,8 @@ discard block |
||
165 | 164 | $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
166 | 165 | |
167 | 166 | if ($xml) { |
168 | - if($xml->meetingID) |
|
169 | - return array( |
|
167 | + if($xml->meetingID) { |
|
168 | + return array( |
|
170 | 169 | 'returncode' => $xml->returncode->__toString(), |
171 | 170 | 'message' => $xml->message->__toString(), |
172 | 171 | 'messageKey' => $xml->messageKey->__toString(), |
@@ -176,14 +175,14 @@ discard block |
||
176 | 175 | 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
177 | 176 | 'createTime' => $xml->createTime->__toString() |
178 | 177 | ); |
179 | - else |
|
180 | - return array( |
|
178 | + } else { |
|
179 | + return array( |
|
181 | 180 | 'returncode' => $xml->returncode->__toString(), |
182 | 181 | 'message' => $xml->message->__toString(), |
183 | 182 | 'messageKey' => $xml->messageKey->__toString() |
184 | 183 | ); |
185 | - } |
|
186 | - else { |
|
184 | + } |
|
185 | + } else { |
|
187 | 186 | return null; |
188 | 187 | } |
189 | 188 | } |
@@ -253,8 +252,7 @@ discard block |
||
253 | 252 | 'message' => $xml->message->__toString(), |
254 | 253 | 'messageKey' => $xml->messageKey->__toString() |
255 | 254 | ); |
256 | - } |
|
257 | - else { |
|
255 | + } else { |
|
258 | 256 | return null; |
259 | 257 | } |
260 | 258 | |
@@ -288,8 +286,7 @@ discard block |
||
288 | 286 | 'returncode' => $xml->returncode->__toString(), |
289 | 287 | 'running' => $xml->running->__toString() // -- Returns true/false. |
290 | 288 | ); |
291 | - } |
|
292 | - else { |
|
289 | + } else { |
|
293 | 290 | return null; |
294 | 291 | } |
295 | 292 | |
@@ -317,8 +314,7 @@ discard block |
||
317 | 314 | 'returncode' => $xml->returncode->__toString() |
318 | 315 | ); |
319 | 316 | return $result; |
320 | - } |
|
321 | - elseif ($xml->messageKey == 'noMeetings') { |
|
317 | + } elseif ($xml->messageKey == 'noMeetings') { |
|
322 | 318 | /* No meetings on server, so return just this info: */ |
323 | 319 | $result = array( |
324 | 320 | 'returncode' => $xml->returncode->__toString(), |
@@ -326,8 +322,7 @@ discard block |
||
326 | 322 | 'message' => $xml->message->__toString() |
327 | 323 | ); |
328 | 324 | return $result; |
329 | - } |
|
330 | - else { |
|
325 | + } else { |
|
331 | 326 | // In this case, we have success and meetings. First return general response: |
332 | 327 | $result = array( |
333 | 328 | 'returncode' => $xml->returncode->__toString(), |
@@ -348,8 +343,7 @@ discard block |
||
348 | 343 | } |
349 | 344 | return $result; |
350 | 345 | } |
351 | - } |
|
352 | - else { |
|
346 | + } else { |
|
353 | 347 | return null; |
354 | 348 | } |
355 | 349 | |
@@ -388,8 +382,7 @@ discard block |
||
388 | 382 | 'message' => $xml->message->__toString() |
389 | 383 | ); |
390 | 384 | return $result; |
391 | - } |
|
392 | - else { |
|
385 | + } else { |
|
393 | 386 | // In this case, we have success and meeting info: |
394 | 387 | $result = array( |
395 | 388 | 'returncode' => $xml->returncode->__toString(), |
@@ -418,8 +411,7 @@ discard block |
||
418 | 411 | } |
419 | 412 | return $result; |
420 | 413 | } |
421 | - } |
|
422 | - else { |
|
414 | + } else { |
|
423 | 415 | return null; |
424 | 416 | } |
425 | 417 | |
@@ -463,8 +455,7 @@ discard block |
||
463 | 455 | 'message' => $xml->message->__toString() |
464 | 456 | ); |
465 | 457 | return $result; |
466 | - } |
|
467 | - else { |
|
458 | + } else { |
|
468 | 459 | // In this case, we have success and recording info: |
469 | 460 | $result = array( |
470 | 461 | 'returncode' => $xml->returncode->__toString(), |
@@ -495,8 +486,7 @@ discard block |
||
495 | 486 | } |
496 | 487 | return $result; |
497 | 488 | } |
498 | - } |
|
499 | - else { |
|
489 | + } else { |
|
500 | 490 | return null; |
501 | 491 | } |
502 | 492 | } |
@@ -529,8 +519,7 @@ discard block |
||
529 | 519 | 'returncode' => $xml->returncode->__toString(), |
530 | 520 | 'published' => $xml->published->__toString() // -- Returns true/false. |
531 | 521 | ); |
532 | - } |
|
533 | - else { |
|
522 | + } else { |
|
534 | 523 | return null; |
535 | 524 | } |
536 | 525 | |
@@ -562,8 +551,7 @@ discard block |
||
562 | 551 | 'returncode' => $xml->returncode->__toString(), |
563 | 552 | 'deleted' => $xml->deleted->__toString() // -- Returns true/false. |
564 | 553 | ); |
565 | - } |
|
566 | - else { |
|
554 | + } else { |
|
567 | 555 | return null; |
568 | 556 | } |
569 | 557 |
@@ -123,8 +123,9 @@ |
||
123 | 123 | |
124 | 124 | for ($i = 0; $i < count($matches[0]); $i++) { |
125 | 125 | |
126 | - if (empty($matches[1][$i])) |
|
127 | - continue; |
|
126 | + if (empty($matches[1][$i])) { |
|
127 | + continue; |
|
128 | + } |
|
128 | 129 | |
129 | 130 | $content = strstr($content,$matches[0][$i]); |
130 | 131 | if ($i + 1 !== count($matches[0])) { |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | public function get_not_created_links() |
30 | 30 | { |
31 | 31 | return false; |
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
32 | + if (empty($this->course_code)) { |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
36 | 37 | |
@@ -57,8 +58,9 @@ discard block |
||
57 | 58 | */ |
58 | 59 | public function get_all_links() |
59 | 60 | { |
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
61 | + if (empty($this->course_code)) { |
|
62 | + die('Error in get_not_created_links() : course code not set'); |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $session_id = api_get_session_id(); |
64 | 66 | if (empty($session_id)) { |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | lp_id = ".$this->get_ref_id()." AND |
112 | 114 | session_id = $session_id "; |
113 | 115 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + if (isset($stud_id)) { |
|
117 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
118 | + } |
|
116 | 119 | |
117 | 120 | // order by id, that way the student's first attempt is accessed first |
118 | 121 | $sql .= ' ORDER BY view_count DESC'; |
@@ -122,8 +125,9 @@ discard block |
||
122 | 125 | if (isset($stud_id)) { |
123 | 126 | if ($data = Database::fetch_assoc($scores)) { |
124 | 127 | return array ($data['progress'], 100); |
125 | - } else |
|
126 | - return null; |
|
128 | + } else { |
|
129 | + return null; |
|
130 | + } |
|
127 | 131 | } else { |
128 | 132 | // all students -> get average |
129 | 133 | $students = array(); // user list, needed to make sure we only |
@@ -231,36 +231,51 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | if (isset($user_id)) { |
234 | - if ($paramcount != 0) $sql .= ' AND'; |
|
235 | - else $sql .= ' WHERE'; |
|
234 | + if ($paramcount != 0) { |
|
235 | + $sql .= ' AND'; |
|
236 | + } else { |
|
237 | + $sql .= ' WHERE'; |
|
238 | + } |
|
236 | 239 | $sql .= ' user_id = '.intval($user_id); |
237 | 240 | $paramcount ++; |
238 | 241 | } |
239 | 242 | |
240 | 243 | if (isset($course_code) && $course_code <> '-1') { |
241 | - if ($paramcount != 0) $sql .= ' AND'; |
|
242 | - else $sql .= ' WHERE'; |
|
244 | + if ($paramcount != 0) { |
|
245 | + $sql .= ' AND'; |
|
246 | + } else { |
|
247 | + $sql .= ' WHERE'; |
|
248 | + } |
|
243 | 249 | $sql .= " course_code = '".Database::escape_string($course_code)."'"; |
244 | 250 | $paramcount ++; |
245 | 251 | } |
246 | 252 | |
247 | 253 | if (isset($category_id)) { |
248 | - if ($paramcount != 0) $sql .= ' AND'; |
|
249 | - else $sql .= ' WHERE'; |
|
254 | + if ($paramcount != 0) { |
|
255 | + $sql .= ' AND'; |
|
256 | + } else { |
|
257 | + $sql .= ' WHERE'; |
|
258 | + } |
|
250 | 259 | $sql .= ' category_id = '.intval($category_id); |
251 | 260 | $paramcount ++; |
252 | 261 | } |
253 | 262 | |
254 | 263 | if (isset($visible)) { |
255 | - if ($paramcount != 0) $sql .= ' AND'; |
|
256 | - else $sql .= ' WHERE'; |
|
264 | + if ($paramcount != 0) { |
|
265 | + $sql .= ' AND'; |
|
266 | + } else { |
|
267 | + $sql .= ' WHERE'; |
|
268 | + } |
|
257 | 269 | $sql .= ' visible = '.intval($visible); |
258 | 270 | $paramcount ++; |
259 | 271 | } |
260 | 272 | |
261 | 273 | if (isset($locked)) { |
262 | - if ($paramcount != 0) $sql .= ' AND'; |
|
263 | - else $sql .= ' WHERE'; |
|
274 | + if ($paramcount != 0) { |
|
275 | + $sql .= ' AND'; |
|
276 | + } else { |
|
277 | + $sql .= ' WHERE'; |
|
278 | + } |
|
264 | 279 | $sql .= ' locked = '.intval($locked); |
265 | 280 | } |
266 | 281 | |
@@ -398,7 +413,7 @@ discard block |
||
398 | 413 | .', description = '; |
399 | 414 | if (isset($this->description)) { |
400 | 415 | $sql .= "'".Database::escape_string($this->get_description())."'"; |
401 | - }else { |
|
416 | + } else { |
|
402 | 417 | $sql .= 'null'; |
403 | 418 | } |
404 | 419 | $sql .= ', user_id = '.intval($this->get_user_id()) |
@@ -469,7 +484,7 @@ discard block |
||
469 | 484 | $sql .= ' AND user_id = '.api_get_user_id(); |
470 | 485 | } |
471 | 486 | |
472 | - }else { |
|
487 | + } else { |
|
473 | 488 | $sql .= ' AND user_id = '.api_get_user_id(); |
474 | 489 | } |
475 | 490 |
@@ -173,7 +173,10 @@ |
||
173 | 173 | echo '<div id="advancedSearch" style="display: none">'. get_lang('SearchSessions'); ?> : |
174 | 174 | <input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()"> |
175 | 175 | </div> |
176 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
176 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) { |
|
177 | + echo '&add=true' ; |
|
178 | +} |
|
179 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
177 | 180 | <?php |
178 | 181 | echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; |
179 | 182 | echo Display::input('hidden','id',$id); |
@@ -96,13 +96,14 @@ |
||
96 | 96 | |
97 | 97 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
98 | 98 | |
99 | -if (!$is_certificate_mode) |
|
99 | +if (!$is_certificate_mode) { |
|
100 | 100 | $interbreadcrumb[] = array( |
101 | 101 | "url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), |
102 | 102 | "name" => get_lang('Documents'), |
103 | 103 | ); |
104 | -else |
|
104 | +} else { |
|
105 | 105 | $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
106 | +} |
|
106 | 107 | |
107 | 108 | // Interbreadcrumb for the current directory root path |
108 | 109 | if (empty($document_data['parents'])) { |
@@ -491,13 +491,19 @@ |
||
491 | 491 | $id = intval($id); |
492 | 492 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
493 | 493 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
494 | - if (!Database::query($sql)) return false; |
|
494 | + if (!Database::query($sql)) { |
|
495 | + return false; |
|
496 | + } |
|
495 | 497 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
496 | 498 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
497 | - if (!Database::query($sql)) return false; |
|
499 | + if (!Database::query($sql)) { |
|
500 | + return false; |
|
501 | + } |
|
498 | 502 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
499 | 503 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
500 | - if (!Database::query($sql)) return false; |
|
504 | + if (!Database::query($sql)) { |
|
505 | + return false; |
|
506 | + } |
|
501 | 507 | return true; |
502 | 508 | } |
503 | 509 |