public function executeTagList()
 {
   $c = new Criteria();
   $c->add(sfSimpleBlogPostPeer::IS_PUBLISHED, true);
   $c->add(TaggingPeer::TAGGABLE_ID, TaggingPeer::TAGGABLE_ID.' = '. sfSimpleBlogPostPeer::ID, Criteria::CUSTOM);
   $this->tags = TagPeer::getPopulars($c);
 }
$object5->addTag('tag1,tag3,tag7');
$object5->save();
// getAll() test
$tags = TagPeer::getAll();
$result = array();
foreach ($tags as $tag) {
    $result[] = $tag->getName();
}
$t->ok($result == array('tag2', 'tag3', 'tag1', 'tag4', 'tag5', 'tag6', 'tag7', 'tag8'), 'all tags can be retrieved with getAll().');
// getAllWithCount() test
$tags = TagPeer::getAllWithCount();
$t->ok($tags == array('tag1' => 3, 'tag2' => 2, 'tag3' => 5, 'tag4' => 2, 'tag5' => 1, 'tag6' => 1, 'tag7' => 3, 'tag8' => 1), 'all tags can be retrieved with getAll().');
// getPopulars() test
$c = new Criteria();
$c->setLimit(3);
$tags = TagPeer::getPopulars($c);
$t->ok(array_keys($tags) == array('tag1', 'tag3', 'tag7'), 'most popular tags can be retrieved with getPopulars().');
$t->ok($tags['tag3'] >= $tags['tag1'], 'getPopulars() preserves tag importance.');
// getRelatedTags() test
$tags = TagPeer::getRelatedTags('tag8');
$t->ok(array_keys($tags) == array('tag2', 'tag3', 'tag7'), 'related tags can be retrieved with getRelatedTags().');
$c = new Criteria();
$tags = TagPeer::getRelatedTags('tag2', array('limit' => 1));
$t->ok(array_keys($tags) == array('tag3'), 'when a limit is set, only most popular related tags are returned by getRelatedTags().');
// getRelatedTags() test
$tags = TagPeer::getRelatedTags('tag7');
$t->ok(array_keys($tags) == array('tag1', 'tag2', 'tag3', 'tag4', 'tag8'), 'getRelatedTags() aggregates tags from different objects.');
// getRelatedTags() test
$tags = TagPeer::getRelatedTags(array('tag2', 'tag7'));
$t->ok(array_keys($tags) == array('tag3', 'tag8'), 'getRelatedTags() can retrieve tags related to an array of tags.');
// getRelatedTags() test
 public function executeRemoveTagFromMyMonitoredTags()
 {
     $isAjax = $this->getRequest()->isXmlHttpRequest();
     // remove the tag from the monitored pool
     $tag_name = $this->getRequestParameter('name');
     $tag = TagPeer::retrieveByTagname($tag_name);
     $tag->removeMonitoringUser($this->getUser()->getId());
     // fetch current user profile and the number of tags the user can still add to the pool
     $opp_user = OppUserPeer::retrieveByPK($this->getUser()->getId());
     $this->remaining_tags = $opp_user->getNMaxMonitoredTags() - $opp_user->countMonitoredObjects('Tag');
     // fetch the monitored pool
     $c = new Criteria();
     $c->add(TagPeer::ID, $opp_user->getMonitoredPks('Tag'), Criteria::IN);
     $this->my_tags = TagPeer::getPopulars($c, array('limit' => 10));
     // a tag was removed, clear the cache for the news, acts and tags page
     $cacheManager = $this->getContext()->getViewCacheManager();
     if (!is_null($cacheManager)) {
         $cacheManager->remove('monitoring/news?user_token=' . $this->getUser()->getToken());
         $cacheManager->remove('monitoring/acts?user_token=' . $this->getUser()->getToken());
         $cacheManager->remove('monitoring/tags?user_token=' . $this->getUser()->getToken());
     }
     // remove the negative bookmarking from objects indirectly monitored thanks to this tag
     $indirectly_monitored_acts = OppAttoPeer::doSelectIndirectlyMonitoredByUser($opp_user, null, null, array($tag_id));
     foreach ($indirectly_monitored_acts as $act) {
         $act->removeNegativeBookmarking($this->getUser()->getId());
     }
     if ($isAjax) {
         $this->setTemplate('ajaxMyTags');
     } else {
         $this->redirect('monitoring/tags?user_token=' . $this->getUser()->getToken());
     }
 }
 /**
  * estrae i tag relativi al top tem
  *
  * @return void
  * @author Guglielmo Celata
  */
 public function executeAjaxTagsForTopTerm()
 {
     $isAjax = $this->getRequest()->isXmlHttpRequest();
     if (!$isAjax) {
         return sfView::noAjax;
     }
     $opp_user = OppUserPeer::retrieveByPK($this->getUser()->getId());
     $top_term_id = $this->getRequestParameter('tt_id');
     $c = new Criteria();
     $c->add(OppTagHasTtPeer::TESEOTT_ID, $top_term_id);
     $c->addJoin(OppTagHasTtPeer::TAG_ID, TagPeer::ID);
     $c->addAscendingOrderByColumn(TagPeer::TRIPLE_VALUE);
     $this->tags = TagPeer::getPopulars($c);
 }