本文整理匯總了PHP中customer::fill方法的典型用法代碼示例。如果您正苦於以下問題:PHP customer::fill方法的具體用法?PHP customer::fill怎麽用?PHP customer::fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類customer
的用法示例。
在下文中一共展示了customer::fill方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: customer
?>
<h1><?php
echo $lang['common_customers'];
?>
</h1>
<?php
$customerInst = new customer();
#######################################################################
## perform action
$status = 1;
if (tool::securePost('action') == "save" && tool::securePost('id')) {
# fill customer with submitted data
$customerInst->id = tool::securePost('id');
$customerInst->fill(tool::securePostAll());
$status = $customerInst->update();
} elseif (tool::securePost('action') == "save") {
$customerInst->fill(tool::securePostAll());
$status = $customerInst->insert();
}
if (tool::securePost('action') == "delete") {
$customerInst->id = tool::securePost('id');
$customerInst->delete();
}
if (tool::securePost('action') == "edit") {
$status = 0;
$customerInst->activate(tool::securePost('id'));
}
#######################################################################
## make edit / new form
示例2: save
public function save($id = 0, $name = '', $id_external = '', $billing_name1 = '', $billing_name2 = '', $billing_address = '', $billing_postcode = '', $billing_city = '', $billing_country = '', $billing_email_address = '', $billing_phone = '', $billing_fax = '', $billing_show_logo = true)
{
// Create new customer, fill and save it
if ($id != 0) {
// Create, fill and save customer
$customer = new customer($id);
$customer->fill($name, $id_external, $billing_name1, $billing_name2, $billing_address, $billing_postcode, $billing_city, $billing_country, $billing_email_address, $billing_phone, $billing_fax, $billing_show_logo);
$customer->save();
} else {
$database = $_SESSION['database'];
// Insert a new entry if one does not exist or update the existing one
if (!$this->id_exists($this->id)) {
// The entry does not exist
$database->query("insert into " . TABLE_CUSTOMERS . " (customers_id, customers_name, customers_id_external, customers_billing_name1, customers_billing_name2, customers_billing_address, customers_billing_postcode, customers_billing_city, customers_billing_country, customers_billing_email_address, customers_billing_phone, customers_billing_fax, customers_billing_show_logo) values ('" . $this->id . "', '" . $database->input($this->name) . "', '" . $database->input($this->id_external) . "', '" . $database->input($this->billing_name1) . "', '" . $database->input($this->billing_name2) . "', '" . $database->input($this->billing_address) . "', '" . $database->input($this->billing_postcode) . "', '" . $database->input($this->billing_city) . "', '" . $database->input($this->billing_country) . "', '" . $database->input($this->billing_email_address) . "', '" . $database->input($this->billing_phone) . "', '" . $database->input($this->billing_fax) . "', '" . ($this->billing_show_logo ? 1 : 0) . "')");
} else {
// The entry exists, update the contents
$activity_query = $database->query("update " . TABLE_CUSTOMERS . " set customers_id='" . $this->id . "', customers_name='" . $database->input($this->name) . "', customers_id_external='" . $database->input($this->id_external) . "', customers_billing_name1='" . $database->input($this->billing_name1) . "', customers_billing_name2='" . $database->input($this->billing_name2) . "', customers_billing_address='" . $database->input($this->billing_address) . "', customers_billing_postcode='" . $database->input($this->billing_postcode) . "', customers_billing_city='" . $database->input($this->billing_city) . "', customers_billing_country='" . $database->input($this->billing_country) . "', customers_billing_email_address='" . $database->input($this->billing_email_address) . "', customers_billing_phone='" . $database->input($this->billing_phone) . "', customers_billing_fax='" . $database->input($this->billing_fax) . "', customers_billing_show_logo='" . ($this->billing_show_logo ? 1 : 0) . "' where customers_id = '" . (int) $this->id . "'");
}
}
}