forked from science-ation/science-ation
switch conference API
This commit is contained in:
parent
c8ada5f7c2
commit
6963b7104b
32
api.php
32
api.php
@ -38,15 +38,33 @@ $ret=array();
|
|||||||
|
|
||||||
switch($request[0]) {
|
switch($request[0]) {
|
||||||
case "conferences":
|
case "conferences":
|
||||||
$ret['status']="ok";
|
if($request[1]=="switch") {
|
||||||
$ret['conferences']=array();
|
if($_POST['conferences_id']) {
|
||||||
|
//this makes sure its valid and sets teh session
|
||||||
|
switchConference($_POST['conferences_id']);
|
||||||
|
|
||||||
$response=array();
|
//get rid of their current roles, and load their record for the new conference
|
||||||
$q=mysql_query("SELECT id,name,type FROM conferences WHERE status='running' ORDER BY id");
|
if(is_array($_SESSION['roles'])) {
|
||||||
while($r=mysql_fetch_assoc($q)) {
|
$_SESSION['roles']=array();
|
||||||
$response[]=$r;
|
user_conference_load($_SESSION['accounts_id'],$_SESSION['conferences_id']);
|
||||||
|
}
|
||||||
|
$ret['status']="ok";
|
||||||
|
} else {
|
||||||
|
$ret['status']="error";
|
||||||
|
$ret['error']='conferences_id (integer) is required';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ret['status']="ok";
|
||||||
|
$ret['conferences']=array();
|
||||||
|
|
||||||
|
$response=array();
|
||||||
|
$q=mysql_query("SELECT id,name,type FROM conferences WHERE status='running' ORDER BY id");
|
||||||
|
while($r=mysql_fetch_assoc($q)) {
|
||||||
|
$response[]=$r;
|
||||||
|
}
|
||||||
|
$ret['conferences']=$response;
|
||||||
}
|
}
|
||||||
$ret['conferences']=$response;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "dates":
|
case "dates":
|
||||||
|
@ -198,15 +198,18 @@ if(!$_SESSION['conferences_id']) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//move the conference stuff before the configuration loading, so we can load the right configuration for the conference :)
|
function switchConference($cid) {
|
||||||
if(isset($_GET['switchconference'])) {
|
$cid=intval($cid);
|
||||||
//make sure its good
|
|
||||||
$cid=intval($_GET['switchconference']);
|
|
||||||
// echo "cid=$cid";
|
// echo "cid=$cid";
|
||||||
$q=mysql_query("SELECT * FROM conferences WHERE id='$cid' AND status='running'");
|
$q=mysql_query("SELECT * FROM conferences WHERE id='$cid' AND status='running'");
|
||||||
if($r=mysql_fetch_object($q)) {
|
if($r=mysql_fetch_object($q)) {
|
||||||
$_SESSION['conferences_id']=$cid;
|
$_SESSION['conferences_id']=$cid;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//move the conference stuff before the configuration loading, so we can load the right configuration for the conference :)
|
||||||
|
if(isset($_GET['switchconference'])) {
|
||||||
|
//make sure its good
|
||||||
|
switchConference($_GET['switchconference']);
|
||||||
unset($_SESSION['nav']);
|
unset($_SESSION['nav']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user