/**
  * In addition to update() it also updates grade_outcomes_courses if needed
  * @param string $source from where was the object inserted
  * @return boolean success
  */
 function update($source = null)
 {
     $this->timemodified = time();
     return parent::update($source);
 }
Esempio n. 2
0
 /**
  * In addition to update() as defined in grade_object, call force_regrading of parent categories, if applicable.
  *
  * @param string $source from where was the object updated (mod/forum, manual, etc.)
  * @return bool success
  */
 public function update($source = null)
 {
     // load the grade item or create a new one
     $this->load_grade_item();
     // force recalculation of path;
     if (empty($this->path)) {
         $this->path = grade_category::build_path($this);
         $this->depth = substr_count($this->path, '/') - 1;
         $updatechildren = true;
     } else {
         $updatechildren = false;
     }
     $this->apply_forced_settings();
     // these are exclusive
     if ($this->droplow > 0) {
         $this->keephigh = 0;
     } else {
         if ($this->keephigh > 0) {
             $this->droplow = 0;
         }
     }
     // Recalculate grades if needed
     if ($this->qualifies_for_regrading()) {
         $this->force_regrading();
     }
     $this->timemodified = time();
     $result = parent::update($source);
     // now update paths in all child categories
     if ($result and $updatechildren) {
         if ($children = grade_category::fetch_all(array('parent' => $this->id))) {
             foreach ($children as $child) {
                 $child->path = null;
                 $child->depth = 0;
                 $child->update($source);
             }
         }
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * In addition to update() as defined in grade_object, handle the grade_outcome and grade_scale objects.
  * Force regrading if necessary, rounds the float numbers using php function,
  * the reason is we need to compare the db value with computed number to skip regrading if possible.
  * @param string $source from where was the object inserted (mod/forum, manual, etc.)
  * @return boolean success
  */
 function update($source = null)
 {
     // reset caches
     $this->dependson_cache = null;
     // Retrieve scale and infer grademax/min from it if needed
     $this->load_scale();
     // make sure there is not 0 in outcomeid
     if (empty($this->outcomeid)) {
         $this->outcomeid = null;
     }
     if ($this->qualifies_for_regrading()) {
         $this->force_regrading();
     }
     $this->timemodified = time();
     $this->grademin = grade_floatval($this->grademin);
     $this->grademax = grade_floatval($this->grademax);
     $this->multfactor = grade_floatval($this->multfactor);
     $this->plusfactor = grade_floatval($this->plusfactor);
     $this->aggregationcoef = grade_floatval($this->aggregationcoef);
     return parent::update($source);
 }
 /**
  * In addition to update() it also updates grade_outcomes_courses if needed
  * @param string $source from where was the object inserted
  * @return boolean success
  */
 function update($source = null)
 {
     $this->timemodified = time();
     if ($result = parent::update($source)) {
         if (!empty($this->courseid)) {
             $this->use_in($this->courseid);
         }
     }
     return $result;
 }
Esempio n. 5
0
 /**
  * In addition to update() as defined in grade_object rounds the float numbers using php function,
  * the reason is we need to compare the db value with computed number to skip updates if possible.
  *
  * @param string $source from where was the object inserted (mod/forum, manual, etc.)
  * @return bool success
  */
 public function update($source = null)
 {
     $this->rawgrade = grade_floatval($this->rawgrade);
     $this->finalgrade = grade_floatval($this->finalgrade);
     $this->rawgrademin = grade_floatval($this->rawgrademin);
     $this->rawgrademax = grade_floatval($this->rawgrademax);
     return parent::update($source);
 }
 /**
  * In addition to update() it also updates grade_outcomes_courses if needed
  * @param string $source from where was the object inserted
  * @return boolean success
  */
 function update($source = null)
 {
     if ($result = parent::update($source)) {
         if (!empty($this->courseid)) {
             if (!get_records('grade_outcomes_courses', 'courseid', $this->courseid, 'outcomeid', $this->id)) {
                 $goc = new object();
                 $goc->courseid = $this->courseid;
                 $goc->outcomeid = $this->id;
                 insert_record('grade_outcomes_courses', $goc);
             }
         }
     }
     return $result;
 }
Esempio n. 7
0
 /**
  * In addition to update() as defined in grade_object, handle the grade_outcome and grade_scale objects.
  * Force regrading if necessary
  * @param string $source from where was the object inserted (mod/forum, manual, etc.)
  * @return boolean success
  */
 function update($source = null)
 {
     // Retrieve scale and infer grademax/min from it if needed
     $this->load_scale();
     // make sure there is not 0 in outcomeid
     if (empty($this->outcomeid)) {
         $this->outcomeid = null;
     }
     if ($this->qualifies_for_regrading()) {
         $this->force_regrading();
     }
     return parent::update($source);
 }
Esempio n. 8
0
 /**
  * In addition to update() as defined in grade_object, call force_regrading of parent categories, if applicable.
  * @param string $source from where was the object updated (mod/forum, manual, etc.)
  * @return boolean success
  */
 function update($source = null)
 {
     // load the grade item or create a new one
     $this->load_grade_item();
     // force recalculation of path;
     if (empty($this->path)) {
         $this->path = grade_category::build_path($this);
         $this->depth = substr_count($this->path, '/') - 1;
     }
     $this->apply_forced_settings();
     // these are exclusive
     if ($this->droplow > 0) {
         $this->keephigh = 0;
     } else {
         if ($this->keephigh > 0) {
             $this->droplow = 0;
         }
     }
     // Recalculate grades if needed
     if ($this->qualifies_for_regrading()) {
         $this->force_regrading();
     }
     $this->timemodified = time();
     return parent::update($source);
 }
 /**
  * In addition to update() as defined in grade_object, call force_regrading of parent categories, if applicable.
  * @param string $source from where was the object updated (mod/forum, manual, etc.)
  * @return boolean success
  */
 function update($source = null)
 {
     // load the grade item or create a new one
     $this->load_grade_item();
     // force recalculation of path;
     if (empty($this->path)) {
         $this->path = grade_category::build_path($this);
         $this->depth = substr_count($this->path, '/') - 1;
     }
     // Recalculate grades if needed
     if ($this->qualifies_for_regrading()) {
         $this->force_regrading();
     }
     return parent::update($source);
 }