$firma = new OppCaricaHasAtto(); $firma->setTipo('P'); $firma->setOppCarica($car); $firma->setOppAtto($obj); $firma->setData($obj->getDataPres()); $firma->save(); $pol_related_news = getRelatedNews($pol); $n_pol_related_news = count($pol_related_news); $t->ok($n_pol_related_news == 3, 'Three news related to the politician'); dumpNews($t, "news related to the politician", $pol_related_news); $related_news = getRelatedNews($obj); $n_related_news = count($related_news); $t->ok($n_related_news == 5, 'Five news related to the act (no new news)'); dumpNews($t, "news related to the act", $related_news); $t->diag('Get a site'); $sede = OppSedePeer::retrieveByPK(11); $t->diag('Add an intervention on the act by the politician'); $int = new OppIntervento(); $int->setData('2008-11-20'); $int->setOppCarica($car); $int->setOppSede($sede); $int->setOppAtto($obj); $int->save(); $pol_related_news = getRelatedNews($pol); $n_pol_related_news = count($pol_related_news); $t->ok($n_pol_related_news == 4, 'Four news related to the politician'); dumpNews($t, "news related to the politician", $pol_related_news); $related_news = getRelatedNews($obj); $n_related_news = count($related_news); $t->ok($n_related_news == 7, 'Seven news related to the act (two more, detailed and group)'); dumpNews($t, "news related to the act", $related_news);
echo $tr_class; ?> "> <?php $tr_class = $tr_class == 'even' ? 'odd' : 'even'; ?> <th scope="row"> <p class="politician-id"> <?php $politico = OppCaricaPeer::retrieveByPk($k[0])->getOppPolitico(); ?> <?php echo image_tag(OppPoliticoPeer::getThumbUrl($politico->getId()), array('width' => '40', 'height' => '53')); ?> <?php echo link_to((OppSedePeer::retrieveByPk($sede_id)->getRamo() == 'CS' ? OppCaricaPeer::retrieveByPk($k[0])->getTipoCaricaId() == 1 ? 'On. ' : 'Sen. ' : '') . $politico->getNome() . " " . $politico->getCognome(), '@parlamentare?' . $politico->getUrlParams()); ?> <?php echo $k[1] != "componente" ? " (" . ucfirst($k[1]) . ")" : ""; ?> </p> </th> <td> <?php echo OppGruppoPeer::retrieveByPk($g)->getAcronimo(); ?> </td> <td> <?php echo OppCaricaPeer::retrieveByPk($k[0])->getCircoscrizione(); ?>
$tr_class = 'even'; foreach ($compara_comm as $k => $com) { ?> <tr class="<?php echo $tr_class == 'even' ? 'odd' : 'even'; ?> "> <?php $tr_class = $tr_class == 'even' ? 'odd' : 'even'; ?> <th scope='row'> <a href="#<?php echo $k; ?> "><?php echo OppSedePeer::retrieveByPk($k)->getDenominazione(); ?> </a></th> <td><?php echo number_format(count(OppAttoPeer::getAttiPerCommissioneLastIter($k, 'approvato definitivamente', $leg)), 0, '', '.'); ?> </td> <td><?php echo number_format($com[0], 0, '', '.'); ?> </td> <td><?php echo number_format($com[1], 0, '', '.'); ?> </td> <td><?php
/** * generate textual representation for a news * * @param News $news * @param String $generator_model * @param Array $pks * @param BaseObject $generator * @param Array $options * context - 0: box, 1: news per politico, 2:pagina di un atto, 3: argomento * in_mail - if the news lives in a mail or not * @return string (html) * @author Guglielmo Celata */ function news_text(News $news, $generator_model, $pks, $generator, $options = array()) { sfLoader::loadHelpers('Asset'); // default value for context if (!array_key_exists('context', $options)) { $context = CONTEXT_LIST; } else { $context = $options['context']; } // default value for in_mail if (!array_key_exists('in_mail', $options)) { $in_mail = false; } else { $in_mail = $options['in_mail']; } $news_string = ""; // notizie di gruppo (votazioni, interventi o emendamenti) if (count($pks) == 0) { if ($generator_model == 'OppVotazioneHasAtto') { if ($news->getPriority() == 1) { $news_string .= content_tag('p', $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '); $news_string .= content_tag('p', 'si è svolta almeno una VOTAZIONE'); } else { $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= 'si è svolta una VOTAZIONE</p>'; if ($context == CONTEXT_LIST) { $atto = call_user_func_array(array($news->getRelatedMonitorableModel() . 'Peer', 'retrieveByPK'), $news->getRelatedMonitorableId()); $atto_link = link_to_in_mail($atto->getRamo() . '.' . $atto->getNumfase() . ' ' . $atto->getTitolo(true), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo(true))); $news_string .= 'per ' . OppTipoAttoPeer::retrieveByPK($news->getTipoAttoId())->getDenominazione() . ' '; $news_string .= '<p>' . $atto_link . '</p>'; } } } if ($generator_model == 'OppIntervento') { $news_string .= "<p>"; $news_string .= OppSedePeer::retrieveByPK($news->getSedeInterventoId())->getRamo() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= 'C\'è stato <strong>almeno un intervento</strong> in '; if (OppSedePeer::retrieveByPK($news->getSedeInterventoId())->getTipologia() != 'Assemblea') { $news_string .= OppSedePeer::retrieveByPK($news->getSedeInterventoId())->getTipologia(); } $news_string .= ' ' . OppSedePeer::retrieveByPK($news->getSedeInterventoId())->getDenominazione(); if ($context = CONTEXT_LIST) { $news_string .= ' per ' . OppTipoAttoPeer::retrieveByPK($news->getTipoAttoId())->getDescrizione() . '</p> '; // link all'atto $atto = call_user_func_array(array($news->getRelatedMonitorableModel() . 'Peer', 'retrieveByPK'), array($news->getRelatedMonitorableId())); $atto_link = link_to_in_mail($atto->getRamo() . '.' . $atto->getNumfase() . ' ' . $atto->getTitolo(true), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo(true))); $news_string .= '<p>' . $atto_link . '</p>'; } else { $news_string .= '</p>'; } } if ($generator_model == 'OppEmendamento') { $related_monitorable_model = $news->getRelatedMonitorableModel(); if ($related_monitorable_model == 'OppAtto') { $atto = OppAttoPeer::retrieveByPK($news->getRelatedMonitorableId()); $n_pres = $atto->countPresentedEmendamentiAtDate($news->getDate()); if ($n_pres > 1) { $news_string .= content_tag('p', sprintf("Sono stati presentati %s", link_to($n_pres . " emendamenti", '/emendamenti_atto/' . $atto->getId()))); } else { $news_string .= content_tag('p', sprintf("È stato presentato %s", link_to("un emendamento", '/emendamenti_atto/' . $atto->getId()))); } } else { if ($related_monitorable_model == 'OppPolitico') { // fetch del politico $politico = OppPoliticoPeer::retrieveByPK($news->getRelatedMonitorableId()); $n_signs = $politico->countSignedEmendamentiAtDate($news->getDate()); if ($n_signs > 1) { $news_string .= content_tag('p', "Ha firmato <b>{$n_signs}</b> emendamenti"); } else { $news_string .= content_tag('p', "Ha firmato un emendamento"); } } } } return $news_string; } // eccezione per firma, quando in pagina argomenti // corregge bug #307 if ($context == CONTEXT_TAG && $generator_model == 'OppCaricaHasAtto') { $atto = $generator->getOppAtto(); $carica = $generator->getOppCarica(); $tipo = $atto->getOppTipoAtto(); $tipo_firma = $generator->getTipo(); switch ($tipo_firma) { case "P": $tipo_firma = 'presenta'; break; case "C": $tipo_firma = 'firma'; break; case "R": $tipo_firma = 'è relatore'; break; } $atto_link = link_to_in_mail(troncaTesto(Text::denominazioneAtto($atto, 'list', true), 200), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo(true))); $politico = $carica->getOppPolitico(); $politico_link = link_to_in_mail($politico, '@parlamentare?' . $politico->getUrlParams(), array('title' => 'Vai alla scheda del politico')); $news_string .= '<p>'; $news_string .= $politico_link; $news_string .= " <strong>" . $tipo_firma . "</strong> "; if ($tipo_firma == 'è relatore') { $news_string .= "dell'atto "; } else { $news_string .= "l'atto "; } $news_string .= $tipo->getDescrizione() . "</p>"; $news_string .= '<p>' . $atto_link . '</p>'; return $news_string; } if ($generator) { $related_monitorable_model = $news->getRelatedMonitorableModel(); if ($related_monitorable_model == 'OppPolitico') { // fetch del politico $c = new Criteria(); $c->add(OppPoliticoPeer::ID, $news->getRelatedMonitorableId()); $politici = OppPoliticoPeer::doSelect($c); if (count($politici) == 0) { return 'empty OppPolitico:' . $news->getRelatedMonitorableId(); } $politico = $politici[0]; // link al politico $politico_link = link_to_in_mail($politico->getNome() . ' ' . $politico->getCognome(), '@parlamentare?' . $politico->getUrlParams(), array('title' => 'Vai alla scheda del politico')); // nuovo incarico if ($generator_model == 'OppCarica') { if ($context != CONTEXT_POLITICO) { $news_string .= "<p><strong>assume l'incarico di " . $generator->getCarica() . "</strong> il politico</p>"; $news_string .= "<p>" . $politico_link . "</p>"; } else { $news_string .= "<p><strong>Assume l'incarico di " . $generator->getCarica() . "</strong></p>"; } } else { if ($generator_model == 'OppCaricaHasGruppo') { if ($context != CONTEXT_POLITICO) { $news_string .= "<p><strong>si unisce al gruppo " . $generator->getOppGruppo()->getNome() . "</strong> il politico</p>"; $news_string .= "<p>" . $politico_link . "</p>"; } else { $news_string .= "<p><strong>Si unisce al gruppo " . $generator->getOppGruppo()->getNome() . "</strong></p>"; } } else { if ($generator_model == 'OppIntervento') { $atto = $generator->getOppAtto(); $tipo = $atto->getOppTipoAtto(); $atto_link = link_to_in_mail(troncaTesto(Text::denominazioneAtto($atto, 'list', true), 200), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo(true))); if ($context == CONTEXT_LIST) { $news_string .= "<p>" . $politico_link . " <strong>interviene</strong>"; if ($generator->getUrl() != NULL) { if (substr_count($generator->getUrl(), '@') > 0) { $int_urls = explode("@", $generator->getUrl()); $intervento_link = " [vai ai testi"; foreach ($int_urls as $cnt => $int_url) { if (!preg_match('#^http://#', $int_url)) { $int_url = sfConfig::get('app_url_sito_camera', 'http://nuovo.camera.it/') . $int_url; } $intervento_link .= " " . link_to($cnt + 1, $int_url) . ","; } $intervento_link = rtrim($intervento_link, ","); $intervento_link .= "]"; } else { $intervento_link = " [" . link_to('vai al testo', $generator->getUrl()) . "]"; } } else { $intervento_link = ""; } $news_string .= $intervento_link . " in "; if ($generator->getOppSede()->getId() != 35 && $generator->getOppSede()->getId() != 36) { $news_string .= $generator->getOppSede()->getTipologia() . " "; } $news_string .= strtoupper($generator->getOppSede()->getDenominazione()) . " su "; $news_string .= $tipo->getDescrizione() . "</p>"; $news_string .= "<p>" . $atto_link . "</p>"; } if ($context == CONTEXT_ATTO) { $news_string .= "<p>"; if ($generator->getOppSede()->getId() != 35 && $generator->getOppSede()->getId() != 36) { $news_string .= $generator->getOppSede()->getTipologia() . " - "; } $news_string .= ucfirst(strtolower($generator->getOppSede()->getDenominazione())); $news_string .= $politico_link . " <strong>è intervenuto</strong>"; if ($generator->getUrl() != NULL) { if (substr_count($generator->getUrl(), '@') > 0) { $int_urls = explode("@", $generator->getUrl()); $intervento_link = " [vai ai testi"; foreach ($int_urls as $cnt => $int_url) { if (!preg_match('#^http://#', $int_url)) { $int_url = sfConfig::get('app_url_sito_camera', 'http://nuovo.camera.it/') . $int_url; } $intervento_link .= " " . link_to($cnt + 1, $int_url) . ","; } $intervento_link = rtrim($intervento_link, ","); $intervento_link .= "]"; } else { $intervento_link = " [" . link_to('vai al testo', $generator->getUrl()) . "]"; } } else { $intervento_link = ""; } $news_string .= $intervento_link . " sull'atto </p>"; } if ($context == CONTEXT_POLITICO) { $news_string .= "<p><strong>Interviene</strong>"; if ($generator->getUrl() != NULL) { if (substr_count($generator->getUrl(), '@') > 0) { $int_urls = explode("@", $generator->getUrl()); $intervento_link = " [vai ai testi"; foreach ($int_urls as $cnt => $int_url) { if (!preg_match('#^http://#', $int_url)) { $int_url = sfConfig::get('app_url_sito_camera', 'http://nuovo.camera.it/') . $int_url; } $intervento_link .= " " . link_to($cnt + 1, $int_url) . ","; } $intervento_link = rtrim($intervento_link, ","); $intervento_link .= "]"; } else { $intervento_link = " [" . link_to('vai al testo', $generator->getUrl()) . "]"; } } else { $intervento_link = ""; } $news_string .= $intervento_link . " in "; $news_string .= $generator->getOppSede()->getTipologia() . " "; $news_string .= strtoupper($generator->getOppSede()->getDenominazione()) . " su "; $news_string .= $tipo->getDescrizione() . "</p>"; $news_string .= "<p>" . $atto_link . "</p>"; } } else { if ($generator_model == 'OppCaricaHasAtto') { $atto = $generator->getOppAtto(); $tipo = $atto->getOppTipoAtto(); $tipo_firma = $generator->getTipo(); switch ($tipo_firma) { case "P": $tipo_firma = 'presenta'; break; case "C": $tipo_firma = 'firma'; break; case "R": $tipo_firma = 'è relatore'; break; } $atto_link = link_to_in_mail(troncaTesto(Text::denominazioneAtto($atto, 'list', true), 200), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo())); if ($context == CONTEXT_POLITICO) { $news_string .= '<p><strong>' . ucfirst($tipo_firma) . "</strong> "; } else { $news_string .= '<p>' . $politico_link . " <strong>" . $tipo_firma . "</strong> "; } if ($context != CONTEXT_ATTO) { $news_string .= $tipo->getDescrizione() . "</p>"; $news_string .= '<p>' . $atto_link . '</p>'; } else { if ($tipo_firma == 'è relatore') { $news_string .= "dell'atto</p>"; } else { $news_string .= "l'atto</p>"; } } } else { if ($generator_model == 'OppCaricaHasEmendamento') { $emendamento = $generator->getOppEmendamento(); $tipo_firma = $generator->getTipo(); switch ($tipo_firma) { case "P": $tipo_firma = 'presenta'; break; case "C": $tipo_firma = 'firma'; break; case "R": $tipo_firma = 'è relatore'; break; } $news_string .= "<p>"; if ($context == CONTEXT_POLITICO) { $news_string .= '<strong>' . ucfirst($tipo_firma) . "</strong> "; } else { $news_string .= $politico_link . " <strong>" . $tipo_firma . "</strong> "; } if ($tipo_firma == 'è relatore') { $news_string .= "dell'emendamento"; } else { $news_string .= "l'emendamento"; } $news_string .= ' "' . link_to_in_mail($emendamento->getTitoloCompleto(), '@singolo_emendamento?id=' . $emendamento->getId()) . '"'; if ($context != CONTEXT_ATTO) { $atto = $emendamento->getAttoPortante(); // tipo di atto e genere per gli articoli e la desinenza $tipo = $atto->getOppTipoAtto(); if (in_array($tipo->getId(), array(1, 10, 11, 12, 13, 15, 16, 17))) { $gender = 'm'; } else { $gender = 'f'; } $news_string .= " riferito " . ($gender == 'm' ? 'al ' : 'alla '); $news_string .= $atto->getOppTipoAtto()->getDescrizione() . " "; $news_string .= link_to_in_mail(troncaTesto(Text::denominazioneAtto($atto, 'list'), 200), 'atto/index?id=' . $atto->getId()); } } else { $news_string .= $generator_model; } } } } } } else { if ($related_monitorable_model == 'OppAtto') { // fetch dell'atto $c = new Criteria(); $c->add(OppAttoPeer::ID, $news->getRelatedMonitorableId()); $atti = OppAttoPeer::doSelectJoinOppTipoAtto($c); // detect a void query if (count($atti) == 0) { return 'empty OppAtto:' . $news->getRelatedMonitorableId(); } $atto = $atti[0]; // tipo di atto e genere per gli articoli e la desinenza $tipo = $atto->getOppTipoAtto(); if (in_array($tipo->getId(), array(1, 10, 11, 12, 13, 15, 16, 17))) { $gender = 'm'; } else { $gender = 'f'; } // link all'atto $atto_link = link_to_in_mail(troncaTesto(Text::denominazioneAtto($atto, 'list', true), 200), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo(true))); // presentazione o passaggio di stato if ($generator_model == 'OppAtto') { if ($tipo->getId() == 1 && $news->getSucc() !== null) { // passaggio di stato (cambio ramo?) // fetch dell'oggetto succ $succ_atto = OppAttoPeer::retrieveByPK($news->getSucc()); $succ_atto_link = link_to_in_mail($succ_atto->getRamo() . "." . $succ_atto->getNumFase(), 'atto/index?id=' . $succ_atto->getId(), array('title' => $succ_atto->getTitolo(true))); $this_atto_link = link_to_in_mail($atto->getRamo() . "." . $atto->getNumFase(), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo(true))); $news_string .= "<p>"; $news_string .= "il ddl {$this_atto_link}, approvato "; if ($atto->getRamo() == 'C') { $news_string .= "alla Camera, "; } else { $news_string .= "al Senato, "; } $news_string .= "<strong>è ora approdato "; if ($succ_atto->getRamo() == 'C') { $news_string .= "alla Camera</strong> "; } else { $news_string .= "al Senato</strong> "; } $news_string .= "come {$succ_atto_link}."; $news_string .= "</p>"; } else { // presentazione atto switch ($tipo_atto = $tipo->getId()) { case 13: $news_string .= "<p>Comunicato del governo: "; $news_string .= $atto_link . "</p>"; break; case 14: $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= "<strong>Svolta</strong> audizione "; $news_string .= $atto_link . "</p>"; break; default: $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= "<strong>Presentat" . ($gender == 'm' ? 'o' : 'a') . "</strong> "; if ($context != 0) { $news_string .= $tipo->getDescrizione() . "</p>"; $news_string .= "<p>" . $atto_link . "</p>"; } else { $news_string .= "</p>"; } break; } } } else { if ($generator_model == 'OppIntervento') { $politico = $generator->getOppCarica()->getOppPolitico(); $politico_link = link_to_in_mail($politico, '@parlamentare?' . $politico->getUrlParams(), array('title' => 'Vai alla scheda del politico')); $news_string .= "<p>" . $politico_link . " <strong>interviene</strong>"; if ($generator->getUrl() != NULL) { if (substr_count($generator->getUrl(), '@') > 0) { $int_urls = explode("@", $generator->getUrl()); $intervento_link = " [vai ai testi"; foreach ($int_urls as $cnt => $int_url) { if (!preg_match('#^http://#', $int_url)) { $int_url = sfConfig::get('app_url_sito_camera', 'http://nuovo.camera.it/') . $int_url; } $intervento_link .= " " . link_to_in_mail($cnt + 1, $int_url) . ","; } $intervento_link = rtrim($intervento_link, ","); $intervento_link .= "]"; } else { $intervento_link = " [" . link_to_in_mail('vai al testo', $generator->getUrl()) . "]"; } } else { $intervento_link = ""; } $news_string .= $intervento_link . " in "; if ($generator->getOppSede()->getId() != 35 && $generator->getOppSede()->getId() != 36) { $news_string .= $generator->getOppSede()->getTipologia() . " "; } $news_string .= strtoupper($generator->getOppSede()->getDenominazione()); $news_string .= $news->getRamoVotazione() == 'C' ? ' alla Camera su' : ' al Senato su'; $news_string .= " " . $tipo->getDescrizione() . "</p>"; $news_string .= '<p>' . $atto_link . '</p>'; } else { if ($generator_model == 'OppCaricaHasAtto') { $tipo_firma = $generator->getTipo(); switch ($tipo_firma) { case "P": $tipo_firma = 'presentato'; break; case "C": $tipo_firma = 'firmato'; break; case "R": $tipo_firma = 'è relatore'; break; } $politico = $generator->getOppCarica()->getOppPolitico(); $politico_link = link_to_in_mail($politico, '@parlamentare?' . $politico->getUrlParams(), array('title' => 'Vai alla scheda del politico')); if ($tipo_firma != 'è relatore') { $news_string .= "<p>"; $news_string .= $politico_link; $news_string .= " <strong>ha " . $tipo_firma . "</strong> "; $news_string .= $tipo->getDescrizione() . "</p>"; $news_string .= '<p>' . $atto_link . '</p>'; } } else { if ($generator_model == 'OppAttoHasSede') { $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= "<strong>è all'esame</strong> in "; $news_string .= $generator->getOppSede()->getTipologia() . " "; $news_string .= content_tag('b', strtoupper($generator->getOppSede()->getDenominazione())); if ($context != 0) { $news_string .= " " . $tipo->getDescrizione() . "</p>"; $news_string .= "<p>" . $atto_link . "</p>"; } else { $news_string .= "</p>"; } } else { if ($generator_model == 'OppVotazioneHasAtto') { $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; if ($news->getPriority() == 1) { $news_string .= link_to(' <strong>si è svolta la votazione finale</strong>', '@votazione?' . $generator->getOppVotazione()->getUrlParams()); } else { $news_string .= " si è svolta la votazione per " . link_to($generator->getOppVotazione()->getTitolo(), '@votazione?' . $generator->getOppVotazione()->getUrlParams()); } if ($context != 0) { $news_string .= " relativa a " . $tipo->getDescrizione() . "</p>"; $news_string .= "<p>" . $atto_link . "</p>"; } else { $news_string .= "</p>"; } } else { if ($generator_model == 'OppAttoHasIter') { $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= content_tag('b', news_text_for_iter($generator->getOppIter()->getId(), $gender)); $news_string .= articolo($tipo->getId()) . $tipo->getDescrizione() . "</p>"; if ($context != CONTEXT_ATTO) { $news_string .= "<p>" . $atto_link . "</p>"; } else { $news_string .= ""; } } else { if ($generator_model == 'Tagging') { $news_string .= "<p>" . articolo($tipo->getId()); $news_string .= $tipo->getDescrizione() . " "; $news_string .= $atto_link . " "; $news_string .= "presentat" . ($gender == 'm' ? 'o' : 'a') . " "; if ($news->getRamoVotazione() == 'C') { $news_string .= ' alla Camera '; } else { if ($news->getRamoVotazione() == 'S') { $news_string .= ' al Senato '; } } $news_string .= "il " . $news->getDataPresentazioneAtto('d/m/Y') . " "; $news_string .= "è stat" . ($gender == 'm' ? 'o' : 'a') . " <b>aggiunt" . ($gender == 'm' ? 'o' : 'a') . " al monitoraggio dell'argomento "; $news_string .= $generator->getTag()->getTripleValue() . "</b></p>"; } else { if ($generator_model == 'OppDocumento') { $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= "E' disponibile il <strong>nuovo documento</strong> "; $news_string .= '"' . link_to($generator->getTitolo(), 'atto/documento?id=' . $generator->getId()) . '"'; if ($context != CONTEXT_ATTO) { $news_string .= " riferito " . ($gender == 'm' ? 'al ' : 'alla '); $news_string .= $generator->getOppAtto()->getOppTipoAtto()->getDescrizione() . "</p>"; $news_string .= "<p>" . link_to($generator->getOppAtto()->getRamo() . "." . $generator->getOppAtto()->getNumfase() . " " . troncaTesto(Text::denominazioneAtto($generator->getOppAtto(), 'list'), 200), 'atto/index?id=' . $generator->getOppAtto()->getId()) . "</p>"; } } else { if ($generator_model == 'OppAttoHasEmendamento') { $emendamento = $generator->getOppEmendamento(); $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= "E' stato presentato "; $news_string .= " in " . $emendamento->getOppSede()->getDenominazione(); $news_string .= " l'<b>emendamento</b> "; $news_string .= '"' . link_to_in_mail($emendamento->getTitoloCompleto(), '@singolo_emendamento?id=' . $emendamento->getId()) . '"'; if ($context != CONTEXT_ATTO) { $news_string .= " riferito " . ($gender == 'm' ? 'al ' : 'alla '); $news_string .= $generator->getOppAtto()->getOppTipoAtto()->getDescrizione() . " "; $news_string .= link_to_in_mail(troncaTesto(Text::denominazioneAtto($generator->getOppAtto(), 'list'), 200), 'atto/index?id=' . $generator->getOppAtto()->getId()); } $news_string .= "</p>"; } else { if ($generator_model == 'OppEmendamentoHasIter') { $emendamento = $generator->getOppEmendamento(); $atti = $emendamento->getOppAttoHasEmendamentosJoinOppAtto(); $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera: ' : 'Senato: '; $news_string .= $emendamento->getOppSede()->getDenominazione() . " - "; $news_string .= "L'<b>emendamento</b> "; $news_string .= '"' . link_to_in_mail($emendamento->getTitoloCompleto(), '@singolo_emendamento?id=' . $emendamento->getId()) . '"'; if ($context != CONTEXT_ATTO) { $news_string .= " riferito " . ($gender == 'm' ? 'al ' : 'alla '); $news_string .= $atto_link; } $news_string .= " è stato " . content_tag('b', strtolower($generator->getOppEmIter()->getFase())); } else { if ($generator_model == 'OppEsitoSeduta') { $sede = $generator->getOppSede(); $news_string .= "<p>"; $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - '; $news_string .= "<strong>Si è svolta una seduta</strong> in "; if ($sede->getTipologia() != 'Assemblea') { $news_string .= $sede->getTipologia() . ' '; } $news_string .= $sede->getDenominazione() . ' '; if ($generator->getTipologia() != 'Assemblea') { $news_string .= " (" . $generator->getTipologia() . ") "; } $news_string .= "<strong><a class='external' target='_blank' href=" . $generator->getUrl() . ">"; $news_string .= $generator->getEsito(); $news_string .= "</a></strong>"; if ($context != CONTEXT_ATTO) { $news_string .= " per il disegno di legge<br/>"; $news_string .= $atto_link; } $news_string .= "</p>"; } else { $news_string .= $generator_model; } } } } } } } } } } } } else { if ($related_monitorable_model == 'Tag') { // tag fetch $tag = TagPeer::retrieveByPK($news->getRelatedMonitorableId()); if ($generator_model == 'Tagging') { $tagging_pks = array_values(unserialize($news->getGeneratorPrimaryKeys())); $tagging_id = $tagging_pks[0]; $tagging = TaggingPeer::retrieveByPK($tagging_id); $taggable_model = $tagging->getTaggableModel(); $taggable_id = $tagging->getTaggableId(); $tagged_obj = call_user_func_array(array($taggable_model . 'Peer', 'retrieveByPK'), array($taggable_id)); if ($taggable_model == 'OppAtto') { // the tagged object is an atto $atto = $tagged_obj; // tipo di atto e genere per gli articoli e la desinenza $tipo = $atto->getOppTipoAtto(); if (in_array($tipo->getId(), array(1, 10, 11, 12, 13, 15, 16, 17))) { $gender = 'm'; } else { $gender = 'f'; } $atto_link = link_to_in_mail(troncaTesto(Text::denominazioneAtto($atto, 'list', true), 200), 'atto/index?id=' . $atto->getId(), array('title' => $atto->getTitolo())); $news_string .= "<p>" . articolo($tipo->getId()); $news_string .= $tipo->getDescrizione() . " "; $news_string .= $atto_link . " "; $news_string .= "presentat" . ($gender == 'm' ? 'o' : 'a') . " "; if ($atto->getRamo() == 'C') { $news_string .= ' alla Camera '; } else { if ($atto->getRamo() == 'S') { $news_string .= ' al Senato '; } } $news_string .= "il " . $atto->getDataPres('d/m/Y') . " "; $news_string .= "è stat" . ($gender == 'm' ? 'o' : 'a') . " <b>aggiunt" . ($gender == 'm' ? 'o' : 'a') . " al monitoraggio dell'argomento "; if ($context != CONTEXT_TAG) { $news_string .= $generator->getTag()->getTripleValue(); } $news_string .= "</b></p>"; } if ($taggable_model == 'OppEmendamento') { $emendamento = $tagged_obj; $emendamento_link = link_to_in_mail($emendamento->getTitoloCompleto(), '@singolo_emendamento?id=' . $emendamento->getId()); $news_string .= "<p>"; $relatedAttos = $emendamento->getOppAttoHasEmendamentosJoinOppAtto(); $ddl_em = ""; if (count($relatedAttos) > 0) { if (count($relatedAttos) == 1) { $ddl_em = " relativo al ddl "; } else { $ddl_em = " relativo ai ddl "; } foreach ($relatedAttos as $relatedAtto) { $atto = $relatedAtto->getOppAtto(); $ddl_em = $ddl_em . " " . link_to($atto->getRamo() . '.' . $atto->getNumfase(), '@singolo_atto?id=' . $atto->getId(), array('title' => $atto->getTitolo())); } } $news_string .= "l'emendamento " . $emendamento_link . ", presentato il " . $emendamento->getDataPres('d/m/Y') . ", " . $ddl_em . " è stato <b>aggiunto al monitoraggio dell'argomento "; if ($context != CONTEXT_TAG) { $news_string .= $generator->getTag()->getTripleValue(); } $news_string .= "</b></p>"; } } } } } } else { sfLogger::getInstance()->info('xxx: errore per: ' . $generator_model . ': chiavi: ' . $news->getGeneratorPrimaryKeys()); } if ($in_mail) { $sf_site_url = sfConfig::get('sf_site_url', 'openparlamento'); $news_string = str_replace('./symfony', $sf_site_url, $news_string); # per il test e per sicurezza $news_string = str_replace('a href=', 'a style="color: #339;" href=', $news_string); } return $news_string; }
public function executeLavoroCommissioni() { $c = new Criteria(); $c->add(OppSedePeer::RAMO, $this->ramo); $c->add(OppSedePeer::TIPOLOGIA, 'Commissione permanente'); $comms = OppSedePeer::doSelect($c); foreach ($comms as $comm) { $c = new Criteria(); $c->addJoin(OppAttoPeer::ID, OppAttoHasSedePeer::ATTO_ID); $c->add(OppAttoPeer::LEGISLATURA, $this->leg); $c->add(OppAttoPeer::TIPO_ATTO_ID, 1); $c->add(OppAttoHasSedePeer::SEDE_ID, $comm->getId()); $c->add(OppAttoHasSedePeer::TIPO, 'Referente'); $ref = OppAttoHasSedePeer::doCount($c); $c = new Criteria(); $c->addJoin(OppAttoPeer::ID, OppAttoHasSedePeer::ATTO_ID); $c->add(OppAttoPeer::LEGISLATURA, $this->leg); $c->add(OppAttoPeer::TIPO_ATTO_ID, 1); $c->add(OppAttoHasSedePeer::SEDE_ID, $comm->getId()); $c->add(OppAttoHasSedePeer::TIPO, 'Consultiva'); $con = OppAttoHasSedePeer::doCount($c); $c = new Criteria(); $c->addJoin(OppAttoPeer::ID, OppAttoHasSedePeer::ATTO_ID); $c->add(OppAttoPeer::LEGISLATURA, $this->leg); $c->add(OppAttoPeer::TIPO_ATTO_ID, 1, Criteria::NOT_EQUAL); $c->add(OppAttoHasSedePeer::SEDE_ID, $comm->getId()); $atti_non_leg = OppAttoHasSedePeer::doCount($c); $c = new Criteria(); $c->add(OppResocontoPeer::LEGISLATURA, $this->leg); $c->add(OppResocontoPeer::SEDE_ID, $comm->getId()); $sedute = OppResocontoPeer::doCount($c); $c = new Criteria(); $c->addJoin(OppAttoPeer::ID, OppInterventoPeer::ATTO_ID); $c->add(OppAttoPeer::LEGISLATURA, $this->leg); $c->add(OppInterventoPeer::SEDE_ID, $comm->getId()); $interventi = OppInterventoPeer::doCount($c); $compara_comm[$comm->getId()] = array($ref, $con, $atti_non_leg, $sedute, $interventi); } $this->compara_comm = $compara_comm; }
} echo link_to('<span style="font-size:12px;">' . OppSedePeer::retrieveByPk($carica->getSedeId())->getDenominazione() . '</span>', $uri . "#" . $carica->getSedeId()) . "</p>"; } } if (count($pasts) > 0) { echo "<p class='indent' style='font-weight:normal;'>guarda i <strong>" . count($pasts) . "</strong> incarichi passati in questa legislatura ..."; echo "[" . link_to('apri', '#', array('class' => 'btn-open action')) . link_to('chiudi', '#', array('class' => 'btn-close action', 'style' => 'display:none')) . " ]<br /><br />"; echo "</p> <div class='more-results float-container' style='display: none;'>"; foreach ($pasts as $carica) { echo "<p style='font-weight:normal;'><label>"; echo "dal " . $carica->getDataInizio('d/m/Y'); echo " al " . $carica->getDataFine('d/m/Y') . ": "; echo OppTipoCaricaPeer::retrieveByPk($carica->getTipoCaricaId())->getNome() . " "; if (stristr(OppSedePeer::retrieveByPk($carica->getSedeId())->getDenominazione(), "commissione") == false && stristr(OppSedePeer::retrieveByPk($carica->getSedeId())->getDenominazione(), "giunta") == false && stristr(OppSedePeer::retrieveByPk($carica->getSedeId())->getDenominazione(), "presidenza") == false) { echo OppSedePeer::retrieveByPk($carica->getSedeId())->getTipologia() . " "; } echo strpos(OppSedePeer::retrieveByPk($carica->getSedeId())->getDenominazione(), "giunta"); if (OppSedePeer::retrieveByPk($carica->getSedeId())->getTipologia() == 'Commissione permanente') { $uri = "@commissioni_{$ramo}"; } elseif (OppSedePeer::retrieveByPk($carica->getSedeId())->getTipologia() == 'Commissione bicamerale') { $uri = "@commissioni_bicamerali?ramo={$ramo}"; } elseif (OppSedePeer::retrieveByPk($carica->getSedeId())->getTipologia() == 'Giunta') { $uri = "@giunte?ramo={$ramo}"; } elseif (OppSedePeer::retrieveByPk($carica->getSedeId())->getTipologia() == 'Presidenza') { $uri = "@organi?ramo={$ramo}"; } echo link_to(OppSedePeer::retrieveByPk($carica->getSedeId())->getDenominazione(), $uri . "#" . $carica->getSedeId()); echo "</label></p>"; } echo "</div>"; }
public function executeOrgani() { $c = new Criteria(); if ($this->getRequestParameter('ramo') == 'camera') { $this->getResponse()->setTitle('Componenti e statistiche di commissioni e giunte della Camera - ' . sfConfig::get('app_main_title')); $this->response->addMeta('description', 'Il potere dei gruppi parlamentari in tutti gli organi della Camera dei Deputati', true); $c->add(OppSedePeer::RAMO, 'C'); } else { $this->getResponse()->setTitle('Componenti e statistiche di commissioni e giunte del Senato - ' . sfConfig::get('app_main_title')); $this->response->addMeta('description', 'Il potere dei gruppi parlamentari in tutti gli organi del Senato', true); $c->add(OppSedePeer::RAMO, 'S'); } $c->add(OppSedePeer::TIPOLOGIA, 'Presidenza'); $this->comm = OppSedePeer::doSelectOne($c); $this->ramo = $this->getRequestParameter('ramo'); $gruppi_all = array(); $gruppi_p = array(); $gruppi_q = array(); $gruppi_vp = array(); $gruppi_s = array(); $gruppi_c = array(); $membri_regione = array(21 => 0, 23 => 0, 25 => 0, 32 => 0, 34 => 0, 36 => 0, 42 => 0, 45 => 0, 52 => 0, 55 => 0, 57 => 0, 62 => 0, 65 => 0, 67 => 0, 72 => 0, 75 => 0, 77 => 0, 78 => 0, 82 => 0, 88 => 0); $c = new Criteria(); $c->addJoin(OppCaricaInternaPeer::CARICA_ID, OppCaricaPeer::ID); $c->addJoin(OppCaricaInternaPeer::SEDE_ID, OppSedePeer::ID); if ($this->getRequestParameter('ramo') == 'camera') { $c->add(OppSedePeer::RAMO, array('C', 'CS'), Criteria::IN); $c->add(OppCaricaPeer::TIPO_CARICA_ID, 1); } else { $c->add(OppSedePeer::RAMO, array('S', 'CS'), Criteria::IN); $c->add(OppCaricaPeer::TIPO_CARICA_ID, 4); } $c->add(OppCaricaInternaPeer::DATA_FINE, NULL, Criteria::ISNULL); $membri = OppCaricaInternaPeer::doSelect($c); foreach ($membri as $membro) { $regione = strtolower(str_replace(array(" ", "'", "-"), "_", $membro->getOppCarica()->getCircoscrizione())); $codice_regione = sfConfig::get('app_circoscrizioni_' . $regione); if (array_key_exists($codice_regione, $membri_regione)) { $membri_regione[$codice_regione] = $membri_regione[$codice_regione] + 1; } $gruppo_id = OppCaricaHasGruppoPeer::getGruppoCorrentePerCarica($membro->getCaricaId())->getId(); $tipo_carica = OppTipoCaricaPeer::retrieveByPk($membro->getTipoCaricaId())->getNome(); if (array_key_exists($gruppo_id, $gruppi_all)) { $gruppi_all[$gruppo_id] = $gruppi_all[$gruppo_id] + 1; } else { $gruppi_all[$gruppo_id] = 1; } if ($tipo_carica == 'Presidente') { if (array_key_exists($gruppo_id, $gruppi_p)) { $gruppi_p[$gruppo_id] = $gruppi_p[$gruppo_id] + 1; } else { $gruppi_p[$gruppo_id] = 1; } } if ($tipo_carica == 'Questore') { if (array_key_exists($gruppo_id, $gruppi_q)) { $gruppi_q[$gruppo_id] = $gruppi_q[$gruppo_id] + 1; } else { $gruppi_q[$gruppo_id] = 1; } } if ($tipo_carica == 'Vicepresidente') { if (array_key_exists($gruppo_id, $gruppi_vp)) { $gruppi_vp[$gruppo_id] = $gruppi_vp[$gruppo_id] + 1; } else { $gruppi_vp[$gruppo_id] = 1; } } if ($tipo_carica == 'Segretario') { if (array_key_exists($gruppo_id, $gruppi_s)) { $gruppi_s[$gruppo_id] = $gruppi_s[$gruppo_id] + 1; } else { $gruppi_s[$gruppo_id] = 1; } } if ($tipo_carica == 'Componente') { if (array_key_exists($gruppo_id, $gruppi_c)) { $gruppi_c[$gruppo_id] = $gruppi_c[$gruppo_id] + 1; } else { $gruppi_c[$gruppo_id] = 1; } } } $this->gruppi_all = $gruppi_all; $this->gruppi_p = $gruppi_p; $this->gruppi_q = $gruppi_q; $this->gruppi_vp = $gruppi_vp; $this->gruppi_s = $gruppi_s; $this->gruppi_c = $gruppi_c; $this->membri_regione = $membri_regione; }
if (OppSedePeer::retrieveByPk($sede_id)->getTipologia() == 'Presidenza') { ?> <td><?php echo array_sum($gruppi_q); ?> </td> <?php } ?> <td><?php echo array_sum($gruppi_s); ?> </td> <?php if (OppSedePeer::retrieveByPk($sede_id)->getTipologia() != 'Presidenza') { ?> <td><?php echo array_sum($gruppi_c); ?> </td> <?php } ?> <td class="evident"><strong><?php echo array_sum($gruppi_all); ?> </strong></td> </tr> </tbody>