Your IP : 216.73.217.68


Current Path : /home/w/u/e/wuectly/www/03cbe/
Upload File :
Current File : /home/w/u/e/wuectly/www/03cbe/mod_iccalendar.tar

js/jQuery.highlightToday.min.js000060400000001026152455611460012532 0ustar00(function(e){e.fn.highlightToday=function(t){var n=new Date,r="0"+n.getDate(),i="0"+(n.getMonth()+1),s=n.getFullYear(),o=s+"-"+i.slice(-2)+"-"+r.slice(-2),u=e(".style_Today",this),a=u.attr("data-cal-date");if(typeof a==="undefined"||o!==a){u.removeClass("style_Today").addClass("style_Day");e('.style_Day[data-cal-date="'+o+'"]',this).addClass("style_Today").removeClass("style_Day");if(t==="show_today"){if(e(".style_Today",this).length===0){if(o>a){e(".nextic",this).click()}else{e(".backic",this).click()}}}}return this}})(jQuery)
js/jquery.noconflict.js000060400000000024152455611460011173 0ustar00jQuery.noConflict();js/index.html000060400000000000152455611460007150 0ustar00js/jQuery.highlightToday.js000060400000002231152455611460011747 0ustar00(function ($) {

	$.fn.highlightToday = function(option) {
		var d = new Date(),
			day = '0' + d.getDate(),
			month = '0' + (d.getMonth() + 1),
			year = d.getFullYear(),
			client_date = year + '-' + month.slice(-2) + '-' + day.slice(-2),
			$today = $('.style_Today', this),
			cal_date = $today.attr('data-cal-date');//cal_date='2014-01-07'; // Test data
		if (typeof cal_date === 'undefined' || client_date !== cal_date) {
			// Calendar date not in the displayed month - or client date is different
			$today.removeClass('style_Today').addClass('style_Day');
			$('.style_Day[data-cal-date="' + client_date + '"]', this).addClass('style_Today').removeClass('style_Day');
			// Check whether the correct month is loaded if today is required to be shown
			if (option === 'show_today') {
				if ($('.style_Today', this).length === 0) {
					// The current date is not shown (because of offset between server and client date)
					if (client_date > cal_date) {
						// Load next month
						$('.nextic', this).click();
					} else {
						// Load previous month
						$('.backic', this).click();
					}
				}
			}
		}
		// Support chaining
		return this;
	};

}(jQuery));
helper.php000060400000126143152455611460006550 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda - mod_iccalendar
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C) - doorknob
 * @link        http://www.joomlic.com
 *
 * @version 	3.5.12 2015-10-01
 * @since       3.1.9 (1.0)
 *------------------------------------------------------------------------------
*/

/**
 *	iCagenda - iC calendar
 */


// No direct access to this file
defined('_JEXEC') or die();

jimport('joomla.methods');
jimport('joomla.environment.request');
jimport('joomla.application.component.helper');

// Module Class
class modiCcalendarHelper
{
	private function construct($params)
	{
		$this->modid				= $params->get('id');
		$this->template				= $params->get('template');
		$this->format				= $params->get('format');
		$this->date_separator		= $params->get('date_separator');
		$this->setTodayTimezone		= $params->get('setTodayTimezone');
		$this->displayDatesTimezone	= $params->get('displayDatesTimezone');
		$this->filtering_shortDesc	= $params->get('filtering_shortDesc', '');
		$this->limit				= $params->get('paramlimit', '')
									? $params->get('paramlimit_Content')
									: false;
		$this->catid				= $params->get('mcatid');
		$this->number				= $params->get('number');
		$this->onlyStDate			= $params->get('onlyStDate');
		$this->firstMonth			= $params->get('firstMonth', null);
		$this->month_nav			= $params->get('month_nav', '1');
		$this->year_nav				= $params->get('year_nav', '1');

//		$linkid						= JRequest::getInt('Itemid');
		$this->itemid				= JRequest::getInt('Itemid');
		$this->mod_iccalendar		= '#mod_iccalendar_' . $this->modid;

		// Get media path
		$params_media				= JComponentHelper::getParams('com_media');
		$image_path					= $params_media->get('image_path', 'images');

		// Features Options
		$this->features_icon_size	= $params->get('features_icon_size');
		$this->show_icon_title		= $params->get('show_icon_title');
		$this->features_icon_root	= JURI::base() . "{$image_path}/icagenda/feature_icons/{$this->features_icon_size}/";

		// First day of the current month
		$this_month	= $this->firstMonth
					? date("Y-m-d", strtotime("+1 month", strtotime($this->firstMonth)))
					: JHtml::date('now', 'Y-m-01', null);

		$iccaldate					= JRequest::getVar('iccaldate', ''); // Get date set in month/year navigation

		// This should be the first day of a month
		$date_start = $iccaldate ? date('Y-m-01', strtotime($iccaldate)) : $this_month;

		// Add filter to restrict the number of events using the 'next' date
		if ($date_start > $this_month)
		{
			// Month to be displayed is in the future
			// Events required start from the current month
			$filter_start = $this_month;
		}
		else
		{
			// Month to be displayed is current or past
			// Events required start from the display month
			$filter_start = $date_start;
		}

		$this->date_start = $date_start;

		$this->addFilter('e.next', '' . $filter_start . '', '>=');

		// An end date for selection is not possible because it may prevent display of past events where the next
		// scheduled instance of an event is after the end of the display month
//		$filter_end = date('Y-m-d', strtotime('+1 month', strtotime($this->date_start)));
//		$this->addFilter('e.next', "'$filter_end'",'<');

		// Get Array of categories to be displayed
		if (isset($this->catid)
			&& ! empty($this->catid))
		{
			$cat_filter_param = $this->catid;

			if ( ! is_array($cat_filter_param))
			{
				$catFilter = array($cat_filter_param);
			}
			else
			{
				$catFilter = $cat_filter_param;
			}

			$cats_option = implode(', ', $catFilter);

			if ($catFilter != array(0))
			{
				$this->addFilter('e.catid', '(' . $cats_option . ')', ' IN ');
			}
		}
	}


	function start($params)
	{
		$this->construct($params);
	}


	function addFilter($key, $var, $for = NULL)
	{
		$for = ($for == NULL) ? '=' : $for;

		$this->filter[] = $key . $for . $var;
	}


	// Class Method
	function getStamp($params)
	{
		$iCparams		= JComponentHelper::getParams('com_icagenda');
		$eventTimeZone	= null;

		// Itemid Request (automatic detection of the first iCagenda menu-link, by menuID)
		$iC_list_menus	= icagendaMenus::iClistMenuItemsInfo();
		$nb_menu		= count($iC_list_menus);
		$nolink			= $nb_menu ? false : true;

		$app			= JFactory::getApplication();
		$menu			= $app->getMenu();
		$isSef			= $app->getCfg( 'sef' );
		$date_var		= ($isSef == 1) ? '?date=' :'&amp;date=';

		// Check if GD is enabled on the server
		if (extension_loaded('gd') && function_exists('gd_info'))
		{
			$thumb_generator = $iCparams->get('thumb_generator', 1);
		}
		else
		{
			$thumb_generator = 0;
		}

		$datetime_today	= JHtml::date('now', 'Y-m-d H:i');
		$timeformat		= $iCparams->get('timeformat', 1);
		$lang_time		= ($timeformat == 1) ? 'H:i' : 'h:i A';

		// Check if fopen is allowed
		$result	= ini_get('allow_url_fopen');
		$fopen	= empty($result) ? false : true;

		$this->start($params);

		// Get the database
		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);

