예제 #1
0
 public function executeBrowser($request)
 {
     // We don't use a single integrated form for this anymore. What we wanted was
     // individual-link behavior, and yet we overlaid a form on that,
     // which had some interesting aspects but was ultimately confusing
     // and a problem for search engine indexing etc
     // ... But we do now use a simple form for the search form
     $this->current = "aMedia/index";
     $params = array();
     $type = aMediaTools::getSearchParameter('type');
     if (strlen($type)) {
         $this->type = $type;
         $params['type'] = $type;
     }
     $tag = aMediaTools::getSearchParameter('tag');
     if (strlen($tag)) {
         $this->selectedTag = $tag;
         $params['tag'] = $tag;
     }
     $categorySlug = aMediaTools::getSearchParameter('category');
     if (strlen($categorySlug)) {
         $this->selectedCategory = Doctrine::getTable('aMediaCategory')->findOneBySlug($categorySlug);
         $params['category'] = $categorySlug;
     }
     $search = aMediaTools::getSearchParameter('search');
     if (strlen($search)) {
         $this->search = $search;
         $params['search'] = $search;
     }
     $this->searchForm = new aMediaSearchForm();
     $this->searchForm->bind(array('search' => $request->getParameter('search')));
     $this->current .= "?" . http_build_query($params);
     $this->allTags = aMediaItemTable::getAllTagNameForUserWithCount();
     $tagsByPopularity = $this->allTags;
     arsort($tagsByPopularity);
     $this->popularTags = array();
     $n = 0;
     $max = aMediaTools::getOption('popular_tags');
     foreach ($tagsByPopularity as $tag => $count) {
         if ($n == $max) {
             break;
         }
         $this->popularTags[$tag] = $count;
         $n++;
     }
 }