This extension is a calendar based on The Coolest DHTML Calendar
It's an easy to use, light and fast calendar with many options
protected/extensionsCheck here the complete documentation of the calendar
See the following code example: A calendar that appears when an image is clicked
echo CHtml::activeLabelEx($event,'start_date'); <?php echo CHtml::activeTextField($event,'start_date',array("id"=>"start_date")); <?php echo CHtml::image("images/images.jpg","calendar", array("id"=>"c_button","class"=>"pointer")); (calendar appears when image is clicked) <?php $this->widget('application.extensions.calendar.SCalendar', array( 'inputField'=>'start_date', 'button'=>'c_button', 'ifFormat'=>'%Y-%m-%d', ));
A calendar that appears when a textfield is clicked
echo CHtml::activeLabelEx($event,'end_date'); <?php echo CHtml::activeTextField($event,'end_date',array("id"=>"end_date")); (calendar appears when textbox is clicked) <?php $this->widget('application.extensions.calendar.SCalendar', array( 'inputField'=>'end_date', 'ifFormat'=>'%Y-%m-%d', ));
A fixed position calendar displaying date and time with a range of 2008-2010
echo CHtml::activeLabelEx($event,'remind'); <?php echo CHtml::activeTextField($event,'remind',array("id"=>"remind")); (calendar with time , position 400,200 and a range 2008-2010) <?php $this->widget('application.extensions.calendar.SCalendar', array( 'inputField'=>'remind', 'ifFormat'=>'%Y-%m-%d %H:%M', 'showsTime'=>true, 'position'=>"[400,200]", 'range'=>"[2008,2010]" ));
Version 1.22
Fixed javascript error caused by boolean parameters (thanks to fhelix72)
Added step parameter for the years displayed in the calendar's year drop down menu (thanks to fhelix72)
Version 1.21
bug fix (handling undefined variables)
Version 1.2
Fixed bug with flatCallback, onSelect, onClose and onUpdate functions
Version 1.1
Fixes a bug with IE that made the widget useless
Total 19 comments
Hey I am using the following Code:
<?php echo CHtml::activeLabelEx($event,'end_date'); ?> <?php echo CHtml::activeTextField($event,'end_date',array("id"=>"end_date")); ?> (calendar appears when textbox is clicked) <?php $this->widget('application.extensions.calendar.SCalendar', array( 'inputField'=>'end_date', 'ifFormat'=>'%Y-%m-%d', )); ?>
I got the error that 'undefined variable: event'...So how to fix it??
Hello, Tell me please, how can I make the calendar be always displayed on the screen, allowing the user to select a date? Thanks
If you get some error messages when you first copy the calendar folder into your extensions folder. Make sure to set the right permissions (in Linux).
When you use it with CActive form, make sure not to include the array("id"=>"idoffield") and to set the 'inputField' config parameter to be the auto generated id of the field you refer to (this is usually FormName_fieldName).
Thank you
How to change default date in this extension? It is displaying current date by default right now
I want to change it with my custom date as default date. How can I do this?
a calendar is more like google's calendar, whereas a datepicker is for picking a date in a form field
Congrats on the extension! Super easy to use and a very powerful functionality ... For those that are in a hurry and getting the error, about the undefined variable, just delete ('skin'=>$skin, 'stylesheet'=>$style) to use the default styling.
Congrats again!
Please give me just one full working example with following missing data for: $event = ? $skin = ? ("aqua"?) $style = ? ("blue"?) Thanks,
Hi,
I think you shouldf add the following code at ca. line 509 in SCalendar.php:
Regards,
Joachim
Hi, What is the value of the $style and $skin you use? Also check the jscalendar's home page to see if the bug happens there too. http://www.dynarch.com/static/jscalendar-1.0/simple-1.html
If you have any other questions please post them in the forum thread http://www.yiiframework.com/forum/index.php?/topic/2337-extension-calendar/
Hey, guys,
I'm using the following code:
Yii 1.0.9, Linux, Firefox 3.5
The calendar object is shown fine, but 17th, October (today) is shown twice, in Saturday and Sunday...and it changes all the rest of month...any idea on how to solve this bug?
Thanks!!
If you want to manage the 'Step' parameter that is contemplated in DHTML Calendar for change the step between years in the drop down list (default=2) you must make these changes to SCalendar.php:
In the begin add to the other parameters: /* @var $_step Integer private $_step;
Add this new function: /*** * @param integer $step */ public function setStep($step) { if(is_numeric($step) && ($step >-1)) { $this->_step = $step; } else { $this->_step = 2; } }
Add in createMarkup function: if(isset ($this->_step)) $prop .= "step : $this->_step,\n";
I found that all the boolean parameters causes a javascript error if they are used (true or false), they are: singleClick, weekNumbers, showsTime, electric, cache, showOthers The problem is that they must be passed to js surrounded by '' So you should substitute in the createMarkup function of SCalendar.php the 6 rows of the above parameters from:
to
WOW.!! Thank you so much to the Author
There was an error in the SCalendar.php You should change line 486 from
to
Then the calendar has to be a flat one Then use this code
Now wondering how to use this?
function dateChanged(calendar) {
if (calendar.dateClicked) { var y = calendar.date.getFullYear(); var m = calendar.date.getMonth(); var d = calendar.date.getDate(); window.location = "/" + y + "/" + m + "/" + d + "/index.php"; }Liked it and planed to use for the flat & flatCallback options it provides, but ..
really good calendar. having time editing is really cool. 10x :)
This "calendar" is much better in my opinion then the only other viable alternative, jui.EDatePicker.
The EDatePicker although useable with some minor code modifications, is really very basic with a crude graphical user interface.
This calendar however offers EVERYTHING and it works great without any modifications. The graphical user interface is intuitive and very advanced as well as easy to control. Thanks!
really good calendar extension
Leave a comment
Please login to leave your comment.