Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,36 +12,52 @@
namespace IPS\calendar\modules\front\calendar;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use InvalidArgumentException;
use IPS\calendar\Calendar;
use IPS\calendar\Date;
use IPS\calendar\Event;
use IPS\calendar\Venue as VenueClass;
use IPS\Dispatcher\Controller;
use IPS\GeoLocation;
use IPS\Http\Url;
use IPS\Member;
use IPS\Output;
use IPS\Request;
use IPS\Theme;
use OutOfRangeException;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* venue
*/
class _venue extends \IPS\Dispatcher\Controller
class venue extends Controller
{
/**
* @brief Venue we are viewing
*/
protected $venue = NULL;
protected ?VenueClass $venue = NULL;
/**
* Init
*
* @return void
*/
public function execute()
public function execute() : void
{
try
{
$this->venue = \IPS\calendar\Venue::loadAndCheckPerms( \IPS\Request::i()->id );
$this->venue = VenueClass::loadAndCheckPerms( Request::i()->id );
}
catch ( \OutOfRangeException $e )
catch ( OutOfRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2L354/1', 404, '' );
Output::i()->error( 'node_error', '2L354/1', 404, '' );
}
parent::execute();
@@ -52,33 +68,33 @@ class _venue extends \IPS\Dispatcher\Controller
*
* @return void
*/
public function manage()
public function manage() : void
{
/* Load the css for Calendar badges */
\IPS\calendar\Calendar::addCss();
Calendar::addCss();
$today = \IPS\calendar\Date::getDate();
$today = Date::getDate();
/* Get the month data */
$day = NULL;
if( ( !\IPS\Request::i()->y OR \IPS\Request::i()->y == $today->year ) AND ( !\IPS\Request::i()->m OR \IPS\Request::i()->m == $today->mon ) )
if( ( !Request::i()->y OR Request::i()->y == $today->year ) AND ( !Request::i()->m OR Request::i()->m == $today->mon ) )
{
$day = $today->mday;
}
try
{
$date = \IPS\calendar\Date::getDate( \IPS\Request::i()->y ?: NULL, \IPS\Request::i()->m ?: NULL, $day );
$date = Date::getDate( Request::i()->y ?: NULL, Request::i()->m ?: NULL, $day );
}
catch( \InvalidArgumentException $e )
catch( InvalidArgumentException $e )
{
\IPS\Output::i()->error( 'error_bad_date', '2L354/2', 403, '' );
Output::i()->error( 'error_bad_date', '2L354/2', 403, '' );
}
$upcoming = \IPS\calendar\Event::retrieveEvents(
\IPS\calendar\Date::getDate( $date->firstDayOfMonth('year'), $date->firstDayOfMonth('mon'), $date->firstDayOfMonth('mday') ),
\IPS\calendar\Date::getDate( $date->lastDayOfMonth('year'), $date->lastDayOfMonth('mon'), $date->lastDayOfMonth('mday'), 23, 59, 59 ),
$upcoming = Event::retrieveEvents(
Date::getDate( $date->firstDayOfMonth('year'), $date->firstDayOfMonth('mon'), $date->firstDayOfMonth('mday') ),
Date::getDate( $date->lastDayOfMonth('year'), $date->lastDayOfMonth('mon'), $date->lastDayOfMonth('mday'), 23, 59, 59 ),
NULL,
NULL,
FALSE,
@@ -86,37 +102,37 @@ class _venue extends \IPS\Dispatcher\Controller
$this->venue
);
$upcomingOutput = \IPS\Theme::i()->getTemplate( 'venue', 'calendar', 'front' )->upcomingStream( $date, $upcoming, $this->venue );
$upcomingOutput = Theme::i()->getTemplate( 'venue', 'calendar', 'front' )->upcomingStream( $date, $upcoming, $this->venue );
/* Address */
$address = NULL;
if ( $this->venue->address )
{
$address = \IPS\GeoLocation::buildFromjson( $this->venue->address )->toString();
$address = GeoLocation::buildFromjson( $this->venue->address )->toString();
}
/* Display */
if( \IPS\Request::i()->isAjax() )
if( Request::i()->isAjax() )
{
\IPS\Output::i()->sendOutput( $upcomingOutput, 200, 'text/html' );
Output::i()->sendOutput( $upcomingOutput );
}
else
{
/* Add JSON-LD */
\IPS\Output::i()->jsonLd['eventVenue'] = array(
'@context' => "http://schema.org",
Output::i()->jsonLd['eventVenue'] = array(
'@context' => "https://schema.org",
'@type' => "EventVenue",
'url' => (string) $this->venue->url(),
'name' => $this->venue->_title
);
\IPS\Output::i()->title = $this->venue->_title;
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_venue.js', 'calendar', 'front' ) );
Output::i()->title = $this->venue->_title;
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'front_venue.js', 'calendar', 'front' ) );
/* We want to present the same breadcrumb structure as the rest of the calendar */
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( "app=calendar&module=calendar&controller=view", 'front', 'calendar' ), \IPS\Member::loggedIn()->language()->addToStack('module__calendar_calendar') );
Output::i()->breadcrumb['module'] = array( Url::internal( "app=calendar&module=calendar&controller=view", 'front', 'calendar' ), Member::loggedIn()->language()->addToStack('module__calendar_calendar') );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'venue', 'calendar', 'front' )->view( $this->venue, $upcomingOutput, NULL, $address );
Output::i()->output = Theme::i()->getTemplate( 'venue', 'calendar', 'front' )->view( $this->venue, $upcomingOutput, NULL, $address );
}
}
}