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


PHP Zend_Date::isEarlier方法代码示例

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


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

示例1: isValid

 public function isValid($value)
 {
     $front = Zend_Controller_Front::getInstance()->getRequest();
     $action = $front->action;
     if ($action == "edit-evento") {
         return true;
     }
     if (!isset($value) or empty($value)) {
         return false;
     }
     //date_default_timezone_set( 'America/Sao_Paulo' );
     //  Zend_Registry::get('logger')->log("valor=", Zend_Log::INFO);
     // Zend_Registry::get('logger')->log($value, Zend_Log::INFO);
     $date = new Zend_Date();
     $data = new Zend_Date($date->toString('dd/MM/YYYY'));
     $data2 = new Zend_Date($value);
     $comparacao = $data->isLater($data2);
     $comparacao2 = $data->isEarlier($data2);
     $comparacao3 = $data->equals($data2);
     // Zend_Registry::get('logger')->log($comparacao, Zend_Log::INFO);
     //  Zend_Registry::get('logger')->log($comparacao2, Zend_Log::INFO);
     // Zend_Registry::get('logger')->log($comparacao3, Zend_Log::INFO);
     if ($comparacao3 || $comparacao2) {
         Zend_Registry::get('logger')->log("data igual ou maior", Zend_Log::INFO);
     } else {
         $this->_setValue($value);
         //	Zend_Registry::get('logger')->log("data menor", Zend_Log::INFO);
         $this->_error(self::INVALID);
         return false;
     }
     // $comparacao= $data->compare($date2);
     // Zend_Registry::get('logger')->log($comparacao, Zend_Log::INFO);
     //  Zend_Registry::get('logger')->log($comparacao2, Zend_Log::INFO);
     return true;
 }
开发者ID:andrelsguerra,项目名称:pequiambiental,代码行数:35,代码来源:Data.php

示例2: isValid

 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     if (empty($data['phone_number']) && empty($data['sms_id']) && (empty($data['date_until']) || empty($data['date_from']))) {
         $this->addErrorMessage('"Data do" i "Data od" sa wymagane jeżeli nie podasz "SMS ID" lub Numeru telefonu');
         return false;
     }
     if (empty($data['sms_id']) && empty($data['phone_number'])) {
         try {
             $dateCheck = new Zend_Date($data['date_from']);
             if (!$dateCheck->isEarlier($data['date_until']) and 0 != strcmp($data['date_from'], $data['date_until'])) {
                 $isValid = false;
                 $this->addErrorMessage('"Data do" nie może być wcześniejsza niż "Data od"!');
             }
             $dateSub = new Zend_Date($data['date_until']);
             $config = Zend_Registry::get('config');
             if ($dateSub->sub($dateCheck)->toValue('DD') > $config['search']['mail']['filter']['interval']) {
                 $isValid = false;
                 $this->addErrorMessage('Maksymalny okres z jakiego można wyszukiwać dane to ' . $config['search']['sms']['filter']['interval'] . ' dni');
             }
         } catch (Exception $ex) {
             $this->addErrorMessage($ex->getMessage());
             $isValid = false;
         }
     }
     return $isValid;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:27,代码来源:Search.php

示例3: convertAttribute

 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Varien_Gdata_Gshopping_Entry $entry
  * @return Varien_Gdata_Gshopping_Entry
  */
 public function convertAttribute($product, $entry)
 {
     $effectiveDateFrom = $this->getGroupAttributeSalePriceEffectiveDateFrom();
     $fromValue = $effectiveDateFrom->getProductAttributeValue($product);
     $effectiveDateTo = $this->getGroupAttributeSalePriceEffectiveDateTo();
     $toValue = $effectiveDateTo->getProductAttributeValue($product);
     $from = $to = null;
     if (!empty($fromValue) && Zend_Date::isDate($fromValue, Zend_Date::ATOM)) {
         $from = new Zend_Date($fromValue, Zend_Date::ATOM);
     }
     if (!empty($toValue) && Zend_Date::isDate($toValue, Zend_Date::ATOM)) {
         $to = new Zend_Date($toValue, Zend_Date::ATOM);
     }
     $dateString = null;
     // if we have from an to dates, and if these dates are correct
     if (!is_null($from) && !is_null($to) && $from->isEarlier($to)) {
         $dateString = $from->toString(Zend_Date::ATOM) . '/' . $to->toString(Zend_Date::ATOM);
     }
     // if we have only "from" date, send "from" day
     if (!is_null($from) && is_null($to)) {
         $dateString = $from->toString('YYYY-MM-dd');
     }
     // if we have only "to" date, use "now" date for "from"
     if (is_null($from) && !is_null($to)) {
         $from = new Zend_Date();
         // if "now" date is earlier than "to" date
         if ($from->isEarlier($to)) {
             $dateString = $from->toString(Zend_Date::ATOM) . '/' . $to->toString(Zend_Date::ATOM);
         }
     }
     if (!is_null($dateString)) {
         $this->_setAttribute($entry, 'sale_price_effective_date', self::ATTRIBUTE_TYPE_TEXT, $dateString);
     }
     return $entry;
 }
