primo commit
This commit is contained in:
		
							
								
								
									
										1
									
								
								components/com_jem/views/event/calendar/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								components/com_jem/views/event/calendar/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| <!DOCTYPE html><title></title> | ||||
							
								
								
									
										411
									
								
								components/com_jem/views/event/calendar/tmpl/default.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										411
									
								
								components/com_jem/views/event/calendar/tmpl/default.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,411 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version 2.3.1 | ||||
|  * @package JEM | ||||
|  * @copyright (C) 2013-2021 joomlaeventmanager.net | ||||
|  * @copyright (C) 2005-2009 Christoph Lukes | ||||
|  * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL | ||||
|  */ | ||||
| defined('_JEXEC') or die; | ||||
| ?> | ||||
|  | ||||
| <div id="jem" class="jlcalendar jem_calendar<?php echo $this->pageclass_sfx;?>"> | ||||
| 	<div class="buttons"> | ||||
| 		<?php | ||||
| 		$btn_params = array('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->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 = strftime('%Y', strtotime($row->dates)); | ||||
| 		$month = strftime('%m', strtotime($row->dates)); | ||||
| 		$day = strftime('%d', strtotime($row->dates)); | ||||
|  | ||||
| 		@$countperday[$year.$month.$day]++; | ||||
| 		if ($countperday[$year.$month.$day] == $limit+1) { | ||||
| 			$var1a = JRoute::_('index.php?option=com_jem&view=day&id='.$year.$month.$day . $this->param_topcat); | ||||
| 			$var1b = JText::_('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">'.JText::_('COM_JEM_TIME_SHORT').': </span>'; | ||||
| 				$timehtml .= $start; | ||||
| 				if ($end != '') { | ||||
| 					$timehtml .= ' - '.$end; | ||||
| 				} | ||||
| 				$timehtml .= '</div>'; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		$eventname  = '<div class="eventName">'.JText::_('COM_JEM_TITLE_SHORT').': '.$this->escape($row->title).'</div>'; | ||||
| 		$detaillink = JRoute::_(JemHelperRoute::getEventRoute($row->slug)); | ||||
|  | ||||
| 		//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 = JRoute::_(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 = JHtml::_("image","com_jem/arrow-left.png",'', NULL, true); | ||||
| 				break; | ||||
| 			case 'middle': // middle day | ||||
| 				$multi_mode = 2; | ||||
| 				$multi_icon = JHtml::_("image","com_jem/arrow-middle.png",'', NULL, true); | ||||
| 				break; | ||||
| 			case 'zlast': // last day | ||||
| 				$multi_mode = 3; | ||||
| 				$multi_icon = JHtml::_("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">'.JText::_('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">'.JText::_('JSTATUS').': </span>'; | ||||
| 			switch ($row->published) { | ||||
| 			case  1: $eventstate .= JText::_('JPUBLISHED');   break; | ||||
| 			case  0: $eventstate .= JText::_('JUNPUBLISHED'); break; | ||||
| 			case  2: $eventstate .= JText::_('JARCHIVED');    break; | ||||
| 			case -2: $eventstate .= JText::_('JTRASHED');     break; | ||||
| 			} | ||||
| 			$eventstate .= '</div>'; | ||||
| 		} else { | ||||
| 			$eventstate  = ''; | ||||
| 		} | ||||
|  | ||||
| 		//date in tooltip | ||||
| 		$multidaydate = '<div class="time"><span class="text-label">'.JText::_('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>'; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		//generate the output | ||||
| 		// if we have exact one color from categories we can use this as background color of event | ||||
| 		if (!empty($evbg_usecatcolor) && (count($catcolor) == 1)) { | ||||
| 			$content .= '<div class="eventcontentinner" style="background-color:'.array_pop($catcolor).'">'; | ||||
| 			$content .= $editicon; | ||||
| 			$content .= JemHelper::caltooltip($catname.$eventname.$timehtml.$venue.$eventstate, $eventdate, $row->title . $statusicon, $detaillink, 'editlinktip hasTip', $timetp, $category->color); | ||||
| 			$content .= $contentend . '</div>'; | ||||
| 		} else { | ||||
| 			$content .= '<div class="eventcontentinner">' . $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 JText::_('COM_JEM_SHOWALL'); ?> | ||||
| 				</div> | ||||
| 				<div id="buttonhideall" class="btn btn-outline-dark"> | ||||
| 					<?php echo JText::_('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"> | ||||
| 					<?php echo JText::_('COM_JEM_SHOWALL'); ?> | ||||
| 				</div> | ||||
| 				<div id="buttonhideall" class="btn btn-outline-dark"> | ||||
| 					<?php echo JText::_('COM_JEM_HIDEALL'); ?> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 		</div> | ||||
| 		<div class="clr"></div> | ||||
|  | ||||
| 	<!-- Calendar Legend --> | ||||
| 		<div class="calendarLegends"> | ||||
| 			<?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" 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> | ||||
							
								
								
									
										126
									
								
								components/com_jem/views/event/calendar/tmpl/default.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								components/com_jem/views/event/calendar/tmpl/default.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,126 @@ | ||||
| <?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="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" | ||||
| 			/> | ||||
| 		</fieldset> | ||||
| 	</fields> | ||||
| </metadata> | ||||
							
								
								
									
										1
									
								
								components/com_jem/views/event/calendar/tmpl/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								components/com_jem/views/event/calendar/tmpl/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| <!DOCTYPE html><title></title> | ||||
| @ -0,0 +1,413 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version 2.3.1 | ||||
|  * @package JEM | ||||
|  * @copyright (C) 2013-2021 joomlaeventmanager.net | ||||
|  * @copyright (C) 2005-2009 Christoph Lukes | ||||
|  * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL | ||||
|  */ | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| ?> | ||||
|  | ||||
| <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); | ||||
| 		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 = strftime('%Y', strtotime($row->dates)); | ||||
| 		$month = strftime('%m', strtotime($row->dates)); | ||||
| 		$day = strftime('%d', strtotime($row->dates)); | ||||
|  | ||||
| 		@$countperday[$year.$month.$day]++; | ||||
| 		if ($countperday[$year.$month.$day] == $limit+1) { | ||||
| 			$var1a = JRoute::_('index.php?option=com_jem&view=day&id='.$year.$month.$day . $this->param_topcat); | ||||
| 			$var1b = JText::_('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">'.JText::_('COM_JEM_TIME_SHORT').': </span>'; | ||||
| 				$timehtml .= $start; | ||||
| 				if ($end != '') { | ||||
| 					$timehtml .= ' - '.$end; | ||||
| 				} | ||||
| 				$timehtml .= '</div>'; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		$eventname  = '<div class="eventName">'.JText::_('COM_JEM_TITLE_SHORT').': '.$this->escape($row->title).'</div>'; | ||||
| 		$detaillink = JRoute::_(JemHelperRoute::getEventRoute($row->slug)); | ||||
|  | ||||
| 		//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 = JRoute::_(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="fa fa-arrows-h fa-lg" aria-hidden="true"></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">'.JText::_('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">'.JText::_('JSTATUS').': </span>'; | ||||
| 			switch ($row->published) { | ||||
| 			case  1: $eventstate .= JText::_('JPUBLISHED');   break; | ||||
| 			case  0: $eventstate .= JText::_('JUNPUBLISHED'); break; | ||||
| 			case  2: $eventstate .= JText::_('JARCHIVED');    break; | ||||
| 			case -2: $eventstate .= JText::_('JTRASHED');     break; | ||||
| 			} | ||||
| 			$eventstate .= '</div>'; | ||||
| 		} else { | ||||
| 			$eventstate  = ''; | ||||
| 		} | ||||
|  | ||||
| 		//date in tooltip | ||||
| 		$multidaydate = '<div class="time"><span class="text-label">'.JText::_('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>'; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		//generate the output | ||||
| 		// if we have exact one color from categories we can use this as background color of event | ||||
| 		if (!empty($evbg_usecatcolor) && (count($catcolor) == 1)) { | ||||
| 			$content .= '<div class="eventcontentinner" style="background-color:'.array_pop($catcolor).'" onclick=location.href="'.$detaillink.'">'; | ||||
| 			$content .= $editicon; | ||||
| 			$content .= JemHelper::caltooltip($catname.$eventname.$timehtml.$venue.$eventstate, $eventdate, $row->title . $statusicon, $detaillink, 'editlinktip hasTip', $timetp, $category->color); | ||||
| 			$content .= $contentend . '</div>'; | ||||
| 		} else { | ||||
| 			$content .= '<div class="eventcontentinner" 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 JText::_('COM_JEM_SHOWALL'); ?> | ||||
| 				</button> | ||||
| 				<button id="buttonhideall" class="calendarButton btn btn-outline-dark"> | ||||
| 					<?php echo JText::_('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 JText::_('COM_JEM_SHOWALL'); ?> | ||||
| 				</button> | ||||
| 				<button id="buttonhideall" class="btn btn-outline-dark"> | ||||
| 					<?php echo JText::_('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> | ||||
							
								
								
									
										136
									
								
								components/com_jem/views/event/calendar/view.html.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								components/com_jem/views/event/calendar/view.html.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,136 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version 2.3.1 | ||||
|  * @package JEM | ||||
|  * @copyright (C) 2013-2021 joomlaeventmanager.net | ||||
|  * @copyright (C) 2005-2009 Christoph Lukes | ||||
|  * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL | ||||
|  */ | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| /** | ||||
|  * Calendar-View | ||||
|  */ | ||||
| class JemViewCalendar extends JemView | ||||
| { | ||||
| 	/** | ||||
| 	 * Calendar-View | ||||
| 	 */ | ||||
| 	public function display($tpl = null) | ||||
| 	{ | ||||
| 		$app = JFactory::getApplication(); | ||||
|  | ||||
| 		// Load tooltips behavior | ||||
| 		JHtml::_('behavior.tooltip'); | ||||
| 		JHtml::_('behavior.framework'); | ||||
|  | ||||
| 		// initialize variables | ||||
| 		$document     = JFactory::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) : ''; | ||||
|  | ||||
| 		// 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) | ||||
| 		JHtml::_('script', 'media/com_jem/js/calendar.js'); | ||||
|  | ||||
| 		$year  = (int)$jinput->getInt('yearID', strftime("%Y")); | ||||
| 		$month = (int)$jinput->getInt('monthID', strftime("%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->getCfg('sitename_pagetitles', 0) == 1) { | ||||
| 			$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); | ||||
| 		} | ||||
| 		elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { | ||||
| 			$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('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' . $partItemid; | ||||
|  | ||||
| 		$print_link = JRoute::_($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' . $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 = htmlspecialchars($pageclass_sfx); | ||||
| 		$this->print_link    = $print_link; | ||||
| 		$this->print         = $print; | ||||
|  | ||||
| 		parent::display($tpl); | ||||
| 	} | ||||
| } | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user