From: ikawhero Date: Fri, 12 Jan 2007 08:44:35 +0000 (+0000) Subject: Changes to the redirects. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c517d8f07ee47e78540625a39beacad126a698fd;p=moodle.git Changes to the redirects. --- diff --git a/user/profile/index.php b/user/profile/index.php index ac7a91d60d..affbd6bf9c 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -80,7 +80,7 @@ switch ($action) { exit; } $field->id = 0; - $field->datatype = $datatypes[$type]; + $field->datatype = $type; $field->categoryid = 0; } elseif (!($field = get_record('user_info_field', 'id', $id))) { redirect($redirect); @@ -102,26 +102,18 @@ switch ($action) { -/// Print the header -admin_externalpage_print_header($adminroot); /// Are we adding or editing a cateogory? if ( ($action == 'editcategory' )) { - if ($id == 0) { - $strheading = get_string('profilecreatenewcategory', 'admin'); - } else { - $strheading = get_string('profileeditcategory', 'admin', $category->name); - } - - print_heading($strheading); - + require_once('index_category_form.php'); $categoryform = new category_form(null, compact('category')); if ($categoryform->is_cancelled()) { - redirect($redirect, $strcancelled); + redirect($redirect); + exit; } else { if ($data = $categoryform->data_submitted()) { if ($data->id == 0) { @@ -137,27 +129,34 @@ if ( ($action == 'editcategory' )) { exit; } } - redirect($redirect, $strchangessaved); + redirect($redirect); + exit; + } else { + + if ($id == 0) { + $strheading = get_string('profilecreatenewcategory', 'admin'); + } else { + $strheading = get_string('profileeditcategory', 'admin', $category->name); + } + + /// Print the header + admin_externalpage_print_header($adminroot); + + print_heading($strheading); + $categoryform->display(); } } /// Are we adding or editing a field? } elseif ( $action == 'editfield' ) { - - if ($id == 0) { - $strheading = get_string('profilecreatenewfield', 'admin'); - } else { - $strheading = get_string('profileeditfield', 'admin', $field->name); - } - - print_heading($strheading); - + require_once('index_field_form.php'); $fieldform = new field_form(null, compact('field')); if ($fieldform->is_cancelled()) { - redirect($redirect, $strcancelled); + redirect($redirect); + exit; } else { if ($data = $fieldform->data_submitted()) { require_once($CFG->dirroot.'/user/profile/field/'.$field->datatype.'/field.class.php'); @@ -166,10 +165,23 @@ if ( ($action == 'editcategory' )) { if (!$formfield->edit_save($data)) { error('There was an error updating the database'); } else { - redirect($redirect, $strchangessaved); + redirect($redirect); + exit; } } else { + + if ($id == 0) { + $strheading = get_string('profilecreatenewfield', 'admin'); + } else { + $strheading = get_string('profileeditfield', 'admin', $field->name); + } + + /// Print the header + admin_externalpage_print_header($adminroot); + + print_heading($strheading); + $fieldform->display(); } } @@ -177,8 +189,11 @@ if ( ($action == 'editcategory' )) { /// Deleting a category that has fields in it, print confirm screen? } elseif ( ($action == 'deletecategory') and !$confirm ) { + /// Print the header + admin_externalpage_print_header($adminroot); + print_heading('profiledeletecategory', 'admin'); - + $fieldcount = count_records('user_info_field', 'categoryid', $id); echo '
'.get_string('profileconfirmcategorydeletion', 'admin', $fieldcount).'
'.get_string('yes').' '.get_string('no').'
'; @@ -186,6 +201,9 @@ if ( ($action == 'editcategory' )) { /// Deleting a field that has user data, print confirm screen } elseif ( ($action == 'deletefield') and !$confirm ) { + /// Print the header + admin_externalpage_print_header($adminroot); + print_heading('profiledeletefield', 'admin'); $datacount = count_records('user_info_data', 'fieldid', $id); @@ -196,6 +214,11 @@ if ( ($action == 'editcategory' )) { /// Print the table of categories and fields } else { + /// 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_select('user_info_category', '1') == 0) { unset($defaultcategory); @@ -204,8 +227,6 @@ if ( ($action == 'editcategory' )) { insert_record('user_info_category', $defaultcategory); } - print_heading(get_string('profilefields', 'admin')); - /// We only displaying if there are fields defined or there is a category with a name different to the default name if ( ( (count_records_select('user_info_category', "name<>'$strdefaultcategory'") > 0) or (count_records_select('user_info_field', '1') > 0) ) and