$assessments = evalcomix_assessments::fetch_all($params2);
 if ($assessments) {
     //$selfgrade = 0;
     $selfgrade = -1;
     $teachergrade = 0;
 /**
  * Finds and returns a evalcomix_modes_time instance based on params.
  * @static
  *
  * @param array $params associative arrays varname=>value
  * @return object grade_item instance or false if none found.
  */
 public static function fetch($params)
 {
     return evalcomix_object::fetch_helper('block_evalcomix_modes_time', 'evalcomix_modes_time', $params);
 }
Exemplo n.º 3
0
 /**
  * Factory method - uses the parameters to retrieve all matching instances from the DB.
  * @static final protected
  * @return mixed array of object instances or false if not found
  */
 public static function fetch_all_helper($table, $classname, $params)
 {
     $instance = new $classname();
     $classvars = (array) $instance;
     $params = (array) $params;
     $wheresql = array();
     $newparams = array();
     foreach ($params as $var => $value) {
         //echo "var:$var = $value<br>";
         if (!in_array($var, $instance->required_fields) and !array_key_exists($var, $instance->optional_fields)) {
             continue;
         }
         if (is_null($value)) {
             $wheresql[] = " {$var} IS NULL ";
         } else {
             $wheresql[] = " {$var} = ? ";
             $newparams[] = $value;
         }
     }
     if (empty($wheresql)) {
         $wheresql = '';
     } else {
         $wheresql = implode("AND", $wheresql);
     }
     global $DB;
     $rs = $DB->get_recordset_select($table, $wheresql, $newparams);
     //returning false rather than empty array if nothing found
     if (!$rs->valid()) {
         $rs->close();
         return false;
     }
     $result = array();
     foreach ($rs as $data) {
         $instance = new $classname();
         evalcomix_object::set_properties($instance, $data);
         $result[$instance->id] = $instance;
     }
     $rs->close();
     return $result;
 }
 /**
  * Finds and returns a evalcomix_allowedusers instance based on params.
  * @static
  *
  * @param array $params associative arrays varname=>value
  * @return object grade_item instance or false if none found.
  */
 public static function fetch($params)
 {
     return evalcomix_object::fetch_helper('block_evalcomix_allowedusers', 'evalcomix_allowedusers', $params);
 }