开发者ID:ksaltik,项目名称:tooldexlive,代码行数:42,代码来源:SalePriceEffectiveDate.php

示例4: save

 /**
  * 
  * @return int|bool
  */
 public function save()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         // Check if there is already a campaign with the title defined
         $row = $this->_checkTitleCampaign();
         if (!empty($row)) {
             $this->_message->addMessage(sprintf('Iha kampanha tiha ona ho naran %', $this->_data['campaign_title']));
             return false;
         }
         $dataForm = $this->_data;
         // Check if the campaign was scheduled to validated and format the date
         if (!empty($this->_data['date_scheduled'])) {
             $date = new Zend_Date($this->_data['date_scheduled']);
             if ($date->isEarlier(Zend_Date::now())) {
                 $this->_message->addMessage('Keta rejistu data atu haruka uluk data ohin');
                 $this->addFieldError('date_scheduled');
                 return false;
             }
             $this->_data['date_scheduled'] = $date->toString('yyyy-MM-dd');
         }
         if (empty($this->_data['id_campaign'])) {
             $mapperSmsConfig = new Admin_Model_Mapper_SmsConfig();
             $config = $mapperSmsConfig->getConfig();
             $this->_data['fk_id_sysuser'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser;
             $this->_data['fk_id_sms_config'] = $config->id_sms_config;
             $this->_data['status'] = empty($this->_data['date_scheduled']) ? self::STATUS_STOPPED : self::STATUS_SCHEDULED;
             $history = 'INSERE KAMPANHA SMS: %s';
         } else {
             $history = 'ALTERA KAMPANHA SMS: %s';
             $this->_data['status'] = empty($this->_data['date_scheduled']) ? self::STATUS_STOPPED : self::STATUS_SCHEDULED;
         }
         // Save the campaign
         $id = parent::_simpleSave();
         // Save the campaign log
         if (empty($dataForm['id_campaign'])) {
             $this->saveLog('KAMPANHA HALOT', $id);
         } else {
             $this->saveLog('KAMPANHA ALTERADA', $id);
         }
         $dataForm['id_campaign'] = $id;
         // Save the groups for the campaign
         $this->_saveCampaignGroups($dataForm);
         $history = sprintf($history, $id);
         $this->_sysAudit($history);
         $dbAdapter->commit();
         return $id;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:58,代码来源:Campaign.php

示例5: isExpired

 /**
  * Checks if subscription has been expired
  * @return boolean
  */
 public function isExpired()
 {
     if (!empty($this->expires_date)) {
         $oExpiredDate = new Zend_Date($this->expires_date);
         $oNowDate = new Zend_Date();
         if ($oExpiredDate->isEarlier($oNowDate)) {
             $this->delete();
             return true;
         }
     }
     return false;
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:16,代码来源:Purchase.php

示例6: isBeforeEditDeadline

 /**
  * Is this current time before the edit deadline?
  *
  * @return boolean
  */
 public function isBeforeEditDeadline()
 {
     $conference = Zend_Registry::get('conference');
     if (!isset($conference['review_start'])) {
         return true;
     }
     $now = new Zend_Date();
     if ($now->isEarlier($conference['review_start'])) {
         return true;
     }
     return false;
 }
开发者ID:br00k,项目名称:tnc-web,代码行数:17,代码来源:Item.php

示例7: isFeedbackOpen

 /**
  * Is feedback open? Feedback is open when the feedback codes are sent and the
  * feedback closing date has not passed
  *
  * @return	mixed	boolean on false or Zend_Date on true
  */
 public function isFeedbackOpen()
 {
     $eventlogModel = new Core_Model_Eventlog();
     if (false === ($feedbackSent = $eventlogModel->getTimestampByType('Core_FeedbackController::mailallAction'))) {
         return false;
     }
     $date = new Zend_Date();
     if ($date->isLater($feedbackSent) && $date->isEarlier($this->_conference['feedback_end'], Zend_Date::ISO_8601)) {
         return $date;
     }
     return false;
 }
开发者ID:br00k,项目名称:tnc-web,代码行数:18,代码来源:ConferenceInfo.php

示例8: getFirstDate

 public function getFirstDate()
 {
     $firstDate = \Zend_Date::now();
     $this->rewind();
     while ($requisition = $this->read()) {
         $requisitionDate = new \Zend_Date($requisition->getDate(), 'yyyy-MM-dd HH:mm:ss');
         if ($requisitionDate->isEarlier($firstDate)) {
             $firstDate = $requisitionDate;
         }
     }
     $this->rewind();
     return $firstDate->get("yyyy-MM-dd HH:mm:ss");
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:13,代码来源:RequisitionCollection.php

示例9: isDateBetween

 public function isDateBetween($target, $from, $to)
 {
     if (is_null($from) && is_null($to)) {
         return true;
     }
     $target = new Zend_Date($target);
     $from = new Zend_Date($from);
     $to = new Zend_Date($to);
     if ($target->isEarlier($to) && $target->isLater($from)) {
         return true;
     }
     return false;
 }
开发者ID:eadsimone,项目名称:moduleforben,代码行数:13,代码来源:Data.php

示例10: getbookdetailsAction

 public function getbookdetailsAction()
 {
     self::createModel();
     $request = $this->getRequest();
     $acc_no = $request->getParam('acc_no');
     $objIsbn = new Lib_Model_DbTable_Isbn();
     $objIssueReturn = new Lib_Model_DbTable_IssueReturn();
     $book = array();
     if (isset($acc_no)) {
         $bookInfo = Lib_Model_DbTable_Book::getBookInfo($acc_no);
         if (isset($bookInfo['isbn_id'])) {
             $book = $objIsbn->getIsbnDetails($bookInfo['isbn_id']);
             $bookIssued = $objIssueReturn->getIssuedBookInfo($acc_no);
             //$this->_helper->logger($bookIssued);
             if ($bookIssued) {
                 $issueDate = new Zend_Date($bookIssued['issue_date'], Zend_Date::ISO_8601);
                 $book['member_id'] = $bookIssued['member_id'];
                 $member_limit = Lib_Model_DbTable_MembershipLimit::getMemberLimit($book['member_id'], $bookInfo['document_type_id']);
                 if (isset($_SESSION['dateFormat'])) {
                     $dateFormat = $_SESSION['dateFormat'];
                 } else {
                     $dateFormat = 'dd/MMM/yyyy';
                 }
                 $book['issue_date'] = $issueDate->toString($dateFormat);
                 $exp_return_date = $issueDate->addDay($member_limit['day_limit']);
                 $day_late = 0;
                 $objtoday = new Zend_Date(Zend_Date::now(), $dateFormat);
                 if ($exp_return_date->isToday() || $objtoday->isEarlier($exp_return_date)) {
                     $day_late = 0;
                 } else {
                     $objtoday->sub($exp_return_date);
                     $day_late = $objtoday->get(Zend_Date::DAY) - 2;
                 }
                 $book['exp_return_date'] = $exp_return_date->toString($dateFormat);
                 $book['day_late'] = $day_late;
                 $bookStatus = 1;
             }
             $book['bookInfo'] = $bookInfo;
             $this->_helper->json($book);
             //echo Zend_Json::encode($book);
         } else {
             $this->getResponse()->setHttpResponseCode(400);
             echo 'Either the Acc No "' . $acc_no . '" or its corrosponding ISBN is invalid.';
         }
     } else {
         $this->getResponse()->setHttpResponseCode(400);
         echo 'Parameters are insufficient to process.';
     }
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:49,代码来源:BookController.php

示例11: isNow

 /**
  * Is this session in progress?
  *
  * @return mixed	Zend_Date on success, false on failure
  */
 public function isNow()
 {
     //$date = new Zend_Date(array(
     //  'year' => 2011,
     //  'month' => 5,
     //  'day' => 16,
     //  'hour' => 14,
     //  'minute' => 10,
     //  'second' => 10));
     $date = new Zend_Date();
     if ($date->isLater($this->tstart, Zend_Date::ISO_8601) && $date->isEarlier($this->tend, Zend_Date::ISO_8601)) {
         return $date;
     }
     return false;
 }
开发者ID:br00k,项目名称:tnc-web,代码行数:20,代码来源:Item.php

示例12: isValid

 public function isValid($value, $context = null)
 {
     $this->_setValue($value);
     if ($value['tstart'] == '' || $value['tend'] == '') {
         $this->_error(self::NOT_EMPTY);
         return false;
     }
     $start = new Zend_Date($value['tstart']);
     $end = new Zend_Date($value['tend']);
     if ($end->isEarlier($start)) {
         $this->_error(self::DATE_MISMATCH);
         return false;
     }
     return true;
 }
开发者ID:br00k,项目名称:tnc-web,代码行数:15,代码来源:Timeslot.php

示例13: isValid

 /**
  * Defined by Zend_Validate_Interface
  *
  * Returns true if $value is a valid date of the format YYYY-MM-DD
  * If optional $format or $locale is set the date format is checked
  * according to Zend_Date, see Zend_Date::isDate()
  *
  * @param  string $value
  * @return boolean
  */
 public function isValid($value)
 {
     $result = true;
     $date_validator = new Zend_Validate_Date($this->_format);
     if (!$date_validator->isValid($value['from']) || !$date_validator->isValid($value['to'])) {
         $this->_error(self::NOT_YYYY_MM_DD);
         $result = false;
     }
     $from_date = new Zend_Date($value['from']);
     $to_date = new Zend_Date($value['to']);
     if ($to_date->isEarlier($from_date)) {
         $this->_error(self::END_DATE_EARLIER);
         $result = false;
     }
     return $result;
 }
开发者ID:anunay,项目名称:stentors,代码行数:26,代码来源:DateRange.php

示例14: baseInit

 public function baseInit()
 {
     $this->datee(false, 'date_for', "Data od:", true);
     $this->date_for->addValidator('Callback', false, array('callback' => function ($value) {
         $date = new Zend_Date();
         $date->setDate($value, 'YYYY-MM-dd');
         return $date->isEarlier(new Zend_date()) || $date->isToday();
     }, 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => "Data od nie może być datą przyszłą")));
     $this->datee(false, 'date_to', "Data do:", true);
     $this->date_to->addValidator('Callback', false, array('callback' => function ($value) {
         $date = new Zend_Date();
         $date->setDate($value, 'YYYY-MM-dd');
         return $date->isEarlier(new Zend_date()) || $date->isToday();
     }, 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => "Data do nie może być datą przyszłą")));
     $this->submit(false, 'create_raport', 'Generuj raport');
 }
开发者ID:knatorski,项目名称:SMS,代码行数:16,代码来源:Search.php

示例15: getisvaliddateAction

 public function getisvaliddateAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout()->disableLayout();
     $dateText = $this->getRequest()->getParam('dateText');
     $objSelectedDate = new Zend_Date($dateText, Zend_Date::ISO_8601);
     $objTodayDate = new Zend_Date(Zend_Date::now(), Zend_Date::ISO_8601);
     if ($objSelectedDate->isToday($dateText)) {
         echo 1;
         return;
     }
     if ($objSelectedDate->isEarlier($objTodayDate) || $objSelectedDate->isDate($dateText)) {
         echo 0;
         return;
     }
     echo 1;
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:17,代码来源:DateController.php


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