primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view
title="Category">
<message><![CDATA[COM_JEM_CATEGORY_VIEW_LAYOUT_DESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,415 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<div id="jem" class="jlcalendar jem_calendar<?php echo $this->pageclass_sfx;?>">
<div class="buttons">
<?php
$btn_params = array('print_link' => $this->print_link, 'ical_link' => $this->ical_link);
echo JemOutput::createButtonBar($this->getName(), $this->permissions, $btn_params);
?>
</div>
<?php if ($this->params->get('show_page_heading', 1)): ?>
<h1 class="componentheading">
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('showintrotext')) : ?>
<div class="description no_space floattext">
<?php echo $this->params->get('introtext'); ?>
</div>
<p> </p>
<?php endif; ?>
<?php
$countcatevents = array ();
$countperday = array();
$limit = $this->params->get('daylimit', 10);
$evbg_usecatcolor = $this->params->get('eventbg_usecatcolor', 0);
$showtime = $this->settings->get('global_show_timedetails', 1);
foreach ($this->rows as $row) :
if (!JemHelper::isValidDate($row->dates)) {
continue; // skip, open date !
}
//get event date
$year = date('Y', strtotime($row->dates));
$month = date('m', strtotime($row->dates));
$day = date('d', strtotime($row->dates));
@$countperday[$year.$month.$day]++;
if ($countperday[$year.$month.$day] == $limit+1) {
$var1a = Route::_('index.php?option=com_jem&view=day&id='.$year.$month.$day.'&catid='.$this->catid);
$var1b = Text::_('COM_JEM_AND_MORE');
$var1c = "<a href=\"".$var1a."\">".$var1b."</a>";
$id = 'eventandmore';
/**
* $cal->setEventContent($year,$month,$day,$content,[$contentUrl,$id])
*
* Info from: https://www.micronetwork.de/activecalendar/demo/doc/doc_en.html
*
* Call this method, if you want the class to create a new HTML table within the date specified by the parameters $year, $month, $day.
* The parameter $content can be a string or an array.
* If $content is a string, then the new generated table will contain one row with the value of $content.
* If it is an array, the generated table will contain as many rows as the array length and each row will contain the value of each array item.
* The parameter $contentUrl is optional: If you set a $contentUrl, an event content specific link (..href='$contentUrl'..) will be generated
* in the 'event content' table row(s), even if the method $cal->enableDayLinks($link) was not called.
* The parameter $id is optional as well: if you set an $id, a HTML class='$id' will be generated for each event content (default: 'eventcontent').
*/
$this->cal->setEventContent($year, $month, $day, $var1c, null, $id);
continue;
} elseif ($countperday[$year.$month.$day] > $limit+1) {
continue;
}
//for time in tooltip
$timehtml = '';
if ($showtime) {
$start = JemOutput::formattime($row->times);
$end = JemOutput::formattime($row->endtimes);
if ($start != '') {
$timehtml = '<div class="time"><span class="text-label">'.Text::_('COM_JEM_TIME_SHORT').': </span>';
$timehtml .= $start;
if ($end != '') {
$timehtml .= ' - '.$end;
}
$timehtml .= '</div>';
}
}
$eventname = '<div class="eventName">'.Text::_('COM_JEM_TITLE_SHORT').': '.$this->escape($row->title).'</div>';
$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 .= '<div id="scat" class="cat'.$category->id.'">';
$contentend .= '</div>';
//attach category color if any in front of the catname
if ($category->color) {
$multicatname .= '<span class="colorpic" style="background-color: '.$category->color.';"></span>&nbsp;'.$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 .= '<span class="colorpic" style="background-color: '.$category->color.';"></span>';
$catcolor[$category->color] = $category->color; // we need to list all different colors of this event
}
//count occurence of the category
if (!isset($row->multi) || ($row->multi == 'first')) {
if (!array_key_exists($category->id, $countcatevents)) {
$countcatevents[$category->id] = 1;
} else {
$countcatevents[$category->id]++;
}
}
}
// multiday
$multi_mode = 0; // single day
$multi_icon = '';
if (isset($row->multi)) {
switch ($row->multi) {
case 'first': // first day
$multi_mode = 1;
$multi_icon = HTMLHelper::_("image","com_jem/arrow-left.png",'', NULL, true);
break;
case 'middle': // middle day
$multi_mode = 2;
$multi_icon = HTMLHelper::_("image","com_jem/arrow-middle.png",'', NULL, true);
break;
case 'zlast': // last day
$multi_mode = 3;
$multi_icon = HTMLHelper::_("image","com_jem/arrow-right.png",'', NULL, true);
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 . '<br />';
break;
case 2:
$timetp .= $multi_icon . '<br />';
break;
case 3:
$timetp .= $multi_icon . ' ' . $end . '<br />';
break;
default:
if ($start != '') {
$timetp .= $start;
if ($end != '') {
$timetp .= ' - '.$end;
}
$timetp .= '<br />';
}
break;
}
} else {
if (!empty($multi_icon)) {
$timetp .= $multi_icon . ' ';
}
}
$catname = '<div class="catname">'.$multicatname.'</div>';
$eventdate = !empty($row->multistartdate) ? JemOutput::formatdate($row->multistartdate) : JemOutput::formatdate($row->dates);
if (!empty($row->multienddate)) {
$eventdate .= ' - ' . JemOutput::formatdate($row->multienddate);
} else if ($row->enddates && $row->dates < $row->enddates) {
$eventdate .= ' - ' . JemOutput::formatdate($row->enddates);
}
//venue
if ($this->jemsettings->showlocate == 1) {
$venue = '<div class="location"><span class="text-label">'.Text::_('COM_JEM_VENUE_SHORT').': </span>';
$venue .= !empty($row->venue) ? $this->escape($row->venue) : '-';
$venue .= '</div>';
} else {
$venue = '';
}
// state if unpublished
$statusicon = '';
if (isset($row->published) && ($row->published != 1)) {
$statusicon = JemOutput::publishstateicon($row);
$eventstate = '<div class="eventstate"><span class="text-label">'.Text::_('JSTATUS').': </span>';
switch ($row->published) {
case 1: $eventstate .= Text::_('JPUBLISHED'); break;
case 0: $eventstate .= Text::_('JUNPUBLISHED'); break;
case 2: $eventstate .= Text::_('JARCHIVED'); break;
case -2: $eventstate .= Text::_('JTRASHED'); break;
}
$eventstate .= '</div>';
} else {
$eventstate = '';
}
//date in tooltip
$multidaydate = '<div class="time"><span class="text-label">'.Text::_('COM_JEM_DATE').': </span>';
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 .= '</div>';
//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 .= '<div class="inline-button-right">';
$editicon .= join(' ', $btns);
$editicon .= '</div>';
}
}
//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 .= '<div class="eventcontentinner event_id' . $eventid . ' cat_id' . $category->id . ' ' . $featuredclass . '" style="' . $featuredstyle;
if (!empty($evbg_usecatcolor) && (count($catcolor) == 1)) {
$content .= '; background-color:'.array_pop($catcolor).'">';
} else {
$content .= '">' . $colorpic;
}
$content .= $editicon;
$content .= JemHelper::caltooltip($catname.$eventname.$timehtml.$venue.$eventstate, $eventdate, $row->title . $statusicon, $detaillink, 'editlinktip hasTip', $timetp, $category->color);
$content .= $contentend . '</div>';
$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('catid='.$this->catid);
$this->cal->enableNewEventLinks($html);
}
$displayLegend = (int)$this->params->get('displayLegend', 1);
if ($displayLegend == 2) : ?>
<!-- Calendar legend above -->
<div id="jlcalendarlegend">
<!-- Calendar Legend -->
<div class="calendarLegends">
<?php
if ($this->params->get('displayLegend')) {
##############
## FOR EACH ##
##############
$counter = array();
# walk through events
foreach ($this->rows as $row) {
foreach ($row->categories as $cat) {
# skip foreign categories - we are restricted to one
if ($cat->id != $this->catid) {
continue;
}
# 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)) {
?>
<div class="eventCat btn btn-outline-dark" id="cat<?php echo $cat->id; ?>">
<?php
if (isset($cat->color) && $cat->color) {
echo '<span class="colorpic" style="background-color: '.$cat->color.';"></span>';
}
echo $cat->catname.' ('.$countcatevents[$cat->id].')';
?>
</div>
<?php
}
}
}
}
}
?>
</div>
</div>
<?php endif; ?>
<?php
// print the calendar
echo $this->cal->showMonth();
?>
<?php if ($displayLegend == 1) : ?>
<!-- Calendar legend below -->
<div id="jlcalendarlegend">
<!-- Calendar Legend -->
<div class="calendarLegends">
<?php
##############
## FOR EACH ##
##############
$counter = array();
# walk through events
foreach ($this->rows as $row) {
foreach ($row->categories as $cat) {
# skip foreign categories - we are restricted to one
if ($cat->id != $this->catid) {
continue;
}
# 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)) {
?>
<div class="eventCat btn btn-outline-dark" id="cat<?php echo $cat->id; ?>">
<?php
if (isset($cat->color) && $cat->color) {
echo '<span class="colorpic" style="background-color: '.$cat->color.';"></span>';
}
echo $cat->catname.' ('.$countcatevents[$cat->id].')';
?>
</div>
<?php
}
}
}
}
?>
</div>
</div>
<?php endif; ?>
<div class="clr"></div>
<div class="copyright">
<?php echo JemOutput::footer(); ?>
</div>
</div>

