function wpmt_add_sessions($session_data)
{
    $session_data_as_array = wpmt_object_to_array($session_data);
    $session = new WPMT_Session();
    for ($i = 0; $i < count($session_data_as_array); $i++) {
        $session->assign_values($session_data_as_array, $i);
        $post_id = wpmt_add_post($session->title, 'wpmt_session');
        $session->update_fields($post_id);
    }
}
 * Created by PhpStorm.
 * User: edit5
 * Date: 1/26/16
 * Time: 12:09 PM
 *
 * This file include is commented out by default.
 */
echo "<div id='container'>";
echo "<div class='general_title'> All Show Times </div>";
$showTimeDataAsArray = wpmt_object_to_array($session_data);
displayAllShowTimes($showTimeDataAsArray);
echo "</div>";
echo "<div id='container'>";
echo "<div class='general_title'> All Films </div>";
$film = new Film();
$filmDataAsArray = wpmt_object_to_array($film_data);
displayAllFilms($filmDataAsArray);
echo "</div>";
function displayAllShowTimes($dataAsArray)
{
    for ($i = 0; $i < count($dataAsArray); $i++) {
        $showTime = new WPMT_Session();
        $showTime->assign_values($dataAsArray, $i);
        echo "<div class='wpmt_session_title'>" . $showTime->title . "</div>";
        echo "<div class='wpmt_session_body'>";
        displayShowTime($showTime);
        echo "</div>";
    }
}
function displayShowTime($showTime)
{
function wpmt_do_option_updates()
{
    //need to add a verification of user priviledges in here
    if (isset($_POST['wpmt_manual_update'])) {
        //$wpmt_updates = get_option('wpmt_manual_updates_checkbox');
        $wpmt_updates = $_POST['wpmt_manual_updates_checkbox'];
    }
    for ($i = 0; $i < count($wpmt_updates); $i++) {
        if ($wpmt_updates[$i] == 'force delete all films') {
            wpmt_delete_all_posts('WPMT_Film');
        }
        if ($wpmt_updates[$i] == 'force delete all performances') {
            wpmt_delete_all_posts('WPMT_Performance');
        }
        if ($wpmt_updates[$i] == 'force delete all sessions') {
            wpmt_delete_all_posts('WPMT_Session');
        }
        if ($wpmt_updates[$i] == 'add new films and performances') {
            $my_token = esc_attr(get_option('wpmt_veezi_token'));
            $veezi_access_token = 'VeeziAccessToken: ' . $my_token;
            $film_and_performance_data = call_service('https://api.us.veezi.com/v1/film', $veezi_access_token);
            wpmt_update_posts($film_and_performance_data);
        }
        if ($wpmt_updates[$i] == 'add new sessions') {
            $my_token = esc_attr(get_option('wpmt_veezi_token'));
            $veezi_access_token = 'VeeziAccessToken: ' . $my_token;
            $session_data = call_service('https://api.us.veezi.com/v1/websession', $veezi_access_token);
            //1. delete all sessions
            wpmt_delete_all_posts('WPMT_Session');
            if (NULL == get_posts(array('post_type' => 'WPMT_Session'))) {
                wpmt_add_sessions($session_data);
            }
        }
        if ($wpmt_updates[$i] == 'update film formats' || $wpmt_updates[$i] == 'update performance formats') {
            $my_token = esc_attr(get_option('wpmt_veezi_token'));
            $veezi_access_token = 'VeeziAccessToken: ' . $my_token;
            $film_and_performance_data = call_service('https://api.us.veezi.com/v1/film', $veezi_access_token);
            $post_data_as_array = wpmt_object_to_array($film_and_performance_data);
            for ($c = 0; $c < count($post_data_as_array); $c++) {
                if ($post_data_as_array[$c]["Genre"] != "Festival") {
                    // if the format is 'not a film' and it's not a documentary, then make a performance
                    if ($post_data_as_array[$c]["Format"] == "Not a Film" && $post_data_as_array[$c]["Genre"] != "Documentary") {
                        if ($wpmt_updates[$i] == 'update performance formats') {
                            $performance = new WPMT_Performance();
                            $performance->assign_values($post_data_as_array, $c);
                            if (NULL != get_posts(array('posts_per_page' => -1, 'post_type' => 'WPMT_Performance', 'meta_key' => 'wpmt_performance_id', 'meta_value' => $performance->id))) {
                                $posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'WPMT_Performance', 'meta_key' => 'wpmt_performance_id', 'meta_value' => $performance->id));
                                foreach ($posts as $post) {
                                    $performance->update_performance_format($post->ID);
                                }
                            }
                        }
                    } elseif ($wpmt_updates[$i] == 'update film formats') {
                        $film = new WPMT_Film();
                        $film->assign_values($post_data_as_array, $c);
                        if (NULL != get_posts(array('posts_per_page' => -1, 'post_type' => 'WPMT_Film', 'meta_key' => 'wpmt_film_id', 'meta_value' => $film->id))) {
                            $posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'WPMT_Film', 'meta_key' => 'wpmt_film_id', 'meta_value' => $film->id));
                            foreach ($posts as $post) {
                                $film->update_film_format($post->ID);
                            }
                        }
                    }
                }
            }
            // end for loop
        }
    }
}