From 96d164308ba60b794a97e25345cd9757a9982a74 Mon Sep 17 00:00:00 2001 From: Eike Foken Date: Tue, 30 Aug 2011 20:47:28 +0200 Subject: [PATCH] Get a program by it's driver --- application/models/program.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/application/models/program.php b/application/models/program.php index 905979e..dd0d448 100644 --- a/application/models/program.php +++ b/application/models/program.php @@ -62,8 +62,8 @@ class Program extends CI_Model { * @param string $id The ID of the program to update * @return boolean Returns TRUE if the update was successful */ - public function update($name, $id) { - $this->db->update('programs', array('name' => $name), array('id' => $id)); + public function update($data, $id) { + $this->db->update('programs', $data, array('id' => $id)); return $this->db->affected_rows() > 0; } @@ -96,6 +96,16 @@ class Program extends CI_Model { return $this->db->get_where('programs', array('id' => $id))->row_array(); } + /** + * Gets a specific program by it's driver's name. + * + * @param string $driver The driver + * @return array Declarative array with all available information of the program. + */ + public function getByDriver($driver) { + return $this->db->get_where('programs', array('driver' => $driver))->row_array(); + } + /** * Get a program's available parameters by program id. *