$DB->insert_record('user_info_category', $defaultcategory);
    redirect($redirect);
}
// Print the header.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('profilefields', 'admin'));
foreach ($categories as $category) {
    $table = new html_table();
    $table->head = array(get_string('profilefield', 'admin'), get_string('edit'));
    $table->align = array('left', 'right');
    $table->width = '95%';
    $table->attributes['class'] = 'generaltable profilefield';
    $table->data = array();
    if ($fields = $DB->get_records('user_info_field', array('categoryid' => $category->id), 'sortorder ASC')) {
        foreach ($fields as $field) {
            $table->data[] = array(format_string($field->name), profile_field_icons($field));
        }
    }
    echo $OUTPUT->heading(format_string($category->name) . ' ' . profile_category_icons($category));
    if (count($table->data)) {
        echo html_writer::table($table);
    } else {
        echo $OUTPUT->notification($strnofields);
    }
}
// End of $categories foreach.
echo '<hr />';
echo '<div class="profileeditor">';
// Create a new field link.
$options = profile_list_datatypes();
$popupurl = new moodle_url('/user/profile/index.php?id=0&action=editfield');
Beispiel #2
0
    $defaultcategory->sortorder = 1;
    insert_record('user_info_category', $defaultcategory);
    redirect($redirect);
}
/// Show all categories
$categories = get_records_select('user_info_category', '', 'sortorder ASC');
foreach ($categories as $category) {
    $table = new object();
    $table->head = array(get_string('profilefield', 'admin'), get_string('edit'));
    $table->align = array('left', 'right');
    $table->width = '95%';
    $table->class = 'generaltable profilefield';
    $table->data = array();
    if ($fields = get_records_select('user_info_field', "categoryid={$category->id}", 'sortorder ASC')) {
        foreach ($fields as $field) {
            $table->data[] = array($field->name, profile_field_icons($field));
        }
    }
    print_heading(format_string($category->name) . ' ' . profile_category_icons($category));
    if (count($table->data)) {
        print_table($table);
    } else {
        notify($strnofields);
    }
}
/// End of $categories foreach
echo '<hr />';
echo '<div class="profileeditor">';
/// Create a new field link
$options = profile_list_datatypes();
popup_form($CFG->wwwroot . '/user/profile/index.php?id=0&amp;action=editfield&amp;datatype=', $options, 'newfieldform', '', 'choose', '', '', false, 'self', $strcreatefield);