예제 #1
0
 function reservaciones_usuario($user_id = false)
 {
     if (!$user_id) {
         return;
     }
     $html = '';
     /*IMPRIMIR RESERVACIONES--------------*/
     $reservas_pendientes = array();
     $reservas_pasadas = array();
     $reservas = get_posts(array('posts_per_page' => -1, 'post_type' => 'reserva', 'author' => $user_id, 'post_status' => array('future', 'publish')));
     if ($reservas) {
         foreach ($reservas as $reserva) {
             $r = new Reserva($reserva->ID);
             if ($reserva->post_status == 'future') {
                 $reservas_pendientes[] = $r->imprimir_historial_back();
             } else {
                 $reservas_pasadas[] = $r->imprimir_historial_back(false);
             }
         }
     }
     if (count($reservas_pendientes)) {
         $html .= '<div class="upcoming_reservations">';
         $html .= '<h2>Próximas reservaciones</h2>';
         $html .= '</div>';
         foreach ($reservas_pendientes as $rp) {
             $html .= $rp;
         }
     }
     if (count($reservas_pasadas)) {
         $html .= '<div class="upcoming_reservations past_reservations">';
         $html .= '<h2>Compras pasadas</h2>';
         $html .= '</div>';
         foreach ($reservas_pasadas as $rpas) {
             $html .= $rpas;
         }
     }
     return '<div class="user_edit_create">' . $html . '</div>';
 }