		// Build the query
		$query->select('e.*,
				e.place as place_name,
				c.title as cat_title,
				c.alias as cat_alias,
				c.color as cat_color,
				c.ordering as cat_order
			')
    		->from($db->qn('#__icagenda_events').' AS e')
			->leftJoin($db->qn('#__icagenda_category').' AS c ON '.$db->qn('c.id').' = '.$db->qn('e.catid'));

		// Where Category is Published
		$query->where('c.state = 1');

		// Where State is Published
		$query->where('e.state = 1');

		// Where event is Approved
		$query->where('e.approval = 0');

		// Add filters
		if (isset($this->filter))
		{
			foreach ($this->filter as $filter)
			{
				$query->where($filter);
			}
		}

		// Check Access Levels
		$user		= JFactory::getUser();
		$userID		= $user->id;
		$userLevels	= $user->getAuthorisedViewLevels();

		if (version_compare(JVERSION, '3.0', 'lt'))
		{
			$userGroups = $user->getAuthorisedGroups();
		}
		else
		{
			$userGroups = $user->groups;
		}

		$userAccess = implode(', ', $userLevels);

		if (!in_array('8', $userGroups))
		{
			$query->where('e.access IN (' . $userAccess . ')');
		}

		// Features - extract the number of displayable icons per event
		$query->select('feat.count AS features');
		$sub_query = $db->getQuery(true);
		$sub_query->select('fx.event_id, COUNT(*) AS count');
		$sub_query->from('`#__icagenda_feature_xref` AS fx');
		$sub_query->innerJoin("`#__icagenda_feature` AS f ON fx.feature_id=f.id AND f.state=1 AND f.icon<>'-1'");
		$sub_query->group('fx.event_id');
		$query->leftJoin('(' . (string) $sub_query . ') AS feat ON e.id=feat.event_id');

		// Registrations total
		$query->select('r.count AS registered, r.date AS reg_date');
		$sub_query = $db->getQuery(true);
		$sub_query->select('r.eventid, sum(r.people) AS count, r.date AS date');
		$sub_query->from('`#__icagenda_registration` AS r');
		$sub_query->where('r.state > 0');
		$sub_query->group('r.eventid');
		$query->leftJoin('(' . (string) $sub_query . ') AS r ON e.id=r.eventid');

		// Run the query
		$db->setQuery($query);

		// Invoke the query
		$result = $db->loadObjectList();

		$registrations = icagendaEventsData::registeredList();

		foreach ($result AS $record)
		{
			$record_registered = array();

			foreach ($registrations AS $reg_by_event)
			{
				$ex_reg_by_event = explode('@@', $reg_by_event);

				if ($ex_reg_by_event[0] == $record->id)
				{
					$record_registered[] = $ex_reg_by_event[0] . '@@' . $ex_reg_by_event[1] . '@@' . $ex_reg_by_event[2];
				}
			}

			$record->registered = $record_registered;
		}

		// Set start/end dates of the current month
		$days = self::getNbOfDaysInMonth($this->date_start);
		$current_date_start	= $this->date_start;
		$month_start		= date('m', strtotime($current_date_start));
		$month_end			= date('m', strtotime('+1 month', strtotime($current_date_start)));
		$day_end			= date('m', strtotime('+'.$days.' days', strtotime($current_date_start)));

		$year_end			= ($month_start == '12')
							? date('Y', strtotime("+1 year", strtotime($this->date_start)))
							: date('Y', strtotime($this->date_start));

		$current_date_end	= $year_end . '-' . $month_end . '-' . $day_end;

		$days = $this->getDays($this->date_start, 'Y-m-d H:i');

		$total_items		= 0;
		$displayed_items	= 0;

		foreach ($result as $item)
		{
			// Extract the feature details, if needed
			$features = array();

			if (is_null($item->features) || empty($this->features_icon_size))
			{
				$item->features = array();
			}
			else
			{
				$item->features = icagendaEvents::featureIcons($item->id);
			}

			if (isset($item->features) && is_array($item->features))
			{
				foreach ($item->features as $feature)
				{
					$features[] = array('icon' => $feature->icon, 'icon_alt' => $feature->icon_alt);
				}
			}

			// list calendar dates
			$AllDates = array();

			$next = isset($next) ? $next : '';

			$allSingleDates_array = $this->getDatelist($item->dates, $next);

			// If Single Dates, added to all dates for this event
			if (isset($datemultiplelist)
				&& $datemultiplelist != NULL
				&& is_array($datemultiplelist))
			{
				$allSingleDates_array = array_merge($AllDates, $datemultiplelist);
			}

			foreach ($allSingleDates_array as $sd)
			{
				$this_date = JHtml::date($sd, 'Y-m-d', null);

				if (strtotime($this_date) >= strtotime($current_date_start)
					&& strtotime($this_date) < strtotime($current_date_end))
				{
					array_push($AllDates, $sd);
				}
			}

			// Get WeekDays Array
			$WeeksDays			= iCDatePeriod::weekdaysToArray($item->weekdays);

			// Get Period Dates
			$StDate				= JHtml::date($item->startdate, 'Y-m-d H:i', $eventTimeZone);
			$EnDate				= JHtml::date($item->enddate, 'Y-m-d H:i', $eventTimeZone);
			$perioddates		= iCDatePeriod::listDates($item->startdate, $item->enddate, $eventTimeZone);

			$onlyStDate			= isset($this->onlyStDate) ? $this->onlyStDate : '';

			// Check the period if individual dates
			$only_startdate		= ($item->weekdays || $item->weekdays == '0') ? false : true;

//			if (isset($perioddates) && $perioddates != NULL)
//			{
				if ($onlyStDate == 1)
				{
					if (strtotime($StDate) >= strtotime($current_date_start)
						&& strtotime($StDate) < strtotime($current_date_end))
					{
						array_push($AllDates, date('Y-m-d H:i', strtotime($item->startdate)));
					}
				}
				else
				{
					foreach ($perioddates as $Dat)
					{
						$this_date = JHtml::date($Dat, 'Y-m-d', null);

						if (in_array(date('w', strtotime($Dat)), $WeeksDays))
						{
							$SingleDate = date('Y-m-d H:i', strtotime($Dat));

							if (strtotime($this_date) >= strtotime($current_date_start)
								&& strtotime($this_date) < strtotime($current_date_end))
							{
								array_push($AllDates, $SingleDate);
							}
						}
					}
				}
//			}

			rsort($AllDates);


			// requête Itemid
			$iCmenuitem = $params->get('iCmenuitem', '');

			if (is_numeric($iCmenuitem))
			{
				$linkid = $iCmenuitem;
			}
			else
			{
				$linkid = icagendaMenus::thisEventItemid($item->next, $item->catid, $iC_list_menus);
			}

			$eventnumber	= $item->id ? $item->id : null;
			$event_slug		= $item->alias ? $item->id . ':' . $item->alias : $item->id;

			$total_items = $total_items + 1;

			if ( $linkid
				&& ! $nolink
				&& JComponentHelper::getComponent('com_icagenda', true)->enabled
				)
			{
				$displayed_items = $displayed_items + 1;
				$urlevent = JRoute::_('index.php?option=com_icagenda&amp;view=list&amp;layout=event&amp;id=' . $event_slug . '&amp;Itemid=' . (int)$linkid);
			}
			else
			{
				$urlevent = '#';
			}

			$descShort = icagendaEvents::shortDescription($item->desc, true, $this->filtering_shortDesc, $this->limit);


			/**
			 * Get Thumbnail
			 */

			// START iCthumb

			// Set if run iCthumb
			if ($item->image
				&& $thumb_generator == 1)
			{
				// Generate small thumb if not exist
				$thumb_img = icagendaThumb::sizeSmall($item->image);
			}
			elseif ($item->image
				&& $thumb_generator == 0)
			{
				$thumb_img = $item->image;
			}
			else
			{
				$thumb_img = $item->image ? 'media/com_icagenda/images/nophoto.jpg' : '';
			}

			// END iCthumb



			$evtParams = '';
			$evtParams = new JRegistry($item->params);

			// Display Time
			$r_time			= $params->get('dp_time', 1) ? true : false;

			// Display City
			$r_city			= $params->get('dp_city', 1) ? $item->city : false;

			// Display Country
			$r_country		= $params->get('dp_country', 1) ? $item->country : false;

			// Display Venue Name
			$r_place		= $params->get('dp_venuename', 1) ? $item->place_name : false;

			// Display Intro Text
			$dp_shortDesc	= $params->get('dp_shortDesc', '');

			// Short Description
			if ($dp_shortDesc == '1')
			{
				$descShort		= $item->shortdesc ? $item->shortdesc : false;
			}
			// Auto-Introtext
			elseif ($dp_shortDesc == '2')
			{
				$descShort		= $descShort ? $descShort : false;
			}
			// Hide
			elseif ($dp_shortDesc == '0')
			{
				$descShort		= false;
			}
			// Auto (First Short Description, if does not exist, Auto-generated short description from the full description. And if does not exist, will use meta description if not empty)
			else
			{
				$e_shortdesc	= $item->shortdesc ? $item->shortdesc : $descShort;
				$descShort		= $e_shortdesc ? $e_shortdesc : $item->metadesc;
			}

			// Display Registration Infos
			$dp_regInfos	= $params->get('dp_regInfos', 1);

			$maxTickets		= ($dp_regInfos == 1) ? $evtParams->get('maxReg', '1000000') : false;
			$typeReg		= ($dp_regInfos == 1) ? $evtParams->get('typeReg', '1') : false;

			$event = array(
				'id'					=> (int)$item->id,
				'Itemid'				=> (int)$linkid,
				'title'					=> $item->title,
				'next'					=> $this->formatDate($item->next),
				'image'					=> $thumb_img,
				'file'					=> $item->file,
				'address'				=> $item->address,
				'city'					=> $r_city,
				'country'				=> $r_country,
				'place'					=> $r_place,
				'description'			=> $item->desc,
				'descShort'				=> $descShort,
				'cat_title'				=> $item->cat_title,
				'cat_order'				=> $item->cat_order,
				'cat_color'				=> $item->cat_color,
				'nb_events'				=> count($item->id),
				'no_image'				=> JTEXT::_('MOD_ICCALENDAR_NO_IMAGE'),
				'params'				=> $item->params,
				'features_icon_size'	=> $this->features_icon_size,
				'features_icon_root'	=> $this->features_icon_root,
				'show_icon_title'		=> $this->show_icon_title,
				'features'				=> $features,
				'item'					=> $item,
			);

			// Access Control
			$access			= $item->access ? $item->access : '1';

			// Language Control
			$languages		= array(JFactory::getLanguage()->getTag(), '*');
			$eventLang		= isset($item->language) ? $item->language : '*';

			// Get Option Dislay Time
			$displaytime	= isset($item->displaytime) ? $item->displaytime : '';

			$events_per_day	= array();

			// Get List of Dates
			if ((in_array($access, $userLevels) || in_array('8', $userGroups))
				&& in_array($eventLang, $languages)
				&& is_array($event)
				&& $linkid
				)
			{
				$past_dates = 0;

				foreach ($AllDates as $d)
				{
					// Control if date is past
					if (strtotime($d) < strtotime($datetime_today))
					{
						$past_dates = $past_dates + 1;
					}
				}

				foreach ($AllDates as $d)
				{
					$this_date_control	= date('Y-m-d H:i', strtotime($d));

					if ($only_startdate && in_array($this_date_control, $perioddates))
					{
						$set_date_in_url = '';
					}
					else
					{
						$set_date_in_url = $date_var . iCDate::dateToAlias($d, 'Y-m-d H:i');
					}

					if ($r_time)
					{
						$time = array(
							'time'			=> date($lang_time, strtotime($d)),
							'displaytime'	=> $displaytime,
							'url'			=> $urlevent . $set_date_in_url
						);
					}
					else
					{
						$time = array(
							'time'			=> '',
							'displaytime'	=> '',
							'url'			=> $urlevent . $set_date_in_url
						);
					}

					$event = array_merge($event, $time);

					$this_date = $item->reg_date ? date('Y-m-d H:i:s', strtotime($d)) : 'period';

					$registrations	= ($dp_regInfos == 1) ? true : false;
					$registered		= ($dp_regInfos == 1)
									? self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url)
									: false;
					$maxTickets		= ($maxTickets != '1000000') ? $maxTickets : false;
					$TicketsLeft	= ($dp_regInfos == 1 && $maxTickets)
									? ($maxTickets - self::getNbTicketsBooked($this_date, $item->registered, $eventnumber, $set_date_in_url))
									: false;

					// If period started, and registration is set to "for all dates of the event"
					if ($maxTickets
//						&& strtotime($item->startdate) < strtotime($datetime_today)
						&& $past_dates
						&& $typeReg == 2
						)
					{
						$date_sold_out	= JText::_('MOD_ICCALENDAR_REGISTRATION_CLOSED');
					}
					elseif ($maxTickets)
					{
						$date_sold_out	= ($TicketsLeft <= 0) ? JText::_('MOD_ICCALENDAR_REGISTRATION_DATE_NO_TICKETS_LEFT') : false;
					}
					else
					{
						$date_sold_out	= false;
					}

					$reg_infos = array(
						'registrations'	=> $registrations,
						'registered'	=> $registered,
						'maxTickets'	=> $maxTickets,
						'TicketsLeft'	=> $TicketsLeft,
						'date_sold_out'	=> $date_sold_out
					);

					$event = array_merge($event, $reg_infos);

					foreach ($days as $k => $dy)
					{
//						$d_date		= JHtml::date($d, 'Y-m-d', $eventTimeZone);
						$d_date		= date('Y-m-d', strtotime($d));
						$dy_date	= date('Y-m-d', strtotime($dy['date']));

						if ($d_date == $dy_date)
						{
							array_push ($days[$k]['events'], $event);
						}
					}
				}
			}
		}

		$i = '';

		if ($nolink || !JComponentHelper::getComponent('com_icagenda', true)->enabled)
		{
			do {
				echo '<div style="color:#a40505; text-align: center;"><b>info :</b></div><div style="color:#a40505; font-size: 0.8em; text-align: center;">'.JText::_( 'MOD_ICCALENDAR_COM_ICAGENDA_MENULINK_UNPUBLISHED_MESSAGE' ).'</div>';
			} while ($i > 0);
  		}

		$db = JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query->select('id AS nbevt')->from('`#__icagenda_events` AS e')->where('e.state > 0');
		$db->setQuery($query);
		$nbevt = $db->loadResult();
		$nbevt = count($nbevt);

		$no_event_message = '<div class="ic-msg-no-event">' . JText::_('MOD_ICCALENDAR_NO_EVENT') . '</div>';

		if ($nbevt == NULL)
		{
			echo $no_event_message;
  		}

// To be Checked
		$total_items = count($result);

		if ($displayed_items == '0'
			&& $total_items > 0)
		{
			echo $no_event_message;
		}

		if ($total_items > $displayed_items)
		{
			$not_displayed = ($total_items - $displayed_items);
			$user = JFactory::getUser();

			if ($user->authorise('core.admin'))
			{
				echo '<div class="alert alert-warning">' . JText::sprintf('IC_MODULE_ALERT_EVENTS_NOT_DISPLAYED', $not_displayed) . '</div>';
			}
		}

		return $days;

	}

	public static function getNbTicketsBooked($date, $event_registered, $event_id, $set_date_in_url)
	{
		$event_registered	= is_array($event_registered) ? $event_registered : array();
		$nb_registrations	= 0;

		foreach ($event_registered AS $reg)
		{
			$ex_reg = explode('@@', $reg); // eventid@@date@@people

			if ( ! $date || $date == 'period')
			{
				$nb_registrations = $nb_registrations + $ex_reg[2];
			}
			elseif (date('Y-m-d H:i', strtotime($date)) == date('Y-m-d H:i', strtotime($ex_reg[1])))
			{
				$nb_registrations = $nb_registrations + $ex_reg[2];
			}
			elseif ( ! $set_date_in_url && $ex_reg[1] == 'period' && $event_id == $ex_reg[0])
			{
				$nb_registrations = $nb_registrations + $ex_reg[2];
			}
		}

		return $nb_registrations;
	}


	// Function to get Format Date (using option format, and translation)
	protected function formatDate($date, $tz = false)
	{
		// Date Format Option (Global Component Option)
		$date_format_global	= JComponentHelper::getParams('com_icagenda')->get('date_format_global', 'Y - m - d');
		$date_format_global	= ($date_format_global !== '0') ? $date_format_global : 'Y - m - d'; // Previous 3.5.6 setting

		// Date Format Option (Module Option)
		$date_format_module	= isset($this->format) ? $this->format : '';
		$date_format_module	= ($date_format_module !== '0') ? $date_format_module : ''; // Previous 3.5.6 setting

		// Set Date Format option to be used
		$format				= $date_format_module ? $date_format_module : $date_format_global;

		// Separator Option
		$separator			= isset($this->date_separator) ? $this->date_separator : ' ';

		if ( ! is_numeric($format))
		{
			// Update old Date Format options of versions before 2.1.7
			$format = str_replace(array('nosep', 'nosep', 'sepb', 'sepa'), '', $format);
			$format = str_replace('.', ' .', $format);
			$format = str_replace(',', ' ,', $format);
		}

		$dateFormatted = iCGlobalize::dateFormat($date, $format, $separator, $tz);

		return $dateFormatted;
	}


	// Function to get TimeZone offset
	function get_timezone_offset($remote_tz, $origin_tz = null)
	{
		if ($origin_tz === null)
		{
			if (!is_string($origin_tz = date_default_timezone_get()))
			{
				return false; // A UTC timestamp was returned -- bail out!
			}
		}

		$origin_dtz	= new DateTimeZone($origin_tz);
		$remote_dtz	= new DateTimeZone($remote_tz);
		$origin_dt	= new DateTime("now", $origin_dtz);
		$remote_dt	= new DateTime("now", $remote_dtz);
		$offset		= $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt);

		return $offset;
	}

	function getNbOfDaysInMonth($date)
	{
		$lang = JFactory::getLanguage();

		// Get Nb of days in the month in Jalali/Persian calendar
		if ($lang->getTag() == 'fa-IR')
		{
			$date_to_persian	= $date;
			$persian_month		= date('m', strtotime($date_to_persian));
			$persian_year		= date('Y', strtotime($date_to_persian));
			$leap_year			= fa_IRDate::leap_persian($persian_year);

			if ($persian_month < 7)
			{
				$days = 31;
			}
			elseif ($persian_month == 12)
			{
				$days = $leap_year ? 30 : 29;
			}
			else
			{
				$days = 30;
			}
		}

		// Get Nb of days in the month in Gregorian calendar
		else
		{
			$days = date("t", strtotime($date));
		}

		return $days;
	}

	// Generate the days of the month
	function getDays($d, $f)
	{
		$lang = JFactory::getLanguage();
		$eventTimeZone = null;

		$days = self::getNbOfDaysInMonth($d);

		// Set Month and Year
		$ex_data	= explode('-', $d);
		$month		= $ex_data[1];
		$year		= $ex_data[0];
		$jour		= $ex_data[2];

		$list = array();

		//
		// Setting function of the visitor Time Zone
		//
		$today = time();

		$config			= JFactory::getConfig();
		$joomla_offset	= $config->get('offset');

		$displayDatesTimezone = '0'; // Option not active

		$opt_TimeZone = isset($this->setTodayTimezone) ? $this->setTodayTimezone : '';

		$gmt_today			= gmdate('Y-m-d H:i:s', $today);
		$today_timestamp	= strtotime($gmt_today);
		$GMT_timezone		= 'Etc/UTC';

		if ($opt_TimeZone == 'SITE')
		{
			// Joomla Server Time Zone
			$visitor_timezone	= $joomla_offset;
			$offset				= $this->get_timezone_offset($GMT_timezone, $visitor_timezone);
			$visitor_today		= JHtml::date(($today_timestamp+$offset), 'Y-m-d H:i:s', null);
			$UTCsite			= $offset / 3600;

			if ($UTCsite > 0) $UTCsite = '+'.$UTCsite;

			if ($displayDatesTimezone == '1')
			{
				echo '<small>' . JHtml::date('now', 'Y-m-d H:i:s', true) . ' UTC' . $UTCsite . '</small><br />';
			}
		}
		elseif ($opt_TimeZone == 'UTC')
		{
			// UTC Time Zone
			$offset			= 0;
			$visitor_today = JHtml::date(($today_timestamp+$offset), 'Y-m-d H:i:s', null);
			$UTC			= $offset / 3600;

			if ($UTC > 0) $UTC = '+'.$UTC;

			if ($displayDatesTimezone == '1')
			{
				echo '<small>' . gmdate('Y-m-d H:i:s', $today) . ' UTC' . $UTC . '</small><br />';
			}
		}
		else
		{
			$visitor_today = JHtml::date(($today_timestamp), 'Y-m-d H:i:s', null);
		}

		$date_today	= str_replace(' ', '-', $visitor_today);
		$date_today	= str_replace(':', '-', $date_today);
		$ex_data	= explode('-', $date_today);
		$v_month	= $ex_data[1];
		$v_year		= $ex_data[0];
		$v_day		= $ex_data[2];
		$v_hours	= $ex_data[3];
		$v_minutes	= $ex_data[4];

		for ($a = 1; $a <= $days; $a++)
		{
			$calday = $a;

			$this_date_a = $year . '-' . $month . '-' . $a;

			if ($lang->getTag() == 'fa-IR')
			{
				$this_date_cal = iCGlobalizeConvert::jalaliToGregorian($year, $month, $a, true);
			}
			else
			{
				$this_date_cal = $year . '-' . $month . '-' . $a;
			}

			if (($a == $v_day) && ($month == $v_month) && ($year == $v_year))
			{
				$classDay = 'style_Today';
			}
			else
			{
				$classDay = 'style_Day';
			}

			$datejour			= JHtml::date($this_date_cal, 'Y-m-d', $eventTimeZone);
			$this_year_month	= $year . '-' . $month . '-00';
			$list_a_date		= date('Y-m-d H:i', strtotime($this_date_a));

			// Set Date in tooltip header
			$date_to_format					= $this->formatDate($this_date_cal, false);
			$list[$calday]['dateTitle']		= $date_to_format;

//			$list[$calday]['datecal']		= JHtml::date($this_date_a, 'j', null);
//			$list[$calday]['monthcal']		= JHtml::date($this_date_a, 'm', null);
//			$list[$calday]['yearcal']		= JHtml::date($this_date_a, 'Y', null);

			$list[$calday]['date']			= date('Y-m-d H:i', strtotime($this_date_cal));

//			$list[$calday]['dateFormat']	= strftime($f, strtotime($this_date_a));
			$list[$calday]['week']			= date('N', strtotime($this_date_a));
			$list[$calday]['day']			= '<div class="' . $classDay . '">' . $a . '</div>';

			// Set cal_date
			$list[$calday]['this_day']		= date('Y-m-d', strtotime($this_date_a));

			// Added in 2.1.2 (change in NAME_day.php)
			$list[$calday]['ifToday']		= $classDay;
			$list[$calday]['Days']			= $a;

			// Set event array
			$list[$calday]['events']		= array();
		}

		return $list;
	}
	/***/


	/**
	 * Single Dates list for one event
	 */
	private function getDatelist($dates, $next)
	{
		$dates	= iCString::isSerialized($dates) ? unserialize($dates) : array();
		$da		= array();

		foreach ($dates as $d)
		{
			if (strtotime($d) >= strtotime($next) && iCDate::isDate($d))
			{
				array_push($da, date('Y-m-d H:i', strtotime($d)));
			}
		}

		return $da;
	}


	/** Systeme de navigation **/
	function getNav($date_start, $modid)
	{
		$app	= JFactory::getApplication();
		$isSef	= $app->getCfg( 'sef' );

		// Return Current URL
		$url	= JUri::getInstance()->toString() . '#tag';
		$url	= preg_replace('/&iccaldate=[^&]*/', '', $url);
		$url	= preg_replace('/\?iccaldate=[^\?]*/', '', $url);

		// Set Separator for Navigation Var
		$separator = strpos($url, '?') !== false ? '&amp;' : '?';

		// Remove fragment (hashtag could be added by a third party extension, eg. nonumber framework)
		$parsed_url	= parse_url($url);
		$fragment	= isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';

		$url	= str_replace($fragment, '', $url);

		// Return Current URL Filtered
		$url	= htmlspecialchars($url);

		// Start Date
		$ex_date	= explode('-', $date_start);
		$year		= $ex_date[0];
		$month		= $ex_date[1];
		$day		= 1;

		if ($month != 1)
		{
			$backMonth = $month-1;
			$backYear = $year;
		}
		elseif ($month == 1)
		{
			$backMonth = 12;
			$backYear = $year-1;
		}

		if ($month != 12)
		{
			$nextMonth = $month+1;
			$nextYear = $year;
		}
		elseif ($month == 12)
		{
			$nextMonth = 1;
			$nextYear = $year+1;
		}

		$backYYear = $year-1;
		$nextYYear = $year+1;

		// Create Navigation Arrows
		$classBackYear	= 'backicY icagendabtn_' . $modid;
		$urlBackYear	= $url . $separator . 'iccaldate=' . $backYYear . '-' . $month . '-' . $day;
		$iconBackYear	= '<span class="iCicon iCicon-backicY"></span>';

		$backY	= '<a class="' . $classBackYear . '" href="' . $urlBackYear . '" rel="nofollow">' . $iconBackYear . '</a>';

		$classBackMonth	= 'backic icagendabtn_' . $modid;
		$urlBackMonth	= $url . $separator . 'iccaldate=' . $backYear . '-' . $backMonth . '-' . $day;
		$iconBackMonth	= '<span class="iCicon iCicon-backic"></span>';

		$back	= '<a class="' . $classBackMonth . '" href="' . $urlBackMonth . '" rel="nofollow">' . $iconBackMonth . '</a>';

		$classNextMonth	= 'nextic icagendabtn_' . $modid;
		$urlNextMonth	= $url . $separator . 'iccaldate=' . $nextYear . '-' . $nextMonth . '-' . $day;
		$iconNextMonth	= '<span class="iCicon iCicon-nextic"></span>';

		$next	= '<a class="' . $classNextMonth . '" href="' . $urlNextMonth . '" rel="nofollow">' . $iconNextMonth . '</a>';

		$classNextYear	= 'nexticY icagendabtn_' . $modid;
		$urlNextYear	= $url . $separator . 'iccaldate=' . $nextYYear . '-' . $month . '-' . $day;
		$iconNextYear	= '<span class="iCicon iCicon-nexticY"></span>';

		$nextY	= '<a class="' . $classNextYear . '" href="' . $urlNextYear . '" rel="nofollow">' . $iconNextYear . '</a>';

		if ( ! $this->month_nav) $back = $next = '';
		if ( ! $this->year_nav) $backY = $nextY = '';

		/** translate the month in the calendar module -- Leland Vandervort **/
		$dateFormat = date('Y-m-d', strtotime($date_start));

		// split out the month and year to obtain translation key for JText using joomla core translation
		$t_day		= strftime("%d", strtotime("$dateFormat"));
		$t_month	= date('F', strtotime($dateFormat));
		$t_year		= strftime("%Y", strtotime("$dateFormat"));

		$lang		= JFactory::getLanguage();
		$langTag	= $lang->getTag();

		$yearBeforeMonth = array('ar-AA', 'ja-JP');

		$monthBeforeYear = in_array($langTag, $yearBeforeMonth) ? 0 : 1;

		/**
		 * Get prefix, suffix and separator for month and year in calendar title
		 */

		// Separator Month/Year
		$separator_month_year = JText::_('SEPARATOR_MONTH_YEAR');
		if ($separator_month_year == 'CALENDAR_SEPARATOR_MONTH_YEAR_FACULTATIVE')
		{
			$separator_month_year = ' ';
		}
		elseif ($separator_month_year == 'NO_SEPARATOR')
		{
			$separator_month_year = '';
		}

		// Prefix Month (Facultative)
		$prefix_month = JText::_('PREFIX_MONTH');
		if ($prefix_month == 'CALENDAR_PREFIX_MONTH_FACULTATIVE')
		{
			$prefix_month = '';
		}

		// Suffix Month (Facultative)
		$suffix_month = JText::_('SUFFIX_MONTH');
		if ($suffix_month == 'CALENDAR_SUFFIX_MONTH_FACULTATIVE')
		{
			$suffix_month = '';
		}

		// Prefix Year (Facultative)
		$prefix_year = JText::_('PREFIX_YEAR');
		if ($prefix_year == 'CALENDAR_PREFIX_YEAR_FACULTATIVE')
		{
			$prefix_year = '';
		}

		// Suffix Year (Facultative)
		$suffix_year = JText::_('SUFFIX_YEAR');
		if ($suffix_year == 'CALENDAR_SUFFIX_YEAR_FACULTATIVE')
		{
			$suffix_year = '';
		}

		$SEP	= $separator_month_year;
		$PM		= $prefix_month;
		$SM		= $suffix_month;
		$PY		= $prefix_year;
		$SY		= $suffix_year;

		// Get MONTH_CAL string or if not translated, use MONTHS
		$array_months = array(
			'JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE',
			'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER'
		);

		$cal_string			= $t_month . '_CAL';
		$missing_cal_string	= iCFilterOutput::stringToJText($cal_string);

		if ( in_array($missing_cal_string, $array_months) )
		{
			// if MONTHS_CAL strings not translated in current language, use MONTHS strings
			$month_J = JText::_( $t_month );
		}
		else
		{
			// Use MONTHS_CAL strings when translated in current language
			$month_J = JText::_( $t_month . '_CAL' );
		}

		// Set Calendar Title
		if ($monthBeforeYear == 0)
		{
			$title = $PY . $t_year . $SY . $SEP . $PM . $month_J . $SM;
		}
		else
		{
			$title = $PM . $month_J . $SM . $SEP . $PY . $t_year . $SY;
		}

		// Set Nav Bar for calendar
		$html = '<div class="icnav">' . $backY . $back . $nextY . $next;
		$html.= '<div class="titleic">' . $title . '</div>';
		$html.= '</div><div style="clear:both"></div>';

		return $html;
	}
}


class cal
{
	public $data;
	public $template;
	public $t_calendar;
	public $t_day;
	public $nav;
	public $fontcolor;
	private $header_text;

	function __construct ($data, $t_calendar, $t_day, $nav,
		$firstday, $columns_bg_color,
		$calfontcolor, $OneEventbgcolor, $Eventsbgcolor, $bgcolor, $bgimage, $bgimagerepeat,
		$moduleclass_sfx, $modid, $template, $ictip_ordering, $header_text)
	{
		$this->data				= $data;
		$this->t_calendar		= $t_calendar;
		$this->t_day			= $t_day;
		$this->nav				= $nav;
		$this->firstday			= $firstday;
		$this->calfontcolor		= $calfontcolor;
		$this->OneEventbgcolor	= $OneEventbgcolor;
		$this->Eventsbgcolor	= $Eventsbgcolor;
		$this->bgcolor			= $bgcolor;
		$this->bgimage			= $bgimage;
		$this->bgimagerepeat	= $bgimagerepeat;
		$this->moduleclass_sfx	= $moduleclass_sfx;
		$this->modid			= $modid;
		$this->template			= $template;
		$this->ictip_ordering	= $ictip_ordering;
		$this->header_text		= $header_text;

		// Columns Background colors
		$cbc					= $columns_bg_color;

		$this->weekdays = array('MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN');

		switch ($this->firstday)
		{
			case 0:
				$this->colbg	= array($cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6]);
				$this->day		= array(7, 1, 2, 3, 4, 5, 6);
				break;

			case 1:
				$this->colbg	= array($cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6], $cbc[0]);
				$this->day		= array(1, 2, 3, 4, 5, 6, 7);
				break;

