當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DateTimeHelper::getDefaultEndRangeFilter方法代碼示例

本文整理匯總了PHP中DateTimeHelper::getDefaultEndRangeFilter方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateTimeHelper::getDefaultEndRangeFilter方法的具體用法?PHP DateTimeHelper::getDefaultEndRangeFilter怎麽用?PHP DateTimeHelper::getDefaultEndRangeFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DateTimeHelper的用法示例。


在下文中一共展示了DateTimeHelper::getDefaultEndRangeFilter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     if (isset($_GET["Audit"])) {
         $dH = new DateTimeHelper();
         $dtFrom = $dH->getDateTimeFromUI($_GET["Audit"]["dateTimeFrom"]);
         $dtTo = $dH->getDateTimeFromUI($_GET["Audit"]["dateTimeTo"]);
         if ($desde !== false) {
             $criteria->addCondition('date_time >= ' . $dtFrom->getTimestamp());
         } else {
             $criteria->addCondition('date_time >= ' . $dH->getDefaultStartRangeFilter("")->getTimestamp());
         }
         if ($hasta !== false) {
             $criteria->addCondition('date_time <= ' . $dtTo->getTimestamp());
         } else {
             $criteria->addCondition('date_time <= ' . $dH->getDefaultEndRangeFilter("audit")->getTimestamp());
         }
     }
     $criteria->compare('object', $this->object, true);
     $criteria->compare('operation', $this->operation, true);
     $criteria->compare('description', $this->description, true);
     $criteria->compare('user', $this->user, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
開發者ID:pelo8888,項目名稱:php-angular-yii,代碼行數:37,代碼來源:Audit.php

示例2: actionAdmin

 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Audit('search');
     $model->unsetAttributes();
     if (isset($_GET['Audit'])) {
         $model->attributes = $_GET['Audit'];
     }
     $dH = new DateTimeHelper();
     if (isset($_GET["Audit"]["dateTimeFrom"]) && strcmp($_GET["Audit"]["dateTimeFrom"], "") !== 0) {
         $model->dateTimeFrom = $_GET["Audit"]["dateTimeFrom"];
     } else {
         $model->dateTimeFrom = $dH->getDefaultStartRangeFilter("")->format(Yii::app()->params["dateTimeDisplayFormat"]);
     }
     if (isset($_GET["Audit"]["dateTimeTo"]) && strcmp($_GET["Audit"]["dateTimeTo"], "") !== 0) {
         $model->dateTimeTo = $_GET["Audit"]["dateTimeTo"];
     } else {
         $model->dateTimeTo = $dH->getDefaultEndRangeFilter("")->format(Yii::app()->params["dateTimeDisplayFormat"]);
     }
     $this->render('admin', array('model' => $model));
 }
開發者ID:MRodriguez08,項目名稱:yii-bundles-app,代碼行數:23,代碼來源:AuditController.php


注:本文中的DateTimeHelper::getDefaultEndRangeFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。