You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
5.4 KiB
PHTML
178 lines
5.4 KiB
PHTML
8 years ago
|
<?php
|
||
|
|
||
|
if (!defined('BASEPATH'))
|
||
|
exit('No direct script access allowed');
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* FAQ
|
||
|
*
|
||
|
*/
|
||
|
class Faq extends CI_Controller
|
||
|
{
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct();
|
||
|
$this->permission->is_admin();
|
||
|
$this->load->model('Area_model');
|
||
|
$this->load->model('Information_model');
|
||
|
$this->load->model('InfoContents_model');
|
||
|
$this->load->model('InfoStructures_model');
|
||
|
$this->load->model('Import_adv_model');
|
||
|
//$this->output->enable_profiler(TRUE);
|
||
|
}
|
||
|
|
||
|
public function index()
|
||
|
{
|
||
|
$link_id=1;
|
||
|
//查询结构根节点,当为空则建立
|
||
|
$rootStructure = $this->Information_model->GetRoot('q', $link_id);
|
||
|
if ($rootStructure == FALSE)
|
||
|
{
|
||
|
$this->InfoContents_model->Add('', 'FAQ', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $link_id, 'q', 0,
|
||
|
'','');
|
||
|
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
|
||
|
$is_id = $this->InfoStructures_model->insert_id;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$is_id = $rootStructure->is_id;
|
||
|
}
|
||
|
redirect(site_url('information/edit/' . $is_id));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* FAQ
|
||
|
*
|
||
|
*/
|
||
|
public function import()
|
||
|
{
|
||
|
$site_code = $this->config->item('site_code');
|
||
|
$site_lgc = $this->config->item('site_lgc');
|
||
|
|
||
|
//取出FAQ列表
|
||
|
$data['faq'] = $this->Import_adv_model->get_faq($site_code, $site_lgc);
|
||
|
|
||
|
//取出FAQ的根节点的is_id
|
||
|
$faq_root_isid = $this->Import_adv_model->get_faq_root_isid($site_code);
|
||
|
|
||
|
//取出所有FAQ类型
|
||
|
$data['faq_type'] = array();
|
||
|
$data['faq_type_en'] = array();
|
||
|
foreach ($data['faq'] as $it)
|
||
|
{
|
||
|
$data['faq_type_en'][] = $it->SFC2_Byname;
|
||
|
$data['faq_type'][] = $it->SFC2_Title;
|
||
|
}
|
||
|
$data['faq_type'] = array_unique($data['faq_type']);
|
||
|
$data['faq_type_en'] = array_unique($data['faq_type_en']);
|
||
|
|
||
|
//插入根节点 -- 已完成 -- 注释掉
|
||
|
/*
|
||
|
foreach ($data['faq_type'] as $key=>$it)
|
||
|
{
|
||
|
//写url
|
||
|
if (strtolower($site_code)=='jp' || strtolower($site_code)=='ru')
|
||
|
{
|
||
|
$url_m = '/feedback/'.$this->parseToUrlString($data['faq_type_en'][$key]).'/';
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$url_m = '/feedback/'.$this->parseToUrlString($it).'/';
|
||
|
}
|
||
|
$this->InfoContents_model->add(
|
||
|
$url_m,//$ic_url
|
||
|
$it,//$ic_url_title
|
||
|
'',//$ic_type
|
||
|
$it,//$ic_title
|
||
|
'',//$ic_content
|
||
|
'',//$ic_summary
|
||
|
'',//$ic_seo_title
|
||
|
'',//$ic_seo_description
|
||
|
'',//$ic_seo_keywords
|
||
|
'',//$ic_show_bread_crumbs
|
||
|
1,//$ic_status
|
||
|
'',//$ic_template
|
||
|
'',//$ic_photo
|
||
|
'',//$ic_photo_width
|
||
|
'',//$ic_photo_height
|
||
|
'',//$ic_recommend_tours
|
||
|
'',//$ic_recommend_packages
|
||
|
'',//$ic_ht_area_id
|
||
|
'q',//$ic_ht_area_type
|
||
|
'',//$ic_ht_product_id
|
||
|
'',//$ic_ht_product_type
|
||
|
''//$ic_author
|
||
|
);
|
||
|
$this->InfoStructures_model->Add($faq_root_isid, $this->InfoContents_model->insert_id);
|
||
|
$insert_is_id = $this->InfoStructures_model->insert_id;
|
||
|
|
||
|
//插入二级节点
|
||
|
foreach ($data['faq'] as $it2)
|
||
|
{
|
||
|
if ($it2->SFC2_Title == $it)
|
||
|
{
|
||
|
//写url
|
||
|
$it2->WSN_Title = mb_substr($it2->WSN_Title,0,240);
|
||
|
$seo_des = strip_tags(mb_substr($it2->WSN_Memo,0,240).'...');
|
||
|
$url_s = $url_m.$it2->WSN_ID.'.htm';
|
||
|
$this->InfoContents_model->add(
|
||
|
$url_s,//$ic_url
|
||
|
$it2->WSN_Title,//$ic_url_title
|
||
|
'',//$ic_type
|
||
|
$it2->WSN_Title,//$ic_title
|
||
|
$it2->WSN_Memo,//$ic_content
|
||
|
'',//$ic_summary
|
||
|
$it2->WSN_Title,//$ic_seo_title
|
||
|
$seo_des,//$ic_seo_description
|
||
|
'',//$ic_seo_keywords
|
||
|
'',//$ic_show_bread_crumbs
|
||
|
1,//$ic_status
|
||
|
'',//$ic_template
|
||
|
'',//$ic_photo
|
||
|
'',//$ic_photo_width
|
||
|
'',//$ic_photo_height
|
||
|
'',//$ic_recommend_tours
|
||
|
'',//$ic_recommend_packages
|
||
|
'',//$ic_ht_area_id
|
||
|
'q',//$ic_ht_area_type
|
||
|
'',//$ic_ht_product_id
|
||
|
'',//$ic_ht_product_type
|
||
|
''//$ic_author
|
||
|
);
|
||
|
$this->InfoStructures_model->Add($insert_is_id, $this->InfoContents_model->insert_id);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
$this->rp($data['faq_type']);
|
||
|
$this->rp($data['faq_type_en']);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* 打印测试
|
||
|
*
|
||
|
*/
|
||
|
private function rp($array)
|
||
|
{
|
||
|
echo('<pre>'.print_r($array, true).'</pre>');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* 字符串转成URL形式.
|
||
|
*
|
||
|
* @param $str String
|
||
|
* @return String
|
||
|
*/
|
||
|
function parseToUrlString($str)
|
||
|
{
|
||
|
return mb_strtolower(trim(str_replace(" ", "-", $str)));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|