<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of listAction
 *
 * @author yzxh24
 */
class listAction extends BaseAction
{
    public function run()
    {
        $criteria = $this->_buildCriteria(new CDbCriteria(array('with'=>'book')));

        $dataProvider = new CActiveDataProvider('ApplyBm',array('pagination' => array('pageSize' => 20)));
        $dataProvider->setCriteria($criteria);
        
        $this->getController()->render('list', array(
			'dataProvider' => $dataProvider,
		));
    }

    private function _buildCriteria(CDbCriteria $criteria)
    {
        $parmas = $_GET;
        if (isset($parmas['t-RangeStart_createdate']['value']))
        {
            $parmas['t-RangeStart_createdate']['value'] = strtotime($parmas['t-RangeStart_createdate']['value']);
        }

        if (isset($parmas['t-RangeEnd_createdate']['value']))
        {
            $parmas['t-RangeEnd_createdate']['value'] = strtotime($parmas['t-RangeEnd_createdate']['value']);
        }

        return Helper::buildCriteria($criteria, $parmas);
    }
}