Exemple #1
0
 public function at_admin_menu_options()
 {
     if (!current_user_can('manage_options')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     global $at_functions, $at_tournament;
     $at_functions = new at_functions();
     $at_tournament = new at_tournament();
     $viewData = array();
     echo $at_functions->at_get_template('admin_menu', $viewData);
     wp_enqueue_script(at_scripts);
     wp_enqueue_script(at_scripts_admin);
     wp_localize_script(at_scripts_admin, 'at_plugin_paths', $at_functions->getPaths());
     wp_localize_script(at_scripts_admin, 'nonce', wp_create_nonce(ajax_nonce_string));
 }
Exemple #2
0
 public function at_insert_listen_list($listen_attrs)
 {
     $attrs = shortcode_atts(array(at_tournament_slug => ''), $listen_attrs, 'at_insert_listen_list');
     $slug = reset($attrs);
     if (!isset($at_functions)) {
         $at_functions = new at_functions();
     }
     if (!isset($at_entry)) {
         $at_entry = new at_entry();
     }
     $tournaments = get_posts(array('posts_per_page' => -1, 'meta_key' => at_post_type, 'meta_value' => at_post_type_results_page, 'post_type' => at_post_type_tournament, 'post_status' => 'publish'));
     $entries = array();
     $entry_posts = array();
     $author_ids = array();
     $authors = array();
     $players = array();
     foreach ($tournaments as $tournament) {
         $entry_ids = array();
         $tournament_id = $tournament->post_parent;
         $tournament_slug = get_post_meta($tournament_id, at_tournament_slug, true);
         if ($tournament_slug == $slug) {
             $tournament->ID = $tournament_id;
             $tournament->post_title = get_the_title($tournament_id);
             $tournament_round = get_post_meta($tournament_id, at_tournament_round, true);
             $entries[$tournament_id] = $at_entry->at_get_entry_data(NULL, NULL, $tournament_id, $tournament_round);
             foreach ($entries[$tournament_id] as $entry) {
                 $entry_url = $at_functions->get_entries_url($entry->user_id, $tournament_id, $tournament_round);
                 $audio = array('src' => $entry_url . "/" . rawurlencode($entry->mp3File));
                 $players[$entry->post_id] = wp_audio_shortcode($audio);
                 $entry_ids[] = $entry->post_id;
                 $author_ids[] = $entry->user_id;
             }
             $posts = $at_entry->at_get_entry_posts($entry_ids);
             $entry_posts[$tournament_id] = array();
             foreach ($posts as $post) {
                 $entry_posts[$tournament_id][$post->ID] = $post;
             }
         }
     }
     $users = get_users(array('include' => $author_ids, 'fields' => array('ID', 'user_nicename', 'display_name')));
     foreach ($users as $user) {
         $authors[$user->ID] = $user;
     }
     $viewData = array('tournaments' => $tournaments, 'players' => $players, 'authors' => $authors, 'entries' => $entries, 'entry_posts' => $entry_posts);
     return $at_functions->at_get_template('listen_list', $viewData);
 }