Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by Mossab Alzeeny )

Add events to Specific date Calendar Class

Category:Core | Category:Core -> Community | Category:Core -> Calendar

With this small modification on the file system/libraries/Calendar.php,
You will be able to add events on a Specific date in the Calendar Class

example:

$data = array(

               
//year
               
'2007' => array(
                                   
//month
                                  
'08' => array(
                                                
//day
                                                 
=> 'http://example.com/news/article/2006/03/'
                                  
)
               ),
               
//year
               
'2008' => array(
                                   
//month
                                  
'01' => array(
                                                
//day
                                                 
=> 'http://example.com/news/article/2006/03/'
                                  
)
               )

             );

echo 
$this->calendar->generate('','',$data); 

 

if you have your own modifications on the file system/libraries/Calendar.php you can just look for this part :

if (isset($data[$day]))
                    
{
                        
// Cells with content
                        
$temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_content_today'$this->temp['cal_cell_content'];
                        
$out .= str_replace('{day}'$daystr_replace('{content}'$data[$day]$temp));
                    
}
                    
else
                    
{
                        
// Cells with no content
                        
$temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_no_content_today'$this->temp['cal_cell_no_content'];
                        
$out .= str_replace('{day}'$day$temp);
                    

and Replace it with :

if (isset($data[$year][$month][$day]))
                    
{
                        
// Cells with content
                        
$temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_content_today'$this->temp['cal_cell_content'];
                        
$out .= str_replace('{day}'$daystr_replace('{content}'$data[$year][$month][$day]$temp));
                    
}
                    
else
                    
{
                        
// Cells with no content
                        
$temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_no_content_today'$this->temp['cal_cell_no_content'];
                        
$out .= str_replace('{day}'$day$temp);
                    

 


or you can just replace whats in the file system/libraries/Calendar.php with this :


Hope you like it ;)

Categories: