public function widget($args, $instance)
    {
        $imgs = TTR_carousel::get_items();
        $imgs_len = TTR_carousel::get_count();
        ?>
			<!-- Top Carousel -->
			<div id="carousel-ctr" class="container-fluid">
				<div id="carousel-main" class="carousel slide" data-ride="carousel">
					<!-- Indicators -->
					<ol class="carousel-indicators">
						<?php 
        for ($i = 0; $i < $imgs_len; $i++) {
            if ($i == 0) {
                echo '<li data-target="#carousel-main" data-slide-to="0" class="active"></li>';
            } else {
                echo '<li data-target="#carousel-main" data-slide-to="' . $i . '"></li>';
            }
        }
        ?>
					</ol>

					<!-- Wrapper for slides -->
					<div class="carousel-inner" role="listbox">
						<?php 
        $img_class = 'item active';
        foreach ($imgs as $i) {
            echo "<div class=\"{$img_class}\"> <a href=\"{$i['page_link']}\"> ";
            echo "<span class='carousel-title'>" . stripslashes($i['title']) . "</span> ";
            echo wp_get_attachment_image($i['img_id'], "carousel-thumb");
            echo "</a> </div>";
            $img_class = 'item';
        }
        ?>
					</div>
				</div>
			</div>
		<?php 
    }
function ttr_carousel_admin_render()
{
    ttr_carousel_admin_style();
    if (!isset($_GET["type"])) {
        $_GET["type"] = "list";
    }
    switch ($_GET["type"]) {
        case "add":
            ttr_carousel_admin_form();
            break;
        case "pos":
            ttr_carousel_admin_position_editor();
            break;
        case "edit":
            $itm = TTR_carousel::get_item($_GET['id']);
            ttr_carousel_admin_form($itm['id'], stripslashes($itm['title']), $itm['img_id'], $itm['page_link']);
            break;
        default:
            ttr_carousel_admin_table();
            break;
    }
}
 public function prepare_items()
 {
     /* Generate Headers */
     $this->_column_headers = array($this->get_columns(), array(), array(), 'title');
     // Write Bulk Action Prossesing
     $this->process_bulk_action();
     // Sets Pagination Data
     //$per_page = 10; //TODO make changable
     //$cur_page = $this->get_pagenum();
     //$this->set_pagination_args([
     //'total_items' => TTR_carousel::get_count() //TODO Add Item Count
     //'per_page' => $per_page
     //]);
     // Sets Tutors For Database
     //$this->items = TTR_carousel::get_items($per_page, $cur_page);
     $this->items = TTR_carousel::get_items();
 }