Browse Source

Minor - cosmetic changes

Julio Montoya 12 years ago
parent
commit
0aaef7db1e

+ 7 - 7
main/newscorm/learnpath.class.php

@@ -3754,7 +3754,7 @@ class learnpath {
         }
         if (is_object($this->items[$this->current])) {
             //$res = $this->items[$this->current]->save(false);
-            $res = $this->items[$this->current]->save(false, $this->prerequisites_match($this->current));
+            $res = $this->items[$this->current]->save(false, $this->prerequisites_match($this->current));            
             $this->autocomplete_parents($this->current);
             $status = $this->items[$this->current]->get_status();
             $this->append_message('new_item_status: ' . $status);
@@ -3770,24 +3770,24 @@ class learnpath {
      * @param	boolean	Save from url params (true) or from current attributes (false). Optional. Defaults to true
      * @return	boolean
      */
-    public function save_item($item_id = null, $from_outside = true) {
-        $course_id = api_get_course_int_id();
-        if ($this->debug > 0) {
+    public function save_item($item_id = null, $from_outside = true) {        
+        $debug = $this->debug;
+        if ($debug) {
             error_log('New LP - In learnpath::save_item(' . $item_id . ',' . $from_outside . ')', 0);
         }
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
         if (empty($item_id)) {
-            $item_id = Database::escape_string($_REQUEST['id']);
+            $item_id = intval($_REQUEST['id']);
         }
         if (empty($item_id)) {
             $item_id = $this->get_current_item_id();
         }
-        if ($this->debug > 2) {
+        if ($debug) {
             error_log('New LP - save_current() saving item ' . $item_id, 0);
         }
         if (is_object($this->items[$item_id])) {
-            if ($this->debug) { error_log('object exists'); }
+            if ($debug) { error_log('object exists'); }
             $res = $this->items[$item_id]->save($from_outside, $this->prerequisites_match($item_id));            
             $this->autocomplete_parents($item_id);
             $status = $this->items[$item_id]->get_status();

+ 0 - 5
main/newscorm/lp_ajax_initialize.php

@@ -62,11 +62,6 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
     $mylp->set_current_item($next_item);
     if ($debug > 1) { error_log('In initialize_item() - new item is '.$next_item, 0); }
     $mylp->start_current_item(true);
-    /*
-    if ($mylp->force_commit) {
-        $mylp->save_current();
-    }
-    */
     
     if (is_object($mylp->items[$next_item])) {
         if ($debug > 1) { error_log('In initialize_item - recovering existing item object '.$next_item, 0); }

+ 6 - 7
main/newscorm/scorm_api.php

@@ -844,8 +844,7 @@ function savedata(origin) {
         }
         */
     }
-    //console.log(olms.lesson_status);
-    
+        
     logit_lms('saving data (status='+olms.lesson_status+' - interactions: '+ olms.interactions.length +')',1);
 
     old_item_id = olms.info_lms_item[0];
@@ -1336,11 +1335,11 @@ function reinit_updatable_vars_list () {
 
 function switch_item(current_item, next_item){
     // backup these params
-    var orig_current_item = current_item;
-    var orig_next_item = next_item;
-    var orig_lesson_status = olms.lesson_status;
-    var orig_item_type = olms.lms_item_types['i'+current_item];
-    var next_item_type = olms.lms_item_types['i'+next_item];
+    var orig_current_item   = current_item;
+    var orig_next_item      = next_item;
+    var orig_lesson_status  = olms.lesson_status;
+    var orig_item_type      = olms.lms_item_types['i'+current_item];
+    var next_item_type      = olms.lms_item_types['i'+next_item];
 
     /*
      There are four "cases" for switching items: