/**
  * @param array $result
  * @return array
  */
 private static function create_evaluation_objects_from_sql_result($result)
 {
     $alleval = array();
     if (Database::num_rows($result)) {
         while ($data = Database::fetch_array($result)) {
             $eval = new Evaluation();
             $eval->set_id($data['id']);
             $eval->set_name($data['name']);
             $eval->set_description($data['description']);
             $eval->set_user_id($data['user_id']);
             $eval->set_course_code($data['course_code']);
             $eval->set_category_id($data['category_id']);
             $eval->set_date(api_get_local_time($data['created_at']));
             $eval->set_weight($data['weight']);
             $eval->set_max($data['max']);
             $eval->set_visible($data['visible']);
             $eval->set_type($data['type']);
             $eval->set_locked($data['locked']);
             $eval->setSessionId(api_get_session_id());
             $alleval[] = $eval;
         }
     }
     return $alleval;
 }
 /**
  * Lazy load function to get the linked evaluation
  */
 protected function get_evaluation()
 {
     if (!isset($this->evaluation)) {
         if (isset($this->ref_id)) {
             $evalarray = Evaluation::load($this->get_ref_id());
             $this->evaluation = $evalarray[0];
         } else {
             $eval = new Evaluation();
             $eval->set_category_id(-1);
             $eval->set_date(api_get_utc_datetime());
             // these values will be changed
             $eval->set_weight(0);
             //   when the link setter
             $eval->set_visible(0);
             //     is called
             $eval->set_id(-1);
             // a 'real' id will be set when eval is added to db
             $eval->set_user_id($this->get_user_id());
             $eval->set_course_code($this->get_course_code());
             $this->evaluation = $eval;
             $this->set_ref_id($eval->get_id());
         }
     }
     return $this->evaluation;
 }