コード例 #1
0
ファイル: HomeController.php プロジェクト: phiphi1992/fpthue
 public function actionIndex()
 {
     $this->pageTitle = $this->dataSystem->title;
     // Dang ky Internet
     $criInternet = new CDBCriteria();
     $criInternet->addCondition("category_news_id = 1");
     $criInternet->order = "id DESC";
     $criInternet->limit = 3;
     $arrInternet = News::model()->findAll($criInternet);
     //Dang ky cap quang
     $criOptical = new CDBCriteria();
     $criOptical->addCondition("category_news_id = 2");
     $criOptical->order = "id DESC";
     $criOptical->limit = 3;
     $arrOptical = News::model()->findAll($criOptical);
     //Store
     $criStore = new CDBCriteria();
     $criStore->addCondition("category_news_id = 6");
     $criStore->order = "id DESC";
     $criStore->limit = 3;
     $arrStore = News::model()->findAll($criStore);
     //CA
     $criCa = new CDBCriteria();
     $criCa->addCondition("category_news_id = 3");
     $criCa->order = "id DESC";
     $criCa->limit = 3;
     $arrCa = News::model()->findAll($criCa);
     //Sim - Card
     $criSimCard = new CDBCriteria();
     $criSimCard->addCondition("category_news_id = 4");
     $criSimCard->order = "id DESC";
     $criSimCard->limit = 3;
     $arrSimCard = News::model()->findAll($criSimCard);
     //TV
     $criTv = new CDBCriteria();
     $criTv->addCondition("category_news_id = 7");
     $criTv->order = "id DESC";
     $criTv->limit = 3;
     $arrTv = News::model()->findAll($criTv);
     /*Pictures*/
     $criPic = new CDbCriteria();
     $criPic->addCondition("album_id = 2");
     $criPic->order = "id DESC";
     $criPic->limit = 10;
     $arrPic = Images::model()->findAll($criPic);
     /*Slider*/
     $criBanner = new CDbCriteria();
     $criBanner->order = "id DESC";
     $criBanner->limit = 5;
     $arrBanner = Slides::model()->findAll($criBanner);
     /*Links web*/
     $arrLink = Links::model()->find();
     $this->render("index", array('arrBanner' => $arrBanner, 'arrInternet' => $arrInternet, 'arrOptical' => $arrOptical, 'arrStore' => $arrStore, 'arrCa' => $arrCa, 'arrSimCard' => $arrSimCard, 'arrTv' => $arrTv, 'arrLink' => $arrLink));
 }
コード例 #2
0
ファイル: LinksController.php プロジェクト: phiphi1992/fpthue
 public function actionIndex()
 {
     $model = Links::model()->find();
     if (!empty($_POST['Links'])) {
         $model->attributes = $_POST['Links'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhật thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/links'));
         }
     }
     $this->render('index', array('model' => $model));
 }
コード例 #3
0
ファイル: Links.php プロジェクト: elikristina/portalcegov
 public static function toArray()
 {
     $arr = array();
     //Coloca os nomes
     $links = Links::model()->findAll();
     foreach ($links as $link) {
         $arr[] = $link->nome;
         foreach (explode(', ', $link->tags) as $tag) {
             if (!in_array($tag, $arr)) {
                 $arr[] = $tag;
             }
         }
     }
     //Coloca as tags
     return $arr;
 }
