Example #1
0
 public static function getAvailableSources($sourcedir)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $paths = self::getFrontsideTemplates();
     $paths[] = $sourcedir;
     foreach ($paths as $path) {
         RokMiniEvents3::addSourcesPath($path);
     }
     $results = array();
     foreach ($paths as $source_path) {
         if (JFolder::exists($source_path)) {
             $source_files = JFolder::files($source_path);
             foreach ($source_files as $entry) {
                 $source_name = basename($entry, ".php");
                 $path = $source_path . '/' . $source_name . '.php';
                 if (JFile::exists($path) && !array_key_exists($source_name, $results)) {
                     $sourceClass = self::CLASS_NAME_PREFIX . ucfirst($source_name);
                     $source = new $sourceClass();
                     if ($source->available()) {
                         $source_info = new stdClass();
                         $source_info->name = $source_name;
                         $source_info->source = $source;
                         $source_info->paramspath = $source_path . '/' . $source_name . '.xml';
                         $results[$source_name] = $source_info;
                     }
                 }
             }
         }
     }
     return $results;
 }
Example #2
0
 public function render()
 {
     $module_name = JFactory::getApplication()->input->getString('module');
     $module_id = JFactory::getApplication()->input->getInt('moduleid');
     $db = JFactory::getDBO();
     if (isset($module_name) && $module_name != '') {
         $query = "SELECT * from #__modules where title=" . $db->quote($module_name);
     } else {
         if (isset($module_id) && $module_id != '') {
             $query = "SELECT * from #__modules where id=" . $module_id;
         } else {
             die;
         }
     }
     $db->setQuery($query);
     $result = $db->loadObject();
     if ($result) {
         $page = JFactory::getApplication()->input->getInt('page', 2);
         $module = JModuleHelper::getModule($result->module);
         $module->params = $result->params;
         $params = new JRegistry($result->params);
         $rokminievents3 = new RokMiniEvents3();
         $events = $rokminievents3->getEvents($params);
         $pages = ceil(count($events) / $params->get('events_pane'));
         $per_pane = $params->get('events_pane');
         //$output = $renderer->render($module, $options);
         $output = new stdClass();
         $output->status = 'success';
         $output->message = '';
         $output->id = $module_id;
         $output->page = $page;
         $output->payload = array();
         if (count($events)) {
             $start = $page * $per_pane - ($per_pane - 1) - 1;
             $stop = count($events) < $page * $per_pane ? count($events) - 1 : $page * $per_pane - 1;
             $output->payload['html'] = '';
             for ($i = $start; $i <= $stop; $i++) {
                 $event = $events[$i];
                 ob_start();
                 include JModuleHelper::getLayoutPath('mod_rokminievents3', 'default_item');
                 $output->payload['html'][] = ob_get_clean();
             }
         }
         echo json_encode($output);
     }
 }
Example #3
0
<?php

