public function display_available_instruction_devices() { global $post; $query_arg = array('post_type' => 'device', 'meta_query' => array('relation' => 'OR', array('key' => 'device_status', 'value' => 'online', 'compare' => '='))); $device_query = new WP_Query($query_arg); $user_id = get_current_user_id(); $devices_availabel = false; get_current_user_id(); if ($device_query->have_posts()) { echo '<p>Hier werden dir die verfügbaren ' . fablab_get_captions('devices_caption') . ' für ' . fablab_get_captions('instructions_caption') . ' angezeigt:</p>'; echo '<div id="fl-getticket" class="device-list">'; while ($device_query->have_posts()) { $device_query->the_post(); if (!get_user_meta($user_id, $post->ID, true) && !user_has_ticket($user_id, $post->ID, 'instruction')) { ?> <div class="fl-device-element get-instruction" data-device-id="<?php echo $post->ID; ?> " data-device-name="<?php echo get_device_title_by_id($post->ID); ?> "> <div class="fl-device-element-content"> <h2><?php echo $post->post_title; ?> </h2> <p>Nächste <?php echo fablab_get_captions('instruction_caption'); ?> : <b><?php echo next_instruction($post->ID); ?> </b></p> <p>Ich möchte für dieses <?php echo fablab_get_captions('device_caption'); ?> eine <?php echo fablab_get_captions('instruction_caption'); ?> </p> </div> </div> <?php $devices_availabel = true; } } if (!$devices_availabel) { echo '<p class="device-message">Keine ' . fablab_get_captions('instruction_requests_caption') . ' verfügbar!</p>'; } echo '</div>'; } wp_reset_query(); }
function print_device_instruction($device_id) { global $post; $color = get_post_meta($device_id, 'device_color', true); $device_name = get_device_title_by_id($device_id); echo '<p>' . fablab_get_captions('device_caption') . ' : <b>' . $device_name . ',</b> Nächste ' . fablab_get_captions('instruction_caption') . ': <b>' . next_instruction($device_id) . '</b></p>'; $query_arg = array('post_type' => 'ticket', 'orderby' => 'date', 'order' => 'ASC', 'orderby' => 'post_author', 'meta_query' => array('relation' => 'and', array('key' => 'ticket_type', 'value' => 'instruction'), array('key' => 'device_id', 'value' => $device_id))); $ticket_query = new WP_Query($query_arg); if ($ticket_query->have_posts()) { echo '<div id="instruction-listing" class="instruction-list">'; while ($ticket_query->have_posts()) { $ticket_query->the_post(); ?> <div class="fl-ticket-element instruction-element" style="border-top: 5px solid <?php echo $color; ?> ;" data-ticket-id="<?php echo $post->ID; ?> " data-device-id="<?php echo $device_id; ?> " data-user-id="<?php echo $post->post_author; ?> " data-device-name="<?php echo get_device_title_by_id($device_id); ?> " data-user="******" > <p><?php echo the_time('l, j. F, G:i'); ?> <p> <h2><?php echo $post->post_title; ?> </h2> <p>für <?php echo fablab_get_captions('device_caption'); ?> : <b><?php echo $device_name; ?> </b></p> <input type="submit" class="ticket-btn set-permission" value="Berechtigung hinzufügen"/> <input type="submit" class="ticket-btn delete-permission" value="Löschen"/> </div> <?php } echo '<div style="clear:left;"></div></div>'; } else { echo '<p style="margin-bottom:40px; opacity: 0.6;"> -- Keine ' . fablab_get_captions('instruction_requests_caption') . '! -- </p>'; } wp_reset_query(); }