*/ class Group extends CI_Model { /** * Calls the parent constructor. */ public function __construct() { parent::__construct(); } /** * Gets all groups. * * @return array */ public function getAll() { $groups = array(); foreach ($this->db->get('groups')->result_array() as $group) { $groups[$group['id']] = $group['description']; } return $groups; } /** * Gets a specific group by it's ID. * * @param string $id * @return array */ public function getById($id) { return $this->db->get_where('groups', array('id' => $id))->row_array(); } /** * Gets a specific group by it's name. * * @param string $name * @return array */ public function getByName($name) { return $this->db->get_where('groups', array('name' => $name))->row_array(); } } /* End of file group.php */ /* Location: ./application/controllers/group.php */