public function executeIndex() { $this->getResponse()->setTitle('Monitora i tuoi rappresentanti - ' . sfConfig::get('app_main_title')); $this->getResponse()->addMeta('description', 'Cosa fanno i tuoi rappresentanti? Tutte le attività parlamentari aggiornate quotidianamente.', true); deppFiltersAndSortVariablesManager::resetVars($this->getUser(), 'module', 'module', array('acts_filter', 'sf_admin/opp_atto/sort', 'votes_filter', 'sf_admin/opp_votazione/sort', 'pol_camera_filter', 'pol_senato_filter', 'sf_admin/opp_carica/sort', 'argomento/atti_filter', 'argomento_leggi/sort', 'argomento_nonleg/sort', 'monitoring_filter')); // ultime attivita' della community $this->latest_activities = CommunityNewsPeer::getLatestActivities(4); // ultime news dal parlamento $c = oppNewsPeer::getHomeNewsCriteria(); $c->addDescendingOrderByColumn(NewsPeer::DATE); $itemsperpage = 4; $pager = new deppNewsPager('News', $itemsperpage); $pager->setCriteria($c); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; // atti in evidenza $this->lanci = array(); $c = new Criteria(); $c->add(sfLaunchingPeer::LAUNCH_NAMESPACE, 'home'); $c->add(sfLaunchingPeer::OBJECT_MODEL, 'OppAtto'); $c->setLimit(8); $c->addDescendingOrderByColumn(sfLaunchingPeer::PRIORITY); $evidences = sfLaunchingPeer::doSelect($c); foreach ($evidences as $evidence) { $atto = OppAttoPeer::retrieveByPk($evidence->getObjectId()); $this->lanci[] = $atto->getId(); } // post del blog $this->post_pager = sfSimpleBlogPostPeer::getTaggedPager('in evidenza', sfConfig::get('app_sfSimpleBlog_post_max_per_page', 10), $this->getRequestParameter('page', 1)); // estrae le circoscrizioni, compreso il valore 0 $this->senato_constituencies = OppCaricaPeer::getAllConstituencies('senato', false); $this->camera_constituencies = OppCaricaPeer::getAllConstituencies('camera', false); }
/** * Delete all launching for a launchable object (delete cascade emulation) * * @param BaseObject $object */ public function preDelete(BaseObject $object) { try { $c = new Criteria(); $c->add(sfLaunchingPeer::OBJECT_ID, $object->getPrimaryKey()); $ls = sfLaunchingPeer::doSelect($c); foreach ($ls as $l) { $l->delete(); } sfLaunchingPeer::resetPriorities(); } catch (Exception $e) { throw new deppPropelActAsLaunchableException('Unable to delete launchable object\'s related launchings records'); } }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(sfLaunchingPeer::ID, $pks, Criteria::IN); $objs = sfLaunchingPeer::doSelect($criteria, $con); } return $objs; }
public function executeKeyvoteComparati() { $lanci = array(); $c = new Criteria(); $c->add(sfLaunchingPeer::OBJECT_MODEL, 'OppVotazione'); $c->add(sfLaunchingPeer::LAUNCH_NAMESPACE, 'key_vote'); $c->addDescendingOrderByColumn(sfLaunchingPeer::PRIORITY); $evidences = sfLaunchingPeer::doSelect($c); foreach ($evidences as $evidence) { $c1 = new Criteria(); $c1->addJoin(OppCaricaPeer::ID, OppVotazioneHasCaricaPeer::CARICA_ID); $c1->add(OppVotazioneHasCaricaPeer::CARICA_ID, array($this->parlamentare1->getId(), $this->parlamentare2->getId()), Criteria::IN); $c1->add(OppVotazioneHasCaricaPeer::VOTAZIONE_ID, $evidence->getObjectId()); $results = OppVotazioneHasCaricaPeer::doSelect($c1); if (count($results) == 2) { if ($results[0]->getCaricaId() == $this->parlamentare1->getId()) { $left = 0; $right = 1; } else { $left = 1; $right = 0; } $lanci[] = array($results[1]->getOppVotazione(), $evidence->getObjectModel(), $results[$left]->getVoto(), $results[$right]->getVoto()); } } $this->lanci = $lanci; }