Exemplo n.º 1
0
if (empty($_REQUEST['modfunc'])) {
    $sql = "SELECT NULL AS REMOVE,du.ID AS USAGE_ID,df.ID,COALESCE(du.TITLE,df.TITLE) AS TITLE,du.SORT_ORDER,df.DATA_TYPE,du.SELECT_OPTIONS FROM DISCIPLINE_FIELDS df LEFT OUTER JOIN DISCIPLINE_FIELD_USAGE du ON (du.DISCIPLINE_FIELD_ID=df.ID AND du.SYEAR='" . UserSyear() . "' AND du.SCHOOL_ID='" . UserSchool() . "') ORDER BY du.ID,du.SORT_ORDER";
    $QI = DBQuery($sql);
    $referrals_RET = DBGet($QI, array('REMOVE' => '_makeRemove', 'TITLE' => '_makeTextInput', 'SORT_ORDER' => '_makeTextInput', 'DATA_TYPE' => '_makeType', 'SELECT_OPTIONS' => '_makeTextAreaInput'));
    foreach ($referrals_RET as $key => $item) {
        if (!$item['USAGE_ID']) {
            $referrals_RET[$key]['row_color'] = 'CCCCCC';
        }
    }
    if (count($referrals_RET)) {
        $columns = array('REMOVE' => '');
    } else {
        $columns = array();
    }
    $columns += array('TITLE' => _('Title'), 'SORT_ORDER' => _('Sort Order'), 'DATA_TYPE' => _('Data Type'), 'SELECT_OPTIONS' => _('Pull-Down') . '/' . _('Select Multiple from Options') . '/' . _('Select One from Options'));
    $link['add']['html'] = array('REMOVE' => button('add'), 'TITLE' => _makeTextInput('', 'TITLE'), 'SORT_ORDER' => _makeTextInput('', 'SORT_ORDER'), 'SELECT_OPTIONS' => _makeTextAreaInput('', 'SELECT_OPTIONS'), 'DATA_TYPE' => _makeType('', 'DATA_TYPE'));
    echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST">';
    DrawHeader('', SubmitButton(_('Save')));
    //modif Francois: fix SQL bug invalid sort order
    if (isset($error)) {
        echo $error;
    }
    ListOutput($referrals_RET, $columns, 'Referral Form Category', 'Referral Form Categories', $link);
    echo '<span class="center">' . SubmitButton(_('Save')) . '</span>';
    echo '</FORM>';
}
function _makeType($value, $name)
{
    global $THIS_RET;
    if ($THIS_RET['USAGE_ID']) {
        $id = $THIS_RET['USAGE_ID'];
Exemplo n.º 2
0
}
if ($_REQUEST['modfunc'] == 'delete' && AllowEdit()) {
    if (DeletePrompt(_('Category'))) {
        $id = $_REQUEST['id'];
        DBQuery("DELETE FROM DISCIPLINE_CATEGORIES WHERE ID='{$id}'");
        DBQuery("ALTER TABLE DISCIPLINE_REFERRALS DROP COLUMN CATEGORY_{$id}");
        unset($_REQUEST['modfunc']);
        unset($_REQUEST['id']);
    }
}
if (empty($_REQUEST['modfunc'])) {
    $sql = "SELECT ID,TITLE,SORT_ORDER,TYPE,OPTIONS FROM DISCIPLINE_CATEGORIES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY SORT_ORDER";
    $QI = DBQuery($sql);
    $referrals_RET = DBGet($QI, array('TITLE' => '_makeTextInput', 'SORT_ORDER' => '_makeTextInput', 'TYPE' => '_makeType', 'OPTIONS' => '_makeTextAreaInput'));
    $columns = array('TITLE' => _('Title'), 'SORT_ORDER' => _('Sort Order'), 'TYPE' => _('Data Type'), 'OPTIONS' => _('Options'));
    $link['add']['html'] = array('TITLE' => _makeTextInput('', 'TITLE'), 'SORT_ORDER' => _makeTextInput('', 'SORT_ORDER'), 'OPTIONS' => _makeTextAreaInput('', 'OPTIONS'), 'TYPE' => _makeType('', 'TYPE'));
    if (AllowEdit()) {
        $link['remove']['link'] = "Modules.php?modname={$_REQUEST['modname']}&modfunc=delete";
        $link['remove']['variables'] = array('id' => 'ID');
    }
    echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST">';
    DrawHeader('', SubmitButton(_('Save')));
    ListOutput($referrals_RET, $columns, 'Referral Form Category', 'Referral Form Categories', $link);
    echo '<span class="center">' . SubmitButton(_('Save')) . '</span>';
    echo '</FORM>';
}
function _makeType($value, $name)
{
    global $THIS_RET;
    if ($THIS_RET['ID']) {
        $id = $THIS_RET['ID'];