Yii Automatic Trigger A Popup Based On Mysql Data

Hello Guys,

I have a condition to make a code and I’m totally unable to make this.

The condition is that I have some records in the database with specific dates and i want to display a reminder popup before that date.

For example I’ve fixed an exam date (2014-08-30) in the database. Now whenever user will signin then the automatically generated popup will come onto my screen as a reminder i.e the exam will on this date.

can we make this guys, if yes then please help to do this. It will really appreciable. Thanks in advance.

What you can do is create a widget (http://www.yiiframework.com/doc/guide/1.1/en/basics.view#widget) and call it inside your views/layouts/main.php file only when the user has been authenticated like:




if (!Yii::app()->user->isGuest)

{

	$this->widget('Alert', array(

		'accountId' => Yii::app()->user->id,

	));

}



This widget would grab all alerts/events/etc for the account id that was passed to it (the logged user in this case) and you can display them however you want in the widget view file. To give you an idea, use a plugin like jquery noty and create your notifications through javascript inside that view file.