Exemple #1
0
        if ($has_pic) {
            $cond['has_pic'] = 1;
        }
        $items = lz_page($item, $cond, intval($config['admin_item_page_size']) ? intval($config['admin_item_page_size']) : 20);
        for ($i = 0; $i < count($items); $i++) {
            $_c = $all_category[$items[$i]['category_id']];
            $items[$i]['category_name'] = $_c ? $_c : lang('DEFAULT_CATEGORY');
        }
        $view_data['categories'] = $categories;
        $view_data['items'] = $items;
        $view_data['page_description'] = lang('ITEM_LIST');
    }
}
$_tree = $category->tree_category(0);
$view_data['all_category'] = print_category_tree_link('admin.php?p=item&category_id=', $_tree, $category_id);
$view_data['category_tree'] = print_category_tree($category->tree_category(0, 1));
$view_data['real_content'] = "category_new.html";
$view_data['err_msg'] = $err_msg;
$view_data['success_msg'] = $success_msg;
$view_data['category_id'] = $category_id;
$view_data['position'] = $category->position_category($category_id);
//nav
$statuses = array();
foreach ($news_status as $key => $val) {
    $statuses[] = array('index' => $key, 'value' => $val);
}
$view_data['statuses'] = $statuses;
$view_data['current_status_all'] = isset($_GET['status']) ? false : true;
$view_data['status'] = $view_data['current_status_all'] ? '-1' : $status;
$view_data['has_pic'] = $has_pic;
$has_pic && ($view_data['current_status_all'] = false);
Exemple #2
0
     } else {
         $view_data['this_category'] = array('is_list' => true);
     }
     define('END_LOG_INFO', LANG_NAVI_ITEM . '&gt;' . $this_category['name']);
     define('END_LOG_URL', 'admin.php?p=item&category_id=' . $this_category['category_id']);
     $view_data['page_description'] = lang('ITEM_LIST');
 }
 //nav buttons
 if (isset($end_models[$item_type . '_list']['status'])) {
     $statuses = array();
     foreach ($end_models[$item_type . '_list']['status'] as $_key => $_val) {
         $statuses[] = array('index' => $_key, 'value' => $_val);
     }
     $view_data['statuses'] = $statuses;
 }
 $view_data['category_tree'] = print_category_tree($category->tree_category(array('status' => $this_category['status'])));
 $view_data['current_status_all'] = isset($_GET['status']) ? false : true;
 $view_data['err_msg'] = $err_msg;
 $view_data['success_msg'] = $success_msg;
 $view_data['status'] = $view_data['current_status_all'] ? '-999' : $status;
 $view_data['table'] = $item_type;
 $view_data['category_id'] = $category_id;
 if (file_exists(END_ROOT . 'end_www/model/' . $item_type . '/end_admin_item_list.html')) {
     $list_tmp = template('end_admin_item_list.html', END_ROOT . 'end_www/model/' . $item_type . '/');
 } else {
     $list_tmp = template('item_list.html');
 }
 $list_tmp->assign('item_model', $item);
 $list_tmp->assign('list_fields', $end_models[$item_type . '_list']['list_fields']);
 $list_tmp->assign($view_data);
 $view_data['list_content'] = $list_tmp->result();
Exemple #3
0
function print_category_tree($arr, $category_id = 0, $excluded = array(), $depth = 0)
{
    $re = '';
    if (!is_array($arr)) {
        return;
    }
    if ($excluded && !is_array($excluded)) {
        $excluded = array($excluded);
    }
    if ($depth > 100) {
        return;
    }
    foreach ($arr as $c) {
        if ($c['category_id'] && in_array($c['category_id'], $excluded)) {
            continue;
        }
        if ($c['status'] == 'folder' && END_CONTROLLER != 'category') {
            $re .= "<optgroup label='" . print_space($depth) . $c['name'] . "'>";
            $re .= print_category_tree($c['children'], $category_id, $excluded, $depth + 1);
            $re .= "</optgroup>";
        } else {
            $re .= "<option status='" . $c['status'] . "' value='" . $c['category_id'] . "' ";
            if ($category_id && $c['category_id'] == $category_id) {
                $re .= " selected='selected' ";
            }
            $re .= ">" . print_space($depth) . $c['name'] . "</option>\n";
            $re .= print_category_tree($c['children'], $category_id, $excluded, $depth + 1);
        }
    }
    return $re;
}
Exemple #4
0
function print_category_tree($arr, $category_id = 0, $depth = 0)
{
    $re = '';
    if (!is_array($arr)) {
        return;
    }
    foreach ($arr as $c) {
        $re .= "<option value='" . $c['category_id'] . "' ";
        if ($category_id && $c['category_id'] == $category_id) {
            $re .= " selected='selected' ";
        }
        $re .= ">" . print_space($depth) . $c['name'] . "</option>\n";
        $re .= print_category_tree($c['children'], $category_id, $depth + 1);
    }
    return $re;
}
Exemple #5
0
    }
    $temp->assign(array('content' => $__category, 'err_msg' => $err_msg, 'fields' => $end_models[$_category['status']]['category_fields'], 'category_id' => $category_id, 'login_user' => $_SESSION['login_user'], 'category_tree' => print_category_tree($category->tree_category(0), $_category['parent_id'], $category_id)));
    $view_data['page_description'] = lang('EDIT_CATEGORY');
    $view_data['page_content'] = $temp->result();
}
$view_data['this_category'] = $category->get_one($category_id);
if (!$action && !$m) {
    define('END_LOG_INFO', $category_id ? LANG_NAVI_CATEGORY . '&gt;' . $view_data['this_category']['name'] : LANG_NAVI_CATEGORY);
    define('END_LOG_URL', $category_id ? 'admin.php?p=category&category_id=' . $view_data['this_category']['category_id'] : 'admin.php?p=category');
}
//显示分类和项目列表
//$categories = $category->get_list( array('parent_id'=>$category_id) );
$_tree = $category->tree_category(0);
//$view_data['tree'] = $category->get_list(array('parent_id'=>0));
//$category->flat_tree($_tree,$view_data['tree']);
//$view_data['all_category'] = print_category_tree_link('admin.php?p=category&category_id=',$_tree,$category_id);
$view_data['category_tree'] = print_category_tree($_tree);
//$view_data['categories'] = $categories;
$view_data['page_description'] = lang('CATEGORIES_LIST');
$view_data['err_msg'] = $err_msg;
$view_data['success_msg'] = $success_msg;
$view_data['category_id'] = $category_id;
//$view_data['position'] = $category->position_category($category_id);
$view_data['end_models'] = $end_models;
//unset($view_data['position'][count($view_data['position'])-1]);
$view_data['statuses'] = $end_models;
function show_status($s)
{
    global $end_models;
    return $end_models[$s]['name'] ? $end_models[$s]['name'] : lang('unknown');
}