예제 #1
0
    ?>
            
        	<?php 
    $entries_in_playlist = mdjm_count_playlist_entries($mdjm_event->ID);
    ?>
        	<p><?php 
    printf(__('Your playlist currently consists of %d %s and is approximately %s long. Your %s is %s long.', 'mobile-dj-manager'), $entries_in_playlist, _n('track', 'tracks', $entries_in_playlist, 'mobile-dj-manager'), '{playlist_duration}', mdjm_get_label_singular(), '{event_duration}');
    ?>
</p>
        
        	<?php 
    foreach ($playlist as $category => $entries) {
        ?>
            	
				<?php 
        $entries_in_category = mdjm_count_playlist_entries($mdjm_event->ID, $category);
        ?>
                
                <div class="row">
                
                    <div class="category"><?php 
        echo $category;
        ?>
 <span class="cat-count">(<?php 
        echo $entries_in_category;
        ?>
 <?php 
        echo _n('entry', 'entries', $entries_in_category, 'mobile-dj-manager');
        ?>
 | <?php 
        echo mdjm_playlist_duration($mdjm_event->ID, $entries_in_category);
예제 #2
0
/**
 * Retrieve the duration of the event playlist.
 *
 * Calculate the approximate length of the event playlist and return in human readable format.
 *
 * @since	1.3
 * @param	int		$event_id		The event ID.
 * @param	int		$songs			Number of songs in playlist.
 * @param	int		$song_duration	Average length of a song in seconds.
 * @return	str		The length of the event playlist.
 */
function mdjm_playlist_duration($event_id = '', $songs = '', $song_duration = 180)
{
    if (empty($songs)) {
        $songs = mdjm_count_playlist_entries($event_id);
    }
    $start_time = current_time('timestamp');
    $end_time = strtotime('+' . $song_duration * $songs . ' seconds', current_time('timestamp'));
    $duration = str_replace('min', 'minute', human_time_diff($start_time, $end_time));
    return apply_filters('mdjm_playlist_duration', $duration, $event_id, $songs, $song_duration);
}
예제 #3
0
/**
 * Define the data to be displayed in each of the custom columns for the Transaction post types
 *
 * @since	0.9
 * @param	str		$column_name	The name of the column to display
 * @param	int		$post_id		The current post ID
 * @return
 */
function mdjm_event_posts_custom_column($column_name, $post_id)
{
    global $post;
    if (mdjm_employee_can('edit_txns') && ($column_name == 'value' || $column_name == 'balance')) {
        $value = mdjm_get_event_price($post_id);
    }
    switch ($column_name) {
        // Event Date
        case 'event_date':
            if (mdjm_employee_can('read_events')) {
                echo '<strong><a href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . date('d M Y', strtotime(get_post_meta($post_id, '_mdjm_event_date', true))) . '</a>';
            } else {
                echo '<strong>' . date('d M Y', strtotime(get_post_meta($post_id, '_mdjm_event_date', true))) . '</strong>';
            }
            break;
            // Client
        // Client
        case 'client':
            $client = get_userdata(get_post_meta($post->ID, '_mdjm_event_client', true));
            if (!empty($client)) {
                if (mdjm_employee_can('send_comms')) {
                    printf('<a href="%s">%s</a>', add_query_arg(array('recipient' => $client->ID, 'event_id' => $post_id), admin_url('admin.php?page=mdjm-comms')), $client->display_name);
                } else {
                    echo $client->display_name;
                }
            } else {
                _e('<span class="mdjm-form-error">Not Assigned</span>', 'mobile-dj-manager');
            }
            break;
            // Employees
        // Employees
        case 'employees':
            global $wp_roles;
            $primary = get_userdata(mdjm_get_event_primary_employee($post->ID));
            $employees = mdjm_get_event_employees_data($post->ID);
            if (!empty($primary)) {
                if (mdjm_employee_can('send_comms')) {
                    printf('<a href="%s" title="%s">%s</a>', add_query_arg(array('recipient' => $primary->ID, 'event_id' => $post_id), admin_url('admin.php?page=mdjm-comms')), mdjm_get_option('artist', __('DJ', 'mobile-dj-manager')), $primary->display_name);
                } else {
                    echo '<a title="' . mdjm_get_option('artist', __('DJ', 'mobile-dj-manager')) . '">' . $primary->display_name . '</a>';
                }
            } else {
                _e('<span class="mdjm-form-error">Not Assigned</span>', 'mobile-dj-manager');
            }
            if (!empty($employees)) {
                echo '<br />';
                $i = 1;
                foreach ($employees as $employee) {
                    echo '<em>';
                    if (mdjm_employee_can('send_comms')) {
                        printf('<a href="%s" title="%s">%s</a>', add_query_arg(array('recipient' => $employee['id'], 'event_id' => $post_id), admin_url('admin.php?page=mdjm-comms')), translate_user_role($wp_roles->roles[$employee['role']]['name']), mdjm_get_employee_display_name($employee['id']));
                    } else {
                        echo '<a title="' . translate_user_role($wp_roles->roles[$employee['role']]['name']) . '">' . mdjm_get_employee_display_name($employee['id']) . '</a>';
                    }
                    echo '</em>';
                    if ($i != count($employees)) {
                        echo '<br />';
                    }
                }
            }
            break;
            // Status
        // Status
        case 'event_status':
            echo get_post_status_object($post->post_status)->label;
            break;
            // Event Type
        // Event Type
        case 'event_type':
            $event_types = get_the_terms($post_id, 'event-types');
            if (is_array($event_types)) {
                foreach ($event_types as $key => $event_type) {
                    $event_types[$key] = $event_type->name;
                }
                echo implode("<br/>", $event_types);
            }
            break;
            // Value
        // Value
        case 'value':
            if (mdjm_employee_can('edit_txns')) {
                if (!empty($value) && $value != '0.00') {
                    echo mdjm_currency_filter(mdjm_format_amount($value));
                    echo '<br />';
                } else {
                    echo '<span class="mdjm-form-error">' . mdjm_currency_filter(mdjm_format_amount('0.00')) . '</span>';
                }
            } else {
                echo '&mdash;';
            }
            break;
            // Balance
        // Balance
        case 'balance':
            if (mdjm_employee_can('edit_txns')) {
                echo mdjm_currency_filter(mdjm_format_amount(mdjm_get_event_balance($post_id)));
                echo '<br />';
                $deposit_status = mdjm_get_event_deposit_status($post_id);
                if ('Paid' == mdjm_get_event_deposit_status($post_id)) {
                    printf(__('<i title="%s %s paid" class="fa fa-check-square-o" aria-hidden="true">', 'mobile-dj-manager'), mdjm_currency_filter(mdjm_format_amount(mdjm_get_event_deposit($post_id))), mdjm_get_deposit_label());
                }
            } else {
                echo '&mdash;';
            }
            break;
            // Playlist
        // Playlist
        case 'playlist':
            if (mdjm_employee_can('read_events')) {
                $total = mdjm_count_playlist_entries($post_id);
                echo '<a href="' . mdjm_get_admin_page('playlists') . $post_id . '">' . $total . ' ' . _n('Song', 'Songs', $total, 'mobile-dj-manager') . '</a>' . "\r\n";
            } else {
                echo '&mdash;';
            }
            break;
            // Journal
        // Journal
        case 'journal':
            if (mdjm_employee_can('read_events_all')) {
                $total = wp_count_comments($post_id)->approved;
                echo '<a href="' . admin_url('/edit-comments.php?p=' . $post_id) . '">' . $total . ' ' . _n('Entry', 'Entries', $total, 'mobile-dj-manager') . '</a>' . "\r\n";
            } else {
                echo '&mdash;';
            }
            break;
    }
    // switch
}
예제 #4
0
/**
 * Content tag: playlist_duration.
 * The approximate length of the playlist.
 *
 * @param	int		The event ID.
 * @param
 *
 * @return	int|str	The approximate length of the playlist.
 */
function mdjm_content_tag_playlist_duration($event_id = '')
{
    $total_entries = mdjm_count_playlist_entries($event_id);
    return mdjm_playlist_duration($event_id, $total_entries);
}
 /**
  * Define the category views.
  *
  * @since	1.3
  * @param
  * @return	arr		$views		Category views
  */
 public function get_views()
 {
     $views = array();
     $current = !empty($_GET['view_cat']) ? $_GET['view_cat'] : 'all';
     $categories = mdjm_get_playlist_categories($_GET['event_id']);
     if ($categories) {
         $class = $current == 'all' ? ' class="current"' : '';
         $all_url = remove_query_arg('view_cat');
         $views['all'] = sprintf(__('<a href="%s" %s >All</a>', 'mobile-dj-manager'), $all_url, $class) . '<span class="count">' . mdjm_count_playlist_entries($_GET['event_id']) . '</span>';
         foreach ($categories as $category) {
             $count = mdjm_count_playlist_entries($_GET['event_id'], $category->name);
             if ($count > 0) {
                 $view_url = add_query_arg('view_cat', $category->name);
                 $class = $current == $category->name ? ' class="current"' : '';
                 $views[$category->name] = '<a href="' . $view_url . '" ' . $class . ' >' . $category->name . '</a>' . '<span class="count">(' . $count . ')</span>';
             }
         }
     }
     return $views;
 }