Esempio n. 1
0
    public function getOne($id)
    {
        $sql = '
			SELECT {{tree}}.*, {{sort}}.countComments, {{sort}}.popularity  FROM {{tree}} 
			LEFT JOIN {{sort}} ON {{tree}}.id={{sort}}.tree
			WHERE {{tree}}.id=' . $id . '
		';
        $data = DB::getRow($sql);
        $fields = Fields::getFieldsByTree($id, 'wide');
        $data['preview'] = $fields['preview'];
        $data['pic'] = $fields['files_gal']['image'][0]['path'];
        $data['source'] = $fields['source'];
        $data['link'] = $fields['link'];
        $data['tags'] = News::getTags($id, $data['parent']);
        $data['path'] = Tree::getPathToTree($id);
        $data['date'] = News::getDate($data['udate']);
        $data['type'] = 'news';
        if ($data['countComments'] == '') {
            $data['countComments'] = 0;
            $sql = 'INSERT INTO {{sort}} SET tree=' . $id;
            DB::exec($sql);
        }
        $sql = '
			SELECT {{tree}}.* FROM {{data}} 
			INNER JOIN {{tree}} ON {{tree}}.id={{data}}.value_text
			WHERE {{data}}.tree=' . $id . ' AND {{data}}.path=\'author\'
		';
        $author = DB::getRow($sql);
        $author['path'] = '/persons/' . $author['path'] . '/';
        $data['author'] = $author;
        return $data;
    }
Esempio n. 2
0
 public function testCreateNews()
 {
     // Arrange
     $a = new News('a', 'b', 123, 'http://abc.com', '2011-09-23T13:24:09.000Z');
     // Assert
     $this->assertEquals('a', $a->getTitle());
     $this->assertEquals('b', $a->getAuthor());
     $this->assertEquals(123, $a->getPoints());
     $this->assertEquals('http://abc.com', $a->getLink());
     $this->assertEquals('2011-09-23T13:24:09.000Z', $a->getDate());
 }
Esempio n. 3
0
 private function getAssociation(P2000 $p2000, News $news)
 {
     $p2000id = $p2000->getId();
     $newsid = $news->getId();
     $leftLabels = array();
     $rightLabels = array();
     if (strtolower($p2000->getLocation()) !== strtolower($news->getLocation())) {
         return false;
     }
     foreach ($p2000->getLabels() as $pLabel) {
         $date = null;
         $match = false;
         foreach ($news->getLabels() as $nLabel) {
             if (strtolower($nLabel) === "overig") {
                 continue;
             }
             if (Util::labelsMatch($pLabel, $nLabel)) {
                 if (!$match) {
                     $match = true;
                 }
                 if (!in_array($pLabel, $leftLabels, true)) {
                     array_push($leftLabels, $pLabel);
                 }
                 if (!in_array($nLabel, $rightLabels, true)) {
                     array_push($rightLabels, $nLabel);
                 }
             }
         }
         if ($match) {
             $p2000date = $p2000->getDate()->format('d-m-Y');
             $newsDate = $news->getDate()->format('d-m-Y');
             if ($p2000date === $newsDate && !in_array($p2000date, $leftLabels, true)) {
                 array_push($leftLabels, $p2000->getDate()->format('d-m-Y'));
                 $date = $p2000->getDate();
             }
         }
     }
     if (count($leftLabels) < 1) {
         return false;
     }
     return new AssocRule($p2000id, $newsid, $leftLabels, $rightLabels, $date);
 }
Esempio n. 4
0
                    <a title="<?php 
            echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'View the latest post');
            ?>
" href="<?php 
            echo IPB::getLink($topic->tid, $topic->title);
            ?>
" target="_blank">
                       <?php 
            echo $topic->title;
            ?>
                    </a>
                </div>

                <div class="date">
                    <?php 
            echo News::getDate(date('d M Y -.H:i', $topic->last_post));
            ?>
                </div>

                <div class="last-poster">
                    <span class="author">
                        <?php 
            echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Author');
            ?>
:
                    </span>

                     <span class="r-author">
                        <?php 
            echo $topic->last_poster_name;
            ?>
Esempio n. 5
0
</td>
            <td align="center"><?php 
    echo $charEntity->{$gReset};
    ?>
</td>
            <td align="center"><?php 
    echo $model->getCGuild($item->mainChar->GameIDC);
    ?>
</td>
            <td align="center"><?php 
    echo $model->getGLogo($model->getCGuild($item->mainChar->GameIDC), 16);
    ?>
</td>
            <td align="center"><?php 
    echo $this->getMap($charEntity->MapNumber);
    ?>
</td>
        </tr>
    <?php 
}
?>
    </tbody>
