本文整理汇总了PHP中TagPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::retrieveByPK方法的具体用法?PHP TagPeer::retrieveByPK怎么用?PHP TagPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagPeer
的用法示例。
在下文中一共展示了TagPeer::retrieveByPK方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeAttivitaGruppoArgomento
public function executeAttivitaGruppoArgomento()
{
// parametri obbligatori
$this->ramo = $this->getRequestParameter('ramo');
$gruppo_id = $this->getRequestParameter('gruppo_id');
// parametri opzionali
if ($this->hasRequestParameter('triple_value')) {
$triple_value = $this->getRequestParameter('triple_value');
$this->argomento = TagPeer::retrieveFirstByTripleValue($triple_value);
}
if ($this->hasRequestParameter('tag_name')) {
$this->tag_name = $this->getRequestParameter('tag_name', '');
$this->argomento = TagPeer::retrieveByTagName($this->tag_name);
}
if ($this->hasRequestParameter('tag_id')) {
$this->tag_id = $this->getRequestParameter('tag_id', '');
$this->argomento = TagPeer::retrieveByPK($this->tag_id);
}
$limit = null;
if ($this->hasRequestParameter('limit')) {
$limit = $this->getRequestParameter('limit');
}
// la data è passata come parametro o viene estratta l'ultima nella cache (per dati di tipo 'A', singoli atti)
if ($this->hasRequestParameter('data')) {
$this->data = $this->getRequestParameter('data');
} else {
$this->data = OppActHistoryCachePeer::fetchLastData();
}
$this->gruppo = OppGruppoPeer::retrieveByPK($gruppo_id);
$this->forward404Unless($this->gruppo instanceof OppGruppo);
$this->politici = OppCaricaPeer::getClassificaPoliticiSiOccupanoDiArgomenti(array($this->argomento->getId()), $this->ramo, $this->data, $limit, $gruppo_id, false);
}
示例2: executeToggleApproved
public function executeToggleApproved()
{
$tag = TagPeer::retrieveByPK($this->getRequestParameter('id'));
$this->forward404Unless($tag);
$tag->setApproved(!$tag->getApproved());
$tag->save();
$this->redirect('tag/index');
}
示例3: reloadByTag
private function reloadByTag($tagId)
{
$c = new Criteria();
$this->routeObject = TagPeer::retrieveByPK($tagId);
$ids = TaggingPeer::getJobIdsByTag($this->routeObject);
$c->add(JobPeer::ID, $ids, Criteria::IN);
$this->route = "job_listby_tag";
$this->propelType = "name";
$this->renderStatus = true;
$this->viewingCaption = " taggings for " . $this->routeObject->__toString();
return $c;
}
示例4: getTag
public function getTag($con = null)
{
if ($this->aTag === null && $this->tag_id !== null) {
include_once 'lib/model/om/BaseTagPeer.php';
$this->aTag = TagPeer::retrieveByPK($this->tag_id, $con);
}
return $this->aTag;
}
示例5: executeTagNews
public function executeTagNews()
{
// due righe modificate per la chiamata con id
$this->tag_id = $this->getRequestParameter('id');
$this->tag = TagPeer::retrieveByPK($this->tag_id);
$namespace = $this->getRequestParameter('namespace');
// setlocale(LC_TIME, 'it_IT');
sfLoader::loadHelpers(array('Tag', 'Url', 'DeppNews'));
$feed = new sfRss2ExtendedFeed();
$feed->initialize(array('title' => 'Ultime notizie sull\'argomento ' . $this->tag->getTripleValue(), 'link' => url_for('@homepage', true), 'feedUrl' => $this->getRequest()->getURI(), 'siteUrl' => 'http://' . sfConfig::get('sf_site_url'), 'image' => 'http://' . sfConfig::get('sf_site_url') . '/images/logo-openparlamento.png', 'language' => 'it', 'authorEmail' => 'info@openparlamento.it', 'authorName' => 'Openparlamento', 'description' => "Openparlamento.it - il progetto Openpolis per la trasparenza del Parlamento", 'sy_updatePeriod' => 'daily', 'sy_updateFrequency' => '1', 'sy_updateBase' => '2000-01-01T12:00+00:00'));
$news = oppNewsPeer::getNewsForTagCriteria($this->tag_id);
$news->addDescendingOrderByColumn(NewsPeer::DATE);
$itemsperpage = $this->getRequestParameter('page', sfConfig::get('app_pagination_limit'));
$page = $this->getRequestParameter('page', 1);
$pager = new deppNewsPager('News', $itemsperpage);
$pager->setCriteria($news);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
$url = url_for('@news_tag?id=' . $this->tag_id, true) . '?' . urlencode('page=' . $page . '&itemsperpage=' . $itemsperpage);
foreach ($pager->getGroupedResults() as $date_ts => $news) {
foreach ($news as $cnt => $n) {
// fetch del modello e dell'oggetto che ha generato la notizia
$generator_model = $n->getGeneratorModel();
if ($n->getGeneratorPrimaryKeys()) {
$pks = array_values(unserialize($n->getGeneratorPrimaryKeys()));
$generator = call_user_func_array(array($generator_model . 'Peer', 'retrieveByPK'), $pks);
} else {
$pks = array();
$generator = null;
}
$item = new sfRss2ExtendedItem();
$description = news_text($n, $generator_model, $pks, $generator, array('context' => CONTEXT_TAG));
$item->initialize(array('title' => strip_tags($description), 'link' => $url, 'permalink' => $url, 'pubDate' => $n->getDate('U'), 'uniqueId' => $n->getId(), 'description' => $description, 'authorEmail' => 'info@openparlamento.it', 'authorName' => 'Openparlamento'));
$feed->addItem($item);
}
}
$this->_send_output($feed);
return sfView::NONE;
}
示例6: executeTag
public function executeTag()
{
// due righe modificate per la chiamata con id
$this->tag_id = $this->getRequestParameter('id');
$this->tag = TagPeer::retrieveByPK($this->tag_id);
$this->getResponse()->setTitle('tutte le notizie sull\'argomento ' . $this->tag->getTripleValue() . ' - ' . sfConfig::get('app_main_title'));
$this->response->addMeta('description', 'Tutte le notizie aggiornate quotidianamente sugli atti parlamentari che parlano di ' . $this->tag->getTripleValue(), true);
$c = oppNewsPeer::getNewsForTagCriteria($this->tag_id);
$c->addDescendingOrderByColumn(NewsPeer::DATE);
if ($this->hasRequestParameter('itemsperpage')) {
$this->getUser()->setAttribute('itemsperpage', $this->getRequestParameter('itemsperpage'));
}
$itemsperpage = $this->getUser()->getAttribute('itemsperpage', sfConfig::get('app_pagination_limit'));
$pager = new deppNewsPager('News', $itemsperpage);
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
}
示例7: run_opp_build_cache_tags
/**
* Calcola o ri-calcola la rilevanza degli argomenti, come somma della rilevanza degli atti taggati
* Si può specificare il una data fino alla quale calcolare la rilevanza
* Se sono passati degli ID (argomenti), sono interpretati come ID di argomenti e il calcolo è fatto solo per loro
*/
function run_opp_build_cache_tags($task, $args, $options)
{
static $loaded;
// load application context
if (!$loaded) {
_loader();
}
echo "memory usage: " . memory_get_usage() . "\n";
$data = '';
$verbose = false;
$offset = null;
$limit = null;
$start_time = time();
if (array_key_exists('data', $options)) {
$data = $options['data'];
}
if (array_key_exists('verbose', $options)) {
$verbose = true;
}
if (array_key_exists('offset', $options)) {
$offset = $options['offset'];
}
if (array_key_exists('limit', $options)) {
$limit = $options['limit'];
}
if ($data != '') {
$legislatura_corrente = OppLegislaturaPeer::getCurrent($data);
$data_lookup = $data;
} else {
$legislatura_corrente = OppLegislaturaPeer::getCurrent();
$data = date('Y-m-d');
$data_lookup = OppTagHistoryCachePeer::fetchLastData();
}
$msg = sprintf("calcolo rilevanza tag - fino a: %10s\n", $data);
echo pakeColor::colorize($msg, array('fg' => 'cyan', 'bold' => true));
if (count($args) > 0) {
$tags_ids = $args;
} else {
$tags_ids = TaggingPeer::getActiveTagsIds('OppAtto');
}
$n_tags = count($tags_ids);
echo "memory usage: " . memory_get_usage() . "\n";
foreach ($tags_ids as $cnt => $tag_id) {
printf("%5d/%6d) %40s %6d ... ", $cnt + 1, $n_tags, TagPeer::retrieveByPK($tag_id), $tag_id);
$indice = OppIndiceRilevanzaPeer::calcola_rilevanza_tag($tag_id, $data, $verbose);
// inserimento o aggiornamento del valore in opp_tag_history_cache
$cache_record = OppTagHistoryCachePeer::retrieveByDataChiTipoChiId($data_lookup, 'S', $tag_id);
if (!$cache_record) {
$cache_record = new OppTagHistoryCache();
}
$cache_record->setLegislatura($legislatura_corrente);
$cache_record->setChiTipo('S');
$cache_record->setChiId($tag_id);
$cache_record->setIndice($indice);
$cache_record->setData($data);
$cache_record->setUpdatedAt(date('Y-m-d H:i'));
// forza riscrittura updated_at, per tenere traccia esecuzioni
$cache_record->save();
unset($cache_record);
$msg = sprintf("%7.2f", $indice);
echo pakeColor::colorize($msg, array('fg' => 'cyan', 'bold' => true));
$msg = sprintf(" [%4d sec] [%10d bytes]\n", time() - $start_time, memory_get_usage());
echo pakeColor::colorize($msg, array('fg' => 'red', 'bold' => false));
}
$msg = sprintf("%d tag elaborati\n", $cnt + 1);
echo pakeColor::colorize($msg, array('fg' => 'cyan', 'bold' => true));
}
示例8: news_text
/**
* 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 è svolta almeno una VOTAZIONE');
} else {
$news_string .= "<p>";
$news_string .= $news->getRamoVotazione() == 'C' ? 'Camera - ' : 'Senato - ';
$news_string .= 'si è 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\'è 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("È 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';
//.........这里部分代码省略.........
示例9: foreach
<th scope="col">indice:</th>
<th scope="col">azioni:</th>
</tr>
</thead>
<tbody>
<?php
$tr_class = 'even';
?>
<?php
foreach ($pager->getResults() as $record) {
?>
<?php
$tag = TagPeer::retrieveByPK($record->getChiId());
?>
<tr class="<?php
echo $tr_class;
?>
">
<?php
$tr_class = $tr_class == 'even' ? 'odd' : 'even';
?>
<th><?php
echo $tag->getTripleValue();
?>
</th>
<td class="numeric-value"><p><?php
printf("%7.2f", $record->getIndice());
示例10: getTag
/**
* Get the associated Tag object
*
* @param Connection Optional Connection object.
* @return Tag The associated Tag object.
* @throws PropelException
*/
public function getTag($con = null)
{
// include the related Peer class
include_once 'lib/model/om/BaseTagPeer.php';
if ($this->aTag === null && $this->tag_id !== null) {
$this->aTag = TagPeer::retrieveByPK($this->tag_id, $con);
/* The following can be used instead of the line above to
guarantee the related object contains a reference
to this object, but this level of coupling
may be undesirable in many circumstances.
As it can lead to a db query with many results that may
never be used.
$obj = TagPeer::retrieveByPK($this->tag_id, $con);
$obj->addTags($this);
*/
}
return $this->aTag;
}
示例11: eval
$c->addAnd(BookmarkPeer::USER_ID, null, Criteria::ISNOTNULL);
if ($class == "Email") {
$c->add(EmailPeer::IS_CONFIRMED, true);
}
$c->addJoin(eval("return {$class}Peer::ID;"), eval("return Tag{$class}Peer::" . strtoupper($class) . "_ID;"), Criteria::LEFT_JOIN);
$c->addJoin(eval("return Tag{$class}Peer::TAG_ID;"), TagPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(TagPeer::ID, BookmarkPeer::TAG_ID, Criteria::LEFT_JOIN);
// add select columns
$c->addSelectColumn(TagPeer::ID);
$c->addSelectColumn(BookmarkPeer::USER_ID);
$c->addSelectColumn(eval("return {$class}Peer::ID;"));
// find changed objects
$changed_objects[$class] = call_user_func(array("{$class}Peer", "doSelectRS"), $c);
}
// build a list of jotag->user->contact that will be notified
$changed_jotags = array();
foreach ($changed_objects as $class => $rs) {
while ($rs->next()) {
$changed_jotags[$rs->getInt(1)][$rs->getInt(2)][$class][] = call_user_func(array("{$class}Peer", "retrieveByPK"), $rs->getInt(3));
}
}
//print_r($changed_jotags);exit;
// nofity each user
foreach ($changed_jotags as $jotagID => $data) {
$jotag = TagPeer::retrieveByPK($jotagID);
$vcard = new Swift_Message_Attachment($jotag->getVCard()->fetch(), $jotag->getTagProfile()->__toString() . '.vcf', "text/plain");
foreach ($data as $userID => $contacts) {
$user = UserPeer::retrieveByPK($userID);
Mailer::sendEmail($user->getPrimaryEmail(), 'changedJotag', array('jotag' => $jotag, 'user' => $user, 'contacts' => $contacts), $user->getPreferedLanguage(), $vcard);
}
}