echo $OUTPUT->heading($strheading);
        $formcontinue = new single_button(new moodle_url($redirect, $optionsyes), get_string('yes'), 'post');
        $formcancel = new single_button(new moodle_url($redirect), get_string('no'), 'get');
        echo $OUTPUT->confirm(get_string('profileconfirmfielddeletion', 'admin', $datacount), $formcontinue, $formcancel);
        echo $OUTPUT->footer();
        die;
        break;
    case 'editfield':
        $id = optional_param('id', 0, PARAM_INT);
        $datatype = optional_param('datatype', '', PARAM_ALPHA);
        profile_edit_field($id, $datatype, $redirect);
        die;
        break;
    case 'editcategory':
        $id = optional_param('id', 0, PARAM_INT);
        profile_edit_category($id, $redirect);
        die;
        break;
    default:
        // Normal form.
}
// Show all categories.
$categories = $DB->get_records('user_info_category', null, 'sortorder ASC');
// Check that we have at least one category defined.
if (empty($categories)) {
    $defaultcategory = new stdClass();
    $defaultcategory->name = $strdefaultcategory;
    $defaultcategory->sortorder = 1;
    $DB->insert_record('user_info_category', $defaultcategory);
    redirect($redirect);
}
Beispiel #2
0
        $optionsyes = array('id' => $id, 'confirm' => 1, 'action' => 'deletefield', 'sesskey' => sesskey());
        admin_externalpage_print_header($adminroot);
        print_heading('profiledeletefield', 'admin');
        notice_yesno(get_string('profileconfirmfielddeletion', 'admin', $datacount), $redirect, $redirect, $optionsyes, null, 'post', 'get');
        admin_externalpage_print_footer($adminroot);
        die;
        break;
    case 'editfield':
        $id = optional_param('id', 0, PARAM_INT);
        $datatype = optional_param('datatype', '', PARAM_ALPHA);
        profile_edit_field($id, $datatype, $redirect, $adminroot);
        die;
        break;
    case 'editcategory':
        $id = optional_param('id', 0, PARAM_INT);
        profile_edit_category($id, $redirect, $adminroot);
        die;
        break;
    default:
        //normal form
}
/// Print the header
admin_externalpage_print_header($adminroot);
print_heading(get_string('profilefields', 'admin'));
/// Check that we have at least one category defined
if (count_records('user_info_category') == 0) {
    $defaultcategory = new object();
    $defaultcategory->name = $strdefaultcategory;
    $defaultcategory->sortorder = 1;
    insert_record('user_info_category', $defaultcategory);
    redirect($redirect);