</table>
</div>
<div class="upd-time">
    <?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Last updated') . ': ' . News::getDate(date("d M Y -.H:i", time()));
?>
</div>

Esempio n. 6
0
echo $this->createUrl('cp/article', array('id' => $data->id));
?>
">
            <?php 
echo $data->title;
?>
        </a>
    </h3>
    <div class="by-line">
        <span class="news-author"><?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Author') . ': ' . $data->author;
?>
</span>
        <span class="spacer"></span>
        <?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Date') . ': ' . News::getDate(date('d M Y -.H:i', $data->date));
?>
    </div>

    <?php 
if ($data->img != '') {
    ?>
        <div class="article-left" style="background-image: url(<?php 
    echo $data->img;
    ?>
);">
           <span class="thumb-frame"></span>
        </div>
    <?php 
}
?>
Esempio n. 7
0
images/stock_person.png" alt="user"/></a>
        <div class="messageArea">
            <span class="aro"></span>
            <div class="infoRow">
                <span class="name"><strong><?php 
echo $model->memb___id;
?>
</strong> (<?php 
echo $model->character;
?>
) <?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'says');
?>
:</span>
                <span class="time"><?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Sent') . ': ' . News::getDate(date("d M Y -.H:i:s", $model->date));
?>
</span>
                <div class="clear"></div>
            </div>
                <?php 
echo $model->description;
?>
        </div>
        <div class="clear"></div>
    </li>




Esempio n. 8
0
        </li>
        <li>
            <div class="enty">
                <?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Status');
?>
:
            </div>

            <div class="val">
                <?php 
echo FAI_TICKETS::getPriority($model->priority, 'word');
?>
            </div>
        </li>
        <li>
            <div class="enty">
                <?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Date');
?>
:
            </div>

            <div class="val">
                <?php 
echo News::getDate(date("d M Y -.H:i:s", $model->date));
?>
            </div>
        </li>
    </ul>
</div>
Esempio n. 9
0
<div class="news">
    <div class="news-head">
        <div class="news_icon"></div>
        <div class="newstitle">
            <h3><?php 
echo $data->title;
?>
</h3>
            <div class="newstime">
                <?php 
echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Wrote') . ': ' . $data->author . ' / ' . News::getDate(date('d.m.Y', $data->date));
?>
            </div>
        </div>
        <div class="clear"></div>
    </div>

    <div class="n-content">
        <?php 
if ($data->img != '') {
    ?>
            <img class="n-image" width="152" height="152" src="<?php 
    echo $data->img;
    ?>
" alt="<?php 
    echo $data->title;
    ?>
"/>
        <?php 
}
?>
/**
 * generate textual representation for a news
 *
 * @param News $news 
 * @param String $generator_model 
 * @param Array $pks 
 * @param BaseObject $generator 
 * @param Array $options 
 *   context  - 0: box, 1: news per politico, 2:pagina di un atto, 3: argomento
 *   in_mail  - if the news lives in a mail or not
 * @return string (html)
 * @author Guglielmo Celata
 */
function news_text(News $news, $generator_model, $pks, $generator, $options = array())
{
    sfLoader::loadHelpers('Asset');
    // default value for context
    if (!array_key_exists('context', $options)) {
        $context = CONTEXT_LIST;
    } else {
        $context = $options['context'];
    }
    // default value for in_mail
    if (!array_key_exists('in_mail', $options)) {
        $in_mail = false;
    } else {
        $in_mail = $options['in_mail'];
    }
    $news_string = "";
    // notizie di gruppo (votazioni, interventi o emendamenti)
    if (count($pks) == 0) {
        if ($generator_model == 'OppVotazioneHasAtto') {
            if ($news->getPriority() == 1) {
                $news_string .= content_tag('p', $news->getRamoVotazione() == 'C' ? 'Camera -  ' : 'Senato - ');
                $news_string .= content_tag('p', 'si &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;
}
Esempio n. 11
0
<tr>
    <td align="center">
        <?php 
echo $data->id;
?>
    </td>

    <td>
        <?php 
echo $data->title;
?>
    </td>

    <td>
        <?php 
echo News::getDate(date('d M Y -.H:s:i', $data->date));
?>
    </td>

    <td align="center">
        <?php 
if ($data->onmpage == 1) {
    ?>
        <?php 
    $form = $this->beginWidget('CActiveForm', array('id' => 'category-form', 'action' => '' . Yii::app()->controller->id . '/mpage/' . $data->id . '', 'enableAjaxValidation' => false));
    ?>
        <button class="status-btn" type="submit"><img src="<?php 
    echo $this->getTemplate('backend');
    ?>
images/accept.png" alt="<?php 
    echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Active');