本文整理汇总了PHP中Zend_Date::isLater方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::isLater方法的具体用法?PHP Zend_Date::isLater怎么用?PHP Zend_Date::isLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::isLater方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _saveContract
/**
*
* @param array $data
* @return int
* @throws Exception
*/
protected function _saveContract($data)
{
$dateStart = new Zend_Date($data['date_start']);
$dateFinish = new Zend_Date($data['date_finish']);
// Check if the initial date is later than finish date
if ($dateStart->isLater($dateFinish)) {
$message = 'Data loron keta liu data remata.';
$this->_message->addMessage($message);
$this->addFieldError('date_start')->addFieldError('date_finish');
throw new Exception($message);
}
// If there is no contract yet
if (empty($data['fk_id_fefop_contract'])) {
$dataContract = array('module' => Fefop_Model_Mapper_Module::DRH, 'district' => $data['fk_id_adddistrict']);
$mapperFefopContract = new Fefop_Model_Mapper_Contract();
$data['fk_id_fefop_contract'] = $mapperFefopContract->save($dataContract);
}
$data['date_start'] = $dateStart->toString('yyyy-MM-dd');
$data['date_finish'] = $dateFinish->toString('yyyy-MM-dd');
$dataForm = $data;
$this->_data = $data;
// Save the contract
$dataForm['id_drh_contract'] = parent::_simpleSave($this->_dbTable, false);
// Save budget category
$this->_saveExpenses($dataForm);
if (empty($data['id_drh_contract'])) {
$history = 'REJISTU KONTRAKTU DRH: %s';
} else {
$history = 'ATUALIZA KONTRAKTU DRH: %s';
}
$history = sprintf($history, $dataForm['id_drh_contract']);
$this->_sysAudit($history);
return $dataForm['id_drh_contract'];
}
示例2: testSetWhenDefaultsToCurrentTime
public function testSetWhenDefaultsToCurrentTime()
{
$entry = new Zend_Feed_Writer_Deleted();
$entry->setWhen();
$dateNow = new Zend_Date();
$this->assertTrue($dateNow->isLater($entry->getWhen()) || $dateNow->equals($entry->getWhen()));
}
示例3: 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;
}
示例4: checkDateConstraint
public static function checkDateConstraint($dateTime, $limit)
{
$dateStr = $dateTime->format('Y-m-d H:i:s');
$date = new Zend_Date($dateStr, 'yyyy-MM-dd HH:mm:ss');
$now = new Zend_Date();
$date->add($limit, Zend_Date::DAY);
return $date->isLater($now);
}
示例5: hasExpired
/** Has the token expired?
*
* @param string $access_token_expiry
*/
private function hasExpired($access_token_expiry)
{
$now = new Zend_Date(NULL, 'yyyy-MM-dd HH:mm:ss');
$tokenDate = new Zend_Date($access_token_expiry, 'YYYY-MM-dd HH:mm:ss');
$difference = $tokenDate->isLater($now);
if ($now > $tokenDate) {
return true;
} else {
return false;
}
}
示例6: isValid
public function isValid($data)
{
$valid = parent::isValid($data);
$date1 = new Zend_Date($data['valid_since']);
$date2 = new Zend_Date($data['valid_until']);
if ($date1->isLater($date2)) {
$this->addError('Nieprawidłowy przedział dat.');
$valid = false;
}
return $valid;
}
示例7: isValid
public function isValid($value, $context = null)
{
$value = (string) $value;
$this->_setValue($value);
$endDate = new Zend_Date($value);
if (isset($context[$this->_field]) && $endDate->isLater($context[$this->_field])) {
return true;
} else {
$this->_error();
return false;
}
}
示例8: 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;
}
示例9: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$dateStart = new Zend_Date($this->_data['date_start']);
$dateFinish = new Zend_Date($this->_data['date_finish']);
$mapperRule = new Fefop_Model_Mapper_Rule();
$mapperRule->validate($this->_message, $this->_data, Fefop_Model_Mapper_Expense::CONFIG_PFPCI_RI);
// Check if the initial date is later than finish date
if ($dateStart->isLater($dateFinish)) {
$this->_message->addMessage('Data loron keta liu data remata.');
$this->addFieldError('date_start')->addFieldError('date_finish');
return false;
}
// If there is no contract yet
if (empty($this->_data['fk_id_fefop_contract'])) {
$dataContract = array('module' => Fefop_Model_Mapper_Module::RI, 'district' => $this->_data['fk_id_adddistrict']);
$mapperFefopContract = new Fefop_Model_Mapper_Contract();
$this->_data['fk_id_fefop_contract'] = $mapperFefopContract->save($dataContract);
}
$this->_data['amount'] = App_General_String::toFloat($this->_data['amount']);
$this->_data['date_start'] = $dateStart->toString('yyyy-MM-dd');
$this->_data['date_finish'] = $dateFinish->toString('yyyy-MM-dd');
$dataForm = $this->_data;
// Save the contract
$dataForm['id_ri_contract'] = parent::_simpleSave();
// Save budget category
$this->_saveExpenses($dataForm);
if (empty($this->_data['id_ri_contract'])) {
$history = 'REJISTU KONTRAKTU RI: %s';
} else {
$history = 'ATUALIZA KONTRAKTU RI: %s';
}
$history = sprintf($history, $dataForm['id_ri_contract']);
$this->_sysAudit($history);
if ($this->_data['amount'] > self::LIMIT_AMOUNT) {
$this->_sendWarningAmount($dataForm['id_ri_contract']);
}
$diff = $dateFinish->sub($dateStart);
$measure = new Zend_Measure_Time($diff->toValue(), Zend_Measure_Time::SECOND);
$diffMonth = preg_replace('/[^0-9.]/i', '', $measure->convertTo(Zend_Measure_Time::MONTH, 0));
if ((double) $diffMonth > self::MOUNTH_LIMIT) {
$this->_sendWarningDuration($dataForm['id_ri_contract']);
}
$dbAdapter->commit();
return $dataForm['id_ri_contract'];
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例10: _getDate
protected function _getDate($timeAmount, Zend_Date $date)
{
$nowDate = new Zend_Date();
$dateWithTimeAmount = $date->addHour($timeAmount);
if ($timeAmount == 0) {
$date = $date->addMinute(1);
} elseif ($timeAmount < 0 && $nowDate->isLater($dateWithTimeAmount)) {
$date = $nowDate->addMinute(1);
} else {
$date = $dateWithTimeAmount;
}
return $date;
}
示例11: 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;
}
示例12: assert
/**
* This assertion should receive the actual Submission objects.
*
* @param Zend_Acl $acl
* @param Zend_Acl_Role_Interface $user
* @param Zend_Acl_Resource_Interface $model
* @param $privilege
* @return bool
*/
public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $user = null, Zend_Acl_Resource_Interface $model = null, $privilege = null)
{
$conference = Zend_Registry::get('conference');
if (!isset($conference['review_visible'])) {
return true;
}
$now = new Zend_Date();
// perform check
if ($now->isLater($conference['review_visible'])) {
return true;
}
return false;
}
示例13: isValid
public function isValid($data)
{
$isValid = parent::isValid($data);
if (!empty($data['date_for']) && !empty($data['date_to'])) {
$date = new Zend_Date();
$date2 = clone $date;
$date->setDate($data['date_for'], 'YYYY-MM-dd')->getTimestamp();
$date2->setDate($data['date_to'], 'YYYY-MM-dd')->getTimestamp();
if ($date->isLater($date2)) {
$isValid = false;
$this->getElement('date_to')->addError("Data do nie może być wcześniejsza niż data od");
}
}
return $isValid;
}
示例14: getProductLabels
public function getProductLabels($product)
{
$html = '';
if (Mage::getStoreConfig('meigee_indigo_general/productlabels/labelnew')) {
$from = $product->getNewsFromDate();
$to = new Zend_Date($product->getNewsToDate());
$now = new Zend_Date(Mage::getModel('core/date')->timestamp(time()));
if (isset($from) && $to->isLater($now)) {
$html .= '<span class="label-new">' . $this->__('New') . '</span>';
}
}
if (Mage::getStoreConfig('meigee_indigo_general/productlabels/labelonsale') and $this->isOnSale($product)) {
$html .= '<span class="label-sale">' . $this->__('Sale') . '</span>';
}
return $html;
}
示例15: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$dateStart = new Zend_Date($this->_data['date_start']);
$dateFinish = new Zend_Date($this->_data['date_finish']);
$mapperExpense = new Fefop_Model_Mapper_Expense();
$item = $mapperExpense->getModuleToItem($this->_data['fk_id_fefop_modules']);
$mapperRule = new Fefop_Model_Mapper_Rule();
$mapperRule->validate($this->_message, $this->_data, $item);
// Check if the initial date is later than finish date
if ($dateStart->isLater($dateFinish)) {
$this->_message->addMessage('Data loron keta liu data remata.');
$this->addFieldError('date_start')->addFieldError('date_finish');
return false;
}
// If there is no contract yet
if (empty($this->_data['fk_id_fefop_contract'])) {
$dataContract = array('module' => $this->_data['fk_id_fefop_modules'], 'district' => $this->_data['fk_id_adddistrict']);
$mapperFefopContract = new Fefop_Model_Mapper_Contract();
$this->_data['fk_id_fefop_contract'] = $mapperFefopContract->save($dataContract);
}
$this->_data['amount'] = App_General_String::toFloat($this->_data['amount']);
$this->_data['date_start'] = $dateStart->toString('yyyy-MM-dd');
$this->_data['date_finish'] = $dateFinish->toString('yyyy-MM-dd');
$dataForm = $this->_data;
// Save the contract
$dataForm['id_per_contract'] = parent::_simpleSave();
$dataForm['fk_id_per_contract'] = $dataForm['id_per_contract'];
// Save budget category
$this->_saveExpenses($dataForm);
if (empty($this->_data['id_per_contract'])) {
$history = 'REJISTU KONTRAKTU PER: %s';
} else {
$history = 'ATUALIZA KONTRAKTU PER: %s';
}
$history = sprintf($history, $dataForm['id_per_contract']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $dataForm['id_per_contract'];
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}