# HG changeset patch # User Gautier Thibault # Date 1272455221 -7200 # Node ID 5ffc23a7f801bca663c3ec702918ff46b4b67bc2 # Parent 301bb2f60b884c8e1ef83b913fc67dc1fd9482a9 update random film diff -r 301bb2f60b88 -r 5ffc23a7f801 web/thdProject/apps/frontend/modules/homepage/actions/components.class.php --- a/web/thdProject/apps/frontend/modules/homepage/actions/components.class.php Mon Apr 26 18:17:02 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/homepage/actions/components.class.php Wed Apr 28 13:47:01 2010 +0200 @@ -18,9 +18,43 @@ } public function executeRandomFilm() { - // FIXME: Dummy value - $this->tag = Array('score' => 3); - + + // Initialize query + $query = Doctrine_Query::create() + ->from('ThdFilm F') + ->leftJoin('F.images I ') + ->leftJoin('F.videos V') + //->where("cu.code='{$culture}' AND mo.code='{$module}' AND ms.code='{$section}'") + ->orderBy('RAND()'); + $this->film = $query->execute()->getFirst(); + + // Get image filename + $images = $this->film->getImages(); + $this->imageFilename = null; + + if ($images) { + $image = $images[0]; + $this->imageFilename = $image->getFile(); + } + + + // Get Tag cloud + // Only display 10 tags + $this->tagCloud = ThdUtil::getTagCloud($this->film->getTagCloud(), 10); + + // Get video filename + $videos = $this->film->getVideos(); + $this->videoFilename = null; + + if ($videos) { + $video = $videos[0]; + $this->videoFilename = $video->getFile(); + } + + // Create tag action + $controller = $this->getController(); + $this->actionUri = $controller->genUrl('@editVideoSegment?film_slug='.$this->film->getSlugUrl()); + } public function executeLastTaggedList() { diff -r 301bb2f60b88 -r 5ffc23a7f801 web/thdProject/apps/frontend/modules/homepage/templates/_randomFilm.php --- a/web/thdProject/apps/frontend/modules/homepage/templates/_randomFilm.php Mon Apr 26 18:17:02 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/homepage/templates/_randomFilm.php Wed Apr 28 13:47:01 2010 +0200 @@ -1,65 +1,108 @@ +
- -

Regardez et annotez des extraits :

-
+

Regardez et annotez des extraits :

+
- Anna M
De Michel Spinosa + getTitle(); ?>
De getDirectorsArray(), 'name'); ?>
-
- -
+
- - Tags liés au film : - - +
    +
  • + Tags liés au film : +
  • + getTagsArray() as $item) { + if($item){ + $tag = $item; + echo '
  • '.$tag.' +
  • '; + + } + } ?> + +
-
- +
+
Tagger le film
diff -r 301bb2f60b88 -r 5ffc23a7f801 web/thdProject/apps/frontend/modules/homepage/templates/indexSuccess.php --- a/web/thdProject/apps/frontend/modules/homepage/templates/indexSuccess.php Mon Apr 26 18:17:02 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/homepage/templates/indexSuccess.php Wed Apr 28 13:47:01 2010 +0200 @@ -1,5 +1,5 @@
- +
\ No newline at end of file