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


PHP StringHelper::cleanEmptyString4NULL方法代码示例

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


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

示例1: action_createOrUpdateWarehouse

 public function action_createOrUpdateWarehouse()
 {
     try {
         $post = Validate::factory($_POST)->rule('warehouse_name', 'not_empty')->rule('warehouse_short_name', 'not_empty')->rule('warehouse_office_location', 'not_empty');
         if (!$post->check()) {
             echo "0|ERROR - Empty Data Post";
             die;
         }
         $warehouse_id = StringHelper::cleanEmptyString4NULL($_POST['warehouse_id']);
         $warehouse_name = StringHelper::cleanEmptyString4NULL($_POST['warehouse_name']);
         $warehouse_short_name = StringHelper::cleanEmptyString4NULL($_POST['warehouse_short_name']);
         $warehouse_office_location = StringHelper::cleanEmptyString4NULL($_POST['warehouse_office_location']);
         $warehouse = new Model_Warehouse();
         if ($warehouse_id != 0) {
             $warehouse = ORM::factory('Warehouse', $warehouse_id);
         }
         $warehouse->name = trim($warehouse_name);
         $warehouse->shortName = trim($warehouse_short_name);
         $warehouse->status = $this->GENERAL_STATUS['ACTIVE'];
         $warehouse->idOfficeLocation = $warehouse_office_location;
         $warehouse->save();
         echo "1|ok";
     } catch (Exception $exc) {
         echo "0|" . $exc->getTraceAsString();
     }
     die;
 }
开发者ID:BGCX261,项目名称:zinventory-svn-to-git,代码行数:27,代码来源:warehouse.php

示例2: action_createOrUpdateOfficeLocation

 public function action_createOrUpdateOfficeLocation()
 {
     try {
         $post = Validate::factory($_POST)->rule('office_location_name', 'not_empty')->rule('office_location_address', 'not_empty')->rule('office_location_country', 'not_empty');
         if (!$post->check()) {
             echo "0|ERROR - Empty Data Post";
             die;
         }
         $office_location_id = StringHelper::cleanEmptyString4NULL($_POST['office_location_id']);
         $office_location_name = StringHelper::cleanEmptyString4NULL($_POST['office_location_name']);
         $office_location_address = StringHelper::cleanEmptyString4NULL($_POST['office_location_address']);
         $office_location_country = StringHelper::cleanEmptyString4NULL($_POST['office_location_country']);
         $office_location = new Model_Officelocation();
         if ($office_location_id != 0) {
             $office_location = ORM::factory('Officelocation', $office_location_id);
         }
         $office_location->name = trim($office_location_name);
         $office_location->address = trim($office_location_address);
         $office_location->status = $this->GENERAL_STATUS['ACTIVE'];
         $office_location->idCountry = $office_location_country;
         $office_location->save();
         echo "1|ok";
     } catch (Exception $exc) {
         echo "0|" . $exc->getTraceAsString();
     }
     die;
 }
开发者ID:BGCX261,项目名称:zinventory-svn-to-git,代码行数:27,代码来源:officelocation.php

示例3: action_createOrUpdateUser

 public function action_createOrUpdateUser()
 {
     try {
         $post = Validate::factory($_POST)->rule('person_fname', 'not_empty')->rule('person_lname', 'not_empty')->rule('person_email', 'not_empty')->rule('user_id', 'not_empty')->rule('user_name', 'not_empty')->rule('user_password', 'not_empty')->rule('user_group', 'not_empty')->rule('person_country', 'not_empty');
         if (!$post->check()) {
             echo "0|ERROR - Empty Data Post";
             die;
         }
         $person_fname = StringHelper::cleanEmptyString4NULL($_POST['person_fname']);
         $person_lname = StringHelper::cleanEmptyString4NULL($_POST['person_lname']);
         $person_email = StringHelper::cleanEmptyString4NULL($_POST['person_email']);
         $user_id = $_POST['user_id'];
         $user_name = StringHelper::cleanEmptyString4NULL($_POST['user_name']);
         $user_password = $_POST['user_password'];
         $user_group = $_POST['user_group'];
         $person_country = $_POST['person_country'];
         $person_phone1 = StringHelper::cleanEmptyString4NULL($_POST['person_phone1']);
         $person_phone2 = StringHelper::cleanEmptyString4NULL($_POST['person_phone2']);
         $person_cellphone = StringHelper::cleanEmptyString4NULL($_POST['person_cellphone']);
         $person_address1 = StringHelper::cleanEmptyString4NULL($_POST['person_address1']);
         $person_address2 = StringHelper::cleanEmptyString4NULL($_POST['person_address2']);
         $person_city = StringHelper::cleanEmptyString4NULL($_POST['person_city']);
         $person_zipcode = StringHelper::cleanEmptyString4NULL($_POST['person_zipcode']);
         $person_array_data = array('fName' => $person_fname, 'lName' => $person_lname, 'phone1' => $person_phone1, 'phone2' => $person_phone2, 'address1' => $person_address1, 'address2' => $person_address2, 'idCountry' => $person_country, 'email' => $person_email, 'city' => $person_city, 'zipcode' => $person_zipcode, 'type' => $this->USER_TYPE['EMPLOYEE']);
         $user_array_data = array('idUser' => NULL, 'userName' => $user_name, 'password' => $user_password, 'status' => $this->GENERAL_STATUS['ACTIVE'], 'registrationDate' => NULL, 'idGroup' => $user_group);
         DB::query(NULL, "BEGIN WORK")->execute();
         $success = FALSE;
         if ($user_id == 0) {
             //CREATE PERSON
             $person_saved = DB::insert('person', array_keys($person_array_data))->values($person_array_data)->execute();
             //CREATE USER
             $user_array_data['idUser'] = $person_saved[0];
             $user_array_data['registrationDate'] = Date::formatted_time();
             $user_saved = DB::insert('user', array_keys($user_array_data))->values($user_array_data)->execute();
             $success = ($person_saved[1] and $user_saved[1]);
         } else {
             //UPDATE PERSON
             $person_update = DB::update('person')->set($person_array_data)->where('idPerson', '=', $user_id)->execute();
             //UPDATE USER
             unset($user_array_data['idUser']);
             unset($user_array_data['registrationDate']);
             $user_update = DB::update('user')->set($user_array_data)->where('idUser', '=', $user_id)->execute();
             $success = ($person_update >= 0 or $user_update >= 0);
         }
         if ($success) {
             DB::query(NULL, "COMMIT")->execute();
             echo "1|ok";
         }
     } catch (Exception $exc) {
         DB::query(NULL, "ROLLBACK")->execute();
         echo "0|COMMIT ERROR - ROLLBACK ACTION SUCCESS - " . $exc->getTraceAsString();
     }
     die;
 }
开发者ID:BGCX261,项目名称:zinventory-svn-to-git,代码行数:54,代码来源:user.php


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