本文整理汇总了PHP中Zend_Date::compareTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::compareTimestamp方法的具体用法?PHP Zend_Date::compareTimestamp怎么用?PHP Zend_Date::compareTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::compareTimestamp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNumFree
/**
*
* Checks if invites exists or can be created
*/
public function getNumFree()
{
$auth = Zend_Auth::getInstance();
$signedUserInfo = self::$_registry->get("signedUserInfo");
$membershipdate = new Zend_Date($signedUserInfo['membershipdate'], Zend_Date::ISO_8601);
if ($membershipdate->compareTimestamp(time() - self::NEW_USER * 86400) == 1) {
return -1;
}
$date = new Zend_Date();
$select = $this->_dbTable->select()->where("uid = ?", $auth->getIdentity())->where("used = ?", "1")->where("timestamp > DATE_ADD(?, INTERVAL -" . self::MAX_DAYS . " DAY)", $date->get("yyyy-MM-dd HH:mm:ss"));
$used = $this->_dbAdapter->fetchAll($select);
$usedNum = sizeof($used);
return self::MAX_INVITES - $usedNum;
}
示例2: testCompareTimestamp
/**
* Test for compareTimestamp
*/
public function testCompareTimestamp()
{
$locale = new Zend_Locale('de_AT');
$date1 = new Zend_Date(0, null, $locale);
$date2 = new Zend_Date(0, null, $locale);
$this->assertSame(0, $date1->compareTimestamp($date2));
$date2 = new Zend_Date(100, null, $locale);
$this->assertSame(-1, $date1->compareTimestamp($date2));
$date2 = new Zend_Date(-100, null, $locale);
$this->assertSame(1, $date1->compareTimestamp($date2));
}
示例3: testCompareTimestamp2
/**
* Test for compareTimestamp
*/
public function testCompareTimestamp2()
{
$locale = new Zend_Locale('de_AT');
$date1 = new Zend_Date(0, false, $locale);
$date2 = new Zend_Date(100, false, $locale);
$this->assertSame($date1->compareTimestamp($date2), '-100');
}
示例4: sendNewsletterAction
public function sendNewsletterAction()
{
$releaseID = $this->_getParam('newsletterID');
$this->view->assign('releaseID', $releaseID);
if ($this->_request->isPost()) {
$this->_redirect("/newsletter/index/edit/newsletterID/{$releaseID}");
} elseif (empty($releaseID)) {
/*
* The following part of code is to send data with CRON task.
* Code not finished. To be implemented in further version.
*/
$this->disableView();
// $releaseId = $this->_getParam('newsletterID');
$oNewsRelease = new NewsletterReleases();
$primary = $oNewsRelease->info('primary');
$select = $oNewsRelease->select()->from($oNewsRelease->info('name'));
$nrData = $oNewsRelease->fetchAll($select)->toArray();
$listSent = array();
$listDest = array();
$listIds = array();
foreach ($nrData as $release) {
$scheduled = $release['NR_MailingDateTimeScheduled'];
$oDate = new Zend_Date($scheduled, 'fr');
$now = Zend_Date::now('fr')->getTimestamp();
$timeToSend = $oDate->compareTimestamp($now);
if ($timeToSend < 1 && (int) $release['NR_Status'] != 1 && $oDate->get() > 0) {
$massMailingResults = $this->sendMassMailingAction($release['NR_ID']);
array_push($listSent, $release['NR_Title']);
array_push($listIds, $release['NR_ID']);
array_push($listDest, $release['NR_AdminEmail']);
}
}
if (!empty($listDest) || !empty($listSent) || !empty($listIds)) {
$data = array('list' => $listSent, 'dest' => $listDest, 'ids' => $listIds);
$this->_adminNotification($data);
$this->_logSending($data);
}
}
}