diff --git a/2020/include/functions.php b/2020/include/functions.php index 4ccf361..c5b3173 100644 --- a/2020/include/functions.php +++ b/2020/include/functions.php @@ -1,45 +1,63 @@ . /** * Require a certain page from the template directory * * @param $name string page name (to be sanitized) * @param $args mixed arguments to be passed to the page scope */ function template_2020( $template_name, $template_args = [] ) { extract( $template_args, EXTR_SKIP ); return require ABSPATH . "/2020/template/$template_name.php"; } /** * Spawn a 2020 Event */ function event_2020( $id ) { $event = ( new QueryEvent() ) ->whereEventID( $id ) ->joinConference() ->joinTrack( 'LEFT' ) ->joinRoom( 'LEFT' ) ->joinChapter( 'LEFT' ) ->queryRow(); template_2020( 'event-brief', [ 'event' => $event, ] ); } + +/** + * Print an icon for the 2020 website + * + * See https://materializecss.com/icons.html + * + * @param string $name Icon name + * @param string $classes CSS classes + * @return string + */ +function icon_2020( $name, $classes = null ) { + $classes = $classes ? " $classes" : ''; + return sprintf( + '%s', + $classes, + $name + ); +} diff --git a/2020/www/event.php b/2020/www/event.php index c92935f..d1d2acd 100644 --- a/2020/www/event.php +++ b/2020/www/event.php @@ -1,242 +1,332 @@ . // load all the stuff require 'load.php'; // the Event we want to visit $event = null; // load this conference //$conference = ( new QueryConference() ) // ->whereConferenceUID( THIS_CONFERENCE_UID ) // ->queryRow(); // no conference no party //if( !$conference ) { // error_die( sprintf( // "missing conference %s", // THIS_CONFERENCE_UID // ) ); //} // event UID $event_slug = $_SERVER['PATH_INFO'] ?? null; if( !$event_slug ) { error_die( "missing event UID" ); } // remove unuseful slashes $event_slug = trim( $event_slug, _ ); // 123-something $event_slug_parts = explode( '-', $event_slug ); // no ID no party $event_ID = $event_slug_parts[0] ?? 0; $event_ID = (int) $event_ID; if( $event_ID ) { // Event $event = FullEvent::factory() ->whereEventID( $event_ID ) ->queryRow(); } else { // else use the complete Event slug // Event $event = FullEvent::factory() ->whereEventUID( $event_slug ) ->queryRow(); } // no Event no party if( !$event ) { error_die( "missing event $event_slug" ); } // inherit the Conference information from the Event object // the $conference is read from the website header $conference = $event; // check if this is the correct permalink if( site_page( $_SERVER['REQUEST_URI'], true ) !== $event->getEventStandardURL( true ) ) { http_redirect( $event->getEventStandardURL( true ) ); } $users = ( new QueryEventUser() ) ->joinUser() ->whereEvent( $event ) ->orderByEventUserOrder() ->queryGenerator(); $user_links = []; foreach( $users as $user ) { // check if the User has an account in Wikimedia Meta-wiki if( $user->has( User::META_WIKI ) ) { // print the Meta-wiki permalink $user_links[] = HTML::a( $user->getUserMetaWikiURL(), esc_html( $user->getUserDisplayName() ) ); } else { $user_links[] = esc_html( $user->getUserDisplayName() ); } } // print the website header template_2020( 'header', [ 'conference' => $conference, 'title' => $event->getEventTitle(), ] ); ?>

getEventTitle() ) ?> – getConferenceAcronym() ) ?>

+ + factorySharebleByEvent() + ->select( Sharable::fields() ) + ->whereSharableIsRoot() + ->selectSharableHasChildren() + ->queryGenerator(); + ?> + valid() ): ?> +
+
+ + + get( 'sharable_has_children' ) ) { + $child_sharables = ( new QuerySharable() ) + ->whereSharableParent( $sharable ) + ->queryResults(); + } + ?> + + +
+
+ isSharableDownloadable() ): ?> + + + isSharableVideo() ): ?> +

+ + isEventPassed() ): ?> +
+

getEventStart( 'd' ) ?> getEventStart( 'H:i' ) ?>–getEventEnd( 'H:i' ) ?> in stanza "getRoomName() ) ?>":

+
+ + + + + + + +

+ getSharablePath(), + icon_2020('attachment', 'left') . + esc_html( $child_sharable->getSharableMIME() ), + null, + null, + 'target="_blank"' + ), + $sharable->getSharableLicense()->getLink() + ) ?> +

+ + + +

+ getSharablePath(), + icon_2020('share', 'left') . + esc_html( $sharable->getSharableTitle( [ 'prop' => true ] ) ), + null, + null, + 'target="_blank"' + ), + $sharable->getSharableLicense()->getLink() + ) ?> +

+ +
+
+ +
+
+ + + hasEventAbstract() ): ?>

getEventAbstractHTML( [ 'p' => 'flow-text', ] ) ?>
+ isEventPassed() ): ?>

getEventStart( 'd' ) ?> getEventStart( 'H:i' ) ?>–getEventEnd( 'H:i' ) ?> in getRoomName() ) ?>.

play_arrow getRoomName() ) ?>

+
hasEventDescription() ): ?> getEventDescription() ?>

getEventExternalURL(), __( "Maggiori informazioni su Meta-wiki" ) ) ?>

factoryPreviousFullEvent( [ 'whatever-room' => true ] ) ->select( Event::fields() ) ->select( Conference::fields() ) ->limit( 2 ) ->queryResults(); // next talk in the same room $nexts = $event->factoryNextFullEvent( [ 'whatever-room' => true ] ) ->select( Event::fields() ) ->select( Conference::fields() ) ->limit( 2 ) ->queryResults(); // in the meanwhile $durings = $event->factoryMeanwhileFullEvent() ->limit( 2 ) ->queryResults(); ?>

navigate_before

getEventURL(), esc_html( $previous->getEventTitle() ) ) ?>

navigate_next

getEventURL(), esc_html( $next->getEventTitle() ) ) ?>

play_arrow

getEventURL(), esc_html( $during->getEventTitle() ) ) ?>

isEventEditable() ): ?>

getEventEditURL(), '[edit]' ) ?>

$conference, ] );