Ver código fonte

Fixing use_max_score

Julio Montoya 14 anos atrás
pai
commit
e9ca403203
2 arquivos alterados com 8 adições e 12 exclusões
  1. 6 10
      main/newscorm/learnpath.class.php
  2. 2 2
      main/newscorm/lp_edit.php

+ 6 - 10
main/newscorm/learnpath.class.php

@@ -72,7 +72,7 @@ class learnpath {
     public $lp_view_session_id =0; // The specific view might be bound to a session.
 
     public $prerequisite = 0;
-    public $use_max_score = 100; //Should work as usual
+    public $use_max_score = 1; // 1 or 0
 
     public $created_on      = '';
     public $modified_on     = '';
@@ -143,6 +143,7 @@ class learnpath {
                 $this->preview_image    = $row['preview_image'];
                 $this->author           = $row['author'];
                 $this->lp_session_id    = $row['session_id'];
+                $this->use_max_score    = $row['use_max_score'];                
 
                 $this->created_on       = $row['created_on'];
                 $this->modified_on      = $row['modified_on'];
@@ -4055,18 +4056,13 @@ class learnpath {
     public function set_use_max_score($use_max_score = 1) {
         if ($this->debug > 0) {
             error_log('New LP - In learnpath::set_use_max_score()', 0);
-        }
-        if ($use_max_score) {
-            $use_max_score = 1;
-        } else {
-            $use_max_score = 0;
-        }
-
-        $this->use_max_score = $this->escape_string($use_max_score);
+        }        
+        $use_max_score = intval($use_max_score);
+        $this->use_max_score = $use_max_score;
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
         $lp_id = $this->get_id();
         $sql = "UPDATE $lp_table SET use_max_score = '" . $this->use_max_score . "' WHERE id = '$lp_id'";
-
+        
         if ($this->debug > 2) {
             error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
         }

+ 2 - 2
main/newscorm/lp_edit.php

@@ -206,8 +206,8 @@ $form->addElement('datepicker', 'expired_on', get_lang('ExpirationDate'), array(
 $form->addElement('html','</div>');            
 
 if (api_is_platform_admin()) {
-    $form->addElement('checkbox', 'use_max_score', get_lang('UseMaxScore100'));
-    $defaults['use_max_score'] = 1;
+    $form->addElement('checkbox', 'use_max_score', get_lang('UseMaxScore100'));    
+    $defaults['use_max_score'] = $_SESSION['oLP']->use_max_score;
 }