antitoxic / dmWidgetEventCalendarPlugin

dmWidgetEventCalendarPlugin displays the days in from the current month in a list.
MIT License
1 stars 0 forks source link

dmWidgetEventCalendarPlugin displays the days in from the current month in a list. You can attach events to each day and they will be displayed on the calendar. Events can be populated into the calendar from a model's records if the model implements the provided interface.

Installation

Download it

Run in project's directory:

git clone git://github.com/antitoxic/dmWidgetEventCalendarPlugin.git plugins/dmWidgetEventCalendarPlugin

Enable it

Edit ProjectConfiguration

class ProjectConfiguration extends dmProjectConfiguration
{
    public function setup()
    {
        parent::setup();

        $this->enablePlugins(array(
            // your enabled plugins
             'dmWidgetEventCalendarPlugin'
        ));

Just clear the cache

Run in project's directory:

php symfony cc

Style the calendar

Include the plugin assets in your apps/front/config/view.yml file:

stylesheets:
  - dmWidgetEventCalendarPlugin.view

Don't forget to publish the plugins' assets:

php symfony dm:publish-assets

What is provided?

It includes:

Widget options

Example Model class implementation

Here is the minimum if you want Events to be populated into the calendar from a model's records:

class Appointment extends BaseAppointment implements dmHtmlCalendarEventInterface
{

    public function getAdditionalDayAttributes()
    {
    }

    public function getAdditionalDayClasses()
    {
    }

    public function renderEvent( $day , $isFirstEvent = true )
    {
        return $day.' '.$this->getClient();
    }

    public function getCalendarDate()
    {
        return $this->getScheduledOn();
    }

    public static function getCalendarDateColumnName()
    {
        return 'scheduled_on';
    }
    public static function getCalendarQuery($startDate, $endDate) {

    }

}