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


PHP Zend_Date::getDate方法代码示例

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


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

示例1: myBest

 /**
  * Retrieve Bestseller product to show in frontend
  * @return mixed
  */
 public function myBest()
 {
     $storeId = Mage::app()->getStore()->getId();
     $HandleArray = Mage::app()->getLayout()->getUpdate()->getHandles();
     $CategoryHandle = 'catalog_category_view';
     $SourceConfig = Mage::getStoreConfig('sm_bestseller/sm_bestseller_source');
     if ($SourceConfig && !empty($SourceConfig)) {
         $SourceType = $SourceConfig['timeperiod'];
         $date = new Zend_Date();
         /**
          * Select time range to retrive bestseller
          */
         if ($SourceType && $SourceType == 'specify') {
             $fromDate = $date->setDate($SourceConfig['fromdate'])->get('Y-MM-dd');
             $toDate = $date->setDate($SourceConfig['todate'])->get('Y-MM-dd');
         } else {
             /**
              * use switch to return begin of week, month, year...
              */
             switch ($SourceType) {
                 case 'subWeek':
                     $toDate = $date->subDay($date->getDate()->get('e'))->getDate()->get('Y-MM-dd');
                     break;
                 case 'subMonth':
                     $toDate = $date->setDay(1)->getDate()->get('Y-MM-dd');
                     break;
                 case 'subYear':
                     $toDate = $date->subDay($date->getDate()->get('D'))->getDate()->get('Y-MM-dd');
                     break;
                 default:
                     $toDate = $date->getDate()->get('Y-MM-dd');
             }
             // end switch
             $subType = $SourceType;
             $unit = $SourceConfig['unit'] ? $SourceConfig['unit'] : 1;
             $fromDate = $date->{$subType}($unit)->getDate()->get('Y-MM-dd');
         }
         // end else
         /**
          * Limit maximum product retrieve
          */
         $limit = $SourceConfig['limitproduct'];
         if ($limit > 0 && ctype_digit($limit)) {
             $this->setProductsCount($limit);
         }
         $products = Mage::getResourceModel('reports/product_collection')->addOrderedQty($fromDate, $toDate)->addAttributeToSelect('*')->addAttributeToSelect(array('name', 'price', 'small_image'))->setStoreId($storeId)->addStoreFilter($storeId)->setOrder('ordered_qty', 'desc');
         // most best sellers on top
         Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
         Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
         $products->setPageSize($limit)->setCurPage(1);
         if (in_array($CategoryHandle, $HandleArray)) {
             $CategoryId = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
             $CategoryModel = Mage::getModel('catalog/category')->load($CategoryId);
             $products->addCategoryFilter($CategoryModel);
         }
         return $products;
     }
     // end if sourceconfig
 }
开发者ID:luoi,项目名称:mockmagentosample,代码行数:63,代码来源:Bestseller.php

示例2: gettodaydateAction

 /**
  * The default action - show the home page
  */
 public function gettodaydateAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout()->disableLayout();
     $dateobj = new Zend_Date();
     echo $dateobj->getDate();
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:10,代码来源:DateController.php

示例3: isValid

 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     if ($isValid) {
         $date = new Zend_Date();
         $date2 = clone $date;
         $date->set($data['date_for'], 'YYYY-MM-dd');
         $date2->set($data['date_to'], 'YYYY-MM-dd');
         if ($date->getDate()->isLater($date2->getDate())) {
             $isValid = false;
             $this->getElement('date_to')->addError('Data do musi być późniejsza niż Data od');
         } else {
             $date->addDay(31);
             if ($date->getDate()->isEarlier($date2->getDate())) {
                 $isValid = false;
                 $this->getElement('date_to')->addError('Wygenerowanie raportu możliwe jest za dowolny okres obejmujący max 31 dni');
             }
         }
     }
     return $isValid;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:21,代码来源:Search.php

