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; }
public function actionAjaxGetChannels() { $pointId = Yii::app()->request->getPost('pointId'); $pointDateStr = date('Y-m-d'); $requestTime = date('H:i:s'); $pointDatetimeStr = $pointDateStr . " 23:59:59"; $pointDateTimestamp = strtotime($pointDateStr); $weekDay = strtolower(date('D', $pointDateTimestamp)); $Playlist = new Playlists(); $pointChannels = Channel::model()->findAll('id_point=:id_point AND window_id IS NOT NULL', array(':id_point' => $pointId)); $resp = array(); foreach ($pointChannels as $pointChannel) { $pointChannelId = $pointChannel->internalId; $windowId = $pointChannel->window_id; if (!is_null($windowId)) { $bg = $Playlist->GetBGContentArr($pointId, $pointChannelId, $pointDatetimeStr, $weekDay); $adv = $Playlist->GetAdvContentArr($pointId, $pointChannelId, $pointDatetimeStr, $weekDay); $blockStructedContent = $Playlist->BuildBlockStructedContent($bg, $adv); $straightTimeContent = $Playlist->ConverBlockStructedToStraightTimeContent($blockStructedContent); $straightTimeContentHisToSecs = $this->ConvertHisToSecsInStraightTime($straightTimeContent, $requestTime); $url = Yii::app()->request->getBaseUrl(true) . '/spool/points/' . $pointId . '/' . $pointChannelId; $straightTimeContentWithURLPath = $this->UpdateContentPathes($straightTimeContentHisToSecs, $url); $window = Window::model()->findByPK($windowId); $widgetToChannel = WidgetToChannel::model()->find("channel_id = :channel_id", array("channel_id" => $pointChannel->id)); $widget = ''; if (count($widgetToChannel) > 0) { $widgetModel = Widget::model()->findByPk($widgetToChannel['widget_id']); $widget = $widgetModel['content']; } $resp[] = array('width' => $window->width, 'height' => $window->height, 'top' => $window->top, 'left' => $window->left, 'content' => $straightTimeContentWithURLPath, 'widget' => $widget); } } echo json_encode($resp); exit; }
public function actionSearch() { $channel = Channel::model(); $channelList = $channel->getAllData(); foreach ($channelList as $val) { $result[] = $val['name']; } echo json_encode($result); }
private function getChannelOptions() { $options = array(); $criteria = new CDbCriteria(); $criteria->order = 'ctime desc'; foreach (Channel::model()->findAll($criteria) as $channel) { $options[$channel->id] = $channel->name; } return $options; }
/** * * 返回组成表单所需要的字段 * */ public function getFormAttributes() { $attrs = array(); foreach (Channel::model()->attributeLabels() as $field => $label) { if (!in_array($field, array('id', 'mtime', 'ctime', 'status'))) { $attrs[$field] = array('type' => 'input'); } } unset($attrs['adv_number']); return $attrs; }
public function categoryItem($model) { $id = $model->id; echo "<div class=\"" . $category->item . "\">"; echo "<h4>" . $model->name . "</h4>"; $item = Channel::model()->getChildrenArray($id); $item = Channel::model()->getChannelList($item, $id); foreach ($item as $child) { $id = $child['id']; $nodeType = Channel::model()->nodeType($id); self::categoryItemChildren($child, $nodeType); } }
private function getChannelId($name) { $name = trim($name); static $cache = array(); if (!isset($cache[$name])) { $channel = Channel::model()->findByAttributes(array('name' => $name)); if ($channel == null) { $channel = new Channel(); $channel->name = $name; $channel->save(); } $cache[$name] = $channel->id; } return $cache[$name]; }
public function actionMerge() { $ids = array('100040', '100039', '100022', '100046'); $adv_data = AdvData::model(); $advertice_channel = AdvertiseChannel::model(); $channel = Channel::model(); foreach ($ids as $channel_id) { if ($channel_id != 100046) { $adv_data->updateRelatedChannelId(array('channel_id' => 100043), $channel_id); $advertice_channel->updateRelatedChannelId(array('channel_id' => 100043), $channel_id); } else { $adv_data->updateRelatedChannelId(array('channel_id' => 100123), $channel_id); $advertice_channel->updateRelatedChannelId(array('channel_id' => 100123), $channel_id); } $channel->deleteOneRow($channel_id); } }
echo Yii::app()->theme->baseUrl; ?> /css/index.css"/> <?php $this->renderPartial('//common/banner'); ?> <div class="site-focus" pbid="众筹制造"> <div class="wrap"> <div class="mod-title clearfix"> <h2>众筹项目</h2> <div class="title-sub"> <?php #获得项目下的分类项目 $project = Channel::model()->find("cl_en_name=:cl_en_name", array(":cl_en_name" => 'project')); if ($project) { $projectlist = Channel::model()->findAll("cl_class=:cl_class AND cl_status=1 order by cl_left asc ", array(":cl_class" => $project->id)); if ($projectlist) { foreach ($projectlist as $key => $value) { echo '<a href="' . Yii::app()->createUrl('/project/' . $value->id) . '" title="' . QCHtml::encode($value->cl_name) . '">' . QCHtml::encode($value->cl_name) . '</a>'; } } } ?> <a href="http://www.10000rmb.com" alt="中国网赚平台" title="中国网赚平台" pbtag="hangye,hangye_zuzhou">中国网赚平台</a> </div> </div> <div class="focus-box" style="overflow:hidden;"> <ul id="JS-recommend_ul" class="focus-con clearfix" style="width:980px;"> <!--Deal Card Module--> <li> <div class="list-item">
<span class="sr-only">切换导航</span> <span class="icon-bar qys_icon_bar"></span> <span class="icon-bar qys_icon_bar"></span> <span class="icon-bar qys_icon_bar"></span> </a> </div> <div class="collapse navbar-collapse" id="top-navbar-collapse"> <ul class="nav navbar-nav"> <?php #获得主菜单 $main_menu = Menu::model()->find("menu_ename='main_menu'"); $main_menu_id = 1; if ($main_menu) { $main_menu_id = $main_menu->menu_id; } $mainmenulist = Channel::model()->findAll("cl_menu_id=:menu_id AND cl_status=1 order by cl_left asc", array(":menu_id" => $main_menu_id)); if ($mainmenulist) { foreach ($mainmenulist as $key => $value) { ?> <li <?php if ($key == 0) { echo 'class="active"'; } ?> > <?php if ($value->cl_exturl) { ?> <a target="_blank" href="<?php echo $value->cl_exturl;
public function getTableName() { $filters = $this->getFilterCondition(); $conditions = array(); if (isset($filters['cp_id'])) { $model = CP::model()->findByPk($filters['cp_id']); if ($model) { $conditions[] = "CP:{$model->name}"; } } if (isset($filters['adv_id'])) { $model = Advertise::model()->findByPk($filters['adv_id']); if ($model) { $conditions[] = "业务:{$model->name}"; } } if (isset($filters['channel_id'])) { $model = Channel::model()->findByPk($filters['channel_id']); if ($model) { $conditions[] = "渠道:{$model->name}"; } } /*2014-11-17包名*/ if (isset($filters['adv_channel_id'])) { $model = AdvertiseChannel::model()->findByPk($filters['adv_channel_id']); if ($model) { $conditions[] = "包名:{$model->tag}"; } } /*end*/ if (isset($filters['begin_date']) && isset($filters['end_date'])) { $conditions[] = "从{$filters['begin_date']}到{$filters['end_date']}"; } if (isset($filters['date'])) { $conditions[] = "日期:{$filters['date']}"; } if (count($conditions)) { return $this->getTableBaseName() . '-(' . join('-', $conditions) . ')'; } else { return $this->getTableBaseName() . '-全部'; } }
public function AddChannelToPoint($pointId) { $_pointId = $pointId; $model = new Channel(); $res = Channel::model()->findAll('id_point=:id_point ORDER BY internalId ASC', array(':id_point' => $_pointId)); $internalId = 1; if (count($res) > 0) { $internalId = $res[count($res) - 1]['internalId'] + 1; } $model->attributes = array('id_point' => $_pointId, 'internalId' => $internalId); if ($model->validate() && $model->save()) { $id = $model->getPrimaryKey(); return array("status" => true, "id" => $id, "internalId" => $internalId); } else { return array("status" => false, "error" => json_encode($model->getErrors())); } }
</div> <div class="content"> <div class="panel"> <div class="tab_box"> <?php Channel::model()->showCategories(1, false, true, 'channelItem'); ?> </div> <div class="tab_box"> <?php Channel::model()->showCategories(2, false, true, 'channelItem'); ?> </div> <div class="tab_box"> <?php Channel::model()->showCategories(3, false, true, 'channelItem'); ?> </div> <div class="tab_box"> <?php Channel::model()->showCategories(4, false, true, 'channelItem'); ?> </div> </div> </div> </div>
/** * @todo 根据广告ID生成页面标题 * @param unknown_type $id */ public function generatePageTitle($id, $isListPage = false) { $result = array(); //列表页面 if ($isListPage) { $channel = Channel::model()->findParent($id); foreach ($channel as $item) { $result[$item['name']] = array('/info/list', 'id' => $item['id'], 't' => urlencode($item['name'])); } $result = array_reverse($result); } else { $model = self::getAdvertisementModel($id); $channel = Channel::model()->findParent($model->cid); foreach ($channel as $item) { $result[$item['name']] = array('/info/list', 'id' => $item['id'], 't' => urlencode($item['name'])); } $result = array_reverse($result); $result[$model->title] = array('/info/view', 'id' => $model->id, 't' => urlencode($model->title)); } // $ad = array( // 'id'=>$model->id, // 'pid'=>$model->cid, // 'name'=>$model->title // ); // // array_unshift($result, $ad); return $result; }
public static function getChannel($id, $returnType = 'array', $data = null) { $types = empty($data) ? self::getChannels() : $data; return BCacheHelper::find($id, $types, $returnType, Channel::model()); }
echo Yii::app()->createUrl('/channel/index', array('id' => Channel::CHANNEL_MARKET)); ?> " data-id="<?php echo UtilHelper::words2PinYin(Channel::model()->getChannel(Channel::CHANNEL_MARKET)); ?> " class="adRoundSection active">交易</a> <a href="<?php echo Yii::app()->createUrl('/channel/index', array('id' => Channel::CHANNEL_FREIND)); ?> " data-id="<?php echo UtilHelper::words2PinYin(Channel::model()->getChannel(Channel::CHANNEL_FREIND)); ?> " class="adRoundSection">交友</a> <a href="<?php echo Yii::app()->createUrl('/channel/index', array('id' => Channel::CHANNEL_JOB)); ?> " data-id="<?php echo UtilHelper::words2PinYin(Channel::model()->getChannel(Channel::CHANNEL_JOB)); ?> " class="adRoundSection">招聘</a> <a href="<?php echo Yii::app()->createUrl('/channel/index', array('id' => Channel::CHANNEL_SERVICE)); ?> " data-id="<?php echo UtilHelper::words2PinYin(Channel::model()->getChannel(Channel::CHANNEL_SERVICE)); ?> " class="adRoundSection">服务</a> 显示方式: <a href="" class="adRoundSection">图标显示</a> <a href="" class="adRoundSection">文字显示</a> </section>
/** * 显示分类 * @param unknown_type $model */ public function categoryItem($model, $limit = 5, $showPop = false, $className = "category-item", &$result = '') { $id = $model->id; $result .= "<div class=\"{$className}\">"; $result .= "<h4>" . $model->name . "</h4>"; if ($showPop) { $result .= "<span class=\"{$className}-pop\">{$model->description}</span>"; } $item = Channel::model()->getChildrenArray($id); $item = Channel::model()->getChannelList($item, $id); foreach ($item as $child) { if ($limit) { if ($child['deep'] == 2 && $child['no'] < $limit || $child['deep'] == 1) { $id = $child['id']; $nodeType = Channel::model()->nodeType($id); $result .= self::categoryItemChildren($child, $nodeType); } } else { $id = $child['id']; $nodeType = Channel::model()->nodeType($id); $result .= self::categoryItemChildren($child, $nodeType); } } $result .= "</ul>"; $result .= "</div>"; return $result; }
echo $form->labelEx($model, 'type'); ?> <?php echo $form->dropDownList($model, 'type', Channel::model()->generateChannelList(), array('class' => 'span-3 poshy', 'title' => '选择频道分类')); ?> <?php echo $form->error($model, 'type'); ?> </div> <div class="row span-5"> <?php echo $form->labelEx($model, 'pid'); ?> <?php echo $form->dropDownList($model, 'pid', Channel::model()->generateChannelList(), array('class' => 'span-4 poshy', 'title' => '选择频道分类')); ?> <?php echo $form->error($model, 'pid'); ?> </div> <div class="row span-2"> <?php echo $form->labelEx($model, 'weight'); ?> <?php echo $form->dropDownList($model, 'weight', array_combine(range(1, 10), range(1, 10)), array('class' => 'span-2 poshy', 'title' => '填写频道权重', 'value' => 500)); ?> <?php echo $form->error($model, 'weight');
public function actionAddInfo() { $userSql = $this->randomSql('{{user}}', 1); $user = User::model()->findBySql($userSql); $cateSql = $this->randomSql('{{channel}}', 1); $category = Channel::model()->findBySql($cateSql); UtilHelper::dump($category->attributes); }
public function CreateChannelsForWindows($screenId, $pointId) { $Screen = Screen::model()->findByPk($screenId); $windows = $Screen->windows; Channel::model()->deleteAll("id_point = :id_point AND window_id IS NOT NULL", array('id_point' => $pointId)); $ii = 0; foreach ($windows as $window) { $ii++; $channel = new Channel(); $channel->attributes = array('id_point' => $pointId, 'window_id' => $window->id, 'internalId' => $ii); $channel->save(); } }
<?php foreach ($model as $info) { ?> <li> <a href="<?php echo $this->createUrl('/info/view/', array('id' => $info->id, 't' => urlencode($info->title))); ?> " title="<?php echo $info->title; ?> " class="span-4 adLatestTitle">[<?php echo UtilHelper::strSlice(Channel::model()->getChannelName($info->cid), 0, 4); ?> ]<?php echo UtilHelper::strSlice($info->title, 0, 4); ?> </a> <span class="span-8 adLatestDes"> <?php echo UtilHelper::strSlice(str_replace(' ', '', strip_tags($info->content)), 0, 20); ?> </span> <span class="span-2 adLatestDate"><?php echo date('Y-m-d', $info->update); ?> </span> </li> <?php }
<div class="view"> <div class="span-2"> <?php $username = Profile::model()->getUserAvatar($data->uid, array('class' => 'span-2 first adRoundSection bind_hover_card', 'bm_user_id' => $data->uid), 60); echo CHtml::link($username, array('archiver/index', 'uid' => $data->uid, 'name' => $data->user->username), array('rel' => "external")); ?> </div> <div class="span-5"> <?php echo CHtml::link(Profile::model()->getUserNickName($_GET['uid']), array('achiver/index', 'name' => $data->user->username, 'uid' => $data->uid)); ?> <span class="lightview">[<?php echo Channel::model()->getChannelName($data->cid); ?> ]</span> <?php echo CHtml::link(CHtml::encode($data->title), array('/info/view', 'uid' => $data->uid, 'id' => $data->id, 't' => urlencode($data->title)), array('target' => '_blank')); ?> <br /> <?php echo UtilHelper::timeFormat(intval($data->moddate)); ?> <br /> <br /> <?php echo UtilHelper::pureStrSlice($data->content, 0, 150); ?> <br /> <hr class="span-5 space" />
/** * 根据分类ID显示当前分类及子分类的所有相关信息 */ public function actionList($id) { $this->layout = '//layouts/infolist'; $page = isset($_GET['page']) ? $_GET['page'] : 0; $ids = Channel::model()->getChildrenIds($id); $criteria = Advertisement::model()->setFetchCondition(); $criteria->addInCondition('cid', $ids); $total = Advertisement::model()->count($criteria); $pages = new CPagination($total); $pages->pageSize = 10; $pages->applyLimit($criteria); $model = Yii::app()->cache->get($this->getUrlId() . '_' . $id . '_' . $page); if ($model === false) { $model = Advertisement::model()->findAll($criteria); Yii::app()->cache->set($this->getUrlId() . '_' . $id . '_' . $page, $model, 3600, new CDbCacheDependency('SELECT MAX(id) FROM {{advertisement}}')); } $this->render('list', array('model' => $model, 'pages' => $pages)); }
<?php $pinyin = new PinYin(); ?> <?php foreach ($model as $item) { ?> <li data-id="<?php echo $pinyin->words2PinYin($item->name); ?> " style="width:<?php echo rand(100, 200); ?> ;"> <?php echo CHtml::image(Channel::model()->getChannelIco($item->id), $item->name); ?> <?php echo $item->name; ?> </li> <?php } ?> <?php $this->widget('ext.yiinfinite-scroll.YiinfiniteScroller', array('contentSelector' => '#channelBox', 'itemSelector' => 'li', 'loadingText' => '<hr /><img src="/public/images/loading.gif" />', 'donetext' => '<hr />This is the end... my only friend, the end', 'pages' => $pages));
<?php $this->renderPartial('//common/html5_top_secondnav'); ?> <div class="warp qys_color_F8F8F8"> <div class="container"> <div class="row"> <div class="col-sm-12 col-sm-12 col-md-12"> <?php $lanmustring = "浏览全部"; if (isset($_REQUEST['list_id'])) { $typeone = Channel::model()->findByPk($_REQUEST['list_id']); if ($typeone) { $lanmustring = $typeone->cl_name; } } ?> <h3><strong><?php echo $lanmustring; ?> </strong></h3> <div class="row"> <?php //#获得最新的4个项目 if (isset($_REQUEST['list_id'])) { if ($typeone) { switch ($typeone->cl_en_name) { case 'help': $list_type_id = 1; break; case 'personart':
<hr class="space" /> <div class="row"> <span class="left rowPadding" >广告标签:</span> <?php echo $form->textField($model, 'tag', array('title' => '广告标签', 'class' => 'left poshy span-8')); ?> <span class="left rowPadding"><a href="javascript:void();" onclick="getTags();">获取标签</a></span> <?php echo $form->error($model, 'tag'); ?> </div> <hr class="space" /> <div class="row"> <span class="left">选择分类:</span><a href="javascript:void();" onclick="showChannels();">选择</a> <span id="categoryVal"><?php echo Channel::model()->parentString($model->cid); ?> </span> </div> <div class="row"> <?php echo $form->hiddenField($model, 'cid', array('title' => '广告分类')); ?> <?php echo $form->error($model, 'cid'); ?> </div>
public function actionJump($channel_id) { if (!Yii::app()->user->isAdmin()) { throw new CHttpException(403, '无权访问'); } if ($channel_id) { $channel = Channel::model()->findByPk($channel_id); if (!$channel) { throw new CHttpException(404, '没有这个渠道'); } } Yii::app()->user->setChannelId($channel_id); $this->redirect('/'); }
/** * 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 = Channel::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }