<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2016 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.6.0 2016-08-09
 * @since       3.6.0
 *------------------------------------------------------------------------------
*/

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

$app        = JFactory::getApplication();
$isSef      = $app->getCfg('sef');
$item       = $this->item;
$iCicons    = new iCicons();

$uri        = JUri::getInstance()->toString();
$date_value = $app->input->get('date', '');
$evt_id     = $app->input->get('id', 0);
$event_link = JRoute::_('index.php?option=com_icagenda&view=event&id=' . $evt_id);

if ($date_value)
{
	$ex         = explode('-', $date_value);
	$dateday    = (count($ex) == 5) ? $ex['0'] . '-' . $ex['1'] . '-' . $ex['2'] . ' ' . $ex['3'] . ':' . $ex['4'] . ':00' : '';

	$session    = JFactory::getSession();
	$session->set('session_date', $dateday);
}

$print_url  = ($isSef == 1) ? $event_link . '?tmpl=component' : $event_link . '&tmpl=component';
$ical_url   = ($isSef == 1) ? $uri . '?vcal=1' : $uri . '&vcal=1';
$ical_url   = preg_replace('/\?date=[^\?]*/', '', $ical_url);
$ical_url   = preg_replace('/&date=[^&]*/', '', $ical_url);
?>

