/** * 取栏目的路径 */ public function get_column_path() { $column_id = $this->input['column_id']; if (!$column_id) { $this->ReportError('ID为空'); } if (!class_exists('column')) { include ROOT_DIR . 'lib/class/column.class.php'; } $column = new column(); $ret['selected_ids'] = $column_id ? $column_id : ''; $ret['selected_items'] = $column->get_selected_column_path($ret['selected_ids']); if (is_array($ret['selected_items'])) { foreach ($ret['selected_items'] as $index => $item) { $hg_print_selected[$index] = array(); $current =& $hg_print_selected[$index]; $current['showName'] = ''; foreach ($item as $sub_item) { if ($sub_item['is_auth']) { $current['is_auth'] = 1; } $current['id'] = $sub_item['id']; $current['name'] = $sub_item['name']; if ($sub_item['fid'] == 0) { $current['showName'] .= $sub_item['name'] . ' > '; } else { $current['showName'] .= $sub_item['name'] . ' > '; } } $current['showName'] = substr($current['showName'], 0, -3); $selected_names[] = $current['name']; } } $ret['selected_items'] = $hg_print_selected; $ret['selected_names'] = isset($selected_names) ? implode(',', $selected_names) : ''; echo json_encode($ret); exit; }
public function show() { $column_id = $this->input['column_id']; $column = new column(); $publish = array(); $publish['sites'] = $column->getallsites(); list($default_site, $default_name) = each($publish['sites']); reset($publish['sites']); $publish['items'] = $column->getAuthoredColumns($default_site); $publish['selected_ids'] = $column_id ? $column_id : ''; $publish['selected_items'] = $column->get_selected_column_path($publish['selected_ids']); $publish['default_site'] = each($publish['sites']); $publish['pub_time'] = $this->input['pub_time']; $hg_print_selected = array(); foreach ($publish['selected_items'] as $index => $item) { $hg_print_selected[$index] = array(); $current =& $hg_print_selected[$index]; $current['showName'] = ''; foreach ($item as $sub_item) { if ($sub_item['is_auth']) { $current['is_auth'] = 1; } $current['id'] = $sub_item['id']; $current['name'] = $sub_item['name']; $current['showName'] .= $sub_item['name'] . ' > '; } if (!$current['is_auth']) { $current['is_auth'] = 0; } $current['showName'] = $publish['default_site']['value'] . ' > ' . substr($current['showName'], 0, -3); $selected_names[] = $current['name']; } $publish['selected_items'] = $hg_print_selected; $publish['selected_names'] = isset($selected_names) ? implode(',', $selected_names) : ''; echo json_encode($publish); }
</div> <?php define('FORMDATA', 0); if ((!isset($formdata) || !is_array($formdata)) && (defined('FORMDATA') && FORMDATA)) { } else { $item = $formdata; if (!class_exists('column')) { include_once ROOT_DIR . 'lib/class/column.class.php'; } $column = new column(); $publish = array(); $publish['sites'] = $column->getallsites(); list($default_site, $default_name) = each($publish['sites']); reset($publish['sites']); $publish['items'] = $column->getAuthoredColumns($default_site); $publish['selected_ids'] = $item['column_id'] ? $item['column_id'] : ''; $publish['selected_items'] = $column->get_selected_column_path($publish['selected_ids']); $publish['default_site'] = each($publish['sites']); $publish['pub_time'] = $item['pub_time']; $hg_print_selected = array(); foreach ($publish['selected_items'] as $index => $item) { $hg_print_selected[$index] = array(); $current =& $hg_print_selected[$index]; $current['showName'] = ''; foreach ($item as $sub_item) { if ($sub_item['is_auth']) { $current['is_auth'] = 1; } $current['id'] = $sub_item['id']; $current['name'] = $sub_item['name']; $current['showName'] .= $sub_item['name'] . ' > ';