Example #1
0
                $msg .= __('Module removed') . ': ' . $id . '<br />';
            } else {
                $msg .= __('Error occurred') . ': ' . $id . '<br />';
            }
        }
    }
    rcms_showAdminMessage($msg);
    unset($_REQUEST['edit']);
} elseif (!empty($_POST['newsave'])) {
    if (ucm_create($_POST['id'], $_POST['title'], $_POST['text'], $_POST['align'])) {
        rcms_showAdminMessage(__('Module created'));
    } else {
        rcms_showAdminMessage(__('Error occurred'));
    }
} elseif (!empty($_REQUEST['edit']) && !empty($_POST['save'])) {
    if (ucm_change($_REQUEST['edit'], $_POST['id'], $_POST['title'], $_POST['text'], $_POST['align'])) {
        rcms_showAdminMessage(__('Module updated'));
        $_REQUEST['edit'] = $_POST['id'];
    } else {
        rcms_showAdminMessage(__('Error occurred'));
    }
}
////////////////////////////////////////////////////////////////////////////////
// Interface generation                                                       //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['new'])) {
    $frm = new InputForm('', 'post', __('Submit'));
    $frm->addmessage('<a href="">&lt;&lt;&lt; ' . __('Back') . '</a>');
    $frm->addbreak(__('Create menu'));
    $frm->hidden('newsave', '1');
    $frm->addrow('<abbr title="' . __('Use only small Latin letters and digits') . '">' . __('MenuID') . '</abbr>', $frm->text_box('id', ''));
// Menus control                                                              //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['delete']) && is_array($_POST['delete'])) {
    $msg = '';
    $keys = array_keys($_POST['delete']);
    foreach ($keys as $key) {
        $res = ucm_delete($key);
        $msg .= $lang['results']['general'][$res] . '<br />';
    }
    rcms_showAdminMessage($msg);
    unset($_POST['edit']);
} elseif (!empty($_POST['newsave'])) {
    $res = ucm_create(@$_POST['id'], @$_POST['title'], @$_POST['text'], @$_POST['align']);
    rcms_showAdminMessage($lang['results']['general'][$res]);
} elseif (!empty($_POST['edit']) && !empty($_POST['save'])) {
    $res = ucm_change(@$_POST['edit'], @$_POST['id'], @$_POST['title'], @$_POST['text'], @$_POST['align']);
    rcms_showAdminMessage($lang['results']['general'][$res]);
    $_POST['edit'] = @$_POST['id'];
}
////////////////////////////////////////////////////////////////////////////////
// Interface generation                                                       //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['new'])) {
    $frm = new InputForm("", "post", $lang['general']['submit']);
    $frm->addmessage('<a href="">&lt;&lt;&lt; ' . $lang['general']['back'] . '</a>');
    $frm->addbreak($lang['admincp']['general']['ucm']['create']);
    $frm->hidden('newsave', '1');
    $frm->addrow('<abbr title="' . $lang['general']['ucm']['id_h'] . '">' . $lang['general']['ucm']['id'] . '</abbr>', $frm->text_box('id', ''));
    $frm->addrow('<abbr title="' . $lang['general']['ucm']['title_h'] . '">' . $lang['general']['ucm']['title'] . '</abbr>', $frm->text_box('title', ''));
    $frm->addrow($lang['general']['alignment'], $frm->select_tag('align', $lang['general']['align']));
    $frm->addrow($lang['general']['ucm']['text'] . '<br>' . $lang['general']['ucm']['text_h'], $frm->textarea('text', '', 70, 25), 'top');