--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/apps/frontend/config/app.yml Fri Mar 12 19:22:21 2010 +0100
@@ -0,0 +1,11 @@
+# default values
+all:
+ storage:
+ #segmentation files
+ uploads: "/Users/ymh/dev/workspace/mosatags/web/thdProject/web/uploads"
+ format: ".csv"
+
+ player:
+ videoPath: "videos/"
+
+#dev:
--- a/web/thdProject/apps/frontend/modules/homepage/actions/actions.class.php Wed Mar 10 17:19:00 2010 +0100
+++ b/web/thdProject/apps/frontend/modules/homepage/actions/actions.class.php Fri Mar 12 19:22:21 2010 +0100
@@ -21,5 +21,17 @@
{
return sfView::SUCCESS;
}
-
+
+/**
+ * Execute search action
+ *
+ * @param sfRequest $request A request object
+ */
+ public function executeSearch(sfWebRequest $request)
+ {
+ return sfView::SUCCESS;
+
+ }
+
+
}
--- a/web/thdProject/apps/frontend/modules/homepage/actions/components.class.php Wed Mar 10 17:19:00 2010 +0100
+++ b/web/thdProject/apps/frontend/modules/homepage/actions/components.class.php Fri Mar 12 19:22:21 2010 +0100
@@ -39,4 +39,46 @@
$this->mostTaggedFilms = $query->execute();
$this->videoPath = sfConfig::get('app_player_videoPath');
}
+
+ public function executeResultList(sfWebRequest $request) {
+
+ $text = $request->getParameter('text');
+
+ $event = $this->dispatcher->notify(new sfEvent($this, 'uvmc_solr.search', array('query' => $text)));
+ $response = $event->getReturnValue();
+ // solr is configured to give you back a serialized php array
+ $rawResp = $response->getRawResponse();
+ $results = unserialize($rawResp);
+
+
+
+ $primaryKeys = array();
+ foreach($results['response']['docs'] as $doc)
+ {
+ if($doc['uniqueid'])
+ {
+ $primaryKeys[] = $doc['uniqueid'];
+ }
+ }
+
+ if(!empty($primaryKeys))
+ {
+ $this->searchResult = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys);
+ $this->searchCount = $this->searchResult->count();
+ }
+ else
+ {
+ $this->searchResult = array();
+ $this->searchCount = 0;
+ }
+
+
+ /*$query = Doctrine_Query::create()
+ ->from('ThdFilm F')
+ ->leftJoin('F.images I ')
+ ->leftJoin('F.videos V')
+ ->orderBy('F.id DESC')
+ ->limit(0,10);
+ $this->searchResult = $query->execute();*/
+ }
}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/apps/frontend/modules/homepage/templates/_resultList.php Fri Mar 12 19:22:21 2010 +0100
@@ -0,0 +1,53 @@
+<div id="resultList">
+ <h3 class="head">Films resultats de la recherche</h3>
+ <h3 class="head">Search length : <?php echo $searchCount ?></h3>
+ <ul>
+ <?php
+ foreach($searchResult as $item):
+ $ref = $item->getRef();
+ $slug = $item->getSlugUrl();
+ $title = $item->getTitle();
+
+ // image file
+ $image_file = $item->getImages();
+ // image file
+ $video_file = $item->getVideos();
+ // directors list
+ $directors = json_decode($item->getDirectors(), true);
+ ?>
+ <li>
+ <div id="playerMostTagged-<?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";?>"">
+ <div class="infos">
+ <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 $directors['name']; ?></span><
+ </div>
+ <a href="#"><img src="images/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>
+ <li class="tag-score-1">
+ <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-2">
+ <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>
+ </div>
+ </li>
+ <?php endforeach; ?>
+ </ul>
+</div>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/homepage/templates/_search.php Wed Mar 10 17:19:00 2010 +0100
+++ b/web/thdProject/apps/frontend/modules/homepage/templates/_search.php Fri Mar 12 19:22:21 2010 +0100
@@ -2,7 +2,7 @@
<h3 class="head">
Recherche classique :
</h3>
- <form name="search-form" id="search-form" method="get" action="">
+ <form name="search-form" id="search-form" method="get" action="<?php echo url_for('homepage/search') ?>">
<input type="text" name="text" value="tapez votre recherche..." class="field help search" />
<button type="submit" class="submit">chercher</button>
</form>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/thdProject/apps/frontend/modules/homepage/templates/searchSuccess.php Fri Mar 12 19:22:21 2010 +0100
@@ -0,0 +1,27 @@
+
+<div id="homepage">
+ <?php include_partial('partials/navigation')?>
+ <div id="document-sidebar">
+ <?php include_component( "homepage", "leftPanel" ) ?>
+ </div>
+ <div id="document">
+ <?php include_component( "homepage", "randomFilm" ) ?>
+ <?php include_component( "homepage", "resultList" ) ?>
+ </div>
+</div>
+<script language="JavaScript">
+ // a very simple setup
+ flowplayer("div.player-item", "flashes/flowplayer-3.1.3.swf",
+ {
+ // configuration for a clip
+ clip: {
+ autoPlay: true,
+ autoBuffering: true,
+ scaling: 'fit',
+ },
+ // setup controlbar to use skins
+ plugins: {
+ controls: conf.skins.universcine
+ }
+ });
+</script>
\ No newline at end of file
--- a/web/thdProject/config/databases.yml Wed Mar 10 17:19:00 2010 +0100
+++ b/web/thdProject/config/databases.yml Fri Mar 12 19:22:21 2010 +0100
@@ -4,4 +4,4 @@
param:
dsn: 'mysql:host=localhost;dbname=thd'
username: root
- password: null
+ password: root
--- a/web/thdProject/lib/model/doctrine/ThdFilmTable.class.php Wed Mar 10 17:19:00 2010 +0100
+++ b/web/thdProject/lib/model/doctrine/ThdFilmTable.class.php Fri Mar 12 19:22:21 2010 +0100
@@ -5,4 +5,17 @@
class ThdFilmTable extends Doctrine_Table
{
+ public function findByScoredId($ids)
+ {
+ $query = $this->createQuery('p');
+ $query->select('p.*')
+ ->whereIn('p.uniqueid', $ids)
+ // Keep scoring
+ // http://groups.google.com/group/symfony-users/browse_thread/thread/92adb0332dfe1065/ee7b8c0d27208368?lnk=gst&q=zend+search+sort#ee7b8c0d27208368
+ ->addSelect('FIELD(p.uniqueid,\''.implode('\', \'', $ids).'\') AS field')
+ ->orderBy('field');
+
+ return $query->execute();
+ }
+
}
\ No newline at end of file