当前位置: 首页>>代码示例>>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;未经允许,请勿转载。