View File

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_JEM_CATEGORY_CALENDAR_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_JEM_CATEGORY_CALENDAR_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_jem/models/fields"
>
<field name="id" type="categories"
default=""
label="COM_JEM_SELECT_CATEGORY"
description="COM_JEM_SELECT_CATEGORY_DESC"
required="true"
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic">
<field name="introtext" type="textarea"
filter="safehtml"
default=""
rows="8"
cols="30"
label="COM_JEM_INTROTEXT_FIELD"
description="COM_JEM_INTROTEXT_FIELD_DESC"
/>
<field name="showintrotext" type="radio"
default="0"
label="COM_JEM_DISPLAY_INTROTEXT"
description="COM_JEM_DISPLAY_INTROTEXT_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">COM_JEM_SHOW</option>
<option value="0">COM_JEM_HIDE</option>
</field>
<field type="spacer" name="myspacer2" hr="true" />
<field name="show_archived_events" type="radio"
default="0"
label="COM_JEM_SHOW_ARCHIVED_EVENTS"
description="COM_JEM_SHOW_ARCHIVED_EVENTS_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="displayLegend" type="list"
default="1"
label="COM_JEM_DISPLAY_LEGEND"
description="COM_JEM_DISPLAY_LEGEND_DESC"
>
<option value="0">JNO</option>
<option value="2">COM_JEM_ABOVE</option>
<option value="1">COM_JEM_BELOW</option>
</field>
<field name="show_only_start" type="radio"
default="0"
label="COM_JEM_SHOWONLYSTARTDAY"
description="COM_JEM_SHOWONLYSTARTDAY_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="firstweekday" type="list"
default="1"
label="COM_JEM_SELECTFIRSTWEEKDAY"
description="COM_JEM_SELECTFIRSTWEEKDAYDESC"
>
<option value="0">COM_JEM_SUNDAY</option>
<option value="1">COM_JEM_MONDAY</option>
</field>
<field name="daylimit" type="text"
default="10"
label="COM_JEM_MAX_EVENTS_PER_DAY"
description="COM_JEM_MAX_EVENTS_PER_DAY_DESC"
/>
<field name="show_addevent_icon" type="radio"
default="0"
label="COM_JEM_SHOWADDEVENTICON"
description="COM_JEM_SHOWADDEVENTICON_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="show_editevent_icon" type="radio"
default="0"
label="COM_JEM_SHOWEDITEVENTICON"
description="COM_JEM_SHOWEDITEVENTICON_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="show_copyevent_icon" type="radio"
default="0"
label="COM_JEM_SHOWCOPYEVENTICON"
description="COM_JEM_SHOWCOPYEVENTICON_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field type="spacer" name="myspacer3" hr="true" />
<field name="eventlinkcolor" type="color"
default="#000000"
label="COM_JEM_CALENDAR_EVENTLINKCOLOR"
description="COM_JEM_CALENDAR_EVENTLINKCOLOR_DESC"
/>
<field name="eventbackgroundcolor" type="color"
default="#FFFF00"
label="COM_JEM_CALENDAR_EVENTBACKGROUNDCOLOR"
description="COM_JEM_CALENDAR_EVENTBACKGROUNDCOLOR_DESC"
/>
<field name="eventbg_usecatcolor" type="radio"
default="0"
label="COM_JEM_CALENDAR_USECATCOLOR"
description="COM_JEM_CALENDAR_USECATCOLOR_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="currentdaycolor" type="color"
default="#CCCC99"
label="COM_JEM_CALENDAR_CURRENTDAYCOLOR"
description="COM_JEM_CALENDAR_CURRENTDAYCOLOR_DESC"
/>
<field name="eventandmorecolor" type="color"
default="#FFFF00"
label="COM_JEM_CALENDAR_EVENTANDMORECOLOR"
description="COM_JEM_CALENDAR_EVENTANDMORECOLOR_DESC"
/>
<field name="usefeaturedborder" type="radio"
default="0"
label="COM_JEM_CALENDAR_USEFEATUREDBORDER"
description="COM_JEM_CALENDAR_USEFEATUREDBORDER_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="featuredbordercolor" type="color"
default="#000080"
label="COM_JEM_CALENDAR_FEATUREDBORDERCOLOR"
description="COM_JEM_CALENDAR_FEATUREDBORDERCOLOR_DESC"
/>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,106 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
?>
<div id="jem" class="jem_category<?php echo $this->pageclass_sfx;?>">
<div class="buttons">
<?php
$btn_params = array('id' => $this->category->slug, 'slug' => $this->category->slug, 'task' => $this->task, 'print_link' => $this->print_link);
echo JemOutput::createButtonBar($this->getName(), $this->permissions, $btn_params);
?>
</div>
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<h1 class='componentheading'>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<div class="clr"></div>
<div class="floattext">
<?php if ($this->jemsettings->discatheader) : ?>
<div class="catimg">
<?php
// flyer
if (empty($this->category->image)) {
$jemsettings = JEMHelper::config();
$imgattribs['width'] = $jemsettings->imagewidth;
$imgattribs['height'] = $jemsettings->imagehight;
echo HTMLHelper::_('image', 'com_jem/noimage.png', $this->category->catname, $imgattribs, true);
}
else {
echo JemOutput::flyer($this->category, $this->cimage, 'category');
}
?>
</div>
<?php endif; ?>
<div class="description">
<p><?php echo $this->description; ?></p>
</div>
</div>
<!--subcategories-->
<?php
if ($this->showsubcats && $this->maxLevel != 0 && !empty($this->category->id) && !empty($this->children[$this->category->id])) :
$countsubcats = 0;
foreach ($this->children[$this->category->id] as $id => $child) :
// Do we have any non-empty subcategory or should generally show empty subcategories?
// Note: We also show empty subcategories if they have at least one non-empty subsubcategory.
if ($this->showemptysubcats || ($child->getNumItems(true) > 0)) :
++$countsubcats;
endif;
endforeach;
if ($countsubcats) :
?>
<div class="cat-children">
<?php if ($this->params->get('show_category_heading_title_text', 1) == 1) : ?>
<h3>
<?php echo TEXT::_('COM_JEM_SUBCATEGORIES'); ?>
</h3>
<?php endif; ?>
<?php echo $this->loadTemplate('subcategories'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<form action="<?php echo htmlspecialchars($this->action); ?>" method="post" id="adminForm">
<!--table-->
<?php echo $this->loadTemplate('events_table'); ?>
<input type="hidden" name="option" value="com_jem" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="view" value="category" />
<input type="hidden" name="task" value="<?php echo $this->task; ?>" />
<input type="hidden" name="id" value="<?php echo $this->category->id; ?>" />
</form>
<!--pagination-->
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<!-- iCal -->
<div id="iCal" class="iCal">
<?php echo JemOutput::icalbutton($this->category->id, 'category'); ?>
</div>
<!-- copyright -->
<div class="copyright">
<?php echo JemOutput::footer( ); ?>
</div>
</div>
<?php echo JemOutput::lightbox(); ?>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_JEM_CATEGORY_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_JEM_CATEGORY_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_jem/models/fields"
>
<field name="id" type="categories"
default=""
label="COM_JEM_SELECT_CATEGORY"
description="COM_JEM_SELECT_CATEGORY_DESC"
required="true"
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic">
<field name="usecat" type="radio"
default="1"
label="COM_JEM_DISPLAYCHILDS"
description="COM_JEM_DISPLAYCHILDSDESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="showemptychilds" type="radio"
default="1"
label="COM_JEM_SHOWEMPTYCHILD"
description="COM_JEM_SHOWEMPTYCHILDDESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,94 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
$class = ' class="first"';
?>
<?php /*
<div class="subcategories">
<?php //echo Text::_('COM_JEM_SUBCATEGORIES'); ?>
</div>
*/ ?>
<?php if (array_key_exists($this->category->id, $this->children) && (count($this->children[$this->category->id]) > 0)) : ?>
<?php
$lastid = 0;
foreach ($this->children[$this->category->id] as $id => $child) :
if ($this->params->get('showemptychilds', 1) || ($child->getNumItems(true) > 0)) :
$lastid = $id;
endif;
endforeach;
?>
<ul>
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
<?php
// Note: We don't skip empty subcategories if they have at least one non-empty subsubcategory.
if (!$this->params->get('showemptychilds', 1) && ($child->getNumItems(true) <= 0)) :
continue; // skip this subcat
endif;
if ($id == $lastid) :
$class = ' class="last"';
endif;
?>
<li<?php echo $class; ?>>
<?php $class = ''; ?>
<span class="item-title">
<a href="<?php echo Route::_(JemHelperRoute::getCategoryRoute($child->id, $this->task)); ?>">
<?php echo $this->escape($child->catname); ?>
</a>
</span>
<?php if ($this->params->get('show_subcat_desc') == 1) : ?>
<?php if ($child->description) : ?>
<div class="category-desc">
<?php echo HTMLHelper::_('content.prepare', $child->description, '', 'com_content.category'); ?>
</div>
<?php endif; ?>
<?php if ( $this->params->get('show_cat_num_articles', 1)) : ?>
<dl>
<dt>
<?php echo Text::_('COM_JEM_EVENTS') . ':' ; ?>
</dt>
<dd>
<?php echo $child->getNumItems(false); /* count direct events only, not recursive */ ?>
</dd>
</dl>
<?php endif; ?>
<?php elseif ($this->params->get('show_cat_num_articles', 1)) : ?>
<?php echo ' (' . $child->getNumItems(false) . ')'; /* count direct events only, not recursive */ ?>
<?php /* experimental * /
$count = $child->getNumItemsByState(false);
echo ' (' . $count['published'] . ' + ' . $count['unpublished'] . ' / ' . $count['archived'] . ' - ' . $count['trashed'] . ')';
/**/
?>
<?php endif; ?>
<?php if (count($child->getChildren()) > 0 ) :
$this->children[$child->id] = $child->getChildren();
$this->category = $child;
$this->maxLevel--;
if ($this->maxLevel != 0) :
echo $this->loadTemplate('subcategories');
endif;
$this->category = $child->getParent();
$this->maxLevel++;
endif; ?>
</li>
<?php // endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,433 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<div id="jem" class="jlcalendar jem_calendar<?php echo $this->pageclass_sfx;?>">
<div class="buttons">
<?php
$btn_params = array('print_link' => $this->print_link, 'ical_link' => $this->ical_link);
echo JemOutput::createButtonBar($this->getName().'-cal', $this->permissions, $btn_params);
?>
</div>
<?php if ($this->params->get('show_page_heading', 1)): ?>
<h1 class="componentheading">
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('showintrotext')) : ?>
<div class="description no_space floattext">
<?php echo $this->params->get('introtext'); ?>
</div>
<p> </p>
<?php endif; ?>
<?php
$countcatevents = array ();
$countperday = array();
$limit = $this->params->get('daylimit', 10);
$evbg_usecatcolor = $this->params->get('eventbg_usecatcolor', 0);
$showtime = $this->settings->get('global_show_timedetails', 1);
foreach ($this->rows as $row) :
if (!JemHelper::isValidDate($row->dates)) {
continue; // skip, open date !
}
//get event date
$year = date('Y', strtotime($row->dates));
$month = date('m', strtotime($row->dates));
$day = date('d', strtotime($row->dates));
@$countperday[$year.$month.$day]++;
if ($countperday[$year.$month.$day] == $limit+1) {
$var1a = Route::_('index.php?option=com_jem&view=day&id='.$year.$month.$day.'&catid='.$this->catid);
$var1b = Text::_('COM_JEM_AND_MORE');
$var1c = "<a href=\"".$var1a."\">".$var1b."</a>";
$id = 'eventandmore';
/**
* $cal->setEventContent($year,$month,$day,$content,[$contentUrl,$id])
*
* Info from: https://www.micronetwork.de/activecalendar/demo/doc/doc_en.html
*
* Call this method, if you want the class to create a new HTML table within the date specified by the parameters $year, $month, $day.
* The parameter $content can be a string or an array.
* If $content is a string, then the new generated table will contain one row with the value of $content.
* If it is an array, the generated table will contain as many rows as the array length and each row will contain the value of each array item.
* The parameter $contentUrl is optional: If you set a $contentUrl, an event content specific link (..href='$contentUrl'..) will be generated
* in the 'event content' table row(s), even if the method $cal->enableDayLinks($link) was not called.
* The parameter $id is optional as well: if you set an $id, a HTML class='$id' will be generated for each event content (default: 'eventcontent').
*/
$this->cal->setEventContent($year, $month, $day, $var1c, null, $id);
continue;
} elseif ($countperday[$year.$month.$day] > $limit+1) {
continue;
}
//for time in tooltip
$timehtml = '';
if ($showtime) {
$start = JemOutput::formattime($row->times);
$end = JemOutput::formattime($row->endtimes);
if ($start != '') {
$timehtml = '<div class="time"><span class="text-label">'.Text::_('COM_JEM_TIME_SHORT').': </span>';
$timehtml .= $start;
if ($end != '') {
$timehtml .= ' - '.$end;
}
$timehtml .= '</div>';
}
}
$eventname = '<div class="eventName">'.Text::_('COM_JEM_TITLE_SHORT').': '.$this->escape($row->title).'</div>';
$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 .= '<div id="scat" class="cat'.$category->id.'">';
$contentend .= '</div>';
//attach category color if any in front of the catname
if ($category->color) {
$multicatname .= '<span class="colorpic" style="background-color: '.$category->color.';"></span>&nbsp;'.$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 .= '<span class="colorpic" style="background-color: '.$category->color.';"></span>';
$catcolor[$category->color] = $category->color; // we need to list all different colors of this event
}
//count occurence of the category
if (!isset($row->multi) || ($row->multi == 'first')) {
if (!array_key_exists($category->id, $countcatevents)) {
$countcatevents[$category->id] = 1;
} else {
$countcatevents[$category->id]++;
}
}
}
// multiday
$multi_mode = 0; // single day
$multi_icon = '';
if (isset($row->multi)) {
switch ($row->multi) {
case 'first': // first day
$multi_mode = 1;
$multi_icon = HTMLHelper::_("image","com_jem/arrow-left.png",'', NULL, true);
break;
case 'middle': // middle day
$multi_mode = 2;
$multi_icon = HTMLHelper::_("image","com_jem/arrow-middle.png",'', NULL, true);
break;
case 'zlast': // last day
$multi_mode = 3;
$multi_icon = HTMLHelper::_("image","com_jem/arrow-right.png",'', NULL, true);
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 . '<br />';
break;
case 2:
$timetp .= $multi_icon . '<br />';
break;
case 3:
$timetp .= $multi_icon . ' ' . $end . '<br />';
break;
default:
if ($start != '') {
$timetp .= $start;
if ($end != '') {
$timetp .= ' - '.$end;
}
$timetp .= '<br />';
}
break;
}
} else {
if (!empty($multi_icon)) {
$timetp .= $multi_icon . ' ';
}
}
$catname = '<div class="catname">'.$multicatname.'</div>';
$eventdate = !empty($row->multistartdate) ? JemOutput::formatdate($row->multistartdate) : JemOutput::formatdate($row->dates);
if (!empty($row->multienddate)) {
$eventdate .= ' - ' . JemOutput::formatdate($row->multienddate);
} else if ($row->enddates && $row->dates < $row->enddates) {
$eventdate .= ' - ' . JemOutput::formatdate($row->enddates);
}
//venue
if ($this->jemsettings->showlocate == 1) {
$venue = '<div class="location"><span class="text-label">'.Text::_('COM_JEM_VENUE_SHORT').': </span>';
$venue .= !empty($row->venue) ? $this->escape($row->venue) : '-';
$venue .= '</div>';
} else {
$venue = '';
}
// state if unpublished
$statusicon = '';
if (isset($row->published) && ($row->published != 1)) {
$statusicon = JemOutput::publishstateicon($row);
$eventstate = '<div class="eventstate"><span class="text-label">'.Text::_('JSTATUS').': </span>';
switch ($row->published) {
case 1: $eventstate .= Text::_('JPUBLISHED'); break;
case 0: $eventstate .= Text::_('JUNPUBLISHED'); break;
case 2: $eventstate .= Text::_('JARCHIVED'); break;
case -2: $eventstate .= Text::_('JTRASHED'); break;
}
$eventstate .= '</div>';
} else {
$eventstate = '';
}
//date in tooltip
$multidaydate = '<div class="time"><span class="text-label">'.Text::_('COM_JEM_DATE').': </span>';
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 .= '</div>';
//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 .= '<div class="inline-button-right">';
$editicon .= join(' ', $btns);
$editicon .= '</div>';
}
}
//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 .= '<div class="eventcontentinner event_id' . $eventid . ' cat_id' . $category->id . ' ' . $featuredclass . '" style="' . $featuredstyle;
if (!empty($evbg_usecatcolor) && (count($catcolor) == 1)) {
$content .= '; background-color:'.array_pop($catcolor);
$content .= '" onclick="location.href=\''.$detaillink.'\'">';
} else {
$content .= '" onclick="location.href=\''.$detaillink.'\'">' . $colorpic;
}
$content .= $editicon;
$content .= JemHelper::caltooltip($catname.$eventname.$timehtml.$venue.$eventstate, $eventdate, $row->title . $statusicon, $detaillink, 'editlinktip hasTip', $timetp, $category->color);
$content .= $contentend . '</div>';
$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('catid='.$this->catid);
$this->cal->enableNewEventLinks($html);
}
$displayLegend = (int)$this->params->get('displayLegend', 1);
if ($displayLegend == 2) : ?>
<!-- Calendar legend above -->
<div id="jlcalendarlegend">
<!-- Calendar buttons -->
<div class="calendarButtons jem-row jem-justify-start">
<button id="buttonshowall" class="calendarButton btn btn-outline-dark">
<?php echo Text::_('COM_JEM_SHOWALL'); ?>
</button>
<button id="buttonhideall" class="calendarButton btn btn-outline-dark">
<?php echo Text::_('COM_JEM_HIDEALL'); ?>
</button>
</div>
<!-- Calendar Legend -->
<div class="calendarLegends jem-row jem-justify-start">
<?php
if ($this->params->get('displayLegend')) {
##############
## FOR EACH ##
##############
$counter = array();
# walk through events
foreach ($this->rows as $row) {
foreach ($row->categories as $cat) {
# skip foreign categories - we are restricted to one
if ($cat->id != $this->catid) {
continue;
}
# 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)) {
?>
<button class="eventCat btn btn-outline-dark" id="cat<?php echo $cat->id; ?>">
<?php
if (isset($cat->color) && $cat->color) {
echo '<span class="colorpic" style="background-color: '.$cat->color.';"></span>';
}
echo $cat->catname.' ('.$countcatevents[$cat->id].')';
?>
</button>
<?php
}
}
}
}
}
?>
</div>
</div>
<?php endif; ?>
<?php
// print the calendar
echo $this->cal->showMonth();
?>
<?php if ($displayLegend == 1) : ?>
<!-- Calendar legend below -->
<div id="jlcalendarlegend">
<!-- Calendar buttons -->
<div class="calendarButtons jem-row jem-justify-start">
<button id="buttonshowall" class="calendarButton btn btn-outline-dark">
<?php echo Text::_('COM_JEM_SHOWALL'); ?>
</button>
<button id="buttonhideall" class="calendarButton btn btn-outline-dark">
<?php echo Text::_('COM_JEM_HIDEALL'); ?>
</button>
</div>
<!-- Calendar Legend -->
<div class="calendarLegends jem-row jem-justify-start">
<?php
##############
## FOR EACH ##
##############
$counter = array();
# walk through events
foreach ($this->rows as $row) {
foreach ($row->categories as $cat) {
# skip foreign categories - we are restricted to one
if ($cat->id != $this->catid) {
continue;
}
# 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)) {
?>
<button class="eventCat btn btn-outline-dark" id="cat<?php echo $cat->id; ?>">
<?php
if (isset($cat->color) && $cat->color) {
echo '<span class="colorpic" style="background-color: '.$cat->color.';"></span>';
}
echo $cat->catname.' ('.$countcatevents[$cat->id].')';
?>
</button>
<?php
}
}
}
}
?>
</div>
</div>
<?php endif; ?>
<div class="clr"></div>
<div class="copyright">
<?php echo JemOutput::footer(); ?>
</div>
</div>

