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


PHP Warehouse::edit方法代码示例

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


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

示例1: process

 public function process()
 {
     // check if session is active
     $session = new Session($this->sessionId);
     if ($session->sessionId > 0) {
         // update session
         $session->update();
         // process restricted functions
         switch ($this->f) {
             case 'checkLogin':
                 return Login::checkLogin($session->sessionId);
             case 'getSession':
                 return $session;
             case 'getWarehouse':
                 if (isset($this->data->update)) {
                     $warehouse = new Warehouse($session->warehouseId, $this->data->update);
                 } else {
                     $warehouse = new Warehouse($session->warehouseId);
                 }
                 $warehouse->dMail = $warehouse->getMail();
                 $warehouse->dDisableLocationLess = $warehouse->isLocationLessDisabled();
                 $warehouse->dDisablePaletteLess = $warehouse->isPaletteLessDisabled();
                 return $warehouse;
             case 'editWarehouse':
                 if (!$session->restricted) {
                     $data = $this->data;
                     $warehouse = new Warehouse($session->warehouseId);
                     // update warehouse data
                     if (isset($data->name)) {
                         $warehouse->name = $data->name;
                     }
                     if (isset($data->description)) {
                         $warehouse->description = $data->description;
                     }
                     if (isset($data->country)) {
                         $warehouse->country = $data->country;
                     }
                     if (isset($data->city)) {
                         $warehouse->city = $data->city;
                     }
                     if (isset($data->password)) {
                         $warehouse->setPassword($data->password);
                     }
                     if (isset($data->passwordRestricted)) {
                         $warehouse->setPasswordRestricted($data->passwordRestricted);
                     }
                     if (isset($data->mail)) {
                         $warehouse->setMail($data->mail);
                     }
                     if (isset($data->disableLocationLess)) {
                         $warehouse->setDisableLocationLess($data->disableLocationLess);
                     }
                     if (isset($data->disablePaletteLess)) {
                         $warehouse->setDisablePaletteLess($data->disablePaletteLess);
                     }
                     // update database entry
                     return $warehouse->edit();
                 }
                 break;
             case 'deleteWarehouse':
                 if (!$session->restricted) {
                     $warehouse = new Warehouse($session->warehouseId);
                     if ($warehouse->id > 0 && $warehouse->delete()) {
                         return $session->destroy();
                     }
                 }
                 break;
             case 'addCategory':
                 if (!$session->restricted && isset($this->data->name)) {
                     $category = new Category(null, $session->warehouseId);
                     $category->name = $this->data->name;
                     if (isset($this->data->parent)) {
                         $category->parent = $this->data->parent;
                     }
                     if ($category->edit()) {
                         return $category->id;
                     }
                 }
                 break;
             case 'getCategory':
                 if (isset($this->data->id) && isset($this->data->update)) {
                     return new Category($this->data->id, $session->warehouseId, $this->data->update);
                 } elseif (isset($this->data->id)) {
                     return new Category($this->data->id, $session->warehouseId);
                 }
                 break;
             case 'deleteCategory':
                 if (!$session->restricted && isset($this->data->id)) {
                     $category = new Category($this->data->id, $session->warehouseId);
                     return $category->delete();
                 }
                 break;
             case 'editCategory':
                 if (isset($this->data->id)) {
                     $data = $this->data;
                     $category = new Category($this->data->id, $session->warehouseId);
                     if (!$session->restricted) {
                         if (isset($data->name)) {
                             $category->name = $data->name;
                         }
//.........这里部分代码省略.........
开发者ID:hanneseilers,项目名称:Social-Warehouse,代码行数:101,代码来源:DataRequest.php


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