Your IP : 216.73.216.84


Current Path : /home/h/e/l/helpink/www/components/com_jbusinessdirectory/helpers/
Upload File :
Current File : /home/h/e/l/helpink/www/components/com_jbusinessdirectory/helpers/event_styles.php

<?php
/**
 * @package    J-BusinessDirectory
 * @author     CMSJunkie http://www.cmsjunkie.com
 * @copyright  Copyright (C) 2007 - 2022 CMSJunkie. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');

class JBDEventsStyles {
    /**
     * Get event header icons HTML
     * 
     * @param object $event Event object
     * @param string $eventId Event ID
     * @return string HTML for header icons
     */
    public static function getEventHeaderIcons($event) {
        $html = '<div class="header-icons">';
        
        // Social share
        ob_start();
        $view = 'event';
        require_once JPATH_COMPONENT_SITE . "/include/social_share.php";
        $html .= ob_get_clean();


        // Print icon
        $html .= '<a class="print-icon" rel="nofollow" href="javascript:jbdUtils.printItem(\'' . 
                JRoute::_("index.php?option=com_jbusinessdirectory&view=event&tmpl=component&action=print&eventId=" . $event->id) . 
                '\')"><i class="icon print-circle"></i></a>';
        
        // Download calendar icon
        $html .= '<a class="" href="' . 
                JRoute::_("index.php?option=com_jbusinessdirectory&task=event.exportEventsDetailsICS&eventId=" . $event->id . '&' . JSession::getFormToken() . '=1') . 
                '"><i class="icon download-circle"></i></a>';
        
        // Add to Google Calendar
        $html .= '<a class="" target="_blank" href="' . 
                JRoute::_("http://www.google.com/calendar/render?action=TEMPLATE&text=" . $event->name .
                "&location=" . $event->address .
                "&details=" . strip_tags($event->description) .
                "&dates=" . date('Ymd', strtotime($event->start_date)) . "T" . date('His', strtotime($event->start_time)) . 
                "/" . date('Ymd', strtotime($event->end_date)) . "T" . date('His', strtotime($event->end_time))) . 
                '"><i class="icon add-to-calendar-circle"></i></a>';
        
        $html .= '</div>';
        
        return $html;
    }

    /**
     * Get event details list HTML
     * 
     * @param object $event Event object
     * @param object $defaultAttributes Default attributes
     * @param object $appSettings Application settings
     * @param bool $showData Whether to show sensitive data
     * @return string HTML for event details list
     */
    public static function getEventDetails($event, $defaultAttributes, $appSettings, $showData = false) {
        $html = '<ul class="item-details">';
        
        // Date
        if ($event->start_date != '0000-00-00') {
            $html .= '<li>
                <div class="icon-wrapper"><i class="icon calendar"></i></div>';
            $dates = JBusinessUtil::getDateGeneralShortFormat($event->start_date) . 
                    (!empty($event->start_date) && $event->start_date != $event->end_date && $event->show_end_date ? 
                    " - " . JBusinessUtil::getDateGeneralShortFormat($event->end_date) : "");
            $html .= $dates . '</li>';

            // Time
            if ($event->show_start_time || $event->show_end_time) {
                $html .= '<li>
                    <div class="icon-wrapper"><i class="icon clock"></i></div>' . 
                    ($event->show_start_time ? JBusinessUtil::convertTimeToFormat($event->start_time) : "") . 
                    " " . (!empty($event->end_time) && $event->show_end_time ? JText::_("LNG_TO") : "") . " " . 
                    ($event->show_end_time ? JBusinessUtil::convertTimeToFormat($event->end_time) : "");
                
                if ($defaultAttributes["time_zone"] != ATTRIBUTE_NOT_SHOW) {
                    $html .= ($event->show_start_time || $event->show_end_time) ? 
                            " | ".JText::_('LNG_GMT') . " " . $event->time_zone : "";
                }
                
                $html .= '</li>';
            }
        }

        // Contact info
        if (!empty($event->contact_phone) || !empty($event->contact_email) || !empty($event->company->email)) {
            if (!empty($event->contact_phone)) {
                $html .= '<li>
                    <div class="icon-wrapper"><i class="icon phone-o"></i></div>
                    <a href="tel:' . $event->contact_phone . '">' . $event->contact_phone . '</a>
                </li>';
            }

            if ((!empty($event->contact_email) || (!empty($event->company) && !empty($event->company->email))) && $appSettings->show_contact_form) {
                $html .= '<li>
                    <div class="icon-wrapper"><i class="icon envelope"></i></div>
                    <a itemprop="email" href="javascript:jbdListings.showContactCompany(' . ($showData ? 1 : 0) . ')">' . 
                    JText::_('LNG_CONTACT') . '</a>
                </li>';
            }
        }
        
        $html .= '</ul>';
        
        return $html;
    }

    /**
     * Get event info items HTML
     * 
     * @param object $event Event object
     * @param object $defaultAttributes Default attributes
     * @return string HTML for event info items
     */
    public static function getEventInfo($event, $defaultAttributes, $appSettings, $user, $userAssociatedCompanies) {
        $html = '<div class="event-info">';
        
        // Doors open time
        if (!empty($event->doors_open_time) && $event->show_doors_open_time) {
            $html .= '<div class="event-info-item">
                <div class="light">' . JText::_('LNG_EVENT_DOORS_OPEN') . '</div>
                <div>
                    <span itemprop="doorTime">' . JBusinessUtil::convertTimeToFormat($event->doors_open_time) . '</span>
                </div>
            </div>';
        }

        // Event type
        if (!empty($event->eventType) && $defaultAttributes["type"] != ATTRIBUTE_NOT_SHOW) {
            $html .= '<div class="event-info-item">
                <div class="light">' . JText::_("LNG_TYPE") . '</div>
                <div>' . htmlspecialchars($event->eventType) . '</div>
            </div>';
        }

        // Age range
        if (!empty($event->min_age) && $defaultAttributes["age"] != ATTRIBUTE_NOT_SHOW) {
            $html .= '<div class="event-info-item">
                <div class="light">' . JText::_("LNG_AGE") . '</div>
                <div>' . $event->min_age . " - " . $event->max_age . " " . JText::_("LNG_YEARS") . '</div>
            </div>';
        }

      
        // Attendance mode
        if (!empty($event->attendance_mode) && $defaultAttributes["attendance"] != ATTRIBUTE_NOT_SHOW) {
            $html .= '<div class="event-info-item" itemscope itemtype="http://schema.org/EventAttendanceModeEnumeration">
                <div class="light">' . JText::_('LNG_MODE') . '</div>
                <div>
                    <span>' . JBusinessUtil::getAttendanceModeText($event->attendance_mode) . '</span>
                </div>';

            // Add schema.org attendance mode
            if ($event->attendance_mode == 1) {
                $html .= '<span style="display:none" itemprop="eventAttendanceMode">OfflineEventAttendanceMode</span>';
            } else if ($event->attendance_mode == 2) {
                $html .= '<span style="display:none" itemprop="eventAttendanceMode">OnlineEventAttendanceMode</span>';
            } else if ($event->attendance_mode == 3) {
                $html .= '<span style="display:none" itemprop="eventAttendanceMode">MixedEventAttendanceMode</span>';
            }

            $html .= '</div>';
        }

        if (!empty($event->attendance_url) && $event->attendance_mode != 1 || 
            $appSettings->enable_event_subscription && $event->enable_subscription) {
            $html .= '<div class="event-info-container">';
            
            // Attendance URL for online/hybrid events
            if (!empty($event->attendance_url) && $event->attendance_mode != 1) {
                $html .= '<div class="event-info-item">
                    <a class="attend-event btn w-100" target="_blank" href="' . $event->attendance_url . '">' . 
                    JText::_("LNG_ATTEND_EVENT") . 
                    '</a>
                </div>';
            }

            // Event subscription button
            if ($appSettings->enable_event_subscription && $event->enable_subscription) {
                $isLoggedIn = $user->id != 0;
                $html .= '<div class="event-info-item">
                    <a href="#" class="btn btn-outline w-100" onclick="jbdEvents.joinEvent(' . ($isLoggedIn ? 1 : 0) . ')">' . 
                    (empty($userAssociatedCompanies) ? JText::_('LNG_BECOME_PARTNER') : JText::_('LNG_CANCEL_PARTNERSHIP')) . 
                    '</a>
                </div>';
            }
            
            $html .= '</div>';
        }
        
        $html .= '</div>';

        
        return $html;
    }
}