			case 2:
				$this->colbg	= array($cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6], $cbc[0], $cbc[1]);
				$this->day		= array(2, 3, 4, 5, 6, 7, 1);
				break;

			case 3:
				$this->colbg	= array($cbc[3], $cbc[4], $cbc[5], $cbc[6], $cbc[0], $cbc[1], $cbc[2]);
				$this->day		= array(3, 4, 5, 6, 7, 1, 2);
				break;

			case 4:
				$this->colbg	= array($cbc[4], $cbc[5], $cbc[6], $cbc[0], $cbc[1], $cbc[2], $cbc[3]);
				$this->day		= array(4, 5, 6, 7, 1, 2, 3);
				break;

			case 5:
				$this->colbg	= array($cbc[5], $cbc[6], $cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4]);
				$this->day		= array(5, 6, 7, 1, 2, 3, 4);
				break;

			case 6:
				$this->colbg	= array($cbc[6], $cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5]);
				$this->day		= array(6, 7, 1, 2, 3, 4, 5);
				break;

			default:
				$this->colbg	= array($cbc[0], $cbc[1], $cbc[2], $cbc[3], $cbc[4], $cbc[5], $cbc[6]);
				$this->day		= array(7, 1, 2, 3, 4, 5, 6);
				break;
		}
	}


	function days()
	{
		$this_calfontcolor	= str_replace(' ', '', $this->calfontcolor);
		$calfontcolor		= ! empty($this_calfontcolor) ? ' color:' . $this->calfontcolor . ';' : '';
		$this_bgcolor		= str_replace(' ', '', $this->bgcolor);
		$bgcolor			= ! empty($this_bgcolor) ? ' background-color:' . $this->bgcolor . ';' : '';
		$this_bgimage		= str_replace(' ', '', $this->bgimage);
		$bgimage			= ! empty($this_bgimage) ? ' background-image:url(\'' . $this->bgimage . '\');' : '';
		$this_bgimagerepeat	= str_replace(' ', '', $this->bgimagerepeat);
		$bgimagerepeat		= ! empty($this_bgimagerepeat) ? ' background-repeat:' . $this->bgimagerepeat . ';' : '';
		$iCcal_style		= '';

		if ( ! empty($this_calfontcolor)
			|| ! empty($this_bgcolor)
			|| ! empty($this_bgimage)
			|| ! empty($this_bgimagerepeat) )
		{
			$iCcal_style.= 'style="';
		}

		$iCcal_style.= $calfontcolor . $bgcolor . $bgimage;
		$iCcal_style.= ($this_bgimagerepeat && $this_bgimage) ? $bgimagerepeat : '';
		$iCcal_style.= (empty($this_bgcolor) && empty($this_bgimage)) ? ' background-color: transparent; background-image: none;' : '';
		$iCcal_style.= '"';

		// Verify Hex color strings
		$OneEventbgcolor	= preg_match('/^#[a-f0-9]{6}$/i', $this->OneEventbgcolor) ? $this->OneEventbgcolor : '';
		$Eventsbgcolor		= preg_match('/^#[a-f0-9]{6}$/i', $this->Eventsbgcolor) ? $this->Eventsbgcolor : '';

		echo '<div class="' . $this->template . ' iccalendar ' . $this->moduleclass_sfx . '" ' . $iCcal_style . ' id="' . $this->modid . '">';


		echo '<div id="mod_iccalendar_' . $this->modid . '">
			<div class="icagenda_header">' . $this->header_text . '
			</div>' . $this->nav . '
			<table id="icagenda_calendar" class="ic-table" style="width:100%;">
				<thead>
					<tr>
						<th style="width:14.2857143%;background:' . $this->colbg[0] . ';">' . JText::_($this->weekdays[($this->day[0]-1)]) . '</th>
						<th style="width:14.2857143%;background:' . $this->colbg[1] . ';">' . JText::_($this->weekdays[($this->day[1]-1)]) . '</th>
						<th style="width:14.2857143%;background:' . $this->colbg[2] . ';">' . JText::_($this->weekdays[($this->day[2]-1)]) . '</th>
						<th style="width:14.2857143%;background:' . $this->colbg[3] . ';">' . JText::_($this->weekdays[($this->day[3]-1)]) . '</th>
						<th style="width:14.2857143%;background:' . $this->colbg[4] . ';">' . JText::_($this->weekdays[($this->day[4]-1)]) . '</th>
						<th style="width:14.2857143%;background:' . $this->colbg[5] . ';">' . JText::_($this->weekdays[($this->day[5]-1)]) . '</th>
						<th style="width:14.2857143%;background:' . $this->colbg[6] . ';">' . JText::_($this->weekdays[($this->day[6]-1)]) . '</th>
					</tr>
				</thead>
		';

		switch ($this->data[1]['week'])
		{
			case $this->day[0]:
				break;

			case $this->day[1]:
				echo '<tr><td colspan="1"></td>';
				break;

			case $this->day[2]:
				echo '<tr><td colspan="2"></td>';
				break;

			case $this->day[3]:
				echo '<tr><td colspan="3"></td>';
				break;

			case $this->day[4]:
				echo '<tr><td colspan="4"></td>';
				break;

			case $this->day[5]:
				echo '<tr><td colspan="5"></td>';
				break;

			case $this->day[6]:
				echo '<tr><td colspan="6"></td>';
				break;

			default:
				echo '<tr><td colspan="' . ($this->data[1]['week']-$this->firstday) . '"></td>';
				break;
		}

		foreach ($this->data as $d)
		{
			$stamp = new day($d);

			switch($stamp->week)
			{
				case $this->day[0]:
					echo '<tr><td style="background:' . $this->colbg[0] . ';">';
					break;

				case $this->day[1]:
					echo '<td style="background:' . $this->colbg[1] . ';">';
					break;

				case $this->day[2]:
					echo '<td style="background:' . $this->colbg[2] . ';">';
					break;

				case $this->day[3]:
					echo '<td style="background:' . $this->colbg[3] . ';">';
					break;

				case $this->day[4]:
					echo '<td style="background:' . $this->colbg[4] . ';">';
					break;

				case $this->day[5]:
					echo '<td style="background:' . $this->colbg[5] . ';">';
					break;

				case $this->day[6]:
					echo '<td style="background:' . $this->colbg[6] . ';">';
					break;

				default:
					echo '<td>';
					break;
			}

			$count_events = count($stamp->events);

			if ($OneEventbgcolor
				&& $OneEventbgcolor != ' '
				&& $count_events == '1')
			{
				$bg_day = $OneEventbgcolor;
			}
			elseif ($Eventsbgcolor
				&& $Eventsbgcolor != ' '
				&& $count_events > '1')
			{
				$bg_day = $Eventsbgcolor;
			}
			else
			{
				$bg_day = isset($stamp->events[0]['cat_color']) ? $stamp->events[0]['cat_color'] : '#d4d4d4';
			}

			$bgcolor		= iCColor::getBrightness($bg_day);
			$bgcolor		= ($bgcolor == 'bright') ? 'ic-bright' : 'ic-dark';
			$order			= 'first';

			$multi_events	= isset($stamp->events[1]['cat_color']) ? 'icmulti' : '';

			// Ordering by time New Theme Packs (since 3.2.9)
			$events			= $stamp->events;

			// Option for Ordering is not yet finished. This developpement is in brainstorming...
			$ictip_ordering	= '1';
			$ictip_ordering	= $this->ictip_ordering;

			if ($ictip_ordering == '1_ASC-1_ASC' || $ictip_ordering == '1_ASC-1_DESC') $ictip_ordering = '1_ASC';
			if ($ictip_ordering == '2_ASC-2_ASC' || $ictip_ordering == '2_ASC-2_DESC') $ictip_ordering = '2_ASC';
			if ($ictip_ordering == '1_DESC-1_ASC' || $ictip_ordering == '1_DESC-1_DESC') $ictip_ordering = '1_DESC';
			if ($ictip_ordering == '2_DESC-2_ASC' || $ictip_ordering == '2_DESC-2_DESC') $ictip_ordering = '2_DESC';

			// Create Functions for Ordering
			// Default $newfunc_1_ASC_2_ASC - edited 2015-07-01 to fix ordering by Time when am/pm
			$newfunc_1_ASC_2_ASC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($a["cat_title"], $b["cat_title"]); } else { return strcasecmp(date("H:i", strtotime($a["time"])), date("H:i", strtotime($b["time"]))); }');

			$newfunc_1_ASC_2_DESC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($b["cat_title"], $a["cat_title"]); } else { return strcasecmp($a["time"], $b["time"]); }');
			$newfunc_1_DESC_2_ASC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($a["cat_title"], $b["cat_title"]); } else { return strcasecmp($b["time"], $a["time"]); }');
			$newfunc_1_DESC_2_DESC = create_function('$a, $b', 'if ($a["time"] == $b["time"]){ return strcasecmp($b["cat_title"], $a["cat_title"]); } else { return strcasecmp($b["time"], $a["time"]); }');

			$newfunc_2_ASC_1_ASC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($a["time"], $b["time"]); } else { return strcasecmp($a["cat_title"], $b["cat_title"]); }');
			$newfunc_2_ASC_1_DESC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($b["time"], $a["time"]); } else { return strcasecmp($a["cat_title"], $b["cat_title"]); }');
			$newfunc_2_DESC_1_ASC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($a["time"], $b["time"]); } else { return strcasecmp($b["cat_title"], $a["cat_title"]); }');
			$newfunc_2_DESC_1_DESC = create_function('$a, $b', 'if ($a["cat_title"] == $b["cat_title"]){ return strcasecmp($b["time"], $a["time"]); } else { return strcasecmp($b["cat_title"], $a["cat_title"]); }');

			$newfunc_1_ASC = create_function('$a, $b', 'return strcasecmp($a["time"], $b["time"]);');
			$newfunc_2_ASC = create_function('$a, $b', 'return strcasecmp($a["cat_title"], $b["cat_title"]);');

			$newfunc_1_DESC = create_function('$a, $b', 'return strcasecmp($b["time"], $a["time"]);');
			$newfunc_2_DESC = create_function('$a, $b', 'return strcasecmp($b["cat_title"], $a["cat_title"]);');

			// Order by time - Old Theme Packs (before 3.2.9) : Update Theme Pack to get all options
			usort($stamp->events, $newfunc_1_ASC_2_ASC);

			// Time ASC and if same time : Category Title ASC (default)
			if ($ictip_ordering == '1_ASC-2_ASC')
			{
				usort($events, $newfunc_1_ASC_2_ASC);
			}
			// Time ASC and if same time : Category Title DESC
			if ($ictip_ordering == '1_ASC-2_DESC')
			{
				usort($events, $newfunc_1_ASC_2_DESC);
			}
			// Time DESC and if same time : Category Title ASC
			if ($ictip_ordering == '1_DESC-2_ASC')
			{
				usort($events, $newfunc_1_DESC_2_ASC);
			}
			// Time DESC and if same time : Category Title DESC
			if ($ictip_ordering == '1_DESC-2_DESC')
			{
				usort($events, $newfunc_1_DESC_2_DESC);
			}

			// Category Title ASC and if same category : Time ASC
			if ($ictip_ordering == '2_ASC-1_ASC')
			{
				usort($events, $newfunc_2_ASC_1_ASC);
			}
			// Category Title ASC and if same category : Time DESC
			if ($ictip_ordering == '2_ASC-1_DESC')
			{
				usort($events, $newfunc_2_ASC_1_DESC);
			}
			// Category Title DESC and if same category : Time ASC
			if ($ictip_ordering == '2_DESC-1_ASC')
			{
				usort($events, $newfunc_2_DESC_1_ASC);
			}
			// Category Title DESC and if same category : Time DESC
			if ($ictip_ordering == '2_DESC-1_DESC')
			{
				usort($events, $newfunc_2_DESC_1_DESC);
			}

			// If main ordering and sub-ordering on Time : set TIME ASC (with no sub-ordering)
			if ($ictip_ordering == '1_ASC')
			{
				usort($events, $newfunc_1_ASC);
			}
			// If main ordering and sub-ordering on Category Title : set CATEGORY TITLE ASC (with no sub-ordering)
			if ($ictip_ordering == '2_ASC')
			{
				usort($events, $newfunc_2_ASC);
			}


			// Load template for day infotip
			require $this->t_day;

			switch('week')
			{
				case $this->day[6]:
					echo '</td></tr>';
					break;
				default:
					echo '</td>';
					break;
			}
		}

		switch ($stamp->week)
		{
			case $this->day[6]:
				break;
			default:
				echo '<td colspan="' . (7-$stamp->week) . '"></td></tr>';
				break;
		}

		echo '</table></div>';

		echo '</div>';

	}
}


class day
{
	public $date;
	public $week;
	public $day;
	public $month;
	public $year;
	public $events;
	public $fontcolor;

	function __construct($day)
	{
		foreach ($day as $k=>$v)
		{
			$this->$k = $v;
		}
	}
}
index.html000060400000000000152455611460006534 0ustar00mod_iccalendar.xml000060400000045277152455611460010236 0ustar00<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" version="2.5" client="site" method="upgrade">
	<name>iCagenda - Calendar</name>
	<creationDate>2015-10-12</creationDate>
	<copyright>Copyright (c)2012-2015 JoomliC. All rights reserved.</copyright>
	<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
	<author>Jooml!C</author>
	<authorEmail>info@joomlic.com</authorEmail>
	<authorUrl>www.joomlic.com</authorUrl>
	<version>3.5.12</version>
	<description>Calendar module for iCagenda component</description>
	<files>
        <filename>mod_iccalendar.xml</filename>
		<filename module="mod_iccalendar">mod_iccalendar.php</filename>
		<filename>index.html</filename>
		<filename>helper.php</filename>
		<folder>js</folder>
	</files>
	<languages folder="site">
		<language tag="en-GB">language/en-GB/en-GB.mod_iccalendar.ini</language>
		<language tag="fr-FR">language/fr-FR/fr-FR.mod_iccalendar.ini</language>
		<language tag="it-IT">language/it-IT/it-IT.mod_iccalendar.ini</language>
	</languages>
	<config>
		<fields id="params" name="params" type="fields" label="params" addfieldpath="/administrator/components/com_icagenda/models/fields">
			<fieldset name="basic" addfieldpath="/administrator/components/com_icagenda/assets/elements">

				<field
					name="template"
					type="modal_template"
					label="MOD_ICCALENDAR_THEME_PACK_LBL"
					description="MOD_ICCALENDAR_THEME_PACK_DESC"
					size="40"
					class="inputbox"
					default="default"
				/>
				<field
					name="iCmenuitem"
					type="modal_menulink"
					default=""
					label="MOD_ICCALENDAR_FIELD_MENU_LABEL"
					description="MOD_ICCALENDAR_FIELD_MENU_DESC" >
				</field>
				<field
					name="firstMonth"
					type="calendar"
					label="MOD_ICCALENDAR_LOADING_ON_DATE_LBL"
					description="MOD_ICCALENDAR_LOADING_ON_DATE_DESC"
					default=""/>

				<field type="Title" label="MOD_ICCALENDAR_FILTERS_LABEL" class="stylebox lead input-xxlarge"/>
				<field
					name="mcatid"
					type="modal_multicat"
					class="inputbox"
					multiple="multiple"
					default="0"
					label="MOD_ICCALENDAR_LBL_CATEGORY"
					description="MOD_ICCALENDAR_DESC_CATEGORY"
				/>
				<field
					name="onlyStDate"
					type="list"
					label="MOD_ICCALENDAR_LBL_PERIOD"
					description="MOD_ICCALENDAR_PERIOD_ONLY_START_DATE_DESC"
					default=""
					class="btn-group">
						<option value="">PERIOD_ALL_DATES</option>
						<option value="1">PERIOD_ONLY_START_DATE</option>
						<!--option value="2">Only Next Date</option-->
				</field>

				<field type="Title" label="MOD_ICCALENDAR_HEADER_TEXT_LBL" class="stylebox lead input-xxlarge"/>
				<field
					name="header_text"
					type="editor"
					label="MOD_ICCALENDAR_HEADER_TEXT_LBL"
					description="MOD_ICCALENDAR_HEADER_TEXT_DESC"
					filter="JComponentHelper::filterText"
					default=""
				/>

				<field type="Title" label=" " class="stylenote"/>
				<field type="Title" label="MOD_ICCALENDAR_LBL_TOOLTIP" class="stylebox lead input-xxlarge"/>

				<field
					name="tipwidth"
					type="text"
					label="MOD_ICCALENDAR_LBL_TIP_WIDTH"
					description="MOD_ICCALENDAR_DESC_TIP_WIDTH"
					size="30"
					class="inputbox"
					default="390"
				/>

				<field type="TitleImg" label="MOD_ICCALENDAR_DESC_HORIZ_POSITION" class="stylenote alert alert-info input-xxlarge" icimage="info.png" />
				<field
					name="position"
					type="radio"
					label="MOD_ICCALENDAR_LBL_HORIZ_POSITION"
					description="MOD_ICCALENDAR_DESC_HORIZ_POSITION"
					class="btn-group"
					labelclass="control-label"
					default="center">
						<option value="left">MOD_ICCALENDAR_HORIZ_POSITION_LEFT</option>
						<option value="center">MOD_ICCALENDAR_HORIZ_POSITION_MIDDLE</option>
						<option value="right">MOD_ICCALENDAR_HORIZ_POSITION_RIGHT</option>
				</field>

				<field
					name="posmiddle"
					type="radio"
					label="MOD_ICCALENDAR_LBL_VERT_POSITION"
					description="MOD_ICCALENDAR_DESC_VERT_POSITION"
					class="btn-group"
					labelclass="control-label"
					default="top">
						<option value="top">MOD_ICCALENDAR_VERT_POSITION_TOP</option>
						<option value="bottom">MOD_ICCALENDAR_VERT_POSITION_BOTTOM</option>
				</field>

				<field type="TitleImg" label="MOD_ICCALENDAR_DESC_VERT_POSITION_OFFSET" class="stylenote alert alert-info input-xxlarge" icimage="info.png" />
				<field
					name="verticaloffset"
					type="text"
					label="MOD_ICCALENDAR_LBL_VERT_POSITION_OFFSET"
					description="MOD_ICCALENDAR_DESC_VERT_POSITION_OFFSET"
					size="30"
					class="inputbox"
					default="50"
				/>

				<field type="TitleImg" label="MOD_ICCALENDAR_TIP_PADDING" class="stylenote alert alert-info input-xxlarge" icimage="info.png" />
				<field
					name="padding"
					type="text"
					label="MOD_ICCALENDAR_LBL_TIP_PADDING"
					description="MOD_ICCALENDAR_DESC_TIP_PADDING"
					size="30"
					class="inputbox"
					default="0"
				/>

				<field type="TitleImg" label="MOD_ICCALENDAR_DESC_MOUSEOVER" class="stylenote alert alert-info input-xxlarge" icimage="info.png" />
				<field
					name="mouseover"
					type="radio"
					label="MOD_ICCALENDAR_LBL_MOUSEOVER"
					description="MOD_ICCALENDAR_DESC_MOUSEOVER"
					class="btn-group"
					labelclass="control-label"
					default="click">
						<option value="click">MOD_ICCALANDAR_OPEN_CLICK</option>
						<option value="mouseover">MOD_ICCALANDAR_OPEN_MOUSEOVER</option>
				</field>
				<field
					name="mouseout"
					type="radio"
					label="MOD_ICCALENDAR_CLOSE_ON_MOUSEOUT_LBL"
					description="MOD_ICCALENDAR_CLOSE_ON_MOUSEOUT_DESC"
					class="btn-group"
					labelclass="control-label"
					default="1"
					>
					<option value="0">JNO</option>
					<option value="1">JYES</option>
				</field>

				<field type="Title" label="MOD_ICCALENDAR_FORMAT_NOTE" class="stylenote"/>
				<field
					name="format"
					type="iclist_globalization"
					class="inputbox"
					label="COM_ICAGENDA_LBL_FORMAT"
					description="COM_ICAGENDA_LBL_FORMAT"
					default="0"
				/>

				<field
					name="date_separator"
					type="text"
					label="COM_ICAGENDA_LBL_DATE_SEPARATOR"
					description="COM_ICAGENDA_DESC_DATE_SEPARATOR"
					size="5"
					class="inputbox"
					default=""
				/>

				<field type="TitleImg" label="COM_ICAGENDA_DATE_FORMAT_NOTE1" class="stylenote alert alert-info input-xxlarge" icimage="info.png" />
				<field type="TitleImg" label="COM_ICAGENDA_DATE_FORMAT_NOTE2" class="stylenoteP alert alert-block input-xxlarge" icimage="blanck.png" />

				<!--field type="Title" label="MOD_ICCALENDAR_LBL_ORDERING" class="stylenote"/>
				<field
					name="events_ordering_first"
					type="list"
					label="MOD_ICCALENDAR_EVENTS_ORDERING_FIRST_LABEL"
					description="MOD_ICCALENDAR_EVENTS_ORDERING_FIRST_DESC"
					default="1_ASC">
						<option value="1_ASC">MOD_ICCALENDAR_TIME_ASC</option>
						<option value="1_DESC">MOD_ICCALENDAR_TIME_DESC</option>
						<option value="2_ASC">MOD_ICCALENDAR_CAT_TITLE_ASC</option>
						<option value="2_DESC">MOD_ICCALENDAR_CAT_TITLE_DESC</option>
				</field>

				<field
					name="events_ordering_second"
					type="list"
					label="MOD_ICCALENDAR_EVENTS_ORDERING_SECOND_LABEL"
					description="MOD_ICCALENDAR_EVENTS_ORDERING_SECOND_DESC"
					default="3">
						<option value="1_ASC">MOD_ICCALENDAR_TIME_ASC</option>
						<option value="1_DESC">MOD_ICCALENDAR_TIME_DESC</option>
						<option value="2_ASC">MOD_ICCALENDAR_CAT_TITLE_ASC</option>
						<option value="2_DESC">MOD_ICCALENDAR_CAT_TITLE_DESC</option>
				</field-->

				<field type="Title" label="MOD_ICCALENDAR_LBL_TOOLTIP_INFOS" class="stylenote"/>

				<field
					name="dp_time"
					type="radio"
					class="btn-group"
					label="MOD_ICCALENDAR_DISPLAY_TIME_LABEL"
					description="MOD_ICCALENDAR_DISPLAY_TIME_DESC"
					labelclass="control-label"
					default="1">
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>
				<field
					name="dp_venuename"
					type="radio"
					class="btn-group"
					label="MOD_ICCALENDAR_DISPLAY_VENUE_NAME_LABEL"
					description="MOD_ICCALENDAR_DISPLAY_VENUE_NAME_DESC"
					labelclass="control-label"
					default="1">
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>
				<field
					name="dp_city"
					type="radio"
					class="btn-group"
					label="MOD_ICCALENDAR_DISPLAY_CITY_LABEL"
					description="MOD_ICCALENDAR_DISPLAY_CITY_DESC"
					labelclass="control-label"
					default="1">
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>
				<field
					name="dp_country"
					type="radio"
					class="btn-group"
					label="MOD_ICCALENDAR_DISPLAY_COUNTRY_LABEL"
					description="MOD_ICCALENDAR_DISPLAY_COUNTRY_DESC"
					labelclass="control-label"
					default="1">
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>
				<field
					name="dp_regInfos"
					type="radio"
					class="btn-group"
					label="MOD_ICCALENDAR_DISPLAY_REGISTRATION_INFOS_LABEL"
					description="MOD_ICCALENDAR_DISPLAY_REGISTRATION_INFOS_DESC"
					labelclass="control-label"
					default="1">
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>
				<field
					name="features_icon_size"
					type="list"
					label="MOD_ICCALENDAR_FEATURES_ICONSIZE_LABEL"
					description="MOD_ICCALENDAR_FEATURES_ICONSIZE_DESC"
					default=""
					filter="options"
					class="inputbox">
						<option value="">COM_ICAGENDA_FEATURES_ICONSIZE_NONE</option>
						<option value="16_bit">COM_ICAGENDA_FEATURES_ICONSIZE_16</option>
						<option value="24_bit">COM_ICAGENDA_FEATURES_ICONSIZE_24</option>
						<option value="32_bit">COM_ICAGENDA_FEATURES_ICONSIZE_32</option>
						<option value="48_bit">COM_ICAGENDA_FEATURES_ICONSIZE_48</option>
						<option value="64_bit">COM_ICAGENDA_FEATURES_ICONSIZE_64</option>
				</field>
				<field
					name="show_icon_title"
					type="radio"
					label="MOD_ICCALENDAR_SHOW_FEATURE_ICON_TITLE_LABEL"
					description="MOD_ICCALENDAR_SHOW_FEATURE_ICON_TITLE_DESC"
					class="btn-group"
					filter="options"
					default="1">
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>
				<field
					name="dp_shortDesc"
					type="radio"
					class="btn-group"
					label="COM_ICAGENDA_LIST_INTROTEXT_DISPLAY_LABEL"
					description="COM_ICAGENDA_LIST_INTROTEXT_DISPLAY_DESC"
					labelclass="control-label"
					default="">
						<option value="">IC_AUTO</option>
						<option value="0">JHIDE</option>
						<option value="1">IC_SHORTDESC</option>
						<option value="2">IC_AUTO_INTROTEXT</option>
				</field>
				<field
					name="filtering_shortDesc"
					type="list"
					class="btn-group"
					label="ICAGENDA_FILTERING_SHORTDESC_LABEL"
					description="ICAGENDA_FILTERING_SHORTDESC_DESC"
					default="">
						<option value="">ICAGENDA_GLOBAL_OPTION</option>
						<option value="1">ICAGENDA_FILTERING_NO_HTML</option>
						<option value="2">ICAGENDA_FILTERING_ALL_ITALIC</option>
				</field>
				<field
					name="paramlimit"
					type="modal_icvalue_opt"
					default=""
					label="ICAGENDA_AUTO_INTROTEXT_LIMIT_LABEL"
					description="ICAGENDA_AUTO_INTROTEXT_LIMIT_DESC"
					labelclass="control-label"
				/>
				<field
					name="paramlimit_Content"
					type="modal_icvalue_field"
					class="inputbox"
					label=" "
					labelclass="control-label"
				/>

				<field type="Title" label="MOD_ICCALENDAR_LBL_DISPLAY" class="stylenote"/>
				<field
					name="calendarclosebtn"
					type="modal_icvalue_opt"
					label="COM_ICAGENDA_LBL_CLOSE_TEXT"
					description="COM_ICAGENDA_DESC_CLOSE_TEXT"
					labelclass="control-label"
					default="0"
				/>
				<field
					name="calendarclosebtn_Content"
					type="modal_icvalue_field"
					class="inputbox"
					label=" "
					labelclass="control-label"
					default="X"
				/>


				<field type="Title" label=" " class="stylenote"/>
				<field type="Title" label="MOD_ICCALENDAR_LBL_DISPLAY" class="stylebox lead input-xxlarge"/>

				<field type="Title" label="MOD_ICCALENDAR_NAVIGATION" class="stylenote"/>
				<field
					name="month_nav"
					type="radio"
					class="btn-group"
					label="MOD_ICCALENDAR_NAVIGATION_MONTH_DISPLAY_LBL"
					description="MOD_ICCALENDAR_NAVIGATION_MONTH_DISPLAY_DESC"
					labelclass="control-label"
					default="1" >
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>
				<field
					name="year_nav"
					type="radio"
					class="btn-group"
					label="MOD_ICCALENDAR_NAVIGATION_YEAR_DISPLAY_LBL"
					description="MOD_ICCALENDAR_NAVIGATION_YEAR_DISPLAY_DESC"
					labelclass="control-label"
					default="1" >
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field>

				<field type="Title" label="MOD_ICCALENDAR_LBL_FIRSTDAY_WEEK" class="stylenote"/>
				<field
					name="firstday"
					type="list"
					label="MOD_ICCALENDAR_LBL_FIRSTDAY"
            		default="1" >
						<option value="0">SUNDAY</option>
						<option value="1">MONDAY</option>
						<option value="2">TUESDAY</option>
						<option value="3">WEDNESDAY</option>
						<option value="4">THURSDAY</option>
						<option value="5">FRIDAY</option>
						<option value="6">SATURDAY</option>
				</field>

				<field type="Title" label="MOD_ICCALENDAR_LBL_FONTCOLORS" class="stylenote"/>
				<field
					name="calfontcolor"
					type="color"
					class="inputbox"
					size="7"
					default=" "
					label="MOD_ICCALENDAR_CALENDAR_FONTCOLOR_LBL"
					description="MOD_ICCALENDAR_CALENDAR_FONTCOLOR_DESC"
					filter="safehtml"
				/>

				<field type="Title" label="MOD_ICCALENDAR_LBL_BGCOLORS" class="stylenote"/>
				<field
					name="OneEventbgcolor"
					type="color"
					class="inputbox"
					size="7"
					default=" "
					label="MOD_ICCALENDAR_DAY_WITH_ONE_EVENT_BACKGROUND_COLOR_LBL"
					description="MOD_ICCALENDAR_DAY_WITH_ONE_EVENT_BACKGROUND_COLOR_DESC"
					filter="safehtml"
				/>
				<field
					name="Eventsbgcolor"
					type="color"
					class="inputbox"
					size="7"
					default=" "
					label="MOD_ICCALENDAR_DAY_WITH_EVENTS_BACKGROUND_COLOR_LBL"
					description="MOD_ICCALENDAR_DAY_WITH_EVENTS_BACKGROUND_COLOR_DESC"
					filter="safehtml"
				/>
				<field
					name="bgcolor"
					type="color"
					class="inputbox"
					size="7"
					default=" "
					label="ICCALENDAR_BACKGROUND_COLOR"
					description="ICCALENDAR_BACKGROUND_COLOR_DESC"
					filter="safehtml"
				/>

				<field
					name="bgimage"
					type="media"
					class="inputbox"
					size="7"
					default=""
					label="ICCALENDAR_BACKGROUND_IMAGE"
					description="ICCALENDAR_BACKGROUND_IMAGE_DESC"
					filter="safehtml"
				/>

				<field
					name="bgimagerepeat"
					type="list"
					default="repeat"
					label="ICCALENDAR_BACKGROUND_IMAGE_REPEAT"
					description="ICCALENDAR_BACKGROUND_IMAGE_REPEAT_DESC" >
						<option value="repeat">repeat</option>
						<option value="repeat-x">repeat-x</option>
						<option value="repeat-y">repeat-y</option>
						<option value="no-repeat">no-repeat</option>
				</field>

				<field
					name="mon"
					type="color"
					class="inputbox"
					size="7"
					default=" "
					label="MONDAY"
					filter="safehtml"
				/>

				<field
					name="tue"
					type="color"
					class="inputbox"
					size="7"
					default=" "
					label="TUESDAY"
					filter="safehtml"
				/>

				<field
					name="wed"
					type="color"
					size="7"
					class="inputbox"
					default=" "
					label="WEDNESDAY"
					filter="safehtml"
				/>

				<field
					name="thu"
					type="color"
					size="7"
					class="inputbox"
					default=" "
					label="THURSDAY"
					filter="safehtml"
				/>

				<field
					name="fri"
					type="color"
					size="7"
					class="inputbox"
					default=" "
					label="FRIDAY"
					filter="safehtml"
				/>

				<field
					name="sat"
					type="color"
					size="7"
					class="inputbox"
					default=" "
					label="SATURDAY"
					filter="safehtml"
				/>

				<field
					name="sun"
					type="color"
					size="7"
					class="inputbox"
					default=" "
					label="SUNDAY"
					filter="safehtml"
				/>

				<field type="Title" label=" " class="stylenote"/>
				<field type="Title" label="MOD_ICCALENDAR_LBL_ADVANCED" class="stylebox lead input-xxlarge"/>

				<field type="Title" label="MOD_ICCALENDAR_LBL_JQUERY" class="stylenote"/>
				<field
					name="loadJquery"
					type="radio"
					label="MOD_ICCALENDAR_LBL_LOADJQUERY"
					description="MOD_ICCALENDAR_DESC_LOADJQUERY"
					default="auto"
					class="btn-group">
						<option value="auto">MOD_ICCALENDAR_LOADJQUERY_AUTO</option>
						<option value="0">MOD_ICCALENDAR_LOADJQUERY_NO</option>
						<option value="1">MOD_ICCALENDAR_LOADJQUERY_YES</option>
				</field>

				<field type="Title" label="ICAGENDA_LBL_TIMEZONE" class="stylenote"/>
				<field
					name="setTodayTimezone"
					type="list"
					label="ICAGENDA_LBL_TODAY_TIMEZONE"
					description="ICAGENDA_DESC_TODAY_TIMEZONE"
					onchange="icalert()"
					default="">
						<option value="">ICAGENDA_VISITOR_TIMEZONE</option>
						<option value="SITE">ICAGENDA_JOOMLA_SERVER_TIMEZONE</option>
						<option value="UTC">ICAGENDA_UTC_TIMEZONE</option>
						<!--option value="2">ICAGENDA_HOSTING_SERVER_TIMEZONE</option-->
				</field>
				<field
					name="caldate_error"
					type="modal_icalert_msg"
					label="COM_ICAGENDA_THEME_PACKS_COMPATIBILITY"
					description="MOD_ICCALENDAR_ALERT_CAL_DATE_MISSING_DESC"
				/>

				<!--field
					name="displayDatesTimezone"
					type="list"
					label="ICAGENDA_LBL_DATES_TIMEZONE_BETA"
					description="ICAGENDA_DESC_DATES_TIMEZONE_BETA"
					default="0"
					class="btn-group">
						<option value="0">JHIDE</option>
						<option value="1">JSHOW</option>
				</field-->

				<!--field type="title" label="ICAGENDA_DESC_TODAY_TIMEZONE_TEMPORARY" class="alert alert-info input-xxlarge" /-->

			</fieldset>



			<fieldset name="ADVANCED" label="MOD_ICCALENDAR_LBL_ADVANCED">
                <field
                	name="moduleclass_sfx"
                	type="text"
                	label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
                	description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
                	icon="text_signature.png"
                />

				<field type="Title" label=" " class="stylenote"/>
				<field
					name="cache"
					type="list"
					default="0"
					label="COM_MODULES_FIELD_CACHING_LABEL"
					description="COM_MODULES_FIELD_CACHING_DESC" >
            			<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
            	</field>

				<field type="title" label="MOD_ICCALENDAR_CACHE_NOTE" class="stylered alert alert-error input-xxlarge" />


