Author: tkoomzaaskz
Date: 2010-01-22 16:53:37 +0100 (Fri, 22 Jan 2010)
New Revision: 27055

Modified:
   plugins/tdVideoPlugin/trunk/config/tdVideoPluginConfiguration.class.php
   plugins/tdVideoPlugin/trunk/lib/model/doctrine/PlugintdVideoTable.class.php
   plugins/tdVideoPlugin/trunk/modules/td_video/config/generator.yml
   plugins/tdVideoPlugin/trunk/package.xml
Log:
[td][video] release 0.1.2

Modified: 
plugins/tdVideoPlugin/trunk/config/tdVideoPluginConfiguration.class.php
===================================================================
--- plugins/tdVideoPlugin/trunk/config/tdVideoPluginConfiguration.class.php     
2010-01-22 15:51:20 UTC (rev 27054)
+++ plugins/tdVideoPlugin/trunk/config/tdVideoPluginConfiguration.class.php     
2010-01-22 15:53:37 UTC (rev 27055)
@@ -20,7 +20,7 @@
     // video files upload dir
     sfConfig::set('td_video_image_dir', 
sfConfig::get('sf_web_dir').'/tdVideoPlugin/flv');
 
-    // blog short text sign count
+    // video short description sign count
     sfConfig::set('td_video_short_text_sign_count', 200);
   }
 }
\ No newline at end of file

Modified: 
plugins/tdVideoPlugin/trunk/lib/model/doctrine/PlugintdVideoTable.class.php
===================================================================
--- plugins/tdVideoPlugin/trunk/lib/model/doctrine/PlugintdVideoTable.class.php 
2010-01-22 15:51:20 UTC (rev 27054)
+++ plugins/tdVideoPlugin/trunk/lib/model/doctrine/PlugintdVideoTable.class.php 
2010-01-22 15:53:37 UTC (rev 27055)
@@ -20,8 +20,8 @@
   static public function getActiveVideosQuery()
   {
     return Doctrine_Query::create()
-             ->from('tdVideo v')
-             ->where('v.active = "1"');
+      ->from('tdVideo v')
+      ->where('v.active = "1"');
   }
 
   /**
@@ -33,21 +33,64 @@
   static public function getActiveVideoByFileQuery($file)
   {
     return Doctrine_Query::create()
-             ->from('tdVideo v')
-             ->where('v.file = ?', $file)
-             ->andWhere('v.active = "1"');
+      ->from('tdVideo v')
+      ->where('v.file = ?', $file)
+      ->andWhere('v.active = "1"');
   }
 
   /**
    * Returns DQL query retrieving video files selected by ids.
    *
-   * @param Array $ids - Identifiers of selected links.
+   * @param Array $ids - Identifiers of selected videos.
    * @return Doctrine_Query
    */
   static public function getSelectedVideosQuery($ids)
   {
     return Doctrine_Query::create()
-             ->from('tdVideo v')
-             ->whereIn('v.id', $ids);
+      ->from('tdVideo v')
+      ->whereIn('v.id', $ids);
   }
+
+  /**
+   * Returns ids of all active videos.
+   *
+   * @param Array $ids - Identifiers of active videos.
+   * @return Array
+   */
+  static protected function getActiveVideosIds()
+  {
+    $query = self::getActiveVideosQuery()
+      ->select('v.id');
+    $data = $query->fetchArray();
+
+    $ids = array();
+    foreach($data as $d)
+    {
+      $ids[] = $d['id'];
+    }
+    return $ids;
+  }
+
+  /**
+   * Returns DQL query retrieving random videos.
+   *
+   * @param Integer $count - Number of videos to be returned by the query.
+   * @return Doctrine_Query
+   */
+  static public function getRandomActiveVideosQuery($count)
+  {
+    $ids = self::getActiveVideosIds();
+    
+    $selected = array();
+    for ($i = 0; $i < $count; $i++)
+    {
+      $id = rand(0, count($ids));
+      while (!isset($ids[$id]))
+        $id = rand(0, count($ids));
+      $selected[] = $ids[$id];
+      unset($ids[$id]);
+    }
+
+    return self::getSelectedVideosQuery($selected);
+  }
 }
\ No newline at end of file

Modified: plugins/tdVideoPlugin/trunk/modules/td_video/config/generator.yml
===================================================================
--- plugins/tdVideoPlugin/trunk/modules/td_video/config/generator.yml   
2010-01-22 15:51:20 UTC (rev 27054)
+++ plugins/tdVideoPlugin/trunk/modules/td_video/config/generator.yml   
2010-01-22 15:53:37 UTC (rev 27055)
@@ -57,10 +57,6 @@
             attributes: { size: 80 }
           author:
             attributes: { size: 80 }
-          name:
-            attributes: { size: 80 }
-          http:
-            attributes: { size: 80 }
           description:
             attributes: { cols: 80, rows: 10 }
       edit:

Modified: plugins/tdVideoPlugin/trunk/package.xml
===================================================================
--- plugins/tdVideoPlugin/trunk/package.xml     2010-01-22 15:51:20 UTC (rev 
27054)
+++ plugins/tdVideoPlugin/trunk/package.xml     2010-01-22 15:53:37 UTC (rev 
27055)
@@ -10,10 +10,10 @@
   <email>[email protected]</email>
   <active>yes</active>
  </lead>
- <date>2010-01-18</date>
+ <date>2010-01-22</date>
  <time>11:00:00</time>
  <version>
-   <release>0.1.1</release>
+   <release>0.1.2</release>
    <api>0.1.0</api>
  </version>
  <stability>
@@ -137,6 +137,11 @@
      <max>1.5.0</max>
      <exclude>1.5.0</exclude>
     </package>
+    <package>
+     <name>tdCorePlugin</name>
+     <channel>plugins.symfony-project.org</channel>
+     <min>0.1.7</min>
+    </package>
    </required>
   </dependencies>
 
@@ -147,6 +152,24 @@
 
    <release>
     <version>
+     <release>0.1.2</release>
+     <api>0.1.0</api>
+    </version>
+    <stability>
+     <release>beta</release>
+     <api>beta</api>
+    </stability>
+    <license uri="http://www.symfony-project.org/license";>MIT license</license>
+    <date>2010-01-22</date>
+    <license>MIT</license>
+    <notes>
+     * dependency on tdCorePlugin
+     * model table class methods added
+    </notes>
+   </release>
+
+   <release>
+    <version>
      <release>0.1.1</release>
      <api>0.1.0</api>
     </version>

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to