Example #1
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     // Initialiase variables.
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     if (JRequest::get('POST')) {
         $this->get('data');
     }
     // loading params
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->template = $params->get('template');
     $this->title = $params->get('title');
     $this->format = $params->get('format');
     $this->copy = $params->get('copy');
     $this->submit = "media/com_icagenda/js/jsevt.js";
     $this->submit_imageDisplay = $params->get('submit_imageDisplay', 1);
     $this->submit_periodDisplay = $params->get('submit_periodDisplay', 1);
     $this->submit_weekdaysDisplay = $params->get('submit_weekdaysDisplay', 1);
     $this->submit_datesDisplay = $params->get('submit_datesDisplay', 1);
     $this->submit_shortdescDisplay = $params->get('submit_shortdescDisplay', 1);
     $this->submit_descDisplay = $params->get('submit_descDisplay', 1);
     $this->submit_metadescDisplay = $params->get('submit_metadescDisplay', 0);
     $this->submit_venueDisplay = $params->get('submit_venueDisplay', 1);
     $this->submit_emailDisplay = $params->get('submit_emailDisplay', 1);
     $this->submit_phoneDisplay = $params->get('submit_phoneDisplay', 1);
     $this->submit_websiteDisplay = $params->get('submit_websiteDisplay', 1);
     $this->submit_customfieldsDisplay = $params->get('submit_customfieldsDisplay', 1);
     $this->submit_fileDisplay = $params->get('submit_fileDisplay', 1);
     $this->submit_gmapDisplay = $params->get('submit_gmapDisplay', 1);
     $this->submit_regoptionsDisplay = $params->get('submit_regoptionsDisplay', 1);
     $this->statutReg = $params->get('statutReg', 0);
     $this->ShortDescLimit = $params->get('ShortDescLimit', '160');
     $this->submit_imageMaxSize = $params->get('submit_imageMaxSize', '800');
     $this->submit_captcha = $params->get('submit_captcha', 0);
     $this->submit_form_validation = $params->get('submit_form_validation', '');
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->params = $this->state->get('params');
     $this->iCparams = $this->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // ASSIGN (deprecated)
     //		$this->assignRef('params', $iCparams);
     $this->_prepareDocument();
     icagendaInfo::commentVersion();
     parent::display($tpl);
     icagendaEvents::isListOfEvents();
     icagendaForm::loadDateTimePickerJSLanguage();
     $jlayout = JRequest::getCmd('layout', '');
     $layouts_array = array('event', 'registration');
     $layout = in_array($jlayout, $layouts_array) ? $jlayout : '';
     if (!$layout || $layout == 'submit') {
         JHtml::stylesheet('com_icagenda/icagenda.css', false, true);
         JHtml::stylesheet('com_icagenda/jquery-ui-1.8.17.custom.css', false, true);
     }
 }
Example #2
0
    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;
            } elseif ($dp_shortDesc == '2') {
                $descShort = $descShort ? $descShort : false;
            } elseif ($dp_shortDesc == '0') {
                $descShort = false;
            } 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 && $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;
    }
