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


PHP TimeHelper::format方法代码示例

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


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

示例1: index

 function index()
 {
     $this->layout = 'cart';
     $this->loadModel('MasterCategory');
     $masterCategories = $this->MasterCategory->find('all', array('order' => array('MasterCategory.priority'), 'recursive' => -1));
     $this->Category->Behaviors->attach('Containable');
     foreach ($masterCategories as &$masterCategory) {
         $products = $this->Category->find('all', array('contain' => array('Product' => array('conditions' => array('AND' => array('Product.display = ' => '1', 'Product.stock > ' => '0', 'Product.master_category_id' => $masterCategory['MasterCategory']['id'])))), 'order' => 'Category.priority'));
         $masterCategory['Products'] = $products;
     }
     $this->set('products', $masterCategories);
     $this->loadModel('Configuration');
     $isSiteClosed = $this->Configuration->findByKeyAndOrganizationId('closed', $this->currentUser['User']['organization_id']);
     if ($isSiteClosed == "yes") {
         $closed = true;
         $nextDelivery = $this->Delivery->find('first', array('conditions' => array('Delivery.next_delivery' => true)));
         App::import('Helper', 'Time');
         $time = new TimeHelper();
         $nextDeliveryDate = $time->format($format = 'd-m-Y', $nextDelivery['Delivery']['date'], null, "+7.0");
         $this->set('nextDeliveryDate', $nextDeliveryDate);
     } else {
         $closed = false;
     }
     $this->set('closed', $closed);
 }
开发者ID:sunny36,项目名称:grecocos,代码行数:25,代码来源:carts_controller.php

