aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers/BluetoothController.php
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-09-14 22:21:12 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-09-14 22:21:12 +0000
commit377b513193b4d0c155eafa2f2cf13592190be17f (patch)
tree095871f9bd1318d4bf86cf36593b22529fa8a2ca /h-source/Application/Controllers/BluetoothController.php
parent50efe9731fdf489b4bbc2669766010075691df08 (diff)
improved the way validate conditions are set
Diffstat (limited to 'h-source/Application/Controllers/BluetoothController.php')
-rw-r--r--h-source/Application/Controllers/BluetoothController.php51
1 files changed, 8 insertions, 43 deletions
diff --git a/h-source/Application/Controllers/BluetoothController.php b/h-source/Application/Controllers/BluetoothController.php
index b452f61..bff2723 100644
--- a/h-source/Application/Controllers/BluetoothController.php
+++ b/h-source/Application/Controllers/BluetoothController.php
@@ -27,6 +27,10 @@ class BluetoothController extends GenericController
{
$this->_topMenuClasses['hardware'] = " class='currentitem'";
+
+ $worksOptions = Bluetooth::$select;;
+ $worksField = 'bluetooth_works';
+ $interfaceOptions = Bluetooth::$interface;
parent::__construct($model, $controller, $queryString);
@@ -41,46 +45,7 @@ class BluetoothController extends GenericController
$this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
$this->m['HardwareModel']->type = 'bluetooth';
- //hardware conditions
- $this->m['HardwareModel']->strongConditions['update'] = array(
- "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry",
- "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry",
- "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",
- "checkLength|99" => "model",
- "+checkLength|299" => "distribution",
- "++checkIsStrings|".Wifi::$commYear => "comm_year",
- "+++checkIsStrings|".Bluetooth::$select => "bluetooth_works",
- "++++checkIsStrings|".Bluetooth::$interface => "interface",
- );
-
- $this->m['HardwareModel']->strongConditions['insert'] = array(
- "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry",
- "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry",
- "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",
- "checkLength|99" => "model",
- "+checkLength|299" => "distribution",
- "++checkIsStrings|".Wifi::$commYear => "comm_year",
- "+++checkIsStrings|".Bluetooth::$select => "bluetooth_works",
- "++++checkIsStrings|".Bluetooth::$interface => "interface",
- );
-
- $this->m['HardwareModel']->softConditions['update'] = array(
- "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry",
- "checkLength|20000" => "description",
- "+checkLength|49" => "kernel",
- "++checkLength|49" => "driver",
- "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]",
- "+++checkLength|1000" => "other_names|the <i>other names</i> entry exceeds the value of 1000 characters",
- );
-
- $this->m['HardwareModel']->softConditions['insert'] = array(
- "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry",
- "checkLength|20000" => "description",
- "+checkLength|49" => "kernel",
- "++checkLength|49" => "driver",
- "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]",
- "+++checkLength|1000" => "other_names|the <i>other names</i> entry exceeds the value of 1000 characters",
- );
+ $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
$this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,bluetooth_works,pci_id,interface,driver,other_names','sanitizeAll');
@@ -98,9 +63,9 @@ class BluetoothController extends GenericController
$data['title'] = 'Bluetooth';
- $data['intefaceOptions'] = Bluetooth::$interface;
- $data['worksOptions'] = Bluetooth::$select;
- $data['worksField'] = 'bluetooth_works';
+ $data['intefaceOptions'] = $interfaceOptions;
+ $data['worksOptions'] = $worksOptions;
+ $data['worksField'] = $worksField;
$this->append($data);
}