This simple widget allows to trigger an action after a given time in seconds...
Requirements ¶
- Yii >= 1.1
Usage ¶
- Set the time in seconds
- Write the action code
- Enjoy it!
$this->widget('ext.ecountdownaction.ECountdownAction',
array(
'seconds'=>8, //8 seconds
'action'=>'{alert("hello world!")}', //action code...
)
);
Another example using bootstrap extension, auto opening a modal window:
$this->widget('ext.ecountdownaction.ECountdownAction',
array(
'seconds'=>3,
'action'=>"$('#modal').bootModal('open');",
)
);
?>
Advantages?
What advantages does this have over a pure JavaScript solution?
Re: Advantages?
Hi!, of course you can do it using pure javascript code. This widget is really basic, is just a simple yii-widget implementation, you can use it as reference to create another widget...
Maybe a good improvement could be reading action from a model ;)
Usages?
Hi,
One of a usage that I can think of is for screen lock, any others? Although, I only have the idea not implementation ;)
Is that possible to change the 'seconds' dynamically?
My idea is to lock the screen if no activity in 5 seconds, unless the user doing something.
Thanks and good extension anyway!
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.