<!--field
					name="cache_time"
					type="text"
					default="900"
					label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
					description="COM_MODULES_FIELD_CACHE_TIME_DESC"
					icon="hourglass.png"
					suffix="min"
				/-->

				<field
					name="cachemode"
					type="hidden"
					default="itemid" >
						<option	value="itemid"></option>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
mod_iccalendar.php000060400000034610152455611460010212 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda - mod_iccalendar
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C) - doorknob
 * @link        http://www.joomlic.com
 *
 * @version		3.5.11 2015-09-04
 * @since       1.0
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *------------------------------------------------------------------------------
*/

/**
 *	iCagenda - iC calendar
 */


// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

// Get iCagenda component parameters
$com_params = JComponentHelper::getParams('com_icagenda');

// For Dev.
$time_loading = $com_params->get('time_loading', '');

if ($time_loading)
{
	$starttime_cal = iCLibrary::getMicrotime();
}

jimport('joomla.application.component.helper');

// Get Application
$app = JFactory::getApplication();

// Check Errors: iC Library & iCagenda Utilities
$UTILITIES_DIR = is_dir(JPATH_ADMINISTRATOR . '/components/com_icagenda/utilities');

if ( (!$UTILITIES_DIR)
	|| (!class_exists('iCLibrary')) )
{
	$alert_message = JText::_('ICAGENDA_CAN_NOT_LOAD').'<br />';
	$alert_message.= '<ul>';
	if (!class_exists('iCLibrary')) $alert_message.= '<li>' . JText::_('IC_LIBRARY_NOT_LOADED') . '</li>';
	if (!$UTILITIES_DIR) $alert_message.= '<li>' . JText::_('ICAGENDA_A_FOLDER_IS_MISSING') . '</li>';
	$alert_message.= '</ul>';
	if (!$UTILITIES_DIR) $alert_message.= JText::_('ICAGENDA_IS_NOT_CORRECTLY_INSTALLED') . ' ';
	if (!$UTILITIES_DIR) $alert_message.= JText::_('ICAGENDA_INSTALL_AGAIN') . '<br />';
	if (!$UTILITIES_DIR) $alert_message.= JText::_('IC_ALTERNATIVELY') . ':<br /><ul>';
	if ($UTILITIES_DIR) $alert_message.= JText::_('IC_PLEASE') . ', ';
	if (!class_exists('iCLibrary'))
	{
		if (!$UTILITIES_DIR) $alert_message.= '<li>';
		$alert_message.= JText::_('IC_LIBRARY_CHECK_PLUGIN_AND_LIBRARY');
		if (!$UTILITIES_DIR) $alert_message.= '</li>';
	}
	if (!$UTILITIES_DIR)
	{
		$alert_message.= '<li>' . JText::Sprintf('ICAGENDA_UTILITIES_FIX_MANUAL'
						, '<strong>admin/utilities</strong>'
						, '<strong>administrator/components/com_icagenda/</strong>');
		$alert_message.= '</li></ul>';
	}

	// Get the message queue
	$messages = $app->getMessageQueue();

	$display_alert_message = false;

	// If we have messages
	if (is_array($messages) && count($messages))
	{
		// Check each message for the one we want
		foreach ($messages as $key => $value)
		{
			if ($value['message'] == $alert_message)
			{
				$display_alert_message = true;
			}
		}
	}

	if (!$display_alert_message)
	{
		$app->enqueueMessage($alert_message, 'error');
	}

	echo JText::_('IC_MODULE_CAN_NOT_BE_LOADED') . '<br />';
	echo JText::_('IC_MODULE_CHECK_ALERT_MESSAGE');

	return false;
}

// Load iCagenda Utilities
JLoader::registerPrefix('icagenda', JPATH_ADMINISTRATOR . '/components/com_icagenda/utilities');

jimport( 'joomla.environment.request' );

// Get Document
$document	= JFactory::getDocument();

// Test if translation is missing, set to en-GB by default
$language = JFactory::getLanguage();
$language->load( 'mod_iccalendar', JPATH_SITE, 'en-GB', true );
$language->load( 'mod_iccalendar', JPATH_SITE, null, true );

// Include the class of the syndicate functions only once
if ( ! class_exists('modiCcalendarHelper')) require_once(dirname(__FILE__) . '/helper.php');

// Module ID
$modid		= $module->id;

// Params of the Module iC Calendar
$moduleclass_sfx	= htmlspecialchars($params->get('moduleclass_sfx'));
$mouseover			= $params->get('mouseover', 'click');
$mouseout			= $params->get('mouseout', 1);
$columns_bg_color	= array(
						$params->get('sun', ' '),
						$params->get('mon', ' '),
						$params->get('tue', ' '),
						$params->get('wed', ' '),
						$params->get('thu', ' '),
						$params->get('fri', ' '),
						$params->get('sat', ' '),
					);
