ソースを参照

Minor - Removing "New LP" in error logs

Julio Montoya 12 年 前
コミット
96734f2f9c
1 ファイル変更110 行追加109 行削除
  1. 110 109
      main/newscorm/learnpathItem.class.php

+ 110 - 109
main/newscorm/learnpathItem.class.php

@@ -76,7 +76,7 @@ class learnpathItem {
 	public function __construct($id, $user_id = null, $course_id = null, $item_content = null) {
 		// Get items table.
 		if (!isset($user_id)) { $user_id = api_get_user_id(); }
-		if (self::debug > 0) { error_log("New LP - In learnpathItem constructor: id: $id user_id: $user_id course_id: $course_id item_content: $item_content", 0); }
+		if (self::debug > 0) { error_log("learnpathItem constructor: id: $id user_id: $user_id course_id: $course_id item_content: $item_content", 0); }
 		$id = intval($id);
         
         if (empty($item_content)) {
@@ -145,7 +145,7 @@ class learnpathItem {
 	 * Adds a child to the current item
 	 */
 	public function add_child($item) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::add_child()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::add_child()', 0); }
 		if (!empty($item)) {
 			// Do not check in DB as we expect the call to come from the learnpath class which should
 			// be aware of any fake.
@@ -199,7 +199,7 @@ class learnpathItem {
 	 * @return	boolean	True on success, false otherwise
 	 */
 	public function close() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::close()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::close()', 0); }
 	   	$this->current_stop_time = time();
 	   	$type = $this->get_type();
 		if ($type != 'sco') {
@@ -220,7 +220,7 @@ class learnpathItem {
 	 * @return	boolean	true. Doesn't check for errors yet.
 	 */
 	public function delete() {
-		if (self::debug > 0) { error_log('New LP - In learnpath_item::delete() for item '.$this->db_id, 0); }
+		if (self::debug > 0) { error_log('learnpath_item::delete() for item '.$this->db_id, 0); }
 		$lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
 		$lp_item = Database::get_course_table(TABLE_LP_ITEM);
 
@@ -256,7 +256,7 @@ class learnpathItem {
 	 * @return 	void
 	 */
 	public function drop_child($item) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::drop_child()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::drop_child()', 0); }
 		if (!empty($item)) {
 			foreach ($this->children as $index => $child) {
 				if ($child == $item) {
@@ -271,7 +271,7 @@ class learnpathItem {
 	 * @return	integer	The attempt_id for this item view by this user, or 1 if none defined
 	 */
 	public function get_attempt_id() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_attempt_id() on item '.$this->db_id, 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_attempt_id() on item '.$this->db_id, 0); }
 		$res = 1;
 		if (!empty($this->attempt_id)) {
 			$res = $this->attempt_id;
@@ -285,7 +285,7 @@ class learnpathItem {
 	 * @return	array	Array of children items IDs
 	 */
 	public function get_children() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_children()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_children()', 0); }
 		$list = array();
 		foreach ($this->children as $child) {
 			if (!empty($child)) {
@@ -309,7 +309,7 @@ class learnpathItem {
 	 * @return	string	'credit' or 'no-credit'. Defaults to 'credit' because if we don't know enough about this item, it's probably because it was never used before.
 	 */
 	public function get_credit() {
-		if (self::debug > 1) {error_log('New LP - In learnpathItem::get_credit()', 0); }
+		if (self::debug > 1) {error_log('learnpathItem::get_credit()', 0); }
 		$credit = 'credit';
 		// Now check the value of prevent_reinit (if it's 0, return credit as the default was).
 		if ($this->get_prevent_reinit() != 0) { // If prevent_reinit == 1 (or more).
@@ -317,11 +317,13 @@ class learnpathItem {
 			// Check the status in the database rather than in the object, as checking in the object
 			// would always return "no-credit" when we want to set it to completed.
 			$status = $this->get_status(true);
-			if (self::debug > 2) { error_log('New LP - In learnpathItem::get_credit() - get_prevent_reinit!=0 and status is '.$status, 0); }
+			if (self::debug > 2) { error_log('learnpathItem::get_credit() - get_prevent_reinit!=0 and status is '.$status, 0); }
+            //0=not attempted - 1 = incomplete
 			if ($status != $this->possible_status[0] && $status != $this->possible_status[1]) {
 				$credit = 'no-credit';
 			}
 		}
+        if (self::debug > 1) {error_log("learnpathItem::get_credit() returns: $credit"); }
 		return $credit;
 	}
 
@@ -330,7 +332,7 @@ class learnpathItem {
 	 * @return	integer	Current start time, or current time if none
 	 */
 	public function get_current_start_time() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_current_start_time()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_current_start_time()', 0); }
 		if (empty($this->current_start_time)) {
 			return time();
 		} else {
@@ -343,7 +345,7 @@ class learnpathItem {
 	 * @return	string	Description
 	 */
 	public function get_description() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_description()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_description()', 0); }
 		if (empty($this->description)) { return ''; }
 		return $this->description;
 	}
@@ -354,7 +356,7 @@ class learnpathItem {
 	 */
 	public function get_file_path($path_to_scorm_dir = '') {
 	    $course_id = api_get_course_int_id();
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_file_path()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_file_path()', 0); }
 		$path = $this->get_path();
    		$type = $this->get_type();
 		if (empty($path)) {
@@ -398,7 +400,7 @@ class learnpathItem {
 	 * @return	integer	Database ID for the current item
 	 */
 	public function get_id() {
-		if (self::debug > 1) {error_log('New LP - In learnpathItem::get_id()', 0); }
+		if (self::debug > 1) {error_log('learnpathItem::get_id()', 0); }
 		if (!empty($this->db_id)) {
 			return $this->db_id;
 		}
@@ -440,7 +442,7 @@ class learnpathItem {
 	 * @return	int	The current number of interactions recorder
 	 */
 	public function get_interactions_count($checkdb = false) {
-		if (self::debug > 1) { error_log('New LP - In learnpathItem::get_interactions_count()', 0); }
+		if (self::debug > 1) { error_log('learnpathItem::get_interactions_count()', 0); }
 		$return = 0;
         $course_id = api_get_course_int_id();
 
@@ -495,7 +497,7 @@ class learnpathItem {
 	 * @return	int	The current number of objectives recorder
 	 */
 	public function get_objectives_count() {
-		if (self::debug > 1) { error_log('New LP - In learnpathItem::get_objectives_count()', 0);}
+		if (self::debug > 1) { error_log('learnpathItem::get_objectives_count()', 0);}
 		$res = 0;
 		if (!empty($this->objectives_count)) {
 			$res = $this->objectives_count;
@@ -508,7 +510,7 @@ class learnpathItem {
 	 * @return	string	Launch data as found in imsmanifest and stored in Chamilo (read only). Defaults to ''.
 	 */
 	public function get_launch_data() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_launch_data()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_launch_data()', 0); }
 		if (!empty($this->launch_data)) {
 			return $this->launch_data;
 		}
@@ -520,7 +522,7 @@ class learnpathItem {
 	 * @return string	lesson location as recorded by the SCORM and AICC elements. Defaults to ''
 	 */
 	public function get_lesson_location() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_lesson_location()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_lesson_location()', 0); }
 		if (!empty($this->lesson_location)) { return $this->lesson_location; } else { return ''; }
 	}
 
@@ -546,7 +548,7 @@ class learnpathItem {
 	 * @return int	Level. Defaults to 0
 	 */
 	public function get_level() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_level()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_level()', 0); }
 		if (empty($this->level)) { return 0; }
 		return $this->level;
 	}
@@ -555,7 +557,7 @@ class learnpathItem {
 	 * Gets the mastery score
 	 */
 	public function get_mastery_score() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_mastery_score()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_mastery_score()', 0); }
 		if (isset($this->mastery_score)) { return $this->mastery_score; } else { return -1; }
 	}
 
@@ -564,7 +566,7 @@ class learnpathItem {
 	 * @return	int	Maximum score. Defaults to 100 if nothing else is defined
 	 */
 	public function get_max(){
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_max()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_max()', 0); }
 		if ($this->type == 'sco') {
 			if (!empty($this->view_max_score) && $this->view_max_score > 0) {
 				return $this->view_max_score;
@@ -583,7 +585,7 @@ class learnpathItem {
 	 * @return	string	Time string in SCORM format (HH:MM:SS or HH:MM:SS.SS or HHHH:MM:SS.SS)
 	 */
 	public function get_max_time_allowed() {
-		if (self::debug > 0) {error_log('New LP - In learnpathItem::get_max_time_allowed()', 0); }
+		if (self::debug > 0) {error_log('learnpathItem::get_max_time_allowed()', 0); }
 		if (!empty($this->max_time_allowed)) { return $this->max_time_allowed; } else { return ''; }
 	}
 
@@ -592,7 +594,7 @@ class learnpathItem {
 	 * @return int	Minimum score. Defaults to 0
 	 */
 	public function get_min() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_min()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_min()', 0); }
 		if (!empty($this->min_score)) { return $this->min_score; } else { return 0; }
 	}
 
@@ -601,7 +603,7 @@ class learnpathItem {
 	 * @return	int	Parent ID. Defaults to null
 	 */
 	public function get_parent(){
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_parent()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_parent()', 0); }
 		if (!empty($this->parent)) {
 			return $this->parent;
 		}
@@ -614,7 +616,7 @@ class learnpathItem {
 	 * @return	string	Path. Defaults to ''
 	 */
 	public function get_path(){
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_path()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_path()', 0); }
 		if (empty($this->path)) { return ''; }
 		return $this->path;
 	}
@@ -624,7 +626,7 @@ class learnpathItem {
 	 * @return	string	Empty string or prerequisites string if defined. Defaults to
 	 */
 	public function get_prereq_string() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_prereq_string()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_prereq_string()', 0); }
 		if (!empty($this->prereq_string)) {
 			return $this->prereq_string;
 		} else {
@@ -638,7 +640,7 @@ class learnpathItem {
 	 */
 	public function get_prevent_reinit() {
 	    $course_id = api_get_course_int_id();
-		if (self::debug > 2) { error_log('New LP - In learnpathItem::get_prevent_reinit()', 0); }
+		if (self::debug > 2) { error_log('learnpathItem::get_prevent_reinit()', 0); }
 		if (!isset($this->prevent_reinit)) {
 			if (!empty($this->lp_id)) {
 				$table = Database::get_course_table(TABLE_LP_MAIN);
@@ -667,7 +669,7 @@ class learnpathItem {
      * @author ndiechburg <noel@cblue.be>
      **/
     public function get_seriousgame_mode() {
-        if(self::debug>2){error_log('New LP - In learnpathItem::get_seriousgame_mode()',0);}        
+        if(self::debug>2){error_log('learnpathItem::get_seriousgame_mode()',0);}        
         $course_id = api_get_course_int_id();
         if (!isset($this->seriousgame_mode)) {
             if (!empty($this->lp_id)) {
@@ -983,7 +985,7 @@ class learnpathItem {
 	 * @return	float	The current score or 0 if no score set yet
 	 */
 	public function get_score() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_score()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_score()', 0); }
 		$res = 0;
 		if (!empty($this->current_score)) {
 			$res = $this->current_score;
@@ -1000,12 +1002,12 @@ class learnpathItem {
 	 */
 	public function get_status($check_db = true, $update_local = false) {
 	    $course_id = api_get_course_int_id();
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_status() on item '.$this->db_id, 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_status() on item '.$this->db_id, 0); }
 		if ($check_db) {
-			if (self::debug > 2) { error_log('New LP - In learnpathItem::get_status(): checking db', 0); }
+			if (self::debug > 2) { error_log('learnpathItem::get_status(): checking db', 0); }
 			$table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
 			$sql = "SELECT status FROM $table WHERE c_id = $course_id AND id = '".$this->db_item_view_id."' AND view_count = '".$this->get_attempt_id()."'";            
-			if (self::debug > 2) { error_log('New LP - In learnpathItem::get_status() - Checking DB: '.$sql, 0); }
+			if (self::debug > 2) { error_log('learnpathItem::get_status() - Checking DB: '.$sql, 0); }
 
 			$res = Database::query($sql);
 			if (Database::num_rows($res) == 1) {
@@ -1013,17 +1015,17 @@ class learnpathItem {
 				if ($update_local) {
 					$this->set_status($row['status']);
 				}
-				if (self::debug > 2) { error_log('New LP - In learnpathItem::get_status() - Returning db value '.$row['status'], 0); }                
+				if (self::debug > 2) { error_log('learnpathItem::get_status() - Returning db value '.$row['status'], 0); }                
 				return $row['status'];
 			}
 		} else {
-			if (self::debug > 2) { error_log('New LP - In learnpathItem::get_status() - in get_status: using attrib', 0); }
+			if (self::debug > 2) { error_log('learnpathItem::get_status() - in get_status: using attrib', 0); }
 			if (!empty($this->status)) {
-				if (self::debug > 2) { error_log('New LP - In learnpathItem::get_status() - Returning attrib: '.$this->status, 0); }
+				if (self::debug > 2) { error_log('learnpathItem::get_status() - Returning attrib: '.$this->status, 0); }
 				return $this->status;
 			}
 		}
-   		if (self::debug > 2) { error_log('New LP - In learnpathItem::get_status() - Returning default '.$this->possible_status[0], 0); }
+   		if (self::debug > 2) { error_log('learnpathItem::get_status() - Returning default '.$this->possible_status[0], 0); }
 		return $this->possible_status[0];
 	}
 
@@ -1031,7 +1033,7 @@ class learnpathItem {
 	 * Gets the suspend data
 	 */
 	public function get_suspend_data() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_suspend_data()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_suspend_data()', 0); }
 		// TODO: Improve cleaning of breaklines ... it works but is it really a beautiful way to do it ?
 		if (!empty($this->current_data)) { return str_replace(array("\r", "\n"), array('\r', '\n'), $this->current_data); } else { return ''; }
 	}
@@ -1045,7 +1047,7 @@ class learnpathItem {
 		$h = get_lang('h');
         $course_id = api_get_course_int_id();
 		if (!isset($given_time)) {
-			if (self::debug > 2) { error_log('New LP - In learnpathItem::get_scorm_time(): given time empty, current_start_time = '.$this->current_start_time, 0); }
+			if (self::debug > 2) { error_log('learnpathItem::get_scorm_time(): given time empty, current_start_time = '.$this->current_start_time, 0); }
 			if (is_object($this)) {
 				if ($query_db === true) {
 					$table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
@@ -1078,7 +1080,7 @@ class learnpathItem {
 		} else {
 			$time = $given_time;
 		}
-		if (self::debug > 2) { error_log('New LP - In learnpathItem::get_scorm_time(): intermediate = '.$time, 0); }
+		if (self::debug > 2) { error_log('learnpathItem::get_scorm_time(): intermediate = '.$time, 0); }
 		$hours = $time/3600;
 		$mins  = ($time%3600)/60;
 		$secs  = ($time%60);
@@ -1087,7 +1089,7 @@ class learnpathItem {
   		} else {
 			$scorm_time = trim(sprintf("%4d$h%02d'%02d\"", $hours, $mins, $secs));
   		}
-		if (self::debug > 2) { error_log('New LP - In learnpathItem::get_scorm_time('.$scorm_time.')', 0); }
+		if (self::debug > 2) { error_log('learnpathItem::get_scorm_time('.$scorm_time.')', 0); }
   		return $scorm_time;
 	}
 
@@ -1105,7 +1107,7 @@ class learnpathItem {
 	 * @return	string	Title
 	 */
 	public function get_title() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_title()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_title()', 0); }
 		if (empty($this->title)) { return ''; }
 		return $this->title;
 	}
@@ -1115,7 +1117,7 @@ class learnpathItem {
 	 * @return	integer	Total time
 	 */
 	public function get_total_time() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_total_time()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_total_time()', 0); }
 		if ($this->current_start_time == 0) { // Shouldn't be necessary thanks to the open() method.
 			$this->current_start_time = time();
 		}
@@ -1129,7 +1131,7 @@ class learnpathItem {
 		if ($time < 0) {
 			return 0;
 		} else {
-			if (self::debug > 2) { error_log('New LP - In learnpathItem::get_total_time() - Current stop time = '.$this->current_stop_time.', current start time = '.$this->current_start_time.' Returning '.$time, 0); }
+			if (self::debug > 2) { error_log('learnpathItem::get_total_time() - Current stop time = '.$this->current_stop_time.', current start time = '.$this->current_start_time.' Returning '.$time, 0); }
 			return $time;
 		}
 	}
@@ -1143,7 +1145,7 @@ class learnpathItem {
 		if (!empty($this->type)) {			
 			$res = $this->type;
 		}
-		if (self::debug > 2) { error_log('New LP - In learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id, 0); }
+		if (self::debug > 2) { error_log('learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id, 0); }
 		return $res;
 	}
 
@@ -1152,7 +1154,7 @@ class learnpathItem {
 	 * @return  int     Number of attempts or 0
      */
 	public function get_view_count() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::get_view_count()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::get_view_count()', 0); }
 		if (!empty($this->attempt_id)) {
 			return $this->attempt_id;
 		} else {
@@ -1166,10 +1168,10 @@ class learnpathItem {
 	 */
 	function is_done(){
    		if ($this->status_is(array('completed', 'passed', 'succeeded', 'failed'))) {
-   			if (self::debug > 2) { error_log('New LP - In learnpath::is_done() - Item '.$this->get_id().' is complete', 0); }
+   			if (self::debug > 2) { error_log('learnpath::is_done() - Item '.$this->get_id().' is complete', 0); }
    			return true;
    		}else{
-   			if (self::debug > 2) { error_log('New LP - In learnpath::is_done() - Item '.$this->get_id().' is not complete', 0); }
+   			if (self::debug > 2) { error_log('learnpath::is_done() - Item '.$this->get_id().' is not complete', 0); }
    			return false;
    		}
 	}
@@ -1181,7 +1183,7 @@ class learnpathItem {
 	 * 					 1 if it is allowed. Defaults to 1
 	 */
 	public function is_restart_allowed() {
-		if (self::debug > 2) { error_log('New LP - In learnpathItem::is_restart_allowed()', 0); }
+		if (self::debug > 2) { error_log('learnpathItem::is_restart_allowed()', 0); }
 		$restart = 1;
 		$mystatus = $this->get_status(true);
 		if ($this->get_prevent_reinit() > 0){ // If prevent_reinit == 1 (or more)
@@ -1205,7 +1207,7 @@ class learnpathItem {
 	 * @return	boolean	True on success, false on failure.
 	 */
 	public function open($allow_new_attempt = false) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::open()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::open()', 0); }
 		if ($this->prevent_reinit == 0) {
 			$this->current_score = 0;
 			$this->current_start_time = time();
@@ -1240,7 +1242,7 @@ class learnpathItem {
 	 * @return	string	HTML file (displayable in an <iframe>) or empty string if no path defined
 	 */
 	function output() {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::output()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::output()', 0); }
 		if (!empty($this->path) and is_file($this->path)) {
 			$output = '';
 			$output .= file_get_contents($this->path);
@@ -1258,7 +1260,7 @@ class learnpathItem {
 	 * @return	boolean	True if the list of prerequisites given is entirely satisfied, false otherwise
 	 */
 	public function parse_prereq($prereqs_string, $items, $refs_list, $user_id) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string, 0); }
+		if (self::debug > 0) { error_log('learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string, 0); }
 
         $course_id = api_get_course_int_id();
 		// Deal with &, |, ~, =, <>, {}, ,, X*, () in reverse order.
@@ -1645,7 +1647,7 @@ class learnpathItem {
 	 * @return	boolean	True on success, false otherwise
 	 */
 	public function restart() {
-        if (self::debug > 0) { error_log('New LP - In learnpathItem::restart()', 0); }
+        if (self::debug > 0) { error_log('learnpathItem::restart()', 0); }
         if ($this->type == 'sco') { //If this is a sco, chamilo can't update the time without explicit scorm call
             $this->current_start_time = 0;
             $this->current_stop_time = 0; //Those 0 value have this effect
@@ -1700,8 +1702,7 @@ class learnpathItem {
 	 * @return	boolean	True on success, false on failure
 	 */
 	public function save($from_outside = true, $prereqs_complete = false) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::save()', 0); }
-		//$item_view_table = Database::get_course_table(COURSEID, LEARNPATH_ITEM_VIEW_TABLE);
+		if (self::debug > 0) { error_log('learnpathItem::save()', 0); }		
 	 	$item_id = $this->get_id();
 	 	// First check if parameters passed via GET can be saved here
 	 	// in case it's a SCORM, we should get:
@@ -1709,50 +1710,50 @@ class learnpathItem {
 			$s = $this->get_status(true);
 			if ($this->prevent_reinit == 1 AND
 				$s != $this->possible_status[0] AND $s != $this->possible_status[1]) {
-				if (self::debug > 1) { error_log('New LP - In learnpathItem::save() - save reinit blocked by setting', 0); }
+				if (self::debug > 1) { error_log('learnpathItem::save() - save reinit blocked by setting', 0); }
 				// Do nothing because the status has already been set. Don't allow it to change.
 				// TODO: Check there isn't a special circumstance where this should be saved.
 			} else {
-				if (self::debug > 1) { error_log('New LP - In learnpathItem::save() - SCORM save request received', 0); }
+				if (self::debug > 1) { error_log('learnpathItem::save() - SCORM save request received', 0); }
 				//get all new settings from the URL
 				if ($from_outside) {
-					if (self::debug > 1) { error_log('New LP - In learnpathItem::save() - Getting item data from outside', 0); }
+					if (self::debug > 1) { error_log('learnpathItem::save() - Getting item data from outside', 0); }
 					foreach ($_GET as $param => $value) {
 						$value = Database::escape_string($value);
 						switch ($param) {
 							case 'score':
 								$this->set_score($value);
-								if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting score to '.$value, 0); }
+								if (self::debug > 2) { error_log('learnpathItem::save() - setting score to '.$value, 0); }
 								break;
 							case 'max':
 								$this->set_max_score($value);
-								if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting view_max_score to '.$value, 0); }
+								if (self::debug > 2) { error_log('learnpathItem::save() - setting view_max_score to '.$value, 0); }
 								break;
 			 				case 'min':
 			 					$this->min_score = $value;
-			 					if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting min_score to '.$value, 0); }
+			 					if (self::debug > 2) { error_log('learnpathItem::save() - setting min_score to '.$value, 0); }
 			 					break;
 			 				case 'lesson_status':
 			 					if(!empty($value)){
 				 					$this->set_status($value);
-				 						if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting status to '.$value, 0); }
+				 						if (self::debug > 2) { error_log('learnpathItem::save() - setting status to '.$value, 0); }
 			 					}
 			 					break;
 			 				case 'time':
 			 					$this->set_time($value);
-			 					if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting time to '.$value, 0); }
+			 					if (self::debug > 2) { error_log('learnpathItem::save() - setting time to '.$value, 0); }
 			 					break;
 			 				case 'suspend_data':
 			 					$this->current_data = $value;
-			 					if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting suspend_data to '.$value, 0); }
+			 					if (self::debug > 2) { error_log('learnpathItem::save() - setting suspend_data to '.$value, 0); }
 			 					break;
 			 				case 'lesson_location':
 			 					$this->set_lesson_location($value);
-			 					if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting lesson_location to '.$value, 0); }
+			 					if (self::debug > 2) { error_log('learnpathItem::save() - setting lesson_location to '.$value, 0); }
 			 					break;
 			 				case 'core_exit':
 			 					$this->set_core_exit($value);
-			 					if (self::debug > 2) { error_log('New LP - In learnpathItem::save() - setting core_exit to '.$value, 0); }
+			 					if (self::debug > 2) { error_log('learnpathItem::save() - setting core_exit to '.$value, 0); }
 			 					break;
 			 				case 'interactions':
 			 					//$interactions = unserialize($value);
@@ -1776,7 +1777,7 @@ class learnpathItem {
 						}
 			 		}
 				} else {
-					if (self::debug > 1) { error_log('New LP - In learnpathItem::save() - Using inside item status', 0); }
+					if (self::debug > 1) { error_log('learnpathItem::save() - Using inside item status', 0); }
 					// Do nothing, just let the local attributes be used.
 				}
 			}
@@ -1810,7 +1811,7 @@ class learnpathItem {
 	 * @return	boolean	TRUE on success, FALSE otherwise
 	 */
 	public function set_attempt_id($num) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_attempt_id()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::set_attempt_id()', 0); }
 	 	if ($num == strval(intval($num)) && $num >= 0) {
 	 		$this->attempt_id = $num;
 	 		return true;
@@ -1843,7 +1844,7 @@ class learnpathItem {
 	 * @return  void
 	 */
 	public function set_description($string = '') {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_description()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::set_description()', 0); }
 		if (!empty($string)) { $this->description = $string; }
 	}
 
@@ -1853,7 +1854,7 @@ class learnpathItem {
 	 * @return	boolean	True on success, false otherwise
 	 */
 	public function set_lesson_location($location) {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_lesson_location()', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::set_lesson_location()', 0); }
 		if (isset($location)) {
    			$this->lesson_location = Database::escape_string($location);
   			return true;
@@ -1867,7 +1868,7 @@ class learnpathItem {
 	 * @return  void
 	 */
 	public function set_level($int = 0) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_level('.$int.')', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::set_level('.$int.')', 0); }
 		if (!empty($int) AND $int == strval(intval($int))) { $this->level = $int; }
 	}
 
@@ -1883,7 +1884,7 @@ class learnpathItem {
 	    } else {
 	        $course_id = intval($course_id);
 	    }
-	    if (self::debug > 0) { error_log('New LP - In learnpathItem::set_lp_view('.$lp_view_id.')', 0); }
+	    if (self::debug > 0) { error_log('learnpathItem::set_lp_view('.$lp_view_id.')', 0); }
 		if (!empty($lp_view_id) and $lp_view_id = intval(strval($lp_view_id))) {
 	 		$this->view_id = $lp_view_id;
 
@@ -1895,7 +1896,7 @@ class learnpathItem {
                             lp_view_id = ".$lp_view_id." 
                     ORDER BY view_count DESC";
 
-		 	if (self::debug > 2) { error_log('New LP - In learnpathItem::set_lp_view() - Querying lp_item_view: '.$sql, 0); }
+		 	if (self::debug > 2) { error_log('learnpathItem::set_lp_view() - Querying lp_item_view: '.$sql, 0); }
 		 	$res = Database::query($sql);
 		 	if (Database::num_rows($res) > 0) {
 		 		$row = Database::fetch_array($res);
@@ -1909,7 +1910,7 @@ class learnpathItem {
                 $this->current_stop_time 	= $this->current_start_time + $row['total_time'];
 				$this->lesson_location      = $row['lesson_location'];
 				$this->core_exit            = $row['core_exit'];
-			 	if (self::debug > 2) { error_log('New LP - In learnpathItem::set_lp_view() - Updated item object with database values', 0); }
+			 	if (self::debug > 2) { error_log('learnpathItem::set_lp_view() - Updated item object with database values', 0); }
 
 			 	// Now get the number of interactions for this little guy.
 			 	$item_view_interaction_table = Database::get_course_table(TABLE_LP_IV_INTERACTION);
@@ -1943,7 +1944,7 @@ class learnpathItem {
 	 * @return  void
 	 */
 	public function set_path($string = '') {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_path()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::set_path()', 0); }
 		if (!empty($string)) { $this->path = $string; }
 	}
 
@@ -1954,7 +1955,7 @@ class learnpathItem {
 	 * @return  void
 	 */
 	public function set_prevent_reinit($prevent) {
-		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_prevent_reinit()', 0); }
+		if (self::debug > 0) { error_log('learnpathItem::set_prevent_reinit()', 0); }
 		if ($prevent) {
 			$this->prevent_reinit = 1;
 		} else {
@@ -1969,7 +1970,7 @@ class learnpathItem {
 	 * @return	boolean	True on success, false otherwise
 	 */
 	public function set_score($score) {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_score('.$score.')', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::set_score('.$score.')', 0); }
    		if (($this->max_score<=0 || $score <= $this->max_score) && ($score >= $this->min_score)) {
    			$this->current_score = $score;
    			$master = $this->get_mastery_score();
@@ -1991,10 +1992,10 @@ class learnpathItem {
 	 * @return	boolean	True on success, false on error
 	 */
 	public function set_max_score($score) {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_max_score('.$score.')', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::set_max_score('.$score.')', 0); }
 	 	if (is_int($score) or $score == '') {
 	 		$this->view_max_score = Database::escape_string($score);
-	 		if (self::debug > 1) { error_log('New LP - In learnpathItem::set_max_score() - Updated object score of item '.$this->db_id.' to '.$this->view_max_score, 0); }
+	 		if (self::debug > 1) { error_log('learnpathItem::set_max_score() - Updated object score of item '.$this->db_id.' to '.$this->view_max_score, 0); }
 	 		return true;
 	 	}
 	 	return false;
@@ -2006,7 +2007,7 @@ class learnpathItem {
 	 * @return	boolean	True on success, false on error
 	 */
 	public function set_status($status) {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_status('.$status.')', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::set_status('.$status.')', 0); }
 	 	$found = false;
 	 	foreach ($this->possible_status  as $possible) {
 	 		if (preg_match('/^'.$possible.'$/i', $status)) {
@@ -2016,7 +2017,7 @@ class learnpathItem {
 	 	//if (in_array($status, $this->possible_status)) {
 	 	if ($found) {
 	 		$this->status = Database::escape_string($status);
-	 		if (self::debug > 1) { error_log('New LP - In learnpathItem::set_status() - Updated object status of item '.$this->db_id.' to '.$this->status, 0); }
+	 		if (self::debug > 1) { error_log('learnpathItem::set_status() - Updated object status of item '.$this->db_id.' to '.$this->status, 0); }
 	 		return true;
 	 	}
 	 	//error_log('New LP - '.$status.' was not in the possible status', 0);
@@ -2068,12 +2069,12 @@ class learnpathItem {
 	 * @return  void
 	 */
 	public function set_time($scorm_time, $format = 'scorm') {        
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_time('.$scorm_time.')', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::set_time('.$scorm_time.')', 0); }
 	 	if ($scorm_time == 0 and ($this->type!='sco') and $this->current_start_time != 0) {
 	 		$my_time = time() - $this->current_start_time;
 	 		if ($my_time > 0) {
 	 			$this->update_time($my_time);
-	 			if (self::debug > 0) { error_log('New LP - In learnpathItem::set_time('.$scorm_time.') - found asset - set time to '.$my_time, 0); }
+	 			if (self::debug > 0) { error_log('learnpathItem::set_time('.$scorm_time.') - found asset - set time to '.$my_time, 0); }
 	 		}
 	 	} else {
 	 		if ($format == 'scorm') {
@@ -2099,7 +2100,7 @@ class learnpathItem {
 	 * @return  void
 	 */
 	public function set_title($string = '') {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_title()', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::set_title()', 0); }
 		if (!empty($string)) { $this->title = $string; }
 	}
 
@@ -2109,7 +2110,7 @@ class learnpathItem {
 	 * @return  void
 	 */
 	public function set_type($string = '') {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::set_type()', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::set_type()', 0); }
 		if (!empty($string)) { $this->type = $string; }
 	}
 
@@ -2119,7 +2120,7 @@ class learnpathItem {
 	 * @return	boolean			True if the status was one of the given strings, false otherwise
 	 */
 	public function status_is($list = array()) {
-   		if (self::debug > 1) { error_log('New LP - In learnpathItem::status_is('.print_r($list,true).') on item '.$this->db_id, 0); }
+   		if (self::debug > 1) { error_log('learnpathItem::status_is('.print_r($list,true).') on item '.$this->db_id, 0); }
 		$mystatus = $this->get_status(true);
 		if (empty($mystatus)) {
 			return false;
@@ -2143,7 +2144,7 @@ class learnpathItem {
 	 * TODO: Make this method better by allowing better/multiple time slices.
 	 */
 	public function update_time($total_sec = 0) {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::update_time('.$total_sec.')', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::update_time('.$total_sec.')', 0); }
 		if ($total_sec >= 0) {
 	 		// Getting start time from finish time. The only problem in the calculation is it might be
 	 		// modified by the scripts processing time.
@@ -2228,7 +2229,7 @@ class learnpathItem {
 	 * @return	boolean		True or false on error
 	 */
 	public function write_objectives_to_db() {
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::write_objectives_to_db()', 0); }
+   		if (self::debug > 0) { error_log('learnpathItem::write_objectives_to_db()', 0); }
         $course_id = api_get_course_int_id();
 	 	if (is_array($this->objectives) && count($this->objectives) > 0) {
 	 		// Save objectives.
@@ -2241,7 +2242,7 @@ class learnpathItem {
 	 		if (Database::num_rows($res) > 0) {
 	 			$row = Database::fetch_array($res);
 	 			$lp_iv_id = $row[0];
-	 			if (self::debug > 2) { error_log('New LP - In learnpathItem::write_to_db() - Got item_view_id '.$lp_iv_id.', now checking objectives ', 0); }
+	 			if (self::debug > 2) { error_log('learnpathItem::write_to_db() - Got item_view_id '.$lp_iv_id.', now checking objectives ', 0); }
 		 		foreach($this->objectives as $index => $objective){
 		 			$iva_table = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
 		 			$iva_sql = "SELECT id FROM $iva_table " .
@@ -2286,16 +2287,17 @@ class learnpathItem {
 	 * @return	boolean	Query result
 	 */
 	 public function write_to_db() {
+         if (self::debug > 0) { error_log('learnpathItem::write_to_db()', 0); }
+         
 		// Check the session visibility.
 		if (!api_is_allowed_to_session_edit()) {
+            if (self::debug > 0) { error_log('return false api_is_allowed_to_session_edit'); }            
 			return false;
 		}
-		$course_id = api_get_course_int_id();
-
-   		if (self::debug > 0) { error_log('New LP - In learnpathItem::write_to_db()', 0); }
-   		$mode = $this->get_lesson_mode();
-   		$credit = $this->get_credit();
-   		$my_verified_status=$this->get_status(false);
+		$course_id  = api_get_course_int_id();
+   		$mode       = $this->get_lesson_mode();
+   		$credit     = $this->get_credit();
+   		//$my_verified_status=$this->get_status(false);
 
    		$item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
 		$sql_verified = 'SELECT status FROM '.$item_view_table.'
@@ -2312,10 +2314,14 @@ class learnpathItem {
             }
         }
 
-   		if ((($save===false && $this->type == 'sco') || 
-            (($this->type == 'sco') && ($credit == 'no-credit' OR $mode == 'review' OR $mode == 'browse'))) && ($this->seriousgame_mode!=1 && $this->type == 'sco')){
-   			//this info shouldn't be saved as the credit or lesson mode info prevent it
-   			if (self::debug>1){error_log('New LP - In learnpathItem::write_to_db() - credit('.$credit.') or lesson_mode('.$mode.') prevent recording!',0);}
+   		if ((($save === false && $this->type == 'sco') || 
+                ($this->type == 'sco' && ($credit == 'no-credit' OR $mode == 'review' OR $mode == 'browse'))
+            ) && ($this->seriousgame_mode != 1 && $this->type == 'sco')
+           ){   			
+   			if (self::debug>1) { 
+                error_log("This info shouldn't be saved as the credit or lesson mode info prevent it");
+                error_log('learnpathItem::write_to_db() - credit('.$credit.') or lesson_mode('.$mode.') prevent recording!',0);
+            }
    		} else {
 	  		// Check the row exists.
 	  		$inserted = false;
@@ -2349,7 +2355,7 @@ class learnpathItem {
 			 			"'".Database::escape_string($this->current_data)."'," .
 			 			//"'".$this->get_max_time_allowed()."'," .
 			 			"'".$this->lesson_location."')";
-	  			if (self::debug > 2) { error_log('New LP - In learnpathItem::write_to_db() - Inserting into item_view forced: '.$sql, 0); }
+	  			if (self::debug > 2) { error_log('learnpathItem::write_to_db() - Inserting into item_view forced: '.$sql, 0); }
 			 	$res = Database::query($sql);
 			 	$this->db_item_view_id = Database::insert_id();
 			 	$inserted = true;
@@ -2360,17 +2366,12 @@ class learnpathItem {
 		 			"WHERE c_id = $course_id AND lp_item_id = ".$this->db_id. " " .
 		 			"AND   lp_view_id = ".$this->view_id. " ".
 		 			"AND   view_count = ".$this->get_attempt_id();
-		 	if (self::debug > 2) { error_log('New LP - In learnpathItem::write_to_db() - Querying item_view: '.$check, 0); }
+		 	if (self::debug > 2) { error_log('learnpathItem::write_to_db() - Querying item_view: '.$check, 0); }
 		 	$check_res = Database::query($check);
 		 	// Depending on what we want (really), we'll update or insert a new row
 		 	// now save into DB.
 		 	$res = 0;
-		 	if (!$inserted && Database::num_rows($check_res) < 1) {
-				/*$my_status = '';
-		 		if ($this->type != TOOL_QUIZ) {
-		 			$my_status = $this->get_status(false);
-		 		}*/
-
+		 	if (!$inserted && Database::num_rows($check_res) < 1) {	
 			 	$sql = "INSERT INTO $item_view_table " .
 			 			"(c_id, total_time, " .
 			 			"start_time, " .
@@ -2395,7 +2396,7 @@ class learnpathItem {
 			 			"'".Database::escape_string($this->current_data)."'," .
 			 			//"'".$this->get_max_time_allowed()."'," .
 			 			"'".$this->lesson_location."')";
-			 	if (self::debug > 2) { error_log('New LP - In learnpathItem::write_to_db() - Inserting into item_view: '.$sql, 0); }
+			 	if (self::debug > 2) { error_log('learnpathItem::write_to_db() - Inserting into item_view: '.$sql, 0); }
 			 	$res = Database::query($sql);
 			 	$this->db_item_view_id = Database::insert_id();
 		 	} else {
@@ -2526,7 +2527,7 @@ class learnpathItem {
                     }
                     $this->current_start_time = time();
                 }
-                if (self::debug > 2) { error_log('New LP - In learnpathItem::write_to_db() - Updating item_view: '.$sql, 0); }
+                if (self::debug > 2) { error_log('learnpathItem::write_to_db() - Updating item_view: '.$sql, 0); }
                 $res = Database::query($sql);
             }
                         
@@ -2541,7 +2542,7 @@ class learnpathItem {
 		 		if (Database::num_rows($res) > 0) {
 		 			$row = Database::fetch_array($res);
 		 			$lp_iv_id = $row[0];
-		 			if (self::debug > 2) { error_log('New LP - In learnpathItem::write_to_db() - Got item_view_id '.$lp_iv_id.', now checking interactions ', 0); }
+		 			if (self::debug > 2) { error_log('learnpathItem::write_to_db() - Got item_view_id '.$lp_iv_id.', now checking interactions ', 0); }
 			 		foreach ($this->interactions as $index => $interaction) {
 			 			$correct_resp = '';
 			 			if (is_array($interaction[4]) && !empty($interaction[4][0])) {
@@ -2590,7 +2591,7 @@ class learnpathItem {
 		 		}
 		 	}
    		}
-		if (self::debug > 2) { error_log('New LP - End of learnpathItem::write_to_db()', 0); }
+		if (self::debug > 2) { error_log('End of learnpathItem::write_to_db()', 0); }
 	 	return true;
 	 }