Permalink
Browse files

Meeting bookmarking, first version

  • Loading branch information...
1 parent 3b5c6a4 commit 7daa5b4f2ade3fc91d8486d551acd1753fe21e17 romaindeveaud committed Apr 22, 2010
@@ -34,6 +34,10 @@ meeting_voteclose:
url: /:h/voteclose
param: { module: meeting, action: voteclose }
+meeting_follow:
+ url: /:h/follow
+ param: { module: meeting, action: follow }
+
meeting_search:
url: /meeting/search
param: { module: meeting, action: search }
@@ -23,6 +23,8 @@ public function executeIndex(sfWebRequest $request)
// Getting the meetings created by the logged in user.
$this->meeting_list = Doctrine::getTable('meeting')->getMeetingsFromUser($this->getUser()->getProfileVar(sfConfig::get('app_user_id'))) ;
+
+ $this->followed_meeting_list = Doctrine::getTable('meeting')->getMeetingsFollowedByUser($this->getUser()->getProfileVar(sfConfig::get('app_user_id'))) ;
}
/**
@@ -258,6 +260,35 @@ public function executeCsv(sfWebRequest $request)
}
+ public function executeFollow(sfWebRequest $request)
+ {
+ $this->meeting = Doctrine::getTable('meeting')->getByHash($request->getParameter('h')) ;
+ $this->forward404Unless($this->meeting);
+
+ $user = Doctrine::getTable('user')->find($this->getUser()->getProfileVar(sfConfig::get('app_user_id'))) ;
+
+ if(!$user)
+ {
+ $this->getContext()->getConfiguration()->loadHelpers(array('I18N'));
+ $this->getUser()->setFlash('error', __('Vous ne semblez pas être authentifié. Veuillez vous authentifier pour suivre ce rendez-vous.')) ;
+ $this->redirect($request->getReferer()) ;
+ }
+
+ if ($follow = Doctrine::getTable('is_following')->findOneByMidAndUid($this->meeting->getId(), $user->getId()))
+ $follow->delete() ;
+ else
+ {
+ $follow = new is_following() ;
+ $follow->setMid($this->meeting->getId()) ;
+ $follow->setUid($user->getId()) ;
+ $follow->save() ;
+ }
+
+ //$this->redirect('meeting/show?h='.$this->meeting->getHash()) ;
+ if(!$request->isXmlHttpRequest())
+ $this->redirect($request->getReferer()) ;
+ }
+
/**
* Action triggered when a user clicks on 'Créer un nouveau rendez-vous'.
*/
@@ -3,10 +3,11 @@
<input type="text" id="m_search" class="search" name="h" value="<?php echo __("Entrez le code d'un sondage pour le visionner...") ?>" />
</form>
</fieldset>
-
+<div style="margin-top:-20px;"></div>
<?php $languages = sfConfig::get('app_languages') ; ?>
<?php if(count($meeting_list)): ?>
-<ul class="my_meetings">
+<h2 class='meeting_title'><?php echo image_tag('/images/book_bookmarks_32.png', array('class' => 'icon_32')).' '.__('Mes rendez-vous') ?></h2>
+<ul class="my_meetings" style="margin-bottom:30px;">
<?php setlocale(LC_TIME,$languages[$sf_user->getCulture()].'.utf8',$sf_user->getCulture()) ; // internationalization... ?>
<?php $i = 0 ; ?>
<?php foreach ($meeting_list as $meeting): ?>
@@ -37,11 +38,49 @@
<?php if(time() < strtotime($meeting->getDateEnd())): ?>
<li><a href="<?php echo url_for('meeting/voteclose?h='.$meeting->getHash()) ?>"><?php echo $meeting->getClosed() ? '<img class="icon_16" src="'.image_path('/images/lock_16.png').'" alt="Rouvrir les votes" /> '.__('Rouvrir les votes') : '<img class="icon_16" src="'.image_path('/images/lock_open_16.png').'" alt="Clore les votes" /> '.__('Clore les votes') ?></a></li>
<?php endif; ?>
- </ul>
+ </ul>
+ </li>
+ <?php endforeach; ?>
+</ul>
+<?php endif; ?>
+
+<?php if(count($followed_meeting_list)): ?>
+<h2 class='meeting_title' style="clear:both;"><?php echo image_tag('/images/rss_32.png', array('class' => 'icon_32')).' '.__('Mes rendez-vous suivis') ?></h2>
+<ul class='my_meetings'>
+ <?php setlocale(LC_TIME,$languages[$sf_user->getCulture()].'.utf8',$sf_user->getCulture()) ; // internationalization... ?>
+ <?php $i = 0 ; ?>
+ <?php foreach ($followed_meeting_list as $meeting): ?>
+ <li class="<?php echo $i++%2 ? 'even' : 'odd' ?>">
+ <div class="meeting_delete_expires">
+
+ <?php if(time() >= strtotime($meeting->getDateEnd()) || $meeting->getClosed()): ?>
+ <div style="color : red; font-weight: bold;"><?php echo __('Votes clos') ?>.</div>
+ <?php else: ?>
+ <div><?php echo __('Fermeture automatique des votes le') ?> <strong><?php echo strftime("%a %d %b %Y", strtotime($meeting->getDateEnd())) ?></strong>.</div>
+ <?php endif ; ?>
+
+ <div><?php echo __('Suppression automatique du sondage le') ?> <strong><?php echo strftime("%a %d %b %Y", strtotime($meeting->getDateDel())) ?></strong>.</div>
+ </div>
+ <div class="meeting_name">
+ <?php if(strlen($meeting->getTitle()) > 27): ?>
+ <?php echo substr_replace($meeting->getTitle(), '...', 27, strlen($meeting->getTitle())) ; ?>
+ <?php else: ?>
+ <?php echo $meeting->getTitle() ; ?>
+ <?php endif; ?>
+ </div>
+
+ <div class="meeting_code_div"><a href="<?php echo url_for('meeting/show?h='.$meeting->getHash()) ?>"><?php echo __('Code du sondage') ?> : <span class="meeting_code"><?php echo $meeting->getHash() ?></span></a></div>
+ <ul class="actions">
+ <li><a class="no_border" href="<?php echo url_for('meeting/csv?h='.$meeting->getHash()) ?>"><img class="icon_16" src="<?php echo image_path('/images/page_table_chart_16.png') ?>" alt="Exporter csv" /> <?php echo __('Exporter au format csv') ?></a></li>
+ <li>
+ <a href="<?php echo url_for('meeting/follow?h='.$meeting->getHash()) ?>"><img class="icon_16" src="<?php echo image_path('/images/rss_16.png') ?>" alt="Follow" /> <?php echo __('Stopper le suivi') ?></a>
+ </li>
+ </ul>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
+
<div style="clear : both; height : 30px ;"></div>
<a href="<?php echo url_for('meeting/new') ?>"><img class="icon_32" src="<?php echo image_path('/images/book_add_32.png') ?>" alt="<?php echo __('Nouveau rendez-vous') ?>" /> <?php echo __('Nouveau rendez-vous') ?></a>
@@ -10,7 +10,9 @@
<div id="url_meet_disc"><?php echo __('Copiez/collez ce lien pour partager ce sondage avec vos collaborateurs') ?> !</div>
<input type="text" class="search url_meet" readonly="readonly" value="http://<?php echo sfConfig::get('app_url').url_for('auth/mh?m='.$meeting->getHash()) ?>" /></div>
<?php endif; ?>
-<h2><img src="<?php echo image_path('/images/book_bookmarks_32.png') ?>" alt="Disponibilités" class="icon_32" /> <?php echo __('Quelles sont vos disponibilités') ?>?</h2>
+<h2><img src="<?php echo image_path('/images/book_bookmarks_32.png') ?>" alt="Disponibilités" class="icon_32" /> <?php echo __('Quelles sont vos disponibilités') ?>?
+<?php echo link_to ($meeting->isFollowedBy($sf_user->getProfileVar(sfConfig::get('app_user_id'))) ? image_tag('/images/rss_32.png', array('title' => __('Stopper le suivi de ce rendez-vous'), 'class' => 'icon_32')) : image_tag('/images/rss_32_bw.png', array('title' => __('Suivre ce rendez-vous'), 'class' => 'icon_32')), url_for('meeting/follow?h='.$meeting->getHash()), array('class' => 'follow')) ?>
+</h2>
<table>
<tbody>
<tr>
@@ -29,6 +31,7 @@
</table>
<br />
<?php echo __('Indiquez votre sélection en cliquant sur les cases à cocher').'. '.__('Utilisez ensuite le bouton "Voter" pour valider votre vote') ?>.
+<br />
<div class="contextMenu" id="poll_menu">
<ul>
<li id="comm"><img src="<?php echo image_path('/images/pencil_16.png') ?>" /> <?php echo __('Commenter') ?></li>
@@ -186,6 +189,7 @@ class="error_name"
<?php //echo $form ?>
</table>
+
<table id="legende">
<tr><td class="ok legend" colspan="1"></td><td><?php echo __('Disponible') ?></td></tr>
<!--<tr><td class="if_needed" colspan="1"></td><td>Disponible en cas de besoin</td></tr>-->
@@ -45,3 +45,11 @@ user:
surname: { type: string(255) }
mail: { type: string(255) }
language: { type : string(8), default: 'fr' }
+
+is_following:
+ columns:
+ mid: { type: integer }
+ uid: { type: integer }
+ relations:
+ meeting: { onDelete: CASCADE, local: mid, foreign: id, foreignAlias: meeting_followers }
+ user: { onDelete: CASCADE, local: uid, foreign: id, foreignAlias: user_follows }
Oops, something went wrong.

0 comments on commit 7daa5b4

Please sign in to comment.