';
$detaillink = Route::_(JemHelperRoute::getEventRoute($row->slug));
$eventid = $this->escape($row->id);
//initialize variables
$multicatname = '';
$colorpic = '';
$nr = is_array($row->categories) ? count($row->categories) : 0;
$ix = 0;
$content = '';
$contentend = '';
$catcolor = array();
//walk through categories assigned to an event
foreach((array)$row->categories AS $category) {
//Currently only one id possible...so simply just pick one up...
$detaillink = Route::_(JemHelperRoute::getEventRoute($row->slug));
//wrap a div for each category around the event for show hide toggler
$content .= '
';
$contentend .= '
';
//attach category color if any in front of the catname
if ($category->color) {
$multicatname .= ' '.$category->catname;
} else {
$multicatname .= $category->catname;
}
$ix++;
if ($ix != $nr) {
$multicatname .= ', ';
}
//attach category color if any in front of the event title in the calendar overview
if (isset($category->color) && $category->color) {
$colorpic .= '';
$catcolor[$category->color] = $category->color; // we need to list all different colors of this event
}
/* count if not multiday or first of multiday or first visible of multiday */
if (!isset($row->multi) || ($row->multi == 'first') || ($row->dates == $firstDate)) {
if (!array_key_exists($category->id, $countcatevents)) {
$countcatevents[$category->id] = 1;
} else {
$countcatevents[$category->id]++;
}
}
}
$color = '
';
$color .= $colorpic;
$color .= '
';
// multiday
$multi_mode = 0; // single day
$multi_icon = '';
if (isset($row->multi)) {
switch ($row->multi) {
case 'first': // first day
$multi_mode = 1;
$multi_icon = '';
break;
case 'middle': // middle day
$multi_mode = 2;
$multi_icon = '';
break;
case 'zlast': // last day
$multi_mode = 3;
$multi_icon = '';
break;
}
}
//for time in calendar
$timetp = '';
if ($showtime) {
$start = JemOutput::formattime($row->times,'',false);
$end = JemOutput::formattime($row->endtimes,'',false);
switch ($multi_mode) {
case 1:
$timetp .= $multi_icon . ' ' . $start . ' ';
break;
case 2:
$timetp .= $multi_icon . ' ';
break;
case 3:
$timetp .= $multi_icon . ' ' . $end . ' ';
break;
default:
if ($start != '') {
$timetp .= $start;
if ($end != '') {
$timetp .= ' - '.$end;
}
$timetp .= ' ';
}
break;
}
} else {
if (!empty($multi_icon)) {
$timetp .= $multi_icon . ' ';
}
}
$catname = '
'.Text::_('COM_JEM_DATE').': ';
switch ($multi_mode) {
case 1: // first day
$multidaydate .= JemOutput::formatShortDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $showtime);
$multidaydate .= JemOutput::formatSchemaOrgDateTime($row->dates, $row->times, $row->enddates, $row->endtimes);
break;
case 2: // middle day
$multidaydate .= JemOutput::formatShortDateTime($row->multistartdate, $row->times, $row->multienddate, $row->endtimes, $showtime);
$multidaydate .= JemOutput::formatSchemaOrgDateTime($row->multistartdate, $row->times, $row->multienddate, $row->endtimes);
break;
case 3: // last day
$multidaydate .= JemOutput::formatShortDateTime($row->multistartdate, $row->times, $row->multienddate, $row->endtimes, $showtime);
$multidaydate .= JemOutput::formatSchemaOrgDateTime($row->multistartdate, $row->times, $row->multienddate, $row->endtimes);
break;
default: // single day
$multidaydate .= JemOutput::formatShortDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $showtime);
$multidaydate .= JemOutput::formatSchemaOrgDateTime($row->dates, $row->times, $row->enddates, $row->endtimes);
break;
}
$multidaydate .= '
';
//create little Edit and/or Copy icon on top right corner of event if user is allowed to edit and/or create
$editicon = '';
if (!$this->print) {
$btns = array();
if ($this->params->get('show_editevent_icon', 0) && $row->params->get('access-edit', false)) {
$btns[] = JemOutput::editbutton($row, null, null, true, 'editevent');
}
if ($this->params->get('show_copyevent_icon', 0) && $this->permissions->canAddEvent) {
$btns[] = JemOutput::copybutton($row, null, null, true, 'editevent');
}
if (!empty($btns)) {
$editicon .= '
';
$editicon .= join(' ', $btns);
$editicon .= '
';
}
}
//get border for featured event
$usefeaturedborder = $this->params->get('usefeaturedborder', 0);
$featuredbordercolor = $this->params->get('featuredbordercolor', 0);
$featuredclass = '';
$featuredstyle ='';
if($usefeaturedborder && $row->featured){
$featuredclass="borderfeatured";
$featuredstyle="border-color:" . $featuredbordercolor;
}
//generate the output
// if we have exact one color from categories we can use this as background color of event
$content .= '
';
$this->cal->setEventContent($year, $month, $day, $content);
endforeach;
// enable little icon right beside day number to allow event creation
if (!$this->print && $this->params->get('show_addevent_icon', 0) && !empty($this->permissions->canAddEvent)) {
$html = JemOutput::prepareAddEventButton();
$this->cal->enableNewEventLinks($html);
}
$displayLegend = (int)$this->params->get('displayLegend', 1);
if ($displayLegend == 2) : ?>
params->get('displayLegend')) {
##############
## FOR EACH ##
##############
$counter = array();
# walk through events
foreach ($this->rows as $row) {
foreach ($row->categories as $cat) {
# sort out dupes for the counter (catid-legend)
if (!in_array($cat->id, $counter)) {
# add cat id to cat counter
$counter[] = $cat->id;
# build legend
if (array_key_exists($cat->id, $countcatevents)) {
?>
rows as $row) {
foreach ($row->categories as $cat) {
# sort out dupes for the counter (catid-legend)
if (!in_array($cat->id, $counter)) {
# add cat id to cat counter
$counter[] = $cat->id;
# build legend
if (array_key_exists($cat->id, $countcatevents)) {
?>