Minor - format code, add logs

pull/3683/head
Julio Montoya 5 years ago
parent 853d209778
commit ba1fe4bb81
  1. 8
      main/lp/learnpath.class.php
  2. 16
      main/lp/learnpathItem.class.php

@ -4313,6 +4313,9 @@ class learnpath
} }
$currentItem = $this->getItem($itemId); $currentItem = $this->getItem($itemId);
if ($debug > 0) {
error_log("Checking item id $itemId");
}
if ($currentItem) { if ($currentItem) {
if ($this->type == 2) { if ($this->type == 2) {
@ -4350,12 +4353,13 @@ class learnpath
} else { } else {
$result = true; $result = true;
if ($debug > 1) { if ($debug > 1) {
error_log('$this->items['.$itemId.'] was not an object', 0); error_log('$this->items['.$itemId.'] was not an object');
} }
} }
if ($debug > 1) { if ($debug > 1) {
error_log('End of prerequisites_match(). Error message is now '.$this->error, 0); error_log('Result: '.$result);
error_log('End of prerequisites_match(). Error message is now '.$this->error);
} }
return $result; return $result;

@ -12,7 +12,7 @@
*/ */
class learnpathItem class learnpathItem
{ {
const DEBUG = 0; // Logging parameter. public const DEBUG = 0; // Logging parameter.
public $iId; public $iId;
public $attempt_id; // Also called "objectives" SCORM-wise. public $attempt_id; // Also called "objectives" SCORM-wise.
public $audio; // The path to an audio file (stored in document/audio/). public $audio; // The path to an audio file (stored in document/audio/).
@ -250,17 +250,17 @@ class learnpathItem
/** /**
* Closes/stops the item viewing. Finalises runtime values. * Closes/stops the item viewing. Finalises runtime values.
* If required, save to DB. * If required, save to DB.
* @param bool $prerequisitesCheck Needed to check if asset can be set as completed or not
* *
* @return bool True on success, false otherwise * @return bool True on success, false otherwise
*/ */
public function close() public function close()
{ {
if (self::DEBUG) { $debug = self::DEBUG;
error_log('Start - learnpathItem:close');
}
$this->current_stop_time = time(); $this->current_stop_time = time();
$type = $this->get_type(); $type = $this->get_type();
if (self::DEBUG) { if ($debug) {
error_log('Start - learnpathItem:close');
error_log("Type: ".$type); error_log("Type: ".$type);
error_log("get_id: ".$this->get_id()); error_log("get_id: ".$this->get_id());
} }
@ -271,8 +271,6 @@ class learnpathItem
true true
); );
} else { } else {
/*if ($this->prerequisites_match()) {
}*/
$this->status = $this->possible_status[2]; $this->status = $this->possible_status[2];
if (self::DEBUG) { if (self::DEBUG) {
@ -281,13 +279,13 @@ class learnpathItem
} }
} }
if ($this->save_on_close) { if ($this->save_on_close) {
if (self::DEBUG) { if ($debug) {
error_log("save_on_close: "); error_log("save_on_close: ");
} }
$this->save(); $this->save();
} }
if (self::DEBUG) { if ($debug) {
error_log('End - learnpathItem:close'); error_log('End - learnpathItem:close');
} }

Loading…
Cancel
Save