Course.php: better spacing; removed unused code: echo '<ul>';
parent
1875028472
commit
b477edca1b
42
Course.php
42
Course.php
|
@ -459,27 +459,21 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$result = mysqli_query($con," SELECT `ID`, course_group_members_table.Course_Group_id, `Student_ID`,
|
$result = mysqli_query($con, "SELECT ID, course_group_members_table.Course_Group_id, Student_ID, Status,course_groups_table.Group_Name, course_groups_table.Course_id FROM course_group_members_table INNER JOIN course_groups_table ON course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id WHERE Student_id=$student_id and course_groups_table.Course_id=$course_id");
|
||||||
`Status`,course_groups_table.Group_Name,course_groups_table.Course_id
|
|
||||||
FROM `course_group_members_table` INNER JOIN course_groups_table on
|
|
||||||
course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id WHERE Student_id=$student_id and course_groups_table.Course_id=$course_id");
|
|
||||||
|
|
||||||
if(mysqli_num_rows($result)==0)
|
if(mysqli_num_rows($result) == 0) {
|
||||||
{
|
|
||||||
echo "You have no group in this course.";
|
echo "You have no group in this course.";
|
||||||
} else {
|
} else {
|
||||||
while($row = mysqli_fetch_assoc($result)) {
|
while($row = mysqli_fetch_assoc($result)) {
|
||||||
$name=$row['Group_Name'];
|
$name = $row['Group_Name'];
|
||||||
$id=$row['Course_Group_id'];
|
$id = $row['Course_Group_id'];
|
||||||
$status=$row['Status'];
|
$status = $row['Status'];
|
||||||
|
$extra = " - <a href='#' class='' onclick='invite($id)'> Invite Others</a></small>";
|
||||||
|
|
||||||
|
if($status == "Invited")
|
||||||
$extra=" - <a href='#' class='' onclick='invite($id)'> Invite Others</a></small>";
|
|
||||||
|
|
||||||
if($status=="Invited")
|
|
||||||
{
|
{
|
||||||
$extra2=" <a href='#' class='' onclick='accept($id,1)'>Accept</a></small>";
|
$extra2 = " <a href='#' class='' onclick='accept($id,1)'>Accept</a></small>";
|
||||||
$extra3=" <a href='#' class='' onclick='accept($id,0)'>Decline</a></small>";
|
$extra3 = " <a href='#' class='' onclick='accept($id,0)'>Decline</a></small>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,31 +486,29 @@ course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id W
|
||||||
(($status == "Created")? "$extra4": "")
|
(($status == "Created")? "$extra4": "")
|
||||||
."</li>";
|
."</li>";
|
||||||
|
|
||||||
$rs2=mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID,
|
$rs2 = mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID,
|
||||||
course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table`
|
course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table`
|
||||||
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID
|
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID
|
||||||
where course_group_members_table.Course_Group_id=$id");
|
where course_group_members_table.Course_Group_id=$id");
|
||||||
|
|
||||||
#Check whether the current user in session is the creator of the group
|
# Check whether the current user in session is the creator of the group
|
||||||
$rs3 = mysqli_query($con, "SELECT `Status` from course_group_members_table where Student_ID = $student_id");
|
$rs3 = mysqli_query($con, "SELECT `Status` from course_group_members_table where Student_ID = $student_id");
|
||||||
$flag = mysqli_fetch_assoc($rs3)['Status'] == "Created";
|
$flag = mysqli_fetch_assoc($rs3)['Status'] == "Created";
|
||||||
|
|
||||||
while($row = mysqli_fetch_assoc($rs2)) {
|
while ($row = mysqli_fetch_assoc($rs2)) {
|
||||||
$name=$row['Full_Name'];
|
$name = $row['Full_Name'];
|
||||||
$id=$row['Course_Group_id'];
|
$id = $row['Course_Group_id'];
|
||||||
$status=$row['Status'];
|
$status = $row['Status'];
|
||||||
$Student_ID=$row['Student_ID'];
|
$Student_ID = $row['Student_ID'];
|
||||||
|
|
||||||
#Show group members + remove button next to each member except the creator of the group
|
#Show group members + remove button next to each member except the creator of the group
|
||||||
if($flag){
|
if ($flag) {
|
||||||
echo "<li class='list-group-item'>$name - $Student_ID ($status) ".(($status != "Created")?"<button onclick='removeMember($Student_ID, $id)'
|
echo "<li class='list-group-item'>$name - $Student_ID ($status) ".(($status != "Created")?"<button onclick='removeMember($Student_ID, $id)'
|
||||||
class='btn btn-sm btn-warning'>Kick out</button>":"")."</li>";
|
class='btn btn-sm btn-warning'>Kick out</button>":"")."</li>";
|
||||||
} else{
|
} else{
|
||||||
echo "<li class='list-group-item'><small> $name - $Student_ID ($status)</small>";
|
echo "<li class='list-group-item'><small> $name - $Student_ID ($status)</small>";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
echo "<ul>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue