search and tags modules
authorGautier Thibault <gthibault@universcine.com>
Wed, 14 Apr 2010 12:59:08 +0200
changeset 43 6b682e0e01dc
parent 42 a2b6a65ec553
child 44 39364e291638
search and tags modules
web/thdProject/apps/frontend/config/routing.yml
web/thdProject/apps/frontend/modules/homepage/templates/_search.php
web/thdProject/apps/frontend/modules/homepage/templates/_tagList.php
web/thdProject/apps/frontend/modules/partials/actions/components.class.php
web/thdProject/apps/frontend/modules/search/actions/actions.class.php
web/thdProject/apps/frontend/modules/search/actions/components.class.php
web/thdProject/apps/frontend/modules/search/config/view.yml
web/thdProject/apps/frontend/modules/search/templates/_leftPanel.php
web/thdProject/apps/frontend/modules/search/templates/_search.php
web/thdProject/apps/frontend/modules/search/templates/_searchList.php
web/thdProject/apps/frontend/modules/search/templates/_selectedFilm.php
web/thdProject/apps/frontend/modules/search/templates/_sideBar.php
web/thdProject/apps/frontend/modules/search/templates/_tagList.php
web/thdProject/apps/frontend/modules/search/templates/viewSearchListSuccess.php
web/thdProject/apps/frontend/modules/tag/actions/actions.class.php
web/thdProject/apps/frontend/modules/tag/actions/viewTagAction.class.php
web/thdProject/apps/frontend/modules/tag/actions/viewTagListAction.class.php
web/thdProject/apps/frontend/modules/tag/templates/viewTagListSuccess.php
web/thdProject/apps/frontend/modules/tag/templates/viewTagSuccess.php
web/thdProject/web/css/search.css
--- a/web/thdProject/apps/frontend/config/routing.yml	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/config/routing.yml	Wed Apr 14 12:59:08 2010 +0200
@@ -42,7 +42,7 @@
 
 search:
   url: /recherche/:filter/:page_nb
-  param: { module: search, action: viewSearchList, filter: all, page_nb: 1 }
+  param: { module: search, action: index, filter: all, page_nb: 1 }
   requirements: { page_nb: \d+ }
   
   
@@ -51,8 +51,9 @@
 ########  
   
 tagging:
-  url: /tagging
-  param: { module: tag, action: viewTag }
+  url: /tagging/:tag/:page_nb
+  param: { module: tag, action: index, tag:all, page_nb: 1 }
+  requirements: { page_nb: \d+ }
   
     
 ########
--- a/web/thdProject/apps/frontend/modules/homepage/templates/_search.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/homepage/templates/_search.php	Wed Apr 14 12:59:08 2010 +0200
@@ -2,7 +2,7 @@
 	<h3 class="head">
     Recherche classique :
 	</h3>
-  <form name="search-form" id="search-form" method="get" action="<?php echo url_for('homepage/search') ?>">
+  <form name="search-form" id="search-form" method="get" action="<?php echo url_for('@search') ?>">
     <input type="text" name="text" value="tapez votre recherche..." class="field help search" />
     <button type="submit" class="submit">chercher</button>
   </form>
--- a/web/thdProject/apps/frontend/modules/homepage/templates/_tagList.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/homepage/templates/_tagList.php	Wed Apr 14 12:59:08 2010 +0200
@@ -2,31 +2,13 @@
 	<h3 class="head">Navigation par tag :</h3>
 	<ul class="item-list tag-list">
 	  <li class="tag-score-<?php echo $tag['score']; ?>">
-	    <a href="<?php echo url_for('@tagging?tag=tag'); ?>">tag</a>
+	    <a href="<?php echo url_for('@tagging?tag=anna'); ?>">anna</a>
 	  </li><li class="tag-score-5">
-	    <a href="">tag</a>
-	  </li><li class="tag-score-3">
-	    <a href="">tag</a>
-	  </li><li class="tag-score-2">
-	    <a href="">tag</a>
-	  </li>
-	  <li class="tag-score-<?php echo $tag['score']; ?>">
-	    <a href="">anna</a>
-	  </li><li class="tag-score-5">
-	    <a href="">Jalousie</a>
+	    <a href="<?php echo url_for('@tagging?tag=Jalousie'); ?>">Jalousie</a>
 	  </li><li class="tag-score-3">
-	    <a href="">erotomanie</a>
+	    <a href="<?php echo url_for('@tagging?tag=erotomanie'); ?>">erotomanie</a>
 	  </li><li class="tag-score-2">
-	    <a href="">violence</a>
-	  </li>
-	  <li class="tag-score-<?php echo $tag['score']; ?>">
-	    <a href="">anna</a>
-	  </li><li class="tag-score-5">
-	    <a href="">Jalousie</a>
-	  </li><li class="tag-score-3">
-	    <a href="">erotomanie</a>
-	  </li><li class="tag-score-2">
-	    <a href="">violence</a>
+	    <a href="<?php echo url_for('@tagging?tag=violence'); ?>">violence</a>
 	  </li>
 	</ul>
 </div>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/partials/actions/components.class.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/partials/actions/components.class.php	Wed Apr 14 12:59:08 2010 +0200
@@ -12,5 +12,8 @@
     $this->user = $this->getUser();
     if (!$this->user->isAuthenticated()) return sfView::NONE;
   }
+  public function executeSearch() {
+
+  }
 
 }
--- a/web/thdProject/apps/frontend/modules/search/actions/actions.class.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/search/actions/actions.class.php	Wed Apr 14 12:59:08 2010 +0200
@@ -2,9 +2,13 @@
 
 class searchActions extends sfActions
 {
- 
+ /**
+  * Executes index action
+  *
+  * @param sfRequest $request A request object
+  */
   public function executeIndex(sfWebRequest $request)
   {
-	$this->forward('search', 'viewSearchList');
+    $this->forward('search', 'viewSearchList');
   }
 }
--- a/web/thdProject/apps/frontend/modules/search/actions/components.class.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/search/actions/components.class.php	Wed Apr 14 12:59:08 2010 +0200
@@ -2,19 +2,16 @@
 
 class searchComponents extends sfComponents
 {
-  public function executeLeftPanel() {
+  public function executeSideBar() {
+
+  }
+  public function executeSearch() {
 
   }
   
   public function executeSelectedFilm() {
 	
-  }
-  public function executeTagNavigator() {
-	
-  }
-  public function executeTagList() {
-	
-  }
+  }  
     
   
 }
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/search/config/view.yml	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/search/config/view.yml	Wed Apr 14 12:59:08 2010 +0200
@@ -1,5 +1,8 @@
 all:
   
-  stylesheets:    [ /css/flashplayer.css, search.css ]
+  stylesheets:    [ /css/flashplayer.css, /css/search.css ]
 
-  javascripts:   [ /js/flowplayer/flowplayer-3.1.0.min.js, /js/flowplayer/uc.flowplayer.config.js]
\ No newline at end of file
+  javascripts:   [ /js/flowplayer/flowplayer-3.1.0.min.js, /js/flowplayer/uc.flowplayer.config.js]
+  
+  components: 
+    sideBar: [ search, sideBar ]
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/search/templates/_leftPanel.php	Wed Apr 14 12:40:11 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<div id="tagPanel-header">
-	<h3 class="head">Navigation par tag :</h3>
-	<span>Autres tags associés à cet extrait</span>
-</div>
-<?php include_component( "search", "tagNavigator" ) ?>
-<?php include_component( "search", "tagList" ) ?>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/search/templates/_search.php	Wed Apr 14 12:40:11 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<div id="search">
-	<h3 class="head">
-    Recherche classique :
-	</h3>
-  <form name="search-form" id="search-form" method="get" action="<?php echo url_for('@search');?>">
-    <input type="text" name="text" value="Tapez votre recherche" class="field help search" />
-    <button type="submit" class="submit">Rechercher</button>
-  </form>
-</div>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/search/templates/_searchList.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/search/templates/_searchList.php	Wed Apr 14 12:59:08 2010 +0200
@@ -13,14 +13,14 @@
 		// directors list
 		$directors = json_decode($item->getDirectorsArray(), true);
 	?>
-	<li>	
-		<div id="player-<?php echo $ref; ?>" class="player-item" style="background:transparent url('/posters/<?php echo $image_file[0]['file'].".jpg"; ?>') no-repeat;" href="<?php echo $videoPath.$video_file[0]['file'].".f4v";?>">
+	<li class="film-item">	
+		<div id="player-<?php echo $ref; ?>" class="player-item" style="background:transparent url('<?php echo image_path('posters/'.$image_file[0]['file'].'.jpg'); ?>') no-repeat;" href="<?php echo video_path($video_file[0]['file']);?>">
 			<div class="infos">
-		    	<a href="<?php echo url_for('@editor?ref='.$ref.'&film_slug='.$slug); ?>" class="title" target="_top"><?php echo $title; ?></a> <span class="film-infos">De <?php echo $directors['name']; ?></span>
+		    	<a href="<?php echo url_for('@editor?ref='.$ref.'&film_slug='.$slug); ?>" class="title"><?php echo $title; ?></a> <span class="film-infos">De <?php echo thd_render_flat_list($item->getDirectorsArray(), 'name'); ?></span>
 		    </div>
-		    <img src="/images/buttons/btn_play.png"/ id="play"></a>
-		     <div class="tags">		    	
-				<ul class="item-list tag-list">   
+		    <img src="<?php echo image_path('buttons/btn_play.png'); ?>"/ id="play"></a>
+		     <div class="tags">
+				<ul class="item-list tag-list">
 				<li><span class="head">
 			    <i>Tags liés au film :</i>
 				</span></li>
@@ -41,12 +41,12 @@
 				    <a href="">erotomanie</a>
 				  </li><li class="tag-score-2">
 				    <a href="">violence</a>
-				  </li>				 
+				  </li>
 				</ul>
-		    </div>	    
+		    </div>
 		</div>
-		
+		<div class="tag-action"><a href="<?php echo url_for('@editor?ref='.$ref.'&film_slug='.$slug); ?>" class="link-button">Tagger le film</a></div>
 	</li>
 	<?php endforeach; ?>
-	</ul>	
-</div>	
\ No newline at end of file
+	</ul>
+</div>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/search/templates/_selectedFilm.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/search/templates/_selectedFilm.php	Wed Apr 14 12:59:08 2010 +0200
@@ -17,8 +17,7 @@
 			}
 	  });
 	}
-</script>
-  	<h3 class="head">Résultat pour : <i><?php echo $text; ?></i></h3>  
+</script>  	
 	<div id="player-ba" class="player-ba" style="background:transparent url('images/test/anna_m/capt720.jpg') no-repeat;">
 		<div class="infos">
 	    	<a href="http://embryon/videos/001009_l-humanite.f4v" onclick="launchSelected(this.href);return false;" class="title">Anna M</a><br/><span class="film-infos">De <b>Michel Spinosa</b></span>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/apps/frontend/modules/search/templates/_sideBar.php	Wed Apr 14 12:59:08 2010 +0200
@@ -0,0 +1,1 @@
+<?php include_component( "search", "search" ) ?>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/search/templates/_tagList.php	Wed Apr 14 12:40:11 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<div id="search-tag">
-<span>Ajoutez des tags à votre navigation :</span>	
-	<ul class="item-list search-tag-list">   
-	  <li class="tag-score-<?php echo $tag['score']; ?>">
-	    <a href="">tag</a>
-	  </li><li class="tag-score-5">
-	    <a href="">tag</a>
-	  </li><li class="tag-score-3">
-	    <a href="">tag</a>
-	  </li><li class="tag-score-2">
-	    <a href="">tag</a>
-	  </li>
-	  <li class="tag-score-<?php echo $tag['score']; ?>">
-	    <a href="">anna</a>
-	  </li><li class="tag-score-5">
-	    <a href="">Jalousie</a>
-	  </li><li class="tag-score-3">
-	    <a href="">erotomanie</a>
-	  </li><li class="tag-score-2">
-	    <a href="">violence</a>
-	  </li>
-	  <li class="tag-score-<?php echo $tag['score']; ?>">
-	    <a href="">anna</a>
-	  </li><li class="tag-score-5">
-	    <a href="">Jalousie</a>
-	  </li><li class="tag-score-3">
-	    <a href="">erotomanie</a>
-	  </li><li class="tag-score-2">
-	    <a href="">violence</a>
-	  </li>				 
-	</ul>
-</div>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/search/templates/viewSearchListSuccess.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/search/templates/viewSearchListSuccess.php	Wed Apr 14 12:59:08 2010 +0200
@@ -1,13 +1,7 @@
-<div id="global">
-	<?php include_partial('partials/navigation')?>
-	<div id="document-sidebar">
-		<?php include_component( "search", "leftPanel" ) ?>
-	</div>
-	<div id="document">
-		<?php include_component( "search", "selectedFilm", array('text'=> $text) ) ?>
-		<?php include_partial('search/searchList', array('filter' => 'all', 'filmCount' => '10', 'searchFilms' => $searchFilms, 'pageIndex' => $pageIndex, 'pageNbItems' => $pageNbItems)); ?>	
-	</div>
-</div>
+<h3 class="head">Résultats pour : <i><?php echo $text; ?></i></h3>  
+<?php include_component( "search", "selectedFilm") ?>
+<?php include_partial('search/searchList', array('filter' => 'all', 'filmCount' => '10', 'searchFilms' => $searchFilms, 'pageIndex' => $pageIndex, 'pageNbItems' => $pageNbItems)); ?>	
+
 <script language="JavaScript">
 	// a very simple setup
 	flowplayer("div.player-item", "../flashes/flowplayer-3.1.3.swf",
--- a/web/thdProject/apps/frontend/modules/tag/actions/actions.class.php	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/actions/actions.class.php	Wed Apr 14 12:59:08 2010 +0200
@@ -5,6 +5,6 @@
  
   public function executeIndex(sfWebRequest $request)
   {
-	$this->forward('tag', 'viewTag');
+	$this->forward('tag', 'viewTagList');
   }
 }
--- a/web/thdProject/apps/frontend/modules/tag/actions/viewTagAction.class.php	Wed Apr 14 12:40:11 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?php
-
-class viewTagAction extends sfAction {
-
-  public function execute($request) {
-  	// Parse request parameters
-    $format = $request->getRequestFormat();
-    $this->text = (string) $request->getParameter('tag');   
-
-    
-    return sfView::SUCCESS;
-  }
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/apps/frontend/modules/tag/actions/viewTagListAction.class.php	Wed Apr 14 12:59:08 2010 +0200
@@ -0,0 +1,17 @@
+<?php
+
+class viewTagListAction extends sfAction {
+
+  public function execute($request) {
+  	// Parse request parameters
+    $format = $request->getRequestFormat();
+    $this->tag = (string) $request->getParameter('tag');   
+    $pageNb = (int) $this->getRequestParameter('page_nb', 1);
+    $this->pageIndex = $pageNb -1;
+    $this->pageNbItems = 10;
+    $this->indexNbItems = 2;
+
+    
+    return sfView::SUCCESS;
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/apps/frontend/modules/tag/templates/viewTagListSuccess.php	Wed Apr 14 12:59:08 2010 +0200
@@ -0,0 +1,3 @@
+<h3 class="head">Résultats pour : <i><?php echo $tag; ?></i></h3> 
+<?php include_component( "tag", "player" ) ?>	
+<?php include_component( "tag", "suggestionFilmList" ) ?>	
--- a/web/thdProject/apps/frontend/modules/tag/templates/viewTagSuccess.php	Wed Apr 14 12:40:11 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<div id="content">
-	<?php include_component( "tag", "player" ) ?>	
-	<?php include_component( "tag", "suggestionFilmList" ) ?>	
-</div>
--- a/web/thdProject/web/css/search.css	Wed Apr 14 12:40:11 2010 +0200
+++ b/web/thdProject/web/css/search.css	Wed Apr 14 12:59:08 2010 +0200
@@ -1,68 +1,8 @@
-/* Tags */
-#search-tag ul.search-tag-list:after {
-  content: ".";
-  display: block;
-  height: 0;
-  overflow: hidden;
-  clear: both;
-  visibility: hidden;
-}
-
-#search-tag ul.search-tag-list li {
-  display: block;
-  padding: 2px 5px;
-}
-
-ul.search-tag-list li a {
-  display: block;
-  font-family: Georgia, "Times New Roman", Times,serif;
-  font-weight: normal;
-  line-height: 20px;
-  color: #666666;
-}
-
-ul.search-tag-list li.tag-score-1 a {
-	font-size: 12px;
-	color: #666666;
-}
-
-ul.search-tag-list li.tag-score-2 a {
-  font-size: 14px;
-  color: #666666;
-}
-
-ul.search-tag-list li.tag-score-3 a {
-  font-size: 16px;
-  color: #999999;
-  font-weight: bold;
-}
-
-ul.search-tag-list li.tag-score-4 a {
-  font-size: 18px;
-  color: #CCCCCC;
-}
-
-ul.search-tag-list li.tag-score-5 a {
-  font-size: 20px;
-  color: #FFFFFF;
-}
-
 /*SEARCH LIST*/
 #search-list{
   width:730px;
 } 
-#search-list li {
+#search-list li.film-item {
   float:left;
   margin: 5px;
-}
-
-
-/* Tag Navigator */
-#tagNavigator-list{
-  margin-bottom: 20px;
-}
-
-
-#tagNavigator-list li {
-  display: block;
-}
+}
\ No newline at end of file