public function executeAttivitaGruppoArgomento() { // parametri obbligatori $this->ramo = $this->getRequestParameter('ramo'); $gruppo_id = $this->getRequestParameter('gruppo_id'); // parametri opzionali if ($this->hasRequestParameter('triple_value')) { $triple_value = $this->getRequestParameter('triple_value'); $this->argomento = TagPeer::retrieveFirstByTripleValue($triple_value); } if ($this->hasRequestParameter('tag_name')) { $this->tag_name = $this->getRequestParameter('tag_name', ''); $this->argomento = TagPeer::retrieveByTagName($this->tag_name); } if ($this->hasRequestParameter('tag_id')) { $this->tag_id = $this->getRequestParameter('tag_id', ''); $this->argomento = TagPeer::retrieveByPK($this->tag_id); } $limit = null; if ($this->hasRequestParameter('limit')) { $limit = $this->getRequestParameter('limit'); } // la data รจ passata come parametro o viene estratta l'ultima nella cache (per dati di tipo 'A', singoli atti) if ($this->hasRequestParameter('data')) { $this->data = $this->getRequestParameter('data'); } else { $this->data = OppActHistoryCachePeer::fetchLastData(); } $this->gruppo = OppGruppoPeer::retrieveByPK($gruppo_id); $this->forward404Unless($this->gruppo instanceof OppGruppo); $this->politici = OppCaricaPeer::getClassificaPoliticiSiOccupanoDiArgomenti(array($this->argomento->getId()), $this->ramo, $this->data, $limit, $gruppo_id, false); }
$pol->save(); $t->diag('Add a new charge'); $car = new OppCarica(); $car->setId(999999); $car->setOppPolitico($pol); $car->setTipoCaricaId(2); $car->setCarica('Ministro dell\'abolizione dei beni Inutili'); $car->setDataInizio('2008-10-10'); $car->save(); $pol_related_news = getRelatedNews($pol); $n_pol_related_news = count($pol_related_news); $t->diag("related_news: " . $n_pol_related_news); $t->ok($n_pol_related_news == 1, 'One news related to the politician'); dumpNews($t, "news related to the politician", $pol_related_news); $t->diag('Add a group to the charge'); $gruppo = OppGruppoPeer::retrieveByPK(1); $car_gruppo = new OppCaricaHasGruppo(); $car_gruppo->setOppCarica($car); $car_gruppo->setOppGruppo($gruppo); $car_gruppo->setDataInizio('2008-08-20'); $car_gruppo->save(); $pol_related_news = getRelatedNews($pol); $n_pol_related_news = count($pol_related_news); $t->ok($n_pol_related_news == 2, 'Two news related to the politician'); dumpNews($t, "news related to the politician", $pol_related_news); $t->diag('Add a first-signer, at the presentation date'); $firma = new OppCaricaHasAtto(); $firma->setTipo('P'); $firma->setOppCarica($car); $firma->setOppAtto($obj); $firma->setData($obj->getDataPres());