コード例 #1
0
        $editor = new editor('entry_type', $_SERVER['PHP_SELF'] . '?editor=1', $id);
        $editor->setHeading(__('Change entrytype'));
        $editor->setSubmitTxt(__('Change'));
    }
    $editor->setDBFieldID('entry_type_id');
    $editor->showID(TRUE);
    $editor->makeNewField('entry_type_name', __('Entrytype name'), 'text');
    $editor->makeNewField('entry_type_name_short', __('Short entrytype name'), 'text');
    $editor->makeNewField('resourcenum_length', _h('Length of resource number') . '<br />(' . _h('If zero, resource number will not be required') . ')', 'text');
    $editor->makeNewField('entry_type_inactive', _l('Inactive'), 'select');
    $editor->addChoice('entry_type_inactive', 0, _l('No'));
    $editor->addChoice('entry_type_inactive', 1, _l('Yes'));
    $editor->getDB();
    if (isset($_POST['editor_submit'])) {
        if ($editor->input($_POST)) {
            if ($editor->performDBquery()) {
                // Redirect
                header('Location: admin_entry_type.php');
                exit;
            } else {
                echo 'Error occured while performing query on database:<br>' . chr(10), exit;
            }
        }
    }
    include "include/admin_middel.php";
    $editor->printEditor();
} elseif (isset($_GET['entry_type_id']) && isset($_GET['area_id'])) {
    $entry_type = getEntryType($_GET['entry_type_id']);
    if (!count($entry_type)) {
        echo 'Finner ikke typen.';
        exit;