Пример #1
1
 /**
  * 会员登录
  */
 public function actionLogin()
 {
     $model = new Admin('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['Admin'];
         if ($model->validate()) {
             $data = $model->find('username=:username', array('username' => $model->username));
             if ($data === null) {
                 $model->addError('username', '用户不存在');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->username), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->username) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } elseif ($data->group_id == 2) {
                 $model->addError('username', '用户被锁定,请联系网站管理');
             } else {
                 parent::_stateWrite(array('userId' => $data->id, 'userName' => $data->username, 'groupId' => $data->group_id, 'super' => $data->group_id == 1 ? 1 : 0), array('prefix' => '_admini'));
                 $data->last_login_ip = XUtils::getClientIP();
                 $data->last_login_time = time();
                 $data->login_count = $data->login_count + 1;
                 $data->save();
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '用户登录成功:' . CHtml::encode($model->username)));
                 $this->redirect(array('default/index'));
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
Пример #2
0
 /**
  * 上传
  */
 public function actionBasicExecute()
 {
     if (XUtils::method() == 'POST') {
         $adminiUserId = self::_sessionGet('adminiUserId');
         $file = XUpload::upload($_FILES['imgFile']);
         if (is_array($file)) {
             $model = new Upload();
             $model->user_id = intval($accountUserId);
             $model->file_name = $file['pathname'];
             $model->thumb_name = $file['paththumbname'];
             $model->real_name = $file['name'];
             $model->file_ext = $file['extension'];
             $model->file_mime = $file['type'];
             $model->file_size = $file['size'];
             $model->save_path = $file['savepath'];
             $model->hash = $file['hash'];
             $model->save_name = $file['savename'];
             $model->create_time = time();
             if ($model->save()) {
                 exit(CJSON::encode(array('state' => 'success', 'fileId' => $model->id, 'realFile' => $model->real_name, 'message' => '上传成功', 'file' => $file['pathname'])));
             } else {
                 @unlink($file['pathname']);
                 exit(CJSON::encode(array('state' => 'error', 'message' => '数据写入失败,上传错误')));
             }
         } else {
             exit(CJSON::encode(array('error' => 1, 'message' => '上传错误')));
         }
     }
 }
Пример #3
0
 /**
  * 获取栏目内容数据
  *
  * @param array   $params
  * @return array  数组
  */
 protected function _catalogList($params = array())
 {
     $postModel = new Post();
     $postCriteria = new CDbCriteria();
     $condition = '1';
     if ($params['catalog']) {
         $condition .= ' AND t.catalog_id=:catalogId';
         $criteriaParams[':catalogId'] = intval($params['catalog']);
     }
     if ($params['keyword']) {
         $condition .= ' AND t.title=:title';
         $criteriaParams[':title'] = CHtml::encode(strip_tags($params['keyword']));
     }
     $condition .= " AND t.status_is='Y'";
     $postCriteria->condition = $condition;
     $postCriteria->params = $criteriaParams;
     $postCriteria->order = 't.id DESC';
     $postCriteria->with = 'catalog';
     $count = $postModel->count($postCriteria);
     $postPages = new CPagination($count);
     $postPages->pageSize = $params['pageSize'] > 0 ? $params['pageSize'] : 20;
     $pageParams = XUtils::buildCondition($_GET, array('catalog', 'keyword'));
     $postPages->params = is_array($pageParams) ? $pageParams : array();
     $postCriteria->limit = $postPages->pageSize;
     $postCriteria->offset = $postPages->currentPage * $postPages->pageSize;
     $bagecmsDataList = $postModel->findAll($postCriteria);
     $catalogArr = Catalog::item($params['catalog'], $this->_catalog);
     if ($catalogArr) {
         $this->_seoTitle = empty($catalogArr['catalog_name']) ? $this->_seoTitle : $catalogArr['catalog_name'];
         $bagecmsCatalogData = $catalogArr;
         $this->_seoKeywords = empty($catalogArr['seo_keywords']) ? $this->_seoKeywords : $catalogArr['seo_keywords'];
         $this->_seoDescription = empty($catalogArr['seo_description']) ? $this->_seoDescription : $catalogArr['seo_description'];
     }
     return array('bagecmsDataList' => $bagecmsDataList, 'bagecmsPagebar' => $postPages, 'bagecmsCatalogData' => $bagecmsCatalogData);
 }
 /**
  * 会员登录
  */
 public function actionLogin()
 {
     try {
         $model = new EnergyAdmin('login');
         if (XUtils::method() == 'POST') {
             $model->id = $_POST['id'];
             $model->password = $_POST['password'];
             $data = $model->find('id=:id', array('id' => $model->id));
             if ($data === null) {
                 $model->addError('id', '用户不存在');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->id), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->id) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } else {
                 parent::_stateWrite(array('userId' => $data->id, 'userName' => $data->name), array('prefix' => '_admini'));
                 // $data->save();
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '用户登录成功:' . CHtml::encode($model->id)));
                 $this->redirect(array('energy/index'));
             }
         }
         $this->render('login', array('model' => $model));
     } catch (Exception $e) {
         echo var_dump($e);
     }
 }
