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


PHP Customer::store方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open('samples');
         // abre uma transação
         // cria novo objeto
         $giovani = new Customer();
         $giovani->name = 'Giovanni Dall Oglio';
         $giovani->address = 'Rua da Conceicao';
         $giovani->phone = '(51) 8111-2222';
         $giovani->birthdate = '2013-02-15';
         $giovani->status = 'S';
         $giovani->email = 'giovanni@dalloglio.net';
         $giovani->gender = 'M';
         $giovani->category_id = '1';
         $giovani->city_id = '1';
         $giovani->store();
         // armazena o objeto
         new TMessage('info', 'Objeto armazenado com sucesso');
         TTransaction::close();
         // fecha a transação.
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:26,代码来源:ObjectStore.class.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open('samples');
         // abre uma transação
         $customer = new Customer(4);
         // carrega o cliente 4
         $customer->addSkill(new Skill(1));
         $customer->addSkill(new Skill(2));
         $customer->store();
         new TMessage('info', 'Habilidades adicionadas');
         TTransaction::close();
         // fecha a transação.
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:18,代码来源:ObjectAggregation.class.php

示例3:

 /**
  * Change the customers' password
  *
  * If no customer is logged in, redirects to the login page.
  * Returns true only after the password has been updated successfully.
  * @return  boolean             True on success, false otherwise
  */
 static function _changepass()
 {
     global $_ARRAYLANG;
     if (!self::$objCustomer) {
         \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'login') . '?redirect=' . base64_encode(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'changepass')));
     }
     if (isset($_POST['shopNewPassword'])) {
         if (empty($_POST['shopCurrentPassword'])) {
             return \Message::error($_ARRAYLANG['TXT_SHOP_ENTER_CURRENT_PASSWORD']);
         }
         $password_old = contrexx_input2raw($_POST['shopCurrentPassword']);
         if (md5($password_old) != self::$objCustomer->password()) {
             return \Message::error($_ARRAYLANG['TXT_SHOP_WRONG_CURRENT_PASSWORD']);
         }
         $password = contrexx_input2raw($_POST['shopNewPassword']);
         if (empty($password)) {
             return \Message::error($_ARRAYLANG['TXT_SHOP_SPECIFY_NEW_PASSWORD']);
         }
         if (empty($_POST['shopConfirmPassword'])) {
             return \Message::error($_ARRAYLANG['TXT_SHOP_PASSWORD_NOT_CONFIRMED']);
         }
         $password_confirm = contrexx_input2raw($_POST['shopConfirmPassword']);
         if ($password != $password_confirm) {
             return \Message::error($_ARRAYLANG['TXT_SHOP_PASSWORD_NOT_CONFIRMED']);
         }
         if (strlen($password) < 6) {
             return \Message::error($_ARRAYLANG['TXT_PASSWORD_MIN_CHARS']);
         }
         if (!self::$objCustomer->password($password)) {
             return \Message::error($_ARRAYLANG['TXT_SHOP_PASSWORD_INVALID']);
         }
         if (!self::$objCustomer->store()) {
             return \Message::error($_ARRAYLANG['TXT_SHOP_PASSWORD_ERROR_UPDATING']);
         }
         return \Message::ok($_ARRAYLANG['TXT_SHOP_PASSWORD_CHANGED_SUCCESSFULLY']);
     }
     self::$objTemplate->setVariable(array('SHOP_PASSWORD_CURRENT' => $_ARRAYLANG['SHOP_PASSWORD_CURRENT'], 'SHOP_PASSWORD_NEW' => $_ARRAYLANG['SHOP_PASSWORD_NEW'], 'SHOP_PASSWORD_CONFIRM' => $_ARRAYLANG['SHOP_PASSWORD_CONFIRM'], 'SHOP_PASSWORD_CHANGE' => $_ARRAYLANG['SHOP_PASSWORD_CHANGE']));
     return false;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:46,代码来源:Shop.class.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open('samples');
         // abre uma transação
         $customer = new Customer(4);
         // carrega o cliente 4
         $contact1 = new Contact();
         $contact2 = new Contact();
         $contact1->type = 'fone';
         $contact1->value = '78 2343-4545';
         $contact2->type = 'fone';
         $contact2->value = '78 9494-0404';
         $customer->addContact($contact1);
         $customer->addContact($contact2);
         $customer->store();
         new TMessage('info', 'Contatos adicionados');
         TTransaction::close();
         // fecha a transação.
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:24,代码来源:ObjectComposition.class.php

