# HG changeset patch # User ymh # Date 1271748821 -7200 # Node ID 554e8a2144fa4e3f41afbf5c0fa114f0f096c815 # Parent 75a7a9d56840b5e59784bdc8aba51c95a3860f9c add reflexonomy search diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/config/routing.yml --- a/web/thdProject/apps/frontend/config/routing.yml Fri Apr 16 20:03:37 2010 +0200 +++ b/web/thdProject/apps/frontend/config/routing.yml Tue Apr 20 09:33:41 2010 +0200 @@ -49,13 +49,12 @@ ######## # TAGGING ######## - + tagging: url: /tagging/:tag/:page_nb - param: { module: tag, action: index, tag:all, page_nb: 1 } + param: { module: tag, action: index, tag: all, page_nb: 1 } requirements: { page_nb: \d+ } - ######## # FILMS ######## @@ -69,9 +68,18 @@ url: /top-des-films/:page/:page_nb param: { module: films, action: viewTopFilmList, page: page, page_nb: 1 } - - + +######### +# REFLEXONOMIES +######### + +searchReflex: + url: /reflex/:film_uniqueid/:tag/:direction/:distance + param: { module: reflex, action: index, tag: all, direction: more, distance: 5 } + requirements: { direction: more|less, distance: \d+ } + + default_index: url: /:module param: { action: index } diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/reflex/actions/actions.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/reflex/actions/actions.class.php Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,48 @@ +getRequestFormat(); + $this->film_uniqueid = (string) $request->getParameter('film_uniqueid'); + $this->tag = (string) $request->getParameter('tag'); + $this->direction = (string) $request->getParameter('direction'); + $this->distance = (int)$request->getParameter('distance'); + + $this->distance = $this->distance * ($this->direction=='more'?1.0:-1.0) / 100.0; + + $sonyengine = SonyengineClient::getInstance(); + $result = $client->engineFind($this->film_uniqueid,$this->tag,$this->distance,true); + foreach($results as $res) + { + $primaryKeys[] = $res['id']; + } + + if(!empty($primaryKeys)) + { + $this->mostTaggedFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys); + } + else + { + $this->mostTaggedFilms = array(); + } + + return sfView::SUCCESS; + } +} diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/reflex/actions/components.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/reflex/actions/components.class.php Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,31 @@ +from('ThdFilm F') + ->leftJoin('F.images I ') + ->leftJoin('F.videos V') + ->where("F.ref='{$ref}'"); + $this->film = $query->execute()->getFirst(); + if (!$this->film) return sfView::NONE; + + // retrieve video infos + $videos = $this->film->getVideos(); + $this->filmVideo = ($videos) ? $videos[0] : null; + + return sfView::SUCCESS; + } + + +} \ No newline at end of file diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/reflex/config/view.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/reflex/config/view.yml Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,10 @@ +all: + + stylesheets: [ /css/flashplayer.css, search.css ] + + javascripts: [ /js/flowplayer/flowplayer-3.1.0.min.js, /js/flowplayer/uc.flowplayer.config.js] + + + components: + sideBar: [ tag, tagNavigator ] + \ No newline at end of file diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/reflex/templates/_player.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/reflex/templates/_player.php Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,98 @@ + +
+

getTitle(); + // original title if exist + + if($film->getOriginalTitle()!= null) + { + echo " {".$film->getOriginalTitle()."}"; + } + ?> + De getDirectorsArray(), 'name'); ?>

+ +
diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/reflex/templates/_suggestionFilmList.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/reflex/templates/_suggestionFilmList.php Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,15 @@ +
+

Les films suivants

+ +
\ No newline at end of file diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/reflex/templates/_tagNavigator.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/reflex/templates/_tagNavigator.php Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,12 @@ +
+

Autres Tags associés à cet extrait

+ +
\ No newline at end of file diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/reflex/templates/indexSuccess.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/reflex/templates/indexSuccess.php Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,3 @@ +

Résultats de la recherche reflexonomique

+ + 'all', 'filmCount' => '10', 'mostTaggedFilms' => $mostTaggedFilms, 'pageIndex' => $pageIndex, 'pageNbItems' => $pageNbItems)); ?> diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/search/actions/viewTagListAction.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/search/actions/viewTagListAction.class.php Tue Apr 20 09:33:41 2010 +0200 @@ -0,0 +1,38 @@ +getRequestFormat(); + $this->tag = (string) $request->getParameter('tag'); + $pageNb = (int) $this->getRequestParameter('page_nb', 1); + $this->pageIndex = $pageNb -1; + $this->pageNbItems = 10; + $this->indexNbItems = 2; + + + $solr = uvmcSolrServicesManager::getInstance()->getService(); + $response = $solr->search("tags:".$this->tag, $this->pageIndex * $this->pageNbItems, $this->pageNbItems); + + $results = unserialize($response->getRawResponse()); + + $primaryKeys = array(); + foreach($results['response']['docs'] as $doc) + { + $primaryKeys[] = $doc['id']; + } + + if(!empty($primaryKeys)) + { + $this->mostTaggedFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys); + } + else + { + $this->mostTaggedFilms = array(); + } + + return sfView::SUCCESS; + } +} \ No newline at end of file diff -r 75a7a9d56840 -r 554e8a2144fa web/thdProject/apps/frontend/modules/tag/templates/_tagNavigator.php --- a/web/thdProject/apps/frontend/modules/tag/templates/_tagNavigator.php Fri Apr 16 20:03:37 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/tag/templates/_tagNavigator.php Tue Apr 20 09:33:41 2010 +0200 @@ -2,7 +2,7 @@

Autres Tags associés à cet extrait