コード例 #4
0
 /**
  * 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 $id the ID of the model to be loaded
  * @return Links the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Links::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #5
0
ファイル: LinksController.php プロジェクト: lp19851119/114la
 private function doTb($tid, $cid = 0)
 {
     if ($tid == 2610) {
         //彩票部分
         $cacheId = 'doTb_' . $tid;
         $fcurl = cacheGet($cacheId);
         if (empty($fcurl)) {
             $url = 'http://www.114la.com/icai.json';
             $fcurl = XUtils::fcurl($url);
             cacheSet($cacheId, $fcurl, 3600);
         }
         $fcurl = substr($fcurl, 17, -1);
         $data_arr = json_decode($fcurl, TRUE);
         if (!empty($data_arr)) {
             //对应关系
             $dy = array('ssq' => array(220, 221, 222), 'dlt' => array(223, 224, 225), 'fc3d' => array(226, 227, 228), 'jx_11x5' => array(229, 230, 231));
             foreach ($data_arr as $tp => $v) {
                 $va = $v[0];
                 $fdata[$dy[$tp][0]] = array(0 => array('title' => '上期开奖号码', 'link' => $va['url'][0], 'opt_a' => implode(',', $va['result']), 'opt_b' => $va['phase'], 'opt_c' => $va['date']));
                 $fdata[$dy[$tp][1]] = array(0 => array('title' => '立即投注', 'link' => $va['url'][1]), 1 => array('title' => $va['chain'][0], 'link' => $va['chain'][1]));
                 foreach ($va['link'] as $vl => $tu) {
                     $tu['link'] = $tu['url'];
                     unset($tu['url']);
                     $va['link'][$vl] = $tu;
                 }
                 $fdata[$dy[$tp][2]] = $va['link'];
             }
         }
         if (!empty($fdata)) {
             foreach ($fdata as $cid => $cinfo) {
                 Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid));
                 foreach ($cinfo as $info) {
                     try {
                         $model = new Links();
                         $info['catalog_id'] = $cid;
                         $info['title'] = empty($info['title']) ? '待定' : $info['title'];
                         $info['link'] = empty($info['link']) || $info['link'] == '#' ? 'http://www.114la.com/' : $info['link'];
                         $info['mix'] = empty($info['mix']) ? null : base64_decode($info['mix']);
                         $info = array_filter($info);
                         $model->attributes = $this->_form($info);
                         //                        ppr($model->attributes);
                         $model->save();
                     } catch (Exception $exc) {
                         return 'error1caipiao';
                     }
                 }
             }
         }
         return 'ok';
         //            ppr($fdata,1);
     } elseif ($tid == 1114) {
         //实时热点部分
         $cacheId = 'doTb_' . $tid;
         $fcurl = cacheGet($cacheId);
         if (empty($fcurl)) {
             $url = 'http://api4.114la.com/1114_2.json';
             $fcurl = XUtils::fcurl($url);
             cacheSet($cacheId, $fcurl, 3600);
         }
         $fcurl = substr($fcurl, 20, -1);
         //            ppr($fcurl,1);
         if (!empty($fcurl) && ($fcurl = json_decode($fcurl, 1))) {
             //先将对应的旧数据处理
             $old = reqPost('old');
             if (empty($old)) {
                 Links::model()->updateAll(array('status_is' => 'N'), "`catalog_id`='{$cid}'");
             } else {
                 Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid));
             }
             //                ppr(Links::model()->findAll("`catalog_id`='$cid'"));
             foreach ($fcurl as $info) {
                 try {
                     $model = new Links();
                     $info['catalog_id'] = $cid;
                     $info['title'] = empty($info['title']) ? '待定' : $info['title'];
                     $info['link'] = empty($info['url']) || $info['url'] == '#' ? 'http://www.114la.com/' : $info['url'];
                     unset($info['url']);
                     $info = array_filter($info);
                     $model->attributes = $this->_form($info);
                     //                        ppr($model->attributes);
                     $model->save();
                 } catch (Exception $exc) {
                     return 'error1';
                 }
             }
             $cacheId = '_catalogAllNum';
             $catalogAllNum = XXcache::refresh($cacheId);
             return empty($catalogAllNum[$cid]) ? 0 : $catalogAllNum[$cid] . ' ok';
         } else {
             return 'error2';
         }
         ppr($data_arr, 1);
     } elseif ($tid > 1000 && $tid < 10000) {
         $tid = (int) $tid;
         $data = $re = 0;
         $cacheId = 'doTb_' . $tid;
         $fcurl = cacheGet($cacheId);
         if (empty($fcurl)) {
             $url = 'http://www.114la.com/api/ky.php?id=' . $tid . '&' . time();
             //                $url = 'http://www.114la.com/api/ky.php?id='.$tid;
             $fcurl = XUtils::fcurl($url);
             cacheSet($cacheId, $fcurl, 3600);
         }
         if (!empty($fcurl) && ($fcurl = json_decode($fcurl, 1))) {
             //先将对应的旧数据处理
             $old = reqPost('old');
             if (empty($old)) {
                 Links::model()->updateAll(array('status_is' => 'N'), "`catalog_id`='{$cid}'");
             } else {
                 Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid));
             }
             //                ppr(Links::model()->findAll("`catalog_id`='$cid'"));
             foreach ($fcurl as $info) {
                 try {
                     $model = new Links();
                     $info['catalog_id'] = $cid;
                     $info['title'] = empty($info['title']) ? '待定' : $info['title'];
                     $info['link'] = empty($info['link']) || $info['link'] == '#' ? 'http://www.114la.com/' : $info['link'];
                     $info['mix'] = empty($info['mix']) ? null : base64_decode($info['mix']);
                     $info = array_filter($info);
                     $model->attributes = $this->_form($info);
                     //                        ppr($model->attributes);
                     $model->save();
                 } catch (Exception $exc) {
                     return 'error1';
                 }
             }
             $cacheId = '_catalogAllNum';
             $catalogAllNum = XXcache::refresh($cacheId);
             return empty($catalogAllNum[$cid]) ? 0 : $catalogAllNum[$cid] . ' ok';
         } else {
             return 'error2';
         }
     } else {
         return 'error3';
     }
 }
コード例 #6
0
ファイル: HtmlController.php プロジェクト: lp19851119/114la
 /**
  * 
  * @param type $cid
  */
 private function _getDataCid($cid, $count)
 {
     $theTime = $this->_thetime;
     $re = null;
     empty($count) && ($count = 1000);
     // 状态可用 在期限内
     $params = array(':cid' => $cid);
     $sql = "\n            SELECT *\n            FROM {{links}}\n            WHERE `status_is`='Y'\n            AND `catalog_id` = :cid\n            AND (`begin_time`='0' OR `begin_time` IS NULL OR `begin_time` < '{$theTime}')\n            AND (`end_time`='0' OR `end_time` IS NULL OR  `end_time` > '{$theTime}')\n            ORDER BY sort_order ASC\n            LIMIT {$count}\n        ";
     $data = Links::model()->findAllBySql($sql, $params);
     if (!empty($data)) {
         foreach ($data as $key => $value) {
             if (empty($value->id)) {
                 continue;
             }
             $re[$key]['title'] = $value->title;
             $re[$key]['title_color'] = $value->title_color;
             $re[$key]['id'] = $value->id;
             $re[$key]['link'] = empty($value->link) ? null : $value->link;
             $re[$key]['image_link'] = empty($value->image_link) ? null : $value->image_link;
             $re[$key]['opt_a'] = empty($value->opt_a) ? null : $value->opt_a;
             $re[$key]['opt_b'] = empty($value->opt_b) ? null : $value->opt_b;
             $re[$key]['opt_c'] = empty($value->opt_c) ? null : $value->opt_c;
             $re[$key]['mix'] = empty($value->mix) ? null : $value->mix;
         }
     }
     //        ppr($re);
     return $re;
 }
