From efe7068c82e2ab60b3735645a65730b25070f23a Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Fri, 8 Apr 2011 06:00:52 +0000 Subject: h-source: added the driver entry for wifi and videocards --- .../Application/Controllers/DownloadController.php | 109 +++++---------------- 1 file changed, 22 insertions(+), 87 deletions(-) (limited to 'h-source/Application/Controllers/DownloadController.php') diff --git a/h-source/Application/Controllers/DownloadController.php b/h-source/Application/Controllers/DownloadController.php index 744d338..fba20f0 100644 --- a/h-source/Application/Controllers/DownloadController.php +++ b/h-source/Application/Controllers/DownloadController.php @@ -127,8 +127,9 @@ class DownloadController extends BaseController { $xml .= "\t\t".$row['hardware']['video_card_works']."\n"; } - - if ($type === 'printer' or $type === 'scanner' or $type === 'soundcard' or $type === 'webcam' or $type === 'bluetooth') + + $devicesWithDriverEntry = array('printer','scanner','soundcard','webcam','bluetooth','wifi','videocard'); + if (in_array($type,$devicesWithDriverEntry)) { $xml .= "\t\t".$row['hardware']['driver']."\n"; } @@ -146,133 +147,67 @@ class DownloadController extends BaseController return $xml; } - public function all($lang = 'en') + protected function printXml($lang = 'en', $whereArray) { header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $res = $this->m['HardwareModel']->clear()->select()->where($whereArray)->orderBy("type,hardware.id_hard")->send(); $data['xml'] = $this->getXml($res); - + $this->append($data); $this->clean(); $this->load('xml'); } - public function notebooks($lang = 'en') + public function all($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'notebook','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + $this->printXml($lang, array('-deleted'=>'no')); + } - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + public function notebooks($lang = 'en') + { + $this->printXml($lang, array('type'=>'notebook','-deleted'=>'no')); } public function wifi($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'wifi','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'wifi','-deleted'=>'no')); } public function videocards($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'videocard','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'videocard','-deleted'=>'no')); } public function printers($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'printer','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'printer','-deleted'=>'no')); } public function scanners($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'scanner','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'scanner','-deleted'=>'no')); } public function threegcards($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'3G-card','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'3G-card','-deleted'=>'no')); } public function soundcards($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'soundcard','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'soundcard','-deleted'=>'no')); } public function webcams($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'webcam','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'webcam','-deleted'=>'no')); } public function bluetooth($lang = 'en') { - header ("Content-Type:text/xml"); - - $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'bluetooth','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); - - $data['xml'] = $this->getXml($res); - - $this->append($data); - $this->clean(); - $this->load('xml'); + $this->printXml($lang, array('type'=>'bluetooth','-deleted'=>'no')); } + } \ No newline at end of file -- cgit v1.2.3