<commit_before><?php
# Linux Day 2016 - Single event page (an event lives in a conference)
# Copyright (C) 2016 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

require 'load.php';

$event = null;
if( isset( $_GET['uid'], $_GET['conference'], $_GET['chapter'] ) ) {
	$event = Event::getEventByConferenceChapter(
		$_GET['uid'],
		$_GET['conference'],
		$_GET['chapter']
	);
}

$event          || die_with_404();
FORCE_PERMALINK && $event->forceEventPermalink();

$args = [
	'title' => sprintf(
		_("%s: %s"),
		$event->getChapterName(),
		$event->getEventTitle()
	),
	'url'   => $event->getEventURL()
];

if( $event->hasEventImage() ) {
	$args['og'] = [
		'image' => $event->getEventImage()
	];
}

new Header('event', $args);
?>
	<?php if( $event->hasPermissionToEditEvent() ): ?>
	<p><?php echo HTML::a(
		CONFERENCE . "/event-edit.php?" . http_build_query( [
			'uid'        => $event->getEventUID(),
			'conference' => $event->getConferenceUID()
		] ),
		_("Modifica evento") . icon('edit', 'left')
	) ?></p>
	<?php endif ?>

	<div class="row">
		<div class="col s12 m5 l4">
			<div class="row">
				<div class="col s6 m12">
					<img class="responsive-img hoverable" src="<?php
						if( $event->hasEventImage() ) {
							echo $event->getEventImage();
						} else {
							echo DEFAULT_IMAGE;
						}
					?>" alt="<?php
						_esc_attr( $event->getEventTitle() )
					?>" />
				</div>
			</div>
		</div>

		<!-- Start room -->
		<div class="col s12 m6 offset-m1 l5 offset-l3">
			<table class="striped bordered">
				<tr>
					<th><?php echo icon('folder', 'left'); _e("Tema") ?></th>
					<td><?php echo $event->getTrackName() ?><br /><small><?php echo $event->getTrackLabel() ?></small></td>
				</tr>
				<tr>
					<th><?php echo icon('access_time', 'left'); _e("Dove") ?></th>
					<td><?php echo $event->getRoomName() ?><br /> <?php echo $event->getConferenceTitle() ?></td>
				</tr>
				<tr>
					<th><?php echo icon('room', 'left'); _e("Quando") ?></th>
					<td><?php printf(
						_("Ore %s"),
						$event->getEventStart('H:i')
					) ?><br /> <?php echo $event->getEventStart('d/m/Y') ?></td>
				</tr>
			</table>
		</div>
		<!-- End room -->
	</div>

	<!-- Start event abstract -->
	<?php if( $event->hasEventAbstract() ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Abstract") ?></h3>
		<?php echo $event->getEventAbstractHTML(['p' => 'flow-text']) ?>
	</div>
	<?php endif ?>
	<!-- End event abstract -->

	<!-- Start event description -->
	<?php if( $event->hasEventDescription() ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Descrizione") ?></h3>
		<?php echo $event->getEventDescriptionHTML(['p' => 'flow-text']) ?>
	</div>
	<?php endif ?>
	<!-- End event description -->

	<!-- Start event description -->
	<?php if( $event->hasEventNote() ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Note") ?></h3>
		<?php echo $event->getEventNoteHTML(['p' => 'flow-text']) ?>
	</div>
	<?php endif ?>
	<!-- End event description -->

	<!-- Start files -->
	<?php $sharables = $event->querySharables() ?>
	<?php if( $sharables->num_rows ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Materiale") ?></h3>
		<div class="row">
			<?php $i = 0 ?>
			<?php while( $sharable = $sharables->fetch_object('Sharable') ): ?>
			<div class="col s12">
				<?php if( $sharable->isSharableVideo() ): ?>
					<video class="responsive-video" controls="controls">
						<source src="<?php echo $sharable->getSharablePath() ?>" type="<?php echo $sharable->getSharableMIME() ?>" />
					</video>
				<?php elseif( $sharable->isSharableDownloadable() ): ?>
					<p class="flow-text">
						<?php printf(
							_("Scarica %s distribuibile sotto licenza %s."),
							HTML::a(
								$sharable->getSharablePath(),
								icon('attachment', 'left') . $sharable->getSharableTitle(['prop' => true]),
								null,
								null,
								'target="_blank"'
							),
							$sharable->getSharableLicense()->getLink()
						) ?>
					</p>
				<?php else: ?>
					<p class="flow-text">
						<?php printf(
							_("Vedi %s distribuibile sotto licenza %s."),
							HTML::a(
								$sharable->getSharablePath(),
								icon('share', 'left') . $sharable->getSharableTitle(['prop' => true]),
								null,
								null,
								'target="_blank"'
							),
							$sharable->getSharableLicense()->getLink()
						) ?>
					</p>
				<?php endif ?>
			</div>
			<?php endwhile ?>
		</div>
	</div>
	<?php endif ?><commit_msg>Added downloadable link also for videos<commit_after><?php
# Linux Day 2016 - Single event page (an event lives in a conference)
# Copyright (C) 2016 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

require 'load.php';

$event = null;
if( isset( $_GET['uid'], $_GET['conference'], $_GET['chapter'] ) ) {
	$event = Event::getEventByConferenceChapter(
		$_GET['uid'],
		$_GET['conference'],
		$_GET['chapter']
	);
}

$event          || die_with_404();
FORCE_PERMALINK && $event->forceEventPermalink();

$args = [
	'title' => sprintf(
		_("%s: %s"),
		$event->getChapterName(),
		$event->getEventTitle()
	),
	'url'   => $event->getEventURL()
];

if( $event->hasEventImage() ) {
	$args['og'] = [
		'image' => $event->getEventImage()
	];
}

new Header('event', $args);
?>
	<?php if( $event->hasPermissionToEditEvent() ): ?>
	<p><?php echo HTML::a(
		CONFERENCE . "/event-edit.php?" . http_build_query( [
			'uid'        => $event->getEventUID(),
			'conference' => $event->getConferenceUID()
		] ),
		_("Modifica evento") . icon('edit', 'left')
	) ?></p>
	<?php endif ?>

	<div class="row">
		<div class="col s12 m5 l4">
			<div class="row">
				<div class="col s6 m12">
					<img class="responsive-img hoverable" src="<?php
						if( $event->hasEventImage() ) {
							echo $event->getEventImage();
						} else {
							echo DEFAULT_IMAGE;
						}
					?>" alt="<?php
						_esc_attr( $event->getEventTitle() )
					?>" />
				</div>
			</div>
		</div>

		<!-- Start room -->
		<div class="col s12 m6 offset-m1 l5 offset-l3">
			<table class="striped bordered">
				<tr>
					<th><?php echo icon('folder', 'left'); _e("Tema") ?></th>
					<td><?php echo $event->getTrackName() ?><br /><small><?php echo $event->getTrackLabel() ?></small></td>
				</tr>
				<tr>
					<th><?php echo icon('access_time', 'left'); _e("Dove") ?></th>
					<td><?php echo $event->getRoomName() ?><br /> <?php echo $event->getConferenceTitle() ?></td>
				</tr>
				<tr>
					<th><?php echo icon('room', 'left'); _e("Quando") ?></th>
					<td><?php printf(
						_("Ore %s"),
						$event->getEventStart('H:i')
					) ?><br /> <?php echo $event->getEventStart('d/m/Y') ?></td>
				</tr>
			</table>
		</div>
		<!-- End room -->
	</div>

	<!-- Start event abstract -->
	<?php if( $event->hasEventAbstract() ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Abstract") ?></h3>
		<?php echo $event->getEventAbstractHTML(['p' => 'flow-text']) ?>
	</div>
	<?php endif ?>
	<!-- End event abstract -->

	<!-- Start event description -->
	<?php if( $event->hasEventDescription() ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Descrizione") ?></h3>
		<?php echo $event->getEventDescriptionHTML(['p' => 'flow-text']) ?>
	</div>
	<?php endif ?>
	<!-- End event description -->

	<!-- Start event description -->
	<?php if( $event->hasEventNote() ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Note") ?></h3>
		<?php echo $event->getEventNoteHTML(['p' => 'flow-text']) ?>
	</div>
	<?php endif ?>
	<!-- End event description -->

	<!-- Start files -->
	<?php $sharables = $event->querySharables() ?>
	<?php if( $sharables->num_rows ): ?>
	<div class="divider"></div>
	<div class="section">
		<h3><?php _e("Materiale") ?></h3>
		<div class="row">
			<?php $i = 0 ?>
			<?php while( $sharable = $sharables->fetch_object('Sharable') ): ?>
			<div class="col s12">
				<?php if( $sharable->isSharableDownloadable() ): ?>
					<p class="flow-text">
						<?php printf(
							_("Scarica %s distribuibile sotto licenza %s."),
							HTML::a(
								$sharable->getSharablePath(),
								icon('attachment', 'left') . $sharable->getSharableTitle(['prop' => true]),
								null,
								null,
								'target="_blank"'
							),
							$sharable->getSharableLicense()->getLink()
						) ?>
					</p>
					<?php if( $sharable->isSharableVideo() ): ?>
					<video class="responsive-video" controls="controls">
						<source src="<?php echo $sharable->getSharablePath() ?>" type="<?php echo $sharable->getSharableMIME() ?>" />
					</video>
					<?php endif ?>
				<?php else: ?>
					<p class="flow-text">
						<?php printf(
							_("Vedi %s distribuibile sotto licenza %s."),
							HTML::a(
								$sharable->getSharablePath(),
								icon('share', 'left') . $sharable->getSharableTitle(['prop' => true]),
								null,
								null,
								'target="_blank"'
							),
							$sharable->getSharableLicense()->getLink()
						) ?>
					</p>
				<?php endif ?>
			</div>
			<?php endwhile ?>
		</div>
	</div>
	<?php endif ?>
{'fraction_non_alphanumeric': 0.21364121470845057, 'fraction_numerical': 0.006985543805180945, 'mean_word_length': 3.229790726302831, 'pattern_counts': {'":': 0, '<': 256, '<?xml version=': 0, '>': 354, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1593353', 'n_tokens_mistral': 4263, 'n_tokens_neox': 3587, 'n_words': 881}