This extension provides tools to add the 'recurring events' feature to your application.
The widget displays a form together with your eventmodel, witch generates one or more recurrence rule (see iCalendar spec It uses the library 'WHEN' from T. Planer to calculate the datetimes from rules and to show a preview the datetimes as list or in a calendar. More included third party tools see Resources below.
This extension is very easy to use and supports languages and jquery ui themes.
Adds a 'rulescontainer' to your model edit/create form It contains multiple recurring rules/except rules as hidden inputs and a userfriendly description of the rule
Adds a form where the user can generate the rule (Every first sunday, monday in feb ...)
Adds buttons/icons to preview the resulting datetimes as list or in a calendar
Adds a button to add the rule to the rulescontainer

class EventController extends Controller { /** * Declares class-based actions. */ public function actions() { return array( .... 'rruleform'=>array( 'class'=>'ext.recur.components.RRuleFormAction', ), ); }
Yii::import('ext.recur.models.*'); ... public function actionCreate() { $model = new Event(); //your Event, Exhibition, whatever-model ... //handle your model ... $rrules = RRules::createFromPOST(); $this->render('create',array('model'=>$model,'rrules'=>$rrules); }
See demo app: views/site/eventform.php
<div class="form"> <?php // show the errors of the rrules model too echo CHtml::errorSummary(array_merge(array($model),$rrules)); echo CHtml::beginForm(); <div class="row"> <?php ..... // show your event input fields here .... //Create the widget inside the events form //This will create the rulescontainer $recurWidget = $this->widget('ext.recur.components.RRuleForm', array( //'theme' => 'cupertino', 'rrules' => $rrules, ) ); //display the preview buttons $recurWidget->renderRulesListPreviewButton(); $recurWidget->renderRulesCalPreviewButton(); echo CHtml::submitButton('Submit'); //the event form echo CHtml::endForm(); //end of the event form //render the rrule-form outside the event-form $recurWidget->renderForm();
See the demo and code for more details or options.
This extension doesn't provide AR models for the db, but it should be easy to implement this. You can save the rule-strings directly to the db or generate a 'EventRRules'- AR-model. Use RRules::getRules(); to get the array of string rules for save to db.
See the 'pseudo-code' in SiteController::actionIndex from the demo app.
TIP: If you want to display the datetime of a lot of events it may be useful to save the generated datetimes of the rules too. This will save memory and will increase performance if not for every event/rule the datetimes have to be calculated. You can use RRules->getDateTimes() for that purpose.
And: Take a look at the code...
Use the 'rruleform.php' view or 'rrule_summary.php' as template to generate your own rruleform/summary views. You can register the customized views with the widget attributes formView / ruleSummaryView.
Many thanks to the authors.
Total 4 comments
recur on github
Is this source available on github (or anywhere else) as a public repository?
Thx for the contribution!
great extension. only problem is lack of proper documentation. But loved it, saved a lot of time.
Thanks joblo.
hy. i have this error. anybody have good idea?
Leave a comment
Please login to leave your comment.