本文整理汇总了PHP中User_Model::logged_user方法的典型用法代码示例。如果您正苦于以下问题:PHP User_Model::logged_user方法的具体用法?PHP User_Model::logged_user怎么用?PHP User_Model::logged_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User_Model
的用法示例。
在下文中一共展示了User_Model::logged_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<div id="root">
<div id="header">
<h1><a href="http://<?php
echo My_Template_Controller::getCurrentSite()->url;
?>
" title="MyChocolateHearts.com - Custom Chocolate Hearts"><img src="/env/images/<?php
echo My_Template_Controller::getViewPrefix();
?>
/logo.png" alt="MyChocolateHearts.com - Custom Chocolate Hearts"/></a></h1>
<?php
if (User_Model::logged_in()) {
$user = User_Model::logged_user();
?>
<div id="login_box" class="logged">
<a class="logout" href="/customers/logout"><img src="/env/images/login/logout_btn.jpg" /></a>
Logged in as: <strong><?php
echo $user->firstname . ' ' . $user->lastname;
?>
</strong><br />
<a href="/customers/my_account" class="my-account">View My Account Details</a>
</div>
<?php
} else {
?>
<div id="login_box" class="login">
<form method="POST" action="/customers/login">
<div class="col">
<img src="/env/images/login/customer_login.jpg" /><br />
</div>
<div class="col">
<input type="text" name="email" value="Type your email." onfocus="if($(this).val()=='Type your email.') $(this).val('');" onblur="if($(this).val()=='') $(this).val('Type your email.');" /><br />
示例2: paypal_ok
public function paypal_ok()
{
$trans_id = $this->input->get('token');
// In Kohana, all views are loaded and treated as objects.
$this->template->content = new View('paypal_status');
$postvars = $_POST;
$db = new Database();
$result = $db->query('SELECT * FROM orders WHERE trans_id = \'' . $trans_id . '\'');
$order = $result[0];
$this->template->content->_order = ORM::factory('order', $order->id);
//CREATE PAYMENT
$result = $db->query('INSERT INTO payments (transaction_number, statusID, transaction_date) VALUES (\'' . $trans_id . '\', 3, ' . time() . ')');
$paymentid = mysql_insert_id();
//CREATE Order ID Entry
$_res = $db->query('SELECT id FROM order_ids WHERE order_id="' . $order->id . '"');
if (!$_res[0] || !$_res[0]->id) {
//CREATE Order ID Entry
$_res = $db->query('INSERT INTO order_ids (order_id) VALUES (' . $order->id . ')');
$new_order_id = mysql_insert_id();
} else {
$new_order_id = $_res[0]->id;
}
//UPDATE THE ORDER TABLE
$result = $db->query('UPDATE orders SET paymentID = ' . $paymentid . ', payment_method = "PayPal", statusID = 2, order_total= ' . $order->subtotal . ', shipping_total = ' . $order->shipping_total . ', order_date = \'' . date("Y-m-d H:i:s", time()) . '\', date_modified = ' . time() . ' WHERE id = ' . $order->id . '');
$result = $db->query('SELECT orders.*, users.email, user_billing_infos.firstname as billfname, user_billing_infos.lastname as billlname, user_billing_infos.address1 as billaddress, user_billing_infos.city as billcity, user_billing_infos.state as billstate, user_billing_infos.zip as billzip, user_billing_infos.country as billcountry, user_billing_infos.phone1 as billphone, user_shipping_infos.firstname as shipfname, user_shipping_infos.lastname as shiplname, user_shipping_infos.address1 as shipaddress, user_shipping_infos.city as shipcity, user_shipping_infos.state as shipstate, user_shipping_infos.zip as shipzip, user_shipping_infos.country as shipcountry FROM orders LEFT JOIN user_billing_infos ON orders.billingID = user_billing_infos.id LEFT JOIN user_shipping_infos ON orders.shippingID = user_shipping_infos.id LEFT JOIN users ON orders.user_id = users.id WHERE orders.id = ' . $order->id . '');
$order = $result[0];
$shippingInfo = $order->shipfname . ' ' . $order->shiplname . '<br/>' . $order->shipaddress . '<br/>' . $order->shipcity . ' ' . $order->shipstate . '<br/>' . $order->shipzip . '<br/>' . $order->shipcountry;
$billingInfo = $order->billfname . ' ' . $order->billlname . '<br/>' . $order->billaddress . '<br/>' . $order->billcity . ' ' . $order->billstate . '<br/>' . $order->billzip . '<br/>' . $order->billcountry;
$dateTime = date('Y-m-d H:i:s');
$res = $db->query('SELECT p.name, ob.qty, ob.subtotal, ob.id as ob_id FROM products p JOIN orders_baskets ob ON (ob.product_id=p.id) WHERE ob.order_id="' . $order->id . '"');
$description = '';
$subtotal = 0;
foreach ($res as $item) {
$basket = ORM::factory('orders_basket', $item->ob_id);
$product_name = $item->name;
if ($basket->packaging_id != 0) {
$product_name .= ' - ' . $basket->packaging->name;
}
$description .= '' . $item->qty . ' x ' . $product_name . ' = ' . money_format('%.2n', $item->subtotal) . '<br/>';
$subtotal += $item->subtotal;
}
if (!empty($order->comment)) {
$description .= 'Comment:' . $order->comment . '<br/>';
}
$total = 'Subtotal: ' . money_format('%.2n', $subtotal) . '<br/>Shipping:' . money_format('%.2n', $order->shipping_total);
$total .= '<br/>Total:' . money_format('%.2n', $order->order_total);
$emailAddr = $order->email;
$res = $db->query('SELECT id FROM order_ids WHERE order_id = ' . $order->id . '');
$orderid = $res[0]->id;
$order->id = $orderid;
$new_order_id = 'MCH' . $orderid;
$to = array($emailAddr, 'info@mychocolatecoins.com', 'freddyfalck@hotmail.com', 'info@deligance.com', 'contact@polardesign.com');
foreach ($to as $address) {
Autoresponder::sendEmail('order.status.changed', $address, $order, array('shipping_info' => $shippingInfo, 'billing_info' => $billingInfo, 'date_time' => $dateTime, 'description' => $description, 'total' => $total, 'order_id' => $new_order_id));
}
$this->template->content->status = 'Your paypal paymeny was successful!';
$this->template->content->trans_id = $trans_id;
$this->template->content->order_id = $order->id;
$user_id = FALSE;
if (User_Model::logged_in()) {
$user_id = User_Model::logged_user()->id;
}
Session::instance()->regenerate();
if ($user_id) {
ORM::factory('user')->find($user_id)->forceLogin();
}
// Meta Description and Meta Keywords for individual pages are, at this point, hard coded.
$this->template->metaDescription = $this->description;
$this->template->metaKeywords = $this->keywords;
$this->template->metaTitle = $this->title;
// You can assign anything variable to a view by using standard OOP
// methods. In my welcome view, the $title variable will be assigned
// the value I give it here.
$this->template->title = $this->title;
}
示例3: order_again
public function order_again()
{
$id = uri::segment(3);
$prevorder = ORM::factory('order', $id);
if ($prevorder->id == 0 || $prevorder->user_id != User_Model::logged_user()->id || $prevorder->site_id != self::getCurrentSite()->id) {
url::redirect('/customers/my_account');
}
$order = ORM::factory('order')->getCurrentOrder();
$_has_fee = FALSE;
foreach ($prevorder->orders_baskets as $prevorders_basket) {
//basic orders_basket
$orders_basket = $prevorders_basket->cloneThis();
$orders_basket->order_id = $order->id;
$orders_basket->save();
if ($orders_basket->second_side_fee != 0) {
$_has_fee = $orders_basket->id;
}
//orders_baskets_images
foreach ($prevorders_basket->orders_baskets_images as $prev) {
$new = $prev->cloneThis();
$new->orders_basket_id = $orders_basket->id;
$new->save();
}
//orders_baskets_texts
foreach ($prevorders_basket->orders_baskets_texts as $prev) {
$new = $prev->cloneThis();
$new->orders_basket_id = $orders_basket->id;
$new->save();
}
//orders_baskets_datas
foreach ($prevorders_basket->orders_baskets_datas as $prev) {
$new = $prev->cloneThis();
$new->orders_basket_id = $orders_basket->id;
$new->save();
}
}
if (FALSE !== $_has_fee) {
foreach ($order->orders_baskets as $orders_basket) {
if ($orders_basket->id != $_has_fee) {
$orders_basket->basket_with_fee = $_has_fee;
$orders_basket->save();
}
}
}
url::redirect('/shopping_cart');
}
示例4: register
public function register()
{
if (User_Model::logged_in()) {
url::redirect('/customers/my_account');
}
$this->template->content = new View('customers/register');
$this->template->metaDescription = $this->description;
$this->template->metaKeywords = $this->keywords;
$this->template->metaTitle = $this->title;
$this->template->title = $this->title;
$formFields = User_Model::getFormFields();
if (User_Model::logged_in()) {
$user = User_Model::logged_user();
$this->template->content->user = $user;
foreach ($formFields as $section => &$fields) {
if ($section == 'user') {
continue;
}
foreach ($fields as &$field) {
switch ($field->form) {
case 'billing':
$field->value = $user->user_billing_info->{$field->db_name};
break;
case 'shipping':
$field->value = $user->user_shipping_info->{$field->db_name};
break;
}
}
}
}
$this->template->content->formFields = $formFields;
$this->template->content->countries = ORM::factory('country')->find_all();
$this->template->content->states = ORM::factory('state')->find_all();
if (request::method() === 'post') {
$post = new Validation($_POST);
$post->add_rules('email', 'email');
$post->add_rules('password', 'required');
$post->add_rules('first_name', 'required');
$post->add_rules('last_name', 'required');
$post->add_rules('address_1', 'required');
$post->add_rules('city', 'required');
$post->add_rules('state', 'required');
$post->add_rules('zip', 'required');
$post->add_rules('country', 'required');
$post->add_rules('phone', 'required');
if ($post->validate()) {
$db = new Database();
//$auth = _Auth::factory();
$user = ORM::factory('user');
$user->email = $post->email;
$user->password = $post->password;
$user->firstname = $post->first_name;
$user->lastname = $post->last_name;
$user->company = $post->company;
$user->address1 = $post->address_1;
$user->address2 = $post->address_2;
$user->city = $post->city;
$user->state = $post->state;
$user->zip = $post->zip;
$user->country = $post->country;
$user->phone1 = $post->phone;
$user->phone2 = $post->second_phone;
$user->save();
unset($user);
$id = $db->query("SELECT id\n\t\t\t\t\t\t\t\t FROM users\n\t\t\t\t\t\t\t\t WHERE email = '{$post->email}'");
//print_r(mysql_fetch);
foreach ($id as $keys => $value) {
// echo 'Key: '. $keys."<br>";
if (is_object($value)) {
foreach ($value as $vkeys => $vvalue) {
// echo 'VKeys: '.$vkeys."<br>";
// echo 'VValue: '.$vvalue."<br>";
if ($vkeys == 'id') {
$id = $vvalue;
}
}
} else {
// echo 'Value: '.$value."<br>";
}
}
//die();
if (!$post->address_2) {
$post->address_2 = "none";
}
if (!$post->second_phone) {
$post->second_phone = "none";
}
$billing = $db->query("INSERT into user_billing_infos\n\t\t\t\t\t\t\tSET user_id = '{$id}', \n\t\t\t\t\t\t\tfirstname = '{$post->first_name}',\n\t\t\t\t\t\t\tlastname = '{$post->last_name}',\n\t\t\t\t\t\t\tcompany = '{$post->company}',\n\t\t\t\t\t\t\taddress1 = '{$post->address_1}',\n\t\t\t\t\t\t\taddress2 = '{$post->address_2}',\n\t\t\t\t\t\t\tcity = '{$post->city}',\n\t\t\t\t\t\t\tstate = '{$post->state}',\n\t\t\t\t\t\t\tzip = '{$post->zip}',\n\t\t\t\t\t\t\tcountry = '{$post->country}',\n\t\t\t\t\t\t\tphone1 = '{$post->phone}',\n\t\t\t\t\t\t\tphone2 = '{$post->second_phone}'\n\t\t\t\t\t\t\t");
//$results = $db->excute();
// $user = ORM::factory('user_billing_infos');
// $user->email = $post->email;
// $user->password = md5($post->password);
// $user->firstname = $post->first_name;
// $user->lastname = $post->last_name;
// $user->company = $post->company;
// $user->address1 = $post->address_1;
// $user->address2 = $post->address_2;
// $user->city = $post->city;
// $user->state = $post->state;
// $user->zip = $post->zip;
//.........这里部分代码省略.........
示例5: setTexts_MCB
protected function setTexts_MCB()
{
$db = new Database();
$productarray = Router::$arguments;
$productname = $productarray[0];
$post = $_POST;
$user = User_Model::logged_user();
$session = $_SESSION;
$this->description = 'Create your very own custom chocolate bars with your own text and images, or use our stock images';
$this->title = 'Custom Chocolate Hearts - MyChocolateHearts.com: Create customized chocolate bars with your own design';
$this->keywords = 'chocolate bars, custom chocolate bars, personalized chocolate bars, chocolate favors, custom chocolate favors, party favors, personalized chocolate favors, chocolate casino chips, chocolate poker chips, custom chocolate casino chips, casino party favors, wedding favors, personalized wedding favors, baby shower favors, bridal shower favors, chocolate gelt, chocolate gold hearts, chocolate party favors, chocolate candy favors, custom chocolate, custom chocolate poker chips, corporate favors';
// $this->template->content->db = $db;
// $this->template->content->productname = $productname;
// $this->template->content->post = $post;
// $this->template->content->user = $user;
// $this->template->content->session = $session;
$temp = ORM::factory('temp_orders');
if ($post->conf_type = 'bar') {
$base = new \Imagick($post->base);
$layout = new \Imagick($post->layer);
$img = $post->base;
$size = getimagesize($img);
// $h = ($size[0])/3;
// $w = ($size[1])/3;
$h = 100;
$w = 100;
$layout->resizeImage($w, $h, Imagick::FILTER_LANCZOS, 1);
$base->compositeImage($layout, Imagick::COMPOSITE_OVERLAY, 100, 30);
$bar = $base->writeImage("/var/www/mch/env/html5_configurator/img/design/output.png");
$temp->sessionID = $session->session_id;
$temp->productID = $post->productsid;
$temp->flavorID = $post->bar_type;
$temp->foilID = 9;
$temp->order_msg_text1 = $post->line_one;
$temp->order_msg_text2 = $post->line_two;
$temp->order_msg_text3 = $post->line_three;
$temp->order_msg_text4 = $post->line_four;
$temp->order_msg_font1 = $post->line_one_font;
$temp->order_msg_font2 = $post->line_two_font;
$temp->order_msg_font3 = $post->line_three_font;
$temp->order_msg_font4 = $post->line_four_font;
$temp->order_msg_size1 = $post->line_one_size;
$temp->order_msg_size2 = $post->line_two_size;
$temp->order_msg_size3 = $post->line_three_size;
$temp->order_msg_size4 = $post->line_four_size;
$temp->styleID = 1;
$temp->order_clip_path = $post->layer_top;
$temp->order_bg_path = null;
$temp->order_design_path = $bar;
$temp->order_qty = 200;
$temp->order_rate = 1;
$temp->order_total = 200 * 1;
$temp->added = 0;
$temp->cust_type = $post->conf_type;
header("Location:/products/wrapper/{$productname}");
}
if ($post->conf_type = 'wrapper') {
$layout = new \Imagick($post->layer_top);
$wrapperbase = new \Imagick($post->base);
$mask = new \Imagick("/var/www/mch/env/images/mcb/wrapper.png");
$temp = $post->base;
$i = sizeof($wrapper);
$wrapper = substr($temp, 3, $i - 1);
$wsize = getimagesize($wrapper);
//print_r($size);
// $h = ($size[0])/3;
// $w = ($size[1])/3;
$h = 100;
$w = 100;
$layout->resizeImage($w, $h, Imagick::FILTER_LANCZOS, 1);
$wrapperbase->resizeImage(1020, 210, Imagick::INTERPOLATE_BICUBIC, 1);
$mask->compositeImage($layout, Imagick::COMPOSITE_OVERLAY, 70, 50);
$wrapperbase->compositeImage($mask, Imagick::COMPOSITE_OVERLAY, 400, 0);
$wrapperbase->writeImage("/var/www/mch/env/html5_configurator/img/design/output2.png");
$temp->sessionID = $session->session_id;
$temp->productID = $post->productsid;
$temp->flavorID = null;
$temp->foilID = 9;
$temp->order_msg_text1 = $post->line_one;
$temp->order_msg_text2 = $post->line_two;
$temp->order_msg_text3 = $post->line_three;
$temp->order_msg_text4 = $post->line_four;
$temp->order_msg_font1 = $post->line_one_font;
$temp->order_msg_font2 = $post->line_two_font;
$temp->order_msg_font3 = $post->line_three_font;
$temp->order_msg_font4 = $post->line_four_font;
$temp->order_msg_size1 = $post->line_one_size;
$temp->order_msg_size2 = $post->line_two_size;
$temp->order_msg_size3 = $post->line_three_size;
$temp->order_msg_size4 = $post->line_four_size;
$temp->styleID = 1;
$temp->order_clip_path = $post->layer_top;
$temp->order_bg_path = $post->wrapper;
$temp->order_design_path = $wrapperbase;
$temp->order_qty = 200;
$temp->order_rate = 1;
$temp->order_total = 200 * 1;
$temp->added = 0;
$temp->cust_type = $post->conf_type;
header("Location:/shopping_cart");
//.........这里部分代码省略.........
示例6: wrapper_MCB
protected function wrapper_MCB($_product)
{
$db = new Database();
$this->template->content = new View('wrapper_builder_mcb');
$productarray = Router::$arguments;
$productname = $productarray[0];
$products = $db->query('SELECT products_descriptions.*, products.* FROM products_descriptions LEFT JOIN products ON products_descriptions.id = products.products_description_id WHERE products_descriptions.title_url = \'' . $productname . '\'');
$product = ORM::factory('product')->where('products.id', $_product->id)->find();
$category = $db->query("SELECT cps.* FROM categories_products as cps WHERE product_id = '{$_product->id}'");
$this->template->content->products = $products[0];
$this->template->content->user = FALSE;
$this->template->content->category = $category[0];
if (User_Model::logged_in()) {
$user = User_Model::logged_user();
$this->template->content->user = $user;
}
// $this->template->content->xmlHeader = $product->getConfiguratorFile(Configurator_file_Model::TYPE_HEADER)->file;
// $this->template->content->xmlContent = $product->getConfiguratorFile(Configurator_file_Model::TYPE_CONTENT)->file;
}