本文整理汇总了PHP中News::setDate方法的典型用法代码示例。如果您正苦于以下问题:PHP News::setDate方法的具体用法?PHP News::setDate怎么用?PHP News::setDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::setDate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateNewsForPolitico
public function generateNewsForPolitico()
{
// force generation of another news related to politico in case skip is activated
// we need the news related to the politician for the politician page
$n = new News();
$n->setGeneratorModel(get_class($this));
$n->setGeneratorPrimaryKeys(serialize($this->getPrimaryKeysArray()));
$n->setRelatedMonitorableModel('OppPolitico');
$n->setRelatedMonitorableId($this->getOppCarica()->getPoliticoId());
if ($this->getCreatedAt() != null) {
$n->setCreatedAt($this->getCreatedAt());
}
$n->setDate($this->getNewsDate());
$n->setPriority(2);
$n->save();
}
示例2: Message
Message::register(new Message(Message::DANGER, i18n(array("en" => "date is required.", "zh" => "请填写date"))));
$error_flag = true;
}
/// proceed submission
// proceed for $title
$object->setTitle($title);
// proceed for $summary
$object->setSummary($summary);
// proceed for $content
$object->setContent($content);
// proceed for $thumbnail
$object->setThumbnail($thumbnail);
// proceed for $image
$object->setImage($image);
// proceed for $date
$object->setDate($date / 1000);
if ($error_flag == false) {
if ($object->save()) {
Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
HTML::forwardBackToReferer();
} else {
Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
}
}
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create News', 'zh' => 'Create News'))));
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$html->renderOut('news/backend/news_create', array('object' => $object));
$html->output('</div>');
示例3: setFlashData
setFlashData('message', $tab_retour_news[1]);
break;
}
redirectBacko(10);
} else {
if ($http_request['act'] == 'update') {
$id = isset($http_request['id']) && $http_request['id'] != '' ? $http_request['id'] : null;
$intitule = isset($http_request['intitule']) && $http_request['intitule'] != '' ? $http_request['intitule'] : null;
$date_a = isset($http_request['date_a']) && $http_request['date_a'] != '' ? $http_request['date_a'] : null;
$heure_a = isset($http_request['heure_a']) && $http_request['heure_a'] != '' ? $http_request['heure_a'] : null;
$minute_a = isset($http_request['minute_a']) && $http_request['minute_a'] != '' ? $http_request['minute_a'] : null;
$valide_news = isset($http_request['valide_news']) && $http_request['valide_news'] != '' ? $http_request['valide_news'] : null;
$date_affichage = $date_a . " " . $heure_a . ":" . $minute_a . ":00";
$obj_news = new News($id);
$obj_news->setIntitule($intitule);
$obj_news->setDate($date_affichage);
if ($valide_news == "on") {
$obj_news->setValide(1);
} else {
$obj_news->setValide(0);
}
//update de T_News
$tab_retour_news = NewsManager::updateNewsBDD($obj_news);
NewsManager::deleteNetxBdd($id);
//delete des lignes T_NewsTextes correspondant à l'id
$tab_langue = Config::get('tab_lang');
foreach ($tab_langue as $row) {
if (isset($http_request['titre' . $row]) && isset($http_request['corps' . $row])) {
$http_request['titre' . $row] = isset($http_request['titre' . $row]) && $http_request['titre' . $row] != '' ? $http_request['titre' . $row] : null;
$http_request['corps' . $row] = isset($http_request['corps' . $row]) && $http_request['corps' . $row] != '' ? $http_request['corps' . $row] : null;
$obj_news->setLangue($row);
示例4: generateNews
/**
* create as many news as the number of monitorable objects related to the
* generating object
*
* @param BaseObject $object - the generator object
* @param int $priority - the priority (it's an override if not null)
* @param bool $isSuccNews - flag to generate a succNews (only called from batch script)
*
* @return int - the number of generated news
* @author Guglielmo Celata
**/
public function generateNews(BaseObject $object, $priority = null, $isSuccNews = null)
{
$n_gen_news = 0;
// fetch the monitorable objects related to this generator
$monitorable_objects = $this->getRelatedMonitorableObjects($object);
foreach ($monitorable_objects as $obj) {
// temporarily skip news generation when tagging emendamento
if (get_class($object) == 'Tagging' && $object->getTaggableModel() == 'OppEmendamento') {
continue;
}
$n = new News();
$n->setGeneratorModel(get_class($object));
$n->setGeneratorPrimaryKeys(serialize($this->getPrimaryKeysArray($object)));
$n->setRelatedMonitorableModel(get_class($obj));
$n->setRelatedMonitorableId($obj->getPrimaryKey());
// the following methods store data related to the generating object in the cache
// only data needed to sort, sum, average, or count, are cached
if ($object->getCreatedAt() != null) {
$n->setCreatedAt($object->getCreatedAt());
}
$n->setDate($object->getNewsDate());
if (!is_null($priority)) {
$n->setPriority($priority);
} else {
$n->setPriority($object->getNewsPriority());
}
# TODO: spostare le eccezioni fuori dal plugin, in un contesto di applicazione
// eccezioni
// eccezione per non generare notizia alla presentazione di un decreto legge
if ($object instanceof OppAtto && $object->getTipoAttoId() == 12) {
continue;
}
if ($obj instanceof OppAtto) {
$n->setDataPresentazioneAtto($obj->getDataPres());
$n->setTipoAttoId($obj->getOppTipoAtto()->getId());
$n->setRamoVotazione($obj->getRamo());
}
// eccezione per modifica valore campo succ (opp_atto)
if (isset($this->succNews) && $this->succNews || $isSuccNews) {
$n->setSucc($object->getSucc());
$succ_obj = OppAttoPeer::retrieveByPK($object->getSucc());
$n->setDate($succ_obj->getDataPres('Y-m-d h:i:s'));
}
// eccezione per news generate dal tagging
if ($object instanceof Tagging) {
$n->setTagId($object->getTagId());
}
$n->save();
$n_gen_news++;
}
return $n_gen_news;
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:63,代码来源:deppPropelActAsNewsGeneratorBehavior.class.php
示例5: News
$news->setSummary('Century 21 Student Service has a free consultation for oversea students');
$news->setContent('<p>Century 21 Student Service has a free consultation for oversea students ...</p>');
$news->setThumbnail('files/fixture/news/thumbnail/consultation-education-flagship_572.jpg');
$news->setImage('files/fixture/news/image/consultation-education-flagship_390.jpg');
$news->setDate(1439215200);
$news->save();
$news = new News();
$news->setTitle('News Year bonus program for $300 dollars');
$news->setSummary('We are giving away $300 dollars free credit for students applying for Australian colleges');
$news->setContent('<p>We are giving away $300 dollars free credit for students applying for Australian colleges...</p>');
$news->setThumbnail('files/fixture/news/thumbnail/bonus_568.jpg');
$news->setImage('files/fixture/news/image/bonus_915.jpg');
$news->setDate(1439733600);
$news->save();
$news = new News();
$news->setTitle('UNSW orientation program is on now!');
$news->setSummary('From 3rd Sept to 5th Sept, Century 21 Student service will hold a special orientation session');
$news->setContent('<p>From 3rd Sept to 5th Sept, Century 21 Student service will hold a special orientation session for future students who are planning to study in UNSW.</p>');
$news->setThumbnail('files/fixture/news/thumbnail/unsw_via_stargate_778.jpg');
$news->setImage('files/fixture/news/image/unsw_via_stargate_722.jpg');
$news->setDate(1440079200);
$news->save();
$news = new News();
$news->setTitle('Introduction to CT21 VIP program');
$news->setSummary('Century 21 Student Service has a new VIP program just announced this Friday.');
$news->setContent('<p>Century 21 Student Service has a new VIP program just announced this Friday.</p>');
$news->setThumbnail('files/fixture/news/thumbnail/maxresdefault_797.jpg');
$news->setImage('files/fixture/news/image/maxresdefault_310.jpg');
$news->setDate(1440079200);
$news->save();
}
示例6: Criteria
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', false);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
sfContext::getInstance();
/*
duplica le notizie generate dal Tagging, relative a un OppAtto
per ogni notizia, genera una notizia relativa a Tag, con data equivalente
in questo modo, l'estrazione di notizie relative a un tag è semplificata
*/
echo "Fetching news to duplicate\n";
$c = new Criteria();
$c->add(NewsPeer::GENERATOR_MODEL, 'Tagging');
$c->add(NewsPeer::RELATED_MONITORABLE_MODEL, 'OppAtto');
$news = NewsPeer::doSelect($c);
echo "Found " . count($news) . " news\n";
foreach ($news as $i => $n) {
$nn = new News();
$nn->setGeneratorModel($n->getGeneratorModel());
$nn->setGeneratorPrimaryKeys($n->getGeneratorPrimaryKeys());
$nn->setRelatedMonitorableModel('Tag');
$nn->setRelatedMonitorableId($n->getTagId());
$nn->setCreatedAt($n->getCreatedAt());
$nn->setDate($n->getDate());
$nn->setPriority(1);
$nn->setTagId($n->getTagId());
$nn->save();
if ($i % 100 == 0) {
echo $i . " ";
}
}
echo "\n{$i} news processed and fixed\n";
示例7: addNews
public static function addNews()
{
$title = array();
$full = array();
$title['EN'] = Core::validate(self::getVar('titleEN'));
$title['RU'] = Core::validate(self::getVar('titleRU'));
$title['ES'] = Core::validate(self::getVar('titleES'));
$full['EN'] = Core::validate(self::getVar('fullEN'));
$full['RU'] = Core::validate(self::getVar('fullRU'));
$full['ES'] = Core::validate(self::getVar('fullES'));
$news = new News();
$date = new DateTime();
$news->setNewsid($news->getLastNewsId() + 1);
$news->setDate($date->format('Y-m-d H:i:s'));
// English
$news->setLang('EN');
$news->setTitle($title['EN']);
$news->setFull($full['EN']);
$news->insert();
// Russian
$news->setLang('RU');
$news->setTitle($title['RU']);
$news->setFull($full['RU']);
$news->insert();
// Spanish
$news->setLang('ES');
$news->setTitle($title['ES']);
$news->setFull($full['ES']);
$news->insert();
header('Location: /admin/news ');
}
示例8: addGroupVotation
/**
* insert a record in the sf_news_cache table, regarding votation on given
* date, place and act; see description of hasGroupVotation, for the meaning of
* parameters
*
* @param date $data - the date of the seduta when the votation happened
* @param char $ramo - the place where the votation happened (C|S)
* @param char $tipo_atto_id - the type of act the news is related to
* @param integer $atto_id - the identifier for the OppAtto object the votation is related to
*
* @return void
* @author Guglielmo Celata
**/
public static function addGroupVotation($data, $ramo, $tipo_atto_id, $atto_id = null)
{
if (!isset($data) || !isset($ramo) || !isset($tipo_atto_id)) {
throw new deppPropelActAsNewsGeneratorException('$data, $ramo and $tipo_atto_id are required');
}
$news = new News();
$news->setGeneratorModel('OppVotazioneHasAtto');
$news->setDate($data);
$news->setRamoVotazione($ramo);
$news->setRelatedMonitorableModel('OppAtto');
$news->setTipoAttoId($tipo_atto_id);
if (!isset($atto_id)) {
$news->setPriority(1);
} else {
$news->setPriority(2);
$news->setRelatedMonitorableId($atto_id);
}
$news->save();
}