コード例 #7
0
ファイル: _form.php プロジェクト: fipumjdeveloper/web
echo $form->textArea($model, 'link_to', array('rows' => 6, 'cols' => 50));
?>
		<?php 
echo $form->error($model, 'link_to');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'idLinks.name');
?>
		<?php 
//echo $form->textField($model,'id_links');
?>
		<?php 
echo $form->dropDownList($model, 'id_links', CHtml::listData(Links::model()->findAll(), 'id_links', 'name'), array('disabled' => $model->id_links != '' ? 'disabled' : ''));
?>
		<?php 
echo $form->error($model, 'id_links');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'idLanguage.name');
?>
		<?php 
//echo $form->textField($model,'id_language');
?>
		<?php 
echo $form->dropDownList($model, 'id_language', CHtml::listData(Language::model()->findAll(), 'id_language', 'name'));
コード例 #8
0
 public function actionDelete()
 {
     parent::_acl();
     $catalogId = reqGet('catalogId', null);
     //        ppr($_REQUEST,1);
     if (!empty($catalogId)) {
         $catalogId = intval($catalogId);
         $model = Catalog::model()->findByPk($catalogId);
         $name = $model->catalog_name;
         $model->delete();
         XXcache::refresh('_catalog');
         XXcache::refresh('_catalogAll');
         $model = Links::model()->deleteAll('catalog_id=:cid', array(':cid' => $catalogId));
         parent::_backendLogger(array('catalog' => 'delete', 'intro' => '删除分类 ' . $name . '(' . $catalogId . ') 及该分类所有链接'));
         XUtils::message('success', '已删除分类 ' . $name . ' 及该分类所有链接');
     }
     $this->redirect(Yii::app()->request->urlReferrer);
 }
コード例 #9
0
 public function actionDelete_link()
 {
     if (!empty($_GET['link_id'])) {
         Links::model()->deleteByPk($_GET['link_id']);
     }
 }
コード例 #10
0
ファイル: XXcache.php プロジェクト: lp19851119/114la
 protected static function _getCatalogAllNum()
 {
     $re = null;
     $data = Links::model()->findAllBySql("\n            SELECT t.catalog_id,COUNT(*) mix \n            FROM {{links}} t\n            WHERE t.status_is = 'Y' \n            AND (t.begin_time=0 OR begin_time<:thetime)\n            AND (t.end_time=0 OR end_time>:thetime)\n            GROUP BY t.catalog_id", array(':thetime' => time()));
     if (!empty($data)) {
         foreach ($data as $value) {
             $re[$value->catalog_id] = $value->mix;
         }
     }
     unset($data);
     return $re;
 }