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); }
public function executeToggleApproved() { $tag = TagPeer::retrieveByPK($this->getRequestParameter('id')); $this->forward404Unless($tag); $tag->setApproved(!$tag->getApproved()); $tag->save(); $this->redirect('tag/index'); }
private function reloadByTag($tagId) { $c = new Criteria(); $this->routeObject = TagPeer::retrieveByPK($tagId); $ids = TaggingPeer::getJobIdsByTag($this->routeObject); $c->add(JobPeer::ID, $ids, Criteria::IN); $this->route = "job_listby_tag"; $this->propelType = "name"; $this->renderStatus = true; $this->viewingCaption = " taggings for " . $this->routeObject->__toString(); return $c; }
public function getTag($con = null) { if ($this->aTag === null && $this->tag_id !== null) { include_once 'lib/model/om/BaseTagPeer.php'; $this->aTag = TagPeer::retrieveByPK($this->tag_id, $con); } return $this->aTag; }
public function getTag($con = null) { if ($this->aTag === null && $this->tag_id !== null) { include_once 'plugins/sfPropelActAsTaggableBehaviorPlugin/lib/model/om/BaseTagPeer.php'; $this->aTag = TagPeer::retrieveByPK($this->tag_id, $con); } return $this->aTag; }
public function executeTagNews() { // due righe modificate per la chiamata con id $this->tag_id = $this->getRequestParameter('id'); $this->tag = TagPeer::retrieveByPK($this->tag_id); $namespace = $this->getRequestParameter('namespace'); // setlocale(LC_TIME, 'it_IT'); sfLoader::loadHelpers(array('Tag', 'Url', 'DeppNews')); $feed = new sfRss2ExtendedFeed(); $feed->initialize(array('title' => 'Ultime notizie sull\'argomento ' . $this->tag->getTripleValue(), 'link' => url_for('@homepage', true), 'feedUrl' => $this->getRequest()->getURI(), 'siteUrl' => 'http://' . sfConfig::get('sf_site_url'), 'image' => 'http://' . sfConfig::get('sf_site_url') . '/images/logo-openparlamento.png', 'language' => 'it', 'authorEmail' => '*****@*****.**', 'authorName' => 'Openparlamento', 'description' => "Openparlamento.it - il progetto Openpolis per la trasparenza del Parlamento", 'sy_updatePeriod' => 'daily', 'sy_updateFrequency' => '1', 'sy_updateBase' => '2000-01-01T12:00+00:00')); $news = oppNewsPeer::getNewsForTagCriteria($this->tag_id); $news->addDescendingOrderByColumn(NewsPeer::DATE); $itemsperpage = $this->getRequestParameter('page', sfConfig::get('app_pagination_limit')); $page = $this->getRequestParameter('page', 1); $pager = new deppNewsPager('News', $itemsperpage); $pager->setCriteria($news); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; $url = url_for('@news_tag?id=' . $this->tag_id, true) . '?' . urlencode('page=' . $page . '&itemsperpage=' . $itemsperpage); foreach ($pager->getGroupedResults() as $date_ts => $news) { foreach ($news as $cnt => $n) { // fetch del modello e dell'oggetto che ha generato la notizia $generator_model = $n->getGeneratorModel(); if ($n->getGeneratorPrimaryKeys()) { $pks = array_values(unserialize($n->getGeneratorPrimaryKeys())); $generator = call_user_func_array(array($generator_model . 'Peer', 'retrieveByPK'), $pks); } else { $pks = array(); $generator = null; } $item = new sfRss2ExtendedItem(); $description = news_text($n, $generator_model, $pks, $generator, array('context' => CONTEXT_TAG)); $item->initialize(array('title' => strip_tags($description), 'link' => $url, 'permalink' => $url, 'pubDate' => $n->getDate('U'), 'uniqueId' => $n->getId(), 'description' => $description, 'authorEmail' => '*****@*****.**', 'authorName' => 'Openparlamento')); $feed->addItem($item); } } $this->_send_output($feed); return sfView::NONE; }
public function executeTag() { // due righe modificate per la chiamata con id $this->tag_id = $this->getRequestParameter('id'); $this->tag = TagPeer::retrieveByPK($this->tag_id); $this->getResponse()->setTitle('tutte le notizie sull\'argomento ' . $this->tag->getTripleValue() . ' - ' . sfConfig::get('app_main_title')); $this->response->addMeta('description', 'Tutte le notizie aggiornate quotidianamente sugli atti parlamentari che parlano di ' . $this->tag->getTripleValue(), true); $c = oppNewsPeer::getNewsForTagCriteria($this->tag_id); $c->addDescendingOrderByColumn(NewsPeer::DATE); if ($this->hasRequestParameter('itemsperpage')) { $this->getUser()->setAttribute('itemsperpage', $this->getRequestParameter('itemsperpage')); } $itemsperpage = $this->getUser()->getAttribute('itemsperpage', sfConfig::get('app_pagination_limit')); $pager = new deppNewsPager('News', $itemsperpage); $pager->setCriteria($c); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; }
/** * Calcola o ri-calcola la rilevanza degli argomenti, come somma della rilevanza degli atti taggati * Si può specificare il una data fino alla quale calcolare la rilevanza * Se sono passati degli ID (argomenti), sono interpretati come ID di argomenti e il calcolo è fatto solo per loro */ function run_opp_build_cache_tags($task, $args, $options) { static $loaded; // load application context if (!$loaded) { _loader(); } echo "memory usage: " . memory_get_usage() . "\n"; $data = ''; $verbose = false; $offset = null; $limit = null; $start_time = time(); if (array_key_exists('data', $options)) { $data = $options['data']; } if (array_key_exists('verbose', $options)) { $verbose = true; } if (array_key_exists('offset', $options)) { $offset = $options['offset']; } if (array_key_exists('limit', $options)) { $limit = $options['limit']; } if ($data != '') { $legislatura_corrente = OppLegislaturaPeer::getCurrent($data); $data_lookup = $data; } else { $legislatura_corrente = OppLegislaturaPeer::getCurrent(); $data = date('Y-m-d'); $data_lookup = OppTagHistoryCachePeer::fetchLastData(); } $msg = sprintf("calcolo rilevanza tag - fino a: %10s\n", $data); echo pakeColor::colorize($msg, array('fg' => 'cyan', 'bold' => true)); if (count($args) > 0) { $tags_ids = $args; } else { $tags_ids = TaggingPeer::getActiveTagsIds('OppAtto'); } $n_tags = count($tags_ids); echo "memory usage: " . memory_get_usage() . "\n"; foreach ($tags_ids as $cnt => $tag_id) { printf("%5d/%6d) %40s %6d ... ", $cnt + 1, $n_tags, TagPeer::retrieveByPK($tag_id), $tag_id); $indice = OppIndiceRilevanzaPeer::calcola_rilevanza_tag($tag_id, $data, $verbose); // inserimento o aggiornamento del valore in opp_tag_history_cache $cache_record = OppTagHistoryCachePeer::retrieveByDataChiTipoChiId($data_lookup, 'S', $tag_id); if (!$cache_record) { $cache_record = new OppTagHistoryCache(); } $cache_record->setLegislatura($legislatura_corrente); $cache_record->setChiTipo('S'); $cache_record->setChiId($tag_id); $cache_record->setIndice($indice); $cache_record->setData($data); $cache_record->setUpdatedAt(date('Y-m-d H:i')); // forza riscrittura updated_at, per tenere traccia esecuzioni $cache_record->save(); unset($cache_record); $msg = sprintf("%7.2f", $indice); echo pakeColor::colorize($msg, array('fg' => 'cyan', 'bold' => true)); $msg = sprintf(" [%4d sec] [%10d bytes]\n", time() - $start_time, memory_get_usage()); echo pakeColor::colorize($msg, array('fg' => 'red', 'bold' => false)); } $msg = sprintf("%d tag elaborati\n", $cnt + 1); echo pakeColor::colorize($msg, array('fg' => 'cyan', 'bold' => true)); }
/** * 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; }
<th scope="col">indice:</th> <th scope="col">azioni:</th> </tr> </thead> <tbody> <?php $tr_class = 'even'; ?> <?php foreach ($pager->getResults() as $record) { ?> <?php $tag = TagPeer::retrieveByPK($record->getChiId()); ?> <tr class="<?php echo $tr_class; ?> "> <?php $tr_class = $tr_class == 'even' ? 'odd' : 'even'; ?> <th><?php echo $tag->getTripleValue(); ?> </th> <td class="numeric-value"><p><?php printf("%7.2f", $record->getIndice());
/** * Get the associated Tag object * * @param Connection Optional Connection object. * @return Tag The associated Tag object. * @throws PropelException */ public function getTag($con = null) { // include the related Peer class include_once 'lib/model/om/BaseTagPeer.php'; if ($this->aTag === null && $this->tag_id !== null) { $this->aTag = TagPeer::retrieveByPK($this->tag_id, $con); /* The following can be used instead of the line above to guarantee the related object contains a reference to this object, but this level of coupling may be undesirable in many circumstances. As it can lead to a db query with many results that may never be used. $obj = TagPeer::retrieveByPK($this->tag_id, $con); $obj->addTags($this); */ } return $this->aTag; }
$c->addAnd(BookmarkPeer::USER_ID, null, Criteria::ISNOTNULL); if ($class == "Email") { $c->add(EmailPeer::IS_CONFIRMED, true); } $c->addJoin(eval("return {$class}Peer::ID;"), eval("return Tag{$class}Peer::" . strtoupper($class) . "_ID;"), Criteria::LEFT_JOIN); $c->addJoin(eval("return Tag{$class}Peer::TAG_ID;"), TagPeer::ID, Criteria::LEFT_JOIN); $c->addJoin(TagPeer::ID, BookmarkPeer::TAG_ID, Criteria::LEFT_JOIN); // add select columns $c->addSelectColumn(TagPeer::ID); $c->addSelectColumn(BookmarkPeer::USER_ID); $c->addSelectColumn(eval("return {$class}Peer::ID;")); // find changed objects $changed_objects[$class] = call_user_func(array("{$class}Peer", "doSelectRS"), $c); } // build a list of jotag->user->contact that will be notified $changed_jotags = array(); foreach ($changed_objects as $class => $rs) { while ($rs->next()) { $changed_jotags[$rs->getInt(1)][$rs->getInt(2)][$class][] = call_user_func(array("{$class}Peer", "retrieveByPK"), $rs->getInt(3)); } } //print_r($changed_jotags);exit; // nofity each user foreach ($changed_jotags as $jotagID => $data) { $jotag = TagPeer::retrieveByPK($jotagID); $vcard = new Swift_Message_Attachment($jotag->getVCard()->fetch(), $jotag->getTagProfile()->__toString() . '.vcf', "text/plain"); foreach ($data as $userID => $contacts) { $user = UserPeer::retrieveByPK($userID); Mailer::sendEmail($user->getPrimaryEmail(), 'changedJotag', array('jotag' => $jotag, 'user' => $user, 'contacts' => $contacts), $user->getPreferedLanguage(), $vcard); } }