Example #3
0
    $period = unserialize($item->period);
    $period = is_array($period) ? $period : array();
    $is_in_period = in_array($this_date, $period) ? true : false;
    if ($is_in_period && $item->weekdays == '' && strtotime($item->startdatetime) <= strtotime($date_today) && strtotime($item->enddatetime) >= strtotime($date_today)) {
        $ongoing = true;
    } else {
        $ongoing = false;
    }
    // Day in Date Box (list of events)
    $EVENT_DAY = $this->day_display_global ? icagendaEvents::day($evt, $item) : false;
    // Month in Date Box (list of events)
    $EVENT_MONTHSHORT = $this->month_display_global ? icagendaEvents::dateBox($this_date, 'monthshort', $ongoing) : false;
    // Year in Date Box (list of events)
    $EVENT_YEAR = $this->year_display_global ? icagendaEvents::dateBox($evt, 'year', $ongoing) : false;
    // Time in Date Box (list of events)
    $EVENT_TIME = $this->time_display_global && $item->displaytime == 1 ? icagendaEvents::dateToTimeFormat($evt) : false;
    // Load Event Data
    $EVENT_DATE = iCModeliChelper::nextDate($evt, $item);
    $EVENT_SET_DATE = iCModeliChelper::eventUrlDate($evt);
    $READ_MORE = $this->shortdesc_display_global == '' && !$item->shortdesc ? iCModeliChelper::readMore($item->url, $item->desc, '[&#46;&#46;&#46;]') : false;
    // URL to event details view (list of events)
    if ($datesDisplay == 1) {
        $date_var = $isSef == '1' ? '?date=' : '&amp;date=';
        $set_url_date = $date_var . $EVENT_SET_DATE;
        $date_url = $only_startdate && in_array($this_date, $period) ? '' : $date_var . $EVENT_SET_DATE;
        $EVENT_URL = $item->url . $date_url;
    } else {
        $EVENT_URL = $item->url;
    }
} else {
    $EVENT_URL = $item->url;
Example #4
0
 public static function nextDate($evt, $i)
 {
     $eventTimeZone = null;
     $singledates = iCString::isSerialized($i->dates) ? unserialize($i->dates) : array();
     // returns array
     $period = iCString::isSerialized($i->period) ? unserialize($i->period) : array();
     // returns array
     $startdatetime = $i->startdatetime;
     $enddatetime = $i->enddatetime;
     $weekdays = $i->weekdays;
     $site_today_date = JHtml::date('now', 'Y-m-d');
     $UTC_today_date = JHtml::date('now', 'Y-m-d', $eventTimeZone);
     $next_date = JHtml::date($evt, 'Y-m-d', $eventTimeZone);
     $next_datetime = JHtml::date($evt, 'Y-m-d H:i', $eventTimeZone);
     $start_date = JHtml::date($i->startdatetime, 'Y-m-d', $eventTimeZone);
     $end_date = JHtml::date($i->enddatetime, 'Y-m-d', $eventTimeZone);
     // Check if date from a period with weekdays has end time of the period set in next.
     //		$time_next_datetime	= JHtml::date($next_datetime, 'H:i', $eventTimeZone);
     $time_next_datetime = date('H:i', strtotime($next_datetime));
     $time_startdate = JHtml::date($i->startdatetime, 'H:i', $eventTimeZone);
     $time_enddate = JHtml::date($i->enddatetime, 'H:i', $eventTimeZone);
     $data_next_datetime = date('Y-m-d H:i', strtotime($evt));
     if ($next_date == $site_today_date && $time_next_datetime == $time_enddate) {
         $next_datetime = $next_date . ' ' . $time_startdate;
     }
     if ($period != NULL && in_array($data_next_datetime, $period)) {
         $next_is_in_period = true;
     } else {
         $next_is_in_period = false;
     }
     // Highlight event in progress
     if ($next_date == $site_today_date) {
         $start_span = '<span class="ic-next-today">';
         $end_span = '</span>';
     } else {
         $start_span = $end_span = '';
     }
     $separator = '<span class="ic-datetime-separator"> - </span>';
     // Format Next Date
     if ($next_is_in_period && ($start_date == $end_date || $weekdays != null)) {
         // Next in the period & (same start/end date OR one or more weekday selected)
         $nextDate = $start_span;
         $nextDate .= '<span class="ic-period-startdate">';
         $nextDate .= self::formatDate($evt);
         $nextDate .= '</span>';
         if ($i->displaytime == 1) {
             $nextDate .= ' <span class="ic-single-starttime">' . icagendaEvents::dateToTimeFormat($startdatetime) . '</span>';
             if (icagendaEvents::dateToTimeFormat($startdatetime) != icagendaEvents::dateToTimeFormat($enddatetime)) {
                 $nextDate .= $separator . '<span class="ic-single-endtime">' . icagendaEvents::dateToTimeFormat($enddatetime) . '</span>';
             }
         }
         $nextDate .= $end_span;
     } elseif ($next_is_in_period && $weekdays == null) {
         // Next in the period & different start/end date & no weekday selected
         $start = '<span class="ic-period-startdate">';
         $start .= self::formatDate($startdatetime);
         $start .= '</span>';
         $end = '<span class="ic-period-enddate">';
         $end .= self::formatDate($enddatetime);
         $end .= '</span>';
         if ($i->displaytime == 1) {
             $start .= ' <span class="ic-period-starttime">' . icagendaEvents::dateToTimeFormat($startdatetime) . '</span>';
             $end .= ' <span class="ic-period-endtime">' . icagendaEvents::dateToTimeFormat($enddatetime) . '</span>';
         }
         $nextDate = $start_span . $start . $separator . $end . $end_span;
     } else {
         // Next is a single date
         $nextDate = $start_span;
         $nextDate .= '<span class="ic-single-next">';
         $nextDate .= self::formatDate($evt);
         $nextDate .= '</span>';
         if ($i->displaytime == 1) {
             $nextDate .= ' <span class="ic-single-starttime">' . icagendaEvents::dateToTimeFormat($evt) . '</span>';
         }
         $nextDate .= $end_span;
     }
     return $nextDate;
 }
Example #5
0
 protected function evenTime($i)
 {
     if ($this->displaytime($i) == 1) {
         return icagendaEvents::dateToTimeFormat($i->next);
     } else {
         return NULL;
     }
 }
Example #6
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $this->params = $app->getParams();
     $params = $this->params;
     //+ FT li-de integráció
     if (JRequest::getVar('catid')) {
         $params->set('mcatid', array(JRequest::getVar('catid')));
     }
     //+ FT li-de integráció
     // For Dev.
     $time_loading = $params->get('time_loading', '');
     if ($time_loading) {
         $starttime_list = iCLibrary::getMicrotime();
     }
     // loading data
     $this->data = $this->getModel()->getData();
     echo count($this->data) . '<br>';
     //+FT li-de témakör láthatóság kezeés
     //$this->getAllDates	= icagendaEventsData::getAllDates();
     // $this->getAllDates MYSQL -el az adott user által látható,
     // a mai napon vagy késöbb lévő eseményeket kell kigyüjteni.
     // tömb elem : éééé-hh-nn hh-ii_####
     $this->getAllDates = iCModelItem::getAllDates();
     //echo count($this->getAllDates).'<br>';
     //-FT li-de témakör láthatóság
     $this->form = $this->getModel()->getForm();
     // Registration Form
     $this->state = $this->get('State');
     //Following variables used more than once
     //		$this->sortColumn 	= $this->state->get('list.ordering');
     //		$this->sortDirection	= $this->state->get('list.direction');
     $this->searchterms = $this->state->get('filter.search');
     // Menu Options
     $this->atlist = $params->get('atlist', 0);
     $this->template = $params->get('template');
     $this->title = $params->get('title');
     $this->number = $params->get('number', 5);
     $this->orderby = $params->get('orderby', 2);
     $this->time = $params->get('time', 1);
     // Component Options
     $this->iconPrint_global = $params->get('iconPrint_global', 0);
     $this->iconAddToCal_global = $params->get('iconAddToCal_global', 0);
     $this->iconAddToCal_options = $params->get('iconAddToCal_options', 0);
     $this->copy = $params->get('copy');
     $this->navposition = $params->get('navposition', 1);
     $this->arrowtext = $params->get('arrowtext', 1);
     $this->GoogleMaps = $params->get('GoogleMaps', 1);
     $this->pagination = $params->get('pagination', 1);
     $this->day_display_global = $params->get('day_display_global', 1);
     $this->month_display_global = $params->get('month_display_global', 1);
     $this->year_display_global = $params->get('year_display_global', 1);
     $this->time_display_global = $params->get('time_display_global', 0);
     $this->venue_display_global = $params->get('venue_display_global', 1);
     $this->city_display_global = $params->get('city_display_global', 1);
     $this->country_display_global = $params->get('country_display_global', 1);
     $this->shortdesc_display_global = $params->get('shortdesc_display_global', '');
     $this->statutReg = $params->get('statutReg', 0);
     $this->dates_display = $params->get('datesDisplay', 1);
     $this->reg_captcha = $params->get('reg_captcha', 0);
     $this->reg_form_validation = $params->get('reg_form_validation', '');
     $this->cat_description = $params->get('displayCatDesc_menu', 'global') == 'global' ? $params->get('CatDesc_global', '0') : $params->get('displayCatDesc_menu', '');
     $cat_options = $params->get('displayCatDesc_menu', 'global') == 'global' ? $params->get('CatDesc_checkbox', '') : $params->get('displayCatDesc_checkbox', '');
     $this->cat_options = is_array($cat_options) ? $cat_options : array();
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $vcal = $app->input->get('vcal');
     if ($vcal) {
         $tpl = 'vcal';
     }
     // Process the content plugins.
     JPluginHelper::importPlugin('content');
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $this->dispatcher = JEventDispatcher::getInstance();
     } else {
         $this->dispatcher = JDispatcher::getInstance();
     }
     $eventid = $app->input->get('id');
     if ($eventid) {
         // Set Item Object
         $this_item = (array) $this->data->items;
         $item = array_shift($this_item);
         $this->actions = $this->dispatcher->trigger('onRegistrationActions', array('com_icagenda.actions', &$item, &$this->params));
     }
     $this->_prepareDocument();
     $isVcal = JRequest::getVar('vcal', '');
     if (!$isVcal) {
         icagendaInfo::commentVersion();
     }
     // Loads jQuery Library
     if (version_compare(JVERSION, '3.0', 'lt')) {
         // Joomla 2.5
         JHtml::stylesheet('com_icagenda/icagenda-front.j25.css', false, true);
         JHtml::_('behavior.mootools');
         // load jQuery, if not loaded before
         $scripts = array_keys($document->_scripts);
         $scriptFound = false;
         for ($i = 0; $i < count($scripts); $i++) {
             if (stripos($scripts[$i], 'jquery.min.js') !== false || stripos($scripts[$i], 'jquery.js') !== false) {
                 $scriptFound = true;
             }
         }
         // jQuery Library Loader
         if (!$scriptFound) {
             // load jQuery, if not loaded before
             if (!$app->get('jquery')) {
                 $app->set('jquery', true);
                 // Add jQuery Library
                 $document->addScript('https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
                 JHtml::script('com_icagenda/jquery.noconflict.js', false, true);
             }
         }
     } else {
         JHtml::_('bootstrap.framework');
         JHtml::_('jquery.framework');
     }
     parent::display($tpl);
     // For Dev.
     if ($time_loading) {
         $endtime_list = iCLibrary::getMicrotime();
         echo '<center style="font-size:8px;">Time to create page: ' . round($endtime_list - $starttime_list, 3) . ' seconds</center>';
     }
     icagendaEvents::isListOfEvents();
     $jlayout = JRequest::getCmd('layout', '');
     $layouts_array = array('event', 'registration', 'actions');
     $layout = in_array($jlayout, $layouts_array) ? $jlayout : '';
     // Loading Script tipTip used for iCtips
     JHtml::script('com_icagenda/jquery.tipTip.js', false, true);
     if (!$layout || $layout == 'list') {
         // Add RSS Feeds
         $menu = $app->getMenu()->getActive()->id;
         $feed = 'index.php?option=com_icagenda&amp;view=list&amp;Itemid=' . (int) $menu . '&amp;format=feed';
         $rss = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink(JRoute::_($feed . '&amp;type=rss'), 'alternate', 'rel', $rss);
     }
 }
Example #7
0
*/
// No direct access to this file
defined('_JEXEC') or die;
// Get Application
$app = JFactory::getApplication();
// User Access Levels
$user = JFactory::getUser();
$userLevels = $user->getAuthorisedViewLevels();
// User Groups
$userGroups = $user->groups;
// Set Item Object
$this_item = (array) $this->data->items;
$item = array_shift($this_item);
// Event Access Control
$EventID = $app->input->getInt('id');
$eventAccess = icagendaEvents::eventAccess($EventID);
$evtState = $eventAccess->evtState;
$evtApproval = $eventAccess->evtApproval;
$evtAccess = $eventAccess->evtAccess;
$accessName = $eventAccess->accessName;
// Redirect to login page if no access to registration form
$uri = JFactory::getURI();
$return = base64_encode($uri);
$rlink = JRoute::_("index.php?option=com_users&view=login&return={$return}", false);
// Add Error or Alert Page
if ($evtState == 1 && $evtApproval == 1 && $this->data->items == NULL) {
    // Set Return Page
    $return = JURI::getInstance()->toString();
    // redirect after successful registration
    $app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'info');
    $app->redirect($rlink);