forked from science-ation/science-ation
- Server side handling for category/divisions
This commit is contained in:
parent
97c489646e
commit
3c8b72a40f
30
remote.php
30
remote.php
@ -241,6 +241,8 @@ function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
||||
/* Update the project in case anythign changed */
|
||||
mysql_query("UPDATE projects SET title='".mysql_real_escape_string($project['title'])."',
|
||||
summary='".mysql_real_escape_string($project['abstract'])."'
|
||||
projectcategories_id='".intval($project['projectcategories_id'])."'
|
||||
projectdivisions_id='".intval($project['projectdivisions_id'])."'
|
||||
WHERE id='$pid'");
|
||||
|
||||
/* Delete the students attached to this project */
|
||||
@ -266,7 +268,6 @@ function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
||||
|
||||
function handle_award_upload(&$u, &$fair, &$data, &$response)
|
||||
{
|
||||
|
||||
$external_identifier = $data['award_upload']['external_identifier'];
|
||||
$year = intval($data['award_upload']['year']);
|
||||
$prizes = $data['award_upload']['prizes'];
|
||||
@ -308,6 +309,31 @@ function handle_award_upload(&$u, &$fair, &$data, &$response)
|
||||
$response['error'] = 0;
|
||||
}
|
||||
|
||||
function handle_get_categories(&$u, &$fair, &$data, &$response)
|
||||
{
|
||||
$year = intval($data['get_categories']['year']);
|
||||
$cat = array();
|
||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
$cat[$r->id]=array('category' => $r->category,
|
||||
'mingrade' => $r->mingrade,
|
||||
'maxgrade' => $r->maxgrade);
|
||||
}
|
||||
$response['categories'] = $cat;
|
||||
$response['error'] = 0;
|
||||
}
|
||||
|
||||
function handle_get_divisions(&$u, &$fair, &$data, &$response)
|
||||
{
|
||||
$year = intval($data['get_divisions']['year']);
|
||||
$div = array();
|
||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
$div[$r->id] = array('division' => $r->division);
|
||||
}
|
||||
$response['divisions'] = $div;
|
||||
$response['error'] = 0;
|
||||
}
|
||||
|
||||
/* magic quotes DEPRECATED as of PHP 5.3.0, REMOVE as of 6.0, on by default *
|
||||
* for any PHP < 5.3.0. Pain in the ASS. php is running the urldecode for us,
|
||||
@ -365,6 +391,8 @@ function handle_award_upload(&$u, &$fair, &$data, &$response)
|
||||
if(array_key_exists('stats', $data)) handle_stats($u,$fair, $data, $response);
|
||||
if(array_key_exists('getawards', $data)) handle_getawards($u,$fair,$data, $response);
|
||||
if(array_key_exists('award_upload', $data)) handle_award_upload($u,$fair,$data, $response);
|
||||
if(array_key_exists('get_categories', $data)) handle_get_categories($u,$fair,$data, $response);
|
||||
if(array_key_exists('get_divisions', $data)) handle_get_divisions($u,$fair,$data, $response);
|
||||
|
||||
echo urlencode(json_encode($response));
|
||||
// echo "Success!<br />";
|
||||
|
Loading…
Reference in New Issue
Block a user