View File

@ -0,0 +1,114 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
?>
<div id="jem" class="jem_category<?php echo $this->pageclass_sfx;?>">
<div class="buttons">
<?php
$btn_params = array('id' => $this->category->slug, 'slug' => $this->category->slug, 'task' => $this->task, 'print_link' => $this->print_link);
echo JemOutput::createButtonBar($this->getName(), $this->permissions, $btn_params);
?>
</div>
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<h1 class='componentheading'>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->escape($this->params->get('page_heading')) != $this->escape($this->category->title)) : ?>
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<h2 class="jem-category-title">
<?php echo $this->escape($this->category->title);?>
</h2>
<?php else : ?>
<h1 class="jem-category-title">
<?php echo $this->escape($this->category->title);?>
</h1>
<?php endif; ?>
<?php endif; ?>
<style>
.jem-catimg {
flex-basis: <?php echo $this->jemsettings->imagewidth; ?>px;
}
</style>
<?php if (($this->jemsettings->discatheader) && (!empty($this->category->image))) : ?>
<div class="jem-catimg">
<?php echo JemOutput::flyer($this->category, $this->cimage, 'category'); ?>
</div>
<?php endif; ?>
<div class="description">
<p><?php echo $this->description; ?></p>
</div>
<div class="jem-clear">
</div>
<!--subcategories-->
<?php
if ($this->showsubcats && $this->maxLevel != 0 && !empty($this->category->id) && !empty($this->children[$this->category->id])) :
$countsubcats = 0;
foreach ($this->children[$this->category->id] as $id => $child) :
// Do we have any non-empty subcategory or should generally show empty subcategories?
// Note: We also show empty subcategories if they have at least one non-empty subsubcategory.
if ($this->showemptysubcats || ($child->getNumItems(true) > 0)) :
++$countsubcats;
endif;
endforeach;
if ($countsubcats) :
?>
<div class="cat-children">
<?php if ($this->params->get('show_category_heading_title_text', 1) == 1) : ?>
<h2>
<?php echo Text::_('COM_JEM_SUBCATEGORIES'); ?>
</h2>
<?php endif; ?>
<?php echo $this->loadTemplate('subcategories'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<h2>
<?php echo Text::_('COM_JEM_EVENTS'); ?>
</h2>
<form action="<?php echo htmlspecialchars($this->action); ?>" method="post" id="adminForm">
<!--table-->
<?php echo $this->loadTemplate('events_table'); ?>
<input type="hidden" name="option" value="com_jem" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="view" value="category" />
<input type="hidden" name="task" value="<?php echo $this->task; ?>" />
<input type="hidden" name="id" value="<?php echo $this->category->id; ?>" />
</form>
<!--pagination-->
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<!-- iCal -->
<div id="iCal" class="iCal">
<?php echo JemOutput::icalbutton($this->category->id, 'category'); ?>
</div>
<!-- copyright -->
<div class="copyright">
<?php echo JemOutput::footer(); ?>
</div>
</div>
<?php echo JemOutput::lightbox(); ?>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,83 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/**
* Category-Feed
*/
class JemViewCategory extends HtmlView
{
/**
* Creates the Event Feed of the Category
*/
public function display($tpl = null)
{
$app = Factory::getApplication();
$document = $app->getDocument();
$jemsettings = JemHelper::config();
// Get some data from the model
$app->input->set('limit', $app->get('feed_limit'));
$rows = $this->get('Items');
if (!empty($rows)) {
foreach ($rows as $row)
{
// strip html from feed item title
$title = $this->escape($row->title);
$title = html_entity_decode($title);
// strip html from feed item category
if (!empty($row->categories)) {
$category = array();
foreach ($row->categories AS $category2) {
$category[] = $category2->catname;
}
// adding the , to the list when there are multiple category's
$category = $this->escape(implode(', ', $category));
$category = html_entity_decode($category);
} else {
$category = '';
}
//Format date and time
$displaydate = JemOutput::formatLongDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $jemsettings->showtime);
// url link to event
$link = Route::_(JemHelperRoute::getEventRoute($row->id));
// feed item description text
$description = Text::_('COM_JEM_TITLE').': '.$title.'<br />';
$description .= Text::_('COM_JEM_VENUE').': '.$row->venue.($row->city ? (' / '.$row->city) : '').'<br />';
$description .= Text::_('COM_JEM_CATEGORY').': '.$category.'<br />';
$description .= Text::_('COM_JEM_DATE').': '.$displaydate.'<br />';
$description .= Text::_('COM_JEM_DESCRIPTION').': '.$row->fulltext;
$created = ($row->created ? date('r', strtotime($row->created)) : '');
// load individual item creator class
$item = new JFeedItem();
$item->title = $title;
$item->link = $link;
$item->description = $description;
$item->date = $created;
$item->category = $category;
// loads item info into rss array
$document->addItem($item);
}
}
}
}
?>

