<?php
	require("__include-common.php");
	require("../account/__logincheck.php");
	require("../__common__/include-common-mp-list.php");

	$mp_list_arg = array();
	$mp_list_arg['account_id']	= $_SESSION['current_id'];
	$mp_list_arg['table_name_view']	= "m_category";
	$mp_list_arg['table_name_edit']	= "m_category";
	$mp_list_arg['id_item']		= "id_category";
	$mp_list_arg['must_item']	= "c_categoryName";
	$mp_list_arg['input_new']	= "no";
	$mp_list_arg['list_filter']	= "no";
	$mp_list_arg['list_edit_right_add_html']	= "../diary/in-block-image.php";
	if ($_SESSION['システム管理者'] == "YES") {
		$mp_list_arg['view_description']	= '※ アイコンファイルは、フォルダ「'.DIARY_MAPS_ICON_FOLDER .'」(<a href="../tools/file-manager.php?path='.urlencode(realpath(DIARY_MAPS_ICON_FOLDER)).'" target="_blank">'.realpath(DIARY_MAPS_ICON_FOLDER).'</a>)を使います。';
	}
	$item_tbl = array();
	$item_tbl[] = array(	"表示名"=>"id_account", "列名"=>"id_account",
				"type"=>"no_edit");
	$item_tbl[] = array(	"表示名"=>"id_category", "列名"=>"id_category",
				"type"=>"no_edit");
	$item_tbl[] = array(	"表示名"=>"分類", "列名"=>"c_categoryName",
				"type"=>"text", "size"=>24, "ime-mode"=>"active", "文字検索"=>"Y");
	$item_tbl[] = array(	"表示名"=>"表示順", "列名"=>"c_categoryDisplayOrder",
				"type"=>"text", "size"=>5, "ime-mode"=>"disabled", "toInt"=>"Y");
	$item_tbl[] = array(	"表示名"=>"アイコン", "列名"=>"c_categoryIcon",
				"イメージ表示列名"=>"c_categoryIcon",
				"type"=>"text", "size"=>30, "ime-mode"=>"disabled");
	$order_tbl = array();
	$order_tbl[] = array(	"表示名"=>"表示順", "get_order_name"=>"cate",
				"order_by"=>"c_categoryDisplayOrder asc");		/* default */
	$order_tbl[] = array(	"表示名"=>"分類名順", "get_order_name"=>"date",
				"order_by"=>"c_categoryName asc");
	$http_arg = array();
	$http_arg['pl'] = PAGE_LINE_DEFAULT;		// mp_list 必須
	$http_arg['sort'] = '';				// mp_list 必須
	$http_arg['cat'] = '';				// mp_list 必須
	$http_arg['key'] = '';				// mp_list 必須

	if (isset($_POST['登録'])) {
		check_post_account($_POST['login_id'], $_POST['current_id']);
		mp_list_update($mp_list_arg, $item_tbl, $order_tbl, $http_arg);
	} else {
		_GET_to_http_arg_pool($http_arg, $table_name);
		html_header(HTML_TITLE);
		page_header();
		contents_header();
		if ($_GET['edit'] == "y") {
			mp_list_edit($mp_list_arg, $item_tbl, $order_tbl, $http_arg);
		} else {
			mp_list_view($mp_list_arg, $item_tbl, $order_tbl, $http_arg);
		}
		page_footer();
		html_footer();
	}
	exit();
