Advertisement
Guest User

carnew

a guest
Aug 4th, 2014
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.91 KB | None | 0 0
  1. <?php
  2. if ( isset( $_POST['doors'] ) ){  
  3. // verify nounce prob a good idea
  4.     foreach($_POST['doors'] as $item=>$key) {
  5.         $id= sanitize_text_field($item);
  6.         update_post_meta( $id, 'doors', sanitize_text_field( $key ) );
  7.     }  
  8. }
  9. ?>
  10. <div id="auto-manager-auto-dashboard">
  11.  
  12.     <?php
  13.  
  14.         if(get_field('enable_favorites_system','option')) {
  15.  
  16.             tdp_fav_list_favorite_posts();
  17.  
  18.         }
  19.  
  20.     ?>
  21.     <?php if ( current_user_can('subscriber') ) : ?>
  22. <style> .fordon {display:none;} </style>
  23. <?php endif; ?>
  24.  
  25. <div class="fordon">
  26.     <h2><i class="icon-list-numbered"></i> <?php _e( 'Dina annonser'); ?></h2>
  27.     <br/>
  28.     <div class="alert-box info ">
  29.         <a href="#" class="icon-cancel close" data-dismiss="alert"></a>
  30.         <div class="alert-content"><?php _e( 'Dina fordon i listan nedan raderas per automatik efter 30 dagar.' ); ?></div>
  31.     </div>
  32.  
  33.     <table class="auto-manager-autos sf-table striped_bordered">
  34.         <thead>
  35.             <tr>
  36.                 <th class="auto_title"><?php _e( 'Titel' ); ?></th>
  37.                 <th class="date"><?php _e( 'Datum' ); ?></th>
  38.                 <th class="status"><?php _e( 'Status' ); ?></th>
  39.                 <th class="expires"><?php _e( 'Utgår' ); ?></th>
  40.                 <th class="filled"><?php _e( 'Action' ); ?></th>
  41.                 <th class="bud"><?php _e( 'Bud' ); ?></th>
  42.             </tr>
  43.         </thead>
  44.         <tbody>
  45.             <?php if ( ! $autos ) : ?>
  46.                 <tr>
  47.                     <td colspan="6"><?php _e( 'Du har inga aktiva annonser.' ); ?></td>
  48.                 </tr>
  49.             <?php else : ?>
  50.                 <?php foreach ( $autos as $auto ) : ?>
  51.                     <tr>
  52.                         <td class="auto_title">
  53.                             <a href="<?php echo get_permalink( $auto->ID ); ?>"><?php echo $auto->post_title; ?></a>
  54.                         </td>
  55.                         <td class="date"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $auto->post_date ) ); ?></td>
  56.                         <td class="status"><?php the_auto_status( $auto ); ?></td>
  57.                         <td class="expires"><?php
  58.                             $expires = $auto->_auto_expires;
  59.  
  60.                             echo $expires ? date_i18n( get_option( 'date_format' ), strtotime( $expires ) ) : '&ndash;';
  61.                         ?></td>
  62.                         <td class="filled">
  63.                             <ul class="auto-dashboard-actions">
  64.                                 <?php
  65.                                     $actions = array();
  66.  
  67.                                     switch ( $auto->post_status ) {
  68.                                         case 'publish' :
  69.                                            
  70.                                             $actions['edit'] = array( 'icon' =>'', 'label' => __( 'Redigera' ), 'nonce' => false, 'edit-vehicle' => false );
  71.  
  72.                                             break;
  73.                                     }
  74.  
  75.                                     $actions['delete'] = array( 'icon' =>'icon-cancel', 'label' => __( 'Radera' ), 'nonce' => true, 'edit-vehicle' => true );
  76.                                     $actions           = apply_filters( 'auto_manager_my_auto_actions', $actions, $auto );
  77.  
  78.                                     foreach ( $actions as $action => $value ) {
  79.                                         $action_url = add_query_arg( array( 'action' => $action, 'auto_id' => $auto->ID ) );
  80.                                         if( $value['edit-vehicle']) {
  81.                                         $action_url = get_field('edit_vehicle_page','option') . '?pid='.$auto->ID;
  82.                                         }
  83.                                         if ( $value['nonce'] )
  84.                                             $action_url = wp_nonce_url( $action_url, 'auto_manager_my_auto_actions' );
  85.                                         echo '<li><a href="' . $action_url . '" class="tooltip auto-dashboard-action-' . $action . '" title="'.$value['label'].'"><i class="' . $value['icon'] . '"></i></a></li>';
  86.                                     }
  87.                                 ?>
  88.                             </ul>
  89.                         </td>
  90.  
  91.                         <td class="bud"><span id="nek">Bud nekat</span> <span style="color:#2A873E;" id="acc" >Bud accepterat</span></a>
  92.  
  93.  
  94. <form id="myForm" method="post" action="" onSubmit="if(!confirm('Är du säker på att du vill acceptera budet?')){return false;}">
  95.    <input type='text' value="1" value='<?php echo $doors ?>' name='doors[<?php echo $auto->ID; ?>]'>
  96.    <input type="button" onclick="" value="Neka bud"> - <input type='submit' value='Godkänn bud' />
  97. </form></td>
  98.                    
  99.                     </tr>
  100.                 <?php endforeach; ?>
  101.             <?php endif; ?>
  102.         </tbody>
  103.     </table>
  104.     <?php get_auto_manager_template( 'pagination.php', array( 'max_num_pages' => $max_num_pages ) ); ?>
  105. </div>
  106.  
  107.  
  108. <div class="clear"></div><br/>
  109.  
  110.  
  111.  
  112. <table class="shop_table my_account_auto_packages sf-table striped_bordered" style="display:none;">
  113.     <thead>
  114.         <tr>
  115.             <th scope="col"><?php _e( 'Package Name', 'auto_manager' ); ?></th>
  116.             <th scope="col"><?php _e( 'Allowance Remaining', 'auto_manager' ); ?></th>
  117.             <th scope="col"><?php _e( 'Listing Duration', 'auto_manager' ); ?></th>
  118.             <th scope="col"><?php _e( 'Featured?', 'auto_manager' ); ?></th>
  119.         </tr>
  120.     </thead>
  121.     <tbody>
  122.         <?php foreach ( $packages as $package ) : ?>
  123.             <tr>
  124.                 <td><?php
  125.                     $product = get_post( $package->product_id );
  126.                     if ( $product )
  127.                         echo $product->post_title;
  128.                     else
  129.                         echo '-';
  130.                 ?></td>
  131.                 <td><?php echo absint( $package->auto_limit - $package->auto_count ); ?></td>
  132.                 <td><?php echo sprintf( __( '%d day', '%d days', $package->auto_duration, 'auto_manager' ), $package->auto_duration ); ?></td>
  133.                 <td><?php if ( $package->auto_featured ) _e( 'Yes', 'auto_manager' ); else _e( 'No', 'auto_manager' ); ?></td>
  134.             </tr>
  135.         <?php endforeach; ?>
  136.     </tbody>
  137. </table>
  138.  
  139. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement