Exemplo n.º 1
0
 /**
  * 获取首页的显示模块
  * @return array|bool
  */
 public function getIndexModule()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('is_show', 1);
     $criteria->compare('start_time', '<=' . time());
     $criteria->compare('end_time', '>=' . time());
     $criteria->limit = 5;
     $criteria->order = 'sort desc ,id desc';
     $list = IndexModule::model()->findAll($criteria);
     if (empty($list)) {
         return false;
     }
     $imageConfig = Yii::app()->params['image']['module_banner'];
     $moduleList = array();
     foreach ($list as $row) {
         $moduleInfo = $row->getAttributes();
         $moduleInfo['start_time'] = date('Y-m-d H:i:s', $row['start_time']);
         $moduleInfo['end_time'] = date('Y-m-d H:i:s', $row['end_time']);
         $moduleInfo['title'] = $row['title'];
         $moduleInfo['link'] = $row['link'];
         if ($moduleInfo['img']) {
             $moduleInfo['img'] = str_replace(ROOT_PATH, '', $imageConfig['path']) . $moduleInfo['img'];
         }
         $moduleInfo['list'] = $this->getModuleProduct($row);
         array_push($moduleList, $moduleInfo);
     }
     return $moduleList;
 }
Exemplo n.º 2
0
<?php

define('MODULE_NAME', 'Index');
define('ACTION_NAME', 'index');
require dirname(__FILE__) . '/core/fanwe.php';
$fanwe =& FanweService::instance();
$fanwe->cache_list[] = 'forums';
$fanwe->initialize();
require fimport('module/index');
IndexModule::index();
Exemplo n.º 3
0
 public function actionChange()
 {
     $res = array('statusCode' => 200, 'message' => '删除成功!');
     try {
         $info = IndexModule::model()->findByPk($_REQUEST['id']);
         if (empty($info)) {
             throw new exception('记录不存在了!');
         }
         $info->is_show = $_REQUEST['is_show'];
         $flag = $info->save();
         if (empty($flag)) {
             throw new exception('修改状态失败!');
         }
         $message = '修改状态成功!';
         $status = 200;
     } catch (Exception $e) {
         $res['statusCode'] = 300;
         $res['message'] = '修改失败【' . $e->getMessage() . '】';
     }
     $res['callbackType'] = 'reloadTab';
     $res['forwardUrl'] = '/manage/indexModule/index';
     $this->ajaxDwzReturn($res);
 }