} return parent::save(); } /** * torna l'oggetto Apache_Solr_Document da indicizzare * * @return Apache_Solr_Document * @author Guglielmo Celata */ public function intoSolrDocument() { $document = new Apache_Solr_Document(); $id = $this->getId(); $document->id = md5('OppDocumento' . $id); $document->sfl_model = 'OppDocumento'; $document->sfl_type = 'model'; $document->tipo_atto_s = strtolower($this->getOppAtto()->getTipoAtto()); $document->propel_id = $id; $document->titolo = strip_tags(str_replace("'", "\\'", $this->getTitoloCompleto())); $document->testo = strip_tags(str_replace("'", "\\'", $this->getTesto())); if ($this->getData()) { $document->data_pres_dt = $this->getData('%Y-%m-%dT%H:%M:%SZ'); } $document->created_at_dt = $this->getCreatedAt('%Y-%m-%dT%H:%M:%SZ'); // ritorna il documento da aggiungere return $document; } } sfPropelBehavior::add('OppDocumento', array('deppPropelActAsNewsGeneratorBehavior' => array('monitorable_models' => array('OppAtto' => 'getOppAtto'), 'date_method' => 'Data', 'priority' => '2'))); sfSolrPropelBehavior::getInitializer()->setupModel('OppDocumento');
} if ($this->getOppSeduta()->getData()) { $document->data_pres_dt = $this->getOppSeduta()->getData('%Y-%m-%dT%H:%M:%SZ'); } // ritorna il documento da aggiungere return $document; } public function getSlug() { return Util::slugify($this->getTitolo()); } /** * * @author Daniele Faraglia * @return string parametri per completare l'url della route */ public function getUrlParams() { $str = 'id=' . $this->getId(); $str .= '&slug=' . $this->getSlug(); $str .= '&ramo=' . ($this->getOppSeduta()->getRamo() == 'C' ? 'camera' : 'senato'); return $str; } } sfPropelBehavior::add('OppVotazione', array('deppPropelActAsVotableBehavior' => array('voting_range' => 1, 'voting_fields' => array(1 => 'UtFav', -1 => 'UtContr'), 'neutral_position' => false, 'anonymous_voting' => false, 'clear_cache_after_update' => true))); sfPropelBehavior::add('OppVotazione', array('wikifiableBehavior' => array('prefix' => 'votazione', 'default_description' => "Inserire qui una descrizione della votazione.", 'default_user_comment' => 'Creazione iniziale'))); sfPropelBehavior::add('OppVotazione', array('deppPropelActAsTaggableBehavior')); sfPropelBehavior::add('OppVotazione', array('deppPropelActAsCommentableBehavior')); sfPropelBehavior::add('OppVotazione', array('deppPropelActAsLaunchableBehavior')); sfSolrPropelBehavior::getInitializer()->setupModel('OppVotazione');
/** * Set the lock status of the behavior * @param boolean $to */ public static function setLock($to) { self::$lock = (bool) $to; }
public function getTopTerms() { $tt_objects = $this->getOppTagHasTtsJoinOppTeseott(); $res = ""; foreach ($tt_objects as $tt) { $res = $tt->getOppTeseott()->getDenominazione() . ", "; } return trim($res, " ,"); } /** * torna l'oggetto Apache_Solr_Document da indicizzare * * @return Apache_Solr_Document * @author Guglielmo Celata */ public function intoSolrDocument() { $document = new Apache_Solr_Document(); $id = $this->getId(); $document->id = md5('Tag' . $id); $document->sfl_model = 'Tag'; $document->sfl_type = 'model'; $document->propel_id = $id; $document->triple_value = $this->getTripleValue(); // ritorna il documento da aggiungere return $document; } } sfPropelBehavior::add('Tag', array('deppPropelActAsMonitorableBehavior' => array('count_monitoring_users_field' => 'NMonitoringUsers', 'monitorer_model' => 'OppUser', 'count_monitored_objects_field' => 'NMonitoredTags'))); sfSolrPropelBehavior::getInitializer()->setupModel('Tag');
$document->nominativo = strtolower($this->getNome()) . " " . strtolower($this->getCognome()); // ritorna il documento da aggiungere return $document; } /** * * @author Daniele Faraglia * @return string parametri per completare l'url della route */ public function getUrlParams() { $str = 'id=' . $this->getId(); $str .= '&slug=' . $this->getSlug(); return $str; } /** * * @author Daniele Faraglia * @return string torna lo slug NOME-COGNOME */ public function getSlug() { return Util::slugify($this->getNome() . ' ' . $this->getCognome()); } } // add the ActAsMonitorable behavior // the field OppUserPeer::N_MONITORED_POLITICOS // holds the number of objects of this type monitored sfPropelBehavior::add('OppPolitico', array('deppPropelActAsMonitorableBehavior' => array('count_monitoring_users_field' => 'NMonitoringUsers', 'monitorer_model' => 'OppUser', 'count_monitored_objects_field' => 'NMonitoredPoliticos'))); sfSolrPropelBehavior::getInitializer()->setupModel('OppPolitico');