// 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'); echo $OUTPUT->single_select($popupurl, 'datatype', $options, '', array('' => $strcreatefield), 'newfieldform'); // Add a div with a class so themers can hide, style or reposition the text. html_writer::start_tag('div', array('class' => 'adminuseractionhint'));
} /// 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&action=editfield&datatype=', $options, 'newfieldform', '', 'choose', '', '', false, 'self', $strcreatefield); /// Create a new category link $options = array('action' => 'editcategory'); print_single_button('index.php', $options, get_string('profilecreatecategory', 'admin'));