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


PHP QDateTime::IsLaterThan方法代码示例

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


在下文中一共展示了QDateTime::IsLaterThan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:27,代码来源:QDatepickerBoxBase.class.php

示例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;
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:38,代码来源:QDatepickerBoxBase.class.php

示例3: btnSave_Click

 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $this->objPerson->Title = $this->lstTitle->SelectedValue;
     $this->objPerson->FirstName = trim($this->txtFirstName->Text);
     $this->objPerson->MiddleName = trim($this->txtMiddleName->Text);
     $this->objPerson->LastName = trim($this->txtLastName->Text);
     $this->objPerson->Suffix = $this->lstSuffix->SelectedValue;
     $this->objPerson->Nickname = trim($this->txtNickname->Text);
     $this->objPerson->PriorLastNames = trim($this->txtPriorLastNames->Text);
     $this->objPerson->MailingLabel = trim($this->txtMailingLabel->Text);
     $this->objPerson->Gender = trim($this->lstGender->SelectedValue);
     // Date of Birth Stuff
     switch ($this->lstDateOfBirth->SelectedValue) {
         case self::DobNone:
             $this->objPerson->DateOfBirth = null;
             $this->objPerson->DobGuessedFlag = null;
             $this->objPerson->DobYearApproximateFlag = null;
             break;
         case self::DobExact:
             $this->objPerson->DateOfBirth = $this->dtxDateOfBirth->DateTime;
             $this->objPerson->DobGuessedFlag = false;
             $this->objPerson->DobYearApproximateFlag = false;
             break;
         case self::DobApproximateDay:
             if ($this->objPerson->DateOfBirth) {
                 $dttDate = new QDateTime($this->objPerson->DateOfBirth);
                 $dttDate->Year = QDateTime::Now()->Year;
                 if ($dttDate->IsLaterThan(QDateTime::Now())) {
                     $dttDate->Year -= 1;
                 }
             } else {
                 $dttDate = QDateTime::Now();
                 $dttDate->Month -= 6;
             }
             $dttDate->Year -= $this->txtAge->Text;
             $this->objPerson->DateOfBirth = $dttDate;
             $this->objPerson->DobGuessedFlag = true;
             $this->objPerson->DobYearApproximateFlag = false;
             break;
         case self::DobApproximateYear:
             $dttDate = QDateTime::Now();
             $dttDate->Month = $this->lstMonth->SelectedValue;
             $dttDate->Day = $this->lstDay->SelectedValue;
             if ($dttDate->IsLaterThan(QDateTime::Now())) {
                 $dttDate->Year -= 1;
             }
             $dttDate->Year -= $this->txtAge->Text;
             $this->objPerson->DateOfBirth = $dttDate;
             $this->objPerson->DobGuessedFlag = false;
             $this->objPerson->DobYearApproximateFlag = true;
             break;
         case self::DobApproximateYearAndDay:
             if ($this->objPerson->DateOfBirth) {
                 $dttDate = new QDateTime($this->objPerson->DateOfBirth);
                 $dttDate->Year = QDateTime::Now()->Year;
                 if ($dttDate->IsLaterThan(QDateTime::Now())) {
                     $dttDate->Year -= 1;
                 }
             } else {
                 $dttDate = QDateTime::Now();
                 $dttDate->Month -= 6;
             }
             $dttDate->Year -= $this->txtAge->Text;
             $this->objPerson->DateOfBirth = $dttDate;
             $this->objPerson->DobGuessedFlag = true;
             $this->objPerson->DobYearApproximateFlag = true;
             break;
         default:
             throw new Exception('Invalid DOB Type');
     }
     $this->objPerson->RefreshAge(false);
     // Deceased Flag and Date
     if ($this->objPerson->DeceasedFlag = $this->chkDeceased->Checked) {
         $this->objPerson->DateDeceased = $this->dtxDateDeceased->DateTime;
         // Also unsubscribe from church newsletter
         $objList = CommunicationList::LoadByToken('allchurch_nl');
         if ($objList->IsPersonAssociated($this->objPerson)) {
             $objList->UnassociatePerson($this->objPerson);
         }
     } else {
         $this->objPerson->DateDeceased = null;
     }
     $this->objPerson->Save();
     $this->objPerson->RefreshNameItemAssociations();
     // Refresh Name of teh Household (if applicable)
     if ($this->objPerson->HouseholdAsHead) {
         $this->objPerson->HouseholdAsHead->RefreshName();
     }
     foreach ($this->objPerson->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
         $objHouseholdParticipation->Household->RefreshMembers();
     }
     QApplication::ExecuteJavaScript('document.location = "#general";');
 }
开发者ID:alcf,项目名称:chms,代码行数:93,代码来源:Vicp_GeneralProfile_EditName.class.php


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