public function executeAddTagValueToMyMonitoredTags() { $isAjax = $this->getRequest()->isXmlHttpRequest(); // fetch current user profile $opp_user = OppUserPeer::retrieveByPK($this->getUser()->getId()); // fetch the tag to add $tag_value = $this->getRequestParameter('tag_value'); $tag = TagPeer::retrieveFirstByTripleValue($tag_value); // try to add tag to my monitored tags or redirect to buypage if limit reached if ($this->_addTagToMyMonitoredTags($tag, $opp_user) == -1) { $this->getUser()->setAttribute('page_before_buy', $this->getRequest()->getReferer()); $this->redirect('@sottoscrizioni_pro'); } // a tag was added, 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()); } if ($isAjax) { $this->setTemplate('ajaxMyTags'); } else { $this->redirect('monitoring/tags?user_token=' . $this->getUser()->getToken()); } }
public function executeShowNonleg() { $this->triple_value = $this->getRequestParameter('triple_value'); $this->getResponse()->setTitle('Mozioni, interrogazioni, odg su ' . strtolower($this->triple_value) . ' - ' . sfConfig::get('app_main_title')); $this->response->addMeta('description', 'Tutti gli aggiornamenti sulle mozioni, interrogazioni, odg presentati in parlamento su ' . strtolower($this->triple_value), true); $this->argomento = TagPeer::retrieveFirstByTripleValue($this->triple_value); $this->forward404Unless(isset($this->argomento)); $this->user = OppUserPeer::retrieveByPK($this->user_id); $this->session = $this->getUser(); // reset dei filtri se richiesto esplicitamente if ($this->getRequestParameter('reset_filters', 'false') == 'true') { $this->getRequest()->getParameterHolder()->set('filter_nonleg_act_type', '0'); $this->getRequest()->getParameterHolder()->set('filter_act_ramo', '0'); $this->getRequest()->getParameterHolder()->set('filter_act_stato', '0'); } $this->processFilters(array('act_nonleg_type', 'act_ramo', 'act_stato')); // if all filters were reset, then restart if ($this->getRequestParameter('filter_nonleg_act_type') == '0' && $this->getRequestParameter('filter_act_ramo') == '0' && $this->getRequestParameter('filter_act_stato') == '0') { $this->redirect('@argomento_nonleg?triple_value=' . $this->triple_value); } $this->processListSort('argomento_nonleg/sort'); if ($this->hasRequestParameter('itemsperpage')) { $this->getUser()->setAttribute('itemsperpage', $this->getRequestParameter('itemsperpage')); } $itemsperpage = $this->getUser()->getAttribute('itemsperpage', sfConfig::get('app_pagination_limit')); $this->pager = new sfPropelPager('OppAtto', $itemsperpage); $c = new Criteria(); $c->addJoin(OppAttoPeer::ID, TaggingPeer::TAGGABLE_ID); $c->add(TaggingPeer::TAG_ID, $this->argomento->getId()); $c->add(TaggingPeer::TAGGABLE_MODEL, 'OppAtto'); $this->addFiltersCriteria($c); $this->addListSortCriteria($c, 'argomento_nonleg/sort'); $c->addDescendingOrderByColumn(OppAttoPeer::DATA_PRES); $this->pager->setCriteria($c); $this->pager->setPage($this->getRequestParameter('page', 1)); $this->pager->setPeerMethod('doSelectJoinOppTipoAtto'); $this->pager->init(); }