CodeIgniter Forums
Simple Calendar - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Simple Calendar (/showthread.php?tid=9627)



Simple Calendar - El Forum - 07-02-2008

[eluser]mihailt[/eluser]
Hi, recently i needed to have a simple calendar, so i took a look at CI calendaring class.
After playing with it for awhile i realized that i needed something different, a bit more flexible.
as a result came up with this library(couple of methods are extracted from CI_Calendar), code is kinda messy, and lots to be done yet, but it works.

Source code


Simple Calendar - El Forum - 07-02-2008

[eluser]mihailt[/eluser]
and the simple usage would be to call it in the method of needed controller:

Code:
function calendar(){
        $this->load->library('simplecalendar');
        $url = "bookingmanager/calendar";
        $this->simplecalendar->setConfigUrl($url);
        $this->simplecalendar->generateContent();
        echo $this->simplecalendar->generateCalendar();
    }

benefits are that you can do with calendar values anything you want:

Code:
function calendar(){
        $this->load->library('simplecalendar');
        $url = "bookingmanager/calendar";
        $this->simplecalendar->setConfigUrl($url);
        $this->simplecalendar->generateContent();

        $data = $this->simplecalendar->getWeeks();
        foreach($data as $key => $week){
                $newweel = array();
            foreach($week as $key => $day){
                $newweek[$key] = '<div id='.simplecalendar->day.$this->simplecalendar->month.$this->simplecalendar->year.'>' . $day . '</div>';
            }
            $newdata[] = $newweek;

        }
        $this->simplecalendar->setWeeks($newdata);
        echo $this->simplecalendar->generateCalendar();
    }

So i would like hear from you guys what do you think of it. Thanks