当前位置: 首页>>代码示例>>PHP>>正文


PHP Device::fromDatabaseById方法代码示例

本文整理汇总了PHP中Device::fromDatabaseById方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::fromDatabaseById方法的具体用法?PHP Device::fromDatabaseById怎么用?PHP Device::fromDatabaseById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Device的用法示例。


在下文中一共展示了Device::fromDatabaseById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removeDevice

 public function removeDevice()
 {
     $dev_id = $_GET['dev_id'];
     $device = Device::fromDatabaseById($dev_id);
     if ($device) {
         if ($device->delete()) {
             return 'true';
         }
     }
     return 'false';
 }
开发者ID:adntec,项目名称:queueManage,代码行数:11,代码来源:RemoveRecord.php

示例2: execute

 public function execute()
 {
     global $gvPath;
     // Trim data
     $this->dev_ip_address = trim($this->dev_ip_address);
     $this->dev_desk_number = trim($this->dev_desk_number);
     // Data validation
     if ($this->dev_ip_address === '' || $this->dev_desk_number === '') {
         $this->message = "Errore: tutti i campi sono obbligatori.";
         return true;
     }
     // dev_desk_number should contain... numbers
     if (preg_match('/^(0|[1-9][0-9]*)$/', $this->dev_desk_number) !== 1) {
         $this->message = "Errore: il numero dello sportello non è valido.";
         return true;
     }
     // Check ip_address
     if (!filter_var($this->dev_ip_address, FILTER_VALIDATE_IP)) {
         $this->message = "Errore: l'indirizzo IP non è valido.";
         return true;
     }
     // Check if desk number really exists
     if ((int) $this->dev_desk_number !== 0) {
         $desk = Desk::fromDatabaseByNumber($this->dev_desk_number);
         if (!$desk) {
             $this->message = "Errore: lo sportello specificato non esiste.";
             return true;
         }
         unset($desk);
     }
     // Check tdCode exists and active
     if ($this->dev_td_code) {
         $td = TopicalDomain::fromDatabaseByCode($this->dev_td_code);
         if (!$td || !$td->getActive()) {
             $this->message = "Errore: l'area tematica selezionata non è disponibile.";
             return true;
         }
     }
     // Check ip is not taken
     $device = Device::fromDatabaseByIpAddress($this->dev_ip_address);
     $desk = Desk::fromDatabaseByIpAddress($this->dev_ip_address);
     if ($desk || $device && ($this->dev_id === 0 || $this->dev_id !== (int) $device->getId())) {
         $this->message = "Errore: l'indirizzo IP è gia stato assegnato.";
         return true;
     }
     unset($device);
     if ($this->dev_id === 0) {
         $device = Device::newRecord();
     } else {
         $device = Device::fromDatabaseById($this->dev_id);
     }
     $device->setIpAddress($this->dev_ip_address);
     $device->setDeskNumber($this->dev_desk_number);
     $device->setTdCode($this->dev_td_code);
     if ($device->save()) {
         gfSetDelayedMsg('Operazione effettuata correttamente', 'Ok');
         $redirect = new RedirectOutput("{$gvPath}/application/adminDeviceList");
         return $redirect;
     } else {
         $this->message = "Impossibile salvare le modifiche. Ritentare in seguito.";
         return true;
     }
 }
开发者ID:adntec,项目名称:queueManage,代码行数:63,代码来源:AdminDeviceEdit.php


注:本文中的Device::fromDatabaseById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。