Beispiel #1
0
 public static function getAll($origin, $logid)
 {
     if (!$logid || !$origin) {
         return false;
     }
     $items = Buylink::model()->findAll(array('order' => 'id ASC', 'condition' => 'logid=:logid AND origin=:origin', 'params' => array(':logid' => $logid, ':origin' => $origin)));
     return $items;
 }
Beispiel #2
0
 public function actionView($id)
 {
     $id = zmf::filterInput($id);
     $info = $this->loadModel($id);
     if ($info['redirect'] > 0) {
         $this->redirect(array('position/view', 'id' => $info['redirect']));
     }
     $_title = '';
     if ($info['title_cn'] != '') {
         $_title = $info['title_cn'];
     }
     if ($info['title_en'] != '' && $_title != '') {
         $_title .= '(' . $info['title_en'] . ')';
     } elseif ($info['title_local'] && $_title != '') {
         $_title .= '(' . $info['title_local'] . ')';
     } elseif ($info['title_en'] != '') {
         $_title .= $info['title_en'];
     } else {
         $_title .= $info['title_local'];
     }
     $_address = '';
     if ($info['address_cn'] != '') {
         $_address = $info['address_cn'];
     } elseif ($info['address_en'] != '') {
         $_address = $info['address_en'];
     } else {
         $_address = $info['address_local'];
     }
     if (!Yii::app()->user->isGuest) {
         if (Favorites::checkFavored($id, 'poi')) {
             $this->favorited = true;
         }
         $tipinfo = PoiPost::model()->findByAttributes(array('logid' => $id, 'uid' => Yii::app()->user->id), 'status=' . Posts::STATUS_PASSED);
         if ($tipinfo) {
             $this->tiped = $tipinfo;
         }
     }
     $info->faceimg = Attachments::faceImg($info, 600);
     //获取图片
     $images = Attachments::model()->findAll(array('condition' => "logid=:id AND " . ($info['faceimg'] > 0 ? "id!=" . $info['faceimg'] . ' AND ' : '') . " classify='poi' AND status=" . Posts::STATUS_PASSED, 'select' => 'id,filePath,classify,cTime', 'limit' => 6, 'order' => 'favor DESC', 'params' => array(':id' => $id)));
     $breads = array();
     $breads[] = CHtml::link('目的地', array('position/index'));
     if ($info['areaid']) {
         $areaInfo = Area::model()->findByPk($info['areaid']);
         if ($areaInfo) {
             $breads[] = CHtml::link($areaInfo['title'], array('position/index', 'areaid' => $areaInfo['id']));
         }
     }
     //获取购买地址
     $buylinks = array();
     if ($info['classify'] == Position::HOTEL) {
         $buylinks = Buylink::getAll('poi', $info->id);
     }
     //更新访问统计
     Posts::updateCount($id, 'Position');
     $breads[] = $_title;
     $this->pageTitle = $_title . ' - ' . zmf::config('sitename');
     $this->pageDescription = '【' . $_title . '】位于' . $_address . ',' . zmf::subStr($info['content'], 200);
     $this->render('view', array('info' => $info, 'type' => $type, 'breads' => $breads, 'buylinks' => $buylinks, 'images' => $images));
 }