Changeset 872
- Timestamp:
- 01/26/07 12:00:16 (2 years ago)
- Files:
-
- devel/profile/edit.php (modified) (3 diffs)
- devel/units/profile/function_actions.php (deleted)
- devel/units/profile/main.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/profile/edit.php
r868 r872 61 61 if (count($profiledetails) > 0) { 62 62 delete_records('profile_data','owner',$page_owner); 63 64 $insertvalues = array(); 65 $requiredmissing = array(); 66 63 67 foreach($profiledetails as $field => $value) { 64 68 $field = trim($field); 65 69 $value = trim($value); 66 70 67 71 if ($value != "") { 68 72 //TODO get rid of variable duplication here. (Penny) … … 75 79 $pd->owner = $page_owner; 76 80 77 $insert_id = insert_record('profile_data',$pd); 81 // $insert_id = insert_record('profile_data',$pd); 82 $insertvalues[] = $pd; 83 84 } else { 85 foreach($data['profile:details'] as $datatype) { 86 if (is_array($datatype)) { 87 $fname = !empty($datatype[1]) ? $datatype[1] : ''; 88 $flabel = !empty($field[0]) ? $field[0] : ''; 89 $frequired = false; 90 // Otherwise map things the new way! 91 } else { 92 $fname = $datatype->internal_name; 93 $flabel = $datatype->name; 94 $frequired = $datatype->required; 95 } 96 if ($fname == $field && $frequired == true) { 97 $requiredmissing[] = $flabel; 98 } 99 } 100 78 101 } 79 80 81 if (is_array($datatype)) { 82 $flabel = !empty($datatype[0]) ? $datatype[0] : ''; 83 $fname = !empty($datatype[1]) ? $datatype[1] : ''; 84 $ftype = !empty($datatype[2]) ? $datatype[2] : ''; 85 $fblurb = !empty($datatype[3]) ? $datatype[3] : ''; 86 $fusertype = !empty($datatype[4]) ? $datatype[4] : ''; 87 $finvisible = false; 88 $frequired = false; 89 // Otherwise map things the new way! 90 } else { 91 $flabel = $datatype->name; 92 $fname = $datatype->internal_name; 93 $ftype = $datatype->field_type; 94 $fblurb = $datatype->description; 95 $fusertype = $datatype->user_type; 96 $finvisible = $datatype->invisible; 97 $frequired = $datatype->required; 98 } 99 100 foreach($data['profile:details'] as $datatype) { 101 if ($fname == $field && $ftype == "keywords") { 102 delete_records('tags', 'tagtype', $field, 'owner', $page_owner); 103 $value = insert_tags_from_string ($value, $field, $insert_id, $access, $page_owner); 102 } 103 if (sizeof($requiredmissing) == 0) { 104 foreach($insertvalues as $insertvalue) { 105 $insert_id = insert_record('profile_data',$insertvalue); 106 foreach($data['profile:details'] as $datatype) { 107 if ($fname == $field && $ftype == "keywords") { 108 delete_records('tags', 'tagtype', $field, 'owner', $page_owner); 109 $value = insert_tags_from_string ($value, $field, $insert_id, $access, $page_owner); 110 } 104 111 } 105 112 } 113 $messages[] = __gettext("Profile updated."); 114 115 $updatedok = true; 116 117 } else { 118 119 foreach($requiredmissing as $key=> $missinglabel) { 120 $message = ""; 121 if ($key > 0) { 122 $message .= ", "; 123 } 124 $message .= $missinglabel; 125 } 126 $messages[] = sprintf(__gettext("You need to fill in the following required fields: %s"),$message); 127 128 $updatedok = false; 106 129 } 107 $messages[] = __gettext("Profile updated.");108 130 } 109 131 … … 112 134 $rssresult = run("profile:rss:publish", array(1, false)); 113 135 136 $_SESSION['messages'] = $messages; 137 114 138 // redirect("{$CFG->wwwroot}{$profile_name}", get_string("changessaved")); 115 redirect("{$CFG->wwwroot}{$profile_name}/profile/", ""); 139 if ($updatedok) { 140 redirect("{$CFG->wwwroot}{$profile_name}/profile/", ""); 141 } else { 142 redirect("{$CFG->wwwroot}profile/edit.php?profile_id=".$page_owner, ""); 143 } 116 144 } 117 145 devel/units/profile/main.php
r598 r872 6 6 $function['profile:init'][] = path . "units/profile/function_init.php"; 7 7 // $function['profile:init'][] = path . "units/profile/function_editfield_defaults.php"; 8 $function['profile:init'][] = path . "units/profile/function_actions.php";9 8 $function['profile:init'][] = path . "units/profile/function_upload_foaf.php"; 10 9
