db->select('subgroep.id AS id, subgroep.naam AS naam, subgroep.themanaam AS themanaam, subgroep.nummer AS nummer, groep.naam AS groepsnaam'); $this->db->from('subgroep'); $this->db->where('subgroep.regioid', $this->session->regio); $this->db->where('subgroep.jaar', date('Y')); $this->db->join('groep', 'subgroep.groepid=groep.id', 'left'); $this->db->order_by('nummer', 'ASC'); $query = $this->db->get(); return $query->result_array(); } public function get_spelgebieden_list() { $this->db->select('id, naam'); $this->db->from('spelgebied'); $this->db->where('regioid', $this->session->regio); $this->db->where('jaar', date('Y')); $this->db->order_by('naam', 'ASC'); $query = $this->db->get(); return $query->result_array(); } public function get_subgroep_punten($subgroepid) { $this->db->select('SUM('.$this->db->dbprefix('resultaat').'.score/'.$this->db->dbprefix('lijst').'.ronde) AS score, SUM('.$this->db->dbprefix('vragen').'.score) AS maxscore, spelgebied.id AS spelgebiedid, spelgebied.gewicht AS gewicht, '); $this->db->from('resultaat'); $this->db->where('resultaat.regioid', $this->session->regio); $this->db->where('vragen.jaar', date('Y')); $this->db->where('resultaat.subgroepid', $subgroepid); $this->db->join('vragen', 'resultaat.vraagid=vragen.id', 'left'); $this->db->join('onderdeel', 'vragen.onderdeelid=onderdeel.id', 'left'); $this->db->join('spelgebied', 'onderdeel.spelgebiedid=spelgebied.id', 'left'); $this->db->join('lijst', 'vragen.lijstid=lijst.id', 'left'); $this->db->group_by('spelgebied.naam'); $this->db->order_by('spelgebied.id', 'ASC'); $query = $this->db->get(); return $query->result_array(); } }