Пример #5
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('position_delete');
             $cityModel = new Position();
             $cityModel->deleteAll('id IN(' . $ids . ')');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除内容,ID:' . $ids));
             parent::_delete(new Position(), $ids, array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
Пример #6
0
 public function actionLogin()
 {
     $model = new Admin('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['Admin'];
         if ($model->validate()) {
             $data = $model->find('username=:username', array('username' => $model->username));
             if ($data === null) {
                 $model->addError('username', '用户不存在');
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->username), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->username) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } elseif ($data->group_id == 2) {
                 $model->addError('username', '用户已经锁定,请联系管理');
             } else {
                 $this->_sessionSet('_backendGroupId', $data->group_id);
                 if (isset($data->group_id) && $data->group_id == 1) {
                     $this->_sessionSet('_backendPermission', 'backendstrator');
                 }
                 $data->last_login_ip = XUtils::getClientIP();
                 $data->last_login_time = time();
                 $data->login_count = $data->login_count + 1;
                 $data->save();
                 parent::_sessionSet('uid', $data->id);
                 parent::_sessionSet('uname', $data->username);
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '用户登录成功:' . $data->username));
                 $this->redirect(array('default/index'));
                 XUtils::message('success', '登录成功', $this->createUrl('default/index'), 2);
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
Пример #7
0
 /**
  * 批量操作
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($this->_gets->getParam('command'));
         $ids = intval($this->_gets->getParam('id'));
     } elseif (XUtils::method() == 'POST') {
         $command = $this->_gets->getPost('command');
         $ids = $this->_gets->getPost('id');
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         throw new CHttpException(404, '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'attachDelete':
             parent::_acl('attach_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除附件,ID:' . $ids));
             //日志
             parent::_delete(new Upload(), $ids, array('attach'), array('file_name'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
Пример #8
0
 /**
  * 编辑器文件上传
  */
 public function actionUpload()
 {
     if (XUtils::method() == 'POST') {
         $file = XUpload::upload($_FILES['imgFile']);
         if (is_array($file)) {
             $model = new Upload();
             $model->user_id = intval($admini['userId']);
             $model->file_name = CHtml::encode($file['pathname']);
             $model->thumb_name = CHtml::encode($file['paththumbname']);
             $model->real_name = CHtml::encode($file['name']);
             $model->file_ext = $file['extension'];
             $model->file_mime = $file['type'];
             $model->file_size = $file['size'];
             $model->save_path = $file['savepath'];
             $model->hash = $file['hash'];
             $model->save_name = $file['savename'];
             $model->create_time = time();
             if ($model->save()) {
                 exit(CJSON::encode(array('error' => 0, 'url' => Yii::app()->baseUrl . '/' . $file['pathname'])));
             } else {
                 @unlink($file['pathname']);
                 @unlink($file['paththumbname']);
                 exit(CJSON::encode(array('error' => 1, 'message' => '上传错误')));
             }
         } else {
             exit(CJSON::encode(array('error' => 1, 'message' => '上传错误:' . $file)));
         }
     }
 }
Пример #9
0
 public function actionView($id)
 {
     $lesson = $this->loadModel($id);
     $userId = $this->_cookiesGet('userId');
     $userType = $this->_cookiesGet('userType');
     $this->_seoTitle = '课程 - ' . $lesson->name;
     //取报名人数
     $actual_students_criteria = new CDbCriteria();
     $actual_students = StudentLesson::model()->count($actual_students_criteria->addCondition("lesson_id =" . $id));
     $lesson->actual_students = $actual_students;
     $teacher = Teacher::model()->findByPk($lesson->teacher_id);
     $place = Place::model()->findByPk($lesson->place_id);
     //教学环境图片显示
     $imageList = $this->_gets->getParam('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     //判断学员已收藏的课程
     if ($userType === 'student') {
         $is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1));
     }
     if ($imageList) {
         $imageList = $imageListSerialize['data'];
     } elseif ($place->pic_other) {
         $imageList = unserialize($place->pic_other);
     }
     $this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher, 'imageList' => $imageList));
 }
