public function SlideshowJedoGalleryDBHelper($oPlugin)
 {
     parent::SlideshowJedoGallery();
     $this->oPlugin = $oPlugin;
     $this->tableName = SlideshowJedoGallery::table_gallery();
     $this->select_query = "SELECT `id`, `title`, `layout_width`, `order`, `options`,\n\t\t\t\t\t\t\t\t\t  `created`, `modified`, \n\t\t                              (SELECT COUNT(*) \n\t\t                                 FROM `" . SlideshowJedoGallery::table_galleryslide() . "` slide\n\t\t                                WHERE slide.gallery_id = gallery.id) AS slide_count \n                                  FROM `" . $this->tableName . "` gallery";
 }
 public function SlideshowJedoGallerySlideDBHelper($oPlugin)
 {
     //echo "SlideshowJedoGallerySlideDBHelper >> ";
     parent::SlideshowJedoGallery();
     $this->oPlugin = $oPlugin;
     $this->tableName = SlideshowJedoGallery::table_galleryslide();
 }
 public function selectGallerySlide($gallery_id, $orders = array())
 {
     global $wpdb;
     $query = "SELECT `id`, `title`, `description`, `order`, `options`, `created`, `modified`\n\t\t            FROM `" . $this->tableName . "` slide \n\t\t           WHERE slide.id IN (SELECT slide_id \n\t\t            \t\t            FROM `" . SlideshowJedoGallery::table_galleryslide() . "` galleryslide \n\t\t            \t\t           WHERE galleryslide.gallery_id = " . $gallery_id . ")\n\t\t           \n\t\t         ";
     if (!empty($orders) && 0 < count($orders)) {
         $c = 1;
         $query .= " ORDER BY ";
         foreach ($orders as $column => $order) {
             $query .= " `" . $column . "` " . $order;
             if ($c < count($orders)) {
                 $query .= ",";
             }
             $c++;
         }
     }
     return $wpdb->get_results($wpdb->prepare($query));
 }
 private function drop_table_slideshow_jedo_galleryslide()
 {
     global $wpdb;
     $query = "DROP TABLE " . SlideshowJedoGallery::table_galleryslide();
     $wpdb->query($query);
     require_once ABSPATH . 'wp-admin' . DS . 'upgrade-functions.php';
     dbDelta($query, true);
 }