コード例 #1
0
ファイル: eme_people.php プロジェクト: johnmanlove/Bridgeland
function eme_printable_booking_report($event_id) {
   global $eme_timezone;
   $event = eme_get_event($event_id);
   $current_userid=get_current_user_id();
   if (!(current_user_can( get_option('eme_cap_edit_events')) || current_user_can( get_option('eme_cap_list_events')) ||
        (current_user_can( get_option('eme_cap_author_event')) && ($event['event_author']==$current_userid || $event['event_contactperson_id']==$current_userid)))) {
        echo "No access";
        die;
   }

   $is_multiprice = eme_is_multi($event['price']);
   $is_multiseat = eme_is_multi($event['event_seats']);
   $bookings = eme_get_bookings_for($event_id);
   $answer_columns = eme_get_answercolumns(eme_get_bookingids_for($event_id));
   $available_seats = eme_get_available_seats($event_id);
   $booked_seats = eme_get_booked_seats($event_id);
   $pending_seats = eme_get_pending_seats($event_id);
   if ($is_multiseat) {
      $available_seats_ms=eme_convert_array2multi(eme_get_available_multiseats($event_id));
      $booked_seats_ms=eme_convert_array2multi(eme_get_booked_multiseats($event_id));
      $pending_seats_ms=eme_convert_array2multi(eme_get_pending_multiseats($event_id));
   }

   $stylesheet = EME_PLUGIN_URL."events_manager.css";
   foreach($answer_columns as $col) {
      $formfield[$col["field_name"]]=eme_get_formfield_id_byname($col["field_name"]);
   }
   ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html>
      <head>
         <meta http-equiv="Content-type" content="text/html; charset=utf-8">
         <title>Bookings for <?php echo eme_trans_sanitize_html($event['event_name']);?></title>
          <link rel="stylesheet" href="<?php echo $stylesheet; ?>" type="text/css" media="screen" />
          <?php
            $file_name= get_stylesheet_directory()."/eme.css";
            if (file_exists($file_name))
               echo "<link rel='stylesheet' href='".get_stylesheet_directory_uri()."/eme.css' type='text/css' media='screen' />\n";
            $file_name= get_stylesheet_directory()."/eme_print.css";
            if (file_exists($file_name))
               echo "<link rel='stylesheet' href='".get_stylesheet_directory_uri()."/eme_print.css' type='text/css' media='print' />\n";
          ?>
      </head>
      <body id="eme_printable_body">
         <div id="eme_printable_container">
         <h1>Bookings for <?php echo eme_trans_sanitize_html($event['event_name']);?></h1> 
         <p><?php echo eme_localised_date($event['event_start_date']." ".$event['event_start_time']." ".$eme_timezone); ?></p>
         <p><?php if ($event['location_id']) echo eme_replace_placeholders("#_LOCATIONNAME, #_ADDRESS, #_TOWN", $event); ?></p>
         <?php if ($event['price']) ?>
            <p><?php _e ( 'Price: ','eme' ); echo eme_replace_placeholders("#_CURRENCY #_PRICE", $event)?></p>
         <h1><?php _e('Bookings data', 'eme');?></h1>
         <table id="eme_printable_table">
            <tr>
               <th scope='col' class='eme_print_id'><?php _e('ID', 'eme')?></th>
               <th scope='col' class='eme_print_name'><?php _e('Last Name', 'eme')?></th>
               <th scope='col' class='eme_print_name'><?php _e('First Name', 'eme')?></th>
               <th scope='col' class='eme_print_email'><?php _e('E-mail', 'eme')?></th>
               <th scope='col' class='eme_print_phone'><?php _e('Phone number', 'eme')?></th> 
               <th scope='col' class='eme_print_seats'><?php if ($is_multiprice) _e('Seats (Multiprice)', 'eme'); else _e('Seats', 'eme'); ?></th>
               <th scope='col' class='eme_print_paid'><?php _e('Paid', 'eme')?></th>
               <th scope='col' class='eme_print_booking_date'><?php _e('Booking date', 'eme')?></th>
               <th scope='col' class='eme_print_total_price'><?php _e('Total price', 'eme')?></th>
               <th scope='col' class='eme_print_unique_nbr'><?php _e('Unique nbr', 'eme')?></th>
               <th scope='col' class='eme_print_comment'><?php _e('Comment', 'eme')?></th> 
            <?php
            $nbr_columns=11;
            foreach($answer_columns as $col) {
               $class="eme_print_formfield".$formfield[$col['field_name']];
               print "<th scope='col' class='$class'>".$col['field_name']."</th>";
               $nbr_columns++;
            }
            ?>
            </tr>
            <?php
            foreach($bookings as $booking) {
               $localised_booking_date = eme_localised_date($booking['creation_date']." ".$eme_timezone);
               $localised_booking_time = eme_localised_time($booking['creation_date']." ".$eme_timezone);
               $person = eme_get_person ($booking['person_id']);
               $pending_string="";
               if (eme_event_needs_approval($event_id) && !$booking['booking_approved']) {
                  $pending_string=__('(pending)','eme');
               }
                ?>
            <tr>
               <td class='eme_print_id'><?php echo $booking['booking_id']?></td> 
               <td class='eme_print_name'><?php echo $person['lastname']?></td> 
               <td class='eme_print_name'><?php echo $person['firstname']?></td> 
               <td class='eme_print_email'><?php echo $person['email']?></td>
               <td class='eme_print_phone'><?php echo $person['phone']?></td>
               <td class='eme_print_seats' class='seats-number'><?php 
               if ($is_multiprice) {
                  // in cases where the event switched to multiprice, but somebody already registered while it was still single price: booking_seats_mp is then empty
                  if ($booking['booking_seats_mp'] == "")
                     $booking['booking_seats_mp']=$booking['booking_seats'];
                  echo $booking['booking_seats']." (".$booking['booking_seats_mp'].") ".$pending_string;
               } else {
                  echo $booking['booking_seats']." ".$pending_string;
               }
               ?>
               </td>
               <td class='eme_print_paid'><?php if ($booking['booking_payed']) _e('Yes'); else _e('No'); ?></td>
               <td class='eme_print_booking_date'><?php echo $localised_booking_date." ".$localised_booking_time; ?></td>
               <td class='eme_print_total_price'><?php echo eme_get_total_booking_price($event,$booking); ?></td>
               <td class='eme_print_unique_nbr'><?php echo $booking['transfer_nbr_be97']; ?></td>
               <td class='eme_print_comment'><?=$booking['booking_comment'] ?></td> 
               <?php
                  $answers = eme_get_answers($booking['booking_id']);
                  foreach($answer_columns as $col) {
                     $found=0;
                     foreach ($answers as $answer) {
                        $class="eme_print_formfield".$formfield[$col['field_name']];
                        if ($answer['field_name'] == $col['field_name']) {
                           print "<td class='$class'>".eme_sanitize_html(eme_convert_answer2tag($answer))."</td>";
                           $found=1;
                           break;
                        }
                     }
                     # to make sure the number of columns are correct, we add an empty answer if none was found
                     if (!$found)
                        print "<td class='$class'>&nbsp;</td>";
                  }
               ?>
            </tr>
               <?php } ?>
            <tr id='eme_printable_booked-seats'>
               <td colspan='<?php echo $nbr_columns-4;?>'>&nbsp;</td>
               <td class='total-label'><?php _e('Booked', 'eme')?>:</td>
               <td colspan='3' class='seats-number'><?php
               print $booked_seats;
               if ($is_multiseat) print " ($booked_seats_ms)";
			      if ($pending_seats>0) {
                  if ($is_multiseat)
                     print " ".sprintf( __('(%s pending)','eme'), $pending_seats . " ($pending_seats_ms)");
                  else
                     print " ".sprintf( __('(%s pending)','eme'), $pending_seats);
               }
               ?>
            </td>
            </tr>
            <tr id='eme_printable_available-seats'>
               <td colspan='<?php echo $nbr_columns-4;?>'>&nbsp;</td>
               <td class='total-label'><?php _e('Available', 'eme')?>:</td>
               <td colspan='3' class='seats-number'><?php print $available_seats; if ($is_multiseat) print " ($available_seats_ms)"; ?></td>
            </tr>
         </table>
         </div>
      </body>
      </html>
      <?php
      die();
} 
コード例 #2
0
ファイル: eme_rsvp.php プロジェクト: simeont9/stoneopen
function eme_bookings_compact_table($event_id)
{
    $bookings = eme_get_bookings_for($event_id);
    $destination = admin_url("edit.php");
    $available_seats = eme_get_available_seats($event_id);
    $approved_seats = eme_get_approved_seats($event_id);
    $pending_seats = eme_get_pending_seats($event_id);
    $booked_seats = eme_get_booked_seats($event_id);
    if (eme_is_event_multiseats($event_id)) {
        $available_seats_ms = eme_convert_array2multi(eme_get_available_multiseats($event_id));
        $approved_seats_ms = eme_convert_array2multi(eme_get_approved_multiseats($event_id));
        $booked_seats_ms = eme_convert_array2multi(eme_get_booked_multiseats($event_id));
        $pending_seats_ms = eme_convert_array2multi(eme_get_pending_multiseats($event_id));
        if ($pending_seats > 0) {
            $booked_seats_info = "{$booked_seats}: {$booked_seats_ms} ({$approved_seats_ms} " . __('approved', 'eme') . ", {$pending_seats_ms} " . __('pending', 'eme');
        } else {
            $booked_seats_info = "{$booked_seats}: {$booked_seats_ms}";
        }
        $available_seats_info = "{$available_seats}: {$available_seats_ms}";
    } else {
        if ($pending_seats > 0) {
            $booked_seats_info = "{$booked_seats} ({$approved_seats} " . __('approved', 'eme') . ", {$pending_seats} " . __('pending', 'eme');
        } else {
            $booked_seats_info = $booked_seats;
        }
        $available_seats_info = $available_seats;
    }
    $count_bookings = count($bookings);
    if ($count_bookings > 0) {
        $printable_address = admin_url("admin.php?page=eme-people&amp;eme_admin_action=booking_printable&amp;event_id={$event_id}");
        $csv_address = admin_url("admin.php?page=eme-people&amp;eme_admin_action=booking_csv&amp;event_id={$event_id}");
        $table = "<div class='wrap'>\n            <h4>{$count_bookings} " . __('bookings so far', 'eme') . ":</h4>\n            <table id='eme-bookings-table-{$event_id}' class='widefat post fixed'>\n               <thead>\n                  <tr>\n                     <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>\n                     <th class='manage-column ' scope='col'>" . __('Respondent', 'eme') . "</th>\n                     <th scope='col'>" . __('Spaces', 'eme') . "</th>\n                  </tr>\n               </thead>\n               <tfoot>\n                  <tr>\n                     <th scope='row' colspan='2'>" . __('Booked spaces', 'eme') . ":</th><td class='booking-result' id='booked-seats'>{$booked_seats_info}</td></tr>\n                  <tr><th scope='row' colspan='2'>" . __('Available spaces', 'eme') . ":</th><td class='booking-result' id='available-seats'>{$available_seats_info}</td>\n                  </tr>\n               </tfoot>\n               <tbody>";
        foreach ($bookings as $booking) {
            $person = eme_get_person($booking['person_id']);
            $booking['booking_comment'] ? $baloon = " <img src='" . EME_PLUGIN_URL . "images/baloon.png' title='" . __('Comment:', 'eme') . " " . $booking['booking_comment'] . "' alt='comment'/>" : ($baloon = "");
            if (eme_is_event_multiprice($event_id)) {
                $booking_info = $booking['booking_seats'] . ': ' . $booking['booking_seats_mp'];
            } else {
                $booking_info = $booking['booking_seats'];
            }
            if (eme_event_needs_approval($event_id) && !$booking['booking_approved']) {
                $booking_info .= " " . __('(pending)', 'eme');
            }
            $table .= "<tr id='booking-" . $booking['booking_id'] . "'> \n            <td><a id='booking-check-" . $booking['booking_id'] . "' class='bookingdelbutton'>X</a></td>\n            <td><a title=\"" . eme_sanitize_html($person['email']) . " - " . eme_sanitize_html($person['phone']) . "\">" . eme_sanitize_html($person['lastname']) . "</a>{$baloon}</td>\n            <td>{$booking_info}</td>\n          </tr>";
        }
        $table .= "</tbody>\n         </table>\n         </div>\n         <br class='clear'/>\n         <div id='major-publishing-actions'>\n         <div id='publishing-action'> \n            <a id='printable'  target='' href='{$printable_address}'>" . __('Printable view', 'eme') . "</a>\n            <br class='clear'/>\n         </div>\n         <div id='publishing-action-csv'> \n            <a id='printable'  target='' href='{$csv_address}'>" . __('CSV export', 'eme') . "</a>\n            <br class='clear'/>\n         </div>\n         <br class='clear'/>\n         </div> ";
    } else {
        $table = "<p><em>" . __('No responses yet!', 'eme') . "</em></p>";
    }
    echo $table;
}