예제 #1
0
 /**
  * When the plugin is updated to a newer version the code here
  * will make any ammendments which are required.
  */
 public function upgrade()
 {
     global $wpdb;
     if (version_compare($this->plugin_installed_version(), '1.1.3') < 0) {
         $result = $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => 'syn_rest_menu'), array('taxonomy' => 'syn_rest_menu'));
         $result = $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => 'syn_rest_course'), array('taxonomy' => 'syn_menu_course'));
         $result = $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => 'syn_rest_diet'), array('taxonomy' => 'syn_dietary_type'));
         $result = $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => 'syn_rest_cuisine'), array('taxonomy' => 'syn_cuisine_type'));
     }
     if (version_compare($this->plugin_installed_version(), '1.2.0') < 0) {
         $events_data = new events_data();
         $events_data->create_table();
         $eventmeta_data = new eventmeta_data();
         $eventmeta_data->create_table();
     }
 }
 function display_rows()
 {
     $even_odd = 'odd alt';
     $records = $this->items;
     list($columns, $hidden) = $this->get_column_info();
     if (!empty($records)) {
         foreach ($records as $rec) {
             $even_odd = 'odd alt' != $even_odd ? 'odd alt' : 'even';
             //Open the line
             echo '<tr id="record_' . $rec->id . '" class="' . $even_odd . ' ' . $rec->event_type . '">';
             foreach ($columns as $column_name => $column_display_name) {
                 //Style attributes for each col
                 $class = "class='{$column_name} column-{$column_name}'";
                 $style = "";
                 if (in_array($column_name, $hidden)) {
                     $style = ' style="display:none;"';
                 }
                 $attributes = $class . $style;
                 $date_format = get_option('date_format');
                 $time_format = get_option('time_format');
                 //edit link
                 $editlink = '/wp-admin/link.php?action=edit&link_id=' . (int) $rec->id;
                 $comment_date = date("{$date_format}", strtotime($rec->created_date));
                 $comment_time = date("{$time_format}", strtotime($rec->created_date));
                 $event_created = sprintf("%s at %s", $comment_date, $comment_time);
                 $meta_data = $event_type = '';
                 $eventmeta_data = new eventmeta_data();
                 switch ($rec->event_type) {
                     case 'email':
                         $recipient_name = $eventmeta_data->get($rec->id, 'recipient_name');
                         $email_address = $eventmeta_data->get($rec->id, 'email_address');
                         $email_subject = $eventmeta_data->get($rec->id, 'email_subject');
                         $email_status = $eventmeta_data->get($rec->id, 'email_status');
                         $meta_data = '<span class="recipient">' . $recipient_name . '</span><span class="email-address">' . $email_address . '</span><span class="email-subject">' . $email_subject . '</span>';
                         $event_type = '<span class="event-icon rman-envelope"></span>';
                         break;
                     case 'sms':
                         $recipient_name = $eventmeta_data->get($rec->id, 'recipient_name');
                         $mobile_number = $eventmeta_data->get($rec->id, 'mobile_number');
                         $sms_status = $eventmeta_data->get($rec->id, 'sms_status');
                         $meta_data = '<span class="recipient">' . $recipient_name . '</span><span class="mobile-number">' . $mobile_number . '</span>';
                         $event_type = '<span class="event-icon rman-mobile-phone"></span>';
                         break;
                     case 'reservation_status':
                         $recipient_name = $eventmeta_data->get($rec->id, 'recipient_name');
                         $old_status = $eventmeta_data->get($rec->id, 'old_status');
                         $new_status = $eventmeta_data->get($rec->id, 'new_status');
                         $email_sent = $eventmeta_data->get($rec->id, 'email_sent');
                         $meta_data = '<span class="status-light status-' . $old_status . '"></span> ' . $old_status . ' &RightArrow; ' . '<span class="status-light status-' . $new_status . '"></span> ' . $new_status . '   |   ' . __('Email Notification: ') . ($email_sent ? __('Sent') : __('Not Sent'));
                         $event_type = '<span class="status-light status-' . $new_status . '"></span>';
                         break;
                 }
                 //Display the cell
                 switch ($column_name) {
                     case "author":
                         echo '<td ' . $attributes . '>' . stripslashes($rec->author) . '</td>';
                         break;
                     case "content":
                         echo '<td ' . $attributes . '>' . $meta_data . '<p class="content">' . $rec->content . '</p></td>';
                         break;
                     case "event_type":
                         echo '<td ' . $attributes . '>' . $event_type . '</td>';
                         break;
                     case "created_date":
                         echo '<td ' . $attributes . '>' . $event_created . '</td>';
                         break;
                 }
             }
             //Close the line
             echo '</tr>';
         }
     }
 }