本文整理汇总了PHP中Customer::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::get方法的具体用法?PHP Customer::get怎么用?PHP Customer::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCustomer
function updateCustomer($id)
{
if (is_null($id)) {
Functions::setResponse(400);
}
$data = Functions::getJSONData();
try {
$c = new Customer($id);
$oldnick = $c->get('nickname');
$oldemail = $c->get('email');
$passwordUpdate = Functions::get('updatePassword');
foreach ($c->getFields() as $field) {
$value = Functions::elt($data, $field['name']);
if (is_null($value)) {
Functions::setResponse(400);
}
if ($field['name'] != 'password' || !is_null($passwordUpdate)) {
$c->set($field['name'], $value);
}
}
$c->set('id', $id);
if (!is_null($passwordUpdate)) {
$c->set('password', Functions::hash($c->get('password')));
}
if (!testUniqueness($c->get('nickname'), $c->get('email'), $oldnick, $oldemail)) {
Functions::setResponse(409);
}
$c->save();
return true;
} catch (RuntimeException $e) {
Functions::setResponse(404);
}
}
示例2: action_edit_customer
public function action_edit_customer()
{
$customer_id = $this->request->param('options');
$customer_model = new Customer($customer_id);
xml::to_XML(array('customer' => $customer_model->get()), $this->xml_content, NULL, 'id');
if (count($_POST)) {
$post = new Validation($_POST);
$post->filter('trim');
if ($post->validate()) {
$customer_model->set($post->as_array());
$this->add_message('Customer "' . $post->get('name') . '" updated');
}
}
$this->set_formdata($customer_model->get());
}
示例3: saveItem
/**
* (non-PHPdoc)
* @see DetailsPageAbstract::saveItem()
*/
public function saveItem($sender, $param)
{
$results = $errors = array();
try {
Dao::beginTransaction();
$task = null;
if (isset($param->CallbackParameter->id) && !($task = Task::get(trim($param->CallbackParameter->id))) instanceof Task) {
throw new Exception('Invalid Task passed in!');
}
if (!isset($param->CallbackParameter->instructions) || ($instructions = trim($param->CallbackParameter->instructions)) === '') {
throw new Exception('Instructions are required!');
}
if (!isset($param->CallbackParameter->customerId) || !($customer = Customer::get(trim($param->CallbackParameter->customerId))) instanceof Customer) {
throw new Exception('Invalid Customer Passed in!');
}
$tech = isset($param->CallbackParameter->techId) ? UserAccount::get(trim($param->CallbackParameter->techId)) : null;
$order = isset($param->CallbackParameter->orderId) ? Order::get(trim($param->CallbackParameter->orderId)) : null;
$dueDate = new UDate(trim($param->CallbackParameter->dueDate));
$status = isset($param->CallbackParameter->statusId) ? TaskStatus::get(trim($param->CallbackParameter->statusId)) : null;
if (!$task instanceof Task) {
$task = Task::create($customer, $dueDate, $instructions, $tech, $order);
} else {
$task->setCustomer($customer)->setDueDate($dueDate)->setInstructions($instructions)->setTechnician($tech)->setFromEntityId($order instanceof Order ? $order->getId() : '')->setFromEntityName($order instanceof Order ? get_class($order) : '')->setStatus($status)->save();
}
// $results['url'] = '/task/' . $task->getId() . '.html?' . $_SERVER['QUERY_STRING'];
$results['item'] = $task->getJson();
Dao::commitTransaction();
} catch (Exception $ex) {
Dao::rollbackTransaction();
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
示例4: get
public function get($customerId = null, $carId = null)
{
$sql = "SELECT * FROM {$this->tableName} WHERE 1=1";
if (!empty($customerId)) {
$sql .= " AND `owner` = " . $this->db->escape($customerId);
}
if (!empty($carId)) {
$sql .= " AND `id` = " . $this->db->escape($carId);
}
$result = array();
$service = new Service();
if (!empty($carId)) {
$result = $this->db->fetchOne($sql);
$customer = new Customer(false);
$owner = $customer->get($result['owner']);
if (!empty($owner)) {
$result['owner'] = $owner;
}
$result['services'] = $service->getForCar($carId);
} else {
$result = $this->db->fetchAll($sql);
$customer = new Customer(false);
foreach ($result as $index => $car) {
$owner = $customer->get($car['owner']);
if (!empty($owner)) {
$result[$index]['owner'] = $owner;
}
$result[$index]['services'] = $service->getForCar($car['id']);
}
}
new Respond($result);
}
示例5: index
/**
* Display a listing of the resource.
* GET /customers
*
* @return Response
*/
public function index()
{
// $relations = ['contactInfo', 'secretary', 'representatives'];
// Can't paginate and eager load at same time
$countrow = Customer::get()->count();
$customers = Customer::paginate($countrow);
return View::make('customers.index', compact('customers'));
}
示例6: _getEndJs
/**
* Getting The end javascript
*
* @return string
*/
protected function _getEndJs()
{
$js = parent::_getEndJs();
if (isset($_REQUEST['poid']) && ($po = PurchaseOrder::get(trim($_REQUEST['poid']))) instanceof PurchaseOrder) {
$js .= "pageJs.loadPO( " . json_encode($po->getJson(array(), false, true)) . " );";
}
$customer = isset($_REQUEST['customerid']) && ($customer = Customer::get(trim($_REQUEST['customerid']))) instanceof Customer ? $customer->getJson() : null;
return $js;
}
示例7: checkRights
public static function checkRights($page, $action, $token)
{
loadClass('status');
loadClass('token');
loadClass('action');
loadClass('right');
loadClass('customer');
if (is_null($action)) {
Functions::setResponse(400);
}
$pagename = str_replace('.php', '', basename($page));
$actionName = $pagename . '-' . $action;
$whereClause = 'name=:name';
$params = array(array('id' => ':name', 'value' => $actionName));
$result = Action::search($whereClause, $params);
if (!count($result)) {
echo 'Please update actions and rights!';
Functions::setResponse(500);
}
$action = $result[0];
define('LOGGED_OUT_STATUS', 'standard');
$loggedOut = false;
if (is_null($token) || strtolower($token) == 'none') {
$loggedOut = true;
} else {
$whereClause = 'value=:value';
$params = array(array('id' => ':value', 'value' => $token));
$result = Token::search($whereClause, $params);
if (!count($result)) {
Functions::setResponse(498);
} else {
$token = $result[0];
$customer = new Customer($token->get('customerId'));
$status = new Status($customer->get('statusId'));
}
}
if ($loggedOut) {
$whereClause = 'name=:name';
$params = array(array('id' => ':name', 'value' => LOGGED_OUT_STATUS));
$result = Status::search($whereClause, $params);
if (!count($result)) {
Functions::setResponse(500);
}
$status = $result[0];
}
$whereClause = 'action_id=:action_id AND status_id=:status_id';
$params = array(array('id' => ':action_id', 'value' => $action->get('id')), array('id' => ':status_id', 'value' => $status->get('id')));
$result = Right::search($whereClause, $params);
if (!count($result)) {
Functions::setResponse(401);
}
if ($result[0]->get('right') == 'deny') {
Functions::setResponse(401);
}
}
示例8: new_bill
/**
* Add a bill
*
* @param int $customer_id
* @param num $due_date (UNIX timestamp)
* @param str $contact - Their reference
* @param arr $items - array(
array(
'artnr' => '239D',
'spec' => 'What to bill for',
'price' => 700,
'qty' => 2,
'delivery_date' => '2011-01-01'
),
etc
)
* @param str $comment - Optional
*/
public static function new_bill($customer_id, $due_date, $contact, $items, $comment = '', $template = 'default', $mail_body = '')
{
$pdo = Kohana_pdo::instance();
if (self::$prepared_insert == NULL) {
self::$prepared_insert = $pdo->prepare('INSERT INTO bills (due_date,customer_id,customer_name,customer_orgnr,customer_contact,customer_tel,customer_email,customer_street,customer_zip,customer_city,comment,contact,template,mail_body) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
self::$prepared_item_insert = $pdo->prepare('INSERT INTO bills_items (item_id,bill_id,artnr,spec,qty,price,delivery_date) VALUES(?,?,?,?,?,?,?)');
}
$customer_model = new Customer($customer_id);
self::$prepared_insert->execute(array(date('Y-m-d', $due_date), intval($customer_id), $customer_model->get('name'), $customer_model->get('orgnr'), $customer_model->get('contact'), $customer_model->get('tel'), $customer_model->get('email'), $customer_model->get('street'), $customer_model->get('zip'), $customer_model->get('city'), $comment, $contact, $template, $mail_body));
$bill_id = $pdo->lastInsertId();
foreach ($items as $nr => $item) {
self::$prepared_item_insert->execute(array($nr + 1, $bill_id, $item['artnr'], $item['spec'], $item['qty'], $item['price'], date('Y-m-d', time())));
}
return $bill_id;
}
示例9: verify
public function verify(SS_HTTPRequest $request)
{
$token = $request->param('Token');
/** @var CryptofierImplementation $crypto */
$crypto = Injector::inst()->get('CryptofierService');
if ($email = $crypto->decrypt_friendly($token)) {
/** @var Customer $member */
if ($member = Customer::get()->filter('Email', $email)->first()) {
$member->{ProfiledMemberExtension::VerificationDateName} = date('Y-m-d H:i:s');
$member->write();
ProfiledMemberForm::set_form_message(ProfiledMemberForm::get_form_message('VerificationOK'), 'Your account has been activated', CrackerjackForm::Good);
return $this()->redirect(CrackerjackModule::get_config_setting(null, 'post_verify_url'));
}
}
ProfiledMemberForm::set_form_message('VerificationFail', 'bad');
return $this()->redirectBack();
}
示例10: _preGetEndJs
/**
* (non-PHPdoc)
* @see BPCPageAbstract::_preGetEndJs()
*/
protected function _preGetEndJs()
{
parent::_preGetEndJs();
$order = $tech = $customer = null;
if (isset($_REQUEST['customerId']) && !($customer = Customer::get(trim($_REQUEST['customerId']))) instanceof Customer) {
die('Invalid Customer provided!');
}
if (isset($_REQUEST['orderId']) && !($order = Order::get(trim($_REQUEST['orderId']))) instanceof Order) {
die('Invalid Order provided!');
}
if (isset($_REQUEST['techId']) && !($tech = UserAccount::get(trim($_REQUEST['techId']))) instanceof UserAccount) {
die('Invalid Technician provided!');
}
$statusIds = array();
if (isset($_REQUEST['statusIds']) && ($statusIds = trim($_REQUEST['statusIds'])) !== '') {
$statusIds = array_map(create_function('$a', 'return intval(trim($a));'), explode(',', $statusIds));
}
$allstatuses = isset($_REQUEST['allstatuses']) && intval(trim($_REQUEST['allstatuses'])) === 1;
$preSetData = array('statuses' => array(), 'order' => $order instanceof Order ? $order->getJson() : array(), 'technician' => $tech instanceof UserAccount ? $tech->getJson() : array(), 'customer' => $customer instanceof Customer ? $customer->getJson() : array(), 'meId' => Core::getUser()->getId(), 'noDueDateStatusIds' => array());
$statuses = array();
foreach (TaskStatus::getAll() as $status) {
$statuses[] = $statusJson = $status->getJson();
if (($noDueDateChecking = in_array(intval($status->getId()), TaskStatus::getClosedStatusIds())) === true) {
$preSetData['noDueDateStatusIds'][] = $status->getId();
}
if (count($statusIds) > 0) {
if (in_array(intval($status->getId()), $statusIds)) {
$preSetData['statuses'][] = $statusJson;
}
} else {
if ($allstatuses === false && !$noDueDateChecking) {
$preSetData['statuses'][] = $statusJson;
}
}
}
if (count($statusIds) > 0 && count($preSetData['statuses']) === 0) {
die('Invalide Task Status provided.');
}
$js = "pageJs";
$js .= ".setOpenInFancyBox(" . (isset($_REQUEST['blanklayout']) && intval(trim($_REQUEST['blanklayout'])) === 1 && (isset($_REQUEST['nosearch']) && intval($_REQUEST['nosearch']) === 1) ? 'false' : 'true') . ")";
$js .= ".setStatuses(" . json_encode($statuses) . ")";
$js .= ".setPreSetData(" . json_encode($preSetData) . ")";
$js .= ";";
return $js;
}
示例11: getCMSFields
/**
* getCMSFields
* Construct the FieldList used in the CMS. To provide a
* smarter UI we don't use the scaffolding provided by
* parent::getCMSFields.
*
* @return FieldList
*/
public function getCMSFields()
{
Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
$customer = $this->Customer();
$fields = FieldList::create(Tabset::create("Root", Tabset::create("Order", Tab::create("CustomerDetails", HeaderField::create("Customer Selection"), CompositeField::create(DropdownField::create("CustomerID", $this->exists() ? "Customer" : "Select a Customer", Customer::get()->sort(array('Surname' => 'ASC', 'FirstName' => 'ASC'))->map())->setEmptyString("(Select a Customer)")->setRightTitle($this->exists() ? "To change the customer against this order select the new customer above (when editing from the\n\t\t\t\t\t\t\t\t'Store Orders' screen) and click save." : "Which customer is this order for?")), $this->exists() ? HeaderField::create("Customer Details") : null, $this->exists() ? CompositeField::create(ReadonlyField::create("Customer.FirstName", "First Name", $customer->FirstName), ReadonlyField::create("Customer.Surname", "Surname", $customer->Surname), ReadonlyField::create("Customer.CompanyName", "Company", $customer->CompanyName), ReadonlyField::create("Customer.Landline", "Landline Number", $customer->LandlineNumber), ReadonlyField::create("Customer.Mobile", "Mobile Number", $customer->MobileNumber)) : ""), Tab::create("OrderDetails", HeaderField::create("Order Details"), CompositeField::create(DropdownField::create("Status", "Order Status", Order_Statuses::get()->map()), DropdownField::create("BillingAddressID", "Billing Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' billing address.")->setEmptyString("(Select one)"), DropdownField::create("ShippingAddressID", "Shipping Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' shipping address.")->setEmptyString("(Select one)")), HeaderField::create("Order Items (Basket)"), CompositeField::create($items = GridField::create("OrderItems", "", $this->Order_Items(), GridFieldConfig_RecordEditor::create()), ReadonlyField::create("SubTotal", "Basket Total (" . Product::getDefaultCurrency() . ")", $this->calculateSubTotal())), HeaderField::create("Shipping"), CompositeField::create(FieldGroup::create(DropdownField::create("Courier", "Courier", $this->getCouriers($this->ID))->setRightTitle("Which courier is being used for this order?")->setEmptyString("(Select one)"), Textfield::create("TrackingNo", "Tracking Number (Optional)")->setRightTitle("If the shipment has a tracking number, enter it here.")), ReadonlyField::create("Shipping", "Shipping Total (" . Product::getDefaultCurrency() . ")", $this->calculateShippingTotal())), HeaderField::create("Order Totals"), CompositeField::create(FieldGroup::create("Tax (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("ProductTaxInclusive", "Product Tax (Inclusive)", $this->calculateProductTax(1))->setRightTitle("Basket total is inclusive of this tax."), ReadonlyField::create("ProductTaxExclusive", "Product Tax (Exclusive)", $this->calculateProductTax(2))->setRightTitle("Basket total is exclusive of this tax."), ReadonlyField::create("ShippingTax", "Shipping Tax", $this->calculateShippingTax($this->calculateShippingTotal()))->setRightTitle(StoreSettings::get_settings()->TaxSettings_ShippingInclusiveExclusive == 1 ? "Shipping price is inclusive of this tax." : "Shipping price is exclusive of this tax.")), FieldGroup::create("Final Totals (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("Total", "Final Total", $this->calculateOrderTotal()), ReadonlyField::create("TotalPayments", "Total Payments", $this->calculatePaymentTotal()), ReadonlyField::create("OutstandingBalance", "Outstanding Balance", $this->calculateRemainingBalance()))), HeaderField::create("Payments"), CompositeField::create($items = GridField::create("OrderPayments", "", $this->Order_Payment(), GridFieldConfig_RecordEditor::create()))), Tab::create("OrderComments", HeaderField::create("Order Comments"), CompositeField::create(ReadonlyField::create("CustomerComments", "Customer Comments")->setRightTitle("These are the comments of this customer."), TextareaField::create("AdminComments", "Admin Comments")->setRightTitle("Only store admins can see these comments"))), Tab::create("OrderEmails", HeaderField::create("Order Emails"), CompositeField::create($items = GridField::create("Order_Emails", "", $this->Order_Emails(), GridFieldConfig_RecordViewer::create()))))));
//If record doesn't exist yet, hide certain tabs.
!$this->exists() ? $fields->RemoveFieldsFromTab("Root.Order", array("OrderDetails", "OrderComments", "OrderEmails")) : null;
/*
* If record exists, and order is unpaid show warning message to prevent shipment of unpaid orders.
* Otherwise show a success message.
*/
if ($this->exists() && $this->calculateRemainingBalance() > 0) {
$alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message error\">\n\t\t\t\t\t\t<strong>ORDER REMAINS UNPAID</strong> - This order has an outstanding balance of " . Product::getDefaultCurrency() . $this->calculateRemainingBalance() . ". If the customer has paid then the\n\t\t\t\t\t\t payment gateway may not have provided a payment status yet.\n\t\t\t\t\t</div>\n\t\t\t\t</div>");
$fields->addFieldToTab("Root.Order", $alert, "Status");
} elseif ($this->exists() && $this->calculateRemainingBalance() == 0) {
$alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message good\">\n\t\t\t\t\t\t<strong>BALANCE PAID</strong> - This balance of this order has been paid. You may now prepare and \n\t\t\t\t\t\tdispatch the order items below.\n\t\t\t\t\t</div> \n\t\t\t\t</div>");
$fields->addFieldToTab("Root.Order", $alert, "Status");
}
return $fields;
}
示例12: Cartdetail
function list_by_parent($id, $customer_id)
{
$cartdetails = new Cartdetail();
$cartdetails->order_by('id', 'desc');
$cartdetails->where('cart_id', $id);
$cartdetails->get();
$customers = new Customer($customer_id);
$customers->order_by('id', 'asc');
$customers->where('id', $customer_id);
$customers->get();
$dis['base_url'] = base_url();
$dis['view'] = "cartdetail/listbyparent";
$dis['menu_active'] = 'Giỏ hàng';
$dis['title'] = "Chi tiết giỏ hàng";
$dis['title_customer'] = "Thông tin khách hàng";
$dis['cartdetails'] = $cartdetails;
$dis['customers'] = $customers;
$dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => "{$this->admin_url}carts/list_all/", "onclick" => ""));
$this->viewadmin($dis);
}
示例13: _preGetEndJs
/**
* (non-PHPdoc)
* @see BPCPageAbstract::_preGetEndJs()
*/
protected function _preGetEndJs()
{
// parent::_preGetEndJs();
$order = $task = $customer = null;
if (isset($_REQUEST['customerId']) && !($customer = Customer::get(trim($_REQUEST['customerId']))) instanceof Customer) {
die('Invalid Customer provided!');
}
if (isset($_REQUEST['taskId']) && !($task = Task::get(trim($_REQUEST['taskId']))) instanceof Task) {
die('Invalid Order provided!');
}
if (isset($_REQUEST['orderId']) && !($order = Order::get(trim($_REQUEST['orderId']))) instanceof Order) {
die('Invalid Order provided!');
}
$preSetData = array('task' => $task instanceof Task ? $task->getJson() : array(), 'order' => $order instanceof Order ? $order->getJson() : array(), 'customer' => $customer instanceof Customer ? $customer->getJson() : array());
$js = "pageJs";
$js .= ".setOpenInFancyBox(" . (isset($_REQUEST['blanklayout']) && intval(trim($_REQUEST['blanklayout'])) === 1 && (isset($_REQUEST['nosearch']) && intval($_REQUEST['nosearch']) === 1) ? 'false' : 'true') . ")";
$js .= ".setPreSetData(" . json_encode($preSetData) . ")";
$js .= ";";
return $js;
}
示例14: all_get
/**
* Customers list
* @route GET customers all
* @param type $token
*/
public function all_get($token)
{
$token_entry = new Token();
$token_entry->get_by_valid_token($token)->get();
if ($token_entry->exists()) {
$customers = new Customer();
$customers->order_by('customer_name', 'ASC');
$customers->get();
$response = array();
foreach ($customers as $customer) {
$p = new stdClass();
$p->id = $customer->id;
$p->customer_name = $customer->customer_name;
array_push($response, $p);
}
$this->response($response);
} else {
$response = new stdClass();
$response->status = false;
$response->error = 'Token not found or session expired';
$this->response($response);
}
}
示例15: fix
function fix($bill_id)
{
$products = $this->getByBillId($bill_id);
$product = new Product();
$price = new Price();
$tax = new Tax();
$bill = new Bill();
$tmp = $bill->get($bill_id);
$bill_data = $tmp[0];
$customer = new Customer();
$tmp = $customer->get($bill_data[1]);
$customer_data = $tmp[0];
for ($i = 0; $i < count($products); $i++) {
$tmp = $this->getByBillIdAndProductId($bill_id, $products[$i][2]);
$bill_product_data = $tmp[0];
$tmp = $product->get($products[$i][2]);
$product_data = $tmp[0];
$tmp = $price->getPrice($customer_data[11], $product_data[0]);
$price_data = $tmp[0];
$tmp = $tax->get($product_data[4]);
$tax_data = $tmp[0];
$this->update($bill_product_data[0], array($bill_product_data[1], $bill_product_data[2], $bill_product_data[3], $bill_product_data[4], $bill_product_data[5], $price_data[3], $tax_data[2]));
}
}