Esempio n. 1
0
 public function searchCell()
 {
     $intSiteId = intval($this->input['intSiteId']);
     $intPageId = intval($this->input['intPageId']);
     $intPageDataId = intval($this->input['intPageDataId']);
     $intContentType = intval($this->input['intContentType']);
     $intTemplateId = intval($this->input['intTemplateId']);
     $blPreset = intval($this->input['blPreset']);
     $intLayoutid = intval($this->input['intLayoutId']);
     //快速专题、区块时不加权限
     if ($this->input['bs'] == 'k' || $this->input['bs'] == 'q') {
     } else {
         if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
             $action = $this->user['prms']['app_prms'][APP_UNIQUEID]['action'];
             $action = empty($action) ? array() : $action;
             if (!in_array('manage', $action)) {
                 $ret = array('login_error' => true);
                 echo json_encode($ret);
                 exit;
                 $this->addItem($ret);
                 $this->output();
             }
         }
     }
     if (!class_exists('Magic')) {
         include CUR_CONF_PATH . 'lib/magic.class.php';
     }
     $magic = new Magic($intSiteId, $intPageId, $intPageDataId, $intContentType, $intTemplateId, $blPreset, $intLayoutid);
     $ret = $magic->searchCell();
     if ($intTemplateId && (!$blPreset || $blPreset == 'false')) {
         //获取专题的布局
         $ret['id'] = $intTemplateId;
         $ret['special_id'] = $intPageDataId;
     }
     $this->addItem($ret);
     $this->output();
 }
Esempio n. 2
0
 public function get_cell_list($site_id, $page_id, $page_data_id, $content_type, $template_sign = '', $site_info = '', $column_info = '')
 {
     if (!class_exists('Maigc')) {
         include CUR_CONF_PATH . 'lib/magic.class.php';
     }
     $objMagic = new Magic($site_id, $page_id, $page_data_id, $content_type);
     $response = $objMagic->searchCell(false, $material_url);
     ###取站点、栏目信息
     include_once ROOT_PATH . 'lib/class/publishconfig.class.php';
     $this->pub = new publishconfig();
     if (!$site_info) {
         $site_info = $this->pub->get_site_first('*', $site_id);
     }
     if ($page_data_id && !$column_info) {
         $page_data = self::get_page_data($page_id, '', '', '', '', $page_data_id);
         $column_info = $page_data['page_data'][0];
     }
     $deploy = self::merge_cell($site_id, $page_id, $page_data_id, $content_type, $site_info, $template_sign);
     $cell = $deploy['default_cell'];
     ###单元中样式、数据源参数处理、样式代码、css、js代码解析
     if (is_array($cell) && count($cell) > 0) {
         $data_source_ids = array();
         foreach ($cell as $key => $value) {
             $mode_info = self::get_mode_info($value['cell_mode'], $value['id'], $value['css_id'], $value['js_id'], $value['param_asso']);
             if ($value['data_source']) {
                 $data_source_ids[$value['id']] = $value['data_source'];
                 $data_source = self::get_datasource_info($value['data_source'], $value['param_asso']);
                 $map = self::get_cell_map($mode_info, $data_source, $value['param_asso']);
             } else {
                 $map = self::get_mode_map($mode_info);
             }
             $cache_file = $value['id'] . '.php';
             include_once CUR_CONF_PATH . 'lib/parse.class.php';
             $parse = new Parse();
             $content = $mode_info['mode_info']['content'];
             $parse->parse_template($content, $value['id'], $mode_info['mode_info'], $map['relation_map'], $map['mode_variable_map'], $map['variable_function_relation']);
             $parse->built_mode_cache($cache_file);
             //专题链接处理
             if (strpos($cell[$key]['more_href'], 'COLURL') !== false) {
             }
             $cell[$key] = array_merge($cell[$key], $mode_info);
             $cell[$key]['mode_detail'] = $cell[$key]['mode_info'];
             unset($cell[$key]['mode_info']);
             $cell[$key]['data_source_info'] = $data_source['info'];
             $cell[$key]['input_param'] = $data_source['input_param'];
             $cell[$key]['input_param_other'] = $map['data_input_variable'];
             $cell[$key]['site_id'] = $site_id;
             $cell[$key]['page_id'] = $page_id;
             $cell[$key]['page_data_id'] = $page_data_id;
             $cell[$key]['content_type'] = $content_type;
         }
     }
     return array('default_style' => $deploy['default_style'], 'curr_style' => $deploy['curr_style'], 'template_sign' => $deploy['template_sign'], 'default_cell' => $cell, 'data_source_ids' => $data_source_ids);
 }