示例2: TimeHelper

 function get_recent_orders()
 {
     $time = new TimeHelper();
     $dayAgo = time() - 86400;
     $formatedDayAgo = $time->format("Y-m-d H:i:s", $dayAgo);
     $result = $this->find('all', array('conditions' => array('od_date >=' => $formatedDayAgo)));
     return $result;
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:8,代码来源:order.php

示例3: sendEmailSiteReopen

 function sendEmailSiteReopen()
 {
     $User = ClassRegistry::init('User');
     $users = $User->find('all', array('conditions' => array('User.status' => 'accepted')));
     foreach ($users as $user) {
         $to = $to . $user['User']['email'] . ", ";
     }
     $subject = "GRECOCOS website is now open";
     $Delivery = ClassRegistry::init('Delivery');
     $nextDelivery = $Delivery->findByNextDelivery(true);
     App::import('Helper', 'Time');
     $timeHelper = new TimeHelper();
     $deliveryDate = $timeHelper->format($format = 'd-m-Y', $nextDelivery['Delivery']['date']);
     $body = "<p>Dear member</p>" . "<p>The GRECOCOS website is opened. " . "You can place your orders now for delivery on " . "{$deliveryDate}.</p>" . "<p><a href=\"http://grecocos.co.cc/index.php\">" . "http://grecocos.co.cc/index.php</a></p>";
     $AppengineEmail = ClassRegistry::init('AppengineEmail');
     $AppengineEmail->sendEmail($to, $subject, $body);
     $this->Session->write('sendEmailReOpenSite', true);
 }
开发者ID:sunny36,项目名称:grecocos,代码行数:18,代码来源:configurations_controller.php

示例4: array

 function reset_user_password($key = null)
 {
     if (!empty($this->data)) {
         $user = $this->Ticket->findUser($this->data['Ticket']['email']);
         $hasTicket = $this->Ticket->find('first', array('conditions' => array('Ticket.email' => $user['User']['email'])));
         //pr($hasTicket);
         //die;
         if (!empty($user) && empty($hasTicket)) {
             App::import('Helper', 'Time');
             $time = new TimeHelper();
             $key = Security::hash(String::uuid(), 'sha1', true);
             $this->data['Ticket']['key'] = $key;
             $this->data['Ticket']['creation_date'] = $time->format('Y-m-d H:i:s', time());
             $url = Router::url(array('controller' => 'tickets', 'action' => 'reset_user_password'), true) . '/' . $key;
             //pr($url);
             //die;
             //ko se ticket shrani v bazo se poslje email (email element: lost_password_notification.ctp) useru, ki je ticket odprl
             if ($this->Ticket->save($this->data)) {
                 $this->set('url', $url);
                 $this->MyEmail->sendResetPasswordEmail($user['User']['email']);
                 $this->Session->setFlash('notification email has been sent to you with reset data');
             }
         } elseif (!empty($hasTicket)) {
             if ($this->Ticket->checkTicketDateValidity($hasTicket)) {
                 $this->Session->setFlash('We had already sent you a link to your email address! Go get it, lazy ass!');
             } else {
                 $this->Session->setFlash('Your ticket regarding lost password has been deleted due to expiration! Try submitting again');
             }
         }
         //se prozi kadar user klikne link, ki vsebuje generiran key, v svojem mailu in ga redirecta sem
     } elseif (isset($key) && !empty($key)) {
         $result = $this->Ticket->find('first', array('conditions' => array('Ticket.key' => $key)));
         $this->Ticket->checkTicketDateValidity($result);
         if (!empty($result)) {
             $user = $this->Ticket->findUser($result['Ticket']['email']);
             $this->set('userId', $user['User']['id']);
             $this->set('key', $key);
             $this->Ticket->delete($result['Ticket']['id']);
             //$this->redirect(array('controller' => 'users', 'action' => 'changeUserPassword/uid:'.$user['User']['id']));
         }
     } else {
         $this->Session->setFlash('Please provide your email!');
     }
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:44,代码来源:tickets_controller.php

示例5: TimeHelper

 function get_new_users()
 {
     $time = new TimeHelper();
     $dayAgo = time() - 86400;
     $formatedDayAgo = $time->format("Y-m-d H:i:s", $dayAgo);
     return $this->find('all', array('conditions' => array('User.reg_date >=' => $formatedDayAgo)));
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:7,代码来源:user.php

示例6: format

 /**
  * format 拡張
  *
  * @param array $format
  * @param string $date String Datetime string
  * @param boolean $invalid flag to ignore results of fromString == false
  * @param int $userOffset User's offset from GMT (in hours)
  * @return string Formatted date string
  */
 public function format($format = 'Y-m-d', $date = null, $invalid = false, $userOffset = null)
 {
     if ($date !== "00:00:00" && (!$date || $date == '0000-00-00 00:00:00')) {
         return "";
     }
     return parent::format($format, $date, $invalid, $userOffset);
 }
开发者ID:baserproject,项目名称:basercms,代码行数:16,代码来源:BcTimeHelper.php

示例7: ceil

 function coordinator_cash_report2()
 {
     $this->layout = "coordinator/index";
     if ($this->RequestHandler->isAjax()) {
         $page = $this->params['url']['page'];
         $limit = $this->params['url']['rows'];
         $sidx = $this->params['url']['sidx'];
         $sord = $this->params['url']['sord'];
         $delivery_id = null;
         if (isset($this->params['url']['delivery_date'])) {
             $delivery_id = $this->params['url']['delivery_date'];
         }
         if (!$sidx) {
             $sidx = 1;
         }
         $count = 0;
         if (isset($delivery_id)) {
             $count = $this->Transaction->getNumRowsForPaidTransactionByDeliveryDate($delivery_id);
         } else {
             $count = $this->Transaction->getNumRowsForPaidTransaction();
         }
         if ($count > 0) {
             $total_pages = ceil($count / $limit);
         } else {
             $total_pages = 0;
         }
         if ($page > $total_pages) {
             $page = $total_pages;
         }
         $start = $limit * $page - $limit;
         $recursive = 2;
         $cashIn = null;
         $dueToPay = null;
         if (isset($delivery_id)) {
             $transactions = $this->Transaction->getPaidTransactionByDeliveryDate($recursive, $start, $limit, $delivery_id);
             $cashIn = $this->Transaction->getCashIn2($delivery_id);
             $dueToPay = $this->Transaction->getDueToPay($delivery_id);
         } else {
             $transactions = $this->Transaction->getPaidTransaction($recursive, $start, $limit);
             $cashIn = $this->Transaction->getCashIn2();
             $dueToPay = $this->Transaction->getDueToPay();
         }
         App::import('Helper', 'Time');
         $time = new TimeHelper();
         foreach ($transactions as &$transaction) {
             $transaction['Order']['ordered_date'] = $time->format($format = 'm-d-Y', $transaction['Order']['ordered_date']);
             $transaction['Transaction']['cash_in'] = "";
             $transaction['Transaction']['due_to_pay'] = "";
             if ($transaction['Transaction']['type'] == 'Cash Payment') {
                 $transaction['Transaction']['cash_in'] = $transaction['Order']['total'];
                 $transaction['Transaction']['due_to_pay'] = $transaction['Order']['total2'];
                 $transaction['Transaction']['type'] = "Order" . " #" . $transaction['Transaction']['order_id'];
             }
             if ($transaction['Transaction']['type'] == "Refund") {
                 $amountRefundIn = -($transaction['Order']['total'] - $transaction['Order']['total_supplied']);
                 $transaction['Transaction']['cash_in'] = $amountRefundIn;
                 $amountRefundDue = -($transaction['Order']['total2'] - $transaction['Order']['total2_supplied']);
                 $transaction['Transaction']['due_to_pay'] = $amountRefundDue;
                 $transaction['Transaction']['type'] = "Refund Order" . " #" . $transaction['Transaction']['order_id'];
             }
             if ($transaction['Transaction']['type'] == "Bank Transfer") {
                 $transaction['Transaction']['due_to_pay'] = -$transaction['Transaction']['bank_transfer_amount'];
             }
         }
         $this->set('page', $page);
         $this->set('total_pages', $total_pages);
         $this->set('count', $count);
         $this->set('transactions', $transactions);
         $this->set('cash_in', $cashIn);
         $this->set('due_to_pay', $dueToPay);
         $this->render('/elements/transactions2', 'ajax');
     }
 }
开发者ID:sunny36,项目名称:grecocos,代码行数:73,代码来源:transactions_controller.php

示例8: FPDF

 function __construct($products, $order, $filename, $save = false)
 {
     App::import('vendor', 'fpdf/fpdf');
     $orientation = 'P';
     $unit = 'pt';
     $format = 'A4';
     $margin = 40;
     $pdf = new FPDF($orientation, $unit, $format);
     App::import('Helper', 'Time');
     $timeHelper = new TimeHelper();
     setlocale(LC_MONETARY, 'th_TH');
     $pdf->AddPage();
     $pdf->SetTopMargin($margin);
     $pdf->SetLeftMargin($margin);
     $pdf->SetRightMargin($margin);
     $pdf->SetAutoPageBreak(true, $margin);
     $pdf->SetY($pdf->GetY() + 60);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->SetTextColor(0);
     $pdf->SetFillColor(255);
     $pdf->SetLineWidth(1);
     $pdf->Cell(50, 25, "Order ID: ", 'LT', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(50, 25, $order['Order']['id'], 'T', 0, 'L');
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(100, 25, 'Customer Name: ', 'T', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(316, 25, $order['User']['name'], 'TR', 1, 'L');
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(100, 25, "Delivery Date: ", 'LT', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(416, 25, $timeHelper->format($format = 'd-m-Y', $order['Delivery']['date']), 'TR', 1, 'L');
     $pdf->SetFont('Arial', 'B', '10');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 30;
     $pdf->MultiCell($cell_width, 25, "No.\n ", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $pdf->Cell(250, 25, "Description", 'LTR', 0, 'C');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "Number Ordered", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "Number Supplied", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount per Unit", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount\n ", 'LTR', 'C');
     $pdf->SetY($pdf->GetY() - 25);
     $pdf->SetFont('Arial', '');
     $pdf->SetFillColor(238);
     $pdf->SetLineWidth(0.2);
     $pdf->SetY($pdf->GetY() + 25);
     $num = 1;
     $number_ordered = 0;
     $number_supplied = 0;
     foreach ($products as $product) {
         $pdf->Cell(30, 20, $num++, 1, 0, 'L');
         $pdf->Cell(250, 20, $product['Product']['short_description'], 1, 0, 'L');
         $pdf->Cell(48, 20, $product['LineItem']['quantity'], 1, 0, 'R');
         $number_ordered += $product['LineItem']['quantity'];
         $pdf->Cell(48, 20, $product['LineItem']['quantity_supplied'], 1, 0, 'R');
         $number_supplied += $product['LineItem']['quantity_supplied'];
         $pdf->Cell(70, 20, money_format("%i", $product['Product']['selling_price']), 1, 0, 'R');
         $pdf->Cell(70, 20, money_format("%i", $product['LineItem']['total_price_supplied']), 1, 1, 'R');
     }
     $pdf->SetX($pdf->GetX() + 30);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(250, 20, "TOTALS", 1);
     $pdf->SetFont('Arial', '');
     $pdf->Cell(48, 20, $number_ordered, 1, 0, 'R');
     $pdf->Cell(48, 20, $number_supplied, 1, 0, 'R');
     $pdf->Cell(70, 20, "N.A.", 1, 0, 'R');
     $pdf->Cell(70, 20, money_format("%i", $order['Order']['total_supplied']), 1, 1, 'R');
     $pdf->SetY($pdf->GetY() + 25);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Amount Paid: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total']), 0, 1);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Actual Amount: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total_supplied']), 0, 1);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Rebate Amount: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total'] - $order['Order']['total_supplied']), 0, 1);
     if ($save) {
         $pdf->Output($filename, 'F');
     } else {
//.........这里部分代码省略.........
开发者ID:sunny36,项目名称:grecocos,代码行数:101,代码来源:supplier_pdf.php

示例9: doUpdate

 function doUpdate($cart)
 {
     $time = new TimeHelper();
     foreach ($cart as $item) {
         $this->data['Cart']['ct_qty'] = $item['ct_qty'];
         $this->data['Cart']['ct_date'] = $time->format("Y-m-d H:i:s", time());
         $this->id = $item['id'];
         $this->save();
     }
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:10,代码来源:cart.php

示例10: format

 /**
  * Returns a formatted date string, given either a UNIX timestamp or a valid strtotime() date string.
  * This function also accepts a time string and a format string as first and second parameters.
  * In that case this function behaves as a wrapper for TimeHelper::i18nFormat()
  *
  * @param string $format date format string (or a DateTime string)
  * @param string $dateString Datetime string (or a date format string)
  * @param boolean $invalid flag to ignore results of fromString == false
  * @param int $userOffset User's offset from GMT (in hours)
  * @return string Formatted date string
  * @access public
  */
 function format($format, $date = null, $invalid = false, $userOffset = null)
 {
     return parent::format($format, $date, $invalid, $this->__userOffset($date, $userOffset));
 }
开发者ID:nani8124,项目名称:infinitas,代码行数:16,代码来源:InfiniTimeHelper.php

示例11: array

 function supplier_products_orders()
 {
     $this->layout = "supplier/index";
     $this->set('title_for_layout', 'Supplier | Products Orders Reports');
     $Delivery = ClassRegistry::init('Delivery');
     $deliveryDates = $Delivery->getDeliveryDatesList();
     $this->set('delivery_dates', $deliveryDates);
     $this->loadModel('Organization');
     $this->set('organizations', $this->Organization->getOrganizationsList());
     if (!empty($this->params['url']['delivery_date'])) {
         if (empty($this->params['url']['organizations'])) {
             $this->Session->setFlash('Please select both outlet and delivery date.', 'flash_notice');
             $this->redirect(array('action' => 'products_orders'));
         }
         $Order = ClassRegistry::init('Order');
         $orders = $Order->findAllByDeliveryIdAndStatus($this->params['url']['delivery_date'], array('paid', 'packed', 'delivered'));
         if (count($orders) < 1) {
             $this->Session->setFlash('Sorry, there is no orders for this delivery date', 'flash_notice');
             $this->redirect(array('action' => 'products_orders'));
         }
         $productIds = NULL;
         foreach ($orders as $order) {
             foreach ($order['LineItem'] as $lineItem) {
                 $productIds[] = $lineItem['product_id'];
             }
         }
         $productIds = array_values(array_unique($productIds));
         $products = $this->Product->find('all', array('conditions' => array('Product.id' => $productIds)));
         $this->set('products', $products);
         $productsOrders = NULL;
         $productsOrders[0][0] = 'Id';
         $productsOrders[0][1] = 'ชื่อสินค้า';
         $productsOrders[0][count($orders) + 2] = 'รวม';
         $col = 2;
         foreach ($orders as $order) {
             $productsOrders[0][$col++] = $order['Order']['id'];
         }
         $row = 1;
         // Fill in products for every row
         foreach ($products as $product) {
             $productsOrders[$row][0] = $product['Product']['id'];
             $productsOrders[$row][1] = $product['Product']['short_description_th'];
             $row++;
         }
         for ($row = 1; $row < count($productsOrders); $row++) {
             foreach ($orders as $order) {
                 foreach ($order['LineItem'] as $lineItem) {
                     if ($productsOrders[$row][0] == $lineItem['product_id']) {
                         $productsOrders[$row][array_search($lineItem['order_id'], $productsOrders[0])] = $lineItem['quantity_supplied'];
                     }
                 }
             }
         }
         for ($row = 1; $row < count($products) + 1; $row++) {
             for ($col = 2; $col < count($orders) + 2; $col++) {
                 if (!array_key_exists($col, $productsOrders[$row])) {
                     $productsOrders[$row][$col] = 0;
                 }
             }
         }
         // Sort productOrders by key
         for ($row = 0; $row < count($products) + 1; $row++) {
             ksort($productsOrders[$row]);
         }
         for ($i = 1; $i < count($productsOrders); $i++) {
             $productTotal = 0;
             for ($j = 2; $j < count($productsOrders[$i]); $j++) {
                 $productTotal += $productsOrders[$i][$j];
             }
             $productsOrders[$i][$j] = $productTotal;
         }
         for ($j = 2; $j < count($orders) + 3; $j++) {
             $orderTotal = 0;
             for ($i = 1; $i < count($products) + 1; $i++) {
                 $orderTotal = $orderTotal + $productsOrders[$i][$j];
             }
             $productsOrders[$i][0] = 'รวม';
             $productsOrders[$i][1] = 'รวม';
             $productsOrders[$i][$j] = $orderTotal;
         }
         $this->set('productsOrders', $productsOrders);
         App::import('Helper', 'Time');
         $time = new TimeHelper();
         $Delivery = ClassRegistry::init('Delivery');
         $delivery = $Delivery->findById($this->params['url']['delivery_date']);
         $fileName = $time->format($format = 'd-m-Y', $delivery['Delivery']['date']) . "_report.xls";
         $this->set('fileName', $fileName);
         $this->render('/elements/pdf_report/supplier_products_orders', 'fpdf');
     }
 }
开发者ID:sunny36,项目名称:grecocos,代码行数:90,代码来源:orders_controller.php

示例12: format

 function format($format, $date)
 {
     if (empty($date)) {
         return null;
     }
     return parent::format($format, $date);
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:7,代码来源:zuluru_time.php


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