Пример #10
0
 public function actionUpdatePlace()
 {
     $model = Place::model()->findByPk($_GET['id']);
     $imageList = $this->_gets->getParam('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     if (isset($_POST['Place'])) {
         $model->attributes = $_POST['Place'];
         $model->pic_other = $imageListSerialize['dataSerialize'];
         $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(192, 470)));
         $adr = XUpload::upload($_FILES['pic_adr'], array('thumb' => true, 'thumbSize' => array(498, 364)));
         if (is_array($file)) {
             $model->pic = $file['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if (is_array($adr)) {
             $model->pic_adr = $adr['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->validate() && $model->save()) {
             $this->redirect(array('/host/default/myplace'));
         }
     }
     if ($imageList) {
         $imageList = $imageListSerialize['data'];
     } elseif ($model->pic_other) {
         $imageList = unserialize($model->pic_other);
     }
     $this->render('addplace', array('model' => $model, 'imageList' => $imageList));
 }
Пример #11
0
 /**
  * 查看专题
  */
 public function actionShow($name)
 {
     $specialModel = Special::model()->find('title_alias=:titleAlias', array('titleAlias' => CHtml::encode(strip_tags($name))));
     if (false == $specialModel) {
         throw new CHttpException(404, '专题不存在');
     }
     //更新浏览次数
     $specialModel->updateCounters(array('view_count' => 1), 'id=:id', array('id' => $specialModel->id));
     $specialPostModel = new Post();
     $criteria = new CDbCriteria();
     $criteria->addCondition('t.status_is=:status AND special_id=:specialId');
     $criteria->params = array('status' => 'Y', 'specialId' => $specialModel->id);
     $criteria->order = 't.id DESC';
     $bagecmsSpecialCount = $specialPostModel->count($criteria);
     $postPage = new CPagination($bagecmsSpecialCount);
     $postPage->pageSize = 10;
     $postPageParams = XUtils::buildCondition($_GET, array());
     $postPageParams['#'] = 'list';
     $postPage->params = is_array($postPageParams) ? $postPageParams : array();
     $criteria->limit = $postPage->pageSize;
     $criteria->offset = $postPage->currentPage * $postPage->pageSize;
     $specialPostList = $specialPostModel->findAll($criteria);
     $this->_seoTitle = empty($specialModel->seo_title) ? $specialModel->title . ' - ' . $this->_conf['site_name'] : $specialModel->seo_title;
     $tpl = empty($specialModel->tpl) ? 'show' : $specialModel->tpl;
     $data = array('specialShow' => $specialModel, 'specialPostList' => $specialPostList, 'bagecmsPagebar' => $postPage);
     $this->render($tpl, $data);
 }
Пример #12
0
 /**
  * 主界面
  */
 public function actionHome()
 {
     $data['soft'] = 'bagecms';
     $data['softVersion'] = $this->_bagecms;
     $data['softRelease'] = $this->_bagecmsRelease;
     $data['serverSoft'] = $_SERVER['SERVER_SOFTWARE'];
     $data['serverOs'] = PHP_OS;
     $data['phpVersion'] = PHP_VERSION;
     $data['fileupload'] = ini_get('file_uploads') ? ini_get('upload_max_filesize') : '禁止上传';
     $data['serverUri'] = $_SERVER['SERVER_NAME'];
     $data['maxExcuteTime'] = ini_get('max_execution_time') . ' 秒';
     $data['maxExcuteMemory'] = ini_get('memory_limit');
     $data['magic_quote_gpc'] = MAGIC_QUOTE_GPC ? '开启' : '关闭';
     $data['allow_url_fopen'] = ini_get('allow_url_fopen') ? '开启' : '关闭';
     $data['excuteUseMemory'] = function_exists('memory_get_usage') ? XUtils::byteFormat(memory_get_usage()) : '未知';
     $dbsize = 0;
     $connection = Yii::app()->db;
     $sql = 'SHOW TABLE STATUS LIKE \'' . $connection->tablePrefix . '%\'';
     $command = $connection->createCommand($sql)->queryAll();
     foreach ($command as $table) {
         $dbsize += $table['Data_length'] + $table['Index_length'];
     }
     $mysqlVersion = $connection->createCommand("SELECT version() AS version")->queryAll();
     $data['mysqlVersion'] = $mysqlVersion[0]['version'];
     $data['dbsize'] = $dbsize ? XUtils::byteFormat($dbsize) : '未知';
     $notebook = Admin::model()->findByPk($this->_admini['userId']);
     $env = XUtils::b64encode(serialize($data));
     $this->render('home', array('notebook' => $notebook, 'env' => $env, 'server' => $data));
 }
