update video gallery
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 17 May 2016 13:28:03 +0000 (09:28 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 17 May 2016 13:28:03 +0000 (09:28 -0400)
Toolkit/Videos/AdminEditVideoForm.php
Toolkit/Videos/Database/addTitle.sql [new file with mode: 0644]
Toolkit/Videos/Video.php
Toolkit/Videos/VideoMapper.php
Toolkit/Videos/VideosDataGrid.php

index 0977087..905890c 100644 (file)
@@ -131,6 +131,13 @@ class Toolkit_Videos_AdminEditVideoForm
                 'name' => 'featured'
             );
         }
+       $e[] = array(
+            'type'    => 'text',
+            'req'     => false,
+            'name'    => 'title',
+            'display' => 'Title',
+            'opts' => array('class' => 'text','size'=>50)
+        );
         $e[] = array(
                'type' => 'text',
                'req' => true,
@@ -210,18 +217,18 @@ class Toolkit_Videos_AdminEditVideoForm
        {
         $r = array();
 
-               $r[] = array(
-                       'element'    => 'video_url',
-                       'message'    => 'ERROR: Invalid URL format (http)',
-                       'type'       => 'checkURI',
-                       'format'     => array(
-                               'allowed_schemes' => array('http'),
-                               'strict' => false
-                       ),
-                       'validation' => $this->validationType,
-                       'reset'      => false,
-                       'force'      => false
-               );
+        $r[] = array(
+            'element'    => 'video_url',
+            'message'    => 'ERROR: Invalid URL format (http)',
+            'type'       => 'checkURI',
+            'format'     => array(
+                'allowed_schemes' => array('http', 'https'),
+                'strict' => false
+            ),
+            'validation' => $this->validationType,
+            'reset'      => false,
+            'force'      => false
+        );
 
 
                $this->setupRules($r);
@@ -252,6 +259,7 @@ class Toolkit_Videos_AdminEditVideoForm
             $video = new Toolkit_Videos_Video();
         }
         $video->setVideo_url($values['video_url'])
+            ->setTitle($values['title'])
             ->setFeatured($values['featured'])
             ->setActive($values['active']);
 
diff --git a/Toolkit/Videos/Database/addTitle.sql b/Toolkit/Videos/Database/addTitle.sql
new file mode 100644 (file)
index 0000000..fe0cbd1
--- /dev/null
@@ -0,0 +1,4 @@
+--
+-- Update the video table
+--
+ALTER TABLE videos.videos ADD title TEXT;
index d38b316..7879c45 100644 (file)
@@ -28,6 +28,7 @@ class Toolkit_Videos_Video
 {
 
     protected $id;
+    protected $title;
     protected $video_url;
     protected $pos;
     protected $featured;
@@ -170,6 +171,16 @@ class Toolkit_Videos_Video
         }
         return $this;
     }
+    public function getTitle()
+    {
+        return $this->title;
+    }
+
+    public function setTitle($title)
+    {
+        $this->title = $title;
+        return $this;
+    }
 
     /**
      * video_url getter
@@ -326,6 +337,7 @@ class Toolkit_Videos_Video
      */
     public function getVideoTitle()
     {
+       return $this->getTitle();
         $url = "http://gdata.youtube.com/feeds/api/videos/". $this->getVideoCode();
         $ch          = curl_init();
         $curlOptions = array(
index 2a00c87..26a1178 100644 (file)
@@ -95,6 +95,7 @@ class Toolkit_Videos_VideoMapper
             if ($res) {
                 $video = new Toolkit_Videos_Video();
                 $video->setId($res['id'])
+                    ->setTitle($res['title'])
                     ->setVideo_url($res['video_url'])
                     ->setActive($res['active'])
                     ->setfeatured($res['featured'])
index f9c5c93..1963f0f 100644 (file)
@@ -112,8 +112,8 @@ class Toolkit_Videos_VideosDataGrid
 
         $this->addColumn(
             new Structures_DataGrid_Column(
-            'Video Url',
-            'video_url',
+            'Title',
+            'title',
             null
             )
         );
@@ -212,7 +212,7 @@ class Toolkit_Videos_VideosDataGrid
             $vidCode = $match[1];
         }
         $thumb = ($vidCode)
-            ? '<a href="http://www.youtube.com/embed/'.$vidCode.'?rel=0" class="various fancybox.iframe vidimg"><img src="http://img.youtube.com/vi/'.$vidCode.'/default.jpg"></a>'
+            ? '<a href="http://www.youtube.com/embed/'.$vidCode.'?rel=0" class="colorbox"><img src="http://img.youtube.com/vi/'.$vidCode.'/default.jpg"></a>'
             : '';
         return $thumb;
     }