The date range list of items is an ideal mechanism for creating an attractive printable layout for your upcoming events. This article will describe how to customise this layout so that you can create an attractive print layout (or even PDF based output). This article will assume you are using the Ruthin layout and the ja_purity template (if you are using a different layout or template then replace these in all file names as necessary).
- Copy the file components/com_jevents/views/default/range/tmpl/listevents.php to templates/ja_purity/html/com_jevents/ruthin/range/printevents.php (note that the source file is from the default view).
- Edit this copied file and replace its content with this:
<?php
defined('_JEXEC') or die('Restricted access');
if (JRequest::getInt("pop",0)==0){
$this->_header();
echo $this->loadTemplate("body");
$this->_viewNavAdminPanel();
$this->_footer();
}
else {
echo $this->loadTemplate("body");
} - Copy the file components/com_jevents/views/ruthin/range/tmpl/listevents_body.php to templates/ja_purity/html/com_jevents/ruthin/range/printevents_body.php
- Create a menu item of type JEvents "Date Range", choose a suitable date range and remember to set the "Override Layout" to "printevents".
- The next step is to customise the layout
Customising the Layout
The printevents_body.php file is fairly straightforward - but it will need to be changed.
- Search for "$this->loadedFromTemplate" at about line 45 and remove that line and the 2 following lines from the code. i.e. remove
if (!$this->loadedFromTemplate('icalevent.list_row', $row, 0)){
$this->viewEventRowNew ( $row,'view_detail',JEV_COM_COMPONENT, $Itemid);
} - In place of this you can output the information you want about the event.
Available fields and methods from JEvents:
- $row->startDate() - YYY-MM-DD formatted start date for the repetition
- $row->endDate() - YYY-MM-DD formatted end date for the repetition
- $row->title() - Title of the event repetition
- $row->content() - Description of the event repetition
- $row->useCatColor() - Does the event use the category colour?
- $row->catid() - Category id
- $row->catname() - Category name
- $row->getCategoryDescription() - Category description
- $row->created_by() - User id of the author of the event
- $row->hits() - hits count
- $row->published() - Is the event published or not
- $row->alldayevent() - Is the event repetition an all day event
- $row->noendtime() - does the event repetition have an end time
- $row->multiday() - is the event repetition a multi day event
- $row->access() - joomla access level for the event
- $row->location() - the event location - either a text field or an extended field based on the managed locations addon
- $row->contact_info() - the event repetition contact info field
- $row->contactLink() - a link to the event contact
- $row->extra_info() - the event repetition extra info field
- $row->published() - Is the event published or not
- $row->yup() - Year of start of event repetition
- $row->mup() - Month of start of event repetition
- $row->dup() - Day of start of event repetition
- $row->hup() - Hour of start of event repetition
- $row->minup() - Minute of start of event repetition
- $row->sup() - Second of start of event repetition
- $row->ydn() - Year of end of event repetition
- $row->mdn() - Month of end of event repetition
- $row->ddn() - Day of end of event repetition
- $row->hdn() - Hour of end of event repetition
- $row->mindn() - Minute of end of event repetition
- $row->sdn() - Second of end of event repetition
- $row->isrepeat() - Is the event a repeating event
- $row->repeatSummary() - a basic summary of the event's repetition pattern
- $row->prevRepeat() - a link to the previous repeat (or blank if none)
- $row->nextRepeat() - a link to the next repeat (or blank if none)
Available Fields from JevLocations
The following are all fields within $row : loc_title, location, loc_street, loc_desc, loc_postcode, loc_city, loc_country, loc_state, loc_phone, loc_url, loc_lon, loc_lat, loc_zoom. You must put an underscore before each field name to get its value e.g. "echo $row->_loc_title;" would output the location title.
In time we will make more information available from other plugins and addons - hopefully as part of JEvents 1.5.5.
Exporting Events as CSV
The same approach can be used to export your events in CSV format. If you unzip and upload this file and upload to templates/YOUR TEMPLATE/html/com_jevents/YOUR JEVENTS LAYOUT/range/printevents.php and then create a new date range menu item setting the layout override to be "printevents". Then this will generate a CSV dump of your events which you can then put in a spreadsheet. One nice feature is that the output will respond to the jevents filter module or constraints you set in the menu item so that you can create partial samples of your data in CSV format.
Clearly you can add more fields to the export or change the field order as you want.