From 3ca3ecdd45838debc75d6feba2a452ef4d91431a Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Mon, 18 Jul 2011 22:55:53 +0000 Subject: deleted pages are no more visible on the filters --- h-source/Application/Models/AcquisitioncardsModel.php | 9 ++------- h-source/Application/Models/BluetoothModel.php | 9 ++------- h-source/Application/Models/FingerprintreadersModel.php | 9 ++------- h-source/Application/Models/GenericModel.php | 10 ++++++++++ h-source/Application/Models/NotebooksModel.php | 9 ++------- h-source/Application/Models/PrintersModel.php | 7 +------ h-source/Application/Models/ScannersModel.php | 11 +++-------- h-source/Application/Models/SoundcardsModel.php | 9 ++------- h-source/Application/Models/ThreegcardsModel.php | 9 ++------- h-source/Application/Models/VideocardsModel.php | 7 +------ h-source/Application/Models/WebcamsModel.php | 9 ++------- h-source/Application/Models/WifiModel.php | 11 +++-------- 12 files changed, 32 insertions(+), 77 deletions(-) (limited to 'h-source/Application/Models') diff --git a/h-source/Application/Models/AcquisitioncardsModel.php b/h-source/Application/Models/AcquisitioncardsModel.php index 67d71eb..ab04fed 100644 --- a/h-source/Application/Models/AcquisitioncardsModel.php +++ b/h-source/Application/Models/AcquisitioncardsModel.php @@ -45,13 +45,8 @@ class AcquisitioncardsModel extends GenericModel $this->_popupFunctions = array( 'vendor' => 'betterVendor', ); - - $this->_popupWhere = array( - 'vendor' => 'type="acquisition-card" and deleted="no"', - 'comm_year' => 'type="acquisition-card" and deleted="no"', - 'compatibility' => 'type="acquisition-card" and deleted="no"', - 'interface' => 'type="acquisition-card" and deleted="no"', - ); + + $this->createPopupWhere('vendor,compatibility,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/BluetoothModel.php b/h-source/Application/Models/BluetoothModel.php index 0b7f15d..82aab59 100644 --- a/h-source/Application/Models/BluetoothModel.php +++ b/h-source/Application/Models/BluetoothModel.php @@ -45,13 +45,8 @@ class BluetoothModel extends GenericModel $this->_popupFunctions = array( 'vendor' => 'betterVendor', ); - - $this->_popupWhere = array( - 'vendor' => 'type="bluetooth" and deleted="no"', - 'comm_year' => 'type="bluetooth" and deleted="no"', - 'bluetooth_works' => 'type="bluetooth" and deleted="no"', - 'interface' => 'type="bluetooth" and deleted="no"', - ); + + $this->createPopupWhere('vendor,bluetooth_works,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/FingerprintreadersModel.php b/h-source/Application/Models/FingerprintreadersModel.php index ea249a9..8e3f8da 100644 --- a/h-source/Application/Models/FingerprintreadersModel.php +++ b/h-source/Application/Models/FingerprintreadersModel.php @@ -45,13 +45,8 @@ class FingerprintreadersModel extends GenericModel $this->_popupFunctions = array( 'vendor' => 'betterVendor', ); - - $this->_popupWhere = array( - 'vendor' => 'type="fingerprint-reader" and deleted="no"', - 'comm_year' => 'type="fingerprint-reader" and deleted="no"', - 'fingerprint_works' => 'type="fingerprint-reader" and deleted="no"', - 'interface' => 'type="fingerprint-reader" and deleted="no"', - ); + + $this->createPopupWhere('vendor,fingerprint_works,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/GenericModel.php b/h-source/Application/Models/GenericModel.php index 0ccd332..9a619fd 100644 --- a/h-source/Application/Models/GenericModel.php +++ b/h-source/Application/Models/GenericModel.php @@ -56,4 +56,14 @@ class GenericModel extends Model_Tree { { return getDiffArray($this->diffFields, $oldArray, $newArray); } + + //create the $_popupWhere property + public function createPopupWhere($list) + { + $listArray = explode(',',$list); + foreach ($listArray as $field) + { + $this->_popupWhere[$field] = 'type="'.$this->type.'" and deleted="no" and cleared="no"'; + } + } } \ No newline at end of file diff --git a/h-source/Application/Models/NotebooksModel.php b/h-source/Application/Models/NotebooksModel.php index 00ab64d..2172f52 100644 --- a/h-source/Application/Models/NotebooksModel.php +++ b/h-source/Application/Models/NotebooksModel.php @@ -40,13 +40,8 @@ class NotebooksModel extends GenericModel { 'comm_year' => gtext("year"), 'subtype' => gtext("subtype"), ); - - $this->_popupWhere = array( - 'vendor' => 'type="notebook" and deleted="no"', - 'compatibility' => 'type="notebook" and deleted="no"', - 'comm_year' => 'type="notebook" and deleted="no"', - 'subtype' => 'type="notebook" and deleted="no"', - ); + + $this->createPopupWhere('vendor,compatibility,comm_year,subtype'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/PrintersModel.php b/h-source/Application/Models/PrintersModel.php index b5b2f49..882224d 100644 --- a/h-source/Application/Models/PrintersModel.php +++ b/h-source/Application/Models/PrintersModel.php @@ -42,12 +42,7 @@ class PrintersModel extends GenericModel 'interface' => gtext("interface"), ); - $this->_popupWhere = array( - 'vendor' => 'type="printer" and deleted="no"', - 'compatibility' => 'type="printer" and deleted="no"', - 'comm_year' => 'type="printer" and deleted="no"', - 'interface' => 'type="printer" and deleted="no"', - ); + $this->createPopupWhere('vendor,compatibility,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/ScannersModel.php b/h-source/Application/Models/ScannersModel.php index 72825b5..430142d 100644 --- a/h-source/Application/Models/ScannersModel.php +++ b/h-source/Application/Models/ScannersModel.php @@ -41,14 +41,9 @@ class ScannersModel extends GenericModel 'comm_year' => gtext("year"), 'interface' => gtext("interface"), ); - - $this->_popupWhere = array( - 'vendor' => 'type="scanner" and deleted="no"', - 'compatibility' => 'type="scanner" and deleted="no"', - 'comm_year' => 'type="scanner" and deleted="no"', - 'interface' => 'type="scanner" and deleted="no"', - ); - + + $this->createPopupWhere('vendor,compatibility,comm_year,interface'); + $this->diffFields = array( 'vendor' => gtext("vendor"), 'model' => gtext('model name'), diff --git a/h-source/Application/Models/SoundcardsModel.php b/h-source/Application/Models/SoundcardsModel.php index 71c8125..cda9c99 100644 --- a/h-source/Application/Models/SoundcardsModel.php +++ b/h-source/Application/Models/SoundcardsModel.php @@ -45,13 +45,8 @@ class SoundcardsModel extends GenericModel $this->_popupFunctions = array( 'vendor' => 'betterVendor', ); - - $this->_popupWhere = array( - 'vendor' => 'type="soundcard" and deleted="no"', - 'comm_year' => 'type="soundcard" and deleted="no"', - 'sound_card_works' => 'type="soundcard" and deleted="no"', - 'interface' => 'type="soundcard" and deleted="no"', - ); + + $this->createPopupWhere('vendor,sound_card_works,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/ThreegcardsModel.php b/h-source/Application/Models/ThreegcardsModel.php index 5b0a7e7..4a89a97 100644 --- a/h-source/Application/Models/ThreegcardsModel.php +++ b/h-source/Application/Models/ThreegcardsModel.php @@ -46,13 +46,8 @@ class ThreegcardsModel extends GenericModel 'vendor' => 'betterVendor', 'interface' => 'betterVendor', ); - - $this->_popupWhere = array( - 'vendor' => 'type="3G-card" and deleted="no"', - 'comm_year' => 'type="3G-card" and deleted="no"', - 'wifi_works' => 'type="3G-card" and deleted="no"', - 'interface' => 'type="3G-card" and deleted="no"', - ); + + $this->createPopupWhere('vendor,wifi_works,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/VideocardsModel.php b/h-source/Application/Models/VideocardsModel.php index 4cac5a7..2e9a3ee 100644 --- a/h-source/Application/Models/VideocardsModel.php +++ b/h-source/Application/Models/VideocardsModel.php @@ -42,12 +42,7 @@ class VideocardsModel extends GenericModel 'interface' => gtext("interface"), ); - $this->_popupWhere = array( - 'vendor' => 'type="videocard" and deleted="no"', - 'comm_year' => 'type="videocard" and deleted="no"', - 'video_card_works' => 'type="videocard" and deleted="no"', - 'interface' => 'type="videocard" and deleted="no"', - ); + $this->createPopupWhere('vendor,video_card_works,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/WebcamsModel.php b/h-source/Application/Models/WebcamsModel.php index 2b5ed9b..a59da6e 100644 --- a/h-source/Application/Models/WebcamsModel.php +++ b/h-source/Application/Models/WebcamsModel.php @@ -45,13 +45,8 @@ class WebcamsModel extends GenericModel $this->_popupFunctions = array( 'vendor' => 'betterVendor', ); - - $this->_popupWhere = array( - 'vendor' => 'type="webcam" and deleted="no"', - 'comm_year' => 'type="webcam" and deleted="no"', - 'webcam_works' => 'type="webcam" and deleted="no"', - 'interface' => 'type="webcam" and deleted="no"', - ); + + $this->createPopupWhere('vendor,webcam_works,comm_year,interface'); $this->diffFields = array( 'vendor' => gtext("vendor"), diff --git a/h-source/Application/Models/WifiModel.php b/h-source/Application/Models/WifiModel.php index 3d15aa2..12dedc2 100644 --- a/h-source/Application/Models/WifiModel.php +++ b/h-source/Application/Models/WifiModel.php @@ -45,14 +45,9 @@ class WifiModel extends GenericModel $this->_popupFunctions = array( 'interface' => 'betterVendor', ); - - $this->_popupWhere = array( - 'vendor' => 'type="wifi" and deleted="no"', - 'comm_year' => 'type="wifi" and deleted="no"', - 'wifi_works' => 'type="wifi" and deleted="no"', - 'interface' => 'type="wifi" and deleted="no"', - ); - + + $this->createPopupWhere('vendor,wifi_works,comm_year,interface'); + $this->diffFields = array( 'vendor' => gtext("vendor"), 'model' => gtext('model name'), -- cgit v1.2.3