/**
 * @version   $Id: mod_rokminievents3.php 20114 2014-04-02 17:18:27Z btowles $
 * @author    RocketTheme http://www.rockettheme.com
 * @copyright Copyright (C) 2007 - 2014 RocketTheme, LLC
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
if (!defined('ROKMINIEVENTS3')) {
    define('ROKMINIEVENTS3', 'ROKMINIEVENTS3');
}
if (!defined('ROKMINIEVENTS3_ROOT')) {
    define('ROKMINIEVENTS3_ROOT', dirname(__FILE__));
}
require_once ROKMINIEVENTS3_ROOT . '/lib/include.php';
$doc = JFactory::getDocument();
if ($params->get('builtin_css', 1)) {
    $doc->addStyleSheet(JURI::Root(true) . '/modules/mod_rokminievents3/tmpl/css/rokminievents3.css');
}
if (preg_match('/(?i)msie [2-9]/', $_SERVER['HTTP_USER_AGENT'])) {
    $doc->addStyleSheet(JURI::Root(true) . '/modules/mod_rokminievents3/tmpl/css/ie.css');
}
$rokminievents3 = new RokMiniEvents3();
$rokminievents3->loadScripts($params);
$events = $rokminievents3->getEvents($params);
require JModuleHelper::getLayoutPath('mod_rokminievents3');
Example #4
0
 function getEvents(&$params)
 {
     require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
     require_once JPATH_ROOT . '/administrator/components/com_community/tables/configuration.php';
     require_once JPATH_ROOT . '/components/com_community/models/events.php';
     $cfactory = new CFactory();
     $cfactory->load('helpers', 'event');
     $cfactory->load('helpers', 'string');
     $cfactory->load('helpers', 'time');
     // Reuse existing language file from JomSocial
     $language = JFactory::getLanguage();
     $language->load('com_community', JPATH_ROOT);
     //$model = $cfactory->getModel('Events');
     $model = new CommunityModelEvents();
     $user_id = null;
     //if ((bool) $params->get( 'jomsocial_user' , false )){
     //    $user = JFactory::getUser();
     //    $user_id = $user->id;
     //}
     $advanced = null;
     if ($params->get('time_range') == 'time_span' || $params->get('rangespan') != 'all_events') {
         $advanced = array();
         $advanced['startdate'] = $params->get('startmin');
         $startMax = $params->get('startmax', false);
         if ($startMax !== false) {
             $advanced['enddate'] = $startMax;
         }
     }
     $cat = $params->get('jomsocial_category', 0);
     //if all cats is selected return 0 for cats
     if (is_array($cat) && in_array(0, $cat)) {
         $cat = 0;
     }
     $rows = $model->getEvents($cat, $user_id, null, null, (bool) $params->get('jomsocial_past', false), false, null, $advanced, $params->get('jomsocial_type', CEventHelper::ALL_TYPES), 0, $params->get('jomsocial_total', 10));
     $events = array();
     if (empty($rows)) {
         return $events;
     }
     foreach ($rows as $row) {
         $table = JTable::getInstance('Event', 'CTable');
         $table->bind($row);
         $handler = CEventHelper::getHandler($table);
         if ($params->get('jomsocial_links') != 'link_no') {
             $link = array('internal' => $params->get('jomsocial_links') == 'link_internal' ? true : false, 'link' => $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $table->id));
         } else {
             $link = false;
         }
         $conf = JFactory::getConfig();
         $tz = $conf->get('offset');
         $tz_offset = RokMiniEvents3::_get_timezone_offset($tz, false);
         $db_offset = $row->offset != 0 ? $row->offset * 3600 * -1 : 0;
         $startdate = strtotime($row->startdate) - (int) $tz_offset + (int) $db_offset;
         $enddate = strtotime($row->enddate) - (int) $tz_offset + (int) $db_offset;
         $time_diff = (int) $enddate - (int) $startdate;
         $event = new RokMiniEvents3_Event($startdate, $enddate, $row->title, $row->description, $link);
         if ($startdate == $enddate || $time_diff <= 86401 && $time_diff >= 86399 || $row->allday) {
             $event->setAllDay(true);
         }
         $events[] = $event;
     }
     return $events;
 }
Example #5
0
*/
defined('_JEXEC') or die('Restricted access');
if (!count($events)) {
    echo JText::_("ROKMINIEVENTS3_NOEVENTSFROUND");
}
if (isset($events['error'])) {
    echo $events;
}
if (!count($events) || isset($events['error'])) {
    return;
}
$offset_x = $params->get('offset_x', 0);
$pages = ceil(count($events) / $params->get('events_pane'));
$per_pane = $params->get('events_pane');
$timeline = $params->get('timeline', 'both');
$timelineDates = RokMiniEvents3::getTimelineDates($events, $params);
$json_options = htmlentities(json_encode(array("id" => $module->id, "pages" => (int) $pages)));
/** @var RokMiniEvents3_Event[] $events */
?>

<div class="rokminievents3" data-rokminievents3="<?php 
echo $json_options;
?>
" data-rokminievents3-id="<?php 
echo $module->id;
?>
">
    <ul class="rme-items cols-<?php 
echo $params->get('events_pane', 3);
?>
">