/** * torna gli emendamenti presentati da questa carica (primo firmatario) * fino a una certa data * * @param string $settimana * @return array of Opp * @author Guglielmo Celata */ public function getPresentedEmendamentos($data = '') { // quando l'incarico è appena stato creato, non ci sono ancora firme if (!$this->isNew()) { $c = new Criteria(); $c->addJoin(OppCaricaHasEmendamentoPeer::EMENDAMENTO_ID, OppEmendamentoPeer::ID); $c->add(OppCaricaHasEmendamentoPeer::TIPO, 'P'); $c->add(OppCaricaHasEmendamentoPeer::CARICA_ID, $this->getId()); if ($data != '') { $c->add(OppCaricaHasEmendamentoPeer::DATA, $data, Criteria::LESS_THAN); $c->add(OppEmendamentoPeer::LEGISLATURA, OppLegislaturaPeer::getCurrent($data)); } else { $c->add(OppEmendamentoPeer::LEGISLATURA, OppLegislaturaPeer::getCurrent()); } $res = OppEmendamentoPeer::doSelect($c); return $res; } return null; }
if ($last_status->getNota() != NULL) { $link_collegato = ""; if (preg_match('#^Id. em. #', $last_status->getNota()) || preg_match('#^Sost. id. em. #', $last_status->getNota()) || preg_match('#^V. em. #', $last_status->getNota())) { $tmpfase = explode(' em. ', $last_status->getNota()); $fase_nota = $tmpfase[0] . ' em. '; if (substr_count($tmpfase[1], ",") > 0) { $tmpfase = explode(", ", $tmpfase[1]); } else { $tmpfase = trim($tmpfase[1]); } $c = new Criteria(); $c->addJoin(OppEmendamentoPeer::ID, OppAttoHasEmendamentoPeer::EMENDAMENTO_ID); $c->add(OppEmendamentoPeer::SEDE_ID, $last_status->getOppEmendamento()->getSedeId()); $c->add(OppEmendamentoPeer::NUMFASE, $tmpfase, Criteria::IN); $c->add(OppAttoHasEmendamentoPeer::ATTO_ID, $relatedAttos[0]->getOppAtto()->getId()); $collegati = OppEmendamentoPeer::doSelect($c); if (count($collegati) > 0) { $link_collegato = $fase_nota; foreach ($collegati as $num => $collegato) { $c = new Criteria(); $c->addJoin(OppEmendamentoHasIterPeer::EM_ITER_ID, OppEmIterPeer::ID); $c->add(OppEmendamentoHasIterPeer::EMENDAMENTO_ID, $collegato->getId()); $status_coll = OppEmIterPeer::doSelectOne($c); $link_collegato = $link_collegato . ($num > 0 ? ", " : "") . link_to($collegato->getNumfase(), '/emendamento/' . $collegato->getId()); if ($status_coll) { if ($status_coll->getFase() != 'Altro' && $status_coll->getFase() != 'Presentato') { $link_collegato = $link_collegato . " (" . $status_coll->getFase() . ")"; } } } }
/** * Executes show action * * @return void * @author Guglielmo Celata */ public function executeShow() { $this->emendamento = OppEmendamentoPeer::retrieveByPK($this->getRequestParameter('id')); $this->attoPortante = $this->emendamento->getAttoPortante(); $this->relatedAttos = $this->emendamento->getOppAttoHasEmendamentosJoinOppAtto(); //nel caso di sub-emedamento prendi l'emendamento portante if (substr_count($this->emendamento->getTitolo(), "/") == 1) { $em_portante = explode("/", $this->emendamento->getNumfase()); $c = new Criteria(); $c->addJoin(OppAttoHasEmendamentoPeer::EMENDAMENTO_ID, OppEmendamentoPeer::ID); $c->add(OppAttoHasEmendamentoPeer::ATTO_ID, $this->relatedAttos[0]->getAttoId()); $c->add(OppEmendamentoPeer::NUMFASE, $em_portante[0]); $c->add(OppEmendamentoPeer::SEDE_ID, $this->emendamento->getSedeId()); $this->em_portante = OppEmendamentoPeer::doSelect($c); } else { $this->em_portante = array(); } // Contralla se emendaneto non abbia sb-emendamenti $c = new Criteria(); $c->addJoin(OppAttoHasEmendamentoPeer::EMENDAMENTO_ID, OppEmendamentoPeer::ID); $c->add(OppAttoHasEmendamentoPeer::ATTO_ID, $this->relatedAttos[0]->getAttoId()); $c->add(OppEmendamentoPeer::NUMFASE, $this->emendamento->getNumfase() . "/%", Criteria::LIKE); $c->add(OppEmendamentoPeer::SEDE_ID, $this->emendamento->getSedeId()); $this->subEmendamenti = OppEmendamentoPeer::doSelect($c); $this->getResponse()->setTitle('Emendamento ' . $this->emendamento->getTitolo() . ' al ddl ' . $this->attoPortante->getRamo() . '.' . $this->attoPortante->getNumfase() . ' ' . Text::denominazioneAtto($this->attoPortante, 'index') . ' - ' . sfConfig::get('app_main_title')); $this->response->addMeta('description', 'Il testo e gli aggiornamenti emendamento ' . $this->emendamento->getTitolo() . ' al ddl ' . $this->attoPortante->getRamo() . '.' . $this->attoPortante->getNumfase() . ' ' . Text::denominazioneAtto($this->attoPortante, 'index'), true); }