diff options
Diffstat (limited to 'h-source/Application/Controllers/GenericController.php')
-rw-r--r-- | h-source/Application/Controllers/GenericController.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index 362ea1e..a2c5bdf 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -59,7 +59,7 @@ class GenericController extends BaseController $data['isApproved'] = true; $this->append($data); } - + protected function insert($lang = 'en', $token = '') { $this->shift(2); @@ -96,7 +96,7 @@ class GenericController extends BaseController { $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id,$interface)); - $this->m['HardwareModel']->databaseConditions['insert']['+checkUnique'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database'; + $this->m['HardwareModel']->databaseConditions['insert']['+checkUnique'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database. See here: '.$this->getAlreadyExixtsLink($pci_id); } //insert the new device @@ -264,7 +264,7 @@ class GenericController extends BaseController { $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id,$interface)); - $this->m['HardwareModel']->databaseConditions['update']['+checkUniqueCompl'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database'; + $this->m['HardwareModel']->databaseConditions['update']['+checkUniqueCompl'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database. See here: '.$this->getAlreadyExixtsLink($pci_id); } //carry out the update database action @@ -820,11 +820,25 @@ class GenericController extends BaseController $this->append($data); $this->loadViewAll('talk,if_page_deleted,moderator_dialog'); } + + //get the link to the device page from vendorid:productid code + protected function getAlreadyExixtsLink($code) + { + $hw = new HardwareModel(); + $info = $hw->getModelByCode($code); + + if ($info) + { + return $this->getViewLink($info['id_hard'],$info['model'],Hardware::getControllerFromType($info['type'])); + } + return ''; + } - protected function getViewLink($id,$ne_name) + protected function getViewLink($id,$ne_name,$controller = null) { -// $text = isset() - return "<a href='".$this->baseUrl.'/'.$this->controller.'/view/'.$this->lang.'/'.$id.'/'.encodeUrl($ne_name).$this->viewStatus."'>".$ne_name."</a>"; + $contr = isset($controller) ? $controller : $this->controller; + + return "<a href='".$this->baseUrl.'/'.$contr.'/view/'.$this->lang.'/'.$id.'/'.encodeUrl($ne_name).$this->viewStatus."'>".$ne_name."</a>"; } protected function getHistoryLink($id) |