diff --git a/application/models/information_model.php b/application/models/information_model.php index 876a5b86..6bd87480 100644 --- a/application/models/information_model.php +++ b/application/models/information_model.php @@ -144,30 +144,66 @@ class Information_model extends CI_Model { */ function get_path_exclude_self($is_id, $path) { $site_code = $this->config->item('site_code'); - $path_query = $this->HT->query("select ic_id, is_id, ic_url,ic_url_title,ic_title,is_path + $path_query = $this->HT->query("select + ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status from infoStructures a inner join infoContents b on a.is_ic_id=b.ic_id where is_id in ($path 0) and is_id <> ? and is_siteCode = ? order by is_level asc", array($is_id, $site_code)); $path_result = $path_query->result(); $path_list = []; + $group_map = [ + 278008010 => [ + 'ic_url' => '/travelguide/culture/', + 'ic_url_title' => 'Chinese Culture' + ], + 278008011 => [ + 'ic_url' => '/travelguide/', + 'ic_url_title' => 'Travel Guide' + ], + 278008012 => [ + 'ic_url' => '/aboutus/', + 'ic_url_title' => 'About Us' + ], + 278008013 => [ + 'ic_url' => '/citytour/', + 'ic_url_title' => 'City Tours' + ], + 278008014 => [ + 'ic_url' => '/tour/', + 'ic_url_title' => 'China Tours' + ] + ]; + foreach ($path_result as $path_row) { $ic_url = $path_row->ic_url; $ic_url_title = $path_row->ic_url_title; - if ($path_row->is_id === 278008010) { - $ic_url = '/inspiration'; - $ic_url_title = 'inspiration title'; + if ($path_row->is_level === 0) { + if (array_key_exists($path_row->ic_id, $group_map)) { + $top_group = $group_map[$path_row->ic_id]; + + $path_array = [ + 'ic_id' => $path_row->ic_id, + 'is_id' => $path_row->is_id, + 'ic_title' => $path_row->ic_title, + 'ic_url' => $top_group['ic_url'], + 'ic_url_title' => $top_group['ic_url_title'] + ]; + $path_list[] = $path_array; + } + } else if ($path_row->ic_status === 1) { + + $path_array = [ + 'ic_id' => $path_row->ic_id, + 'is_id' => $path_row->is_id, + 'ic_title' => $path_row->ic_title, + 'ic_url' => $path_row->ic_url, + 'ic_url_title' => $path_row->ic_url_title + ]; + $path_list[] = $path_array; + } - - $path_array = [ - 'ic_id' => $path_row->ic_id, - 'is_id' => $path_row->is_id, - 'ic_title' => $path_row->ic_title, - 'ic_url' => $ic_url, - 'ic_url_title' => $ic_url_title - ]; - $path_list[] = $path_array; } return $path_list;