public function executeLastAtto()
 {
     $id = $this->getRequestParameter('id');
     $atto = OppAttoPeer::retrieveByPk($id);
     $this->forward404Unless($atto instanceof OppAtto);
     $c = oppNewsPeer::getNewsForItemCriteria('OppAtto', $id);
     $c->addDescendingOrderByColumn(NewsPeer::DATE);
     $feed = $this->_make_feed_from_pager('Ultime per ' . Text::denominazioneAttoShort($atto), '@singolo_atto?id=' . $id, $this->_get_newspager_from_criteria($c));
     $this->_send_output($feed);
     return sfView::NONE;
 }
 public function executeIndex()
 {
     $this->getResponse()->setTitle('Monitora i tuoi rappresentanti - ' . sfConfig::get('app_main_title'));
     $this->getResponse()->addMeta('description', 'Cosa fanno i tuoi rappresentanti? Tutte le attività parlamentari aggiornate quotidianamente.', true);
     deppFiltersAndSortVariablesManager::resetVars($this->getUser(), 'module', 'module', array('acts_filter', 'sf_admin/opp_atto/sort', 'votes_filter', 'sf_admin/opp_votazione/sort', 'pol_camera_filter', 'pol_senato_filter', 'sf_admin/opp_carica/sort', 'argomento/atti_filter', 'argomento_leggi/sort', 'argomento_nonleg/sort', 'monitoring_filter'));
     // ultime attivita' della community
     $this->latest_activities = CommunityNewsPeer::getLatestActivities(4);
     // ultime news dal parlamento
     $c = oppNewsPeer::getHomeNewsCriteria();
     $c->addDescendingOrderByColumn(NewsPeer::DATE);
     $itemsperpage = 4;
     $pager = new deppNewsPager('News', $itemsperpage);
     $pager->setCriteria($c);
     $pager->setPage($this->getRequestParameter('page', 1));
     $pager->init();
     $this->pager = $pager;
     // atti in evidenza
     $this->lanci = array();
     $c = new Criteria();
     $c->add(sfLaunchingPeer::LAUNCH_NAMESPACE, 'home');
     $c->add(sfLaunchingPeer::OBJECT_MODEL, 'OppAtto');
     $c->setLimit(8);
     $c->addDescendingOrderByColumn(sfLaunchingPeer::PRIORITY);
     $evidences = sfLaunchingPeer::doSelect($c);
     foreach ($evidences as $evidence) {
         $atto = OppAttoPeer::retrieveByPk($evidence->getObjectId());
         $this->lanci[] = $atto->getId();
     }
     // post del blog
     $this->post_pager = sfSimpleBlogPostPeer::getTaggedPager('in evidenza', sfConfig::get('app_sfSimpleBlog_post_max_per_page', 10), $this->getRequestParameter('page', 1));
     // estrae le circoscrizioni, compreso il valore 0
     $this->senato_constituencies = OppCaricaPeer::getAllConstituencies('senato', false);
     $this->camera_constituencies = OppCaricaPeer::getAllConstituencies('camera', false);
 }
    ?>
 <?php 
    echo link_to('chiudi', '#', array('class' => 'btn-close action', 'style' => 'display:none'));
    ?>
 ]
</span>

