Move nummentors to project object

Remove registration/edit (we dont need to post anything back... for now...)
This commit is contained in:
james 2011-03-03 04:42:13 +00:00
parent 26e4204015
commit 22b4d119f6
2 changed files with 29 additions and 4 deletions

View File

@ -918,11 +918,12 @@ switch($request[0]) {
break;
default:
/* APIDOC: registration/edit
description(update registration information. Updatable data: nummentors)
/* COMMENTEDOUT because there's nothing to be saved!: registration/edit
description(update registration information)
post(registration array)
return(registration array)
*/
/*
case 'edit':
$chk=api_user_auth_required('participant');
if($chk['status']!="ok") {
@ -948,6 +949,7 @@ switch($request[0]) {
}
break;
*/
default:

View File

@ -351,12 +351,21 @@ function saveProjectData($data){
}
}
//and update nummentors in registrations, yea, i know its not in the projects table
if(isset($data['nummentors'])) {
if($data['nummentors']==null) {
mysql_query("UPDATE registrations SET nummentors=NULL WHERE id='{$_SESSION['registration_id']}'");
}
else {
mysql_query("UPDATE registrations SET nummentors='".intval($data['nummentors'])."' WHERE id='{$_SESSION['registration_id']}'");
}
}
if($message == ''){
$message = 'success';
}
}
else
{
else {
$message = i18n("Invalid project to update");
}
}
@ -464,6 +473,13 @@ function getRegistration($id) {
//and also get the project
$pq=mysql_query("SELECT id,projectnumber,title FROM projects WHERE registrations_id='$id' AND conferences_id='{$conference['id']}'");
$p=mysql_fetch_assoc($pq);
//move nummentors from registration object into the project object
//we'll also load it on getProejct, and save it on saveProjectData
//even though its in the registrations table not the projects table
$p['nummentors']=$reg['nummentors'];
unset($reg['nummentors']);
$reg['project']=$p;
//and finally, the status breakdown for the entire registration
@ -473,12 +489,15 @@ function getRegistration($id) {
function saveRegistrationData($d) {
global $conference;
/*
if($d['id']) {
mysql_query("UPDATE registrations SET nummentors='{$d['nummentors']}' WHERE id='{$d['id']}' AND conferences_id='{$conference['id']}'");
return getRegistration($d['id']);
}
else
return null;
*/
return getRegistration($data['id']);
}
function getProject($userId){
@ -514,6 +533,10 @@ function getProject($userId){
$returnval = mysql_fetch_assoc($q);
}
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='$regId'");
$r=mysql_fetch_assoc($q);
$returnval['nummentors']=$r['nummentors'];
$safetyquestions=getSafetyQuestions($regId);
$returnval['safetyquestions']=$safetyquestions;