function process_registration() { $dir = new directory_service(); $dir->search_by_attribute('ds_username', $this->event->get_value('contact_username'), array('ds_email')); $to = $dir->get_first_value('ds_email'); $dates = explode(',', $this->event->get_value('dates')); $date_strings = array(); foreach ($dates as $date) { $date_strings[] = prettify_mysql_datetime(trim($date), 'l, d F Y'); } $subject = 'Event Registration: ' . $_POST["name"] . ' for ' . $this->event->get_value('name'); $body = 'Name: ' . $_POST["name"] . "\n"; /*$body.="Department: ".$_POST["department"]."\n"; $body.="Campus Address: ".$_POST["address"]."\n"; $body.="Campus Postal Address: ".$_POST["postal_address"]."\n"; $body.="Work Phone: ".$_POST["phone"]."\n";*/ $body .= "E-mail Address: " . $_POST["email"] . "\n\n"; $body .= 'Class: ' . $this->event->get_value('name') . "\n\n"; $body .= 'Dates:' . "\n" . implode("\n", $date_strings) . "\n\n"; $body .= 'Time: ' . prettify_mysql_datetime($this->event->get_value('datetime'), 'g:i a') . "\n\n"; $body .= 'Location: ' . $this->event->get_value('location') . "\n\n"; // separated out so we don't repeat the content twice when we write back into the DB $other_info = 'Other Information: ' . "\n" . strip_tags($this->event->get_value('content')) . "\n\n"; // to person who should get registration mail($to, $subject, $body . $other_info, "From: " . strip_tags($_POST["email"])); // to person who filled out email mail(strip_tags($_POST["email"]), $subject, $body . $other_info, "From: " . strip_tags($to)); $values = array('registration' => 'full', 'show_hide' => 'hide', 'content' => $this->event->get_value('content') . '<h3>Registration Information</h3>' . nl2br(htmlspecialchars($body, ENT_QUOTES))); reason_update_entity($this->event->id(), $this->event->get_value('last_edited_by'), $values, true); $this->show_registration_thanks(); }
function get_links() { $links = parent::get_links(); $es = new entity_selector($this->admin_page->site_id); $es->add_type(id_of('event_type')); $es->set_order('dated.datetime DESC'); $values = $es->run_one(); //should adjust so that can't rearrange slots for events that have only one or no registration slots. //also, probably not for past events either. if ($values) { foreach ($values as $event_id => $event) { $es2 = new entity_selector($this->admin_page->site_id); $es2->add_type(id_of('registration_slot_type')); $es2->add_right_relationship($event_id, relationship_id_of('event_type_to_registration_slot_type')); $numSlots = $es2->get_one_count(); if ($numSlots > 1) { $date = $event->get_value('datetime'); $name = 'Sort slots for ' . $event->get_value('name') . ' - ' . prettify_mysql_datetime($date); $link = $this->admin_page->make_link(array('event_id' => $event->id(), 'default_sort' => false), true); $links[$name] = $link; } } $this->links = $links; return $this->links; } }
/** * Get the markup for a given event * * @param object $event * @param string $day mysql-formatted date, e.g. '2013-05-14', or 'ongoing' * @param string $time mysql-formatted time, e.g. '15:30:00', or 'all_day' * @return string markup */ public function get_markup($event, $day, $time) { $ret = ''; $link = ''; $link = $this->bundle->event_link($event, $day); $ret .= $this->bundle->teaser_image($event, $link); if ($time && 'all_day' != $time) { $ret .= prettify_mysql_datetime($event->get_value('datetime'), 'g:i a') . ' - '; } $name = $event->get_value('name'); if (!empty($link)) { $name = '<a href="' . $link . '">' . $name . '</a>'; } $ret .= $name; if ('ongoing' == $day) { if ($event->get_value('_ongoing_through_formatted')) { $ret .= ' <em class="through">(through ' . $event->get_value('_ongoing_through_formatted') . ')</em>'; } } elseif ($event->get_value('_ongoing_starts') == $day) { $ret .= ' <span class="begins">begins</span>'; if ($event->get_value('_ongoing_through_formatted')) { $ret .= ' <em class="through">(through ' . $event->get_value('_ongoing_through_formatted') . ')</em>'; } } elseif ($event->get_value('_ongoing_ends') == $day) { $ret .= ' <span class="ends">ends</span>'; } return $ret; }
function _get_site_page_data() { if (!isset($this->_site_page_data)) { $site_pages = $this->_get_site_pages(); if ($site_pages) { foreach ($site_pages as $k => $v) { $user_entity_lm = $v->get_value('last_edited_by') ? new entity($v->get_value('last_edited_by')) : false; $username_lm = $user_entity_lm && reason_is_entity($user_entity_lm, 'user') ? $user_entity_lm->get_value('name') : '(unknown)'; $user_entity_cb = $v->get_value('created_by') ? new entity($v->get_value('created_by')) : false; $username_cb = $user_entity_cb && reason_is_entity($user_entity_cb, 'user') ? $user_entity_cb->get_value('name') : '(unknown)'; $pretty_date = prettify_mysql_datetime($v->get_value('last_modified')); $page_url = $v->get_value('page_url'); if (!empty($page_url)) { $this->_site_page_data[$k]['page_url'] = $this->_should_provide_html_link() ? '<a href="' . $page_url . '">' . $page_url . '</a>' : $page_url; $this->_site_page_data[$k]['author'] = $v->get_value('author'); $this->_site_page_data[$k]['created_by'] = $username_cb; $this->_site_page_data[$k]['last_edited_by'] = $username_lm; $this->_site_page_data[$k]['last_modified'] = $pretty_date; } } } else { $this->_site_page_data = false; } } return $this->_site_page_data; }
function get_date_markup() { $item = $this->passed_vars['item']; if ($item->get_value('datetime') && $this->passed_vars['use_dates_in_list']) { $datetime = prettify_mysql_datetime($item->get_value('datetime'), $this->passed_vars['date_format']); return '<div class="date"><span>' . $datetime . '</span> in </div>' . "\n"; } }
/** * Get the markup for a given event * * @param object $event * @param string $day mysql-formatted date, e.g. '2013-05-14', or 'ongoing' * @param string $time mysql-formatted time, e.g. '15:30:00', or 'all_day' * @return string markup */ public function get_markup($event, $day, $time) { if (empty($this->bundle)) { trigger_error('Call set_bundle() on this object before calling get_markup()'); return ''; } $ret = ''; $link = ''; $link = $this->bundle->event_link($event, $day); $ret .= $this->bundle->teaser_image($event, $link); $name = $event->get_value('name'); if (!empty($link)) { $name = '<a href="' . $link . '">' . $name . '</a>'; } $ret .= $name; if ('ongoing' == $day) { if ($event->get_value('_ongoing_through_formatted')) { $ret .= ' <em class="through">(through ' . $event->get_value('_ongoing_through_formatted') . ')</em>'; } } elseif ($event->get_value('_ongoing_starts') == $day) { $ret .= ' <span class="begins">begins</span>'; if ($event->get_value('_ongoing_through_formatted')) { $ret .= ' <em class="through">(through ' . $event->get_value('_ongoing_through_formatted') . ')</em>'; } } elseif ($event->get_value('_ongoing_ends') == $day) { $ret .= ' <span class="ends">ends</span>'; } $desc_str = ''; $time_loc_str = ''; if ($event->get_value('description')) { $desc_str = '<li class="description">' . $event->get_value('description') . '</li>' . "\n"; } $time_loc = array(); if ($time && 'all_day' != $time) { $time_loc[] = '<span class="time">' . prettify_mysql_datetime($event->get_value('datetime'), 'g:i a') . '</span>'; } if ($event->get_value('location')) { $time_loc[] = '<span class="location">' . $event->get_value('location') . '</span>'; } if (!empty($time_loc)) { $time_loc_str = '<li class="timeLocation">' . implode(', ', $time_loc) . '</li>' . "\n"; } if ($desc_str || $time_loc_str) { $ret .= '<ul>' . "\n" . $desc_str . $time_loc_str . '</ul>' . "\n"; } if ($event->get_value('_inline_editable')) { $before = '<div class="editable"><div class="editRegion">' . "\n"; $after = ' <a href="' . $event->get_value('_inline_editable_link') . '" class="editThis">Edit Event</a></div></div>' . "\n"; $ret = $before . $ret . $after; } return $ret; }
function run() { if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) { echo 'Sorry; you do not have the rights to view this information.'; return; } // get audiences in REason $es = new entity_selector(); $es->add_type(id_of('audience_type')); $audiences = $es->run_one(); $options = array(); foreach ($audiences as $aud) { $options[$aud->get_value('directory_service_value')] = $aud->get_value('name'); } $d = new disco(); $d->add_element('active_since', 'textdatetime'); $d->add_element('affiliations', 'checkboxgroup', array('options' => $options)); $d->set_display_name('affiliations', 'Audiences'); $d->add_comments('affiliations', form_comment('Leaving these checkboxes blank won\'t filter the results.')); $d->set_actions(array('run' => 'Run')); $d->run(); if ($d->get_value('active_since')) { $user_ids = $this->_get_active_user_ids($d->get_value('active_since')); echo count($user_ids) . ' Reason users modified at least one item since ' . prettify_mysql_datetime($d->get_value('active_since')) . '<br />'; if ($d->get_value('affiliations')) { $affiliations = array_values($d->get_value('affiliations')); } else { $affiliations = array(); } $users = $this->_get_active_users_from_ids($user_ids, $affiliations); echo '<br />' . count($users) . ' of the above users currently have access to at least one site<br />'; if (!empty($users)) { echo '<textarea rows="12">' . "\n"; $usernames = array(); foreach ($users as $user) { $usernames[$user->id()] = $user->get_value('name'); } echo implode(', ', $usernames); echo '</textarea>' . "\n"; } $emails = $this->_get_email_addresses_from_users($users); echo '<br />' . count($emails) . ' of the users with site access have an email addresses in the directory<br />'; if (!empty($emails)) { echo '<textarea rows="12">' . "\n"; echo implode(', ', $emails); echo '</textarea>' . "\n"; } } }
function process_registration() { $dir = new directory_service(); $dir->search_by_attribute('ds_username', $this->event->get_value('contact_username'), array('ds_email')); $to = $dir->get_first_value('ds_email'); $subject = 'Event Registration: ' . $_POST["name"] . ' for ' . $this->event->get_value('name'); $body = 'Name: ' . $_POST["name"] . "\n"; $body .= "E-mail Address: " . $_POST["email"] . "\n\n"; $body .= 'Class: ' . $this->event->get_value('name') . "\n\n"; $body .= 'Date & Time: ' . prettify_mysql_datetime($this->event->get_value('datetime'), 'm/d/Y \\a\\t g:i a') . "\n\n"; $body .= 'Location: ' . $this->event->get_value('location') . "\n\n"; // to person who should get registration mail($to, $subject, $body, "From: " . strip_tags($_POST["email"])); // to person who filled out email mail(strip_tags($_POST["email"]), $subject, $body, "From: " . strip_tags($to)); $this->show_registration_thanks(); }
/** * Get the list markup * * @return string markup */ public function get_markup() { if (empty($this->bundle)) { trigger_error('Call set_bundle() before calling get_markup()'); return ''; } $ret = ''; if ($events = $this->bundle->events($this->get_ongoing_display_type())) { $prev_month = ''; $prev_year = ''; foreach ($events as $day => $times) { if ('ongoing' == $day) { continue; } $today = $day == $this->bundle->today() ? ' (Today)' : ''; $ret .= '<div class="dayblock" id="dayblock_' . $day . '">' . "\n"; $ret .= '<h4 class="day"><a name="' . $day . '"></a>' . prettify_mysql_datetime($day, 'D. M. j') . $today . '</h4>' . "\n"; $ret .= '<ul class="dayEvents">'; foreach ($times as $time => $events) { foreach ($events as $event) { $ret .= '<li class="event">'; $ret .= $this->bundle->list_item_markup($event, $day, $time); $ret .= '</li>' . "\n"; } } $ret .= '</ul>' . "\n"; $ret .= '</div>' . "\n"; } if (!empty($events['ongoing'])) { $ret .= '<div class="ongoingblock">' . "\n"; $ret .= '<h4>Ongoing</h4>' . "\n"; $ret .= '<ul class="ongoingEvents">' . "\n"; foreach ($events['ongoing'] as $time => $ongoing_events) { foreach ($ongoing_events as $event) { $ret .= '<li class="event">'; $ret .= $this->bundle->list_item_markup($event, 'ongoing', $time); $ret .= '</li>' . "\n"; } } $ret .= '</ul>' . "\n"; $ret .= '</div>' . "\n"; } } return $ret; }
function show_item_content($item) { $plural = ''; $time = ''; $time = prettify_mysql_datetime($item->get_value('datetime'), 'g:i a'); if ($item->get_value('location') || $time != '12:00 am' || $item->get_value('present_members') || $item->get_value('absent_members') || $item->get_value('guests') || $item->get_value('bigger_author')) { echo "\n" . '<ul class="minutesInfo">' . "\n"; if ($item->get_value('location')) { echo '<li class="location"><em>Location:</em> ' . $item->get_value('location') . '</li>' . "\n"; } if ($time != '12:00 am') { echo '<li class="time"><em>Time:</em> ' . $time . '</li>' . "\n"; } if ($item->get_value('present_members')) { echo '<li class="present"><em>Present:</em> ' . $item->get_value('present_members') . '</li>' . "\n"; } if ($item->get_value('absent_members')) { echo '<li class="absent"><em>Absent:</em> ' . $item->get_value('absent_members') . '</li>' . "\n"; } if ($item->get_value('guests')) { echo '<li class="guests"><em>Guests:</em> ' . $item->get_value('guests') . '</li>' . "\n"; } if ($item->get_value('bigger_author')) { echo '<li class="secretary"><em>Secretary:</em> ' . $item->get_value('bigger_author') . '</li>' . "\n"; } if ($item->get_value('keywords')) { echo '<li class="keywords"><em>Keywords:</em> ' . $item->get_value('keywords') . '</li>' . "\n"; } echo "\n" . '</ul>' . "\n"; } if ($item->get_value('bigger_content')) { $search = array('<h3>', '</h3>'); $replace = array('<h4>', '</h4>'); echo '<div class="minutesContent">' . str_replace($search, $replace, $item->get_value('bigger_content')) . '</div>' . "\n"; } }
/** * Get the list chrome markup * @return string markup */ public function get_markup() { if (empty($this->bundle)) { trigger_error('Call set_bundle() before calling get_markup()'); return ''; } $ret = ''; if ($events = $this->bundle->events($this->get_ongoing_display_type())) { $prev_month = ''; $prev_year = ''; $upcoming = array(); $archive = array(); foreach ($events as $day => $times) { if ('ongoing' == $day) { $upcoming[$day] = $times; } elseif ($day < $this->bundle->today()) { $archive[$day] = $times; } else { $upcoming[$day] = $times; } } if (!empty($upcoming)) { $ret .= '<div class="upcoming">' . "\n"; if (!empty($archive)) { $ret .= '<h3 class="upcoming">Upcoming</h3>' . "\n"; } if (!empty($upcoming['ongoing'])) { $ret .= '<div class="ongoingblock">' . "\n"; $ret .= '<h4>Ongoing</h4>' . "\n"; $ret .= '<ul class="ongoingEvents">' . "\n"; foreach ($upcoming['ongoing'] as $time => $events) { foreach ($events as $event) { $ret .= '<li class="event">'; $ret .= $this->bundle->list_item_markup($event, 'ongoing', $time); $ret .= '</li>' . "\n"; } } $ret .= '</ul>' . "\n"; $ret .= '</div>' . "\n"; } foreach ($upcoming as $day => $times) { if ('ongoing' == $day) { continue; } if ($prev_month != substr($day, 5, 2) || $prev_year != substr($day, 0, 4)) { $ret .= '<h4 class="month">' . prettify_mysql_datetime($day, 'F Y') . '</h4>' . "\n"; $prev_month = substr($day, 5, 2); $prev_year = substr($day, 0, 4); } $today = $day == $this->bundle->today() ? ' (Today)' : ''; $ret .= '<div class="dayblock" id="dayblock_' . $day . '">' . "\n"; $ret .= '<h5 class="day"><a name="' . $day . '"></a>' . prettify_mysql_datetime($day, 'l, F jS') . $today . '</h5>' . "\n"; $ret .= '<ul class="dayEvents">'; foreach ($times as $time => $events) { foreach ($events as $event) { $ret .= '<li class="event">'; $ret .= $this->bundle->list_item_markup($event, $day, $time); $ret .= '</li>' . "\n"; } } $ret .= '</ul>' . "\n"; $ret .= '</div>' . "\n"; } $ret .= '</div>' . "\n"; } $prev_month = ''; $prev_year = ''; if (!empty($archive)) { $ret .= '<div class="archive">' . "\n"; if (!empty($upcoming)) { $ret .= '<h3 class="archive">Archive</h3>' . "\n"; } foreach (array_reverse($archive, true) as $day => $times) { if ($prev_month != substr($day, 5, 2) || $prev_year != substr($day, 0, 4)) { $ret .= '<h4 class="month">' . prettify_mysql_datetime($day, 'F Y') . '</h4>' . "\n"; $prev_month = substr($day, 5, 2); $prev_year = substr($day, 0, 4); } $ret .= '<div class="dayblock" id="dayblock_' . $day . '">' . "\n"; $ret .= '<h5 class="day"><a name="' . $day . '"></a>' . prettify_mysql_datetime($day, 'l, F jS') . '</h5>' . "\n"; $ret .= '<ul class="dayEvents">'; foreach ($times as $time => $events) { foreach ($events as $event) { $ret .= '<li class="event">'; $ret .= $this->bundle->list_item_markup($event, $day, $time); $ret .= '</li>' . "\n"; } } $ret .= '</ul>' . "\n"; $ret .= '</div>' . "\n"; } $ret .= '</div>' . "\n"; } } return $ret; }
function turn_into_yyyy_mm($val, $format = 'Y-m') { return prettify_mysql_datetime($val . '-01', $format); }
$es->limit_tables(); $es->limit_fields(); $meta = $es->add_left_relationship_field('minisite_page_parent', 'entity', 'id', 'parent_id'); $str = $meta['parent_id']['table'] . "." . $meta['parent_id']['field']; $es->add_relation('entity.id = ' . $str); $result = $es->run_one(); $count = count($result); if ($count > 1) { $site = new entity($site_id); $report .= '<h3>The site "' . $site->get_value('name') . '" has ' . $count . ' root pages.</h3>'; $report .= '<ul>'; foreach ($result as $page) { $last_mod = $page->get_value('last_modified'); $page_name = $page->get_value('name'); $page_name = !empty($page_name) ? $page_name : '<em>Untitled</em>'; $report .= '<li>' . $page_name . ' (id is ' . $page->id() . ', last modified ' . prettify_mysql_datetime($last_mod) . ')</li>'; } $report .= '</ul>'; } } if (!empty($report)) { echo '<h2>Found sites with multiple root pages</h2>'; echo $report; echo '<p><strong>You should go into the site editing interface, edit pages, choose "list view", and delete the rogue root page(s).</strong></p>'; } else { echo '<h2>Congratulations!</h2>'; echo '<p>Your instance of Reason does not have any sites that contain multiple root pages.</p>'; } } ?> </body>
/** * Get HTML that shows the dates a given event occurs on * @param object $event event * @return string */ protected function get_dates_markup($event) { $ret = ''; $dates = explode(', ', $event->get_value('dates')); if (count($dates) > 1 || !$this->bundle->request_date() || !strstr($event->get_value('dates'), $this->bundle->request_date())) { $ret .= '<div class="dates"><h4>This event occurs on:</h4>' . "\n"; $ret .= '<ul>' . "\n"; foreach ($dates as $date) { $ret .= '<li>' . prettify_mysql_datetime($date, "l, F jS, Y") . '</li>' . "\n"; } $ret .= '</ul>' . "\n"; $ret .= '</div>' . "\n"; } return $ret; }
/** * Get the markup for a given date range, type (optional) and site (optional) * * @param string $start_date * @param string $end_date * @param integer $type_id * @param integer $site_id * @return string markup */ function _get_changes_markup($start_date, $end_date, $type_id = '', $site_id = '', $mod_user = '', $sort = '') { if ($start_date == $end_date) { echo '<p>Items added or edited on ' . prettify_mysql_datetime($start_date) . '</p>' . "\n"; } else { echo '<p>Items added or edited between ' . prettify_mysql_datetime($start_date) . ' and ' . prettify_mysql_datetime($end_date) . '</p>' . "\n"; } $types = $this->_get_types(); $sites = $this->_get_sites(); if ($site_id) { $site_param = $site_id; } else { $site_param = array_keys($sites); } foreach ($types as $type) { if ($type_id && $type_id != $type->id()) { continue; } $es = new entity_selector($site_param); $es->add_type($type->id()); $es->add_relation('entity.last_modified >= "' . $start_date . '"'); $es->add_relation('entity.last_modified <= "' . $end_date . ' 23:59:59"'); if ($mod_user) { $es->add_relation('entity.last_edited_by = "' . addslashes($mod_user) . '"'); } if ($sort && ('ASC' == $sort || 'DESC' == $sort)) { $es->set_order('entity.last_modified ' . $sort); } $es->set_sharing('owns'); $changes = $es->run_one(); $deletions = $es->run_one('', 'Deleted'); if (!empty($changes) || !empty($deletions)) { $plural_word = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name'); echo '<div class="' . htmlspecialchars($type->get_value('unique_name')) . '_report">' . "\n"; echo '<h3>' . $plural_word . '</h3>' . "\n"; if (!empty($changes)) { echo '<h4>Changes: ' . count($changes) . '</h4>' . "\n"; echo '<ul class="changes">' . "\n"; foreach ($changes as $item) { $change_type = 'change'; if ($item->get_value('creation_date') > $start_date && $item->get_value('creation_date') <= $end_date . ' 23:59:59') { $change_type = 'addition'; } echo '<li class="' . $change_type . '">'; if ($change_type == 'change') { echo '<a href="' . $this->_get_archive_link($item, $start_date, $end_date) . '">' . $item->get_display_name() . '</a>'; } else { echo '<a href="' . $this->_get_preview_link($item) . '">' . $item->get_display_name() . '</a> (new)'; } if (empty($site_id) && ($owner = $item->get_owner())) { echo '<div class="owner">' . $owner->get_value('name') . '</div>' . "\n"; } $lastmod = $item->get_value('last_edited_by'); if ($lastmod) { $user = new entity($lastmod); if ($user->get_values()) { echo '<div class="lastmod">Last modified by: ' . $user->get_value('name') . ' on ' . date("F j, Y - g:i a", strtotime($item->get_value('last_modified'))) . '</div>'; } } echo '</li>' . "\n"; } echo '</ul>' . "\n"; } if (!empty($deletions)) { echo '<h4>Deletions: ' . count($deletions) . '</h4>' . "\n"; echo '<ul class="deletions">' . "\n"; foreach ($deletions as $item) { echo '<li class="deletion">'; echo '<a href="' . $this->_get_preview_link($item) . '">' . $item->get_display_name() . '</a>'; if (empty($site_id) && ($owner = $item->get_owner())) { echo '<div class="owner">' . $owner->get_value('name') . '</div>' . "\n"; } $lastmod = $item->get_value('last_edited_by'); if ($lastmod) { $user = new entity($lastmod); if ($user->get_values()) { echo '<div class="lastmod">Deleted by: ' . $user->get_value('name') . '</div>'; } } echo '</li>' . "\n"; } echo '</ul>' . "\n"; } echo '</div>' . "\n"; //die('foo'); } } }
if (count($events)) { // Ask the admin page class for the token that will allow us // to complete the borrow action. $admin = new AdminPage(); $params['admin_token'] = $admin->get_admin_token(); echo '<p>Click an event to add it to the <em>' . $_REQUEST['site'] . '</em> calendar:</p>'; echo '<ul class="preview_list">'; foreach ($events as $event) { $classes = array($event->get_value('show_hide') . '_status'); if ($editing_id == $event->get_value('id')) { $classes[] = 'current'; } echo '<li class="' . join(' ', $classes) . '">'; $params['id'] = $event->get_value('id'); if (substr($event->get_value('datetime'), 11) != '00:00:00') { $time = prettify_mysql_datetime($event->get_value('datetime'), 'g:ia'); } else { $time = 'All day'; } if ($event->get_value('show_hide') == 'tentative') { $time .= '<br /><span class="label">tentative</span>'; } echo '<span class="preview_time">' . $time . ' </span>'; echo '<span class="preview_name">'; // Get the owner site for the event; we don't want events from the current site to look borrowable $owner = $event->get_owner(); if ($params['site_id'] != $owner->id()) { echo '<a class="nav" href="#" onclick = \'borrow_confirm("' . carl_make_link($params, $_REQUEST['path']) . '", ' . $event->get_value('id') . '); return false;\' title="Add this event to your calendar">'; echo $event->get_value('name') . '</a>'; } else { echo $event->get_value('name');
function get_display_value_classified_date_available($value, &$item, $summary_mode) { return prettify_mysql_datetime($value); }
function get_event_info_html(&$disco) { $dates = $this->_get_dates_from_event($this->_event); $ret = '<p>The event "' . $this->_event->get_value('name') . '" occurs on ' . count($dates) . ' dates:</p>' . "\n"; $ret .= '<ul>' . "\n"; foreach ($dates as $date) { $ret .= '<li>' . prettify_mysql_datetime($date) . '</li>' . "\n"; } $ret .= '</ul>' . "\n"; $ret .= '<p>Would you like to break this event up into ' . count($dates) . ' separate event items, one for each occurrence?</p>' . "\n"; $ret .= '<p>Note that you only need to do this if you want to change the name/description/time for some (but not all) of the occurrences.</p>' . "\n"; return $ret; }
/** * Display the markup listing possible dates for registration * * We require a specific date to be passed in order to register for an event * * If only one date is available, redirect to that date ... otherwise show a screen that allows a date selection * * @param object $event event entity * @return void * @todo Move to a markup class */ function show_registration_dates($event) { $possible_dates = $this->get_possible_registration_dates($event); if (count($possible_dates) == 1) // redirect to the date { $date = $possible_dates[0]; $link = carl_make_redirect(array('date' => $date)); header("Location: " . $link); exit; } elseif(!empty($possible_dates)) { echo '<h3>To register, please choose a date</h3>'; echo '<ul>'; foreach ($possible_dates as $the_date) { $link = carl_make_link(array('date' => $the_date)); echo '<li>'; echo '<a href="'. $link . '">'.prettify_mysql_datetime($the_date).'</a>'; echo '</li>'; } echo '</ul>'; } }
protected function display_metadata($policy) { if ($approvals = $this->get_approvals($policy)) { foreach($approvals as $approval_id => $approval_policy) { echo '<div class="approvals">'; echo $this->get_approval_text($approval_policy, ($approval_id != $policy->id())); echo "</div>\n"; } } if ($policy->get_value( 'last_revised_date' ) > '0000-00-00' ) { echo '<div class="revised">'; echo 'Last revised '.prettify_mysql_datetime($policy->get_value('last_revised_date'),'F j, Y'); echo "</div>\n"; } $audiences = $this->get_audiences($policy); if(!empty($audiences)) { $audience_names = array(); foreach($audiences as $audience) $audience_names[] = '<a href="'.$this->get_audience_link($audience).'">'.$audience->get_value('name').'</a>'; echo '<div class="audiences">'; echo 'For '.implode(', ',$audience_names); echo "</div>\n"; } if($policy->get_value( 'keywords' )) { echo '<div class="keywords">Keywords: '.$policy->get_value( 'keywords' ).'</div>'."\n"; } }
function get_date_information($item) { $ret = ''; if($item->get_value('datetime') && $item->get_value('datetime') != '0000-00-00 00:00:00') { $ret .= '<span class="created">'; if($item->get_value('media_publication_datetime')) $ret .= 'Created '; $ret .= prettify_mysql_datetime($item->get_value('datetime'),$this->date_format).'</span>'; if($item->get_value('media_publication_datetime')) $ret .= '; '; } if($item->get_value('media_publication_datetime')) { $ret .= '<span class="published">Published '.prettify_mysql_datetime($item->get_value('media_publication_datetime'),$this->date_format).'</span>'; } return $ret; }
/** * Format a date to be shown in a "through [formatted date]" phrase * * @param object $event entity * @return string formatted date */ function _get_formatted_end_date($event) { $full_month = prettify_mysql_datetime($event->get_value('last_occurence'), 'F'); $month = prettify_mysql_datetime($event->get_value('last_occurence'), 'M'); $ret = $month; if ($full_month != $month) { $ret .= '.'; } $ret .= ' '; $ret .= prettify_mysql_datetime($event->get_value('last_occurence'), 'j'); $start_year = max(substr($event->get_value('datetime'), 0, 4), substr($this->eh->calendar->get_start_date(), 0, 4)); if ($start_year != substr($event->get_value('last_occurence'), 0, 4)) { $ret .= ', ' . substr($event->get_value('last_occurence'), 0, 4); } return $ret; }
function show_registration_error_message() { echo '<div class="formResponse">' . "\n"; echo '<h4>Sorry.</h4>' . "\n"; echo '<p>We were unable to process your registration at this time. The webmaster (' . WEBMASTER_NAME . ') has been notified. Please try again later.</p>'; echo '</div>' . "\n"; $to = WEBMASTER_EMAIL_ADDRESS; $subject = 'Slot registration error'; $body = "There was an error with slot registration for " . $this->event->get_value('name') . '.' . "\n\n"; $body = "The following person was not successfully registered\n\n"; $body .= 'Name: ' . $this->get_value('name') . "\n"; $body .= "E-mail Address: " . $this->get_value('email') . "\n"; $body .= 'Date: ' . prettify_mysql_datetime($this->request_array['date'], 'm/d/Y') . "\n"; mail($to, $subject, $body, "From: " . strip_tags($this->get_value('email'))); }
function _get_issue_label($issue) { $name = $issue->get_value('name'); if (!empty($this->passed_vars['links_to_issues'][$issue->id()])) { $name = '<a href="' . $this->passed_vars['links_to_issues'][$issue->id()] . '">' . $name . '</a>'; } if ($issue->get_value('show_hide') == 'hide') { $name = '[Unpublished] ' . $name; } $date = prettify_mysql_datetime($issue->get_value('datetime'), $this->passed_vars['date_format']); return $name . ' <span class="date">(' . $date . ')</span>'; }
function show_daily_events($day) { ob_start(); foreach ($this->events_by_date[$day] as $event_id) { $ongoing_type = $this->get_event_ongoing_type_for_day($event_id, $day); if ('middle' == $ongoing_type) { continue; } echo '<li class="event">'; $this->show_event_list_item($event_id, $day, $ongoing_type); echo '</li>' . "\n"; } $list_items = ob_get_clean(); if (empty($list_items)) { return; } if ($this->show_months == true && ($this->prev_month != substr($day, 5, 2) || $this->prev_year != substr($day, 0, 4))) { echo '<h4 class="month">' . prettify_mysql_datetime($day, 'F Y') . '</h4>' . "\n"; $this->prev_month = substr($day, 5, 2); $this->prev_year = substr($day, 0, 4); } if ($day == $this->today) { $today = ' (Today)'; } else { $today = ''; } echo '<h5 class="day">' . prettify_mysql_datetime($day, $this->list_date_format) . $today . '</h5>' . "\n"; echo '<ul>'; echo $list_items; echo '</ul>' . "\n"; }
function show_item_field_datetime($field, $value) { $this->show_item_default($field, prettify_mysql_datetime($value, "M jS, Y, g:i a")); }
function show_list_item_date( $item ) { if($this->use_dates_in_list && $item->get_value( 'datetime' ) ) echo '<div class="smallText date">'.prettify_mysql_datetime( $item->get_value( 'datetime' ), $this->date_format ).'</div>'."\n"; }
public function date_range_phrase() { if (substr($this->_event->get_value('datetime'), 0, 10) == $this->_event->get_value('last_occurence')) { if (mb_strlen(prettify_mysql_datetime($this->_event->get_value('datetime'), 'F')) > 3) { $format = 'M. j, Y'; } else { $format = 'M j, Y'; } return prettify_mysql_datetime($this->_event->get_value('datetime'), $format); } $diff_years = true; $diff_months = true; $start_year = substr($this->_event->get_value('datetime'), 0, 4); $end_year = substr($this->_event->get_value('last_occurence'), 0, 4); if ($start_year == $end_year) { $diff_years = false; $start_month = substr($this->_event->get_value('datetime'), 5, 2); $end_month = substr($this->_event->get_value('last_occurence'), 5, 2); if ($start_month == $end_month) { $diff_months = false; } } if (mb_strlen(prettify_mysql_datetime($this->_event->get_value('datetime'), 'F')) > 3) { $start_format = 'M. j'; } else { $start_format = 'M j'; } if ($diff_years) { $start_format .= ', Y'; } if ($diff_months) { if (mb_strlen(prettify_mysql_datetime($this->_event->get_value('last_occurence'), 'F')) > 3) { $end_format = 'M. j, Y'; } else { $end_format = 'M j, Y'; } } else { $end_format = 'j, Y'; } $ret = prettify_mysql_datetime($this->_event->get_value('datetime'), $start_format); $ret .= ' ' . html_entity_decode('–', ENT_NOQUOTES, 'UTF-8') . ' '; $ret .= prettify_mysql_datetime($this->_event->get_value('last_occurence'), $end_format); return $ret; }
/** * Get the list markup * * @return string markup */ public function get_markup() { if(empty($this->bundle)) { trigger_error('Call set_bundle() before calling get_markup()'); return ''; } $ret = ''; if($events = $this->bundle->events($this->get_ongoing_display_type())) { $prev_month = ''; $prev_year = ''; $show_months = true; $calendar = $this->bundle->calendar(); if(!empty($calendar) && ($calendar->get_view() == 'daily' || $calendar->get_view() == 'weekly') ) { $show_months = false; } if(!empty($events['ongoing'])) { $ret .= '<div class="ongoingblock">'."\n"; $ret .= '<h3>Ongoing</h3>'."\n"; $ret .= '<ul class="ongoingEvents">'."\n"; foreach($events['ongoing'] as $time => $ongoing_events) { foreach($ongoing_events as $event) { $ret .= '<li class="event">'; $ret .= $this->bundle->list_item_markup($event, 'ongoing', $time); $ret .= '</li>'."\n"; } } $ret .= '</ul>'."\n"; $ret .= '</div>'."\n"; } foreach($events as $day => $times) { if('ongoing' == $day) continue; if($show_months && ($prev_month != substr($day,5,2) || $prev_year != substr($day,0,4) ) ) { $ret .= '<h3 class="month">'.prettify_mysql_datetime( $day, 'F Y' ).'</h3>'."\n"; $prev_month = substr($day,5,2); $prev_year = substr($day,0,4); } $today = ($day == $this->bundle->today()) ? ' (Today)' : ''; $ret .= '<div class="dayblock" id="dayblock_'.$day.'">'."\n"; $ret .= '<h4 class="day"><a name="'.$day.'"></a>'.prettify_mysql_datetime( $day, 'l, F jS' ).$today.'</h4>'."\n"; $ret .= '<ul class="dayEvents">'; foreach($times as $time => $events) { foreach($events as $event) { $ret .= '<li class="event">'; $ret .= $this->bundle->list_item_markup($event, $day, $time); $ret .= '</li>'."\n"; } } $ret .= '</ul>'."\n"; $ret .= '</div>'."\n"; } } return $ret; }
public function contains_any_events_before($date) { if (!$this->contains_any_events()) { return false; } if (!empty($this->known_lower_limit) && $this->known_lower_limit < $date) { //echo '<strong>contains_any_events_before</strong>: req.date ('.$date.') after kll ('.$this->known_lower_limit.'); ret true<br />'; return true; } elseif (!empty($this->known_closest_date_before) && $this->known_closest_date_before > $date) { //echo '<strong>contains_any_events_before</strong>: req.date ('.$date.') before kcdb ('.$this->known_closest_date_before.'); ret false<br />'; return false; } $test_es = carl_clone($this->base_es); $test_es->set_num(1); $test_es->add_relation(table_of('datetime', id_of('event_type')) . ' < "' . reason_sql_string_escape($date) . '"'); $test_es->limit_fields(); $test_es->exclude_tables_dynamically(); $test_es->set_cache_lifespan($this->_get_cache_lifespan_meta()); $test_results = $test_es->run_one(); if (!empty($test_results)) { $result = current($test_results); //echo '<strong>contains_any_events_before</strong>: found event before req.date '.$date.'. id: '.$result->id().'; datetime: '.$result->get_value('datetime').'; ret true<br />'; $date = prettify_mysql_datetime($result->get_value('datetime'), 'Y-m-d'); $this->known_lower_limit = carl_date('Y-m-d', strtotime($date . ' -1 day')); return true; } else { //echo '<strong>contains_any_events_before</strong>: no events found before req.date ('.$date.'); ret false<br />'; $this->known_closest_date_before = $date; return false; } }