1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027 |
- <?php
- /**
- * MainController
- * Feel free to delete the methods and replace them with your own code.
- *
- * @author darkredz
- */
- class MainController extends DooController{
- private $column;
- private $comart;
- function __construct() {
- include './protected/config/index.conf.php';
- $this->column=$column;
- Doo::loadModel('Article');
- $article=new Article();
- $cid=$this->column['COMPANY'];
- $this->comart=$article->getArticleByCid($cid,4);
- }
- function index() {
- Doo::loadModel('Column');
- Doo::loadModel('Product');
- $article=new Article();
- $product=new Product();
- $column=new Column();
- $cid=$this->column['SOFTAPP'].",".$this->column['WEBAPP'];
- $data['WEBAPP']=$this->column['WEBAPP'];
- $col=$column->getColumnByIdList($cid);
- //foreach ($col as $key=>$value){
- $pro=$product->getProductByCid($col[0]['cid']);
- $col[0]['product']=$pro;
- //}
- $cid=$this->column['TRAINC'];
- $train=$article->getArticleByTrain(2);
- $end=$doing=$apply=array();
- foreach ($train as $key=>$value){
- $type=getTrainTimeByStatus($value['enroll_time']);
- $date=explode(":", $value['enroll_time']);
- if($type=="end"){
- $train[$key]['timeStuts']="<p class='tData'>结束 ".$date[1]."</p>";
- array_push($end, $train[$key]);
- }elseif ($type=="doing"){
- $train[$key]['timeStuts']="<span class='tIcon'>进行中</span>";
- array_push($doing, $train[$key]);
- }elseif ($type=="apply"){
- $time = strtotime($date[0]) - 60*60*24;
- $train[$key]['timeStuts']="<span class='tIcon'>报名中</span><p class='tData'>截止".date('Y-m-d',$time)."</p>";
- array_push($apply, $train[$key]);
- }
- }
- $ta=$apply+$doing+$end;
- //print_r($ta);die;
- //$type=="apply";
- //$article->find ( array ('desc' => 'time', 'limit'=>4 , 'where' => 'cid=4 and ', 'asArray' => TRUE ) );
- //$art=$article->getArticleByCid($cid,4);
- $art=array_slice($ta,0,4);
- foreach ($art as $key=>$value){
- $art[$key]['timeStuts']=getTrainTime2($value['enroll_time']);
- $art[$key]['timeStuts3']=getTrainTime3($value['enroll_time']);
- $art[$key]['Stuts']=strlen($art[$key]['timeStuts']);
- }
- $list1=$article->getArticleByCid2($this->column['COMPANY'],5);
- foreach ($list1 as $key=>$value){
- $list1[$key]['title']=$this->cut_str($value['title'], 45);
- }
- $list2=$article->getArticleByCid($this->column['INDUSTRY'],5);
- foreach ($list2 as $key=>$value){
- $list2[$key]['title']=$this->cut_str($value['title'], 45);
- }
- Doo::loadModel('Product');
- $product=new Product();
- $data['product']=$product->getProductByCidAll($this->column['SOFTAPP']);
- $data['article']=$art;
- $data['comart']=$this->comart;
- $data['column']=$col;
- $data['map']='index';
- $data['companyNews']=$list1;
- $data['industryNews']=$list2;
- $this->render ( "/index3", $data );
- }
- function softDown2(){
- Doo::loadModel('Product');
- Doo::loadModel('Down');
- $down=new Down();
- $product=new Product();
- $data['product']=$product->getProductByCidAll($this->column['SOFTAPP']);
- $html="";
- foreach ($data['product'] as $key=>$value){
- $data['product'][$key]['down']=array();
- if(!empty($value['did']))
- $data['product'][$key]['down']=$down->getDownByIdList($value['did']);
- foreach ($data['product'][$key]['down'] as $keys=>$values){
- $t=explode("{b}", $values['down_url']);
- $i=2;
- foreach ($t as $k=>$v){
- if($i==2)
- $html.='<a href="'.$v.'">点击下载</a>';
- // elseif($i==1)
- // $html.='<a href="'.$v.'">联通线路</a>';
- $i--;
- }
- $data['product'][$key]['down'][$keys]['html']=$html;
- $i=2;$html="";
- }
- }
- $data['comart']=$this->comart;
- $data['map']='softDown';
- $this->render ( "/softDown2", $data );
- }
- function softDown(){
- Doo::loadModel('Product');
- $product=new Product();
- $data['product']=$product->getProductByCidAll($this->column['SOFTAPP']);
- $data['comart']=$this->comart;
- $data['map']='softDown';
- $this->render ( "/softDown", $data );
- }
- function ajaxSoftDown(){
- Doo::loadModel('Down');
- Doo::loadModel('Product');
- Doo::loadModel('Animation');
- $animation=new Animation();
- $product=new Product();
- $down=new Down();
- $did=$this->get_args('did');
- $pid=$this->get_args('pid');
- if(!empty($did))
- $do['dot']=$down->getDownByIdList($did);
- $info=$product->getProductById($pid);
- $MyAnimation=array();
- if(!empty($info[0]['anid']))
- $MyAnimation=$animation->getAnimationByIdList($info[0]['anid']);
- $belongAnimation=$animation->getAnimationByBelong();
- $uc='<div class="softVideo">
- <div class="videoItem">';
- if (empty($MyAnimation) ){
- $uc.='<span class="tips">该软件无专属教程,您可观看通用教程</span>';
- }else{
- $uc.='<h1>专属教程</h1>
- <ul class="clearfix">';
- foreach ($MyAnimation as $key=>$value){
- $uc.='<li>
- <img src="'.$value['img_url'].'">
- <h3>'.$value['title'].'</h3>
- <div class="videoCon">
- <span class="playBtn" data-toggle="modal" href="#myModal'.$value['aid'].'" data-keyboard="false" data-backdrop="ture"><b></b>播放</span>
- <a target="blank" href="'.$value['down_url'].'" ><span class="downBtn"><b></b>下载</span></a>
- </div>
- </li>';
- }
- $uc.='</ul>';
- }
- $uc.='</div>
- <div class="videoItem">
- <h1>通用教程</h1>
- <ul class="clearfix">';
- foreach ($belongAnimation as $key=>$value){
- $uc.='<li>
- <img src="'.$value['img_url'].'">
- <h3>'.$value['title'].'</h3>
- <div class="videoCon">
- <span class="playBtn" data-toggle="modal" href="#myModal'.$value['aid'].'" data-keyboard="false" data-backdrop="ture"><b></b>播放</span>
- <a target="blank" href="'.$value['down_url'].'"> <span class="downBtn"><b></b>下载</span> </a>
- </div>
- </li>';
- }
- $uc.='</ul>
- </div>
- <div class="bottomSpace"></div>
- </div>';
- $html='<div class="dSoftInof">
- <div class="productTab clearfix">
- <div class="title fL"><img width="32" src="'.$info[0]['logo'].'"><b>'.$info[0]['title'].'</b></div>
- <ul>
- <li class="now" id="a" onclick="changeProduct(\'info\')" title="查看版本功能更新">版本更新</li>
- <li id="c" onclick="changeProduct(\'edition\')" title="浏览软件简介" class="">软件介绍</li>
- <li id="d" onclick="changeProduct(\'animation\')" title="观看软件动画教程" class="">动画教程 </li>
- </ul>
- </div>
- <div class="contentItem" id="info" style="display: block;">
- '.$info[0]['edition'].'
- </div>
- <div class="contentItem" id="edition" style="display: none;">
- '.$info[0]['content'].'
- </div>
- <div class="contentItem" id="animation" style="display: none;">
- '.$uc.'
- </div>
- </div>';
- if($info[0]['p_type']!=2)
- $do['info']=$html;
- else
- $do['info']="";
- $show=json_encode($do);
- echo $show;
- }
- function product(){
- $pid=$this->params['pid'];
- $tab = $this->get_args ( 'tab' ) ? $this->get_args ( 'tab' ) : 'down';
- $pid=is_numeric($pid)?$pid:0;
- Doo::loadModel('Product');
- Doo::loadModel('Down');
- Doo::loadModel('DownVersion');
- $down=new Down();
- $product=new Product();
- $downversion=new DownVersion();
- Doo::loadModel('Animation');
- $animation=new Animation();
- Doo::loadModel( 'Course' );
- $course = new Course();
- $data['product']=$product->getProductByCid($this->column['SOFTAPP']);
- if (empty($pid))
- $pid=$data['product'][0]['pid'];
- //获取下载内容
- $data['productInfo']=$product->getProductById($pid);
- if(isset($data['productInfo'][0]['isstartup']) && $data['productInfo'][0]['isstartup'] == 1) {
- Doo::loadModel('Startup');
- $startup = new Startup();
- $data['down_url'] = $startup->getDownUrlById();
- }
- if(empty($data['productInfo'][0]['did']))
- $data['productInfo'][0]['did']=0;
- $do=$down->getDownByIdList($data['productInfo'][0]['did']);
- foreach ($do as $key=>$value){
- $url=explode("{b}", $value['down_url']);
- $do[$key]['down_url']=$url;
- $down_version_msg = $downversion->getVersionByDidAnd2($value['did']);
- $do[$key]['version_msg'] = !empty($down_version_msg) ? $down_version_msg['version_msg'] : '';
- }
- $data['productInfo'][0]['down']=$do;
- //获得教程
- $courseList=$course->getCourseAllLikePid($pid);
- $data['courseList']=$courseList;
- // $data['MyAnimation']=array();
- // if(!empty($data['productInfo'][0]['anid']))
- // $data['MyAnimation']=$animation->getAnimationByIdList($data['productInfo'][0]['anid']);
- //
- // $data['belongAnimation']=$animation->getAnimationByBelong();
- $data['tab']=$tab;
- $data['comart']=$this->comart;
- $data['map']='product';
- $data['title']=$data['productInfo'][0]['title'];
- $this->render ( "/product", $data );
- }
- /*
- *教程
- */
- function course(){
- $idKey=isset($this->params ['idKey'])?$this->params['idKey']:'';
- $p = $this->get_args ( 'p' ) && is_numeric ( $this->get_args ( 'p' ) ) ? $this->get_args ( 'p' ) : '';
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $id = $XDeode->decode ( $idKey );
- if (! is_numeric ( $id ))
- die ( 'illegal request' );
- Doo::loadModel( 'Course' );
- $course = new Course();
- Doo::loadModel('Animation');
- $animation=new Animation();
- $courseDetail=$course->getCourseById($id);
- $courseDetail['videoHtml']='';
- foreach ($courseDetail['animationList'] as $key=>$value){
- /* preg_match_all("/<video(.*)src=\"([^\"]+)\"[^>]+>/isU",$courseDetail['animationList'][$key]['url'],$matches);
- $courseDetail['animationList'][$key]['videoSrc']=$matches[2][0];*/
- if (empty($p)){
- $courseDetail['animationList'][0]['url']=str_replace("<video"
- ,"<video id='player' class='video-js vjs-default-skin vjs-big-play-centered vjs-fluid'
- poster='".$value['img_url']."'
- ",$value['url']);
- $courseDetail['videoHtml']=$courseDetail['animationList'][0]['url'];
- $courseDetail['videoDown']=$courseDetail['animationList'][0]['down_url'];
- $courseDetail['videoTitle']=$courseDetail['animationList'][0]['title'];
- break;
- }else{
- if($p==$value['aid']){
- $courseDetail['animationList'][$key]['url']=str_replace("<video"
- ,"<video id='player' class='video-js vjs-default-skin vjs-big-play-centered vjs-fluid'
- poster='".$value['img_url']."'
- ",$value['url']);
- $courseDetail['videoHtml']=$courseDetail['animationList'][$key]['url'];
- $courseDetail['videoDown']=$courseDetail['animationList'][$key]['down_url'];
- $courseDetail['videoTitle']=$courseDetail['animationList'][$key]['title'];
- break;
- }
- }
- }
- $data['title']=$courseDetail['videoTitle'];
- $courseDetail['animationCount']=count($courseDetail['animationList']);
- $data['courseDetail']=$courseDetail;
- $data['map']='product';
- $this->render ( "/coursePlay", $data );
- }
- function aboutUs(){
- $k=isset($this->params ['k'])?$this->params['k']:'';
- $data['comart']=$this->comart;
- $data['map']='aboutUs';
- if (empty($k)){
- $this->render ( "/aboutUsAbout", $data );
- }else{
- Doo::loadModel('Article');
- $article=new Article();
- //$s=strtotime(date('Y')."-01-01");
- $s=strtotime("2015-01-01");
- $list=$article->find(array ( 'where' => 'cid= 7 and time>='.$s,'desc'=>'time','asArray' => TRUE ));
- foreach ($list as $key=>$value){
- $list[$key]['year']=date('Y',$value['time']);
- $list[$key]['month']=date('m',$value['time']);
- if(empty($value['thum']))
- $list[$key]['thum']='/global/img/2.png';
- }
- $data['list']=$list;
- $data['year']=date('Y');
- $this->render ( "/".$k, $data );
- }
- }
- function contact(){
- $data['comart']=$this->comart;
- $data['map']='contact';
- $data['iscontact'] = 1;
- $this->render ( "/contact", $data );
- }
- function contact4(){
- $data['comart']=$this->comart;
- $data['map']='contact';
- $data['iscontact'] = 1;
- Doo::loadModel('Contact');
- Doo::loadModel('ContactProvince');
- $contact = new Contact();
- $contactProvince = new ContactProvince();
- $area = array('华东', '华南', '华中', '华北', '西北', '西南', '东北');
- $list = array();
- foreach ($area as $k => $v) {
- $provinceList = $contactProvince->getListByArea($k);
- foreach ($provinceList as $pk => $pv) {
- $staffList = $contact->getRowByProvince($pv['id']);
- $provinceList[$pk]['staffList'] = $staffList;
- array_push($list, $provinceList[$pk]);
- }
- }
- $data['list'] = $list;
- $this->render ( "/contact4", $data );
- }
- function contact2(){
- $data['iscontact'] = 1;
- $this->render ( "/contact2", $data );
- }
- function contact3(){
- $data['iscontact'] = 1;
- Doo::loadModel('Contact');
- Doo::loadModel('ContactProvince');
- $contact = new Contact();
- $contactProvince = new ContactProvince();
- $area = array('华东', '华南', '华中', '华北', '西北', '西南', '东北');
- $data['area'] = $area;
- $list = array();
- foreach ($area as $k => $v) {
- $provinceList = $contactProvince->getListByArea($k);
- foreach ($provinceList as $pk => $pv) {
- $staffList = $contact->getRowByProvince($pv['id']);
- $provinceList[$pk]['staffList'] = $staffList;
- }
- $list[$k]['provinceList'] = $provinceList;
- }
- $data['list'] = $list;
- $this->render ( "/contact3", $data );
- }
- function train(){
- // $article=new Article();
- // $train=$article->getArticleByTrain(2);
- // $end=$doing=$apply=array();
- //
- // foreach ($train as $key=>$value){
- // $type=getTrainTimeByStatus($value['enroll_time']);
- // $date=explode(":", $value['enroll_time']);
- //
- // if($type=="end"){
- //
- // $train[$key]['timeStuts']="<p class='tData'>结束 ".$date[1]."</p>";
- // array_push($end, $train[$key]);
- // }elseif ($type=="doing"){
- //
- // $train[$key]['timeStuts']="<span class='tIcon'>进行中</span>";
- // array_push($doing, $train[$key]);
- // }elseif ($type=="apply"){
- //
- // $time = strtotime($date[0]) - 60*60*24;
- // $train[$key]['timeStuts']="<span class='tIcon'>报名中</span><p class='tData'>截止".date('Y-m-d',$time)."</p>";
- // array_push($apply, $train[$key]);
- // }
- // }
- //
- // $train=$article->getArticleByTrain(1);
- // $end1=$doing1=$apply1=array();
- //
- // foreach ($train as $key=>$value){
- // $type=getTrainTimeByStatus($value['enroll_time']);
- // $date=explode(":", $value['enroll_time']);
- //
- // if($type=="end"){
- //
- // $train[$key]['timeStuts']="<p class='tData'>结束 ".$date[1]."</p>";
- // array_push($end1, $train[$key]);
- // }elseif ($type=="doing"){
- //
- // $train[$key]['timeStuts']="<span class='tIcon'>进行中</span>";
- // array_push($doing1, $train[$key]);
- // }elseif ($type=="apply"){
- //
- // $time = strtotime($date[0]) - 60*60*24;
- // $train[$key]['timeStuts']="<span class='tIcon'>报名中</span><p class='tData'>截止".date('Y-m-d',$time)."</p>";
- // array_push($apply1, $train[$key]);
- // }
- // }
- //
- // $data['end1']=$end1;
- // $data['doing1']=$doing1;
- // $data['apply1']=$apply1;
- //
- // $data['end']=$end;
- // $data['doing']=$doing;
- // $data['apply']=$apply;
- // $data['comart']=$this->comart;
- // $data['map']='trainI';
- // $this->render ( "/train2", $data );
- //新培训班页
- $article=new Article();
- $trainType = isset($_GET['trainType']) && is_numeric($_GET['trainType']) ? $_GET['trainType'] : '';
- //列出11个地区培训班数量
- $areaArr = array('广东', '山东', '内蒙古', '广西', '重庆', '新疆', '江西', '安徽', '四川', '浙江', '甘肃', '湖南', '贵州');
- $area = isset($_GET['area']) && in_array($_GET['area'], $areaArr) ? $_GET['area'] : '';
- $train= !isset($_GET['trainType']) && !isset($_GET['area']) ? $article->getArticleByTrain3() : $article->getArticleByTrain2($trainType,$area);
- $end=$doing=$apply=$areatrainnum=array();
- foreach($areaArr as $k => $v){
- $trainnum = $article->getArticleNumByTrain2($trainType,$v);
- array_push($areatrainnum,$trainnum);
- }
- foreach ($train as $key=>$value){
- $type=getTrainTimeByStatus($value['enroll_time']);
- $date=explode(":", $value['enroll_time']);
- if($type=="end"){
- $train[$key]['timeStuts']="<p class='tData'>结束 ".$date[1]."</p>";
- array_push($end, $train[$key]);
- }elseif ($type=="doing"){
- $train[$key]['timeStuts']="<span class='tIcon'>进行中</span>";
- array_push($doing, $train[$key]);
- }elseif ($type=="apply"){
- $time = strtotime($date[0]) - 60*60*24;
- $train[$key]['timeStuts']="<span class='tIcon'>报名中</span><p class='tData'>截止".date('Y-m-d',$time)."</p>";
- array_push($apply, $train[$key]);
- }
- }
- $data['end']=$end;
- $data['doing']=$doing;
- $data['apply']=$apply;
- $data['areatrainnum']=$areatrainnum;
- $data['area'] = $area;
- $data['trainType'] = $trainType;
- $data['comart']=$this->comart;
- $data['map']='trainI';
- $this->render ( "/train2", $data );
- }
- function trainPage(){
- $aid=$this->params['aid'];
- $aid=is_numeric($aid)?$aid:0;
- if(empty($aid)){
- return "/train";
- }
- $article=new Article();
- $trainPage=$article->getArticleByTrainAid($aid);
- $trainPage[0]['timeStuts']=getTrainTime($trainPage[0]['enroll_time']);
- $trainPage[0]['class']=getTrainTimeByStatus($trainPage[0]['enroll_time']);
- $data['trainPage']=$trainPage[0];
- $data['comart']=$this->comart;
- $data['map']='train';
- $this->render ( "/trainPage", $data );
- }
- function searchNews(){
- $kind = $this->get_args('kind') ? $this->get_args('kind') : 1;
- $k = $this->get_args('k') ? $this->get_args('k') : "";
- $onPage =$this->get_args('onPage')&&is_numeric ( $this->get_args('onPage') ) ? $this->get_args('onPage') : 1;
- $list=array();$next=0;$previous=0;
- if (!empty($k)){
- Doo::loadModel('Down');
- $down=new Down();
- $article=new Article();
- if ($onPage <= 0)
- $onPage = 1;
- $pageSize = 20;
- $o=$onPage;
- $lower = (-- $o) * $pageSize;
- $previous = $onPage != 0 ? $onPage - 1 : $onPage;
- if ($kind==2){
- $list=$down->getDownByAnyWhere($k);
- //$list=$down->find(array('where'=>'title like "%'.$k.'%" or key_number like "%'.$k.'%"','limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $totalCount = $down->count(array('where'=>'title like "%'.$k.'%" or key_number like "%'.$k.'%"','limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $total = intval ( $totalCount / $pageSize );
- $totalPage = ($totalCount % $pageSize) == 0 ? $total : $total + 1;
- $next = $onPage == $totalPage ? $totalPage : $onPage + 1;
- foreach ($list as $key=>$value){
- $url=explode("{b}", $value['down_url']);
- $list[$key]['down_url']=$url;
- }
- }elseif($kind==3){
- Doo::loadModel('ArticleDao');
- $ArticleDao=new ArticleDao();
- $list=$ArticleDao->find(array('select'=>'title,aid,cid,time','where'=>'title like "%'.$k.'%" ',
- 'limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $totalCount = $ArticleDao->count(array('where'=>'title like "%'.$k.'%" ','asArray' => TRUE));
- $total = intval ( $totalCount / $pageSize );
- $totalPage = ($totalCount % $pageSize) == 0 ? $total : $total + 1;
- $next = $onPage == $totalPage ? $totalPage : $onPage + 1;
- }else{//or content like "%'.$k.'%"
- $list=$article->find(array('select'=>'title,aid,cid,time','where'=>'title like "%'.$k.'%" and ( cid=4 or cid=5 or cid=3 or cid=7)',
- 'limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $totalCount = $article->count(array('where'=>'title like "%'.$k.'%" and ( cid=4 or cid=5 or cid=3 or cid=7)','asArray' => TRUE));
- $total = intval ( $totalCount / $pageSize );
- $totalPage = ($totalCount % $pageSize) == 0 ? $total : $total + 1;
- $next = $onPage == $totalPage ? $totalPage : $onPage + 1;
- foreach ($list as $key=>$value){
- if($value['cid']==4)
- $list[$key]['c']='公司新闻';
- elseif ($value['cid']==5)
- $list[$key]['c']='行业新闻';
- elseif ($value['cid']==3)
- $list[$key]['c']='培训教育';
- elseif ($value['cid']==7)
- $list[$key]['c']='软件更新';
- }
- }
- }
- $data['next']=$next;
- $data['previous']=$previous;
- $data['k']=$k;
- $data['onPage']=$onPage;
- $data['list']=$list;
- $data['kind']=$kind;
- $data['map']='sNews';
- $this->render ( "/search", $data );
- }
- function news(){
- $n = "";
- $cid=isset($this->params ['cid'])&&is_numeric($this->params['cid'])?$this->params['cid']:$this->column['COMPANY'];
- $aid=isset($this->params ['aid'])&&is_numeric($this->params['aid'])?$this->params['aid']:0;
- $on_page = isset($this->params ['page'])&&is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
- //
- if ($on_page <= 0)
- $on_page = 1;
- $page_size = 10;
- // //检索条件
- if($cid==$this->column['TRAINC'])
- $n = " and a_type=2 and cid =" . $cid .' and title!=""';
- else
- $n = " and a_type=1 and cid =" . $cid .' and title!=""';
- $condition=$n;
- $action = "/news/";
- Load::logic ( 'Admin' );
- $this->adminlogic = new AdminLogic ();
- //获取分页相关数据
- $page = $this->adminlogic->get_page ( "sc_article", $condition, $on_page, $page_size, $action );
- $limit = " order by update_time desc limit " . $page ['lower'] . " , " . $page_size . " ";
- Doo::loadModel('Article');
- $article=new Article();
- // $k=$article->getOne(array ('where' => 'aid=721' , 'asArray' => TRUE ));
- //
- // print_r();
- //echo $condition;
- $page ['article_list'] = $article->getArticleList ( array (), $condition, $limit );
- $data['articleInfo']=array();
- if(empty($aid)){
- if(!empty($page ['article_list']))
- $data['articleInfo']=$page ['article_list'][0];
- }else{
- $a=$article->getArticleById($aid);
- $data['articleInfo']=$a[0];
- }
- foreach ($page ['article_list'] as $key=>$value){
- if(empty($value['thum']))
- $page ['article_list'][$key]['thum']='/global/img/2.png';
- }
- $data ['article'] = $page;
- $k="";
- for ($i=1;$i<=$page['total_page'];$i++){
- if($on_page==$i)
- $k.="<option value='".$cid.":".$i."' selected>第".$i."页</option>";
- else
- $k.="<option value='".$cid.":".$i."'>第".$i."页</option>";
- }
- $data['page']=$page;
- $data['comart']=$this->comart;
- $data['onpage']=$on_page;
- $data['cid']=$cid;
- $data['aid']=$aid;
- $data['column']=$this->column;
- $data['map']='news';
- $this->render ( "/news2", $data );
- }
- function newsPage(){
- $aid=isset($this->params ['aid'])&&is_numeric($this->params['aid'])?$this->params['aid']:0;
- Doo::loadModel('Article');
- $article=new Article();
- $a=$article->getArticleById($aid);
- $list=$article->find(array ( 'where' => 'aid !=' . $a[0]['aid'].' and cid='.$a[0]['cid'], 'limit'=>'5','desc'=>'aid' ,'asArray' => TRUE ));
- $data['list']=$list;
- $data['cid']=$a[0]['cid'];
- $data['articleInfo']=$a[0];
- $data['comart']=$this->comart;
- $data['aid']=$aid;
- $data['column']=$this->column;
- $data['map']='news';
- $this->render ( "/newsContent", $data );
- }
- function video(){
- Doo::loadModel('Animation');
- $animation=new Animation();
- $data['comart']=$this->comart;
- $data['map']='video';
- if(isset($this->params['aid'])){
- $data['nimationInfo']=$animation->getAnimationById($this->params['aid']);
- $this->render ( "/videoPage", $data );
- }else{
- $data['nimation']=$animation->getAnimationList(array(), "", "order by aid asc");
- $this->render ( "/video", $data );
- }
- }
- function sdown(){
- $url=isset($this->params ['url'])?$this->params['url']:0;
- if(!empty($url)){
- $url=base64_decode($url);
- if(!empty($url))
- return $url;
- }else{
- return "/";
- }
- }
- function getInfo(){
- $article=new Article();
- $info=$article->getArticleByCid($this->column['COMPANY'],2);
- $k=array();
- foreach ($info as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['title']));
- }
- $pa['company']=$k;
- $cid=$this->column['TRAINC'];
- $art=$article->getArticleByCid($cid,3);
- $k=array();//,'timeStuts'=>getTrainTimeTk($value['enroll_time'])
- foreach ($art as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['enroll_title']));
- }
- $pa['trainc']=$k;
- echo json_encode($pa);
- }
- function getInfo2(){
- $article=new Article();
- $info=$article->getArticleByCid($this->column['COMPANY'],6);
- $k=array();
- foreach ($info as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['title']));
- }
- $pa['company']=$k;
- $cid=$this->column['TRAINC'];
- $art=$article->getArticleByCid($cid,3);
- $k=array();//,'timeStuts'=>getTrainTimeTk($value['enroll_time'])
- foreach ($art as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['enroll_title']));
- }
- $pa['trainc']=$k;
- echo json_encode($pa);
- }
- function newsHttp(){
- $updateTime = $this->get_args('updateTime')&&is_numeric($this->get_args('updateTime')) ? $this->get_args('updateTime') : 0;
- $page = $this->get_args('page')&&is_numeric($this->get_args('page')) ? $this->get_args('page') : 1;
- $size = $this->get_args('size')&&is_numeric($this->get_args('size')) ? $this->get_args('size') : 10;
- Doo::loadModel('Article');
- $article=new Article();
- if ($page!=1)
- $page=$page*$size-1;
- else
- $page--;
- $count=$article->count(array('where'=>'title!="" and (update_time>'.$updateTime.')','limit'=>$page.','.$size,'asArray'=>true));
- $list=$article->find(array('where'=>'title!="" and (update_time>'.$updateTime.')','limit'=>$page.','.$size,'desc'=>'update_time','asArray'=>true));
- echo json_encode(array('status'=>1,'articleList'=>$list,'count'=>$count));
- }
- function authentication(){
- $data=array();
- $this->render ( "/productSecurity", $data );
- }
- function doAuthentication(){
- $key = $this->get_args('key')? $this->get_args('key') :"";
- $data['comart']=$this->comart;
- if (!empty($key)){
- require_once (SITE_PATH . '/protected/class/client.php');
- $client = new client ( 'http://cld.smartcost.com.cn/' );
- $list = $client->zhsso_getSerialNumber ( $key );
- $list=json_decode($list,true);
- if (empty($list['list'])){
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- $data['list']=$list['list'];
- $this->render ( "/productSecurityGenuine", $data );
- }else
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- function authenticationHttp(){
- $SerialNumber = $this->get_args('SerialNumber')? $this->get_args('SerialNumber') :"";
- $data['comart']=$this->comart;
- if (!empty($SerialNumber)){
- require_once (SITE_PATH . '/protected/class/client.php');
- $client = new client ( 'http://cld.smartcost.com.cn/' );
- $list = $client->zhsso_getSerialNumber2 ( $SerialNumber );
- $list=json_decode($list,true);
- if (empty($list['list'])){
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- $data['list']=$list['list'];
- $this->render ( "/productSecurityGenuine2", $data );
- }else{
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- }
- function cut_str($string, $length, $dot = ' ...'){
- if(strlen($string) <= $length)
- {
- return $string;
- }
- $strcut = '';
- $sys_config = 'utf-8';
- if($sys_config == 'utf-8'){
- $n = $tn = $noc = 0;
- while($n < strlen($string))
- {
- $t = ord($string[$n]);
- if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) {
- $tn = 1; $n++; $noc++;
- } elseif(194 <= $t && $t <= 223) {
- $tn = 2; $n += 2; $noc += 2;
- } elseif(224 <= $t && $t < 239) {
- $tn = 3; $n += 3; $noc += 2;
- } elseif(240 <= $t && $t <= 247) {
- $tn = 4; $n += 4; $noc += 2;
- } elseif(248 <= $t && $t <= 251) {
- $tn = 5; $n += 5; $noc += 2;
- } elseif($t == 252 || $t == 253) {
- $tn = 6; $n += 6; $noc += 2;
- } else {
- $n++;
- }
- if($noc >= $length)
- {
- break;
- }
- }
- if($noc > $length)
- {
- $n -= $tn;
- }
- $strcut = mb_substr($string, 0, $n);
- }
- else
- {
- for($i = 0; $i < $length; $i++)
- {
- $strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
- }
- }
- return $strcut.$dot;
- }
- /**
- * 获取get或者POST值
- * @param string $name 属性名称
- * @return fixed 值
- */
- function get_args($name) {
- if (isset ( $_GET [$name] )) {
- if (is_array ( $_GET [$name] ))
- return $_GET [$name];
- else
- return addslashes ( $_GET [$name] );
- } elseif (isset ( $_POST [$name] )) {
- if (is_array ( $_POST [$name] ))
- return $_POST [$name];
- else
- return addslashes ( $_POST [$name] );
- } else {
- return false;
- }
- }
- }
- ?>
|