public function actionDetial() { $id = yii::app()->request->getParam('id'); $article = TSArticle::model()->findByPk($id); $channel = TSChannel::model()->find('Channel_Identify =:channelIden', array("channelIden" => $article->Channel_Identify)); $this->breadcrumbs = array($channel->Channel_Name => $this->createUrl('show/solutions'), $article->Article_Title); $list = TSArticle::model()->publish()->findAll('Id != :id and Channel_Identify =:ci', array(':id' => $id, ':ci' => $article->Channel_Identify)); $this->render('solutions_detail', array('article' => $article, 'list' => $list)); }
public function actionCaseDetail() { $id = yii::app()->request->getParam('id'); $article = TSArticle::model()->findByPk($id); $parentChannel = TSChannel::model()->find('Channel_Identify =:pChannelIden', array(':pChannelIden' => $article->Channel_Parent_Identify)); $channel = TSChannel::model()->find('Channel_Identify =:channelIden', array("channelIden" => $article->Channel_Identify)); $this->breadcrumbs = array($parentChannel->Channel_Name => $this->createUrl('show/cases'), $channel->Channel_Name => $this->createUrl('cases/caseForOne', array('id' => $article->Channel_Identify)), $article->Article_Title); $this->render('case_detail', array('article' => $article)); }
public function actionLoadChannels() { $channels = TSChannel::model()->findAll(); $result = array(); for ($i = 0; $i < count($channels); $i++) { $c = $channels[$i]; $result[$i] = array('id' => $c->Id, 'name' => $c->Channel_Name, 'pId' => $c->Channel_Pid, 'isParent' => $c->Channel_Is_Parent, 'open' => $c->Channel_Is_Open, 'channelIdentify' => $c->Channel_Identify); } $json = json_encode($result, JSON_UNESCAPED_UNICODE); $this->renderPartial('index', array('znodes' => $json)); }
public function actionNewsList() { $id = yii::app()->request->getParam('id'); $page = yii::app()->request->getParam('page'); $channel = TSChannel::model()->find('Channel_Identify=:id', array(':id' => $id)); $criteria = new CDbCriteria(); $criteria->condition = "Article_Is_Publish = 1 AND Channel_Identify ='" . $id . "'"; $criteria->order = 'Article_Create_Time desc'; $count = TSArticle::model()->count($criteria); $pages = new Pager($count); $pages->currentPage = (int) $page; $pages->pageSize = 3; $pages->applyLimit($criteria); $models = TSArticle::model()->findAll($criteria); $this->render('news_list', array('articles' => $models, 'pages' => $pages, 'id' => $id, 'channel' => $channel)); }
public function actionCases() { $currChannel = TSChannel::model()->find('Channel_Identify =:ci', array(':ci' => 'cgal')); $channelList = TSChannel::model()->findAll('Channel_Pid=:cpi', array(':cpi' => $currChannel->Id)); $cList = array(); foreach ($channelList as $value) { $cList[] = array('ctitle' => $value->Channel_Name, 'href' => $this->createUrl('cases/caseForOne', array('id' => $value->Channel_Identify))); } $articles = TSArticle::model()->publish()->recently()->findAll('Channel_Parent_Identify =:cpi', array(':cpi' => 'cgal')); $list = array(); foreach ($articles as $value) { $channel = TSChannel::model()->find('Channel_Identify = :ci', array(':ci' => $value->Channel_Identify)); $list[] = array('article' => $value, 'channel' => $channel); } $this->menu = 'menu3'; $this->render('cases', array('list' => $list, 'cList' => $cList)); }
public function actionSaveNewArticle() { try { $channelId = yii::app()->request->getParam('id'); $title = yii::app()->request->getParam('title'); $author = yii::app()->request->getParam('author'); $content = yii::app()->request->getParam('content'); $summany = $this->left(strip_tags($content), 70); $currChannel = TSChannel::model()->find('Channel_Identify =:channelId', array(':channelId' => $channelId)); $paretnChannel = TSChannel::model()->findByPk($currChannel->Channel_Pid); $article = new TSArticle(); $article->Article_Title = $title; $article->Article_Author = $author; $article->Article_Content = $content; $article->Channel_Identify = $channelId; $article->Article_Create_Time = date("Y-m-d H:i:s", time()); $article->Article_Summary = $summany; $article->Channel_Parent_Identify = $paretnChannel->Channel_Identify; $article->save(); echo json_encode(array('flag' => 'SUCCESS', 'message' => '新建文章成功!'), JSON_UNESCAPED_UNICODE); } catch (Exception $e) { echo json_decode(array('flag' => 'Exception', 'message' => '系统异常!'), JSON_UNESCAPED_UNICODE); } }
public function actionSaveEdit() { try { $channelName = Yii::app()->request->getParam('channelName'); $contentType = Yii::app()->request->getParam('contentType'); $channelType = Yii::app()->request->getParam('channelType'); $channelIdentify = Yii::app()->request->getParam('channelIdentify'); $id = Yii::app()->request->getParam('id'); $list = TSChannel::model()->findAll('Id=:id and Channel_Identify =:ident', array(':id' => $id, ':ident' => $channelIdentify)); if (count($list) > 0) { $tmodel = $list[0]; $tmodel->Channel_Is_Title = $contentType; $tmodel->Channel_Is_Parent = $channelType == '0' ? 'true' : 'false'; $tmodel->Channel_Name = $channelName; $tmodel->Channel_Identify = $channelIdentify; $tmodel->save(); $result = array('flag' => 'SUCCESS', 'message' => '栏目修改成功!', 'name' => $channelName); echo json_encode($result); } else { $list_ = TSChannel::model()->findAll('Channel_Identify =:ident', array(':ident' => $channelIdentify)); if (count($list_) > 0) { $result = array('flag' => 'ERROR', 'message' => '栏目标示已存在!'); echo json_encode($result); } else { $tmodel = TSChannel::model()->findByPk($id); $tmodel->Channel_Is_Title = $contentType; $tmodel->Channel_Is_Parent = $channelType == '0' ? 'true' : 'false'; $tmodel->Channel_Name = $channelName; $tmodel->Channel_Identify = $channelIdentify; $tmodel->save(); $result = array('flag' => 'SUCCESS', 'message' => '栏目修改成功!', 'name' => $channelName); echo json_encode($result); } } } catch (Exception $e) { $result = array('flag' => 'Exception', 'message' => $e->getMessage()); echo json_encode($result); } }