primo commit
This commit is contained in:
1
components/com_jem/views/calendar/index.html
Normal file
1
components/com_jem/views/calendar/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
424
components/com_jem/views/calendar/tmpl/default.php
Normal file
424
components/com_jem/views/calendar/tmpl/default.php
Normal file
@ -0,0 +1,424 @@
|
||||
<?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\Router\Route;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
?>
|
||||
|
||||
<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 . $this->param_topcat);
|
||||
$var1b = Text::_('COM_JEM_AND_MORE');
|
||||
$var1c = "<a href=\"".$var1a."\">".$var1b."</a>";
|
||||
$id = 'eventandmore';
|
||||
|
||||
$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="catz" class="cat'.$category->id.'">';
|
||||
$contentend .= '</div>';
|
||||
|
||||
//attach category color if any in front of the catname
|
||||
if ($category->color) {
|
||||
$multicatname .= '<span class="colorpic" style="width:6px; background-color: '.$category->color.';"></span> '.$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="width:6px; 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]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$color = '<div id="eventcontenttop" class="eventcontenttop">';
|
||||
$color .= $colorpic;
|
||||
$color .= '</div>';
|
||||
|
||||
// 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();
|
||||
$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">
|
||||
<div class="calendarButtonsToggle">
|
||||
<div id="buttonshowall" class="btn btn-outline-dark">
|
||||
<?php echo Text::_('COM_JEM_SHOWALL'); ?>
|
||||
</div>
|
||||
<div id="buttonhideall" class="btn btn-outline-dark">
|
||||
<?php echo Text::_('COM_JEM_HIDEALL'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
|
||||
<!-- 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) {
|
||||
|
||||
# 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) || ($displayLegend == 0)) : ?>
|
||||
<!-- Calendar legend below -->
|
||||
<div id="jlcalendarlegend">
|
||||
|
||||
<!-- Calendar buttons -->
|
||||
<div class="calendarButtons">
|
||||
<div class="calendarButtonsToggle">
|
||||
<div id="buttonshowall" class="btn btn-outline-dark me-2">
|
||||
<?php echo Text::_('COM_JEM_SHOWALL'); ?>
|
||||
</div>
|
||||
<div id="buttonhideall" class="btn btn-outline-dark">
|
||||
<?php echo Text::_('COM_JEM_HIDEALL'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
|
||||
<!-- Calendar Legend -->
|
||||
<div class="calendarLegends mt-4">
|
||||
<?php
|
||||
if ($displayLegend == 1) {
|
||||
|
||||
##############
|
||||
## 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)) {
|
||||
?>
|
||||
<div class="eventCat btn btn-outline-dark me-2" 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>
|
||||
149
components/com_jem/views/calendar/tmpl/default.xml
Normal file
149
components/com_jem/views/calendar/tmpl/default.xml
Normal file
@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_JEM_CALENDAR_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_JEM_CALENDAR_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<fields name="params">
|
||||
<fieldset name="basic"
|
||||
addfieldpath="/administrator/components/com_jem/models/fields"
|
||||
>
|
||||
<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="top_category" type="categories"
|
||||
default="0"
|
||||
label="COM_JEM_SELECT_TOP_CATEGORY"
|
||||
description="COM_JEM_SELECT_TOP_CATEGORY_DESC"
|
||||
/>
|
||||
<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>
|
||||
1
components/com_jem/views/calendar/tmpl/index.html
Normal file
1
components/com_jem/views/calendar/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
425
components/com_jem/views/calendar/tmpl/responsive/default.php
Normal file
425
components/com_jem/views/calendar/tmpl/responsive/default.php
Normal file
@ -0,0 +1,425 @@
|
||||
<?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\Router\Route;
|
||||
?>
|
||||
|
||||
<style>
|
||||
td.today div.daynum::before,
|
||||
td.today div.daynum::after {
|
||||
background-color: <?php echo $this->params->get('currentdaycolor'); ?>;
|
||||
}
|
||||
</style>
|
||||
|
||||
<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 . $this->param_topcat);
|
||||
$var1b = Text::_('COM_JEM_AND_MORE');
|
||||
$var1c = "<a href=\"".$var1a."\">".$var1b."</a>";
|
||||
$id = 'eventandmore';
|
||||
|
||||
$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="catz" class="cat'.$category->id.'">';
|
||||
$contentend .= '</div>';
|
||||
|
||||
//attach category color if any in front of the catname
|
||||
if ($category->color) {
|
||||
$multicatname .= '<span class="colorpic" style="width:6px; background-color: '.$category->color.';"></span> '.$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="width:6px; 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]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$color = '<div id="eventcontenttop" class="eventcontenttop">';
|
||||
$color .= $colorpic;
|
||||
$color .= '</div>';
|
||||
|
||||
// multiday
|
||||
$multi_mode = 0; // single day
|
||||
$multi_icon = '';
|
||||
if (isset($row->multi)) {
|
||||
switch ($row->multi) {
|
||||
case 'first': // first day
|
||||
$multi_mode = 1;
|
||||
$multi_icon = '<i class="fa fa-step-backward" aria-hidden="true"></i>';
|
||||
break;
|
||||
case 'middle': // middle day
|
||||
$multi_mode = 2;
|
||||
$multi_icon = '<i class="fas fa-arrows-alt-h"></i>';
|
||||
break;
|
||||
case 'zlast': // last day
|
||||
$multi_mode = 3;
|
||||
$multi_icon = '<i class="fa fa-step-forward" aria-hidden="true"></i>';
|
||||
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();
|
||||
$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) {
|
||||
|
||||
# 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) || ($displayLegend == 0)) : ?>
|
||||
<!-- Calendar legend below -->
|
||||
<div id="jlcalendarlegend">
|
||||
|
||||
<!-- Calendar buttons -->
|
||||
<div class="calendarButtons jem-row jem-justify-start">
|
||||
<button id="buttonshowall" class="btn btn-outline-dark">
|
||||
<?php echo Text::_('COM_JEM_SHOWALL'); ?>
|
||||
</button>
|
||||
<button id="buttonhideall" class="btn btn-outline-dark">
|
||||
<?php echo Text::_('COM_JEM_HIDEALL'); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Calendar Legend -->
|
||||
<div class="calendarLegends jem-row jem-justify-start">
|
||||
<?php
|
||||
if ($displayLegend == 1) {
|
||||
|
||||
##############
|
||||
## 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)) {
|
||||
?>
|
||||
<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>
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
142
components/com_jem/views/calendar/view.html.php
Normal file
142
components/com_jem/views/calendar/view.html.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?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\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
/**
|
||||
* Calendar-View
|
||||
*/
|
||||
class JemViewCalendar extends JemView
|
||||
{
|
||||
/**
|
||||
* Creates the Calendar View
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
|
||||
// initialize variables
|
||||
$app = Factory::getApplication();
|
||||
$document = $app->getDocument();
|
||||
$menu = $app->getMenu();
|
||||
$menuitem = $menu->getActive();
|
||||
$jemsettings = JemHelper::config();
|
||||
$settings = JemHelper::globalattribs();
|
||||
$user = JemFactory::getUser();
|
||||
$params = $app->getParams();
|
||||
$top_category = (int)$params->get('top_category', 0);
|
||||
$jinput = $app->input;
|
||||
$print = $jinput->getBool('print', false);
|
||||
|
||||
$this->param_topcat = $top_category > 0 ? ('&topcat='.$top_category) : '';
|
||||
$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);
|
||||
$document->addScript($url.'media/com_jem/js/calendar.js');
|
||||
|
||||
$year = (int)$jinput->getInt('yearID', date("Y"));
|
||||
$month = (int)$jinput->getInt('monthID', date("m"));
|
||||
|
||||
// get data from model and set the month
|
||||
$model = $this->getModel();
|
||||
$model->setDate(mktime(0, 0, 1, $month, 1, $year));
|
||||
|
||||
$rows = $this->get('Items');
|
||||
|
||||
// Set Page title
|
||||
$pagetitle = $params->def('page_title', $menuitem->title);
|
||||
$params->def('page_heading', $pagetitle);
|
||||
$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();
|
||||
$catIds = $model->getCategories('all');
|
||||
$permissions->canAddEvent = $user->can('add', 'event', false, false, $catIds);
|
||||
$permissions->canAddVenue = $user->can('add', 'venue', false, false, $catIds);
|
||||
|
||||
$itemid = $jinput->getInt('Itemid', 0);
|
||||
|
||||
$partItemid = ($itemid > 0) ? '&Itemid=' . $itemid : '';
|
||||
$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');
|
||||
$url_base = 'index.php?option=com_jem&view=calendar';
|
||||
|
||||
$print_link = Route::_($url_base . $partItemid. $partDate . '&print=1&tmpl=component');
|
||||
$ical_link = $partDate;
|
||||
//http://localhost/jl500rc2/index.php/jem/calendar?format=raw&layout=ics
|
||||
|
||||
// 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' . $this->param_topcat);
|
||||
|
||||
$this->rows = $rows;
|
||||
$this->catIds = $catIds;
|
||||
$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 = $ical_link;
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
?>
|
||||
55
components/com_jem/views/calendar/view.raw.php
Normal file
55
components/com_jem/views/calendar/view.raw.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?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: Calendar
|
||||
*/
|
||||
class JemViewCalendar extends HtmlView
|
||||
{
|
||||
/**
|
||||
* Creates the output for the Calendar 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"));
|
||||
|
||||
if ($settings2->get('global_show_ical_icon','0')==1) {
|
||||
// Get data from the model
|
||||
$model = $this->getModel();
|
||||
$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_month_". $year . $month . ".ics");
|
||||
|
||||
if (!empty($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
JemHelper::icalAddEvent($vcal, $row);
|
||||
}
|
||||
}
|
||||
|
||||
// generate and redirect output to user browser
|
||||
$vcal->returnCalendar();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user