示例4: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $form = new Logic_Raports_Form_Search();
     $search = new Logic_Raports_Search($this->_model);
     if ($request->isPost()) {
         $values = $request->getPost();
         if ($form->isValid($values)) {
             if (isset($values['create_raport'])) {
                 if ($this->_model->getRaportByDate($values['date_for'], $values['date_to']) === null) {
                     $config = Zend_Registry::get('config');
                     $base = $config['general']['default']['base_path'];
                     $date = new Zend_Date();
                     $values['hash'] = SHA1($date->getTimestamp());
                     $this->_model->addRaport($values);
                     $form->date_for->setValue('');
                     $form->date_to->setValue('');
                     $view = new Zend_View();
                     $date = new Zend_Date();
                     throw new Exception("Do zmiany.");
                     $packageModel = new WsPackageMail();
                     $packageQueue = new WsPackageQueue();
                     $packageData = new WsPackageDataMail();
                     $package = $packageModel->addPackage(array('name' => 'wysyka raportu', 'time_send_start' => '08:00', 'time_send_end' => "20:00", 'send_start' => $date->getDate()->toString('YYYY-MM-dd'), 'file_type' => Logic_Ws_ServiceSet_ServiceSet::TYPE_ANY));
                     /* TODO zmiana adresu email doręczena raportów */
                     $view->setScriptPath(APPLICATION_PATH . '/views/scripts/_mail/');
                     $view->output = array('baseurl' => $base, 'hash' => $values['hash']);
                     $packageData->addPackageData(array('message' => $view->render('sendreport.phtml'), 'ws_package_id' => $package, 'email_address' => 'grzegorz.kielar@nobelbank.pl'));
                     $packageQueue->addQueue(array('ws_package_id' => $package));
                 }
             }
         }
     }
     $this->view->form = $form;
     $this->view->headers = $search->getHeaders();
     $this->view->paginator = $search->paginator();
 }
开发者ID:knatorski,项目名称:SMS,代码行数:37,代码来源:RaportsController.php

