This extension is a calendar based on The Coolest DHTML Calendar
It's an easy to use, light and fast calendar with many options
Resources ¶
Documentation ¶
Requirements ¶
- Yii 1.0 or above
Installation ¶
- Extract the release file under
protected/extensions
Documentation ¶
Check here the complete documentation of the calendar
Usage ¶
See the following code example: A calendar that appears when an image is clicked
<?php 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
<?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',
));
?>
A fixed position calendar displaying date and time with a range of 2008-2010
<?php 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]"
));
?>
Change Log ¶
August 18, 2009 ¶
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)
July 16, 2009 ¶
Version 1.21
bug fix (handling undefined variables)
June 23, 2009 ¶
Version 1.2
Fixed bug with flatCallback, onSelect, onClose and onUpdate functions
June 2, 2009 ¶
Version 1.1
Fixes a bug with IE that made the widget useless
May 29, 2009 ¶
- Initial release.
Powerfull and easy to integrate extension!
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!
More guide please
Please give me just one full working example with following missing data for:
$event = ?
$skin = ? ("aqua"?)
$style = ? ("blue"?)
Thanks,
Language Property
Hi,
I think you shouldf add the following code at ca. line 509 in SCalendar.php:
if(isset ($this->_language)) $prop .= "language : '$this->_language',\n";
Regards,
Joachim
Is It a bug?
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/
is it a bug?
Hey, guys,
I'm using the following code:
<?php echo CHtml::activeLabelEx($model,'promotionDateStart'); ?> <?php echo CHtml::activeTextField($model,'promotionDateStart',array('id'=>'promotionDateStart')); ?> <?php echo CHtml::image(Yii::app()->baseUrl."/images/site/calendar.jpg","calendar", array("id"=>"ds_button","class"=>"pointer")); ?> <?php $this->widget('application.extensions.calendar.SCalendar', array( 'inputField'=>'promotionDateStart', 'button'=>'ds_button', 'skin'=>$skin, 'stylesheet'=>$style, 'ifFormat'=>'%Y-%m-%d', 'range'=>'[2000,2050]', 'cache'=>true, //'showOthers'=>false, //'showsTime'=>false, //'timeFormat'=>'24', 'language'=>'br', )); ?>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!!
To use Step Parameter
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";
Error in SCalendar.php for boolean parameters
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:
if(isset ($this->_PARAMETER)) $prop .= "PARAMETER : $this->_PARAMETER,\n";
to
if(isset ($this->_PARAMETER)) $prop .= "PARAMETER : '$this->_PARAMETER',\n";
I do love this thing
WOW.!! Thank you so much to the Author
flatCallback
There was an error in the SCalendar.php
You should change line 486
from
if(isset ($this->_flatCallback)) $prop .= "flatCallback : '$this->_flatCallback',\n";
to
if(isset ($this->_flatCallback)) $prop .= "flatCallback : $this->_flatCallback,\n";
Then the calendar has to be a flat one
Then use this code
<script type="text/javascript"> function dateChanged(calendar) { // Beware that this function is called even if the end-user only // changed the month/year. In order to determine if a date was // clicked you can use the dateClicked property of the calendar: if (calendar.dateClicked) { // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php var y = calendar.date.getFullYear(); var m = calendar.date.getMonth(); // integer, 0..11 var d = calendar.date.getDate(); // integer, 1..31 // redirect... window.location = "/" + y + "/" + m + "/" + d + "/index.php"; } }; </script> <div id="calendar-container"></div> <?php $this->widget('application.extensions.calendar.SCalendar', array( 'flat'=> 'calendar-container', 'ifFormat'=>'%Y-%m-%d', 'flatCallback'=>'dateChanged' )); ?>
My BAD, this version is under LGPL
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"; }
Not free for comercial use
Liked it and planed to use for the flat & flatCallback options it provides, but ..
nice
really good calendar. having time editing is really cool. 10x :)
The "better" date picker
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
really good calendar extension
Looks like a datepicker not a calendar
a calendar is more like google's calendar, whereas a datepicker is for picking a date in a form field
change default date
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?
Just 2 points
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
Plain calendar
Hello,
Tell me please, how can I make the calendar be always displayed on the screen, allowing the user to select a date?
Thanks
QUERY
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??
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.