View File

@ -0,0 +1,352 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Plugin\PluginHelper;
/**
* Category-View
*/
class JemViewCategory extends JemView
{
protected $state;
protected $items;
protected $category;
protected $children;
protected $pagination;
public function __construct($config = array())
{
parent::__construct($config);
// additional path for common templates + corresponding override path
$this->addCommonTemplatePath();
}
/**
* Creates the Category View
*/
public function display($tpl = null)
{
if ($this->getLayout() == 'calendar')
{
### Category Calendar view ###
//initialize variables
$app = Factory::getApplication();
$document = $app->getDocument();
$jemsettings = JemHelper::config();
$settings = JemHelper::globalattribs();
$user = JemFactory::getUser();
$menu = $app->getMenu();
$menuitem = $menu->getActive();
$params = $app->getParams();
$uri = Uri::getInstance();
$pathway = $app->getPathWay();
$print = $app->input->getBool('print', false);
$url = Uri::root();
// Load css
JemHelper::loadCss('jem');
JemHelper::loadCss('calendar');
JemHelper::loadCustomCss();
JemHelper::loadCustomTag();
if ($print) {
JemHelper::loadCss('print');
$document->setMetaData('robots', 'noindex, nofollow');
}
$evlinkcolor = $params->get('eventlinkcolor');
$evbackgroundcolor = $params->get('eventbackgroundcolor');
$currentdaycolor = $params->get('currentdaycolor');
$eventandmorecolor = $params->get('eventandmorecolor');
$style = '
div#jem .eventcontentinner a, div#jem .eventandmore a {color:' . $evlinkcolor . ';}
.eventcontentinner {background-color:'.$evbackgroundcolor .';}
.eventandmore {background-color:'.$eventandmorecolor .';}
.today .daynum {background-color:'.$currentdaycolor.';}';
$document->addStyleDeclaration($style);
// add javascript (using full path - see issue #590)
// HTMLHelper::_('script', 'media/com_jem/js/calendar.js');
$document->addScript($url.'media/com_jem/js/calendar.js');
// Retrieve date variables
$year = (int)$app->input->getInt('yearID', date("Y"));
$month = (int)$app->input->getInt('monthID', date("m"));
$catid = $app->input->getInt('id', 0);
if (empty($catid)) {
$catid = $params->get('id');
}
// get data from model and set the month
$model = $this->getModel('CategoryCal');
$model->setDate(mktime(0, 0, 1, $month, 1, $year));
$category = $this->get('Category', 'CategoryCal');
$rows = $this->get('Items', 'CategoryCal');
// Set Page title
$pagetitle = $params->def('page_title', $menuitem->title);
$params->def('page_heading', $params->get('page_title'));
$pageclass_sfx = $params->get('pageclass_sfx');
// Add site name to title if param is set
if ($app->get('sitename_pagetitles', 0) == 1) {
$pagetitle = Text::sprintf('JPAGETITLE', $app->get('sitename'), $pagetitle);
}
elseif ($app->get('sitename_pagetitles', 0) == 2) {
$pagetitle = Text::sprintf('JPAGETITLE', $pagetitle, $app->get('sitename'));
}
$document->setTitle($pagetitle);
$document->setMetaData('title', $pagetitle);
// Check if the user has permission to add things
$permissions = new stdClass();
$permissions->canAddEvent = $user->can('add', 'event', false, false, $catid);
$permissions->canAddVenue = $user->can('add', 'venue', false, false, $catid);
$itemid = $app->input->getInt('Itemid', 0);
$partItemid = ($itemid > 0) ? '&Itemid='.$itemid : '';
$partCatid = ($catid > 0) ? '&id=' . $catid : '';
$url_base = 'index.php?option=com_jem&view=category&layout=calendar' . $partCatid . $partItemid;
$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');
$print_link = Route::_($url_base . $partDate . '&print=1&tmpl=component');
// init calendar
$cal = new JemCalendar($year, $month, 0);
$cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : ''));
$cal->setFirstWeekDay($params->get('firstweekday', 1));
$cal->enableDayLinks('index.php?option=com_jem&view=day&catid='.$catid);
$this->rows = $rows;
$this->catid = $catid;
$this->params = $params;
$this->jemsettings = $jemsettings;
$this->settings = $settings;
$this->permissions = $permissions;
$this->cal = $cal;
$this->pageclass_sfx = $pageclass_sfx ? htmlspecialchars($pageclass_sfx) : $pageclass_sfx;
$this->print_link = $print_link;
$this->print = $print;
$this->ical_link = $partDate;
}
else
{
### Category List view ###
//initialize variables
$app = Factory::getApplication();
$document = $app->getDocument();
$jemsettings = JemHelper::config();
$settings = JemHelper::globalattribs();
$user = JemFactory::getUser();
$print = $app->input->getBool('print', false);
// get menu information
$uri = Uri::getInstance();
$pathway = $app->getPathWay();
$menu = $app->getMenu();
$menuitem = $menu->getActive();
// Load css
JemHelper::loadCss('jem');
JemHelper::loadCustomCss();
JemHelper::loadCustomTag();
if ($print) {
JemHelper::loadCss('print');
$document->setMetaData('robots', 'noindex, nofollow');
}
// get data from model
$state = $this->get('State');
$params = $state->params;
$items = $this->get('Items');
$category = $this->get('Category');
$children = $this->get('Children');
$parent = $this->get('Parent');
if ($category == false)
{
throw new Exception(Text::_('JGLOBAL_CATEGORY_NOT_FOUND'), 404);
}
// are events available?
$noevents = (!$items) ? 1 : 0;
// Decide which parameters should take priority
$useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem'
&& $menuitem->query['view'] == 'category'
&& (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default')
&& $menuitem->query['id'] == $category->id);
// get variables
$itemid = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);
$this->showsubcats = (bool)$params->get('usecat', 1);
$this->showemptysubcats = (bool)$params->get('showemptychilds', 1);
$filter_order = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd');
$filter_order_Dir = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter_type = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_filtertype', 'filter_type', 0, 'int');
$search = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_search', 'filter_search', '', 'string');
$search_month = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_month', 'filter_month', '', 'string');
$task = $app->input->get('task', '');
// table ordering
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
// search filter
$filters = array();
if ($jemsettings->showtitle == 1) {
$filters[] = HTMLHelper::_('select.option', '1', Text::_('COM_JEM_TITLE'));
}
if ($jemsettings->showlocate == 1) {
$filters[] = HTMLHelper::_('select.option', '2', Text::_('COM_JEM_VENUE'));
}
if ($jemsettings->showcity == 1) {
$filters[] = HTMLHelper::_('select.option', '3', Text::_('COM_JEM_CITY'));
}
if ($jemsettings->showcat == 1) {
$filters[] = HTMLHelper::_('select.option', '4', Text::_('COM_JEM_CATEGORY'));
}
if ($jemsettings->showstate == 1) {
$filters[] = HTMLHelper::_('select.option', '5', Text::_('COM_JEM_STATE'));
}
$lists['filter'] = HTMLHelper::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'form-select'), 'value', 'text', $filter_type);
// search filter
$lists['search'] = $search;
// don't show column "Category" on Category view
$lists['hide'] = array('category' => 1);
// Add feed links
$link = '&format=feed&id='.$category->id.'&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$this->document->addHeadLink(Route::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$this->document->addHeadLink(Route::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
// create the pathway
$cats = new JemCategories($category->id);
$parents = $cats->getParentlist();
foreach ($parents as $parent) {
$pathway->addItem($this->escape($parent->catname), Route::_(JemHelperRoute::getCategoryRoute($parent->slug)) );
}
// Show page heading specified on menu item or category title as heading - idea taken from com_content.
//
// Check to see which parameters should take priority
// If the current view is the active menuitem and an category view for this category, then the menu item params take priority
if ($useMenuItemParams) {
$pagetitle = $params->get('page_title', $menuitem->title ? $menuitem->title : $category->catname);
$pageheading = $params->get('page_heading', $pagetitle);
$pathwayKeys = array_keys($pathway->getPathway());
$lastPathwayEntryIndex = end($pathwayKeys);
$pathway->setItemName($lastPathwayEntryIndex, $menuitem->title);
//$pathway->setItemName(1, $menuitem->title);
} else {
$pagetitle = $category->catname;
$pageheading = $pagetitle;
$params->set('show_page_heading', 1); // ensure page heading is shown
$pathway->addItem($category->catname, Route::_(JemHelperRoute::getCategoryRoute($category->slug)) );
}
$pageclass_sfx = $params->get('pageclass_sfx');
if ($task == 'archive') {
$pathway->addItem(Text::_('COM_JEM_ARCHIVE'), Route::_(JemHelperRoute::getCategoryRoute($category->slug).'&task=archive'));
$print_link = Route::_(JemHelperRoute::getCategoryRoute($category->id) .'&task=archive&print=1&tmpl=component');
$pagetitle .= ' - '.Text::_('COM_JEM_ARCHIVE');
$pageheading .= ' - '.Text::_('COM_JEM_ARCHIVE');
} else {
$print_link = Route::_(JemHelperRoute::getCategoryRoute($category->id) .'&print=1&tmpl=component');
}
$params->set('page_heading', $pageheading);
// Add site name to title if param is set
if ($app->get('sitename_pagetitles', 0) == 1) {
$pagetitle = Text::sprintf('JPAGETITLE', $app->get('sitename'), $pagetitle);
}
elseif ($app->get('sitename_pagetitles', 0) == 2) {
$pagetitle = Text::sprintf('JPAGETITLE', $pagetitle, $app->get('sitename'));
}
// Set Page title & Meta data
$this->document->setTitle($pagetitle);
$document->setMetaData('title', $pagetitle);
$document->setMetadata('keywords', $category->meta_keywords);
$document->setDescription(strip_tags($category->meta_description));
// Check if the user has permission to add things
$permissions = new stdClass();
$permissions->canAddEvent = $user->can('add', 'event', false, false, $category->id);
$permissions->canAddVenue = $user->can('add', 'venue', false, false, $category->id);
// Create the pagination object
$pagination = $this->get('Pagination');
// Generate Categorydescription
if (empty ($category->description)) {
$description = Text::_('COM_JEM_NO_DESCRIPTION');
} else {
// execute plugins
$category->text = $category->description;
$category->title = $category->catname;
PluginHelper::importPlugin('content');
$app->triggerEvent('onContentPrepare', array('com_jem.category', &$category, &$params, 0));
$description = $category->text;
}
$cimage = JemImage::flyercreator($category->image,'category');
$this->lists = $lists;
$this->action = $uri->toString();
$this->cimage = $cimage;
$this->rows = $items;
$this->noevents = $noevents;
$this->print_link = $print_link;
$this->print = $print;
$this->params = $params;
$this->dellink = $permissions->canAddEvent; // deprecated
$this->permissions = $permissions;
$this->task = $task;
$this->description = $description;
$this->pagination = $pagination;
$this->jemsettings = $jemsettings;
$this->settings = $settings;
$this->pageclass_sfx = $pageclass_sfx ? htmlspecialchars($pageclass_sfx) : $pageclass_sfx;
$this->maxLevel = $params->get('maxLevel', -1);
$this->category = $category;
$this->children = array($category->id => $children);
$this->parent = $parent;
$this->user = $user;
}
parent::display($tpl);
}
}
?>

View File

@ -0,0 +1,56 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
/**
* Raw: Category
*/
class JemViewCategory extends HtmlView
{
/**
* Creates the output for the Category view
*/
public function display($tpl = null)
{
$settings = JemHelper::config();
$settings2 = JemHelper::globalattribs();
$app = Factory::getApplication();
$jinput = $app->input;
$year = (int)$jinput->getInt('yearID', date("Y"));
$month = (int)$jinput->getInt('monthID', date("m"));
$catid = (int)$jinput->getInt('id', 0);
if ($settings2->get('global_show_ical_icon','0')==1) {
// Get data from the model
$model = $this->getModel('CategoryCal');
$model->setState('list.start',0);
$model->setState('list.limit',$settings->ical_max_items);
$model->setDate(mktime(0, 0, 1, $month, 1, $year));
$rows = $model->getItems();
// initiate new CALENDAR
$vcal = JemHelper::getCalendarTool();
$vcal->setConfig("filename", "events_category_" . $catid . "_". $year . $month . ".ics");
if (!empty($rows)) {
foreach ($rows as $row) {
JemHelper::icalAddEvent($vcal, $row);
}
}
// generate and redirect output to user browser
$vcal->returnCalendar();
}
}
}