Пример #13
0
 /**
  * 自动化初始值/处理数据
  *
  * @return unknown
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         isset($this->create_time) && ($this->create_time = time());
     }
     $this->sort_order = intval($this->sort_order);
     $this->site_url = XUtils::convertHttp($this->site_url);
     return true;
 }
Пример #14
0
 /**
  * 后台日志记录
  * @param  $intro
  */
 public static function _create(array $arr = array())
 {
     $session = new XSession();
     $admini = $session->get('_admini');
     $model = new AdminLogger();
     $model->attributes = $arr;
     !isset($arr['user_id']) && ($model->user_id = intval($admini['userId']));
     $model->url = Yii::app()->request->getRequestUri();
     $model->ip = XUtils::getClientIP();
     $model->save();
 }
Пример #15
0
 function sendMail($email, $subject, $message, $name)
 {
     global $app;
     $headers = "To: " . XUtils::strToBase($name, 'utf-8', 'windows-1251') . " <{$email}>\n";
     $headers .= "From: " . XUtils::strToBase($app->Dictionary->getWord("MailFrom"), 'utf-8', 'windows-1251') . "<" . $app->getVar("mailsender") . ">\n";
     $headers .= "X-Sender: " . XUtils::strToBase($app->Dictionary->getWord("XSender"), 'utf-8', 'windows-1251') . "\n";
     $headers .= "Content-Type: text/plain; charset=windows-1251\n";
     $headers .= "Content-Transfer-Encoding: 8bit\n";
     $headers .= "MIME-Version: 1.0\n";
     $headers = iconv("utf-8", "windows-1251", $headers);
     $subject = XUtils::strToBase($subject, 'utf-8', 'windows-1251');
     $message = iconv("utf-8", "windows-1251", $message);
     mail($email, $subject, $message, $headers);
 }
Пример #16
0
 /**
  * 编辑
  *
  * @param $id
  */
 public function actionUpdateTpl($filename)
 {
     $filename = CHtml::encode(trim($this->_gets->getParam('filename')));
     $content = trim($this->_gets->getParam('content'));
     if (isset($_POST['content'])) {
         $fileputcontent = file_put_contents(Yii::app()->basePath . '/views/' . XUtils::b64decode($filename), $content);
         if ($fileputcontent == true) {
             //$this->redirect( array ( 'index' ) );
             Yii::app()->user->setFlash('success', '修改成功!');
         }
     }
     $data['filename'] = XUtils::b64decode($filename);
     $data['content'] = htmlspecialchars(file_get_contents(Yii::app()->basePath . '/views/' . XUtils::b64decode($filename)));
     $this->render('update', $data);
 }
 /**
  * 外借资产查询
  *
  * @author 张钰 徐晨阳
  * 该模块主要负责对申请资产进行显示,删除
  */
 public function actionIndex()
 {
     // 分页取数据
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     if (XUtils::method() == 'POST') {
         // 查询按钮
         if (isset($_POST['subQuery'])) {
             // 判断是否获取content中的内容,内容为空是显示全部申请
             if (isset($_POST['queryType']) && isset($_POST['content']) && $_POST['content'] != null) {
                 $queryType = $_POST['queryType'];
                 if ($queryType == 'ByApplyId') {
                     $criteria->addCondition('applyId=:applyId');
                     // 查询条件,即where id = 1
                     $criteria->params[':applyId'] = $_POST['content'];
                 } else {
                     if ($queryType == 'ByStuId') {
                         $criteria->addCondition('stuId=:stuId');
                         // 查询条件,即where id = 1
                         $criteria->params[':stuId'] = $_POST['content'];
                     } else {
                         if ($queryType == 'ByAssetName') {
                             $criteria->addCondition('assetName=:assetName');
                             // 查询条件,即where id = 1
                             $criteria->params[':assetName'] = $_POST['content'];
                         } else {
                             echo "ERROR";
                         }
                     }
                 }
             }
         }
     }
     //分页获取
     $count = AsApply::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = PAGESIZE;
     $pages->applyLimit($criteria);
     //echo var_dump($pages);
     $data = AsApply::model()->findAll($criteria);
     $data = json_decode(CJSON::encode($data), TRUE);
     is_array($data) ? null : ($data = array());
     // 防止空数组
     $this->render('index', array('data' => $data, 'pages' => $pages));
     // $this->render ( 'index' );
 }
