@@ -33,11 +33,9 @@ |
||
| 33 | 33 | { |
| 34 | 34 | if ($entorno == 'INTEG') { |
| 35 | 35 | self::$api_base = "https://integ-pago.culqi.com/api/v1"; |
| 36 | - } |
|
| 37 | - elseif ($entorno == 'PRODUC') { |
|
| 36 | + } elseif ($entorno == 'PRODUC') { |
|
| 38 | 37 | self::$api_base = "https://pago.culqi.com/api/v1"; |
| 39 | - } |
|
| 40 | - else { |
|
| 38 | + } else { |
|
| 41 | 39 | self::$api_base = "https://integ-pago.culqi.com/api/v1"; |
| 42 | 40 | } |
| 43 | 41 | |
@@ -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])) { |
@@ -3881,8 +3881,9 @@ discard block |
||
| 3881 | 3881 | WHERE c_id = ".$course_id." |
| 3882 | 3882 | ORDER BY display_order"; |
| 3883 | 3883 | $res = Database::query($sql); |
| 3884 | - if ($res === false) |
|
| 3885 | - return false; |
|
| 3884 | + if ($res === false) { |
|
| 3885 | + return false; |
|
| 3886 | + } |
|
| 3886 | 3887 | $lps = array (); |
| 3887 | 3888 | $lp_order = array (); |
| 3888 | 3889 | $num = Database :: num_rows($res); |
@@ -4480,8 +4481,9 @@ discard block |
||
| 4480 | 4481 | if ($this->debug > 0) { |
| 4481 | 4482 | error_log('New LP - In learnpath::set_maker()', 0); |
| 4482 | 4483 | } |
| 4483 | - if (empty ($name)) |
|
| 4484 | - return false; |
|
| 4484 | + if (empty ($name)) { |
|
| 4485 | + return false; |
|
| 4486 | + } |
|
| 4485 | 4487 | $this->maker = $name; |
| 4486 | 4488 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4487 | 4489 | $course_id = api_get_course_int_id(); |
@@ -4546,8 +4548,9 @@ discard block |
||
| 4546 | 4548 | public function set_terms_by_prefix($terms_string, $prefix) |
| 4547 | 4549 | { |
| 4548 | 4550 | $course_id = api_get_course_int_id(); |
| 4549 | - if (api_get_setting('search_enabled') !== 'true') |
|
| 4550 | - return false; |
|
| 4551 | + if (api_get_setting('search_enabled') !== 'true') { |
|
| 4552 | + return false; |
|
| 4553 | + } |
|
| 4551 | 4554 | |
| 4552 | 4555 | if (!extension_loaded('xapian')) { |
| 4553 | 4556 | return false; |
@@ -4560,8 +4563,9 @@ discard block |
||
| 4560 | 4563 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
| 4561 | 4564 | |
| 4562 | 4565 | // Don't do anything if no change, verify only at DB, not the search engine. |
| 4563 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
| 4564 | - return false; |
|
| 4566 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
| 4567 | + return false; |
|
| 4568 | + } |
|
| 4565 | 4569 | |
| 4566 | 4570 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
| 4567 | 4571 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4753,8 +4757,9 @@ discard block |
||
| 4753 | 4757 | if ($this->debug > 0) { |
| 4754 | 4758 | error_log('New LP - In learnpath::set_proximity()', 0); |
| 4755 | 4759 | } |
| 4756 | - if (empty ($name)) |
|
| 4757 | - return false; |
|
| 4760 | + if (empty ($name)) { |
|
| 4761 | + return false; |
|
| 4762 | + } |
|
| 4758 | 4763 | |
| 4759 | 4764 | $this->proximity = $name; |
| 4760 | 4765 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5098,8 +5103,9 @@ discard block |
||
| 5098 | 5103 | |
| 5099 | 5104 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
| 5100 | 5105 | $res = Database::query($sql); |
| 5101 | - if ($res === false) |
|
| 5102 | - return false; |
|
| 5106 | + if ($res === false) { |
|
| 5107 | + return false; |
|
| 5108 | + } |
|
| 5103 | 5109 | |
| 5104 | 5110 | $num = Database :: num_rows($res); |
| 5105 | 5111 | // First check the order is correct, globally (might be wrong because |
@@ -5410,8 +5416,9 @@ discard block |
||
| 5410 | 5416 | $position[$key] = $row['display_order']; |
| 5411 | 5417 | } |
| 5412 | 5418 | |
| 5413 | - if (count($array) > 0) |
|
| 5414 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
| 5419 | + if (count($array) > 0) { |
|
| 5420 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
| 5421 | + } |
|
| 5415 | 5422 | |
| 5416 | 5423 | return $array; |
| 5417 | 5424 | } |
@@ -6183,10 +6190,12 @@ discard block |
||
| 6183 | 6190 | if ($new_comment || $new_title) { |
| 6184 | 6191 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
| 6185 | 6192 | $ct = ''; |
| 6186 | - if ($new_comment) |
|
| 6187 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
| 6188 | - if ($new_title) |
|
| 6189 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
| 6193 | + if ($new_comment) { |
|
| 6194 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
| 6195 | + } |
|
| 6196 | + if ($new_title) { |
|
| 6197 | + $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
| 6198 | + } |
|
| 6190 | 6199 | |
| 6191 | 6200 | $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
| 6192 | 6201 | WHERE c_id = ".$course_id." AND id = " . $document_id; |
@@ -6210,17 +6219,21 @@ discard block |
||
| 6210 | 6219 | // Please, do not modify this dirname formatting. |
| 6211 | 6220 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
| 6212 | 6221 | |
| 6213 | - if (strstr($dir, '..')) |
|
| 6214 | - $dir = '/'; |
|
| 6222 | + if (strstr($dir, '..')) { |
|
| 6223 | + $dir = '/'; |
|
| 6224 | + } |
|
| 6215 | 6225 | |
| 6216 | - if ($dir[0] == '.') |
|
| 6217 | - $dir = substr($dir, 1); |
|
| 6226 | + if ($dir[0] == '.') { |
|
| 6227 | + $dir = substr($dir, 1); |
|
| 6228 | + } |
|
| 6218 | 6229 | |
| 6219 | - if ($dir[0] != '/') |
|
| 6220 | - $dir = '/' . $dir; |
|
| 6230 | + if ($dir[0] != '/') { |
|
| 6231 | + $dir = '/' . $dir; |
|
| 6232 | + } |
|
| 6221 | 6233 | |
| 6222 | - if ($dir[strlen($dir) - 1] != '/') |
|
| 6223 | - $dir .= '/'; |
|
| 6234 | + if ($dir[strlen($dir) - 1] != '/') { |
|
| 6235 | + $dir .= '/'; |
|
| 6236 | + } |
|
| 6224 | 6237 | |
| 6225 | 6238 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
| 6226 | 6239 | |
@@ -6285,8 +6298,9 @@ discard block |
||
| 6285 | 6298 | } |
| 6286 | 6299 | $return .= '<div style="padding:10px;">'; |
| 6287 | 6300 | |
| 6288 | - if ($msg != '') |
|
| 6289 | - $return .= $msg; |
|
| 6301 | + if ($msg != '') { |
|
| 6302 | + $return .= $msg; |
|
| 6303 | + } |
|
| 6290 | 6304 | |
| 6291 | 6305 | $return .= '<h3>'.$row['title'].'</h3>'; |
| 6292 | 6306 | switch ($row['item_type']) { |
@@ -6563,10 +6577,11 @@ discard block |
||
| 6563 | 6577 | $item_title = Security::remove_XSS($item_title); |
| 6564 | 6578 | $item_description = Security::remove_XSS($item_description); |
| 6565 | 6579 | |
| 6566 | - if ($id != 0 && is_array($extra_info)) |
|
| 6567 | - $parent = $extra_info['parent_item_id']; |
|
| 6568 | - else |
|
| 6569 | - $parent = 0; |
|
| 6580 | + if ($id != 0 && is_array($extra_info)) { |
|
| 6581 | + $parent = $extra_info['parent_item_id']; |
|
| 6582 | + } else { |
|
| 6583 | + $parent = 0; |
|
| 6584 | + } |
|
| 6570 | 6585 | |
| 6571 | 6586 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
| 6572 | 6587 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6866,8 +6881,9 @@ discard block |
||
| 6866 | 6881 | $arrHide[] = $arrLP[$i]['id']; |
| 6867 | 6882 | } |
| 6868 | 6883 | } else { |
| 6869 | - if ($arrLP[$i]['item_type'] == 'dir') |
|
| 6870 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6884 | + if ($arrLP[$i]['item_type'] == 'dir') { |
|
| 6885 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6886 | + } |
|
| 6871 | 6887 | } |
| 6872 | 6888 | } |
| 6873 | 6889 | reset($arrLP); |
@@ -6884,11 +6900,13 @@ discard block |
||
| 6884 | 6900 | |
| 6885 | 6901 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6886 | 6902 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
| 6887 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
| 6903 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
| 6904 | + $selected = 'selected="selected" '; |
|
| 6905 | + } elseif ($action == 'add') { |
|
| 6888 | 6906 | $selected = 'selected="selected" '; |
| 6889 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
| 6890 | - else |
|
| 6891 | - $selected = ''; |
|
| 6907 | + } else { |
|
| 6908 | + $selected = ''; |
|
| 6909 | + } |
|
| 6892 | 6910 | |
| 6893 | 6911 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
| 6894 | 6912 | } |
@@ -6915,9 +6933,11 @@ discard block |
||
| 6915 | 6933 | $arrHide = array (); |
| 6916 | 6934 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6917 | 6935 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
| 6918 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
| 6919 | - $s_selected_position = $arrLP[$i]['id']; |
|
| 6920 | - elseif ($action == 'add') $s_selected_position = 0; |
|
| 6936 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
| 6937 | + $s_selected_position = $arrLP[$i]['id']; |
|
| 6938 | + } elseif ($action == 'add') { |
|
| 6939 | + $s_selected_position = 0; |
|
| 6940 | + } |
|
| 6921 | 6941 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
| 6922 | 6942 | } |
| 6923 | 6943 | } |
@@ -7110,9 +7130,11 @@ discard block |
||
| 7110 | 7130 | $arrHide = array(); |
| 7111 | 7131 | for ($i = 0; $i < count($arrLP); $i++) { |
| 7112 | 7132 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
| 7113 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
| 7114 | - $s_selected_position = $arrLP[$i]['id']; |
|
| 7115 | - elseif ($action == 'add') $s_selected_position = 0; |
|
| 7133 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
| 7134 | + $s_selected_position = $arrLP[$i]['id']; |
|
| 7135 | + } elseif ($action == 'add') { |
|
| 7136 | + $s_selected_position = 0; |
|
| 7137 | + } |
|
| 7116 | 7138 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
| 7117 | 7139 | } |
| 7118 | 7140 | } |
@@ -7307,9 +7329,11 @@ discard block |
||
| 7307 | 7329 | |
| 7308 | 7330 | for ($i = 0; $i < count($arrLP); $i++) { |
| 7309 | 7331 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
| 7310 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
| 7311 | - $s_selected_position = $arrLP[$i]['id']; |
|
| 7312 | - elseif ($action == 'add') $s_selected_position = 0; |
|
| 7332 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
| 7333 | + $s_selected_position = $arrLP[$i]['id']; |
|
| 7334 | + } elseif ($action == 'add') { |
|
| 7335 | + $s_selected_position = 0; |
|
| 7336 | + } |
|
| 7313 | 7337 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
| 7314 | 7338 | |
| 7315 | 7339 | } |
@@ -7343,8 +7367,7 @@ discard block |
||
| 7343 | 7367 | |
| 7344 | 7368 | if (is_numeric($extra_info)) { |
| 7345 | 7369 | $form->addHidden('path', $extra_info); |
| 7346 | - } |
|
| 7347 | - elseif (is_array($extra_info)) { |
|
| 7370 | + } elseif (is_array($extra_info)) { |
|
| 7348 | 7371 | $form->addHidden('path', $extra_info['path']); |
| 7349 | 7372 | } |
| 7350 | 7373 | |
@@ -7397,8 +7420,9 @@ discard block |
||
| 7397 | 7420 | lp_id = " . $this->lp_id . " AND |
| 7398 | 7421 | id != $id"; |
| 7399 | 7422 | |
| 7400 | - if ($item_type == 'dir') |
|
| 7401 | - $sql .= " AND parent_item_id = 0"; |
|
| 7423 | + if ($item_type == 'dir') { |
|
| 7424 | + $sql .= " AND parent_item_id = 0"; |
|
| 7425 | + } |
|
| 7402 | 7426 | |
| 7403 | 7427 | $result = Database::query($sql); |
| 7404 | 7428 | $arrLP = array (); |
@@ -7795,9 +7819,11 @@ discard block |
||
| 7795 | 7819 | $arrHide = array(); |
| 7796 | 7820 | for ($i = 0; $i < count($arrLP); $i++) { |
| 7797 | 7821 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) { |
| 7798 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
| 7822 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
| 7823 | + $s_selected_position = $arrLP[$i]['id']; |
|
| 7824 | + } elseif ($action == 'add') { |
|
| 7799 | 7825 | $s_selected_position = $arrLP[$i]['id']; |
| 7800 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
| 7826 | + } |
|
| 7801 | 7827 | |
| 7802 | 7828 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
| 7803 | 7829 | |
@@ -7808,17 +7834,18 @@ discard block |
||
| 7808 | 7834 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
| 7809 | 7835 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
| 7810 | 7836 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) { |
| 7811 | - if (isset ($_POST['content'])) |
|
| 7812 | - $content = stripslashes($_POST['content']); |
|
| 7813 | - elseif (is_array($extra_info)) { |
|
| 7837 | + if (isset ($_POST['content'])) { |
|
| 7838 | + $content = stripslashes($_POST['content']); |
|
| 7839 | + } elseif (is_array($extra_info)) { |
|
| 7814 | 7840 | //If it's an html document or a text file |
| 7815 | 7841 | if (!$no_display_edit_textarea) { |
| 7816 | 7842 | $content = $this->display_document($extra_info['path'], false, false); |
| 7817 | 7843 | } |
| 7818 | - } elseif (is_numeric($extra_info)) |
|
| 7819 | - $content = $this->display_document($extra_info, false, false); |
|
| 7820 | - else |
|
| 7821 | - $content = ''; |
|
| 7844 | + } elseif (is_numeric($extra_info)) { |
|
| 7845 | + $content = $this->display_document($extra_info, false, false); |
|
| 7846 | + } else { |
|
| 7847 | + $content = ''; |
|
| 7848 | + } |
|
| 7822 | 7849 | |
| 7823 | 7850 | if (!$no_display_edit_textarea) { |
| 7824 | 7851 | // We need to calculate here some specific settings for the online editor. |
@@ -8082,9 +8109,11 @@ discard block |
||
| 8082 | 8109 | $arrHide = array(); |
| 8083 | 8110 | for ($i = 0; $i < count($arrLP); $i++) { |
| 8084 | 8111 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
| 8085 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
| 8086 | - $s_selected_position = $arrLP[$i]['id']; |
|
| 8087 | - elseif ($action == 'add') $s_selected_position = 0; |
|
| 8112 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
| 8113 | + $s_selected_position = $arrLP[$i]['id']; |
|
| 8114 | + } elseif ($action == 'add') { |
|
| 8115 | + $s_selected_position = 0; |
|
| 8116 | + } |
|
| 8088 | 8117 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
| 8089 | 8118 | |
| 8090 | 8119 | } |
@@ -8280,9 +8309,11 @@ discard block |
||
| 8280 | 8309 | $arrHide = array (); |
| 8281 | 8310 | for ($i = 0; $i < count($arrLP); $i++) { |
| 8282 | 8311 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
| 8283 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
| 8284 | - $s_selected_position = $arrLP[$i]['id']; |
|
| 8285 | - elseif ($action == 'add') $s_selected_position = 0; |
|
| 8312 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
| 8313 | + $s_selected_position = $arrLP[$i]['id']; |
|
| 8314 | + } elseif ($action == 'add') { |
|
| 8315 | + $s_selected_position = 0; |
|
| 8316 | + } |
|
| 8286 | 8317 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
| 8287 | 8318 | |
| 8288 | 8319 | } |
@@ -9353,10 +9384,11 @@ discard block |
||
| 9353 | 9384 | |
| 9354 | 9385 | // Dependency to other files - not yet supported. |
| 9355 | 9386 | $i = 1; |
| 9356 | - if ($inc_docs) |
|
| 9357 | - foreach ($inc_docs as $doc_info) { |
|
| 9387 | + if ($inc_docs) { |
|
| 9388 | + foreach ($inc_docs as $doc_info) { |
|
| 9358 | 9389 | if (count($doc_info) < 1 || empty($doc_info[0])) { |
| 9359 | 9390 | continue; |
| 9391 | + } |
|
| 9360 | 9392 | } |
| 9361 | 9393 | $my_dep = $xmldoc->createElement('resource'); |
| 9362 | 9394 | $res_id = 'RESOURCE_'.$item->get_id().'_'.$i; |
@@ -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); |