forked from science-ation/science-ation
updated to delete links between schedule registrations and users when a schedule registration is deleted
This commit is contained in:
parent
00716cd84d
commit
b3448b7c7c
@ -33,47 +33,47 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
if($school) {
|
if($school) {
|
||||||
switch($_GET['action']) {
|
switch($_GET['action']) {
|
||||||
case "load":
|
case "load":
|
||||||
$id=intval($_GET['id']);
|
$id=intval($_GET['id']);
|
||||||
$q=mysql_query("SELECT schedule.*,
|
$q=mysql_query("SELECT schedule.*,
|
||||||
events.eventtype,
|
events.eventtype,
|
||||||
events.website,
|
events.website,
|
||||||
events.summary,
|
events.summary,
|
||||||
events.name,
|
events.name,
|
||||||
locations.name AS location
|
locations.name AS location
|
||||||
FROM schedule
|
FROM schedule
|
||||||
JOIN events ON schedule.events_id=events.id
|
JOIN events ON schedule.events_id=events.id
|
||||||
JOIN locations ON schedule.locations_id=locations.id
|
JOIN locations ON schedule.locations_id=locations.id
|
||||||
WHERE schedule.conferences_id='{$conference['id']}'
|
WHERE schedule.conferences_id='{$conference['id']}'
|
||||||
AND schedule.id='{$id}'");
|
AND schedule.id='{$id}'");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
$r=mysql_fetch_object($q);
|
$r=mysql_fetch_object($q);
|
||||||
if($r->title!=$r->name) {
|
if($r->title!=$r->name) {
|
||||||
$name="($r->name)";
|
$name="($r->name)";
|
||||||
}
|
}
|
||||||
echo "<h3>$r->title $name</h3>";
|
echo "<h3>$r->title $name</h3>";
|
||||||
|
|
||||||
switch($_GET['tab']) {
|
switch($_GET['tab']) {
|
||||||
case "summary":
|
case "summary":
|
||||||
echo "<table width=\"95%\" class=\"tableview\">";
|
echo "<table width=\"95%\" class=\"tableview\">";
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<th>".i18n("Time")."</th>\n";
|
echo "<th>".i18n("Time")."</th>\n";
|
||||||
echo "<th>".i18n("Duration")."</th>\n";
|
echo "<th>".i18n("Duration")."</th>\n";
|
||||||
echo "<th>".i18n("Location")."</th>\n";
|
echo "<th>".i18n("Location")."</th>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td>".format_time(strtotime($r->hour.":".$r->minute))."</td>\n";
|
echo "<td>".format_time(strtotime($r->hour.":".$r->minute))."</td>\n";
|
||||||
echo "<td>$r->duration minutes</td>\n";
|
echo "<td>$r->duration minutes</td>\n";
|
||||||
echo "<td>$r->location</td>\n";
|
echo "<td>$r->location</td>\n";
|
||||||
echo "</tr></table>\n";
|
echo "</tr></table>\n";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<h4>".i18n("Summary")."</h4>\n";
|
echo "<h4>".i18n("Summary")."</h4>\n";
|
||||||
echo nl2br(trim($r->summary));
|
echo nl2br(trim($r->summary));
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
|
|
||||||
if($r->website) {
|
if($r->website) {
|
||||||
echo "<a target=\"_blank\" href=\"$r->website\">".i18n("Click here for the full event description")."</a> <br />\n";
|
echo "<a target=\"_blank\" href=\"$r->website\">".i18n("Click here for the full event description")."</a> <br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "register":
|
case "register":
|
||||||
@ -121,20 +121,19 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
$scheduleid=intval($_POST['scheduleid']);
|
$scheduleid=intval($_POST['scheduleid']);
|
||||||
$conferenceid=$conference['id'];
|
$conferenceid=$conference['id'];
|
||||||
|
|
||||||
$q=mysql_query("SELECT schedule.*,
|
$q=mysql_query("SELECT schedule.*,
|
||||||
events.eventtype,
|
events.eventtype,
|
||||||
events.website,
|
events.website,
|
||||||
events.summary,
|
events.summary,
|
||||||
events.name,
|
events.name,
|
||||||
locations.name AS location
|
locations.name AS location
|
||||||
FROM schedule
|
FROM schedule
|
||||||
JOIN events ON schedule.events_id=events.id
|
JOIN events ON schedule.events_id=events.id
|
||||||
JOIN locations ON schedule.locations_id=locations.id
|
JOIN locations ON schedule.locations_id=locations.id
|
||||||
WHERE schedule.conferences_id='{$conference['id']}'
|
WHERE schedule.conferences_id='{$conference['id']}'
|
||||||
AND schedule.id='{$scheduleid}'");
|
AND schedule.id='{$scheduleid}'");
|
||||||
$schedule=mysql_fetch_object($q);
|
$schedule=mysql_fetch_object($q);
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
||||||
|
|
||||||
switch($_POST['regaction']) {
|
switch($_POST['regaction']) {
|
||||||
case "register":
|
case "register":
|
||||||
@ -155,9 +154,34 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "unregister":
|
case "unregister":
|
||||||
|
|
||||||
$q=mysql_query("SELECT * FROM schedule_registrations WHERE so_teams_id=$teamid AND schedule_id=$scheduleid AND conferences_id=$conferenceid");
|
$q=mysql_query("SELECT * FROM schedule_registrations WHERE so_teams_id=$teamid AND schedule_id=$scheduleid AND conferences_id=$conferenceid");
|
||||||
if(mysql_num_rows($q)) {
|
if(mysql_num_rows($q)) {
|
||||||
|
|
||||||
|
// delete any links between students and this registrationa
|
||||||
|
$q = mysql_query(
|
||||||
|
" SELECT users_uid, schedule_registrations_id" .
|
||||||
|
" FROM schedule_registrations_users_link srul" .
|
||||||
|
" JOIN schedule_registrations sr ON sr.id = srul.schedule_registrations_id" .
|
||||||
|
" WHERE sr.so_teams_id = '$teamid'" .
|
||||||
|
" AND sr.schedule_id='$scheduleid'" .
|
||||||
|
" AND sr.conferences_id='$conferenceid'"
|
||||||
|
);
|
||||||
|
while($r = mysql_fetch_array($q)){
|
||||||
|
$idSet[] = $r['users_uid'];
|
||||||
|
$srid = $r['schedule_registrations_id'];
|
||||||
|
}
|
||||||
|
if(is_array($idSet)){
|
||||||
|
$query =
|
||||||
|
" DELETE FROM schedule_registrations_users_link" .
|
||||||
|
" WHERE schedule_registrations_id = $srid" .
|
||||||
|
" AND users_uid IN(" . implode(',', $idSet) . ")";
|
||||||
|
$q = mysql_query($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete the registrations themselves
|
||||||
mysql_query("DELETE FROM schedule_registrations WHERE so_teams_id='$teamid' AND schedule_id='$scheduleid' AND conferences_id='$conferenceid'");
|
mysql_query("DELETE FROM schedule_registrations WHERE so_teams_id='$teamid' AND schedule_id='$scheduleid' AND conferences_id='$conferenceid'");
|
||||||
|
|
||||||
happy_("Successfully unregistered the team from this scheduled event");
|
happy_("Successfully unregistered the team from this scheduled event");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user