public function executeGetNumeroEmendamenti()
 {
     $c = new Criteria();
     $number = OppEmendamentoPeer::doCount($c);
     $resp_node = new SimpleXMLElement('<openparlamento_response></openparlamento_response>');
     $number_node = $resp_node->addChild('numero_emendamenti', $number);
     $this->xmlContent = $resp_node->asXML();
     $this->response->setContentType('text/xml; charset=utf-8');
     $this->response->setHttpHeader('Content-Length: ', strlen($this->xmlContent));
     $this->setLayout(false);
 }
 protected function setPage($page_name = null)
 {
     // Get page from request if not given as parameter (default behaviour)
     if (is_null($page_name)) {
         $page_name = $this->getRequestParameter('page', $this->startPage);
     }
     // Handle case insensitivity
     $page_name = strtolower($page_name);
     // Support default page if not specified in namespace
     if (substr($page_name, -1) == ':') {
         $page_name .= $this->startPage;
     }
     // Retrieve the page, or start a new one if cannot be found
     $this->page = nahoWikiPagePeer::retrieveByName($page_name);
     if (!$this->page) {
         return;
     }
     // Retrieve the revision
     $revision = $this->getRequestParameter('revision', $this->page->getLatestRevision());
     $this->revision = $this->page->getRevision($revision);
     if (!$this->revision) {
         $this->initNewRevision();
     }
     // Generate the URI parameters to keep trace of the requested page
     $this->uriParams = 'page=' . $this->page->getName();
     if ($this->revision->getRevision() != $this->page->getLatestRevision()) {
         $this->uriParams .= '&revision=' . $this->revision->getRevision();
     }
     // Permissions management
     $this->canView = $this->page->canView($this->getUser());
     $this->canEdit = $this->page->canEdit($this->getUser());
     // Retriev item name and type of item (tab and breadcrumbs)
     list($tipo, $id) = split("_", $this->page->getName());
     switch ($tipo) {
         case 'atto':
             $this->item = OppAttoPeer::retrieveByPK($id);
             $this->item_name = Text::denominazioneAttoShort($this->item);
             break;
         case 'votazione':
             $this->item = OppVotazionePeer::retrieveByPK($id);
             $this->item_name = $this->item->getTitolo();
             break;
         case 'emendamento':
             $this->item = OppEmendamentoPeer::retrieveByPK($id);
             $attoPortante = $this->item->getAttoPortante();
             $this->item_name = "Emendamento " . $this->item->getTitolo() . " relativo a " . Text::denominazioneAttoShort($attoPortante) . " - " . $attoPortante->getTitolo();
             break;
     }
     $this->item_type = $tipo;
 }
 /**
  * get all distinct available statuses for emendamenti of a given atto
  *
  * @param OppAtto $atto 
  * @return hash of type {id => status}
  * @author Guglielmo Celata
  */
 public static function getAvailableStatuses(OppAtto $atto)
 {
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addJoin(OppAttoHasEmendamentoPeer::EMENDAMENTO_ID, OppEmendamentoPeer::ID);
     $c->addJoin(OppEmendamentoHasIterPeer::EMENDAMENTO_ID, OppEmendamentoPeer::ID);
     $c->addJoin(OppEmendamentoHasIterPeer::EM_ITER_ID, OppEmIterPeer::ID);
     $c->add(OppAttoHasEmendamentoPeer::ATTO_ID, $atto->getId());
     $c->addSelectColumn(OppEmIterPeer::ID);
     $c->addSelectColumn(OppEmIterPeer::FASE);
     $c->addSelectColumn(OppEmIterPeer::CONCLUSO);
     $c->setDistinct();
     $rs = OppEmendamentoPeer::doSelectRS($c);
     $items = array();
     while ($rs->next()) {
         if (trim(strtolower($rs->getString(2) != 'altro'))) {
             $items[$rs->getInt(1)] = $rs->getString(2);
         }
     }
     return $items;
 }
     }
 }
 if (preg_match('#^V. testo #', $last_status->getNota())) {
     $tmpfase = explode('V. ', $last_status->getNota());
     if (substr_count($last_status->getOppEmendamento()->getNumfase(), "(") > 0) {
         $numero_fase = explode("(", $last_status->getOppEmendamento()->getNumfase());
         $numero_fase = trim($numero_fase[0]);
     } else {
         $numero_fase = $last_status->getOppEmendamento()->getNumfase();
     }
     $c = new Criteria();
     $c->addJoin(OppEmendamentoPeer::ID, OppAttoHasEmendamentoPeer::EMENDAMENTO_ID);
     $c->add(OppEmendamentoPeer::SEDE_ID, $last_status->getOppEmendamento()->getSedeId());
     $c->add(OppEmendamentoPeer::NUMFASE, $numero_fase . " (" . $tmpfase[1] . ")");
     $c->add(OppAttoHasEmendamentoPeer::ATTO_ID, $relatedAttos[0]->getOppAtto()->getId());
     $collegato = OppEmendamentoPeer::doSelectOne($c);
     if ($collegato) {
         $c = new Criteria();
         $c->addJoin(OppEmendamentoHasIterPeer::EM_ITER_ID, OppEmIterPeer::ID);
         $c->add(OppEmendamentoHasIterPeer::EMENDAMENTO_ID, $collegato->getId());
         $status_coll = OppEmIterPeer::doSelectOne($c);
         $link_collegato = link_to($last_status->getNota(), '/emendamento/' . $collegato->getId());
         if ($status_coll) {
             $link_collegato = $link_collegato . " (" . $status_coll->getFase() . ")";
         }
     }
 }
 if ($last_status->getOppEmIter()->getFase() != 'Altro') {
     echo " (" . $last_status->getNota() . ")";
 } else {
     if ($link_collegato == "") {
 /**
  * get the available distinct status for all the emendamenti of the atto
  *
  * @return hash of type {id => status}
  * @author Guglielmo Celata
  */
 public function getAvailableEmendamentiStatuses()
 {
     return OppEmendamentoPeer::getAvailableStatuses($this);
 }
<?php

$emendamento = OppEmendamentoPeer::retrieveByPK($result->propel_id);
$atto = $emendamento->getAttoPortante();
$tipo_atto = $atto->getOppTipoAtto();
?>

<?php 
echo link_to_in_mail(highlight_keywords(sprintf("emendamento %s", $emendamento->getTitoloCompleto(), $term, sfConfig::get('app_lucene_result_highlighter', '<strong class="highlight">%s</strong>')), add_highlight_qs($result->getInternalUri(), $term)));
?>
 
-
presentato il <?php 
echo $emendamento->getDataPres('d/m/Y');
?>
,
relativo a <?php 
echo $tipo_atto->getDescrizione();
?>
 <?php 
echo $atto->getShortTitle();
?>
, 
                  Presentato
                  <?php 
    if ($em->getDataPres()) {
        ?>
                    il <span class="date"><?php 
        echo format_date($em->getDataPres(), 'dd/MM/yyyy');
        ?>
,</span>                    
                  <?php 
    }
    ?>
                  in <span><?php 
    echo $em->getOppSede()->getDenominazione();
    ?>
                  <?php 
    $f_signers = OppEmendamentoPeer::getRecordsetFirmatari($em->getId(), 'P');
    ?>
                  <?php 
    if ($f_signers->next()) {
        ?>
  
                       <?php 
        echo ' da ' . $f_signers->getString(2) . ' ' . $f_signers->getString(3) . ($f_signers->getString(6) != '' ? ' (' . $f_signers->getString(6) . ')' : '') . ($f_signers->next() ? ' e altri' : '');
        ?>
                  <?php 
    } else {
        ?>
                    <?php 
        if ($em->getNota()) {
            ?>
                       <?php 
 /**
  * torna gli emendamenti presentati da questa carica (primo firmatario)
  * fino a una certa data
  *
  * @param string $settimana
  * @return array of Opp
  * @author Guglielmo Celata
  */
 public function getPresentedEmendamentos($data = '')
 {
     // quando l'incarico è appena stato creato, non ci sono ancora firme
     if (!$this->isNew()) {
         $c = new Criteria();
         $c->addJoin(OppCaricaHasEmendamentoPeer::EMENDAMENTO_ID, OppEmendamentoPeer::ID);
         $c->add(OppCaricaHasEmendamentoPeer::TIPO, 'P');
         $c->add(OppCaricaHasEmendamentoPeer::CARICA_ID, $this->getId());
         if ($data != '') {
             $c->add(OppCaricaHasEmendamentoPeer::DATA, $data, Criteria::LESS_THAN);
             $c->add(OppEmendamentoPeer::LEGISLATURA, OppLegislaturaPeer::getCurrent($data));
         } else {
             $c->add(OppEmendamentoPeer::LEGISLATURA, OppLegislaturaPeer::getCurrent());
         }
         $res = OppEmendamentoPeer::doSelect($c);
         return $res;
     }
     return null;
 }
            ?>
	                 <em>
	               <?php 
            echo ucfirst($emendamento->getNota());
            ?>
.
	               </em>
	              <?php 
        }
        ?>
        
	            <?php 
    }
    ?>
	            <?php 
    $c_signers = OppEmendamentoPeer::doSelectCoFirmatari($emendamento->getId());
    ?>
	            <?php 
    if (count($c_signers) > 0) {
        ?>
	            <span style="margin-bottom: 0px; font-size:13px; font-weight:normal">e altri <?php 
        echo count($c_signers);
        ?>
 cofirmatari ... [ <a class="btn-open action" href="#" style="display: inline;">apri</a> <a style="display: none;" class="btn-close action" href="#">chiudi</a> ]</span>
	              <div style="display: none; line-height:1.2em;font-size:13px; font-weight:normal;" class="more-results float-container">
	              <?php 
        $i = 0;
        foreach ($c_signers as $key => $cf) {
            $i++;
            $pol = OppPoliticoPeer::retrieveByPk($key);
            echo link_to($pol->getNome() . " " . $pol->getCognome(), '@parlamentare?' . $pol->getUrlParams()) . ($i < count($c_signers) ? ', ' : '.');
 /**
  * Executes commenti action
  *
  * @return void
  * @author Guglielmo Celata
  */
 public function executeCommenti()
 {
     $this->emendamento = OppEmendamentoPeer::retrieveByPK($this->getRequestParameter('id'));
     $this->attoPortante = $this->emendamento->getAttoPortante();
 }