本文整理匯總了PHP中models\User::getFirstName方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getFirstName方法的具體用法?PHP User::getFirstName怎麽用?PHP User::getFirstName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::getFirstName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: registerUser
public static function registerUser(User $user)
{
$db = Database::getInstance();
$query = $db->prepare('INSERT INTO users (firstname, lastname, username, password, email) VALUES (?, ?, ?, ?, ?)');
$query->execute([$user->getFirstName(), $user->getLastName(), $user->getUsername(), $user->getPassword(), $user->getEmail()]);
$affected = $query->rowCount();
if ($affected == 1) {
redirect(\route\Route::get("index")->generate());
} else {
?>
<script>
document.getElementById("failedRegister").innerHTML =
"User already exists.";
</script>
<?php
}
}
示例2: finalize
private function finalize()
{
$user = new User(\Lib\Session::get('id'));
$name = $user->getFirstName();
$surname = $user->getSurname();
$country = $user->getCountry();
$zipcode = $user->getZipCode();
$city = $user->getCity();
$street = $user->getStreet();
$house = $user->getHousNr();
$appartment = $user->getAppartmentNr();
$order_details = new Order_details();
$order_details->setAddress('Imie: ' . $user->getFirstName() . ' Nazwisko: ' . $user->getSurname() . ' Kraj: ' . $user->getCountry() . ' Kod-Pocztowy: ' . $user->getZipCode() . ' Miasto: ' . $user->getCity() . ' Ulica : ' . $user->getStreet() . ' Nr domu: ' . $user->getHousNr() . ' Nr mieszkania: ' . $user->getAppartmentNr());
$time = time();
$id = \Lib\Session::get('id');
$rand = rand(1, 100);
$nr = $id . $time . $rand;
$order_details->setOrderNr($nr);
$order_details->setDisplaySeller(true);
$order_details->setDisplayUser(true);
$sm = $this->http->get('shipping_method');
if (empty($sm)) {
Location::To(URL . 'cart/show');
}
$order_details->setShippingMethodId($sm);
$order_details->setDate();
$order_details->setStatus(1);
$cart = \Lib\Session::get('cart');
if (!empty($cart)) {
$db = Register::get('db');
$db->query('START TRANSACTION');
$id = $order_details->writeData();
foreach ($cart as $product) {
$order = new Order($product['order_id']);
$order->setActive(1);
$order->setOrderDetailsId($id);
$order->writeData(true);
if (!$order->writeData(true)) {
$db->query('ROLLBACK');
return false;
}
}
if ($id) {
$db->query('COMMIT');
} else {
$db->query('ROLLBACK');
return false;
}
$mess = $this->http->get('message');
if (!empty($mess)) {
$mesage = new Message();
$mesage->setUserId(\lib\Register::get('id'));
$mesage->setReaded(false);
$mesage->setSeller(false);
$mesage->setMessage($order_details->getOrderNr() . ': ' . $this->http->get('message'));
$mesage->setDate();
$mesage->setDisplayUser(true);
$mesage->setDisplaySeller(true);
$mesage->writeData();
}
\Lib\Session::delete('cart');
$this->ActNumberOfProducts();
return true;
}
}