Пример #18
0
 /**
  * 首页
  */
 public function actionIndex()
 {
     $bagecmsQuestionModel = new Question();
     $bagecmsQuestionCriteria = new CDbCriteria();
     $bagecmsQuestionCriteria->condition = 'status_is=:status';
     $bagecmsQuestionCriteria->params = array('status' => 'Y');
     $bagecmsQuestionCriteria->order = 't.id DESC';
     $bagecmsQuestionCount = $bagecmsQuestionModel->count($bagecmsQuestionCriteria);
     $bagecmsQuestionPages = new CPagination($bagecmsQuestionCount);
     $bagecmsQuestionPages->pageSize = 10;
     $bagecmsQuestionPageParams = XUtils::buildCondition($_GET, array());
     $bagecmsQuestionPageParams['#'] = 'list';
     $bagecmsQuestionPages->params = is_array($bagecmsQuestionPageParams) ? $bagecmsQuestionPageParams : array();
     $bagecmsQuestionCriteria->limit = $bagecmsQuestionPages->pageSize;
     $bagecmsQuestionCriteria->offset = $bagecmsQuestionPages->currentPage * $bagecmsQuestionPages->pageSize;
     $bagecmsQuestionList = $bagecmsQuestionModel->findAll($bagecmsQuestionCriteria);
     $this->_seoTitle = '留言咨询 - ' . $this->_conf['site_name'];
     $this->render('index', array('bagecmsQuestionList' => $bagecmsQuestionList, 'pages' => $bagecmsQuestionPages));
 }
Пример #19
0
 static function mapi_get($url_mixed, $data = array(), $debug = false)
 {
     //$debug=true;
     Yii::import('application.vendors.*');
     require_once 'Tp/Curl.class.php';
     $curl = new Curl();
     if (YII_ENV == 'development') {
         $curl->setHeader('Apihandshake', 'yaochufa');
         $curl->setHeader('Referer', 'http://m.yaochufa.com');
     } else {
         $curl->setHeader('Apihandshake', 'yaochufaapi');
         $curl->setHeader('Referer', 'http://m.yaochufa.com');
     }
     $curl->setOpt(CURLOPT_TIMEOUT, 15);
     $data['system'] = Yii::app()->params['mmm_api']['system'];
     $curl->get($url_mixed, $data);
     if ($debug == true) {
         XUtils::dump($curl->request_headers);
     }
     return $curl->response;
 }
Пример #20
0
 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     parent::_acl('evaluate_index');
     $model = new Evaluate();
     $criteria = new CDbCriteria();
     $condition = '1';
     $isHandle = $this->_gets->getParam('is_handle');
     $noHandle = $this->_gets->getParam('no_handle');
     $isHandle && ($condition .= ' AND status= ' . $isHandle);
     $noHandle && ($condition .= ' AND status= ' . $noHandle);
     $criteria->condition = $condition;
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pageParams = XUtils::buildCondition($_GET, array('status'));
     $pages->params = is_array($pageParams) ? $pageParams : array();
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages));
 }
