当前位置: 首页>>代码示例>>PHP>>正文


PHP prettify_mysql_datetime函数代码示例

本文整理汇总了PHP中prettify_mysql_datetime函数的典型用法代码示例。如果您正苦于以下问题:PHP prettify_mysql_datetime函数的具体用法?PHP prettify_mysql_datetime怎么用?PHP prettify_mysql_datetime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了prettify_mysql_datetime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process_registration

 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();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:event_signup.php

示例2: get_links

 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;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:registration_slot.php

示例3: get_markup

 /**
  * 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:36,代码来源:mini_events_list_item.php

示例4: _get_site_page_data

 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:site_pages.php

示例5: get_date_markup

 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";
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:8,代码来源:related_item_with_categories.php

示例6: get_markup

 /**
  * 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:60,代码来源:verbose_events_list_item.php

示例7: run

 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";
         }
     }
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:49,代码来源:active_users.php

示例8: process_registration

 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();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:17,代码来源:event_registration.php

示例9: get_markup

 /**
  * 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:50,代码来源:mini_events_list_ongoing_below.php

示例10: show_item_content

 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";
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:36,代码来源:minutes.php

示例11: get_markup

 /**
  * 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:100,代码来源:hybrid_events_list.php

示例12: turn_into_yyyy_mm

function turn_into_yyyy_mm($val, $format = 'Y-m')
{
    return prettify_mysql_datetime($val . '-01', $format);
}
开发者ID:natepixel,项目名称:reason_package,代码行数:4,代码来源:cleanup_funcs.php

示例13: count

        $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>
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:find_extra_root_pages.php

示例14: get_dates_markup

 /**
  * 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:20,代码来源:events_item.php

示例15: _get_changes_markup

 /**
  * 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');
         }
     }
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:97,代码来源:review_changes.php


注:本文中的prettify_mysql_datetime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。