
<?php

class partialsComponents extends sfComponents {

  public function executeUserPanel() {
    $this->user = $this->getUser();
    if (!$this->user->isAuthenticated()) return sfView::NONE;
  }

  public function executeNavigation() {
    $this->user = $this->getUser();
    if (!$this->user->isAuthenticated()) return sfView::NONE;
  }

  public function executeSearch() {

  }

  public function executeFilmItem() {
    // FIXME
    $this->tag = Array('score' => 3);

    // 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());
  }
}
