public static function doSelectDirectlyMonitoredByUser($user, $criteria = null)
 {
     if (!$user instanceof OppUser) {
         throw new Exception('A user must be specified');
     }
     // fetch directly monitored acts
     $directly_monitored_acts_pks = Util::transformIntoPKs($user->getMonitoredObjects('OppAtto', $criteria));
     // fetch types of acts directly monitored
     $c = new Criteria();
     $c->addJoin(OppTipoAttoPeer::ID, OppAttoPeer::TIPO_ATTO_ID);
     $c->addGroupByColumn(OppAttoPeer::TIPO_ATTO_ID);
     $c->add(OppAttoPeer::ID, $directly_monitored_acts_pks, Criteria::IN);
     $directly_monitored_acts_types = OppTipoAttoPeer::doSelect($c);
     unset($c);
     return $directly_monitored_acts_types;
 }
	               <td><div class="ico-type"><?php 
        echo image_tag('/images/no-avatar40.png', array('width' => '44', 'height' => '42'));
        ?>
</div></td> 
	               <?php 
    } elseif ($result->getInternalPartial() == 'atto/searchResultDoc') {
        ?>
	                   <td><div class="ico-type"><?php 
        echo image_tag('/images/ico-type-document.png', array('width' => '44', 'height' => '42'));
        ?>
</div></td> 
	                   <?php 
    } elseif ($result->getInternalPartial() == 'atto/searchResult') {
        ?>
	                        <?php 
        if (OppTipoAttoPeer::retrieveByPK($result->tipo_atto_id)->getId() == 1 || OppTipoAttoPeer::retrieveByPK($result->tipo_atto_id)->getId() == 12 || OppTipoAttoPeer::retrieveByPK($result->tipo_atto_id)->getId() == 15 || OppTipoAttoPeer::retrieveByPK($result->tipo_atto_id)->getId() == 16 || OppTipoAttoPeer::retrieveByPK($result->tipo_atto_id)->getId() == 17) {
            ?>
	                            <td><div class="ico-type"><?php 
            echo image_tag('/images/ico-type-proposta.png', array('width' => '44', 'height' => '42'));
            ?>
</div></td>
	                        <?php 
        } else {
            ?>
	                            <td><div class="ico-type"><?php 
            echo image_tag('/images/ico-type-descrizione.png', array('width' => '44', 'height' => '42'));
            ?>
</div></td>
	                        <?php 
        }
        ?>
<div class="more-results float-container" style="padding:0px 5px 5px 0px; display: none;">
<table class="disegni-decreti column-table">

  <tbody>
  <?php 
    foreach ($contros as $key => $contro) {
        ?>
    <?php 
        $rs = OppAttoPeer::retrieveByPk($contro);
        ?>
    <tr class="even">
    <th scope="row">
    <p class="content-meta">
    <span class="date"> 
    <?php 
        $tipo = OppTipoAttoPeer::retrieveByPk($rs->getTipoAttoId());
        ?>
  
      <?php 
        echo $tipo->getDescrizione();
        ?>
      </span>
    </p>
    <p>
      <?php 
        echo link_to(Text::denominazioneAtto($rs, 'list'), 'atto/index?id=' . $rs->getId());
        ?>
    </p>
    </th>
  </tr>
<?php 
Esempio n. 4
0
<?php

$atto = OppAttoPeer::retrieveByPK($result->propel_id);
$tipo_atto = OppTipoAttoPeer::retrieveByPK($result->tipo_atto_id);
?>

<?php 
echo $tipo_atto->getDescrizione();
?>
 - 
<?php 
echo link_to_in_mail(highlight_keywords($atto->getTitoloCompleto(), $term, sfConfig::get('app_lucene_result_highlighter', '<strong class="highlight">%s</strong>')), add_highlight_qs($result->getInternalUri(), $term));
?>
-
presentato il <?php 
echo $atto->getDataPres('d/m/Y');
?>

 /**
  * torna il tipo di atto, per quello che concerne il calcolo dell'indice di attività
  *
  * @return string
  * @author Guglielmo Celata
  */
 public function getTipoPerIndice()
 {
     return OppTipoAttoPeer::getTipoPerIndice($this->getTipoAttoId());
 }
<?php

echo OppTipoAttoPeer::retrieveByPK($result->tipo_atto_id)->getDescrizione();
?>
 - <?php 
echo link_to(highlight_keywords($result->titolo, $query, sfConfig::get('app_lucene_result_highlighter', '<strong class="highlight">%s</strong>')), add_highlight_qs($result->getInternalUri(), $query));
?>

<span style="font-size: 11px; color: gray;">(<?php 
echo date("d/m/Y", strtotime($result->data_pres_dt));
?>
)</span>
 /**
  * acts list grouped by types
  *
  * @return void
  * @author Guglielmo Celata
  */
 public function executeActs()
 {
     $this->user_id = $this->getUser()->getId();
     $this->user = OppUserPeer::retrieveByPK($this->user_id);
     $this->redirectUnless($this->user instanceof OppUser, '/');
     $this->session = $this->getUser();
     $this->getResponse()->setTitle(sfConfig::get('app_main_title') . ' - i miei atti');
     // reset dei filtri se richiesto esplicitamente
     if ($this->getRequestParameter('reset_filters', 'false') == 'true') {
         $this->getRequest()->getParameterHolder()->set('filter_tag_id', '0');
         $this->getRequest()->getParameterHolder()->set('filter_act_type_id', '0');
         $this->getRequest()->getParameterHolder()->set('filter_act_ramo', '0');
         $this->getRequest()->getParameterHolder()->set('filter_act_stato', '0');
     }
     // legge i filtri dalla request
     $filters = array();
     if ($this->getRequest()->getMethod() == sfRequest::POST || $this->getRequest()->getMethod() == sfRequest::GET) {
         // legge i filtri dalla request e li scrive nella sessione utente
         if ($this->hasRequestParameter('filter_tag_id')) {
             $this->session->setAttribute('tag_id', $this->getRequestParameter('filter_tag_id'), 'monitoring_filter');
             // $this->filter_tag = TagPeer::retrieveByPK($filters['tag_id']);
         }
         if ($this->hasRequestParameter('filter_act_type_id')) {
             $this->session->setAttribute('act_type_id', $this->getRequestParameter('filter_act_type_id'), 'monitoring_filter');
         }
         if ($this->hasRequestParameter('filter_act_ramo')) {
             $this->session->setAttribute('act_ramo', $this->getRequestParameter('filter_act_ramo'), 'monitoring_filter');
         }
         if ($this->hasRequestParameter('filter_act_stato')) {
             $this->session->setAttribute('act_stato', $this->getRequestParameter('filter_act_stato'), 'monitoring_filter');
         }
         if ($this->getRequestParameter('filter_tag_id') == '0' && $this->getRequestParameter('filter_act_type_id') == '0' && $this->getRequestParameter('filter_act_ramo') == '0' && $this->getRequestParameter('filter_act_stato') == '0') {
             $this->redirect('monitoring/acts');
         }
     }
     // legge sempre i filtri dalla sessione utente
     $filters['tag_id'] = $this->session->getAttribute('tag_id', '0', 'monitoring_filter');
     $filters['act_type_id'] = $this->session->getAttribute('act_type_id', '0', 'monitoring_filter');
     $filters['act_ramo'] = $this->session->getAttribute('act_ramo', '0', 'monitoring_filter');
     $filters['act_stato'] = $this->session->getAttribute('act_stato', '0', 'monitoring_filter');
     // definisce il criterio di filtri sui tag
     if ($filters['tag_id'] != '0') {
         $tag_filtering_criteria = new Criteria();
         $tag_filtering_criteria->addJoin(TagPeer::ID, TaggingPeer::TAG_ID);
         $tag_filtering_criteria->add(TagPeer::ID, $filters['tag_id']);
     } else {
         $tag_filtering_criteria = null;
     }
     // estrae tutti i tag monitorati dall'utente, per costruire la tendina
     $this->all_monitored_tags = $this->user->getMonitoredObjects('Tag');
     // estrae le primary keys dei tag monitorati (sempre per la tendina?)
     $this->my_monitored_tags_pks = $this->user->getMonitoredPks('Tag', $tag_filtering_criteria);
     // estrae tutti i tipi di atti monitorati dall'utente (senza filtri), per le tendine
     $indirectly_monitored_acts_types = OppTipoAttoPeer::doSelectIndirectlyMonitoredByUser($this->user, $this->type);
     $directly_monitored_acts_types = OppTipoAttoPeer::doSelectDirectlyMonitoredByUser($this->user, $this->type);
     $this->all_monitored_acts_types = OppTipoAttoPeer::merge($indirectly_monitored_acts_types, $directly_monitored_acts_types);
     // filtro sui tipi di atti
     if ($filters['act_type_id'] != 0) {
         $this->monitored_acts_types = array(OppTipoAttoPeer::retrieveByPK($filters['act_type_id']));
     } else {
         $indirectly_monitored_acts_types = OppTipoAttoPeer::doSelectIndirectlyMonitoredByUser($this->user, $this->type, $tag_filtering_criteria);
         if (is_null($tag_filtering_criteria)) {
             $directly_monitored_acts_types = OppTipoAttoPeer::doSelectDirectlyMonitoredByUser($this->user, $this->type);
         } else {
             $directly_monitored_acts_types = array();
         }
         $this->monitored_acts_types = OppTipoAttoPeer::merge($indirectly_monitored_acts_types, $directly_monitored_acts_types);
     }
     $this->filters = $filters;
     $this->tag_filtering_criteria = $tag_filtering_criteria;
 }
 /**
  * calcola l'indice di rilevanza, per un atto, nel suo complesso
  *
  * @param integer $atto_id
  * @param integer $tipo_atto_id 
  * @param date $data 
  * @param SimpleXMLElement    $xml_node   
  * @param boolean   $verbose
  * @return float
  * @author Guglielmo Celata
  */
 public static function calcolaRilevanzaAtto($atto, $tipo_atto_id, $data, $xml_node, $verbose = false)
 {
     $atto_node = $xml_node->addChild('atto', null, self::$opp_ns);
     $atto_id = $atto->getId();
     // calcolo gruppi e schieramenti che presentano
     list($schier_pres, $grup_pres) = OppCaricaHasAttoPeer::getSchierGrupPresAtto($atto_id, $data);
     if ($verbose) {
         printf("\n    presentazione:\n");
         printf("      schieramenti: %s\n", join(',', $schier_pres));
         printf("      gruppi: %s\n", join(',', $grup_pres));
     }
     // il peso di un atto non dipende mai da chi lo ha presentato
     // il coefficiente che si considera è sempre quello di maggioranza
     $di_maggioranza = true;
     // determina la priorità dell'atto
     $priorita = is_null($atto->getPriorityValue()) ? 1 : $atto->getPriorityValue();
     $atto_is_ratifica = $atto->isRatifica();
     // determina il tipo di atto (per quello che concerne il calcolo dell'indice)
     $tipo_atto = OppTipoAttoPeer::getTipoPerIndice($tipo_atto_id);
     if (is_null($tipo_atto)) {
         return 0;
     }
     $atto_node->addAttribute('tipo_atto', $tipo_atto);
     $atto_node->addAttribute('priorita', $priorita);
     $atto_node->addAttribute('id', $atto_id);
     $punteggio = 0.0;
     // punteggio dato all'atto per-se, a seconda del tipo
     if ($tipo_atto == 'SDDL') {
         $punteggio = 1.0;
     } else {
         $punteggio = 0.5;
     }
     $presentazione_node = $atto_node->addChild('presentazione', null, self::$opp_ns);
     $presentazione_node->addAttribute('totale', $punteggio);
     // --- consenso ---
     $consenso_node = $atto_node->addChild('consenso', null, self::$opp_ns);
     $firmeRS = OppCaricaHasAttoPeer::getFirmeAttoDataTipoRS($atto_id, $data, "'C'");
     $n_firme = array('gruppo' => 0, 'altri' => 0, 'opp' => 0);
     while ($firmeRS->next()) {
         $row = $firmeRS->getRow();
         if ($verbose) {
             printf("    %d firme per gruppo %d\n", $row['nf'], $row['gruppo_id']);
         }
         // gestione del caso in cui l'atto è presentato dai due schieramenti
         // tutte le firme sono assegnate a gruppo, altri e opp
         if (count($schier_pres) > 1) {
             $n_firme['gruppo'] += $row['nf'];
             $n_firme['altri'] += $row['nf'];
             $n_firme['opp'] += $row['nf'];
             continue;
         }
         // gestione del caso in cui l'atto è presentato da più di un gruppo
         // le firme dello schieramento di pres. sono assegnate a gruppo e altri
         if (count($grup_pres) > 1) {
             if ($row['maggioranza'] == $schier_pres[0]) {
                 $n_firme['gruppo'] += $row['nf'];
                 $n_firme['altri'] += $row['nf'];
             } else {
                 $n_firme['opp'] += $row['nf'];
             }
             continue;
         }
         if (in_array($row['gruppo_id'], $grup_pres)) {
             if ($row['nf'] > 1) {
                 $n_firme['gruppo'] += $row['nf'];
             }
         } else {
             if (count($schier_pres) > 0 && $row['maggioranza'] == $schier_pres[0]) {
                 $n_firme['altri'] += $row['nf'];
             } else {
                 $n_firme['gruppo'] += $row['nf'];
             }
         }
     }
     $d_punteggio = 0.0;
     foreach ($n_firme as $tipo => $value) {
         if (!$value) {
             continue;
         }
         $soglia = self::$soglia_cofirme;
         if ($tipo_atto == 'mozione') {
             $soglia = self::$soglia_cofirme_mozioni;
         }
         if ($value <= $soglia) {
             $d_punteggio += $dd_punteggio = self::getPunteggio($tipo_atto, "cofirme_{$tipo}_lo", $di_maggioranza);
         } else {
             $d_punteggio += $dd_punteggio = self::getPunteggio($tipo_atto, "cofirme_{$tipo}_hi", $di_maggioranza);
         }
         $firme_node = $consenso_node->addChild('firme_' . $tipo, null, self::$opp_ns);
         $firme_node->addAttribute('n_firme', $value);
         $firme_node->addAttribute('totale', $dd_punteggio);
         if ($verbose) {
             printf("    firme %s (%d) %7.2f\n", $tipo, $value, $dd_punteggio);
         }
     }
     $punteggio += $d_punteggio;
     if ($verbose) {
         printf("  totale firme  %7.2f\n", $d_punteggio);
     }
     $consenso_node->addAttribute('n_firme', $n_firme['gruppo'] + $n_firme['altri'] + $n_firme['opp']);
     $consenso_node->addAttribute('totale', $d_punteggio);
     // --- iter ---
     // controlla se atti non assorbiti sono diventati legge dopo passaggi in altri rami
     // atti diventati legge non prendono il punteggio di approvazione
     $diventato_legge_in_altri_rami = false;
     if (!isset($passaggio) || $passaggio != 'assorbito') {
         $atto = OppAttoPeer::retrieveByPK($atto_id);
         $c = new Criteria();
         $c->add(OppAttoHasIterPeer::ITER_ID, 16);
         $c->add(OppAttoHasIterPeer::DATA, $data, Criteria::LESS_EQUAL);
         while ($atto_succ_id = $atto->getSucc()) {
             $atto = OppAttoPeer::retrieveByPK($atto_succ_id);
             if ($atto->countOppAttoHasIters($c) > 0) {
                 $diventato_legge_in_altri_rami = true;
             }
         }
         unset($c);
         unset($atto);
     }
     // determina se l'atto è parte di un Testo Unificato
     $is_unified = OppAttoPeer::isUnifiedText($atto_id);
     // determina se l'atto è stato assorbito
     $is_absorbed = OppAttoPeer::isAbsorbed($atto_id);
     // determina se l'atto unificato è principale o meno
     $is_unificato_non_main = is_array($is_unified) && !$is_unified['is_main_unified'];
     $is_unificato_main = is_array($is_unified) && $is_unified['is_main_unified'];
     $itinera_atto_rs = OppAttoHasIterPeer::getItineraAttoDataRS($atto_id, $data);
     $iter_node = $atto_node->addChild('iter', null, self::$opp_ns);
     $d_punteggio = 0.0;
     $n_passaggi = 0;
     while ($itinera_atto_rs->next()) {
         $iter_atto = $itinera_atto_rs->getRow();
         $passaggio = OppIterPeer::getIterPerIndice($iter_atto['iter_id']);
         if (is_null($passaggio)) {
             continue;
         }
         // se l'atto è unificato e non-main, allora prende il punteggio come gli atti assorbiti
         if ($is_unificato_non_main && $passaggio == 'approvato') {
             $passaggio = 'assorbito';
         }
         // se diventato legge in altri rami, non prende punteggio di approvazione
         if ($diventato_legge_in_altri_rami && $passaggio == 'approvato') {
             continue;
         }
         $n_passaggi++;
         $passaggio_node = $iter_node->addChild('passaggio', null, self::$opp_ns);
         if ($passaggio == 'assorbito' && $is_unificato_non_main) {
             $passaggio_node->addAttribute('tipo', 'assorbimento come unificato non principale');
         } else {
             $passaggio_node->addAttribute('tipo', $passaggio);
         }
         $d_punteggio += $dd_punteggio = self::getPunteggio($tipo_atto, $passaggio, $di_maggioranza);
         if ($verbose) {
             if ($passaggio == 'assorbito' && $is_unificato_non_main) {
                 printf("    iter %s %7.2f\n", 'assorbimento come unificato non principale', $dd_punteggio);
             } else {
                 printf("    iter %s %7.2f\n", $passaggio, $dd_punteggio);
             }
         }
         $passaggio_node->addAttribute('totale', $dd_punteggio);
         // il break su atti assorbiti avviene dopo l'assegnazione del punteggio
         if ($passaggio == 'assorbito') {
             break;
         }
         // --- bonus maggioranza ---
         if ($passaggio == 'approvato') {
             if ($di_maggioranza && OppAttoPeer::isAttoVotatoDaOpposizione($atto_id, $data)) {
                 $d_punteggio += $dd_punteggio = self::getPunteggio($tipo_atto, 'bonus_bi_partisan', true);
                 $bonus_node = $iter_node->addChild('bonus_maggioranza', null, self::$opp_ns);
                 $bonus_node->addAttribute('totale', $dd_punteggio);
                 if ($verbose) {
                     printf("    bonus di maggioranza! %7.2f\n", $dd_punteggio);
                 }
             }
         }
         // break se mozione, risoluzione o odg approvato
         if (in_array($tipo_atto, array('mozione', 'risoluzione', 'odg')) && $passaggio == 'approvato') {
             break;
         }
     }
     // assegna punteggio se diventato legge in altri rami
     if ($diventato_legge_in_altri_rami && is_null($is_absorbed) && (is_null($is_unified) || $is_unificato_main)) {
         $d_punteggio += $dd_punteggio = self::getPunteggio($tipo_atto, 'diventato_legge', $di_maggioranza);
         $passaggio_node = $iter_node->addChild('passaggio', null, self::$opp_ns);
         $passaggio_node->addAttribute('tipo', "diventato legge in altri rami");
         $passaggio_node->addAttribute('totale', $dd_punteggio);
         if ($verbose) {
             printf("    iter %s %7.2f\n", "diventato legge in altri rami", $dd_punteggio);
         }
     }
     $punteggio += $d_punteggio;
     if ($verbose) {
         printf("  totale iter   %7.2f\n", $d_punteggio);
     }
     $iter_node->addAttribute('n_passaggi', $n_passaggi);
     $iter_node->addAttribute('totale', $d_punteggio);
     // --- componente emendamenti con funzione sigmoide ---
     $punteggio += $d_punteggio = self::calcolaComponenteEmendamentiPerAtto($atto_id, $data, $atto_node, $verbose);
     // --- sedute con interventi in commissione e assemblea ---
     $sedute_con_interventi_node = $atto_node->addChild('sedute_con_interventi', null, self::$opp_ns);
     $sedute_commissioni_node = $sedute_con_interventi_node->addChild('commissioni', null, self::$opp_ns);
     $n_sedute_commissioni = OppInterventoPeer::getNSeduteConInterventiAttoData($atto_id, 'C', $data);
     if ($n_sedute_commissioni) {
         $n_sedute_commissioni--;
     }
     if ($verbose) {
         printf("    n. sedute in commissione   %d\n", $n_sedute_commissioni);
     }
     $d_punteggio_sedute_commissioni = $n_sedute_commissioni * parent::$punteggi['seduta_in_comm'];
     $sedute_commissioni_node->addAttribute('n_sedute', $n_sedute_commissioni);
     $sedute_commissioni_node->addAttribute('totale', $d_punteggio_sedute_commissioni);
     $sedute_assemblea_node = $sedute_con_interventi_node->addChild('assemblea', null, self::$opp_ns);
     $n_sedute_assemblea = OppInterventoPeer::getNSeduteConInterventiAttoData($atto_id, 'A', $data);
     if ($n_sedute_assemblea) {
         $n_sedute_assemblea--;
     }
     if ($verbose) {
         printf("    n. sedute in commissione   %d\n", $n_sedute_assemblea);
     }
     $d_punteggio_sedute_assemblea = $n_sedute_assemblea * parent::$punteggi['seduta_in_ass'];
     $sedute_assemblea_node->addAttribute('n_sedute', $n_sedute_assemblea);
     $sedute_assemblea_node->addAttribute('totale', $d_punteggio_sedute_assemblea);
     $punteggio += $d_punteggio_sedute = $d_punteggio_sedute_commissioni + $d_punteggio_sedute_assemblea;
     if ($verbose) {
         printf("  totale sedute   %7.2f\n", $d_punteggio_sedute);
     }
     $sedute_con_interventi_node->addAttribute('totale', $d_punteggio_sedute);
     if ($atto_is_ratifica) {
         $atto_node->addAttribute('totale_pre_decurtazione_ratifica', $punteggio);
         if ($verbose) {
             print "questo ATTO è una ratifica\n";
         }
         $punteggio = $punteggio / self::$punteggi['fattore_diminuzione_ratifica'];
     }
     $punteggio = $priorita * $punteggio;
     $atto_node->addAttribute('totale', $punteggio);
     return $punteggio;
 }
/**
 * 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 &egrave; svolta almeno una VOTAZIONE');
            } else {
                $news_string .= "<p>";
                $news_string .= $news->getRamoVotazione() == 'C' ? 'Camera -  ' : 'Senato - ';
                $news_string .= 'si &egrave; 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\'&egrave; 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("&Egrave; 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 = '&egrave; 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 == '&egrave; 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>&egrave; 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 = '&egrave; 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 == '&egrave; 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 = '&egrave; 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 == '&egrave; 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>&egrave; 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 = '&egrave; 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 != '&egrave; 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>&egrave; 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 &egrave; svolta la votazione finale</strong>', '@votazione?' . $generator->getOppVotazione()->getUrlParams());
                                    } else {
                                        $news_string .= " si &egrave; 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 .= "&egrave; 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 .= " &egrave; 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 &egrave; 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 .= "&egrave; 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 . " &egrave; 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;
}