Метод поиска Yii не работает и не сравнивается с данными в базе данных

Привет вчера я попробовал один способ создать поиск по дате и времени, и вы можете увидеть ссылку:Задача поиска на следующий пост. Сегодня я пробую другой путь: когда я преуспею, я верну решение, спасибо.

Это мой файл поиска:

<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
<?php
/* @var $this ApplicationController */
/* @var $model Application */
/* @var $form CActiveForm */
?>

<div class="wide form">

<?php $form=$this->beginWidget('CActiveForm', array(
    'action'=>Yii::app()->createUrl($this->route),
    'method'=>'get',
        'enableAjaxValidation'=>false,
        //$model->search(),
)); ?>
<div class="row">
        <?php echo $form->label($model,'AUUsername'); ?>
        <?php echo $form->textField($model,'AUUsername',array('size'=>45,'maxlength'=>45)); ?>
    </div>
    <div class="row">
        <?php
        //datepicker for date_from 
        echo CHtml::label("From date", 'datepicker');
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'name' => 'filters[date_from]',
            //'value' => $filters['date_from'],
            // additional javascript options for the date picker plugin
            'options' => array(
                    'showButtonPanel' => true,
                'showAnim' => 'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
                'dateFormat'=>'yyyy-mm-dd hh:mm:ss',
                ),
            'htmlOptions' => array(
                'id'=>'date_from',  
                ),
            ));?>
        </div>
        <div class="row">
            <?php
                //datepicker for date to
            echo CHtml::label("To date", 'datepicker');
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                    'name' => 'filters[date_to]',
                //'value' => $filters['date_to'],
                // additional javascript options for the date picker plugin
                'options' => array(
                    'showButtonPanel' => true,
                    'showAnim' => 'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
                    'dateFormat'=>'yyyy-mm-dd hh:mm:ss',
                ),
                'htmlOptions' => array(
                    'id'=>'date_to',    
                    ),
                ));?>
        </div>
    <div class="row buttons">
        <?php echo CHtml::submitButton('Search'); ?>
    </div>
    <?php $this->endWidget(); ?>
</div>

Это мой файл модели:

<?php
class AppLog extends AltActiveRecord 
{
    private $_ActionName=null;

    public $date_from;
    public $date_to;

    public function getDbConnection(){
        return Yii::app()->connectionManager->getConnection(Yii::app()->user->getState('application'));
    } 

    public function relations ()
    {
        return array (
            'actions'=>array(self::HAS_ONE, 'Actions', array('ActionID'=>'ActionID')),
        );  
    }   

    public function getActionName()
    {
        if ($this->_ActionName === null && $this->actions !== null)
        {
            $this->_ActionName = $this->actions->ActionName;
        }
        return $this->_ActionName;
    }

    public function setActionName($value)
    {
        $this->_ActionName = $value;
    }  

    public function tableName()
    {
            return 'applog';
    }

    public function rules()
    {
        return array(                    
                array('AppUserID','length', 'max'=>11),
                array('AUUsername','length', 'max'=>45),

                array('AUActionTime','type','type'=>'datetime','datetimeFormat'=>'yyyy-mm-dd hh:mm:ss'),

                // The following rule is used by search().
                // @todo Please remove those attributes that should not be searched.
                array('AppUserID,AUUsername, date_from, date_to', 'safe', 'on'=>'search'),

        );
    }

    public function attributeLabels()
    {
        return array(
                'ActionID' => 'ID',
                'AUUsername' => 'Naziv korisnika',

                'AUActionTime' => 'Vrijeme akcije',

        );
    }

    public function search()
    {

        $criteria=new CDbCriteria;
        $criteria->compare('APUsername',$this->AUUsername,true);

        $criteria->compare('AUActionTime',$this->AUActionTime,true);
        $criteria->compare('date_from',$this->date_from,true);
        $criteria->compare('date_to',$this->date_to,true);     
        return new CActiveDataProvider($this, array(
                'criteria'=>$criteria,
        ));
    }

    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }
}
?>

ЭТО МОЙ КОНТРОЛЛЕР ДЕЙСТВИЯ ДЛЯ ПОИСКА

public function actionLista()
{
    $model = new Datalist;
    $this->layout='column1';
    //

    if($_GET!=null) 
    {
        $date_from = $_GET['filters']['date_from'];

        $params[':date_from'] = date('yyyy-mm-dd hh:mm:ss', strtotime($_GET['filters']['date_from']));
        $date_to = $_GET['filters']['date_to'];
        $params[':date_to'] = date('yyyy-mm-dd hh:mm:ss', strtotime($_GET['filters']['date_to']));

        if($date_from == '') $params[':date_from'] = date('yyyy-mm-dd hh:mm:ss', strtotime('2014-01-01 00:00:00'));
        if($date_to == '') $params[':date_to'] = date('yyyy-mm-dd hh:mm:ss', strtotime('2999-01-01 00:00:00'));
        //$condition = '(AUActionTime>:date_from OR AUActionTime<:date_to)';


        //set filters
        //$this->setFilters($_GET['filters']);
        //die(CVarDumper::dump($params,10,true));                        
    }
    else {
        $this->filters = array(
        'date_from' => date('yyyy-mm-dd hh:mm:ss', strtotime('2014-01-01')),
        'date_to' => date('yyyy-mm-dd hh:mm:ss', strtotime('today + 1 day')),
        );
    }

Ответы на вопрос(1)

Ваш ответ на вопрос