<p>
    <label for="<?php echo $widget->get_field_id('title'); ?>"><?php _e('Title', THEMEMAKERS_THEME_FOLDER_NAME) ?>:</label>
    <input class="widefat" type="text" id="<?php echo $widget->get_field_id('title'); ?>" name="<?php echo $widget->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
</p>

<p>
    <label for="<?php echo $widget->get_field_id('post_type'); ?>"><?php _e('Post type', THEMEMAKERS_THEME_FOLDER_NAME) ?>:</label>
    <select id="<?php echo $widget->get_field_id('post_type'); ?>" name="<?php echo $widget->get_field_name('post_type'); ?>" class="widefat">
        <?php
        $current_post_type = $instance['post_type'];
        $post_types = array("games", "release", "review");
        ?>
        <?php if (!empty($post_types)) : ?>
            <?php foreach ($post_types as $post_type) : ?>
                <option <?php echo($current_post_type == $post_type ? "selected" : "") ?> value="<?php echo $post_type ?>"><?php echo $post_type ?></option>
            <?php endforeach; ?>
        <?php endif; ?>
    </select>
</p>

<p>
    <label for="<?php echo $widget->get_field_id('orderby'); ?>"><?php _e('Order by', THEMEMAKERS_THEME_FOLDER_NAME) ?>:</label>
    <select id="<?php echo $widget->get_field_id('orderby'); ?>" name="<?php echo $widget->get_field_name('orderby'); ?>" class="widefat">
        <?php
        $current_sort_by = $instance['orderby'];
        $sort_by_array = array("title" => "Post title", "date" => "Post date", "rand" => "Random", "rating" => "Post rating");
        ?>
        <?php if (!empty($sort_by_array)) : ?>
            <?php foreach ($sort_by_array as $key => $sort_by) : ?>
                <option <?php echo($current_sort_by == $key ? "selected" : "") ?> value="<?php echo $key ?>"><?php echo $sort_by ?></option>
            <?php endforeach; ?>
        <?php endif; ?>
    </select>
</p>

<p>
    <label for="<?php echo $widget->get_field_id('sort_order'); ?>"><?php _e('Sort order', THEMEMAKERS_THEME_FOLDER_NAME) ?>:</label>
    <select id="<?php echo $widget->get_field_id('sort_order'); ?>" name="<?php echo $widget->get_field_name('sort_order'); ?>" class="widefat">
        <?php
        $current_order = $instance['sort_order'];
        $order_array = array("DESC" => "DESC", "ASC" => "ASC");
        ?>
        <?php if (!empty($order_array)) : ?>
            <?php foreach ($order_array as $order) : ?>
                <option <?php echo($current_order == $order ? "selected" : "") ?> value="<?php echo $order ?>"><?php echo $order ?></option>
            <?php endforeach; ?>
        <?php endif; ?>
    </select>
</p>



<p>
    <label for="<?php echo $widget->get_field_id('post_number'); ?>"><?php _e('Post Number', THEMEMAKERS_THEME_FOLDER_NAME) ?></label>
    <input class="widefat" type="text" id="<?php echo $widget->get_field_id('post_number'); ?>" name="<?php echo $widget->get_field_name('post_number'); ?>" value="<?php echo $instance['post_number']; ?>" />
</p>

<p>
    <?php
    $checked = "";
    if ($instance['show_thumbnail'] == 'true') {
        $checked = 'checked="checked"';
    }
    ?>
    <input type="checkbox" id="<?php echo $widget->get_field_id('show_thumbnail'); ?>" name="<?php echo $widget->get_field_name('show_thumbnail'); ?>" value="true" <?php echo $checked; ?> />
    <label for="<?php echo $widget->get_field_id('show_thumbnail'); ?>"><?php _e('Show thumbnail', THEMEMAKERS_THEME_FOLDER_NAME) ?></label>
    <br />
    <?php
    $checked = "";
    if ($instance['show_exerpt'] == 'true') {
        $checked = 'checked="checked"';
    }
    ?>
    <input type="checkbox" id="<?php echo $widget->get_field_id('show_exerpt'); ?>" name="<?php echo $widget->get_field_name('show_exerpt'); ?>" value="true" <?php echo $checked; ?> />
    <label for="<?php echo $widget->get_field_id('show_exerpt'); ?>"><?php _e('Show Excerpt', THEMEMAKERS_THEME_FOLDER_NAME) ?></label>
    <br />
    <?php
    $checked = "";
    if ($instance['show_rating'] == 'true') {
        $checked = 'checked="checked"';
    }
    ?>
    <input type="checkbox" id="<?php echo $widget->get_field_id('show_rating'); ?>" name="<?php echo $widget->get_field_name('show_rating'); ?>" value="true" <?php echo $checked; ?> />
    <label for="<?php echo $widget->get_field_id('show_rating'); ?>"><?php _e('Show Rating', THEMEMAKERS_THEME_FOLDER_NAME) ?></label>
    <br />
    <?php
    $checked = "";
    if ($instance['show_console_filter'] == 'true') {
        $checked = 'checked="checked"';
    }
    ?>
    <input type="checkbox" id="<?php echo $widget->get_field_id('show_console_filter'); ?>" name="<?php echo $widget->get_field_name('show_console_filter'); ?>" value="true" <?php echo $checked; ?> />
    <label for="<?php echo $widget->get_field_id('show_console_filter'); ?>"><?php _e('Show console filter', THEMEMAKERS_THEME_FOLDER_NAME) ?></label>
</p>
<h4><?php _e('Show consoles', THEMEMAKERS_THEME_FOLDER_NAME) ?>:</h4>
<p>
    <?php $consoles = get_terms(array("cons")); ?>

    <?php if (!empty($consoles)) : ?>
        <?php foreach ($consoles as $key => $console): ?>

            <?php
            $checked = "";
            if ($instance['consoles_' . $console->term_id] == 'true') {
                $checked = 'checked="checked"';
            }
            ?>
            <input type="checkbox" id="<?php echo $widget->get_field_id('consoles_' . $console->term_id); ?>" name="<?php echo $widget->get_field_name('consoles_' . $console->term_id); ?>" value="true" <?php echo $checked; ?> />
            <label for="<?php echo $widget->get_field_id('consoles_' . $console->term_id); ?>"><?php echo $console->name ?></label>
            <br />

        <?php endforeach; ?>
    <?php endif; ?>
</p>