forked from science-ation/science-ation
Move the schedule to the teacher account
This commit is contained in:
parent
88cdfebdea
commit
c8ada5f7c2
@ -59,9 +59,12 @@ function draw_dashboard(){
|
|||||||
echo '<li><a href="schoolinvite.php">' . i18n("Participant Registration") . "</a></li>\n";
|
echo '<li><a href="schoolinvite.php">' . i18n("Participant Registration") . "</a></li>\n";
|
||||||
}
|
}
|
||||||
}else if($conference['type'] == 'scienceolympics'){
|
}else if($conference['type'] == 'scienceolympics'){
|
||||||
|
echo "To access science olympics registration, login as a teacher";
|
||||||
|
/*
|
||||||
echo '<li><a href="schoolstudents.php">' . i18n("Manage Students") . "</a></li>\n";
|
echo '<li><a href="schoolstudents.php">' . i18n("Manage Students") . "</a></li>\n";
|
||||||
echo '<li><a href="schoolteams.php">' . i18n("Manage Teams") . "</a></li>\n";
|
echo '<li><a href="schoolteams.php">' . i18n("Manage Teams") . "</a></li>\n";
|
||||||
echo '<li><a href="schoolschedule.php">' . i18n("Register Teams for Events") . "</a></li>\n";
|
echo '<li><a href="schoolschedule.php">' . i18n("Register Teams for Events") . "</a></li>\n";
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
echo '<li><a href="schoolfeedback.php">' . i18n("School Feedback / Questions") . "</a></li>";
|
echo '<li><a href="schoolfeedback.php">' . i18n("School Feedback / Questions") . "</a></li>";
|
||||||
echo "</ul>\n";
|
echo "</ul>\n";
|
||||||
|
@ -24,13 +24,15 @@
|
|||||||
<?
|
<?
|
||||||
require("common.inc.php");
|
require("common.inc.php");
|
||||||
require_once("schedule.inc.php");
|
require_once("schedule.inc.php");
|
||||||
|
require_once("user.inc.php");
|
||||||
|
|
||||||
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
user_auth_required("teacher");
|
||||||
// we're logged in, make sure the school is good
|
$schoolid=user_field_required("schools_id","user_edit.php?tab=school");
|
||||||
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."'");
|
|
||||||
echo mysql_error();
|
$q=mysql_query("SELECT * FROM schools WHERE id='".$schoolid."'");
|
||||||
$school=mysql_fetch_object($q);
|
echo mysql_error();
|
||||||
if($school) {
|
$school=mysql_fetch_object($q);
|
||||||
|
if($school) {
|
||||||
|
|
||||||
if($_GET['action']=="loadschedule") {
|
if($_GET['action']=="loadschedule") {
|
||||||
$date=$_POST['date'];
|
$date=$_POST['date'];
|
||||||
@ -143,24 +145,23 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
// print_r($_POST);
|
// print_r($_POST);
|
||||||
|
|
||||||
// get a list of all students that could be put on this team
|
// get a list of all students that could be put on this team
|
||||||
$query = 'SELECT * FROM users_student';
|
|
||||||
$query .= ' JOIN users ON users_student.users_id = users.uid';
|
$results = mysql_query("SELECT * FROM users_student
|
||||||
$query .= ' JOIN users_conferences_link ucl ON ucl.users_uid = users_student.users_id';
|
JOIN users ON users_student.users_id = users.uid
|
||||||
$query .= ' WHERE schools_id = ' . $_SESSION['schoolid'];
|
JOIN users_conferences_link ucl ON ucl.users_uid = users_student.users_id
|
||||||
$query .= ' AND ucl.conferences_id=' . $conference['id'];
|
WHERE schools_id = $schoolid
|
||||||
$query .= ' AND users.deleted = "no"';
|
AND ucl.conferences_id={$conference['id']}
|
||||||
$results = mysql_query($query);
|
AND users.deleted = 'no'");
|
||||||
|
|
||||||
$availList = array();
|
$availList = array();
|
||||||
while($record = mysql_fetch_array($results)){
|
while($record = mysql_fetch_array($results)){
|
||||||
$availList[$record['uid']] = $record['firstname'] . ' ' . $record['lastname'];
|
$availList[$record['uid']] = $record['firstname'] . ' ' . $record['lastname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// let's empty the current list of students for this team
|
// let's empty the current list of students for this team
|
||||||
$query = "DELETE FROM schedule_registrations_users_link";
|
$results=mysql_query("DELETE FROM schedule_registrations_users_link
|
||||||
$query .= " WHERE users_uid IN (";
|
WHERE users_uid IN (".implode(',', array_keys($availList)).")
|
||||||
$query .= implode(',', array_keys($availList)) . ')';
|
AND schedule_registrations_id = ".intval($_POST['regId']));
|
||||||
$query .= " AND schedule_registrations_id = " . (int)$_POST['regId'];
|
|
||||||
$results = mysql_query($query);
|
|
||||||
|
|
||||||
// and now we'll insert only those that were selected
|
// and now we'll insert only those that were selected
|
||||||
$query = "INSERT INTO schedule_registrations_users_link (schedule_registrations_id, users_uid)";
|
$query = "INSERT INTO schedule_registrations_users_link (schedule_registrations_id, users_uid)";
|
||||||
@ -181,7 +182,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
$query = "SELECT sr.*, so_teams.name as name FROM schedule_registrations sr";
|
$query = "SELECT sr.*, so_teams.name as name FROM schedule_registrations sr";
|
||||||
$query .= " JOIN so_teams ON so_teams.id = sr.so_teams_id";
|
$query .= " JOIN so_teams ON so_teams.id = sr.so_teams_id";
|
||||||
$query .= " WHERE sr.id=" . $_POST['regId'];
|
$query .= " WHERE sr.id=" . $_POST['regId'];
|
||||||
$query .= " AND so_teams.schools_id = " . $_SESSION['schoolid'];
|
$query .= " AND so_teams.schools_id = " . $schoolid;
|
||||||
|
|
||||||
$results = mysql_query($query);
|
$results = mysql_query($query);
|
||||||
if(!$results){
|
if(!$results){
|
||||||
@ -195,7 +196,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
$query = 'SELECT * FROM users_student';
|
$query = 'SELECT * FROM users_student';
|
||||||
$query .= ' JOIN users ON users_student.users_id = users.uid';
|
$query .= ' JOIN users ON users_student.users_id = users.uid';
|
||||||
$query .= ' JOIN users_conferences_link ucl ON ucl.users_uid = users_student.users_id';
|
$query .= ' JOIN users_conferences_link ucl ON ucl.users_uid = users_student.users_id';
|
||||||
$query .= ' WHERE schools_id = ' . $_SESSION['schoolid'];
|
$query .= ' WHERE schools_id = ' . $schoolid;
|
||||||
$query .= ' AND ucl.conferences_id=' . $conference['id'];
|
$query .= ' AND ucl.conferences_id=' . $conference['id'];
|
||||||
$query .= ' AND users.deleted = "no"';
|
$query .= ' AND users.deleted = "no"';
|
||||||
$results = mysql_query($query);
|
$results = mysql_query($query);
|
||||||
@ -488,5 +489,4 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
@ -24,10 +24,13 @@
|
|||||||
<?
|
<?
|
||||||
require("common.inc.php");
|
require("common.inc.php");
|
||||||
require_once("schedule.inc.php");
|
require_once("schedule.inc.php");
|
||||||
|
require_once("user.inc.php");
|
||||||
|
|
||||||
|
user_auth_required("teacher");
|
||||||
|
$schoolid=user_field_required("schools_id","user_edit.php?tab=school");
|
||||||
|
|
||||||
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|
||||||
// we're logged in, make sure the school is good
|
// we're logged in, make sure the school is good
|
||||||
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."'");
|
$q=mysql_query("SELECT * FROM schools WHERE id='".$schoolid."'");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
$school=mysql_fetch_object($q);
|
$school=mysql_fetch_object($q);
|
||||||
if($school) {
|
if($school) {
|
||||||
@ -197,9 +200,5 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
else {
|
else {
|
||||||
echo "Invalid school";
|
echo "Invalid school";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Invalid school id or access code";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user