Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
224 lines (182 sloc) 5.78 KB

Events Calendar for Modx EVO


use PackageManager or

  • Copy assets/*
  • Add chunk from install/chunks/*
  • Add tv from install/tvs/*


  • Open index-ajax.php and append snippet dir assets/snippets/EventsCalendar/ at this code part:
// Add items to this array corresponding to which directories within assets/snippets/ can be used by this file.
// Do not add entries unneccesarily.
// Any PHP files in these directories can be executed by any user.
$allowed_dirs = array('assets/snippets/ajaxSearch/'); 


$allowed_dirs = array('assets/snippets/ajaxSearch/');

must be

$allowed_dirs = array('assets/snippets/ajaxSearch/','assets/snippets/EventsCalendar/');

Call options and defaults


Use chunk {{EventsCalendar}} for draw html template. See install/chunks/EventsCalendar.tpl


opt = {
// language : russian
	'lang': {'months': 'январь,февраль,март,апрель,май,июнь,июль,август,сентябрь,октябрь,ноябрь,декабрь'.split(",")},
// templates for event items
	'tpl': {
// Event item template
		'event': '<a href="%url" class="item" data-id="%id">%image%date<span class="title">%title</span></a>',
// date format
		'date': '<span class="date">%d.%m.%Y %H:%i:%s</span>',
// block for dates <from> - <to>
		'dates': '<span class="dates">%dates</span>',
// dates periods delimeter 
		'dateBetween': ' &ndash; ',
// image template
		'image': '<span class="image"><img src="%src" alt="%alt" /></span>'
// Function on loaded month events: function(){}
	'onloadMonth': false,

// Image get :  false | true | {field:"tvimage","options":"w=200,h=200"}
// if set true, default options is: TV name = image, Image size gets from modx->config 
// {field:"image","options":"w=<thumbWidth>,h=<thumbHeught>"} 
	'image': false,

// Date use for date of event.
// Set TV name for date use: 
// 'useDates':"date",
// same as:
// 'useDates':{"field":"date"},
 // Set TV names for date start and end of event: 
// 'useDates':"dates_start,date_end", 
// same as:
// 'useDates':{"field":"dates_start,date_end"},
// same as
// 'useDates':{"field":["dates_start","date_end"]},
// set dateFormat for TV, default "%d-%m-%Y %H:%i:%s"
// 'useDates':{"field":"date","dateFormat":"%d-%m-%Y %H:%i:%s"},
// Set TV for multivalue (at now ony for ddmultiplefields yet}
// 'useDates':{"field":"dates","multi":1}, 
// 'useDates':{"field":"dates","multi":"ddmultiplefields"}, 
// same as
// 'useDates':{"field":"dates","multi":{"delimRow":"||","delimCol":"::"}},
// json (not ready yet)
// 'useDates':{"field":"dates","multi":"json"},
// By default used publishedon or pub_date
	'useDates': false

Usage examples

Simple call with defaults:


Set language


Get image for event

With default parameters:

  • TV image field: image,
  • phpthumb options w=$modx->config["thumbWidth"],h=$modx->config["thumbHeight"]

Set image parameters


Set event templates

Set custom date format, without time

	'tpl': {"date": '<span class="date">%d.%m.%Y</span>'}

Set custom event item template and image

Set link only at title, no data-id attr, image without span outer

	'tpl': {
		'event': '<span class="item">%image %date <a href="%url" class="item" class="title">%title</a></span>',
		'image': '<img src="%src" alt="%alt" />'

Use multi dates

Use two tv fields


Use ddMultipleFields dates (delimited rows and cols)

Add to mm_rules mm_ddMultipleFields rule for TV date:

mm_ddMultipleFields("dates", '', '', 'date,date', "Date Start, Date End");

and use js call


Use MultiTV (JSON)

not ready yet :(


Override the output of the event list and click instead of hover

This example usable for list of events at external visible div loaded by click to day with event instead mouse hover. Also activating nearest day with an events.

JS call:

			EC = $(EC);
			var ecM = $(".monthdays ", EC);
/* Multi field usage example * /
				'tpl': {"date": '<span class="date">%d.%m.%Y</span>'},
				// image:1,
/* */
				"onloadMonth": function(){
					var ecM = $(this);
					var ecToday = $("", ecM);
					var NEvent ; 
					$("span.event", ecM).each(function(){
						if (!$(NEvent).length ||
							Math.abs($(NEvent).data("date") - $(ecToday).data("date")) > Math.abs($(this).data("date") - $(ecToday).data("date"))
						) NEvent = $(this); 
			}).on("click", ".monthdays span.event", function(e){
				$("span.event", ecM).removeClass("active");
				$(">.items", EC).html($("div", this).html());

Also, on css remove hover handler

.EventsCalendar .monthdays span:hover > div {
  display: block;
You can’t perform that action at this time.