예제 #1
0
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $box_conf = "_" . strtoupper($pi_name) . "_CONF";
    global ${$box_conf};
    $box_conf = ${$box_conf};
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $lang_box_noyes = "LANG_" . strtoupper($pi_name) . "_NOYES";
    global ${$lang_box_noyes};
    $lang_box_noyes = ${$lang_box_noyes};
    $lang_box_type = "LANG_" . strtoupper($pi_name) . "_TYPE";
    global ${$lang_box_type};
    $lang_box_type = ${$lang_box_type};
    $lang_box_allow_display = "LANG_" . strtoupper($pi_name) . "_ALLOW_DISPLAY";
    global ${$lang_box_allow_display};
    $lang_box_allow_display = ${$lang_box_allow_display};
    $lang_box_allow_edit = "LANG_" . strtoupper($pi_name) . "_ALLOW_EDIT";
    global ${$lang_box_allow_edit};
    $lang_box_allow_edit = ${$lang_box_allow_edit};
    $lang_box_textcheck = "LANG_" . strtoupper($pi_name) . "_TEXTCHECK";
    global ${$lang_box_textcheck};
    $lang_box_textcheck = ${$lang_box_textcheck};
    $lang_box_textconv = "LANG_" . strtoupper($pi_name) . "_TEXTCONV";
    global ${$lang_box_textconv};
    $lang_box_textconv = ${$lang_box_textconv};
    $table = $_TABLES[strtoupper($pi_name) . '_def_field'];
    //        $cur_year = date( 'Y' );
    //        $year_startoffset=1990 - $cur_year +1;
    //        $year_endoffset=0;
    $retval = '';
    $delflg = false;
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $name = COM_applyFilter($_POST['name']);
        $templatesetvar = COM_applyFilter($_POST['templatesetvar']);
        $type = COM_applyFilter($_POST['type']);
        $description = COM_applyFilter($_POST['description']);
        $allow_display = COM_applyFilter($_POST['allow_display'], true);
        $allow_edit = COM_applyFilter($_POST['allow_edit'], true);
        $textcheck = COM_applyFilter($_POST['textcheck'], true);
        $textconv = COM_applyFilter($_POST['textconv'], true);
        $searchtarget = COM_applyFilter($_POST['searchtarget'], true);
        $initial_value = COM_applyFilter($_POST['initial_value']);
        $range_start = COM_applyFilter($_POST['range_start']);
        $range_end = COM_applyFilter($_POST['range_end']);
        $dfid = COM_applyFilter($_POST['dfid'], true);
        $selection = COM_applyFilter($_POST['selection']);
        $selectlist = COM_applyFilter($_POST['selectlist']);
        $checkrequried = COM_applyFilter($_POST['checkrequried']);
        $size = COM_applyFilter($_POST['size'], true);
        $maxlength = COM_applyFilter($_POST['maxlength'], true);
        $rows = COM_applyFilter($_POST['rows'], true);
        $br = COM_applyFilter($_POST['br'], true);
        $orderno = COM_applyFilter($_POST['orderno']);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $name = "";
            $templatesetvar = "";
            $description = "";
            $allow_display = "";
            $allow_edit = "";
            $textcheck = "";
            $textconv = "";
            $searchtarget = "";
            $initial_value = "";
            $range_start = "";
            $range_end = "";
            $dfid = 0;
            $type = "";
            $selection = "";
            $selectlist = "";
            $checkrequried = "";
            $size = 60;
            $maxlength = 500;
            $rows = 3;
            $br = 0;
            $orderno = "";
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " ,UNIX_TIMESTAMP(udatetime) AS udatetime_un" . LB;
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " field_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $name = COM_stripslashes($A['name']);
            $templatesetvar = COM_stripslashes($A['templatesetvar']);
            $description = $A['description'];
            //COM_stripslashes($A['description']);
            $allow_edit = COM_stripslashes($A['allow_edit']);
            $allow_display = COM_stripslashes($A['allow_display']);
            $textcheck = COM_stripslashes($A['textcheck']);
            $textconv = COM_stripslashes($A['textconv']);
            $searchtarget = COM_stripslashes($A['searchtarget']);
            $initial_value = COM_stripslashes($A['initial_value']);
            $range_start = COM_stripslashes($A['range_start']);
            $range_end = COM_stripslashes($A['range_end']);
            $dfid = COM_stripslashes($A['dfid']);
            $type = COM_stripslashes($A['type']);
            $selection = COM_stripslashes($A['selection']);
            $selectlist = COM_stripslashes($A['selectlist']);
            $checkrequried = COM_stripslashes($A['checkrequried']);
            $size = COM_stripslashes($A['size']);
            $maxlength = COM_stripslashes($A['maxlength']);
            $rows = COM_stripslashes($A['rows']);
            $br = COM_stripslashes($A['br']);
            $orderno = COM_stripslashes($A['orderno']);
            $uuid = COM_stripslashes($A['uuid']);
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un']));
            $udatetime = $wary[0];
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        //
        $delflg = false;
    }
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "field_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_field']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_field_id', $lang_box_admin['field_id']);
    $templates->set_var('id', $id);
    //document link
    $lang = COM_getLanguageName();
    $path = 'admin/plugins/' . strtolower($pi_name) . '/docs/';
    if (!file_exists($_CONF['path_html'] . $path . $lang . '/')) {
        $lang = 'japanese';
        //'english';
    }
    $document_url = $_CONF['site_url'] . '/' . $path . $lang . '/';
    $templates->set_var('document_url', $document_url);
    $templates->set_var('lang_document', $LANG_DATABOX_ADMIN['document']);
    //名前&テンプレート変数&説明
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_templatesetvar', $lang_box_admin['templatesetvar']);
    $templates->set_var('templatesetvar', $templatesetvar);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    $templates->set_var('lang_allow_display', $lang_box_admin['allow_display']);
    $list_allow_display = DATABOX_getoptionlistary($lang_box_allow_display, "allow_display", $allow_display, $pi_name);
    $templates->set_var('list_allow_display', $list_allow_display);
    $templates->set_var('lang_allow_edit', $lang_box_admin['allow_edit']);
    $list_allow_edit = DATABOX_getoptionlistary($lang_box_allow_edit, "allow_edit", $allow_edit, $pi_name);
    $templates->set_var('list_allow_edit', $list_allow_edit);
    //textcheck
    $templates->set_var('lang_textcheck', $lang_box_admin['textcheck']);
    $list_textcheck = DATABOX_getoptionlistary($lang_box_textcheck, "textcheck", $textcheck, $pi_name);
    $templates->set_var('list_textcheck', $list_textcheck);
    //textconv
    $templates->set_var('lang_textconv', $lang_box_admin['textconv']);
    $list_textconv = DATABOX_getoptionlistary($lang_box_textconv, "textconv", $textconv, $pi_name);
    $templates->set_var('list_textconv', $list_textconv);
    //searchtarget
    $templates->set_var('lang_searchtarget', $lang_box_admin['searchtarget']);
    $list_searchtarget = DATABOX_getradiolist($lang_box_noyes, "searchtarget", $searchtarget);
    $templates->set_var('list_searchtarget', $list_searchtarget);
    //初期値 範囲 日時フォーマット initial value range dfid
    $templates->set_var('lang_initial_value', $lang_box_admin['initial_value']);
    $templates->set_var('help_initial_value', $lang_box_admin['help_initial_value']);
    $templates->set_var('initial_value', $initial_value);
    $templates->set_var('lang_range', $lang_box_admin['range']);
    $templates->set_var('help_range', $lang_box_admin['help_range']);
    $templates->set_var('range_start', $range_start);
    $templates->set_var('range_end', $range_end);
    $templates->set_var('lang_dfid', $lang_box_admin['dfid']);
    $templates->set_var('help_dfid', $lang_box_admin['help_dfid']);
    //$list_dfid=DATABOX_getoptionlistary ($lang_box_textcheck,"textcheck",$textcheck,$pi_name);
    $list_dfid = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', $dfid) . '</select>';
    $templates->set_var('list_dfid', $list_dfid);
    //type
    $templates->set_var('lang_type', $lang_box_admin['type']);
    $list_type = DATABOX_getoptionlistary($lang_box_type, "type", $type, $pi_name);
    $templates->set_var('list_type', $list_type);
    //checkrequried
    $templates->set_var('lang_checkrequried', $lang_box_admin['checkrequried']);
    $list_checkrequried = DATABOX_getradiolist($lang_box_noyes, "checkrequried", $checkrequried);
    $templates->set_var('list_checkrequried', $list_checkrequried);
    //size maxlength rows br
    $templates->set_var('lang_size', $lang_box_admin['size']);
    $templates->set_var('size', $size);
    $templates->set_var('lang_maxlength', $lang_box_admin['maxlength']);
    $templates->set_var('maxlength', $maxlength);
    $templates->set_var('lang_rows', $lang_box_admin['rows']);
    $templates->set_var('rows', $rows);
    $templates->set_var('lang_br', $lang_box_admin['br']);
    $templates->set_var('help_br', $lang_box_admin['help_br']);
    $templates->set_var('br', $br);
    //selection
    $templates->set_var('lang_selection', $lang_box_admin['selection']);
    $templates->set_var('selection', $selection);
    //selectlist
    $templates->set_var('lang_selectlist', $lang_box_admin['selectlist']);
    $list_selectlist = DATABOX_getoptionlist("selectlist", $selectlist, 0, $pi_name);
    $templates->set_var('list_selectlist', $list_selectlist);
    //順序
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        //
        $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_field']);
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    return $retval;
}
예제 #2
0
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $lang_box_noyes = "LANG_" . strtoupper($pi_name) . "_NOYES";
    global ${$lang_box_noyes};
    $lang_box_noyes = ${$lang_box_noyes};
    $lang_box_inputtype = "LANG_" . strtoupper($pi_name) . "_INPUTTYPE";
    global ${$lang_box_inputtype};
    $lang_box_inputtype = ${$lang_box_inputtype};
    $table = $_TABLES[strtoupper($pi_name) . '_def_group'];
    $table1 = $_TABLES[strtoupper($pi_name) . '_def_category'];
    $table2 = $_TABLES[strtoupper($pi_name) . '_def_field'];
    //        $cur_year = date( 'Y' );
    //        $year_startoffset=1990 - $cur_year +1;
    //        $year_endoffset=0;
    $retval = '';
    $delflg = false;
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $code = COM_applyFilter($_POST['code']);
        $name = COM_applyFilter($_POST['name']);
        $description = $_POST['description'];
        //COM_applyFilter($_POST['description']);
        $orderno = COM_applyFilter($_POST['orderno']);
        $parent_flg = COM_applyFilter($_POST['parent_flg'], true);
        $input_type = COM_applyFilter($_POST['input_type'], true);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $code = "";
            $name = "";
            $description = "";
            $orderno = "";
            $parent_flg = 0;
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " ,UNIX_TIMESTAMP(udatetime) AS udatetime_un" . LB;
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " group_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $code = COM_stripslashes($A['code']);
            $name = COM_stripslashes($A['name']);
            $description = COM_stripslashes($A['description']);
            $orderno = COM_stripslashes($A['orderno']);
            $parent_flg = COM_stripslashes($A['parent_flg']);
            $input_type = COM_stripslashes($A['input_type']);
            $uuid = COM_stripslashes($A['uuid']);
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un']));
            $udatetime = $wary[0];
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        $created_month = 0;
        $created_day = 0;
        $created_year = 0;
        $created_hour = 0;
        $created_minute = 0;
        //
        $delflg = false;
    }
    $retval .= COM_startBlock($lang_box_admin['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "group_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_group']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_group_id', $lang_box_admin['group_id']);
    $templates->set_var('id', $id);
    //コード、名前&説明
    $templates->set_var('lang_code', $lang_box_admin['code']);
    $templates->set_var('code', $code);
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    //順番
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //親ブループ?
    $templates->set_var('lang_parent_flg', $lang_box_admin['parent_flg']);
    $list_parent_flg = DATABOX_getradiolist($lang_box_noyes, "parent_flg", $parent_flg);
    $templates->set_var('list_parent_flg', $list_parent_flg);
    //入力タイプ
    $templates->set_var('lang_input_type', $lang_box_admin['input_type']);
    $list_input_type = DATABOX_getradiolist($lang_box_inputtype, "input_type", $input_type);
    $templates->set_var('list_input_type', $list_input_type);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $wkcnt = DB_count($table1, "categorygroup_id", $id);
        if ($wkcnt > 0) {
            $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_group']);
        } else {
            $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
            $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
            $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        }
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
예제 #3
0
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $box_conf = "_" . strtoupper($pi_name) . "_CONF";
    global ${$box_conf};
    $box_conf = ${$box_conf};
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $lang_box_noyes = "LANG_" . strtoupper($pi_name) . "_NOYES";
    global ${$lang_box_noyes};
    $lang_box_noyes = ${$lang_box_noyes};
    $lang_box_type = "LANG_" . strtoupper($pi_name) . "_TYPE";
    global ${$lang_box_type};
    $lang_box_type = ${$lang_box_type};
    $lang_box_allow_display = "LANG_" . strtoupper($pi_name) . "_ALLOW_DISPLAY";
    global ${$lang_box_allow_display};
    $lang_box_allow_display = ${$lang_box_allow_display};
    $lang_box_allow_edit = "LANG_" . strtoupper($pi_name) . "_ALLOW_EDIT";
    global ${$lang_box_allow_edit};
    $lang_box_allow_edit = ${$lang_box_allow_edit};
    $table = $_TABLES[strtoupper($pi_name) . '_def_field'];
    //        $cur_year = date( 'Y' );
    //        $year_startoffset=1990 - $cur_year +1;
    //        $year_endoffset=0;
    $retval = '';
    $delflg = false;
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $name = COM_applyFilter($_POST['name']);
        $templatesetvar = COM_applyFilter($_POST['templatesetvar']);
        $fieldgroup_id = COM_applyFilter($_POST['group'], true);
        $type = COM_applyFilter($_POST['type']);
        $description = COM_applyFilter($_POST['description']);
        $allow_display = COM_applyFilter($_POST['allow_display'], true);
        $allow_edit = COM_applyFilter($_POST['allow_edit'], true);
        $selection = COM_applyFilter($_POST['selection']);
        $selectlist = COM_applyFilter($_POST['selectlist']);
        $checkrequried = COM_applyFilter($_POST['checkrequried']);
        $size = COM_applyFilter($_POST['size'], true);
        $maxlength = COM_applyFilter($_POST['maxlength'], true);
        $rows = COM_applyFilter($_POST['rows'], true);
        $orderno = COM_applyFilter($_POST['orderno']);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $name = "";
            $templatesetvar = "";
            $description = "";
            $allow_display = "";
            $allow_edit = "";
            $type = "";
            $selection = "";
            $selectlist = "";
            $checkrequried = "";
            $size = 60;
            $maxlength = 160;
            $rows = 2;
            $br = 0;
            $fieldgroup_id = "";
            $orderno = "";
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " field_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $name = COM_stripslashes($A['name']);
            $templatesetvar = COM_stripslashes($A['templatesetvar']);
            $description = $A['description'];
            //COM_stripslashes($A['description']);
            $allow_edit = COM_stripslashes($A['allow_edit']);
            $allow_display = COM_stripslashes($A['allow_display']);
            $type = COM_stripslashes($A['type']);
            $fieldgroup_id = COM_stripslashes($A['fieldgroup_id']);
            $selection = COM_stripslashes($A['selection']);
            $selectlist = COM_stripslashes($A['selectlist']);
            $checkrequried = COM_stripslashes($A['checkrequried']);
            $br = COM_stripslashes($A['br']);
            $size = COM_stripslashes($A['size']);
            $maxlength = COM_stripslashes($A['maxlength']);
            $rows = COM_stripslashes($A['rows']);
            $br = COM_stripslashes($A['br']);
            $orderno = COM_stripslashes($A['orderno']);
            $uuid = COM_stripslashes($A['uuid']);
            $udatetime = COM_stripslashes($A['udatetime']);
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        $created_month = 0;
        $created_day = 0;
        $created_year = 0;
        $created_hour = 0;
        $created_minute = 0;
        //
        $delflg = false;
    }
    $retval .= COM_startBlock($lang_box_admin['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "field_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_field']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_field_id', $lang_box_admin['field_id']);
    $templates->set_var('id', $id);
    //名前&テンプレート変数&説明
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_templatesetvar', $lang_box_admin['templatesetvar']);
    $templates->set_var('templatesetvar', $templatesetvar);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    $templates->set_var('lang_allow_display', $lang_box_admin['allow_display']);
    $list_allow_display = DATABOX_getradiolist($lang_box_allow_display, "allow_display", $allow_display, "<br/>");
    $templates->set_var('list_allow_display', $list_allow_display);
    $templates->set_var('lang_allow_edit', $lang_box_admin['allow_edit']);
    $list_allow_edit = DATABOX_getradiolist($lang_box_allow_edit, "allow_edit", $allow_edit, "<br/>");
    $templates->set_var('list_allow_edit', $list_allow_edit);
    //type
    $templates->set_var('lang_type', $lang_box_admin['type']);
    $list_type = DATABOX_getradiolist($lang_box_type, "type", $type, "<br/>");
    $templates->set_var('list_type', $list_type);
    //checkrequried
    $templates->set_var('lang_checkrequried', $lang_box_admin['checkrequried']);
    $list_checkrequried = DATABOX_getradiolist($lang_box_noyes, "checkrequried", $checkrequried);
    $templates->set_var('list_checkrequried', $list_checkrequried);
    //size maxlength rows br
    $templates->set_var('lang_size', $lang_box_admin['size']);
    $templates->set_var('size', $size);
    $templates->set_var('lang_maxlength', $lang_box_admin['maxlength']);
    $templates->set_var('maxlength', $maxlength);
    $templates->set_var('lang_rows', $lang_box_admin['rows']);
    $templates->set_var('rows', $rows);
    $templates->set_var('lang_br', $lang_box_admin['br']);
    $list_br = DATABOX_getradiolist($lang_box_noyes, "br", $br);
    $templates->set_var('list_br', $list_br);
    //selection
    $templates->set_var('lang_selection', $lang_box_admin['selection']);
    $templates->set_var('selection', $selection);
    //selectlist
    $templates->set_var('lang_selectlist', $lang_box_admin['selectlist']);
    $list_selectlist = DATABOX_getoptionlist("selectlist", $selectlist, 0, $pi_name);
    $templates->set_var('list_selectlist', $list_selectlist);
    //group
    $templates->set_var('lang_group', $lang_box_admin['group']);
    $list_group = DATABOX_getoptionlist("group", $fieldgroup_id, 0, $pi_name, "", 0);
    $templates->set_var('list_group', $list_group);
    //順序
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        //
        $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_field']);
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}