Merge branch 'wip-MDL-45154-master' of git://github.com/marinaglancy/moodle

This commit is contained in:
Dan Poltawski 2014-04-18 09:57:21 +08:00
commit b67362cf98
2 changed files with 9 additions and 9 deletions

View File

@ -451,9 +451,9 @@ function profile_list_categories() {
* @param string $redirect
*/
function profile_edit_category($id, $redirect) {
global $DB, $OUTPUT;
global $DB, $OUTPUT, $CFG;
require_once('index_category_form.php');
require_once($CFG->dirroot.'/user/profile/index_category_form.php');
$categoryform = new category_form();
if ($category = $DB->get_record('user_info_category', array('id' => $id))) {
@ -515,7 +515,7 @@ function profile_edit_field($id, $datatype, $redirect) {
$field->description = clean_text($field->description, $field->descriptionformat);
$field->description = array('text' => $field->description, 'format' => $field->descriptionformat, 'itemid' => 0);
require_once('index_field_form.php');
require_once($CFG->dirroot.'/user/profile/index_field_form.php');
$fieldform = new field_form(null, $field->datatype);
// Convert the data format for.

View File

@ -108,12 +108,11 @@ switch ($action) {
// Normal form.
}
// Print the header.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('profilefields', 'admin'));
// Show all categories.
$categories = $DB->get_records('user_info_category', null, 'sortorder ASC');
// Check that we have at least one category defined.
if ($DB->count_records('user_info_category') == 0) {
if (empty($categories)) {
$defaultcategory = new stdClass();
$defaultcategory->name = $strdefaultcategory;
$defaultcategory->sortorder = 1;
@ -121,8 +120,9 @@ if ($DB->count_records('user_info_category') == 0) {
redirect($redirect);
}
// Show all categories.
$categories = $DB->get_records('user_info_category', null, 'sortorder ASC');
// Print the header.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('profilefields', 'admin'));
foreach ($categories as $category) {
$table = new html_table();