本文整理汇总了PHP中News::getLastNews方法的典型用法代码示例。如果您正苦于以下问题:PHP News::getLastNews方法的具体用法?PHP News::getLastNews怎么用?PHP News::getLastNews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::getLastNews方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$this->checkCookieEnabled();
$this->htmlPageId = 'index';
$page = Menu::model()->findByPk(InfoPages::MAIN_PAGE_ID);
if (issetModule('seo')) {
$seo = SeoFriendlyUrl::model()->findByAttributes(array('model_name' => 'InfoPages', 'model_id' => InfoPages::MAIN_PAGE_ID));
if ($seo) {
$this->setSeo($seo);
}
}
$langs = Lang::getActiveLangs();
$countLangs = count($langs);
if (!isFree() && !isset($_GET['lang']) && ($countLangs > 1 || $countLangs == 1 && param('useLangPrefixIfOneLang'))) {
$canonicalUrl = Yii::app()->getBaseUrl(true);
$canonicalUrl .= '/' . Yii::app()->language;
Yii::app()->clientScript->registerLinkTag('canonical', null, $canonicalUrl);
}
Yii::app()->user->setState('searchUrl', NULL);
$lastNews = News::getLastNews();
if (Yii::app()->request->isAjaxRequest) {
// $modeListShow = User::getModeListShow();
// if ($modeListShow == 'table') {
// # нужны скрипты и стили, поэтому processOutput установлен в true только для table
// $this->renderPartial('index', array('page' => $page, 'newsIndex' => $lastNews), false, true);
// }
// else {
$this->renderPartial('index', array('page' => $page, 'newsIndex' => $lastNews));
// }
} else {
$this->render('index', array('page' => $page, 'newsIndex' => $lastNews));
}
}
示例2: index
public function index($request)
{
$data['storage_server'] = ['local_server', 'stor1'];
$data['tickets'] = Ticket::getSize(Session::get());
$data['all_tickets'] = Ticket::getSize();
$data['news'] = News::getLastNews();
return new ViewResponse('admin/dashboard/index', $data);
}
示例3: index
public function index($request)
{
$data['storage_server'] = ['local_server', 'stor1'];
$data['tickets'] = Ticket::getSize(Session::get());
$data['all_tickets'] = Ticket::getSize();
$data['news'] = News::getLastNews();
$data['notifs'] = StaffNotification::getInternStaffNotifications();
$data['team'] = User::getTeam();
$data['is_notif_enabled'] = StaffNotification::isEnabled(Session::get());
return new ViewResponse('admin/dashboard/index', $data);
}
示例4: actionView
public function actionView($id = 0, $url = '', $printable = 0)
{
//$this->showSearchForm = false;
$this->htmlPageId = 'viewlisting';
$apartment = NULL;
$seo = NULL;
if (($id || $url) && issetModule('seo')) {
$url = $url ? $url : $id;
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if ($seo) {
$this->setSeo($seo);
$id = $seo->model_id;
}
}
if ($id) {
$apartment = Apartment::model()->with(array('windowTo', 'objType', 'city'))->findByPk($id);
// избавляемся от дублей
$apartmentUrl = $apartment->getUrl(false);
if (!$printable && issetModule('seo') && $apartment->seo && Yii::app()->request->url != $apartmentUrl) {
$this->redirect($apartmentUrl, true, 301);
}
}
if (!$apartment) {
throw404();
}
if (!in_array($apartment->type, Apartment::availableApTypesIds()) || !in_array($apartment->price_type, array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)))) {
throw404();
}
if ($apartment->owner_id != 1 && $apartment->owner_active == Apartment::STATUS_INACTIVE) {
if (!(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id) && !Yii::app()->user->checkAccess('backend_access')) {
Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments'));
throw404();
}
}
if (($apartment->active == Apartment::STATUS_INACTIVE || $apartment->active == Apartment::STATUS_MODERATION) && !Yii::app()->user->checkAccess('backend_access') && !(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id)) {
Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments'));
//$this->redirect(Yii::app()->homeUrl);
throw404();
}
if ($apartment->active == Apartment::STATUS_MODERATION && $apartment->owner_active == Apartment::STATUS_ACTIVE && $apartment->owner_id == Yii::app()->user->id) {
Yii::app()->user->setFlash('error', tc('Awaiting moderation'));
}
if ($apartment->deleted) {
Yii::app()->user->setFlash('error', tt('Listing is deleted', 'apartments'));
}
$dateFree = CDateTimeParser::parse($apartment->is_free_to, 'yyyy-MM-dd');
if ($dateFree && $dateFree < time() - 60 * 60 * 24) {
$apartment->is_special_offer = 0;
$apartment->update(array('is_special_offer'));
}
if (!Yii::app()->request->isAjaxRequest) {
$ipAddress = Yii::app()->request->userHostAddress;
$userAgent = Yii::app()->request->userAgent;
Apartment::setApartmentVisitCount($apartment, $ipAddress, $userAgent);
}
$lastNews = News::getLastNews();
$lastArticles = Article::getLastArticles();
#######################################################################
# для соц. кнопок
if ($apartment->getStrByLang("title")) {
Yii::app()->clientScript->registerMetaTag($apartment->getStrByLang("title"), null, null, array('property' => 'og:title'));
}
if ($apartment->getStrByLang("description")) {
Yii::app()->clientScript->registerMetaTag($apartment->getStrByLang("description"), null, null, array('property' => 'og:description'));
}
Yii::app()->clientScript->registerMetaTag($apartment->getUrl(), null, null, array('property' => 'og:url'));
if (Yii::app()->theme->name == 'atlas') {
$res = Images::getMainThumb(640, 400, $apartment->images);
} else {
$res = Images::getMainThumb(300, 200, $apartment->images);
}
if (isset($res['thumbUrl']) && $res['thumbUrl']) {
Yii::app()->clientScript->registerMetaTag($res['thumbUrl'], null, null, array('property' => 'og:image'));
Yii::app()->clientScript->registerLinkTag('image_src', null, $res['thumbUrl']);
}
#######################################################################
if ($printable) {
$this->layout = '//layouts/print';
$this->render('view_print', array('model' => $apartment));
} else {
$this->render('view', array('model' => $apartment, 'statistics' => Apartment::getApartmentVisitCount($apartment), 'lastNews' => $lastNews, 'lastArticles' => $lastArticles));
}
}
示例5: alert
}
}', 'success' => 'function() {
alert("Ваш вопрос отправлен");
$("#Qa_username, #Qa_question").val("");
}')));
$this->endWidget();
?>
</div><!--/qform-->
<div id="news">
<h2>Новости</h2>
<?php
foreach (News::getLastNews() as $value) {
echo '<div><span>', $value['date'], '</span><br><a href="#" class="preview">', $value['preview'], '</a></div>';
}
?>
<a href="#" class="archive">Архив новостей</a>
</div><!--/news-->
</div>
<div class="span9">
<div id="content">
<?php
echo $content;