Example #1
0
 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));
 }
Example #2
0
 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));
 }
Example #3
0
 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));
 }
Example #4
0
 public function actionUploadImage()
 {
     try {
         $id = yii::app()->request->getParam("Id");
         $file = CUploadedFile::getInstanceByName('file');
         $oldName = $file->getName();
         $ext = substr($oldName, stripos($oldName, '.'));
         $typeList = array(".jpg", ".png", ".jpeg", ".gif", ".bmp");
         if (in_array(strtolower($ext), $typeList)) {
             // 图片格式正确
             $article = TSArticle::model()->findByPk($id);
             $article->Logo_Image_path = 'upload/' . $oldName;
             $uploadFile = './assets/upload/' . $oldName;
             $flag = $file->saveAs($uploadFile);
             $length = $article->save();
             if ($flag && $length > 0) {
                 echo json_encode(array('flag' => 'SUCCESS', 'message' => '上传附件成功!'), JSON_UNESCAPED_UNICODE);
             } else {
                 echo json_encode(array('flag' => 'ERROR', 'message' => '上传附件失败!'), JSON_UNESCAPED_UNICODE);
             }
         } else {
             echo json_encode(array('flag' => 'ERROR', 'message' => '图片必须是jpg,png,jpeg,gif,bmp中的一种格式!'), JSON_UNESCAPED_UNICODE);
         }
     } catch (Exception $e) {
         echo json_encode(array('flag' => 'SUCCESS', 'message' => $e->getMessage()), JSON_UNESCAPED_UNICODE);
     }
 }
Example #5
0
 public function actionSolutions()
 {
     $articles = TSArticle::model()->publish()->recently()->findAll('Channel_Identify =:ci', array(':ci' => 'jjfa'));
     $this->menu = 'menu6';
     $this->render('solutions', array('articles' => $articles));
 }