| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/mod_ic_event_list.php.tar |
home/wuectly/www/modules/mod_ic_event_list/mod_ic_event_list.php 0000604 00000042712 15245572020 0021355 0 ustar 00 <?php
/**
* iCagenda Event List
*----------------------------------------------------------------------------
* @package mod_ic_event_list
* @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)
* @link http://www.joomlic.com
*
* @update iCagenda 3.5.12
* @version 3.9.0 2015-10-06
* @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/>.
*----------------------------------------------------------------------------
*/
// no direct access
defined('_JEXEC') or die();
// 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();
}
// Global Joomla API objects
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$lang = JFactory::getLanguage();
$menu = $app->getMenu();
$isSef = $app->getCfg( 'sef' );
$date_var = ($isSef == 1) ? '?date=' :'&date=';
// 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');
// Test if translation is missing, set to en-GB by default
$language= JFactory::getLanguage();
$language->load( 'mod_ic_event_list', JPATH_SITE, 'en-GB', true );
$language->load( 'mod_ic_event_list', JPATH_SITE, null, true );
// Static call to the framework module processor which will
// Include the layout file (procedural, not a class)
jimport( 'joomla.application.module.helper' );
// Include the class of the syndicate functions only once
require_once(dirname(__FILE__) . '/helper.php');
// Load iCtip css
JHtml::stylesheet( 'com_icagenda/tipTip.css', false, true );
// Get Component Global Options
$iCparams = JComponentHelper::getParams('com_icagenda');
// Check valid NEXT DATE
icagendaEventsData::getNext();
// Load jQuery Files
if (version_compare(JVERSION, '3.0', 'lt'))
{
JHtml::_('behavior.mootools');
// load jQuery, if not loaded before (NEW VERSION IN 1.2.6)
$scripts = array_keys($document->_scripts);
$scriptFound = false;
$count_scripts = count($scripts);
for ($i = 0; $i < $count_scripts; $i++)
{
if (stripos($scripts[$i], 'jquery.min.js') !== false)
{
$scriptFound = true;
}
// load jQuery, if not loaded before as jquery - added in 1.2.7
if (stripos($scripts[$i], 'jquery.js') !== false)
{
$scriptFound = true;
}
}
// jQuery Library Loader
if (!$scriptFound)
{
// load jQuery, if not loaded before
if (!JFactory::getApplication()->get('jquery'))
{
JFactory::getApplication()->set('jquery', true);
// add jQuery
$document->addScript('https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
$document->addScript('components/com_icagenda/js/jquery.noconflict.js');
}
}
}
else
{
JHtml::_('bootstrap.framework');
JHtml::_('jquery.framework');
}
// Loading Script tipTip used for iCtips
JHtml::script( 'com_icagenda/jquery.tipTip.js', false, true );
$iCtip = array();
$iCtip[] = ' jQuery(document).ready(function(){';
$iCtip[] = ' jQuery(".iCtip").tipTip({maxWidth: "200", defaultPosition: "top", edgeOffset: 1});';
$iCtip[] = ' });';
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $iCtip));
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
// START MODULE DISPLAY
?>
<!--
* iCagenda PRO Event List Module by Jooml!C
*
* @copyright Copyright (c)2012-2015 JOOMLIC - All rights reserved.
* @version 3.4
*
-->
<?php
echo '<div class="ic_eventlist' . $moduleclass_sfx . '">';
// 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;
$x = '';
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_IC_EVENT_LIST_MENULINK_UNPUBLISHED_MESSAGE' ).'</div>';
} while ($x > 0);
}
else
{
// Static call to the class
$list = modiCEventListHelper::getList($params);
// Get Module Params
$limitcount = $params->get('count', 5);
$monthFormat = $params->get('monthFormat', 2);
$iCmenuitem = $params->get('iCmenuitem');
$dp_venue = $params->get('dp_venue', '');
$dp_city = $params->get('dp_city', '');
$dp_shortDesc = $params->get('dp_shortDesc', '');
$dp_dateTime = $params->get('dp_dateTime', '');
$dp_regInfos = $params->get('dp_regInfos', '');
$filtering_shortDesc = $params->get('filtering_shortDesc', '');
$paramlimit = $params->get('paramlimit', '');
$paramlimit_Content = $params->get('paramlimit_Content');
$column = $params->get('column', 'col1');
$header_text = $params->get('header_text', '');
$footer_text = $params->get('footer_text', '');
//$cropped_thumb=$params->get('cropped_thumb');
// Feature Icons Options
$FEATURES_ICONSIZE = $params->get('features_icon_size');
$SHOW_ICON_TITLE = $params->get('show_icon_title');
// Get media path
$params_media = JComponentHelper::getParams('com_media');
$image_path = $params_media->get('image_path', 'images');
$layout = $params->get('layout');
// $time = $params->get('time', 1);
$time = $params->get('filter_by_date', 1);
$datetime_today = JHtml::date('now', 'Y-m-d H:i');
$date_today = JHtml::date('now', 'Y-m-d');
// Load List
$i = '';
$nb = 0;
// Get Time Format setting
$timeformat = $iCparams->get('timeformat');
// Check if GD is enabled
if (extension_loaded('gd') && function_exists('gd_info'))
{
$thumb_generator = $iCparams->get('thumb_generator', 1);
}
else
{
$thumb_generator = 0;
//JError::raiseWarning('101', JText::_('COM_ICAGENDA_PHP_ERROR_GD'));
}
// Get limit Short Description Global Option
$limitShortDesc = $iCparams->get('ShortDescLimit');
// Get XSmall thumbnail Settings - Component Options
$thumb_xsmall = $iCparams->get('thumb_xsmall', array("48","48","80","1"));
$thumb_xsmall_width = is_numeric($thumb_xsmall[0]) ? $thumb_xsmall[0]. 'px' : '';
$thumb_xsmall_height = is_numeric($thumb_xsmall[1]) ? $thumb_xsmall[0]. 'px' : '';
// Check if fopen is allowed
$fopen = true;
$result = ini_get('allow_url_fopen');
if (empty($result))
{
//JError::raiseWarning('101', JText::_('COM_ICAGENDA_PHP_ERROR_FOPEN'));
$fopen = false;
}
if ($header_text)
{
echo '<div class="ic-header-text">' . $header_text . '</div>';
}
$displayed_items = 0;
echo '<div class="ic-section ic-group">';
if ($list)
{
foreach ($list as $item) :
if (empty($item->approval))
{
$evtParams = '';
$evtParams = new JRegistry($item->params);
$catid = $item->catid;
$cat_color = $item->catcolor;
$font_color = modiCEventListHelper::getfontColor($cat_color);
$imageSet = $item->image;
$thumb_img = modiCEventListHelper::getThumbnail($imageSet, $thumb_generator);
$eventID = $item->id;
$nextDate = $item->next;
$eventTimeZone = null;
$eventTitle = $item->title;
$eventCity = $item->city;
$eventVenue = $dp_venue ? $item->place : false;
if ($timeformat == 1)
{
$lang_time = strftime("%H:%M", strtotime("$item->next"));
}
else
{
$lang_time = strftime("%I:%M %p", strtotime("$item->next"));
}
$nextTime = JText::_($lang_time);
$displayTime = $item->displaytime;
if (empty($dp_city) OR $dp_city == 0)
{
$display_city = false;
}
else
{
$display_city = true;
}
// Intro Text
$description = $item->desc;
$limit = $paramlimit ? $paramlimit_Content : false;
$shortDesc = icagendaEvents::shortDescription($description, true, $filtering_shortDesc, $limit);
$display_shortDesc = true;
if ($dp_shortDesc == '1') // Short Description
{
$display_shortDesc = true;
$shortDesc = $item->shortdesc ? $item->shortdesc : false;
}
elseif ($dp_shortDesc == '2') // Auto-Introtext
{
$display_shortDesc = true;
$shortDesc = $shortDesc ? $shortDesc : false;
}
elseif ($dp_shortDesc == '0') // Hide
{
$display_shortDesc = false;
$shortDesc = false;
}
else // 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)
{
$short_description = $item->shortdesc ? $item->shortdesc : $shortDesc;
$shortDesc = $short_description ? $short_description : $item->metadesc;
}
$ic_datetime = $ic_date = $ic_time = false;
if ($dp_dateTime == 1)
{
$ic_datetime = true;
}
elseif ($dp_dateTime == 2)
{
$ic_date = true;
}
elseif ($dp_dateTime == 3 && $displayTime == 1)
{
$ic_time = true;
}
if (empty($dp_regInfos))
{
$registered = false;
$maxTickets = false;
$TicketsLeft = false;
}
else
{
$registered = $item->registered;
$get_maxTickets = $evtParams->get('maxReg');
if ($get_maxTickets < 1)
{
$maxTickets = false;
$TicketsLeft = false;
}
else
{
$maxTickets = $evtParams->get('maxReg');
$TicketsLeft = ($get_maxTickets - $registered);
}
}
/**
* Feature Icons
*/
$featureIcons = icagendaEvents::featureIcons($eventID);
$FEATURES_ICONROOT = JURI::base() . "$image_path/icagenda/feature_icons/$FEATURES_ICONSIZE/";
$FEATURES_ICONS = array();
if ( isset($featureIcons)
&& is_array($featureIcons)
&& (!empty($FEATURES_ICONSIZE)) )
{
foreach ($featureIcons as $feature)
{
$FEATURES_ICONS[] = array('icon' => $feature->icon, 'icon_alt' => $feature->icon_alt);
}
}
if (is_numeric($iCmenuitem))
{
$linkid = $iCmenuitem;
}
else
{
$linkid = icagendaMenus::thisEventItemid($item->next, $item->catid, $iC_list_menus);
}
// if (count($menu_IDs))
if ($linkid)
{
$displayed_items = $displayed_items + 1;
// $linkid = $menu_IDs[0];
// $period_array = $item->period ? unserialize($item->period) : array();
$period_array = iCDatePeriod::listDates($item->startdate, $item->enddate, $eventTimeZone);
$only_startdate = ($item->weekdays || $item->weekdays == '0') ? false : true;
$next_date_control = JHtml::date($item->next, 'Y-m-d H:i', $eventTimeZone);
if ($only_startdate
&& in_array($next_date_control, $period_array)
&& strtotime($item->startdate) < strtotime($datetime_today)
&& strtotime($item->enddate) >= strtotime($datetime_today)
)
{
$nextDay = JHtml::date($datetime_today, 'd', $eventTimeZone);
$eventDate = JHtml::date($datetime_today , JText::_('DATE_FORMAT_LC3'), $eventTimeZone);
$this_date = JHtml::date($datetime_today , 'Y-m-d', $eventTimeZone);
$this_time = JHtml::date($item->next, 'H:i', $eventTimeZone);
}
elseif ($params->get('filter_by_date', '1') == '4'
&& (JHtml::date($item->next , 'Y-m-d', $eventTimeZone) != JHtml::date('now' , 'Y-m-d'))
)
{
$nextDay = JHtml::date($datetime_today, 'd', $eventTimeZone);
$eventDate = JHtml::date($datetime_today , JText::_('DATE_FORMAT_LC3'), $eventTimeZone);
$this_date = JHtml::date($datetime_today , 'Y-m-d', $eventTimeZone);
$this_time = JHtml::date($item->next, 'H:i', $eventTimeZone);
}
else
{
$nextDay = JHtml::date($item->next, 'd', $eventTimeZone);
$eventDate = JHtml::date($item->next , JText::_('DATE_FORMAT_LC3'), $eventTimeZone);
$this_date = JHtml::date($item->next , 'Y-m-d', $eventTimeZone);
$this_time = JHtml::date($item->next, 'H:i', $eventTimeZone);
}
if ($monthFormat == 1)
{
// $nextMonth = JHtml::date($item->next, 'm', $eventTimeZone);
$nextMonth = date('m', strtotime($this_date));
}
elseif ($monthFormat == 2)
{
// We need month in english to set the translation string.
// To be changed to get month numeric and using an array of months in english, to remove the use of strtotime.
// $nextMonth = JText::_(date("F", strtotime($item->next)) . '_SHORT');
$nextMonth = JText::_(date("F", strtotime($this_date)) . '_SHORT');
}
$event_slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$this_next = iCDate::dateToAlias($this_date . ' ' . $this_time);
if ($only_startdate && in_array($next_date_control, $period_array))
{
$set_date_in_url = '';
}
else
{
$set_date_in_url = $date_var . $this_next;
}
if (is_numeric($linkid))
{
$urlEvent = JRoute::_( 'index.php?option=com_icagenda&view=list&layout=event&id='
. $event_slug . '&Itemid=' . (int) $linkid) . $set_date_in_url;
}
else
{
// When new list view, should check default home itemid as $linkid
$urlEvent = JRoute::_( 'index.php?option=com_icagenda&view=list&layout=event&id='
. $event_slug . '&Itemid=' . (int) $linkid) . $set_date_in_url;
}
$link_one = $link_multi = '';
// Style of layout
$style = str_replace('_:', '', $layout);
if (file_exists(__DIR__ . '/css/' . $style . '_style.css'))
{
$module_style = 'modules/mod_ic_event_list/css/' . $style . '_style.css';
$module_style_rss = 'modules/mod_ic_event_list/css/' . $style . '_style-rtl.css';
$document->addStyleSheet( JURI::base() . $module_style );
// RTL css if site language is RTL
if ($lang->isRTL()
&& file_exists(__DIR__ . '/css/' . $style . '_style-rtl.css'))
{
$document->addStyleSheet(JURI::base() . $module_style_rss);
}
}
require (JModuleHelper::getLayoutPath('mod_ic_event_list', $layout));
}
}
endforeach;
}
else
{
if ($time == '3') { $ordertext = 'today'; }
elseif ($time == '2') { $ordertext = 'future'; }
elseif ($time == '1') { $ordertext = 'future'; }
elseif ($time == '0') { $ordertext = 'past'; }
elseif (($time == '') || ($time == NULL) || ($time == '4')) { $ordertext = 'all'; }
echo '<div class="ic-msg-no-event">' . JText::_('MOD_IC_EVENT_LIST_' . strtoupper($ordertext) . '_NO_EVENT_TEXT') . '</div>';
}
$total_items = count($list);
if ($displayed_items == '0'
&& $total_items > 0)
{
echo '<div class="ic-msg-no-event">' . JText::_('MOD_IC_EVENT_LIST_ALL_NO_EVENT_TEXT') . '</div>';
}
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>';
}
}
echo '</div>';
if ($footer_text)
{
echo '<div class="ic-footer-text">' . $footer_text . '</div>';
}
}
echo '</div>';
echo '<div style="clear:both"></div>';
// For Dev.
if ($time_loading)
{
$endtime_cal = iCLibrary::getMicrotime();
echo '<center style="font-size:8px;">Time to create list: ' . round($endtime_cal - $starttime_cal, 3) . ' seconds</center>';
}