public function getData() { $result = array(); $result['preview'] = Advertisement::model()->getPreviewAdvertisementt($this->id); $result['next'] = Advertisement::model()->getNextAdvertisementt($this->id); return $result; }
public function getData() { $view = $this->view; $data = array(); switch ($view) { case $view == 'adlist': $data = Advertisement::model()->getAdvertisements(); break; case $view == 'channel': foreach (Channel::model()->generateChannelList() as $channel => $v) { $data[] = Channel::model()->getChannels(0, $channel); } break; case $view == 'message': $data = Advertisement::model()->getValidateAdvertisements(4); break; case $view == 'register': $data = User::model()->findAll(array('order' => 'lastlogin DESC', 'limit' => 10)); break; case $view == 'adrelated': $_model = Advertisement::model()->getAdvertisementModel($_GET['id']); $data = Advertisement::model()->findAll(array('condition' => 'cid = :cid', 'order' => 'id DESC', 'limit' => 10, 'params' => array(':cid' => $_model->cid))); unset($_model); break; case $view = 'infolist': $_model = Advertisement::model()->getAdvertisementModel($_GET['id']); $data = Advertisement::model()->findAll(array('condition' => 'uid = :uid', 'order' => 'id DESC', 'limit' => 10, 'params' => array(':uid' => $_model->uid))); unset($_model); break; } return $data; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Advertisement::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function run() { parent::run(); $criteria = new CDbCriteria(); $criteria->order = 't.order ASC'; $menu = Menu::model()->findAll($criteria); $data['adv'] = Advertisement::model()->findAll("state = 1"); $this->render('bottom_logos', $data); }
public function actionIndex() { $this->layout = '//layouts/frontend/home'; $this->pageTitle = 'Trang Chủ'; $listAds = Advertisement::model()->listAdvertisement(); $featuredPosts = Post::model()->getListFeaturedPost('vi', 7, 1); $homeServicesPosts = Post::model()->getListPostWithCategoryID(8, 6, Yii::app()->language); // $listProducts = Yii::app()->extraFunctions->parseTree(Menu::model()->getListMenu(Yii::app()->language, 'main_menu', 1, '2', NULL, 3, 8)); // $listServices = Yii::app()->extraFunctions->parseTree(Menu::model()->getListMenu(Yii::app()->language, 'main_menu', 1, '2', NULL, 4, 5)); // $listPromotions = Yii::app()->extraFunctions->parseTree(Menu::model()->getListMenu(Yii::app()->language, 'main_menu', 1, '2', NULL, 6, 4)); // $listNews = Yii::app()->extraFunctions->parseTree(Menu::model()->getListMenu(Yii::app()->language, 'main_menu', 1, '2', NULL, 5, 2)); // $listSupports = Yii::app()->extraFunctions->parseTree(Menu::model()->getListMenu(Yii::app()->language, 'main_menu', 1, '2', NULL, 7, 7)); // $listIntros = Yii::app()->extraFunctions->parseTree(Menu::model()->getListMenu(Yii::app()->language, 'main_menu', 1, '2', NULL, 2, 3)); // foreach ($listNews as $index => $obj) { // $listNews[$index]['url'] = preg_match('/^[http|https]+\:\/\//', $listNews[$index]['url']) ? $listNews[$index]['url'] : Yii::app()->createUrl($listNews[$index]['url']); // } $this->render('index', array('listAds' => $listAds, 'featuredPosts' => $featuredPosts, 'homeServicesPosts' => $homeServicesPosts)); }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { $criteria = Advertisement::model()->setFetchCondition(5); $latestInfo = Yii::app()->cache->get($this->getUrlId() . '_latestInfo'); if ($latestInfo === false) { $latestInfo = Advertisement::model()->findAll($criteria); Yii::app()->cache->set($this->getUrlId() . '_latestInfo', $latestInfo, 3600, new CDbCacheDependency("SELECT MAX(id) FROM {{advertisement}}")); } $criteria->addColumnCondition(array('hasimg' => 1)); $criteria->limit = 4; $newInfo = Yii::app()->cache->get($this->getUrlId() . '_newInfo'); if ($newInfo === false) { $newInfo = Advertisement::model()->findAll($criteria); Yii::app()->cache->set($this->getUrlId() . '_newInfo', $newInfo, 3600, new CDbCacheDependency("SELECT MAX(id) FROM {{advertisement}}")); } // $newInfo = Advertisement::model()->findAll($criteria); // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' $this->render('index', array('latestInfo' => $latestInfo, 'newInfo' => $newInfo)); }
<span class="title"><a href="" class="bind_hover_card" bm_user_id="1"><?php echo $model->title; ?> </a></span> <br /> </h3> <span class="ico ico_footprint"></span> <span>有<?php echo count($model->statistics); ?> 人路过</span> <span class="ico ico_mark"></span> <span>特别提示:<span id="time"><?php echo Advertisement::model()->getAdvertisementExpired($model->end); ?> </span>过期</span> <?php if (Yii::app()->user->id == $model->uid) { ?> <span class="ico ico_pencil"></span> <span><a href="<?php echo $this->createUrl('/archiver/erelease', array('id' => $model->id, 't' => urlencode($model->title))); ?> ">编辑</a></span> <?php } ?> <br />
<script> $(document).ready(function () { totalUsers = "<?php echo User::model()->count(); ?> "; totalPosts = "<?php echo Post::model()->count(); ?> "; totalFeedbacks = "<?php echo Feedback::model()->count(); ?> "; totalAdvertisements = "<?php echo Advertisement::model()->count(); ?> "; countUp(totalUsers, '.count1'); countUp(totalPosts, '.count2'); countUp(totalFeedbacks, '.count3'); countUp(totalAdvertisements, '.count4'); }); function countUp(count, className) { var div_by = Math.round(count / 100), speed = Math.round(count / div_by), $display = $(className), run_count = 1, int_speed = 24;
<div style="width: 64px;height:64px;text-align:center;margin-top:15px;margin-right: 5px;" class="left "> <?php $advertisement = Advertisement::model()->getAdvertisementModel($_GET['id']); $uid = $advertisement->uid; $uid = isset($_GET['uid']) ? $_GET['uid'] : $uid; ?> <?php echo Profile::model()->getUserAvatar($uid, array('class' => 'roundSection', 'alt' => Profile::model()->getUserTrueName($uid)), 60); ?> </div> <?php $model = Profile::model()->getProfileModel($uid); ?> <ul class="list" style="margin-left:74px;isplay: block;"> <li>姓名:<?php echo $model->firstname . $model->lastname; ?> </li> <li>性别:<?php echo Profile::model()->getGender($model->gender); ?> </li> <li>年龄:<?php echo date('Y') - $model->birthyear . '岁'; ?> </li> <li>生日:<?php echo $model->birthmonth . '月' . $model->birthday . '日'; ?> </li> <li>星座:<?php
<?php $this->breadcrumbs = Advertisement::model()->generatePageTitle($_GET['id'], true); $this->pageTitle = Advertisement::model()->PageTitleArray2String($_GET['id']); ?> <div class="items"> <?php foreach ($model as $item) { ?> <?php $this->renderPartial('_boxview', array('data' => $item)); } ?> </div> <?php $this->widget('ext.isotope.IsotopeWidget', array('id' => '.items', 'layoutMode' => 'masonry')); $this->widget('ext.yiinfinite-scroll.YiinfiniteScroller', array('contentSelector' => '.items', 'itemSelector' => '.view', 'loadingImg' => '/public/images/loading.gif', 'loadingText' => '正在加载内容……', 'donetext' => '亲,没有了……', 'extraScrollPx' => 40, 'pages' => $pages, 'func' => 'function(newElements) { $(".items").isotope( "appended", $(newElements) ); }')); ?> <!-- 侧栏 --> <div id="sideBar"> <h5><a href="">筛选信息</a></h5> </div> <div id="bottomBar">底部选项</div>
<?php foreach ($model as $item) { ?> <li> <?php echo CHtml::link(CHtml::image(Advertisement::model()->getAdvertismentFolder($item->imginfo), $item->title), array('/info/view', 'id' => $item->id, 't' => urlencode($item->title))); ?> <div class="adTitle"><?php echo CHtml::link($item->title, array('/info/view', 'id' => $item->id, 't' => urlencode($item->title))); ?> </div> <div class="adSpansor"><a href="#"><?php echo CHtml::link(Profile::model()->getUserNickName($item->uid), array('/archiver/index', 'uid' => $item->uid)); ?> </a></div> <div class="adCreated"><?php echo date('Y-m-d', $item->create); ?> </div> </li> <?php }
/** * 以下为数据统计相关 */ public function getAdvertisementArchiver() { $cacheid = 'advertisementArchiver'; $temp = $result = array(); $result = Yii::app()->cache->get($cacheid); if ($result === false) { $criteria = new CDbCriteria(array('select' => 'pubdate', 'order' => 'pubdate DESC')); $model = Advertisement::model()->findAll($criteria); foreach ($model as $data) { $temp[] = $data->pubdate; } if (is_array($temp)) { foreach ($temp as $time) { $y = gmdate('Y', $time); $m = gmdate('n', $time); $result[$y][$m] += 1; } } Yii::app()->cache->set($cacheid, $result, 3600, new CDbCacheDependency('SELECT MAX(id) FROM {{advertisement}}')); } return $result; }
/** * Lists all models. */ public function actionIndex() { $model = Advertisement::model()->findAll(array('join' => '{{profile}}')); UtilHelper::dump($model); $dataProvider = new CActiveDataProvider('Job'); $this->render('index', array('dataProvider' => $dataProvider)); }
</a></div> <div class="adCreated"><?php echo date('Y-m-d', $item->pubdate); ?> </div> </li> <?php } ?> </ul> </article> <article id="adLatest"> <h3>最近广告 <?php $this->widget('ext.viewbutton.ViewButtonWidget', array('url' => 'info/infolist', 'navID' => 'ajaxnavadLatest', 'destinationID' => '#adLatestBox', 'pageCount' => Advertisement::model()->getAdvertisementSize(false))); ?> <span class="right more"><?php echo CHtml::link('更多', array('/info/infolist')); ?> </span> </h3> <ul id="adLatestBox"> <?php foreach ($latestInfo as $info) { ?> <li> <a href="<?php echo $this->createUrl('/info/view/', array('id' => $info->id, 't' => urlencode($info->title))); ?> " title="<?php