From 052b32cc059c090caf2f995e5bace0b968365a45 Mon Sep 17 00:00:00 2001 From: Karsten Heiken Date: Sun, 31 Jul 2011 16:40:01 +0200 Subject: [PATCH] Add some getters to the program model --- application/models/program.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/application/models/program.php b/application/models/program.php index 3f1da68..f49d495 100644 --- a/application/models/program.php +++ b/application/models/program.php @@ -27,6 +27,25 @@ class Program extends CI_Model { return $this->db->delete('programs', array('id' => $program_id)); } + /** + * Get all available programs from the database. + * + * @return array Declarative array with all available information of all programs. + */ + public function getAll() { + return $this->db->get('programs')->result_array(); + } + + /** + * Get a specific program. + * + * @param string $prg_id The id of the program to get from the database + * @return array Declarative array with all available information of the program. + */ + public function getById($prg_id) { + return $this->db->get_where('programs', array('id' => $prg_id))->row_array(); + } + /** * Get a program's available parameters by program id. *