Пример #21
0
 /**
  * 首页
  */
 public function actionIndex()
 {
     $keyword = CHtml::encode(strip_tags(trim($this->_gets->getParam('keyword'))));
     $postModel = new Post();
     $postCriteria = new CDbCriteria();
     if ($keyword) {
         $postCriteria->addSearchCondition('t.title', $keyword);
     }
     $postCriteria->addCondition('t.status_is=:status');
     $postCriteria->params[':status'] = 'Y';
     $postCriteria->with = 'catalog';
     $postCriteria->order = 't.id DESC';
     $bagecmsQuestionCount = $postModel->count($postCriteria);
     $postPages = new CPagination($bagecmsQuestionCount);
     $postPages->pageSize = 15;
     $postPageParams = XUtils::buildCondition($_GET, array('keyword'));
     $postPageParams['#'] = 'list';
     $postPages->params = is_array($postPageParams) ? $postPageParams : array();
     $postCriteria->limit = $postPages->pageSize;
     $postCriteria->offset = $postPages->currentPage * $postPages->pageSize;
     $postList = $postModel->findAll($postCriteria);
     $this->render('index', array('bagecmsDataList' => $postList, 'bagecmsPagebar' => $postPages));
 }
 public function actionUpdate($stuId)
 {
     if (XUtils::method() == 'POST') {
         $student = new StStudent();
         $student->stuId = $stuId;
         $student->stuName = $_POST['stuName'];
         $student->profession = $_POST['profession'];
         $student->grade = $_POST['grade'];
         $student->phone = $_POST['phone'];
         $student->classId = $_POST['classId'];
         $count = AsAsset::model()->updateByPk($stuId, array('stuName' => $student->stuName, 'profession' => $student->profession, 'grade' => $student->grade, 'phone' => $student->phone, 'classId' => $student->classId));
         if ($count > 0) {
             echo "<script language=\"JavaScript\">alert(\"更新成功\");</script>";
         } else {
             echo "<script language=\"JavaScript\">alert(\"更新失败\");</script>";
         }
     }
     $data = StStudent::model()->findByPk($stuId);
     $data = json_decode(CJSON::encode($data), TRUE);
     is_array($data) ? null : ($data = array());
     // 防止空数组
     $this->render('update', array('data' => $data));
 }
Пример #23
0
 /**
  * tags数据列表
  */
 public function actionPost($name)
 {
     $tagName = CHtml::encode(strip_tags(urldecode($name)));
     $tagModel = new Post2tags();
     $post2TagsCriteria = new CDbCriteria();
     if ($tagName) {
         $post2TagsCriteria->addCondition("tag_name = :tagName");
         $post2TagsCriteria->params[':tagName'] = $tagName;
     }
     $post2TagsCriteria->order = 't.id DESC';
     $post2TagsCriteria->with = array('post');
     $post2TagsCount = $tagModel->count($post2TagsCriteria);
     $post2TagsPages = new CPagination($post2TagsCount);
     $post2TagsPages->pageSize = 30;
     $pageParams = XUtils::buildCondition($_GET, array('name'));
     $post2TagsPages->params = is_array($pageParams) ? $pageParams : array();
     $post2TagsCriteria->limit = $post2TagsPages->pageSize;
     $post2TagsCriteria->offset = $post2TagsPages->currentPage * $post2TagsPages->pageSize;
     $data['bagecmsDataList'] = $tagModel->findAll($post2TagsCriteria);
     $data['bagecmsPagebar'] = $post2TagsPages;
     $data['tagName'] = $tagName;
     $this->_seoTitle = 'Tag-' . $tagName;
     $this->render('post2tags', $data);
 }
Пример #24
0
 function actionCache()
 {
     $dataList = array('pageCache' => '页面缓存', 'dataCache' => '数据缓存', 'allCache' => '全部缓存');
     //        ppr($dataList);
     $notice = '选择缓存类型';
     if (XUtils::method() == 'POST') {
         $cacheType = reqPost('cacheType', NULL);
         $path = SITE_BACKEND_PATH . 'assets';
         switch ($cacheType) {
             case 'pageCache':
                 XUtils::delDirAndFile($path);
                 break;
             case 'dataCache':
                 cacheFlush();
                 break;
             case 'allCache':
                 cacheFlush();
                 XUtils::delDirAndFile($path);
                 break;
         }
         $notice .= '<br />清空完成!';
     }
     $this->render('cache', array('dataList' => $dataList, 'notice' => $notice));
 }
