Yii 1.1: ecountdownaction

Countdown Action Widget
8 followers

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');",
        )
      );
?>

Total 3 comments

#6193 report it
Daniel at 2011/12/19 04:41am
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!

#6109 report it
ytannus at 2011/12/13 09:41am
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 ;)

#6108 report it
allain at 2011/12/13 08:59am
Advantages?

What advantages does this have over a pure JavaScript solution?

Leave a comment

Please to leave your comment.

Create extension