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


PHP Customer::load方法代码示例

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


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

示例1: index

 public function index()
 {
     $data = array();
     $this->load->model('customer');
     $customer = new Customer();
     $customer->load(1);
     $data['customer'] = $customer;
     $this->load->model('fault');
     $fault = new Fault();
     $fault->load(1);
     $data['fault'] = $fault;
     $this->load->view('fault', $data);
 }
开发者ID:loyalcomps,项目名称:faultgate,代码行数:13,代码来源:Faults.php

示例2: onCheckSales

 /**
  * Show customer data and sales
  */
 public function onCheckSales()
 {
     try {
         $data = $this->form->getData();
         // get form data
         $this->form->setData($data);
         // keep the form filled
         // load the html template
         $html = new THtmlRenderer('app/resources/customer_status.html');
         // load CSS styles
         parent::include_css('app/resources/styles.css');
         TTransaction::open('samples');
         $customer = new Customer();
         // load customer identified in the form
         $object = $customer->load($data->customer_id);
         if ($object) {
             // create one array with the customer data
             $array_object = $object->toArray();
             $array_object['city_name'] = $object->city_name;
             $array_object['category_name'] = $object->category_name;
             // replace variables from the main section with the object data
             $html->enableSection('main', $array_object);
             $replaces = array();
             $sales = $object->getSales();
             if ($sales) {
                 $total = 0;
                 // iterate the customer sales
                 foreach ($sales as $sale) {
                     // foreach sale item
                     foreach ($sale->getSaleItems() as $item) {
                         // define the multidimensional array with the sale items
                         $replaces[] = array('date' => $sale->date, 'product_id' => $item->product_id, 'product_description' => $item->product->description, 'sale_price' => number_format($item->sale_price, 2), 'amount' => $item->amount, 'discount' => $item->discount, 'total' => number_format($item->total, 2));
                         $total += $item->total;
                     }
                 }
                 $totals['total'] = number_format($total, 2);
                 // replace sale items and totals
                 $html->enableSection('sale-details', $replaces, TRUE);
                 $html->enableSection('sale-totals', $totals);
             }
         } else {
             throw new Exception('Customer not found');
         }
         TTransaction::close();
         parent::add($html);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:52,代码来源:CustomerStatusView.class.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open('samples');
         // open transaction
         $objeto = new Customer();
         // instantiates customer
         $customer = $objeto->load(31);
         // load customer 31
         if ($customer) {
             $customer->phone = '51 8111-3333';
             // changes phone
             $customer->store();
             // store the object
         }
         new TMessage('info', 'Objeto atualizado');
         TTransaction::close();
         // close the transaction
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:23,代码来源:ObjectUpdate.php

示例4: header

<?php

session_start();
if (isset($_SESSION['CustomerID']) == false) {
    header("Location:index.php");
    exit;
}
require_once "includes/header.php";
require_once "includes/customer.php";
require_once "includes/view.php";
$iCustomerID = 1;
if (isset($_GET["CustomerID"])) {
    $iCustomerID = $_GET["CustomerID"];
}
$oCustomer = new Customer();
$iCustomerID = $_SESSION["CustomerID"];
$oCustomer->load($iCustomerID);
echo View::renderCustomer($oCustomer);
?>
<a href="edit_details.php?CustomerID=<?php 
echo $iCustomerID;
?>
">+Edit Details</a>

<?php 
require_once "includes/footer.php";
?>

开发者ID:wasim01,项目名称:theRecordBreakers,代码行数:27,代码来源:my_account.php

示例5: get_class

try {
    $load_account5 = Customer::load('B2345');
    $user_name = $load_account5->generate_username($load_account5->customer_type_id, 29);
    echo 'Username for ' . get_class($load_account5) . ' with customer ID: B2345' . $user_name;
} catch (Exception $e) {
    echo 'Exception generating username: ' . $e->getMessage();
}
echo "<h2>Generating a unique valid username for new silver customer given the customer ID: S5678</h2>";
try {
    $load_account6 = Customer::load('S5678');
    $user_name2 = $load_account6->generate_username($load_account6->customer_type_id, 29);
    echo 'Username for ' . get_class($load_account6) . ' with customer ID: S5678' . $user_name2;
} catch (Exception $e) {
    echo 'Exception generating username: ' . $e->getMessage();
}
echo "<h2>Generating a unique valid username for new gold  customer given the customer ID: G1234</h2>";
try {
    $load_account7 = Customer::load('G1234');
    $user_name3 = $load_account6->generate_username($load_account7->customer_type_id, 29);
    echo 'Username for ' . get_class($load_account7) . ' with customer ID: G1234' . $user_name3;
} catch (Exception $e) {
    echo 'Exception generating username: ' . $e->getMessage();
}
echo "<h2>Throwing exception generating username for invalid customer ID: A9876</h2>";
try {
    $load_account8 = Customer::load('A9876');
    $user_name4 = $load_account6->generate_username($load_account8->customer_type_id, 29);
    echo 'Username for ' . get_class($load_account8) . ' with customer ID: A9876' . $user_name4;
} catch (Exception $e) {
    echo 'Exception generating username: ' . $e->getMessage();
}
开发者ID:bheeshmaa,项目名称:tabcorp-php-software-assessment,代码行数:31,代码来源:question_2.php

示例6: header

<?php

ob_start();
require_once "includes/header.php";
require_once "includes/form.php";
require_once "includes/customer.php";
session_start();
if (isset($_SESSION['CustomerID']) == false) {
    header("Location:index.php");
    exit;
}
$iCurrentID = $_SESSION['CustomerID'];
$oExistingCustomer = new Customer();
$oExistingCustomer->load($iCurrentID);
$aExistingData = [];
$aExistingData["Name"] = $oExistingCustomer->Name;
$aExistingData["Address"] = $oExistingCustomer->Address;
$aExistingData["Phone"] = $oExistingCustomer->Phone;
$aExistingData["Email"] = $oExistingCustomer->Email;
$oForm = new Form();
$oForm->data = $aExistingData;
if (isset($_POST["submit"]) == true) {
    $oForm->data = $_POST;
    $oForm->checkRequired("Name");
    $oForm->checkRequired("Address");
    $oForm->checkRequired("Phone");
    $oForm->checkRequired("Email");
    if ($oForm->valid == true) {
        $oExistingCustomer->Name = $_POST["Name"];
        $oExistingCustomer->Address = $_POST["Address"];
        $oExistingCustomer->Phone = $_POST["Phone"];
开发者ID:wasim01,项目名称:theRecordBreakers,代码行数:31,代码来源:edit_details.php


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