Welcome Guest, Not a member yet? Register   Sign In
Adding multiple variables to calendar days
#8

Best way (IMHO) is create a MY_Calendar.php in application/libraries.
PHP Code:
class MY_Calendar extends CI_Calendar {

 
       public function __construct($config = array())
 
       {
 
               parent::__construct($config);
 
       }


Copy the generate() function from the core class (in system/libraries/Calendar.php) and paste it into MY_Calendar.
Now, add an extra parameter to the genarate function, like this:
PHP Code:
public function generate($year ''$month ''$data = array(), $css = array() ) 

To pass a specific css class for each day, use the same approach as for passing links for each day:
PHP Code:
$css = array(
 
 3 => 'cal-blue',
 
 7 => 'cal-red',
 
 13 => 'cal-green',
 
 26 => 'cal-orange'
); 

Inside the new generate() function, write to code for inserting the correct css-class into the output string ($out).
Reply


Messages In This Thread
RE: Adding multiple variables to calendar days - by Wouter60 - 08-03-2017, 06:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB