<commit_before><?php
    $crumbs = new stdClass;
    $crumbs->crumbs = array(
        "Events Manager" => "/manager",
        $context->calendar->name => $context->calendar->getManageURL(),
        'Search' => NULL
    );
    echo $savvy->render($crumbs, 'BreadcrumbBar.tpl.php');
?>
<?php
	$total_pages = ceil(count($context->events) / 10);
?>
<form>
    <label for="events-search">Search</label>
    <input type="text" name="search_term" id="events-search" value="<?php echo $context->search_term ?>" />
</form>

<div>
    <?php if (count($context->events) == 0): ?>
        There are no results.
    <?php else: ?>
        <div class="event-page">
            <table class="event-list">
                <thead class="small-hidden">
                    <tr>
                        <th>Title</th>
                        <th>Original Calendar</th>
                        <th>Date/Location</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($context->events as $event): ?>
                        <tr>
                            <td class="small-hidden">
                                <?php if ($event->userCanEdit()): ?>
                                    <a href="<?php echo $event->getEditURL() ?>"><?php echo $event->title; ?></a>
                                <?php else: ?>
                                    <?php echo $event->title; ?>
                                <?php endif; ?>
                            </td>
                            <td class="small-hidden">
                                <?php $calendar = $event->getOriginCalendar() ?>
                                <?php if ($calendar): ?>
                                    <a href="<?php echo $calendar->getFrontendURL() ?>"><?php echo $calendar->name ?></a>
                                <?php endif; ?>
                            </td>
                            <td>
                                <div class="small-block hidden calendar-event-title">
                                    <?php if ($event->userCanEdit()): ?>
                                        <a href="<?php echo $event->getEditURL() ?>">
                                        <?php echo $event->title; ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $event->title; ?>
                                    <?php endif; ?>
                                </div>
                                <ul>
                                <?php $datetimes = $event->getDateTimes(); ?>
                                <?php $count = 0; ?>
                                <?php foreach($datetimes as $datetime): ?>
                                    <li>
                                        <?php if (++$count <= 3) : ?>
                                            <?php 
                                            {
                                                if ($datetime->recurringtype == 'none') {
                                                    echo date('n/d/y @ g:ia', strtotime($datetime->starttime));
                                                } else if ($datetime->recurringtype == 'daily' || $datetime->recurringtype == 'weekly' ||
                                                        $datetime->recurringtype == 'annually') {
                                                    echo ucwords($datetime->recurringtype) . ' @ ' . date('g:ia', strtotime($datetime->starttime)) .
                                                        ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                        ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                } else if ($datetime->recurringtype == 'monthly') {
                                                    if ($datetime->rectypemonth == 'lastday') {
                                                        echo 'Last day of each month @ ' . date('g:ia', strtotime($datetime->starttime)) . 
                                                            ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                            ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                    } else if ($datetime->rectypemonth == 'date') {
                                                        echo ordinal(date('d', strtotime($datetime->starttime))) . 
                                                            ' of each month @ ' . date('g:ia', strtotime($datetime->starttime)) . 
                                                            ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                            ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                    } else {
                                                        echo ucwords($datetime->rectypemonth) . date('f', strtotime($datetime->starttime)) . ' of every month' . 
                                                            ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                            ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                    }
                                                }
                                            }
                                            ?><br>
                                            <?php if (!empty($location = $datetime->getLocation())) echo $location->name; ?>
                                        <?php else: ?>
                                            ...and <?php echo (count($datetimes) - 3); ?> more
                                        <?php break; ?>
                                        <?php endif; ?>
                                    </li>
                                <?php endforeach; ?>
                                </ul>
                                <div class="small-block hidden">
                                    <?php if ($status = $event->getStatusWithCalendar($context->calendar->getRawObject())): ?>
                                        <strong><?php echo ucwords($status); ?></strong> on <?php echo $context->calendar->name ?>
                                    <?php else: ?>
                                        <select 
                                            id="event-action-<?php echo $event->id ?>"
                                            class="searched-event-tools" 
                                            data-id="<?php echo $event->id; ?>"
                                            >
                                                <option value="">Select an Action</option>
                                                <?php if ($user->hasPermission(\UNL\UCBCN\Permission::EVENT_MOVE_TO_UPCOMING_ID, $context->calendar->id)): ?>
                                                    <option value="move-to-upcoming">Move to Upcoming</option>
                                                <?php endif; ?>
                                                <?php if ($user->hasPermission(\UNL\UCBCN\Permission::EVENT_MOVE_TO_PENDING_ID, $context->calendar->id)): ?>
                                                    <option value="move-to-pending">Move to Pending</option>
                                                <?php endif; ?>
                                        </select>
                                        <form id="move-<?php echo $event->id; ?>" method="POST" action="<?php echo $event->getMoveURL($context->calendar) ?>" class="delete-form hidden">
                                        <input type="text" name="new_status" id="move-target-<?php echo $event->id; ?>">
                                        <input type="text" name="event_id" value="<?php echo $event->id ?>">
                                        </form><commit_msg>Old versions of PHP dont like this either<commit_after><?php
    $crumbs = new stdClass;
    $crumbs->crumbs = array(
        "Events Manager" => "/manager",
        $context->calendar->name => $context->calendar->getManageURL(),
        'Search' => NULL
    );
    echo $savvy->render($crumbs, 'BreadcrumbBar.tpl.php');
?>
<?php
	$total_pages = ceil(count($context->events) / 10);
?>
<form>
    <label for="events-search">Search</label>
    <input type="text" name="search_term" id="events-search" value="<?php echo $context->search_term ?>" />
</form>

<div>
    <?php if (count($context->events) == 0): ?>
        There are no results.
    <?php else: ?>
        <div class="event-page">
            <table class="event-list">
                <thead class="small-hidden">
                    <tr>
                        <th>Title</th>
                        <th>Original Calendar</th>
                        <th>Date/Location</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($context->events as $event): ?>
                        <tr>
                            <td class="small-hidden">
                                <?php if ($event->userCanEdit()): ?>
                                    <a href="<?php echo $event->getEditURL() ?>"><?php echo $event->title; ?></a>
                                <?php else: ?>
                                    <?php echo $event->title; ?>
                                <?php endif; ?>
                            </td>
                            <td class="small-hidden">
                                <?php $calendar = $event->getOriginCalendar() ?>
                                <?php if ($calendar): ?>
                                    <a href="<?php echo $calendar->getFrontendURL() ?>"><?php echo $calendar->name ?></a>
                                <?php endif; ?>
                            </td>
                            <td>
                                <div class="small-block hidden calendar-event-title">
                                    <?php if ($event->userCanEdit()): ?>
                                        <a href="<?php echo $event->getEditURL() ?>">
                                        <?php echo $event->title; ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $event->title; ?>
                                    <?php endif; ?>
                                </div>
                                <ul>
                                <?php $datetimes = $event->getDateTimes(); ?>
                                <?php $count = 0; ?>
                                <?php foreach($datetimes as $datetime): ?>
                                    <li>
                                        <?php if (++$count <= 3) : ?>
                                            <?php 
                                            {
                                                if ($datetime->recurringtype == 'none') {
                                                    echo date('n/d/y @ g:ia', strtotime($datetime->starttime));
                                                } else if ($datetime->recurringtype == 'daily' || $datetime->recurringtype == 'weekly' ||
                                                        $datetime->recurringtype == 'annually') {
                                                    echo ucwords($datetime->recurringtype) . ' @ ' . date('g:ia', strtotime($datetime->starttime)) .
                                                        ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                        ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                } else if ($datetime->recurringtype == 'monthly') {
                                                    if ($datetime->rectypemonth == 'lastday') {
                                                        echo 'Last day of each month @ ' . date('g:ia', strtotime($datetime->starttime)) . 
                                                            ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                            ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                    } else if ($datetime->rectypemonth == 'date') {
                                                        echo ordinal(date('d', strtotime($datetime->starttime))) . 
                                                            ' of each month @ ' . date('g:ia', strtotime($datetime->starttime)) . 
                                                            ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                            ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                    } else {
                                                        echo ucwords($datetime->rectypemonth) . date('f', strtotime($datetime->starttime)) . ' of every month' . 
                                                            ': ' . date('n/d/y', strtotime($datetime->starttime)) . 
                                                            ' - ' . date('n/d/y', strtotime($datetime->recurs_until));
                                                    }
                                                }
                                            }
                                            ?><br>
                                            <?php $location = $datetime->getLocation(); ?>
                                            <?php if (!empty($location)) echo $location->name; ?>
                                            <?php else: ?>
                                                ...and <?php echo (count($datetimes) - 3); ?> more
                                            <?php break; ?>
                                            <?php endif; ?>
                                    </li>
                                <?php endforeach; ?>
                                </ul>
                                <div class="small-block hidden">
                                    <?php if ($status = $event->getStatusWithCalendar($context->calendar->getRawObject())): ?>
                                        <strong><?php echo ucwords($status); ?></strong> on <?php echo $context->calendar->name ?>
                                    <?php else: ?>
                                        <select 
                                            id="event-action-<?php echo $event->id ?>"
                                            class="searched-event-tools" 
                                            data-id="<?php echo $event->id; ?>"
                                            >
                                                <option value="">Select an Action</option>
                                                <?php if ($user->hasPermission(\UNL\UCBCN\Permission::EVENT_MOVE_TO_UPCOMING_ID, $context->calendar->id)): ?>
                                                    <option value="move-to-upcoming">Move to Upcoming</option>
                                                <?php endif; ?>
                                                <?php if ($user->hasPermission(\UNL\UCBCN\Permission::EVENT_MOVE_TO_PENDING_ID, $context->calendar->id)): ?>
                                                    <option value="move-to-pending">Move to Pending</option>
                                                <?php endif; ?>
                                        </select>
                                        <form id="move-<?php echo $event->id; ?>" method="POST" action="<?php echo $event->getMoveURL($context->calendar) ?>" class="delete-form hidden">
                                        <input type="text" name="new_status" id="move-target-<?php echo $event->id; ?>">
                                        <input type="text" name="event_id" value="<?php echo $event->id ?>">
                                        </form>
{'fraction_non_alphanumeric': 0.1294304571009533, 'fraction_numerical': 0.0007333170373991689, 'mean_word_length': 0.7778381314502988, 'pattern_counts': {'":': 0, '<': 212, '<?xml version=': 0, '>': 346, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 217, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2884549', 'n_tokens_mistral': 3276, 'n_tokens_neox': 3159, 'n_words': 626}