示例5: testGetDate

 /**
  * Test for getDate
  */
 public function testGetDate()
 {
     $locale = new Zend_Locale('de_AT');
     $date = new Zend_Date(1010101010, null, $locale);
     $d2 = new Zend_Date(1010101010, null, $locale);
     $result = $date->getDate();
     $this->assertSame('2002-01-04T00:00:00+05:00', $result->get(Zend_Date::W3C));
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:11,代码来源:DateTest.php

示例6: getCurrentDate

 public static function getCurrentDate()
 {
     $date = new Zend_Date();
     return $date->getDate();
 }
开发者ID:rizkioa,项目名称:etak6,代码行数:5,代码来源:Date.php

示例7: getDate

 /**
  * Returns a clone of $this, with the time part set to 00:00:00.
  *
  * @param  string|Zend_Locale  $locale  OPTIONAL Locale for parsing input
  * @return Axis_Date
  */
 public function getDate($locale = null)
 {
     // supress notice about PCRE without UTF8 support
     return @parent::getDate($locale);
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:11,代码来源:Date.php

示例8: baseInit

 public function baseInit()
 {
     $dict = new Base_Dictionary();
     $date = new Zend_Date();
     $user = Zend_Auth::getInstance()->getIdentity();
     $client = Logic_Client::getInstance();
     $wsServiceSet = $client->getGroupListAsDict(Wsclient::GROUP_SERVICE_SET);
     $config = Zend_Registry::get('config');
     $this->addElement('text', 'name', array('required' => true, 'label' => 'Nazwa wysyłki'));
     $this->datee(false, "send_start", "Początek wysyłki");
     $this->send_start->setValue($date->getDate()->toString('YYYY-MM-dd'))->addValidator('Callback', false, array('callback' => function ($value) {
         $date = new Zend_Date();
         $date2 = clone $date;
         return $date->getTimestamp() <= $date2->setDate($value, 'YYYY-MM-dd')->getTimestamp();
     }));
     $this->timee(false, "time_send_start", "Okno czasowe od");
     $this->time_send_start->setValue('8:00');
     $this->timee(false, "time_send_end", "Okno czasowe do");
     $this->time_send_end->setValue('20:00');
     $this->time_send_end->addValidator('Callback', false, array('callback' => function ($value) {
         return strtotime($value) > strtotime($this->time_send_start->getValue());
     }));
     $this->datetimee(false, 'expiry_date', "Ważność wiadomości", false, array('value' => ''));
     $this->expiry_date->addValidator('Callback', false, array('callback' => function ($value) {
         $date = new Zend_Date();
         $date2 = clone $date;
         $date2->setDate($value, 'YYYY-MM-dd HH:mm');
         $date->setDate($this->send_start->getValue(), 'YYYY-MM-dd HH:mm');
         return $date->getTimestamp() <= $date2->getTimestamp() && $date->addHour(72)->getTimestamp() >= $date2->getTimestamp();
     }));
     $this->expiry_date->getValidator('Callback')->setMessages(array(Zend_Validate_Callback::INVALID_VALUE => "Data ważności wiadmości może wynosić maksymalnie 72 godziny"));
     $this->addElement('checkbox', 'repeat_message', array('label' => 'Powtarzaj tą wiadomość', 'attribs' => array('onchange' => 'checkPackageOptions();')));
     $this->repeat_message->addValidator('Callback', false, array('callback' => function ($value) {
         if ($value) {
             $this->repeat_interval->setRequired(true);
             $this->repeat_count->setRequired(true);
             $this->repeat_end->setRequired(true);
         }
         return true;
     }));
     $this->addElement('radio', 'repeat_interval', array('MultiOptions' => $dict->setSource('package_repeat')->getDictionary(), 'attribs' => array('disable' => 'disable'), 'attribs' => array('onchange' => 'checkPackageOptions();')));
     $this->repeat_interval->addValidator('Callback', false, array('callback' => function ($value) {
         if ($value == 5) {
             $this->repeat_days->setRequired(true);
         } elseif ($value == 4) {
             $this->repeat_day_interval->setRequired(true);
         }
         return true;
     }));
     $this->addElement('multiselect', 'repeat_days', array('MultiOptions' => $dict->setSource('day_of_week')->getDictionary(), 'attribs' => array('disable' => 'disable')));
     $this->addElement('text', 'repeat_day_interval', array('label' => 'Powtarzań wiadomość co (liczba dni)', 'attribs' => array('disable' => 'disable')));
     $this->addElement('text', 'repeat_count', array('label' => 'Ilość powtórzeń wiadomości', 'attribs' => array('disable' => 'disable')));
     $this->datetimee(false, "repeat_end", "Powtarzań do", false, array('value' => '', 'attribs' => array('disabled' => 'disabled')));
     $this->repeat_end->addValidator('Callback', false, array('callback' => function ($value) {
         $date = new Zend_Date();
         $date2 = clone $date;
         $date->setDate($value, 'YYYY-MM-dd HH:mm');
         $date2->setDate($this->send_start->getValue(), 'YYYY-MM-dd HH:mm');
         return $date->getTimestamp() <= $date2->setDate($value, 'YYYY-MM-dd HH:mm')->getTimestamp();
     }));
     $this->addElement('select', 'ws_service_set_id', array('label' => 'Wysyłka', 'required' => true, 'MultiOptions' => $this->addClearStart($wsServiceSet), 'attribs' => array('onchange' => 'getServiceSetOptions();')));
     $this->addElement('select', 'file_type', array('required' => true, 'label' => 'Typ wysyłki:', 'multioptions' => $this->addClearStart($dict->setSource('service_import_file_type')->getDictionary())));
     $this->addElement('file', 'addressbook_import_csv', array('label' => 'CSV z listą kontaktów do zaimportowania', 'decorators' => $this->_fileDecorator, 'validators' => array(array('Extension', false, 'csv'), array('Size', false, $config['uploads']['maxfilesize']))));
     $this->addElement('select', 'delimeter', array('label' => "Separator pola", 'MultiOptions' => $this->addClearStart($dict->setSource('csv_delimeter')->getDictionary())));
     $this->addElement('select', 'phone_heders', array('label' => "Kolumna z kontaktami"));
     $this->addElement('select', 'ws_addressbook_id', array('label' => 'Adresy', 'MultiOptions' => $this->addClearStart($dict->setSource(new Addressbook(), array('created_by =' . (int) $user->id, 'ghost=false'), 'id', 'id', array('addressbook_name'))->getDictionary())));
     $this->addDisplayGroup(array($this->addressbook_import_csv, $this->delimeter, $this->phone_heders), 'tags_import');
     $this->addElement('select', 'message_heders', array('label' => "Kolumna z wiadomością"));
     $this->submit(false, 'save_send', 'Wyślij');
     $this->submit();
     $this->cancel();
 }
开发者ID:knatorski,项目名称:SMS,代码行数:72,代码来源:Generic.php


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