| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /AppServ/www/news/modules/mod_eventlistcalqajax/ |
Upload File : |
<?php
/**
* Helper class for mod_eventlistcalq module
*
* @package Qivva Eventlist Calendar Ajax Module for Joomla 1.5.x
* @subpackage Modules
* @link http://extensions.qivva.com
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @copyright (C) 2008,2009,2010 Toni Smillie www.qivva.com
* Eventlist Calendar Q by Toni Smillie www.qivva.com
*
* Version 1.00
* First Ajax version based on 0.94 eventlistcal15q
* Thanks to Bart Eversdijk for the Ajax conversion and Piotr Konieczny for assistance in porting of changes
* Original Eventlist calendar from Christoph Lukes www.schlu.net
* PHP Calendar (version 2.3), written by Keith Devens
* http://keithdevens.com/software/php_calendar
* see example at http://keithdevens.com/weblog
* License: http://keithdevens.com/software/license
*/
class modeventlistcalqajaxhelper
{
function getdays ($greq_year, $greq_month, &$params)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$catid = trim( $params->get('catid') );
$venid = trim( $params->get('venid') );
$StraightToDetails = $params->get( 'StraightToDetails', '1' );
$DisplayCat = $params->get( 'DisplayCat', '0' );
$DisplayVenue = $params->get( 'DisplayVenue', '0' );
$ArchivedEvents = $params->get( 'ArchivedEvents', '0' );
$CurrentEvents = $params->get( 'CurrentEvents', '1' );
$FixItemID = $params->get( 'FixItemID', '0' );
//Get eventdates
if ($catid)
{
$ids = explode( ',', $catid );
JArrayHelper::toInteger( $ids );
$categories = ' AND (c.id=' . implode( ' OR c.id=', $ids ) . ')';
}
if ($venid)
{
$ids = explode( ',', $venid );
JArrayHelper::toInteger( $ids );
$venues = ' AND (l.id=' . implode( ' OR l.id=', $ids ) . ')';
}
if ($CurrentEvents==1)
{
$wherestr = ' WHERE a.published = 1';
}
else
{
$wherestr = ' WHERE a.published = 0';
}
if ($ArchivedEvents==1)
{
$wherestr = $wherestr. ' OR a.published = -1';
}
$query = 'SELECT a.*, l.venue, DAYOFMONTH(a.dates) AS created_day, YEAR(a.dates) AS created_year, MONTH(a.dates) AS created_month,c.id AS mcatid,c.catname,l.id AS mlocid,l.venue,'
.' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug'
. ' FROM #__eventlist_events AS a'
.' INNER JOIN #__eventlist_cats_event_relations AS rel ON rel.itemid = a.id'
.' INNER JOIN #__eventlist_categories AS c ON c.id = rel.catid'
. ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid'
. $wherestr
. ' AND c.access <= '.(int)$user->aid
.($catid ? $categories : '')
.($venid ? $venues : '')
;
$db->setQuery( $query );
$events = $db->loadObjectList();
$days = array();
foreach ( $events as $event )
{
// Cope with no end date set i.e. set it to same as start date
if (($event->enddates == '0000-00-00') or (is_null($event->enddates)))
{
$eyear = $event->created_year;
$emonth = $event->created_month;
$eday = $event->created_day;
}
else
{
list($eyear, $emonth, $eday) = explode('-', $event->enddates);
}
// The two cases for roll over the year end with an event that goes across the year boundary.
if ($greq_year < $eyear)
{
$emonth = $emonth + 12;
}
if ($event->created_year < $greq_year)
{
$event->created_month = $event->created_month - 12;
}
if ( ($greq_year >= $event->created_year) && ($greq_year <= $eyear)
&& ($greq_month >= $event->created_month) && ($greq_month <= $emonth) )
{
// Set end day for current month
if ($emonth > $greq_month)
{
$emonth = $greq_month;
// $eday = cal_days_in_month(CAL_GREGORIAN, $greq_month,$greq_year);
$eday = date('t', mktime(0,0,0, $greq_month, 1, $greq_year));
}
// Set start day for current month
if ($event->created_month < $greq_month)
{
$event->created_month = $greq_month;
$event->created_day = 1;
}
$stod = 1;
for ($count = $event->created_day; $count <= $eday; $count++)
{
$uxdate = mktime(0,0,0,$greq_month,$count,$greq_year);
$tdate = strftime('%Y%m%d',$uxdate);// Toni change Joomla 1.5
$created_day = $count;
// $tt = $days[$count][1];
// if (strlen($tt) == 0)
if (empty($days[$count][1]))
{
$title = htmlspecialchars($event->title);
if ($DisplayCat ==1)
{
$title = $title . ' (' . htmlspecialchars($event->catname) . ')';
}
if ($DisplayVenue == 1)
{
if (isset($event->venue))
{
$title = $title . ' @' . htmlspecialchars($event->venue);
}
}
$stodid = $event->id;
$stod = 1;
}
else
{
$tt = $days[$count][1];
$title = $tt . '+%+%+' . htmlspecialchars($event->title);
if ($DisplayCat ==1)
{
$title = $title . ' (' . htmlspecialchars($event->catname) . ')';
}
if ($DisplayVenue == 1)
{
if (isset($event->venue))
{
$title = $title . ' @' . htmlspecialchars($event->venue);
}
}
$stod = 0;
}
if (($StraightToDetails == 1) and ($stod==1))
{
if ($FixItemID == 0)
{
$link = JRoute::_( EventListHelperRoute::getRoute($event->slug) );
}
else
{
//Create the link - copied from Jroute
$evlink = 'index.php?option=com_eventlist&view=details&id='. $event->slug.'&Itemid='.$FixItemID;
$link = JRoute::_( $evlink );
}
}
else
{
if ($FixItemID == 0)
{
$link = EventListHelperRoute::getRoute( $tdate, 'day') ;
}
else
{
//Create the link - copied from Jroute
$evlink = 'index.php?option=com_eventlist&view=day&id='. $tdate.'&Itemid='.$FixItemID;
$link = JRoute::_( $evlink );
}
}
$days[$count] = array($link,$title);
}
}
// End of Toni modification
}
return $days;
} //End of function getdays
} //End class
?>