示例5: onEdit

 function onEdit($param)
 {
     try {
         // get the parameter $key
         $field = $param['field'];
         $key = $param['key'];
         $value = $param['value'];
         // open a transaction with database 'samples'
         TTransaction::open('samples');
         // instantiates object Customer
         $customer = new Customer($key);
         $customer->{$field} = $value;
         $customer->store();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload($param);
         // shows the success message
         new TMessage('info', "Record Updated");
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:26,代码来源:InlineDataGridView.class.php

示例6: errorHandler

 /**
  * Handles database errors
  *
  * Also migrates old Shop Customers to the User accounts and adds
  * all new settings
  * @return  boolean     false     Always!
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Customer
     $table_name_old = DBPREFIX . "module_shop_customers";
     // If the old Customer table is missing, the migration has completed
     // successfully already
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
         return false;
     }
     // Ensure that the ShopSettings (including \Cx\Core\Setting) and Order tables
     // are ready first!
     //DBG::log("Customer::errorHandler(): Adding settings");
     ShopSettings::errorHandler();
     //        \Cx\Core\Country\Controller\Country::errorHandler(); // Called by Order::errorHandler();
     Order::errorHandler();
     Discount::errorHandler();
     \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
     $objUser = \FWUser::getFWUserObject()->objUser;
     // Create new User_Profile_Attributes
     $index_notes = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_notes', 'Shop');
     if (!$index_notes) {
         //DBG::log("Customer::errorHandler(): Adding notes attribute...");
         //            $objProfileAttribute = new \User_Profile_Attribute();
         $objProfileAttribute = $objUser->objAttribute->getById(0);
         //DBG::log("Customer::errorHandler(): NEW notes attribute: ".var_export($objProfileAttribute, true));
         $objProfileAttribute->setNames(array(1 => 'Notizen', 2 => 'Notes', 3 => 'Notes', 4 => 'Notes', 5 => 'Notes', 6 => 'Notes'));
         $objProfileAttribute->setType('text');
         $objProfileAttribute->setMultiline(true);
         $objProfileAttribute->setParent(0);
         $objProfileAttribute->setProtection(array(1));
         //DBG::log("Customer::errorHandler(): Made notes attribute: ".var_export($objProfileAttribute, true));
         if (!$objProfileAttribute->store()) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
         }
         //Re initialize shop setting
         \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
         //DBG::log("Customer::errorHandler(): Stored notes attribute, ID ".$objProfileAttribute->getId());
         if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_notes', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_notes'))) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'notes' setting");
         }
         //DBG::log("Customer::errorHandler(): Stored notes attribute ID setting");
     }
     $index_group = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_group_id', 'Shop');
     if (!$index_group) {
         //            $objProfileAttribute = new \User_Profile_Attribute();
         $objProfileAttribute = $objUser->objAttribute->getById(0);
         $objProfileAttribute->setNames(array(1 => 'Kundenrabattgruppe', 2 => 'Discount group', 3 => 'Kundenrabattgruppe', 4 => 'Kundenrabattgruppe', 5 => 'Kundenrabattgruppe', 6 => 'Kundenrabattgruppe'));
         $objProfileAttribute->setType('text');
         $objProfileAttribute->setParent(0);
         $objProfileAttribute->setProtection(array(1));
         if (!$objProfileAttribute->store()) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
         }
         //Re initialize shop setting
         \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
         if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_customer_group_id', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_customer_group_id'))) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'customer_group_id' setting");
         }
     }
     // For the migration, a temporary flag is needed in the orders table
     // in order to prevent mixing up old and new customer_id values.
     $table_order_name = DBPREFIX . "module_shop_orders";
     if (!\Cx\Lib\UpdateUtil::column_exist($table_order_name, 'migrated')) {
         $query = "\n                ALTER TABLE `{$table_order_name}`\n                  ADD `migrated` TINYINT(1) unsigned NOT NULL default 0";
         \Cx\Lib\UpdateUtil::sql($query);
     }
     // Create missing UserGroups for customers and resellers
     $objGroup = null;
     $group_id_customer = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop');
     if ($group_id_customer) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroup($group_id_customer);
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroups(array('group_name' => 'Shop Endkunden'));
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = new \UserGroup();
         $objGroup->setActiveStatus(true);
         $objGroup->setDescription('Online Shop Endkunden');
         $objGroup->setName('Shop Endkunden');
         $objGroup->setType('frontend');
     }
     //DBG::log("Group: ".var_export($objGroup, true));
     if (!$objGroup) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to create UserGroup for customers");
     }
     //DBG::log("Customer::errorHandler(): Made customer usergroup: ".var_export($objGroup, true));
     if (!$objGroup->store() || !$objGroup->getId()) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup for customers");
     }
     //DBG::log("Customer::errorHandler(): Stored customer usergroup, ID ".$objGroup->getId());
     \Cx\Core\Setting\Controller\Setting::set('usergroup_id_customer', $objGroup->getId());
//.........这里部分代码省略.........
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:Customer.class.php

示例7: delete

            }
        }
    }
    /**
     * Delete the object and its aggregates
     * @param $id object ID
     */
    public function delete($id = NULL)
    {
        // delete the related CustomerSkill objects
        $id = isset($id) ? $id : $this->id;
        $repository = new TRepository('CustomerSkill');
        $criteria = new TCriteria();
        $criteria->add(new TFilter('customer_id', '=', $id));
        $repository->delete($criteria);
        // delete the object itself
        parent::delete($id);
    }
}
/**
 * USAGE
 */
$customer = new Customer(4);
// lodas the customer 4
// add two skills
$customer->addSkill(new Skill(1));
$customer->addSkill(new Skill(2));
// stores the customer and the references to the skills
// using CustomerSkill class (that handles customer_skill association table).
$customer->store();
开发者ID:jfrank1500,项目名称:curso_php,代码行数:30,代码来源:Aggregation.php

示例8: storeCustomerFromPost

 /**
  * Store a customer
  *
  * Sets a Message according to the outcome.
  * Note that failure to send the e-mail with login data is not
  * considered an error and will only produce a warning.
  * @return  integer       The Customer ID on success, null otherwise
  * @author  Reto Kohli <reto.kohli@comvation.com>
  */
 static function storeCustomerFromPost()
 {
     global $_ARRAYLANG;
     $username = trim(strip_tags(contrexx_input2raw($_POST['username'])));
     $password = trim(strip_tags(contrexx_input2raw($_POST['password'])));
     $company = trim(strip_tags(contrexx_input2raw($_POST['company'])));
     $gender = trim(strip_tags(contrexx_input2raw($_POST['gender'])));
     $firstname = trim(strip_tags(contrexx_input2raw($_POST['firstname'])));
     $lastname = trim(strip_tags(contrexx_input2raw($_POST['lastname'])));
     $address = trim(strip_tags(contrexx_input2raw($_POST['address'])));
     $city = trim(strip_tags(contrexx_input2raw($_POST['city'])));
     $zip = trim(strip_tags(contrexx_input2raw($_POST['zip'])));
     $country_id = intval($_POST['country_id']);
     $phone = trim(strip_tags(contrexx_input2raw($_POST['phone'])));
     $fax = trim(strip_tags(contrexx_input2raw($_POST['fax'])));
     $email = trim(strip_tags(contrexx_input2raw($_POST['email'])));
     $companynote = trim(strip_tags(contrexx_input2raw($_POST['companynote'])));
     $customer_active = intval($_POST['active']);
     $is_reseller = intval($_POST['customer_type']);
     $customer_group_id = intval($_POST['customer_group_id']);
     //        $registerdate = trim(strip_tags(contrexx_input2raw($_POST['registerdate'])));
     $lang_id = isset($_POST['customer_lang_id']) ? intval($_POST['customer_lang_id']) : FRONTEND_LANG_ID;
     $customer_id = intval($_REQUEST['customer_id']);
     $objCustomer = Customer::getById($customer_id);
     if (!$objCustomer) {
         $objCustomer = new Customer();
     }
     $objCustomer->gender($gender);
     $objCustomer->company($company);
     $objCustomer->firstname($firstname);
     $objCustomer->lastname($lastname);
     $objCustomer->address($address);
     $objCustomer->city($city);
     $objCustomer->zip($zip);
     $objCustomer->country_id($country_id);
     $objCustomer->phone($phone);
     $objCustomer->fax($fax);
     $objCustomer->email($email);
     $objCustomer->companynote($companynote);
     $objCustomer->active($customer_active);
     $objCustomer->is_reseller($is_reseller);
     // Set automatically: $objCustomer->setRegisterDate($registerdate);
     $objCustomer->group_id($customer_group_id);
     $objCustomer->username($username);
     if (isset($_POST['sendlogindata']) && $password == '') {
         $password = \User::make_password();
     }
     if ($password != '') {
         $objCustomer->password($password);
     }
     $objCustomer->setFrontendLanguage($lang_id);
     if (!$objCustomer->store()) {
         foreach ($objCustomer->error_msg as $message) {
             \Message::error($message);
         }
         return null;
     }
     \Message::ok($_ARRAYLANG['TXT_DATA_RECORD_UPDATED_SUCCESSFUL']);
     if (isset($_POST['sendlogindata'])) {
         // TODO: Use a common sendLogin() method
         $lang_id = $objCustomer->getFrontendLanguage();
         $arrSubs = $objCustomer->getSubstitutionArray();
         $arrSubs['CUSTOMER_LOGIN'] = array(0 => array('CUSTOMER_USERNAME' => $username, 'CUSTOMER_PASSWORD' => $password));
         //DBG::log("Subs: ".var_export($arrSubs, true));
         // Select template for sending login data
         $arrMailTemplate = array('key' => 'customer_login', 'section' => 'Shop', 'lang_id' => $lang_id, 'to' => $email, 'substitution' => $arrSubs);
         if (!\Cx\Core\MailTemplate\Controller\MailTemplate::send($arrMailTemplate)) {
             \Message::warning($_ARRAYLANG['TXT_MESSAGE_SEND_ERROR']);
             return $objCustomer->id();
         }
         \Message::ok(sprintf($_ARRAYLANG['TXT_EMAIL_SEND_SUCCESSFULLY'], $email));
     }
     return $objCustomer->id();
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:83,代码来源:ShopManager.class.php


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