Flexible Calendar for Laravel 4

Overview

Laravel 4 Calendar

Flexible Calendar for Laravel 4, supports Month, Week and Day Views and multiple events per date.

To change the view type dynamically, pass in a GET variable called 'cv' (calendar view) with either a 'week' or 'day' value. Day and Week views are split into 30 minute interval rows.

Install:

Add this to "require" in composer.json:

	"makzumi/calendar": "dev-master"

After that run a composer update, then in app.php add:

	'providers' => array(
				...,
				'Makzumi\Calendar\CalendarServiceProvider',
			),

To use, create a new Calender instance and generate it, below you'll find several options to customize it as well:

	$events = array(
		"2014-04-09 10:30:00" => array(
			"Event 1",
			"Event 2 <strong> with html</stong>",
		),
		"2014-04-12 14:12:23" => array(
			"Event 3",
		),
		"2014-05-14 08:00:00" => array(
			"Event 4",
		),
	);

	$cal = Calendar::make();
	/**** OPTIONAL METHODS ****/
	$cal->setDate(Input::get('cdate')); //Set starting date
	$cal->setBasePath('/dashboard'); // Base path for navigation URLs
	$cal->showNav(true); // Show or hide navigation
	$cal->setView(Input::get('cv')); //'day' or 'week' or null
	$cal->setStartEndHours(8,20); // Set the hour range for day and week view
	$cal->setTimeClass('ctime'); //Class Name for times column on day and week views
	$cal->setEventsWrap(array('<p>', '</p>')); // Set the event's content wrapper
	$cal->setDayWrap(array('<div>','</div>')); //Set the day's number wrapper
	$cal->setNextIcon('>>'); //Can also be html: <i class='fa fa-chevron-right'></i>
	$cal->setPrevIcon('<<'); // Same as above
	$cal->setDayLabels(array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')); //Label names for week days
	$cal->setMonthLabels(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')); //Month names
	$cal->setDateWrap(array('<div>','</div>')); //Set cell inner content wrapper
	$cal->setWeekStartsMonday(true); // Make monday the first day of the week
	$cal->setHighlightEvents(true); // Highlight dates with events in month view (potential performance impact!)
	$cal->setTableClass('table'); //Set the table's class name
	$cal->setHeadClass('table-header'); //Set top header's class name
	$cal->setNextClass('btn'); // Set next btn class name
	$cal->setPrevClass('btn'); // Set Prev btn class name
	$cal->setEvents($events); // Receives the events array
	/**** END OPTIONAL METHODS ****/

	echo $cal->generate() // Return the calendar's html;
Comments
  • Foreach loop for the $events variable

    Foreach loop for the $events variable

    How can I loop through a events table to show the events within the calendar.

    In the docs you have:

         $events = array(
            "2014-04-09 10:30:00" => array(
                "Event 1",
                "Event 2 <strong> with html</stong>",
            ),
            "2014-04-12 14:12:23" => array(
                "Event 3",
            ),
            "2014-05-14 08:00:00" => array(
                "Event 4",
            ),
        );
    

    But I want to loop through a model called Events

    so ideally I would setup $events = Events::all(); then do a foreach for this, but how would one do it and add it the array above so these dates/events then show within the calendar?

    opened by lstables 33
  • Click next for next month, not working.....

    Click next for next month, not working.....

    I have a problem, the calendar works but when navigating (in Laravel of course) for next and previous months I get this URI admin/employees/edit/?cdate=2014-07 but the last segment doesn't seem to work.

    Any idea's?

    Cheers, Lee

    opened by lstables 22
  • Enhancement: Option to control time increments

    Enhancement: Option to control time increments

    I'd like to suggest the option of allowing the developer to choose how often to show events - 5, 10, 15, 20, 30, 1, or 2 hours - from the start time of day to end time.

    Ex: $cal->setStartEndHours(7,21); $cal->setHowOften('+1 hour'); // could be '+5 minutes', '+30 minutes', etc.

    opened by rginnow 10
  • Enhancement: Option to reference each date in the date wrapper

    Enhancement: Option to reference each date in the date wrapper

    In my application i need every cell to be clickable , so when clicked , they open up the event create form with the date field prepopulated, currently it is possible with javascript , but a native solution would be handier , Thanks for the great package though

    opened by Pandahisham 4
  • Not sure what can be done with this package

    Not sure what can be done with this package

    I'm looking for a calendar package that will allow me to render a full-page calendar with clickable links that lead to a resource's show page. From your post at laravel.io it doesn't look like your calendar can do that. But the optional stuff seems to indicate that maybe it could.

    There's no real demo available for me to look at either, so could you perhaps provide one? How does it show you events? I could maybe even just use the tiny calendar thing from that laravel.io post (but I'd really rather have a full-page calendar view), but I really don't know what all your package can do.

    opened by prateem 4
  • Week view: next month events not rendered

    Week view: next month events not rendered

    Thanks for your calendar, looks nice and hopefully you'll be moving it forward :)

    There is an issue with week view, next month events are not showing if they are on the same week. I figured it out and made a pull request, it's commented so you'll see everything i did and maybe do it better yourself or merge.

    Cheers!

    opened by AndreasLoukakis 3
  • Bug: End of month Week View day number is wrong

    Bug: End of month Week View day number is wrong

    https://docs.google.com/file/d/0BykrpWdDM9xVbm5seVRZTjNfZHM/edit

    At the url above is a screenshot of the problem. At the end of June, the days keep going past the 30th. Then the next week starts a July 6th.

    opened by rginnow 3
  • What is the package's license?

    What is the package's license?

    Hi, makzumi. Thank you for a cool package!

    By the way, this package is released under the MIT license? If I can I'd like to contain the package for my client's site. Thanks!

    opened by SUKOHI 2
  • Display Multiple events

    Display Multiple events

    Hello Makzumi,

    I have installed your calendar package but I have a problem when event(s) per day as found below. capture-cal

    Any idea how can I fix that as I just need the day that has events to appear as link where I can redirect to whatever I want? Also is there any sort of documentation for the rest of function that can be used with this calendar?

    Thank you in advance.

    opened by omarsafwany 2
  • Fixed Issue with day label on day view

    Fixed Issue with day label on day view

    I figured I'd help you out since I don't want to create another issue for you to fix. I hope this doesn't screw with your code too much, but please fix this if you have a better way to do it! :)

    I noticed the day view label was always Sunday so I looked into your code to fix it myself. It looks like this has worked.

    opened by rginnow 2
  • Added support for monday being the first day of the week

    Added support for monday being the first day of the week

    I know there is another PR for this but this one addresses both the week & the month view. Would you accept it as is or are there any more suggestions from your side, @makzumi?

    opened by kwizzn 1
  • If 1 of month and startingDay is not first td, the

    If 1 of month and startingDay is not first td, the "filling" td's have wrong data-datetime and highlighting

    In buildBody() the $day (starts with 1) doesn't get counted up for the fill days up until startingDay (1. of month).

    This results in having those td's all have a data-datetime of m-01-Y. And if an event is on 1. those also get highlighted.

    I changed the inner for loop to something like:

    for ($j = 0; $j <= 6; $j++) {
    
    	if ($day <= $monthLength && ($i > 0 || $j >= $startingDay)) {
    		$curr_date = $this->getDayDate($day);
    		$classes = [];
    		if ($this->hasEvent($curr_date))
    			$classes[] = 'event';
    		if ($curr_date == $this->today)
    			$classes[] = 'today';
    		$class = count($classes) ? ' class="' . implode(' ', $classes) . '"' : '';
    		$h .= "<td data-datetime='$curr_date' $class>";
    		$h .= $this->dateWrap[0];
    		$h .= $this->dayWrap[0];
    		$h .= $day;
    		$h .= $this->dayWrap[1];
    		$h .= $this->buildEvents($curr_date);
    		$day++;
    	} else {
    		$h .= "<td>";
    		$h .= $this->dateWrap[0];
    		$h .= "&nbsp;";
    	}
    	$h .= $this->dateWrap[1];
    	$h .= "</td>";
    }
    
    opened by somatonic 0
  • Cant update composer for calendar

    Cant update composer for calendar

    Your requirements could not be resolved to an installable set of packages.

    Problem 1 - Conclusion: remove laravel/framework v5.0.33 - Conclusion: don't install laravel/framework v5.0.33 - Conclusion: don't install laravel/framework v5.0.32 - Conclusion: don't install laravel/framework v5.0.31 - Conclusion: don't install laravel/framework 5.0.30 - Conclusion: don't install laravel/framework v5.0.29 - Conclusion: don't install laravel/framework v5.0.28 - Conclusion: don't install laravel/framework v5.0.27 - Conclusion: don't install laravel/framework v5.0.26 - Conclusion: don't install laravel/framework v5.0.25 - Conclusion: don't install laravel/framework v5.0.24 - Conclusion: don't install laravel/framework v5.0.23 - Conclusion: don't install laravel/framework v5.0.22 - Conclusion: don't install laravel/framework v5.0.21 - Conclusion: don't install laravel/framework v5.0.20 - Conclusion: don't install laravel/framework v5.0.19 - Conclusion: don't install laravel/framework v5.0.18 - Conclusion: don't install laravel/framework v5.0.17 - Conclusion: don't install laravel/framework v5.0.16 - Conclusion: don't install laravel/framework v5.0.15 - Conclusion: don't install laravel/framework v5.0.14 - Conclusion: don't install laravel/framework v5.0.13 - Conclusion: don't install laravel/framework v5.0.12 - Conclusion: don't install laravel/framework v5.0.11 - Conclusion: don't install laravel/framework v5.0.10 - Conclusion: don't install laravel/framework v5.0.9 - Conclusion: don't install laravel/framework v5.0.8 - Conclusion: don't install laravel/framework v5.0.7 - Conclusion: don't install laravel/framework v5.0.6 - Conclusion: don't install laravel/framework v5.0.5 - Conclusion: don't install laravel/framework v5.0.4 - Conclusion: don't install laravel/framework v5.0.3 - Installation request for makzumi/calendar dev-master -> satisfiable by makzumi/calendar[dev-master]. - Conclusion: don't install laravel/framework v5.0.2 - Conclusion: don't install laravel/framework v5.0.1 - makzumi/calendar dev-master requires illuminate/support ~4 -> satisfiable by illuminate/support[v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.13, v4.1.14, v4.1.15, v4.1.16, v4.1.17, v4.1.18, v4.1.19, v4.1.2, v4.1.20, v4.1.21, v4.1.22, v4.1.23, v4.1.24, v4.1.25, v4.1.26, v4.1.27, v4.1.28, v4.1.29, v4.1.3, v4.1.30, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.1, v4.2.12, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9]. - don't install illuminate/support v4.0.0|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.1|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.10|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.2|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.3|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.4|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.5|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.6|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.7|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.8|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.0.9|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.0|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.1|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.10|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.11|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.12|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.13|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.14|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.15|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.16|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.17|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.18|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.19|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.2|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.20|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.21|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.22|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.23|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.24|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.25|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.26|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.27|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.28|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.29|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.3|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.30|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.4|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.5|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.6|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.7|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.8|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.1.9|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.1|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.12|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.16|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.17|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.2|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.3|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.4|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.5|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.6|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.7|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.8|don't install laravel/framework v5.0.0 - don't install illuminate/support v4.2.9|don't install laravel/framework v5.0.0 - Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[5.0.30, v5.0.0, v5.0.1, v5.0.10, v5.0.11, v5.0.12, v5.0.13, v5.0.14, v5.0.15, v5.0.16, v5.0.17, v5.0.18, v5.0.19, v5.0.2, v5.0.20, v5.0.21, v5.0.22, v5.0.23, v5.0.24, v5.0.25, v5.0.26, v5.0.27, v5.0.28, v5.0.29, v5.0.3, v5.0.31, v5.0.32, v5.0.33, v5.0.4, v5.0.5, v5.0.6, v5.0.7, v5.0.8, v5.0.9].

    opened by nezaboravi 0
  • Starting the week on Monday

    Starting the week on Monday

    In Europe calendars start the week on Monday instead of Sunday. Is it possible to choose this? If not, which part of the code should I look at to change this?

    opened by matthieucalu 14
  • Make setEvents accept MessageBag objects [feature request]

    Make setEvents accept MessageBag objects [feature request]

    Your example array:

            $events = array(
                "2014-08-09 10:30:00" => array(
                    "Event 1",
                    "Event 2 <strong> with html</stong>",
                ),
                "2014-08-12 14:12:23" => array(
                    "Event 3",
                ),
                "2014-09-14 08:00:00" => array(
                    "Event 4",
                ),
            );
            $cal->setEvents($events);
    

    can be rewritten as:

    $events = new Illuminate\Support\MessageBag;
    $events->add("2014-08-09 10:30:00", "Event 1");
    $events->add("2014-08-09 10:30:00", "Event 2 <strong> with html</stong>");
    $events->add("2014-08-12 14:12:23", "Event 3");
    $events->add("2014-09-14 08:00:00", "Event 4");
    $cal->setEvents($events);
    

    Currently, it works if you use $cal->setEvents($events->toArray()); instead.

    MessageBag has cool features like $bag1->merge($bag2);

    opened by carcinocron 2
Owner
null
Laravel 9 & React Event Calendar

###Event Calendar ##Projeyi docker üzerinde ayağa kaldırma #Acount Service accountService klasörü içine girerek docker-compose up --build komutu ile a

Muhammed Mustafa Bulut 4 Apr 19, 2022
The missing PHP 5.3+ calendar management library.

CalendR CalendR is an Object Oriented Calendar management library on top of PHP5.3+ Date objects. You can use it to deal with all your needs about cal

Yohan Giarelli 462 Dec 30, 2022
ReCalendar - highly customizable calendar for ReMarkable tablets

ReCalendar Highly customizable calendar for ReMarkable tablets ReCalendar allows you to generate your own, personalized calendar using PHP and the mPD

Igor Klimer 172 Oct 17, 2022
Display a calendar of commits from public GitHub repositories

commit-calendar Display a list of dates and commits from public GitHub repositories. You will display the list in the terminal, and you can choose to

Erika Gili 5 Jul 23, 2021
This helps with public holiday info using google calendar api

Public Holiday This package uses the Google Calendar API to fetch public holidays. The data always comes with 3 years data; the previous year, the cur

Temitope Olotin 5 Jul 13, 2022
📆 Calendar app for Nextcloud

Nextcloud Calendar A calendar app for Nextcloud. Easily sync events from various devices with your Nextcloud and edit them online. ?? ?? Why is this s

Nextcloud 801 Dec 29, 2022
Manage events on a Google Calendar

Manage events on a Google Calendar This package makes working with a Google Calendar a breeze. Once it has been set up you can do these things: use Sp

Spatie 1k Dec 31, 2022
A package which provides a monthly calendar with days and events depending on given months and events.

A package which provides a monthly calendar with days and events depending on given months and events. This is where your description should go. Try a

MichaB 6 Nov 1, 2022
TeamCal Neo is a web application of a day-based calendar

TeamCal Neo is a web application of a day-based calendar. It's generic purpose is the absence and event management of project teams, music bands and other groups needing a scheduler that focusses on days.

George Lewe 3 Nov 15, 2022
Simple Event/Calendar

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files

TolisM 2 Feb 1, 2022
Laravel package to convert AD to BS that can work with carbon.

Laravel Nepali Date Converter Laravel package to convert AD to BS that can work with carbon. Installation You can install the package via composer: co

DRH2SO4 19 Jan 5, 2023
Clase Calendario Colombia Calculo de Festivos, Manejo de Fechas, Migraciones Laravel

Calendario Colombia | Calendar Colombia | Laravel (^5) Control del Calendario de Colombia desde llamado de métodos de Clase. PHP (^7.4). Control fácil

Raúl Mauricio Uñate Castro 9 Sep 10, 2022
Flexible Calendar for Laravel 4

Laravel 4 Calendar Flexible Calendar for Laravel 4, supports Month, Week and Day Views and multiple events per date. To change the view type dynamical

null 59 Dec 24, 2022
Laravel Livewire component to show Events in a good looking monthly calendar

Livewire Calendar This package allows you to build a Livewire monthly calendar grid to show events for each day. Events can be loaded from within the

Andrés Santibáñez 680 Jan 4, 2023
Laravel 9 & React Event Calendar

###Event Calendar ##Projeyi docker üzerinde ayağa kaldırma #Acount Service accountService klasörü içine girerek docker-compose up --build komutu ile a

Muhammed Mustafa Bulut 4 Apr 19, 2022
A minimalistic event calendar Tool for Laravel's Nova 4

Event calendar for Laravel Nova 4 An event calendar that displays Nova resources or other time-related data in your Nova 4 project on a monthly calend

wdelfuego 44 Jan 1, 2023
The missing PHP 5.3+ calendar management library.

CalendR CalendR is an Object Oriented Calendar management library on top of PHP5.3+ Date objects. You can use it to deal with all your needs about cal

Yohan Giarelli 462 Dec 30, 2022
Add The Events Calendar support to Sage 10.

The Events Calendar support for Sage 10 Add The Events Calendar support to Sage 10. For the time being there can only be a blade view, the default-tem

Supermundano 10 Nov 5, 2022
ReCalendar - highly customizable calendar for ReMarkable tablets

ReCalendar Highly customizable calendar for ReMarkable tablets ReCalendar allows you to generate your own, personalized calendar using PHP and the mPD

Igor Klimer 172 Oct 17, 2022
Display a calendar of commits from public GitHub repositories

commit-calendar Display a list of dates and commits from public GitHub repositories. You will display the list in the terminal, and you can choose to

Erika Gili 5 Jul 23, 2021