本文整理汇总了PHP中QDateTime::IsEarlierThan方法的典型用法代码示例。如果您正苦于以下问题:PHP QDateTime::IsEarlierThan方法的具体用法?PHP QDateTime::IsEarlierThan怎么用?PHP QDateTime::IsEarlierThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::IsEarlierThan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Validate
public function Validate()
{
if (!parent::Validate()) {
return false;
}
if ($this->strText != '') {
$dttDateTime = new QDateTime($this->strText);
if ($dttDateTime->IsDateNull()) {
$this->strValidationError = QApplication::Translate("invalid date");
return false;
}
if (!is_null($this->Minimum)) {
if ($dttDateTime->IsEarlierThan($this->Minimum)) {
$this->strValidationError = QApplication::Translate("date is earlier than minimum allowed");
return false;
}
}
if (!is_null($this->Maximum)) {
if ($dttDateTime->IsLaterThan($this->Maximum)) {
$this->strValidationError = QApplication::Translate("date is later than maximum allowed");
return false;
}
}
}
$this->strValidationError = '';
return true;
}
示例2: Validate
/**
* Validate the control.
* @return bool
*/
public function Validate()
{
if (!parent::Validate()) {
return false;
}
if ($this->strText != '') {
$dttDateTime = new QDateTime($this->strText, null, QDateTime::DateOnlyType);
if ($dttDateTime->IsDateNull()) {
$this->ValidationError = QApplication::Translate("Invalid date");
return false;
}
if (!is_null($this->Minimum)) {
if ($dttDateTime->IsEarlierThan($this->Minimum)) {
if ($this->strMinDateErrorMsg) {
$this->ValidationError = $this->strMinDateErrorMsg;
} else {
$this->ValidationError = QApplication::Translate("Date is earlier than minimum allowed");
}
return false;
}
}
if (!is_null($this->Maximum)) {
if ($dttDateTime->IsLaterThan($this->Maximum)) {
if ($this->strMaxDateErrorMsg) {
$this->ValidationError = $this->strMaxDateErrorMsg;
} else {
$this->ValidationError = QApplication::Translate("Date is later than maximum allowed");
}
return false;
}
}
}
return true;
}
示例3: GenerateStewardship
public static function GenerateStewardship()
{
$dttDate = new QDateTime('2004-01-05');
print 'Generating Stewardship... ';
$objFundArray = StewardshipFund::QueryArray(QQ::NotEqual(QQN::StewardshipFund()->Id, 1));
while ($dttDate->IsEarlierThan(QDateTime::Now())) {
print $strDate = '[' . $dttDate->ToString('YYYY-MMM-DD') . ']';
$intCheckCount = rand(10, 55);
$arrStack = array();
for ($i = 0; $i < floor(($intCheckCount - 1) / 25) + 1; $i++) {
$arrStack[] = null;
}
$objBatch = StewardshipBatch::Create(self::GenerateFromArray(self::$StewardshipUserArray), $arrStack, self::GenerateFromArray(array('Weekend T/O', 'Weekend Giving', 'Tithes and Offerings', 'Tithes & Offerings', null)), $dttDate, $dttDate);
$intStackCount = $objBatch->CountStewardshipStacks();
$dttStart = new QDateTime($dttDate);
$dttStart->SetTime(8, 0, 0);
$dttEnd = new QDateTime($dttDate);
$dttEnd->SetTime(16, 0, 0);
for ($i = 0; $i < $intStackCount; $i++) {
if ($i == $intStackCount - 1) {
if ($intCheckCount % 25 == 0) {
$intChecksInStackCount = 25;
} else {
$intChecksInStackCount = $intCheckCount % 25;
}
} else {
$intChecksInStackCount = 25;
}
$objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($objBatch->Id, $i + 1);
for ($j = 0; $j < $intChecksInStackCount; $j++) {
$objHousehold = self::GenerateFromArray(self::$HouseholdArray);
$objHouseholdParticipant = self::GenerateFromArray($objHousehold->GetHouseholdParticipationArray());
$mixAmountArray = array();
if (rand(0, 50)) {
$mixAmountArray[] = array(1, rand(1000, 150000) / 100);
} else {
$mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
}
if (!rand(0, 20)) {
$mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
}
$objContribution = StewardshipContribution::Create($objBatch->CreatedByLogin, $objHouseholdParticipant->Person, $objStack, StewardshipContributionType::Check, rand(1000, 9999), $mixAmountArray, self::GenerateDateTime($dttStart, $dttEnd), null, null, null, false);
if (rand(0, 5)) {
$objContribution->SaveImageFile(__DEVTOOLS_CLI__ . '/datagen_file_assets/check.tif');
}
}
$objStack->RefreshActualTotalAmount();
}
if ($intCheckCount != $objBatch->CountStewardshipContributions()) {
print "\r\n" . 'MISCOUNT: ' . $objBatch->Id . "\r\n";
}
$objBatch->RefreshActualTotalAmount();
$dttDate->Day += 7;
print str_repeat(chr(8) . ' ' . chr(8), strlen($strDate));
}
print "Done.\r\n";
}
示例4: __toStringStatusWithHovertip
/**
* Returns the status (with hovertip) of a Receipt based on it's ReceivedFlag
*
* @param QDatagrid Object $objControl
* @return string that says either Received or Pending with a hovertip if the Receipt is overdue
*/
public function __toStringStatusWithHovertip($objControl)
{
$dtsDueDate = new QDateTime($this->DueDate);
$dtsToday = new QDateTime(date('Y-m-d'));
if ($this->ReceivedFlag) {
$strToReturn = 'Received';
} elseif ($this->DueDate && $dtsDueDate->IsEarlierThan($dtsToday)) {
//$now = new QDateTime(QDateTime::Now);
$dtsDifference = $dtsToday->Difference($dtsDueDate);
$lblStatus = new QLabelExt($objControl);
$lblStatus->HtmlEntities = false;
$lblStatus->Text = '<strong style="color:#BC3500;">Pending</strong>';
// create hovertip
$objHoverTip = new QHoverTip($lblStatus);
$lblOverdue = new QLabel($objHoverTip);
$lblOverdue->Text = $dtsDifference->Days == 0 ? 'Due today' : sprintf('%s days overdue', $dtsDifference->Days);
$objHoverTip->AutoRenderChildren = true;
$lblStatus->HoverTip = $objHoverTip;
$strToReturn = $lblStatus->Render(false);
} elseif ($this->DueDate && ($dtsDueDate->IsLaterThan($dtsToday) || $dtsDueDate->IsEqualTo($dtsToday))) {
$dtsDifference = $dtsDueDate->Difference($dtsToday);
$lblStatus = new QLabelExt($objControl);
$lblStatus->HtmlEntities = false;
$lblStatus->Text = '<strong style="color:#CC9933">Pending</strong>';
// create hovertip
$objHoverTip = new QHoverTip($lblStatus);
$lblDueIn = new QLabel($objHoverTip);
$lblDueIn->Text = $dtsDifference->Days == 0 ? 'Due today' : sprintf('Due in %s days', $dtsDifference->Days);
$objHoverTip->AutoRenderChildren = true;
$lblStatus->HoverTip = $objHoverTip;
$strToReturn = $lblStatus->Render(false);
} else {
$strToReturn = '<strong style="color:#CC9933;">Pending</strong>';
}
return sprintf('%s', $strToReturn);
}