<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>
 public function getAllSucc()
 {
     $allSucc = array();
     $atto = $this;
     $succ = $atto->getSucc();
     while ($succ != '' && $succ != NULL) {
         $c = new Criteria();
         $c->add(OppAttoPeer::ID, $atto->getId());
         $result = OppAttoPeer::doSelectOne($c);
         if ($result->getSucc() != '' && $result->getSucc() != NULL) {
             $atto = OppAttoPeer::retrieveByPk($result->getSucc());
             $succ = $atto->getId();
             $allSucc[] = $atto;
         } else {
             $succ = '';
         }
     }
     return $allSucc;
 }
 public function executeDdl2legge()
 {
     if ($this->gruppo != NULL) {
         $c = new Criteria();
         $c->add(OppGruppoPeer::ACRONIMO, $this->gruppo);
         $gruppo = OppGruppoPeer::doSelectOne($c);
         $cariche = OppCaricaHasGruppoPeer::getCarichePerGruppo($gruppo->getId(), 1);
         foreach ($cariche as $carica) {
             $componenti_gruppo[] = $carica->getCaricaId();
         }
     }
     if ($this->gruppo != NULL) {
         $c = new Criteria();
         $c->add(OppGruppoPeer::ACRONIMO, $this->gruppo);
         $gruppo = OppGruppoPeer::doSelectOne($c);
         $cariche = OppCaricaHasGruppoPeer::getCaricheGovernoPerGruppo($gruppo->getId(), 1);
         foreach ($cariche as $carica) {
             $componenti_gruppo[] = $carica;
         }
     }
     $arrs = array();
     $arr_alls = array();
     foreach (array(1, 2, 4) as $i) {
         $c = new Criteria();
         if ($this->gruppo != NULL) {
             $c->addJoin(OppAttoPeer::ID, OppCaricaHasAttoPeer::ATTO_ID);
             $c->add(OppCaricaHasAttoPeer::CARICA_ID, $componenti_gruppo, Criteria::IN);
             $c->add(OppCaricaHasAttoPeer::TIPO, 'P');
         }
         $c->add(OppAttoPeer::TIPO_ATTO_ID, 1);
         $c->add(OppAttoPeer::LEGISLATURA, $this->leg);
         $c->add(OppAttoPeer::INIZIATIVA, $i);
         $c->setDistinct(OppAttoPeer::ID);
         $atti = OppAttoPeer::doSelect($c);
         $c = new Criteria();
         if ($this->gruppo != NULL) {
             $c->addJoin(OppAttoPeer::ID, OppCaricaHasAttoPeer::ATTO_ID);
             $c->add(OppCaricaHasAttoPeer::CARICA_ID, $componenti_gruppo, Criteria::IN);
             $c->add(OppCaricaHasAttoPeer::TIPO, 'P');
         }
         $c->addJoin(OppAttoPeer::ID, OppAttoHasIterPeer::ATTO_ID);
         $c->add(OppAttoPeer::TIPO_ATTO_ID, 1);
         $c->add(OppAttoPeer::LEGISLATURA, $this->leg);
         $c->add(OppAttoPeer::INIZIATIVA, $i);
         $c->add(OppAttoHasIterPeer::ITER_ID, 16);
         $c->setDistinct(OppAttoPeer::ID);
         $leggi = OppAttoHasIterPeer::doSelect($c);
         $tempo_medio = 0;
         foreach ($leggi as $legge) {
             $ddl = $legge->getOppAtto();
             while ($ddl->getPred() != NULL) {
                 $ddl = OppAttoPeer::retrieveByPk($ddl->getPred());
             }
             //$this->data_pres=$ddl->getDataPres();
             //$this->data_appr=$legge->getData();
             $data_pres = strtotime($ddl->getDataPres());
             $data_appr = strtotime($legge->getData());
             $tempo_medio = $tempo_medio + ($data_appr - $data_pres) / 86400;
             $arr_alls[] = array($legge->getOppAtto(), ($data_appr - $data_pres) / 86400);
         }
         if (count($leggi) > 0) {
             $tempo_medio = intval($tempo_medio / count($leggi));
         } else {
             $tempo_medio = $tempo_medio;
         }
         $arrs[] = array(count($atti), count($leggi), $tempo_medio);
     }
     $this->arrs = $arrs;
     function cmp($a, $b)
     {
         if ($a[1] == $b[1]) {
             return 0;
         }
         return $a[1] < $b[1] ? -1 : 1;
     }
     usort($arr_alls, "cmp");
     $this->arr_alls = $arr_alls;
 }
<?php

foreach ($lanci as $l) {
    $lancio = OppAttoPeer::retrieveByPk($l);
    ?>
<li class="float-container">
	<div style="margin-right:30px;" class="float-right"><small>utenti:</small></div>
	<p style="color: #BEBEBE;font-size:11px;font-weight:bold;">
	<?php 
    echo format_date($lancio->getDataPres(), 'dd/MM/yyyy');
    ?>
, <?php 
    echo $lancio->getOppTipoAtto()->getDescrizione();
    echo $lancio->getRamo() == 'C' ? ' alla Camera' : ' al Senato';
    ?>
	<?php 
    $f_signers = OppAttoPeer::doSelectPrimiFirmatari($lancio->getId());
    ?>
	<?php 
    if (count($f_signers) > 0) {
        ?>
		<?php 
        $c = new Criteria();
        ?>
		<?php 
        $c->add(OppPoliticoPeer::ID, key($f_signers), Criteria::EQUAL);
        ?>
		<?php 
        $f_signer = OppPoliticoPeer::doSelectOne($c);
        ?>
		<?php 
    <?php 
        echo '<ul style="margin-bottom: 12px;" class="presentation float-container">';
        ?>
      <li>
        <?php 
        echo '<h6>atto originario: <em>' . link_to(OppAttoPeer::retrieveByPk($atto->getPred())->getNumfase(), '/singolo_atto/' . $atto->getPred()) . '</em></h6>';
        ?>
      </li>
    </ul>   
  <?php 
    }
    ?>
  <?php 
    if (is_int($atto->getSucc())) {
        ?>
  
     <?php 
        echo '<ul style="margin-bottom: 12px;" class="presentation float-container">';
        ?>
      <li>
        <?php 
        echo '<h6>trasformato in atto: <em>' . link_to(OppAttoPeer::retrieveByPk($atto->getSucc())->getNumfase(), '/singolo_atto/' . $atto->getSucc()) . '</em></h6>';
        ?>
       </li>
      </ul>
  <?php 
    }
    ?>
  
<?php 
}
 public function executeConfWidget()
 {
     $this->id = $this->getRequestParameter('id');
     $this->pos = $this->getRequestParameter('pos');
     $this->atto = OppAttoPeer::retrieveByPk($this->getRequestParameter('id'));
 }