/**
  * 获取配置
  * @param arr $param 查询参数(cKey)
  * @return array 返回配置内容
  */
 public function getConfig($cKey)
 {
     //先读缓存(缓存没有则会默认读数据库,并更新缓存)
     $confCache = get_pro_config_content($cKey);
     //读取模版文件,页面显示按模版配置来输出的,需要把最新的配置项更新到模版中。
     $configTpl = $this->getConfigTpl($cKey);
     if (!$configTpl['status']) {
         return $configTpl;
     }
     //不存在则读默认模版中的配置
     if (!empty($confCache)) {
         foreach ($confCache as $k => $v) {
             $configTpl['data'][$k]['value'] = $v;
         }
     }
     return $configTpl;
 }
 /**
  * 异步加载信息:龄段
  */
 public function loadAct()
 {
     $type = I('get.type', '');
     if ($type == 'stage') {
         //龄段
         $stages = get_cache('Stage');
         foreach ($stages as $k => $v) {
             $data[] = array('id' => $v['id'], 'name' => $v['name']);
         }
         save_log('load', $data);
     } elseif ($type == 'key') {
         //关键字
         $proConf = get_pro_config_content('proConfig');
         foreach ($proConf['keys'] as $k => $v) {
             $data[] = array('id' => $k, 'name' => $v);
         }
     }
     $this->ajaxReturn($data);
 }
 /**
  * 查看操作
  */
 public function indexAct()
 {
     //        $proConfig = get_cache('ProConfig');
     $proConfig = get_pro_config_content('proConfig');
     if (!IS_POST) {
         $this->assign(array('buttonStyle' => $this->buttonAuthStyle(array('add', 'edit', 'del', 'export')), 'rpHtml' => $this->getComboBox($proConfig['content']['rp'], 'where[rpId]', array('width' => 100)), 'statusHtml' => $this->getComboBox($this->statusNames, 'where[status]', array('selVal' => -1, 'width' => 60))));
         $this->display();
     } else {
         $param = $this->getSelectParam('id', 'rpId');
         session('SEARCHCONDITION', $param);
         $list = D('Resource')->selectPage($param);
         $rp = $proConfig['content']['rp'];
         foreach ($list['rows'] as $key => $row) {
             $list['rows'][$key]['rpId'] = $rp[$row['rpId']];
             $list['rows'][$key]['status'] = $this->statusNames[$list['rows'][$key]['status']];
         }
         $this->ajaxReturn($list);
     }
 }
 /**
  * 按页读取数据并把数据中的
  * @param array $param 选择参数 格式:请参考initSelectParam方法;
  * @param bool $isTotal 是否返回总记录数
  */
 public function queryCourse($param = '', $isTotal = true)
 {
     $this->initSelectParam($param);
     $list['rows'] = $this->where($param['where'])->field($param['field'], $param['fieldExcept'])->order($param['sortOrder'])->page($param['page'], $param['pageSize'])->select();
     if ($isTotal) {
         $list['total'] = $this->where($param['where'])->count();
     }
     //把栏目id,出版社id,类型,册数,科目id,标签,关键字id,龄段id,转换成名称在首页显示
     $channels = get_cache('Channel');
     $stages = get_cache('Stage');
     $proConf = get_pro_config_content('proConfig');
     foreach ($list['rows'] as $k => $v) {
         $list['rows'][$k]['chId'] = $channels[$v['chId']]['name'];
         $list['rows'][$k]['pressId'] = $proConf['press'][$v['pressId']];
         $list['rows'][$k]['typeId'] = $proConf['courseType'][$v['typeId']];
         $list['rows'][$k]['session'] = $proConf['session'][$v['session']];
         $list['rows'][$k]['subject'] = $proConf['subject'][$v['subject']];
         $keys = explode(',', $v['keys']);
         $keys = array_filter($keys);
         if (count($keys) > 0) {
             foreach ($keys as $k1 => $v1) {
                 $_keys .= $proConf['keys'][$v1] . ',';
             }
             $list['rows'][$k]['keys'] = $_keys;
             unset($_keys);
         }
         unset($keys);
         $s = explode(',', $v['stage']);
         $s = array_filter($s);
         if (count($s) > 0) {
             foreach ($s as $k2 => $v2) {
                 $_stages .= $stages[$v2]['name'] . ',';
             }
             $list['rows'][$k]['stage'] = $_stages;
             unset($_stages);
         }
         unset($s);
     }
     return $this->returnListData($list);
 }