Modifying The Output In The Admin Page

CREATE TABLE attendance (

id int(10) NOT NULL AUTO_INCREMENT,

classId varchar(3) NOT NULL,

admissionId varchar(8) NOT NULL,

nameWithInitials varchar(100) DEFAULT NULL,

Date date DEFAULT NULL,

status tinyint(1) DEFAULT ‘1’,

PRIMARY KEY (id);

My table is attendance. When I load the page I want only the details of a given date (not all the records available in the table), in the gridview in admin page. How do I get that. Thank u in advance! :)

Hi

You can change the model search function

just like




if(isset($this->venue_category_id) && !empty($this->venue_category_id)){

			$criteria->select = '*';

			$criteria->addCondition("FIND_IN_SET ($this->venue_category_id,venue_category_id)");

		}

I made the modification in the search function… but still I’m not getting the correct output…

can u post the code?

public function search()

{





	$criteria=new CDbCriteria;


            


            


           if(isset($this->Date)){


                    $criteria->select = '*';


                    $criteria->addCondition("FIND_IN_SET ($this->2013-06-05,Date)");


            }


            


            





	$criteria->compare('id',$this->id);


	$criteria->compare('classId',$this->classId,true);


	$criteria->compare('admissionId',$this->admissionId,true);


	$criteria->compare('nameWithInitials',$this->nameWithInitials,true);


	//$criteria->compare('Date',$this->Date,true);


	$criteria->compare('status',$this->status);





	return new CActiveDataProvider($this, array(


		'criteria'=>$criteria,


	));


}

This is my modified search function

Thank u for the help! :)

Hi,

please change the line


$criteria->addCondition($this->2013-06-05,Date);

I got it working… had to change the actionadmin.





 $date= "SELECT DATE(now())";

 $mydate = Yii::app()->db->createCommand($date)->queryScalar();




                $model=new Studentattendances('search');

		$model->unsetAttributes();  

                $model->Date=$mydate;

		if(isset($_GET['Studentattendances']))

			$model->attributes=$_GET['Studentattendances'];


		$this->render('admin',array(

			'model'=>$model,

		));