Пример #25
0
" class="actionBtn"><span>录入</span></a></li>
    </ul>
    <div class="search right">
      <?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'searchForm', 'method' => 'get', 'htmlOptions' => array('name' => 'xform')));
?>
      <select name="groupId" id="groupId">
        <option value="">=组=</option>
        <?php 
foreach ((array) $this->group_list as $group) {
    ?>
        <option value="<?php 
    echo $group['id'];
    ?>
" <?php 
    XUtils::selected($group['id'], $model->group_id);
    ?>
><?php 
    echo $group['group_name'];
    ?>
</option>
        <?php 
}
?>
      </select>
      <select name="sex" id="sex">
        <option value="">性别</option>
        <option value="男">男</option>
        <option value="女">女</option>
      </select>
      用户名
Пример #26
0
                ?>
 href="<?php 
                echo $item['link'];
                ?>
" class="<?php 
                echo $item['opt_a'];
                ?>
"><?php 
                echo $item['title'];
                ?>
</a> 
                                    <?php 
            } else {
                ?>
                                        <?php 
                echo XUtils::b64decode($item['mix']);
                ?>
                                    <?php 
            }
            ?>
                                </li>
                            <?php 
        }
        ?>
                        <?php 
    }
    ?>
                    </ul>
                </div>
<?php 
    $m++;
Пример #27
0
      </em></div>
	<!--/上下篇-->
    
	<!--相关阅读-->
    <div id="relatedPost" class="bm">
      <div class="boxTit clear">
        <h3>相关阅读</h3>
      </div>
      <div class="bmc">
        <ul class="list clear" id="raid_div">
		<?php 
foreach ((array) Bagecms::getList('post', 'index_news', array('where' => "status_is='Y' AND catalog_id={$bagecmsShow['catalog_id']} AND id!={$bagecmsShow['id']}", 'order' => 'id DESC', 'limit' => 8)) as $newsKey => $newsRow) {
    ?>
          <li>• <a href="<?php 
    if ($newsRow['redirect_url']) {
        echo XUtils::convertHttp($newsRow['redirect_url']);
    } else {
        echo $this->createUrl('post/show', array('id' => $newsRow['id']));
    }
    ?>
" target="_blank"><?php 
    echo $newsRow['title'];
    ?>
</a></li>
		<?php 
}
?>
 
        </ul>
      </div>
    </div>
 /**
  * 描述格式化
  * @param  $subject
  */
 public static function clearCutstr($subject, $length = 0, $dot = '...', $charset = 'utf-8')
 {
     if ($length) {
         return XUtils::cutstr(strip_tags(str_replace(array("\r\n"), '', $subject)), $length, $dot, $charset);
     } else {
         return strip_tags(str_replace(array("\r\n"), '', $subject));
     }
 }
Пример #29
0
  </tr>
    <tr>
        <td class="tb_title">城市:</td>
    </tr>
    <tr >
        <td >
            <select name="Subject[city_id]" id="Subject_city_id" class="validate[required]">
                <option value>==所有城市==</option>
                <?php 
foreach ((array) $this->city_list as $city) {
    ?>
                    <option value="<?php 
    echo $city['id'];
    ?>
" <?php 
    XUtils::selected($city['id'], $model->city_id);
    ?>
><?php 
    echo $city['name'];
    ?>
</option>
                <?php 
}
?>
            </select>
        </td>
    </tr>
  <tr>
    <td class="tb_title">项目时间:</td>
  </tr>
  <tr>
Пример #30
0
      <td ><p><?php 
    echo CHtml::encode($row->real_name);
    ?>
</p>
        <p><?php 
    echo CHtml::encode($row->save_path);
    ?>
</p>
        <p><?php 
    echo CHtml::encode($row->save_name);
    ?>
</p></td>
      <!--<td ></td>-->
      
      <td ><span ><?php 
    echo XUtils::byteFormat($row->file_size);
    ?>
</span></td>
      <td ><?php 
    echo date('Y-m-d H:i', $row->create_time);
    ?>
</td>
      <td ><a href="<?php 
    echo $this->createUrl('batch', array('command' => 'attachDelete', 'id' => $row->id));
    ?>
" class="confirmSubmit"><img src="<?php 
    echo $this->_baseUrl;
    ?>
/static/admin/images/delete.png" align="absmiddle" /></a></td>
    </tr>
    <?php