$firstday			= $params->get('firstday', '1');
$calfontcolor		= $params->get('calfontcolor', ' ');
$OneEventbgcolor	= $params->get('OneEventbgcolor', ' ');
$Eventsbgcolor		= $params->get('Eventsbgcolor', ' ');
$bgcolor			= $params->get('bgcolor', ' ');
$bgimage			= $params->get('bgimage');
$bgimagerepeat		= $params->get('bgimagerepeat');
$closebutton		= $params->get('calendarclosebtn', 1);
$closebutton_custom	= $params->get('calendarclosebtn_Content', 'X');
$theme_calendar		= $params->get('template', 'default');
$firstMonth			= $params->get('firstMonth', null);

$setTodayTimezone	= $params->get('setTodayTimezone', '');

// Ordering set by default (time/category) - Option in developpement (Not used)
$events_ordering_first	= $params->get('events_ordering_first', '1_ASC');
$events_ordering_second	= $params->get('events_ordering_second', '2_ASC');
$ictip_ordering			= $events_ordering_first.'-'.$events_ordering_second;

$header_text			= $params->get('header_text', '');
$padding				= $params->get('padding', '0');

// Module
$cal		= new modiCcalendarHelper;
$data		= $cal->getStamp($params);
$url_date	= JRequest::getVar('date');
$iccaldate	= JRequest::getVar('iccaldate');

// First day of the current month
$this_month	= $firstMonth
//			? date("Y-m-d", strtotime("+1 month", strtotime($firstMonth)))
			? date("Y-m-01", strtotime($firstMonth))
			: JHtml::date('now', 'Y-m-01', null);

if ( isset($iccaldate)
	&& !empty($iccaldate) )
{
	// This should be the first day of a month
	$date_start = date('Y-m-01', strtotime($iccaldate));
}
else
{
	$date_start	= $this_month;
}

$nav = $cal->getNav($date_start, $modid);


// Search template of iC Calendar from the selected Theme Pack
$themes_path = '/components/com_icagenda/themes/packs/';

if ( ! file_exists(JPATH_BASE . $themes_path . $theme_calendar . '/' . $theme_calendar . '_calendar.php'))
{
	$theme_calendar = 'default';
}

$theme_tmpl	= JPATH_BASE . $themes_path . $theme_calendar . '/' . $theme_calendar;
$theme_css	= $themes_path . $theme_calendar . '/css/' . $theme_calendar;

$t_calendar		= $theme_tmpl . '_calendar.php';
$css_module		= $theme_css . '_module.css';
$css_mod_rtl	= $theme_css . '_module-rtl.css';

// ToolTip 2 in developpement (Not used)
$tip_type = '1';

if ($tip_type == 1)
{
	$t_day = $theme_tmpl . '_day.php';
}
elseif ($tip_type == 2)
{
	$t_day = $theme_tmpl . '_calendar_tip.php';
}

// Add the media specific CSS to the document
JLoader::register('iCagendaMediaCss', JPATH_ROOT . '/components/com_icagenda/helpers/media_css.class.php');

iCagendaMediaCss::addMediaCss($theme_calendar, 'module');

// Load Vector iCicons Font (navigation arrows)
JHtml::stylesheet( 'media/com_icagenda/icicons/style.css' );

// Theme pack component css
$document->addStyleSheet( JURI::base( true ) . $css_module );

// RTL css if site language is RTL
$lang = JFactory::getLanguage();

if ( $lang->isRTL()
	&& file_exists( JPATH_SITE . $css_mod_rtl) )
{
	$document->addStyleSheet( JURI::base( true ) . $css_mod_rtl );
}

if (version_compare(JVERSION, '3.0', 'ge'))
{
	// Request Joomla to load jQuery in no conflict mode
	JHtml::_('bootstrap.framework');
	JHtml::_('jquery.framework');
}
else
{
	//Load JS
	JHtml::_('behavior.mootools');

	$header = $document->getHeadData();
	$loadJquery = true;

	switch($params->get('loadJquery',"auto"))
	{
		case "0":
			$loadJquery = false;
			break;
		case "1":
			$loadJquery = true;
			break;
		case "auto":
			foreach ($header['scripts'] as $scriptName => $scriptData)
			{
				if (substr_count($scriptName,'jquery'))
				{
					$loadJquery = false;
					break;
				}
			}
			break;
	}

	//Add js
	$app = JFactory::getApplication();

	if ($loadJquery && !$app->get('jquery'))
	{
		$document->addScript( 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' );
		$app->set('jquery', true);
	}

	$document->addScript( 'modules/mod_iccalendar/js/jquery.noconflict.js' );
}

if (ini_get('allow_url_fopen'))
{
	$file = file_get_contents($t_day);

	if ( ! strpos($file, "data-cal-date"))
	{
		$server_date = false;
		echo "<div class='alert alert-error'>'data-cal-date' not found in your Custom Theme Pack!</div>";
	}
	else
	{
		$server_date = true;
	}
}
else
{
	$server_date = true;
}

if ( ! $setTodayTimezone && $server_date)
{
	$document->addScript( 'modules/mod_iccalendar/js/jQuery.highlightToday.min.js' );
}


$icclasstip		= '.icevent a';
$icclass		= '.iccalendar';
$icagendabtn	= '.icagendabtn_' . $modid;
$mod_iccalendar	= '#mod_iccalendar_' . $modid;

$close_btn		= ($closebutton == 1) ? $closebutton_custom : JText::_('MOD_ICCALENDAR_CLOSE');

// Minimum popup width for mobile phone mode
$mobile_min_width = 320;

$stamp = new cal($data, $t_calendar, $t_day, $nav, $firstday, $columns_bg_color, $calfontcolor,
		$OneEventbgcolor, $Eventsbgcolor, $bgcolor, $bgimage, $bgimagerepeat,
		$moduleclass_sfx, $modid, $theme_calendar, $ictip_ordering, $header_text);

// Load Calendar Template
require $t_calendar;
?>

<script type="text/javascript">
(function($){
	var icmouse = '<?php echo $mouseover; ?>';
	var mouseout = '<?php echo $mouseout; ?>';
	var icclasstip = '<?php echo $icclasstip; ?>';
	var icclass = '<?php echo $icclass; ?>';
	var position = '<?php echo $params->get('position', 'center'); ?>';
	var posmiddle = '<?php echo $params->get('posmiddle', 'top'); ?>';
	var modid = '<?php echo $modid; ?>';
	var modidid = '<?php echo '#'.$modid; ?>';
	var icagendabtn = '<?php echo $icagendabtn; ?>';
	var mod_iccalendar = '<?php echo $mod_iccalendar; ?>';
	var template = '<?php echo '.'.$theme_calendar; ?>';
	var loading = '<?php echo JText::_('MOD_ICCALENDAR_LOADING'); ?>';
	var closetxt = '<?php echo $close_btn; ?>';
	var tip_type = '<?php echo $tip_type; ?>';
	var tipwidth = <?php echo (int)$params->get('tipwidth', 390) ?>;
	var smallwidththreshold = <?php echo (int) $com_params->get('smallwidththreshold', 0) ?>;
	var verticaloffset = <?php echo (int)$params->get('verticaloffset', 0) ?>;
	var css_position = '';
	var mobile_min_width = <?php echo $mobile_min_width; ?>;
	var extra_css = '';

	$(document).on('click touchend', icagendabtn, function(e){<?php // Refresh the current month ?>
		e.preventDefault();

		url=$(this).attr('href');

		$(modidid).html('<div class="icloading_box"><div style="text-align:center;">' + loading + '<\/div><div class="icloading_img"><\/div><\/div>').load(url + ' ' + mod_iccalendar, function(){$('<?php echo $mod_iccalendar ?>').highlightToday();});

	});

	if (tip_type=='2') {<?php // Not used ?>
	$(document).on(icmouse, this, function(e){
		e.preventDefault();

		$(".iCaTip").tipTip({maxWidth: "400", defaultPosition: "top", edgeOffset: 1, activation:"hover", keepAlive: true});
	});
	}

	if (tip_type=='1') {<?php // Display the events popup ?>
		$view_width=$(window).width();<?php // Get the viewport width ?>
		if($view_width<smallwidththreshold){<?php // Mobile phones do not support 'hover' or 'click' in the conventional way ?>
			icmouse='click touchend';
		}

		$(document).on(icmouse, modidid+' '+icclasstip, function(e){
			$view_height=$(window).height();<?php // Get the viewport height ?>
			$view_width=$(window).width();<?php // Get the viewport width ?>
			e.preventDefault();
			$('#ictip').remove();
			$parent=$(this).parent();
			$tip=$($parent).children(modidid+' .spanEv').html();


			if ($view_width < smallwidththreshold)
			{
				<?php // Mobile phone style - fill the viewport ?>
				css_position = 'fixed';
				$width_px = Math.max(mobile_min_width,$view_width); <?php // Popup width is screen width (minimum 320px) ?>
				$width = '100%';
				$pos = '0px';
				$top = '0px';
				extra_css='border:0;border-radius:0;height:100%;box-shadow:none;margin:0px;padding:10px;min-width:'+mobile_min_width+'px;overflow-y:scroll;padding:<?php echo $padding ?>;';<?php // iPhone friendly size and allow scrolling if the page overflows ?>
			}
			else
			{
				css_position = 'absolute';
				$width_px = Math.min($view_width, tipwidth);
				$width = $width_px+'px';

				<?php // Horizontal positioning ?>
				switch(position) {
					case 'left':
						$pos=Math.max(0,$(modidid).offset().left-$width_px-10)+'px';
						break;
					case 'right':
						$pos=Math.max(0,Math.min($view_width-$width_px,$(modidid).offset().left+$(modidid).width()+10))+'px';
						break;
					default:<?php //Centre ?>
						$pos=Math.ceil(($view_width-$width_px)/2)+'px';
						break;
				}

				<?php // Vertical positioning ?>
				if (posmiddle === 'top')
				{
					$top = Math.max(0,$(modidid).offset().top-verticaloffset)+'px';<?php // Top ?>
				}
				else
				{
					$top = Math.max(0,$(modidid).offset().top+$(modidid).height()-verticaloffset)+'px';<?php // Bottom ?>
				}
			}


			$('body').append('<div style="display:block; position:'+css_position+'; width:'+$width+'; left:'+$pos+'; top:'+$top+';'+extra_css+'" id="ictip"> '+$(this).parent().children('.date').html()+'<a class="close" style="cursor: pointer;"><div style="display:block; width:auto; height:50px; text-align:right;">' + closetxt + '<\/div></a><span class="clr"></span>'+$tip+'<\/div>');

			$(document).on('click touchend', '.close', function(e){
				e.preventDefault();
				$('#ictip').remove();
			});

			if (mouseout == '1')
			{
				$('#ictip')
					.mouseout(function() {
//						$( "div:first", this ).text( "mouse out" );
						$('#ictip').stop(true).fadeOut(300);
					})
					.mouseover(function() {
//						$( "div:first", this ).text( "mouse over" );
						$('#ictip').stop(true).fadeIn(300);
					});
			}
		});
	}

}) (jQuery);
</script>
<?php
if ( ! $setTodayTimezone && $server_date
	&& $lang->getTag() != 'fa-IR')
{
	$document->addScriptDeclaration('
		jQuery(document).ready(function(){
			jQuery("' . $mod_iccalendar . '").highlightToday("show_today");
		});
	');
}

// For Dev.
if ($time_loading)
{
	$endtime_cal = iCLibrary::getMicrotime();

	echo '<center style="font-size:8px;">Time to create calendar: ' . round($endtime_cal - $starttime_cal, 3) . ' seconds</center>';
}