Sunteți pe pagina 1din 182

ADMIN FILES

dashboard.php - is code for the main view of website.


<?php include('header.php'); ?>
<?php include('session.php'); ?>
<body>
<!-- you can see this design code into the first session when you are already login you
can see the status of user -->
<?php include('navbar.php') ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/dashboard_sidebar.php'); ?>
<!--/span-->
<div class="span9" id="contentdashboard">
<div class="row-fluid"></div>

<div class="row-fluid">

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Data
Monitoring</div>
</div>
<div class="block-content collapse in">
<div class="span12">

<?php
$query_reg_teacher = mysql_query("select *
from teacher where teacher_status = 'Registered' ")or die(mysql_error());
$count_reg_teacher =
mysql_num_rows($query_reg_teacher);
?>

<div class="span3">
<div class="chart" data-
percent="<?php echo $count_reg_teacher; ?>"><?php echo $count_reg_teacher; ?></div>
<div class="chart-bottom-
heading"><strong>Registered Teacher</strong>

</div>
</div>

<?php
$query_teacher = mysql_query("select *
from teacher")or die(mysql_error());
$count_teacher =
mysql_num_rows($query_teacher);
?>

<div class="span3">
<div class="chart" data-
percent="<?php echo $count_teacher; ?>"><?php echo $count_teacher ?></div>
<div class="chart-bottom-
heading"><strong>Teachers</strong>

</div>
</div>

<?php
$query_student = mysql_query("select *
from student where status='Registered'")or die(mysql_error());
$count_student =
mysql_num_rows($query_student);
?>

<div class="span3">
<div class="chart" data-
percent="<?php echo $count_student ?>"><?php echo $count_student ?></div>
<div class="chart-bottom-
heading"><strong>Registered Students</strong>

</div>
</div>

<?php
$query_student = mysql_query("select *
from student")or die(mysql_error());
$count_student =
mysql_num_rows($query_student);
?>

<div class="span3">
<div class="chart" data-
percent="<?php echo $count_student ?>"><?php echo $count_student ?></div>
<div class="chart-bottom-
heading"><strong>Students</strong>

</div>
</div>
<?php
$query_class = mysql_query("select * from
class")or die(mysql_error());
$count_class =
mysql_num_rows($query_class);
?>

<div class="span3">
<div class="chart" data-
percent="<?php echo $count_class; ?>"><?php echo $count_class; ?></div>
<div class="chart-bottom-
heading"><strong>Class</strong>

</div>
</div>

<?php
$query_file = mysql_query("select * from
files")or die(mysql_error());
$count_file =
mysql_num_rows($query_file);
?>

<div class="span3">
<div class="chart" data-
percent="<?php echo $count_file; ?>"><?php echo $count_file; ?></div>
<div class="chart-bottom-
heading"><strong>Downloadable File</strong>

</div>
</div>

<?php
$query_program = mysql_query("select *
from program")or die(mysql_error());
$count_program =
mysql_num_rows($query_program);
?>
<div class="span3">
<div class="chart" data-
percent="<?php echo $count_program; ?>"><?php echo $count_program; ?></div>
<div class="chart-bottom-
heading"><strong>Programs</strong>

</div>
</div>

</div>
</div>
<!-- /block -->

</div>
</div>

</div>
</div>

<?php include('footer.php'); ?>


</div>
<?php include('script.php'); ?>
</body>

</html>

Header.php
<!DOCTYPE html>
<html class="no-js">
<head>
<title>Administrator | S.O.A.P</title>
<!-- Bootstrap -->
<link href="../images/icon.png" rel="icon" type="image">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"
media="screen">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"
media="screen">
<link href="bootstrap/css/font-awesome.css" rel="stylesheet"
media="screen">
<link href="bootstrap/css/my_style.css" rel="stylesheet" media="screen">
<link href="vendors/easypiechart/jquery.easy-pie-chart.css"
rel="stylesheet" media="screen">
<link href="assets/styles.css" rel="stylesheet" media="screen">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- calendar css -->
<link href="vendors/fullcalendar/fullcalendar.css" rel="stylesheet"
media="screen">
<script src="vendors/jquery-1.9.1.min.js"></script>
<script src="vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<!-- data table -->
<link href="assets/DT_bootstrap.css" rel="stylesheet" media="screen">
<!-- notification -->
<link href="vendors/jGrowl/jquery.jgrowl.css" rel="stylesheet" media="screen">
<!-- wysiwug -->
<link rel="stylesheet" type="text/css" href="vendors/bootstrap-
wysihtml5/src/bootstrap-wysihtml5.css">

<script src="vendors/jGrowl/jquery.jgrowl.js"></script>
</head>
<?php
include_once('mysql2i.class.php');
include('dbcon.php'); ?>

Register – add new user for confirmation if the user is signup.


Add_student.php - is for adding new enrolled student.

<div class="row-fluid">
<!-- block -->
<!-- code for adding new enrolled student -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Add Student</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form id="add_student"
method="post">

<div class="control-group">

<div class="controls">
<select name="class_id" class="class_id" required>
<option></option>
<?php
$class_query
= mysql_query("select * from class order by class_name");

while($class_row = mysql_fetch_array($class_query)){

?>
<option
value="<?php echo $class_row['class_id']; ?>"><?php echo $class_row['class_name'];
?></option>
<?php } ?>
</select>
</div>
</div>

<div class="control-
group">
<div class="controls">
<input name="un" class="input focused" id="focusedInput"
type="text" placeholder = "ID Number" required>
</div>
</div>

<div class="control-
group">
<div class="controls">
<input name="fn" class="input focused" id="focusedInput"
type="text" placeholder = "Firstname" required>
</div>
</div>

<div class="control-
group">
<div class="controls">
<input name="ln" class="input focused" id="focusedInput"
type="text" placeholder = "Lastname" required>
</div>
</div>

<div
class="control-group">
<div class="controls">

<button name="save" class="btn btn-success"><i class="icon-plus-sign icon-


large"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

<script>
jQuery(document).ready(function($){
$("#add_student").submit(function(e){
e.preventDefault();
var _this = $(e.target);
var formData = $(this).serialize();
$.ajax({
type: "POST",
url: "save_student.php",
data: formData,
success: function(html){
$.jGrowl("Student Successfully Added", {
header: 'Student Added' });

$('#studentTableDiv').load('student_table.php', function(response){

$("#studentTableDiv").html(response);
$('#example').dataTable( {
"sDom":
"<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sPaginationType":
"bootstrap",
"oLanguage": {
"sLengthMenu":
"_MENU_ records per page"
}
} );
$(_this).find(":input").val('');
$(_this).find('select
option').attr('selected',false);
$(_this).find('select
option:first').attr('selected',true);
});
}
});
});
});
</script>

Add_teacher.php - adding new employee teacher.

<div class="row-fluid">
<!-- block -->
<!-- code for adding a new teacher employee -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Add Teacher</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form id="add_teacher"
method="post">

<div class="control-group">

<div class="controls">
<select name="department" class="department_id" required>
<option></option>
<?php

$department_query = mysql_query("select * from department order by


department_name");

while($department_row = mysql_fetch_array($department_query)){

?>
<option
value="<?php echo $department_row['department_id']; ?>"><?php echo
$department_row['department_name']; ?></option>
<?php } ?>
</select>
</div>
</div>

<div class="control-group">
<div class="controls">
<input class="input focused" name="firstname" id="focusedInput"
type="text" placeholder = "Firstname" required>
</div>
</div>
<div class="control-group">
<div class="controls">
<input class="input focused" name="lastname" id="focusedInput"
type="text" placeholder = "Lastname" required>
</div>
</div>

<div
class="control-group">
<div class="controls">

<button name="save" class="btn btn-success"><i class="icon-plus-sign icon-


large"></i></button>

</div>
</div>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

<script>
jQuery(document).ready(function($){
$("#add_teacher").submit(function(e){
e.preventDefault();
var _this = $(e.target);
var formData = $(this).serialize();
$.ajax({
type: "POST",
url: "save_teacher.php",
data: formData,
success: function(html){
$.jGrowl("Teacher Successfully Added", {
header: 'Teacher Added' });

$('#teacherTableDiv').load('teacher_table.php', function(response){

$("#teacherTableDiv").html(response);
$('#example').dataTable( {
"sDom":
"<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sPaginationType":
"bootstrap",
"oLanguage": {
"sLengthMenu":
"_MENU_ records per page"
}
} );
$(_this).find(":input").val('');
$(_this).find('select
option').attr('selected',false);
$(_this).find('select
option:first').attr('selected',true);
});
}
});
});
});
</script>

Add_user.php - adding new admin to manage.

<div class="row-fluid">
<!-- block -->
<!-- code for adding new user of administrator -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Add Administrator Account</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form method="post">
<div class="control-
group">
<div class="controls">
<input class="input focused" name="firstname" id="focusedInput"
type="text" placeholder = "Firstname" required>
</div>
</div>

<div class="control-
group">
<div class="controls">
<input class="input focused" name="lastname" id="focusedInput"
type="text" placeholder = "Lastname" required>
</div>
</div>
<div
class="control-group">
<div class="controls">
<input class="input focused" name="username" id="focusedInput"
type="text" placeholder = "Username" required>
</div>
</div>

<div class="control-
group">
<div class="controls">
<input class="input focused" name="password" id="focusedInput"
type="password" placeholder = "Password" required>
</div>
</div>

<div
class="control-group">
<div class="controls">

<button name="save" class="btn btn-success"><i class="icon-plus-sign icon-


large"></i></button>

</div>
</div>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

<?php
if (isset($_POST['save'])){
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$username = $_POST['username'];
$password = sha1(md5($_POST['password']));

$query = mysql_query("select * from users where username = '$username' and password =


'$password' and firstname = '$firstname' and password = '$password' ")or die(mysql_error());
$count = mysql_num_rows($query);

if ($count > 0){ ?>


<script>
$.jGrowl("Administrator Account Already Exist", { header: 'Message' });
</script>
<?php
}else{
mysql_query("insert into users (username,password,firstname,lastname)
values('$username','$password','$firstname','$lastname')")or die(mysql_error());
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Add Administrator Account $username')")or
die(mysql_error());
?>
<script>
window.location = "admin_user.php";
</script>
<?php
}
}
?>

Activity_log.php -this code is for monitor the time of login and logout of users.

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/activity_log_sidebar.php'); ?>
<div class="span9" id="contentdashboard">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Activity Log List</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<table cellpadding="0" cellspacing="0" border="0" class="table" id="example">

<thead>
<tr>
<!-- code for getting the update of activity log -->
<th>Date</th>
<th>User</th>
<th>Action</th>
</tr>

</thead>
<tbody>

<?php
$query = mysql_query("select * from activity_log")or die(mysql_error());
while($row = mysql_fetch_array($query)){
?>

<tr>

<td><?php echo $row['date']; ?></td>


<td><?php echo $row['username']; ?></td>
<td><?php echo $row['action']; ?></td>

</tr>

<?php } ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Add_class.php - This code is for adding a new type of class that teachers need.
<div class="row-fluid">
<!-- block -->
<!-- code for adding a new type of class that teacher will be use -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Add Class</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form method="post">
<div class="control-
group">
<div class="controls">
<input name="class_name" class="input focused" id="focusedInput"
type="text" placeholder = "Course - Year And Section" required>
</div>
</div>

<div
class="control-group">
<div class="controls">

<button name="save" class="btn btn-success"><i class="icon-plus-sign icon-


large"></i></button>

</div>
</div>
</form>
</div>
</div>
</div>
<!-- /block -->
</div><?php
if (isset($_POST['save'])){
$class_name = $_POST['class_name'];

$query = mysql_query("select * from class where class_name = '$class_name' ")or


die(mysql_error());
$count = mysql_num_rows($query);

if ($count > 0){ ?>


<script>
$.jGrowl("Course - Year and Section Already Exist", { header: 'Message' });
</script>
<?php
}else{
mysql_query("insert into class (class_name) values('$class_name')")or die(mysql_error());
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Add Class $class_name')")or die(mysql_error());
?>
<script>
window.location = "class.php";
</script>
<?php
}
}
?>

Add_class_event.php
<form id="add_event" class="form-add" method="post">
<h4 class="form-signin-heading"><i class="icon-plus-sign"></i> Add Event</h4>
<input type="text" class="input-block-level datepicker" name="date_start"
id="date01" placeholder="Date Start" required/>
<input type="text" class="input-block-level datepicker" name="date_end" id="date01"
placeholder="Date End" required/>
<input type="text" class="input-block-level" id="event_title" name="title"
placeholder="Title" required/>
<button id="add_event" name="add" class="btn btn-success" type="submit"><i
class="icon-save"></i> Save</button>
</form>
<!-- creating of new event class and save or adding into the database -->
<?php
if (isset($_POST['add'])){
$date_start = $_POST['date_start'];
$date_end = $_POST['date_end'];
$title = $_POST['title'];

$query = mysql_query("insert into event (date_end,date_start,event_title)


values('$date_end','$date_start','$title')")or die(mysql_error());
?>
<script>
window.location = "calendar_of_events.php";
</script>
<?php
}
?>

<table cellpadding="0" cellspacing="0" border="0" class="table" id="">

<thead>
<tr>
<th>Event</th>

<th>Date</th>

<th></th>

</tr>

</thead>
<tbody>

<?php $event_query =
mysql_query("select * from event where teacher_class_id = '' ")or die(mysql_error());
while($event_row =
mysql_fetch_array($event_query)){
$id =
$event_row['event_id'];
?>
<tr id="del<?php
echo $id; ?>">

<td><?php echo
$event_row['event_title']; ?> </td>
<td><?php echo $event_row['date_start']; ?>
<br>To
<?php echo
$event_row['date_end']; ?>
</td>
<td width="40">

<a class="btn btn-


danger" href="delete_event.php<?php echo '?id='.$id; ?>"><i class="icon-remove icon-
large"></i></a>

</td>

</tr>

<?php } ?>
</tbody>
</table>

Add_department.php – code for adding a different department.


<div class="row-fluid">
<!-- block -->
<!-- coding for adding a new selection of department -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Add Department</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form method="post">
<div class="control-
group">
<div class="controls">
<input class="input focused" id="focusedInput" name="d"
type="text" placeholder = "Deparment">
</div>
</div>

<div class="control-
group">
<div class="controls">
<input class="input focused" id="focusedInput" name="pi"
type="text" placeholder = "Person Incharge">
</div>
</div>

<div
class="control-group">
<div class="controls">

<button name="save" class="btn btn-success"><i class="icon-plus-sign icon-


large"></i></button>

</div>
</div>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>
<?php
if (isset($_POST['save'])){
$pi = $_POST['pi'];
$d = $_POST['d'];

$query = mysql_query("select * from department where department_name = '$d' and dean = '$pi'
")or die(mysql_error());
$count = mysql_num_rows($query);

if ($count > 0){ ?>


<script>
$.jGrowl("Department Already Exist", { header: 'Message' });
</script>
<?php
}else{
mysql_query("insert into department (department_name,dean) values('$d','$pi')")or
die(mysql_error());
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Add Department $d')")or die(mysql_error());
?>
<script>
window.location = "department.php";
</script>
<?php
}
}
?>

Add_program.php – code for adding a new program or courses .


<?php include('header.php'); ?>
<?php include('session.php'); ?>
<body>
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/program_sidebar.php'); ?>

<div class="span9" id="content">


<div class="row-fluid">

<!-- block -->


<div class="blockprogram">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Add Program</div>
</div>
<div class="block-content collapse in">
<a href="program.php"><i
class="icon-arrow-left"></i> Back</a>
<form class="form-
horizontal" method="post">
<div class="control-
group">
<label
class="control-label" for="programCode">Program Code</label>
<div
class="controls">
<input
type="text" name="program_code" id="inputProgramCode" placeholder="Program Code"
required>
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="programTitle">Program Title</label>
<div
class="controls">
<input
type="text" class="span8" name="program_title" id="inputProgramTitle" placeholder="Program
Title" required>
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="programNumberOfUnits">Number of Units</label>
<div
class="controls">
<input
type="text" class="units" name="unit" id="inputNumberOfUnits" required>
</div>
</div>
<div
class="control-group">
<label
class="control-label" for="programSemester">Semester</label>
<div
class="controls">
<select
name="semester" required>
<option></option>

<option>1st</option>

<option>2nd</option>

</select>
</div>
</div>

<div class="control-
group">
<label
class="control-label" for="programDescription">Description</label>
<div
class="controls">

<textarea name="description" id="ckeditor_full"></textarea>


</div>
</div>

<div class="control-
group">
<div
class="controls">

<button name="save"
type="submit" class="btn btn-success"><i class="icon-save"></i> Save</button>
</div>
</div>
</form>

<?php
if
(isset($_POST['save'])){
$program_code =
$_POST['program_code'];
$program_title =
$_POST['program_title'];
$unit =
$_POST['unit'];
$description =
$_POST['description'];
$semester =
$_POST['semester'];

$query =
mysql_query("select * from program where program_code = '$program_code' ")or
die(mysql_error());
$count =
mysql_num_rows($query);

if ($count > 0){ ?>


<script>
alert('Data Already
Exist');
</script>
<?php
}else{
mysql_query("insert
into program (program_code,program_title,description,unit,semester)
values('$program_code','$program_title','$description','$unit','$semester')")or die(mysql_error());

mysql_query("insert
into activity_log (date,username,action) values(NOW(),'$user_username','Add Program
$program_code')")or die(mysql_error());

?>
<script>
window.location =
"program.php";
</script>
<?php
}
}

?>

</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Add_school_year.php –code for adding a school year .

<div class="row-fluid">
<!-- block -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Add School Year</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form method="post">
<div class="control-
group">
<div class="controls">
<input class="input focused" name="school_year" id="focusedInput"
type="text" placeholder = "School Year" required>
</div>
</div>

<div
class="control-group">
<div class="controls">

<button name="save" class="btn btn-success"><i class="icon-plus-sign icon-


large"></i></button>

</div>
</div>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

<?php
if (isset($_POST['save'])){
$school_year = $_POST['school_year'];

$query = mysql_query("select * from school_year where school_year = '$school_year'")or


die(mysql_error());
$count = mysql_num_rows($query);

if ($count > 0){ ?>


<script>
$.jGrowl("School Year Already Exist", { header: 'Message' });
</script>
<?php
}else{
mysql_query("insert into school_year (school_year) values('$school_year')")or
die(mysql_error());

mysql_query("insert into activity_log (date,username,action)


values(NOW(),'$user_username','Add School Year $school_year')")or die(mysql_error());
?>
<script>
window.location = "school_year.php";
</script>
<?php
}
}
?>

Admin_calendar_script.php - function for admin calendar to restore and see automatically the
events, announcement, and also the schedules.

<script>

$(function() {
// Easy pie charts
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: 'month,basicWeek,basicDay'
},

droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function(date, allDay) { // this function is called when something is dropped

// retrieve the dropped element's stored Event Object


var originalEventObject = $(this).data('eventObject');

// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);

// assign it the date that was reported


copiedEventObject.start = date;
copiedEventObject.allDay = allDay;

// render the event on the calendar


// the last `true` argument determines if the event "sticks"
(http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

// is the "remove after drop" checkbox checked?


if ($('#drop-remove').is(':checked')) {
// if so, remove the element from the "Draggable Events" list
$(this).remove();
}

},
editable: true,
// US Holidays
events:
[
<?php $event_query = mysql_query("select * from event where teacher_class_id
= '' ")or die(mysql_error());
while($event_row = mysql_fetch_array($event_query)){
?>
{
title : '<?php echo $event_row['event_title']; ?> ',
start : '<?php echo $event_row['date_start']; ?>',
end : '<?php echo $event_row['date_end']; ?>'
},
<?php } ?>
]

});
});

</script>

Assignment.php - list of assignment that already upload.


<?php include('header.php'); ?>
<?php include('session.php'); ?>
<body>
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/assignment_sidebar.php'); ?>
<div class="span9" id="contentdashboard">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Assignment File Uploaded List</div>
</div>
<!-- code to see the assignment that attached from other user -->
<div class="block-content collapse in">
<div class="span12">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">

<thead>
<tr>

<th>File Name</th>

<th>Description</th>

<th>Date Upload</th>

<th>Upload By</th>

<th>Class</th>

</tr>

</thead>
<tbody>

<?php
$query =
mysql_query("select * FROM assignment LEFT JOIN teacher ON teacher.teacher_id =
assignment.teacher_id

LEFT JOIN teacher_class ON


teacher_class.teacher_class_id = assignment.class_id
INNER JOIN class ON class.class_id =
teacher_class.class_id ")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
?>

<tr>

<td><?php echo $row['fname']; ?></td>


<td><?php echo $row['fdesc']; ?></td>
<td><?php echo $row['fdatein']; ?></td>
<td><?php echo $row['firstname']." ".$row['lastname']; ?></td>
<td><?php echo $row['class_name']; ?></td>

</tr>

<?php } ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Backupdatabase.php - code for easily backup the database .


<?php include('header.php'); ?>
<?php include('session.php'); ?>
<body>
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/assignment_sidebar.php'); ?>
<div class="span9" id="contentdashboard">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Assignment File Uploaded List</div>
</div>
<!-- code to see the assignment that attached from other user -->
<div class="block-content collapse in">
<div class="span12">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">

<thead>
<tr>

<th>File Name</th>

<th>Description</th>

<th>Date Upload</th>

<th>Upload By</th>

<th>Class</th>

</tr>

</thead>
<tbody>

<?php
$query =
mysql_query("select * FROM assignment LEFT JOIN teacher ON teacher.teacher_id =
assignment.teacher_id

LEFT JOIN teacher_class ON


teacher_class.teacher_class_id = assignment.class_id

INNER JOIN class ON class.class_id =


teacher_class.class_id ")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
?>

<tr>

<td><?php echo $row['fname']; ?></td>


<td><?php echo $row['fdesc']; ?></td>
<td><?php echo $row['fdatein']; ?></td>
<td><?php echo $row['firstname']." ".$row['lastname']; ?></td>
<td><?php echo $row['class_name']; ?></td>

</tr>

<?php } ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Calendar.php - design of calendar with events and announcement.

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/assignment_sidebar.php'); ?>
<div class="span9" id="contentdashboard">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Assignment File Uploaded List</div>
</div>
<!-- code to see the assignment that attached from other user -->
<div class="block-content collapse in">
<div class="span12">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">

<thead>
<tr>

<th>File Name</th>

<th>Description</th>

<th>Date Upload</th>

<th>Upload By</th>

<th>Class</th>

</tr>

</thead>
<tbody>

<?php
$query =
mysql_query("select * FROM assignment LEFT JOIN teacher ON teacher.teacher_id =
assignment.teacher_id

LEFT JOIN teacher_class ON


teacher_class.teacher_class_id = assignment.class_id

INNER JOIN class ON class.class_id =


teacher_class.class_id ")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
?>

<tr>

<td><?php echo $row['fname']; ?></td>


<td><?php echo $row['fdesc']; ?></td>
<td><?php echo $row['fdatein']; ?></td>
<td><?php echo $row['firstname']." ".$row['lastname']; ?></td>
<td><?php echo $row['class_name']; ?></td>

</tr>

<?php } ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Class.php – list of class.

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<body>
<!-- list of class -->
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/class_sidebar.php'); ?>
<div class="span3" id="adduser">
<?php include('add_class.php'); ?>
</div>
<div class="span6" id="">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Class List</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form
action="delete_class.php" method="post">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">
<a data-
toggle="modal" href="#class_delete" id="delete" class="btn btn-danger" name=""><i
class="icon-trash icon-large"></i></a>

<?php include('modal_delete.php'); ?>


<thead>
<tr>

<th></th>

<th>Course Year And Section</th>

<th></th>
</tr>
</thead>
<tbody>
<?php
$class_query =
mysql_query("select * from class")or die(mysql_error());
while($class_row =
mysql_fetch_array($class_query)){
$id =
$class_row['class_id'];
?>

<tr>
<td
width="30">
<input
id="optionsCheckbox" class="uniform_on" name="selector[]" type="checkbox" value="<?php
echo $id; ?>">
</td>
<td><?php
echo $class_row['class_name']; ?></td>
<td
width="40"><a href="edit_class.php<?php echo '?id='.$id; ?>" class="btn btn-primary"><i
class="icon-pencil icon-large"></i> </a></td>

</tr>
<?php } ?>

</tbody>
</table>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

CODES FOR DELETE

Delete_student.php

<?php
include('dbcon.php');
include('session.php');
if (isset($_POST['delete_student'])){
// for deleting a student into the data base
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
mysql_query("DELETE FROM student where student_id='$id[$i]'");
mysql_query("DELETE FROM teacher_class_student where student_id='$id[$i]'");
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Deleted Student ID $id[$i]')")or die(mysql_error());
}
header("location: students.php");
}
?>

Delete_user.php
<?php
include('dbcon.php');
include('session.php');
if (isset($_POST['delete_user'])){
$id=$_POST['selector'];
$N = count($id);
// selection for deleting a specific user into the data base
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM users where user_id='$id[$i]'");
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Deleted Administrator Account ID $id[$i]')")or
die(mysql_error());
}
header("location: admin_user.php");
}
?>

Delete_teacher.php
<?php
include('dbcon.php');
include('session.php');
if (isset($_POST['delete_teacher'])){
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM teacher where teacher_id='$id[$i]'");
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Deleted Teacher ID $id[$i]')")or die(mysql_error());
}
header("location: teachers.php");
}
?>
Delete_sy.php - deleting of school year.

<?php
include('dbcon.php');
if (isset($_POST['delete_user'])){
$id=$_POST['selector'];
$N = count($id);
// selection for deleting a specific school year into the data base
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM school_year where school_year_id='$id[$i]'");
}
header("location: school_year.php");
}
?>

Delete_program.php
<?php
include('dbcon.php');
include('session.php');
if (isset($_POST['delete_program'])){
$id=$_POST['selector'];
// selection for deleting a specific program into the data base
$N = count($id);
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM program where program_id='$id[$i]'");
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Deleted Program ID $id[$i]')")or die(mysql_error());

}
header("location: program.php");
}
?>

Delete_event.php

<?php
include('dbcon.php');
$get_id = $_GET['id'];
// for deleting an event into the data base
mysql_query("delete from event where event_id = '$get_id'")or die(mysql_error());
?>
<script>
window.location = 'calendar_of_events.php';
</script>

Delete_department.php

<?php
include('dbcon.php');
include('session.php');
if (isset($_POST['delete_department'])){
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM department where department_id='$id[$i]'");
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Deleted Department ID $id[$i]')")or die(mysql_error());
}
header("location: department.php");
}
?>

Delete_class.php

<?php
include('dbcon.php');
include('session.php');
if (isset($_POST['delete_class'])){
// code for selection of specific class the need to delete
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM class where class_id='$id[$i]'");
mysql_query("insert into activity_log (date,username,action)
values(NOW(),'$user_username','Deleted Class ID $id[$i]')")or die(mysql_error());
}
header("location: class.php");
}
?>
CODE FOR EDITING

Edit_user.php

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- for editing a specific user into the data base
-->
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/admin_sidebar.php'); ?>
<div class="span3" id="adduser">
<?php include('edit_user_form.php'); ?>

</div>
<div class="span6" id="">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Admin Users List</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form action="delete_users.php"
method="post">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">
<a data-toggle="modal"
href="#user_delete" id="delete" class="btn btn-danger" name=""><i class="icon-trash icon-
large"></i></a>
<?php
include('modal_delete.php'); ?>
<thead>
<tr>

<th></th>

<th>Name</th>

<th>Username</th>
<th></th>
</tr>
</thead>
<tbody>

<?php

$user_query = mysql_query("select * from users")or die(mysql_error());

while($row = mysql_fetch_array($user_query)){

$id = $row['user_id'];

?>

<tr>
<td
width="30">
<input
id="optionsCheckbox" class="uniform_on" name="selector[]" type="checkbox" value="<?php
echo $id; ?>">
</td>

<td><?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?></td>

<td><?php echo $row['username']; ?></td>

<td
width="40">
<a
href="edit_user.php<?php echo '?id='.$id; ?>" data-toggle="modal" class="btn btn-success"><i
class="icon-pencil icon-large"></i></a>
</td>

</tr>
<?php
} ?>
</tbody>
</table>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>

<?php include('footer.php'); ?>


</div>
<?php include('script.php'); ?>
</body>

</html>

Edit_teacher.php

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- for editing a specific teacher into the data base
-->
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/teacher_sidebar.php'); ?>
<div class="span3" id="adduser">
<?php include('edit_teacher_form.php'); ?>

</div>
<div class="span6" id="">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Teacher List</div>
</div>
<div class="block-content collapse in">
<div class="span12"
id="teacherTableDiv">
<?php
include('teacher_table.php'); ?>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Edit_student.php

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- code design for editing a specific program into the data base
-->
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/student_sidebar.php'); ?>
<div class="span3" id="adduser">
<?php include('edit_students_form.php'); ?>

</div>
<div class="span6" id="">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Student List</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form
action="delete_student.php" method="post">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">
<a data-toggle="modal"
href="#student_delete" id="delete" class="btn btn-danger" name=""><i class="icon-trash icon-
large"></i></a>
<?php
include('modal_delete.php'); ?>
<thead>
<tr>

<th></th>

<th>Name</th>

<th>ID Number</th>

<th>Course Yr & Section</th>

<th></th>
</tr>
</thead>
<tbody>

<?php
$query = mysql_query("select * from student LEFT JOIN class ON
class.class_id = student.class_id ORDER BY student.student_id DESC") or die(mysql_error());
while ($row = mysql_fetch_array($query)) {
$id = $row['student_id'];
?>

<tr>
<td width="30">
<input
id="optionsCheckbox" class="uniform_on" name="selector[]" type="checkbox" value="<?php
echo $id; ?>">
</td>

<td><?php echo $row['firstname'] . " " . $row['lastname']; ?></td>


<td><?php echo
$row['username']; ?></td>

<td
width="100"><?php echo $row['class_name']; ?></td>

<td width="30"><a
href="edit_student.php<?php echo '?id='.$id; ?>" class="btn btn-success"><i class="icon-
pencil"></i> </a></td>

</tr>
<?php } ?>

</tbody>
</table>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Edit_school_year.php

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- code design for editing a specific school year into the data base
-->
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/school_year_sidebar.php'); ?>
<div class="span3" id="adduser">
<?php include('edit_school_year_form.php'); ?>

</div>
<div class="span6" id="">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">School Year List</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form action="delete_sy.php"
method="post">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">
<a data-toggle="modal"
href="#user_delete" id="delete" class="btn btn-danger" name=""><i class="icon-trash icon-
large"></i></a>
<?php
include('modal_delete.php'); ?>
<thead>
<tr>

<th></th>

<th>School Year</th>

<th></th>
</tr>
</thead>
<tbody>

<?php

$user_query = mysql_query("select * from school_year")or die(mysql_error());

while($row = mysql_fetch_array($user_query)){

$id = $row['school_year_id'];

?>

<tr>
<td
width="30">
<input
id="optionsCheckbox" class="uniform_on" name="selector[]" type="checkbox" value="<?php
echo $id; ?>">
</td>

<td><?php echo $row['school_year']; ?></td>

<td
width="40">
<a
href="edit_school_year.php<?php echo '?id='.$id; ?>" data-toggle="modal" class="btn btn-
success"><i class="icon-pencil icon-large"></i></a>
</td>

</tr>
<?php
} ?>
</tbody>
</table>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>

<?php include('footer.php'); ?>


</div>
<?php include('script.php'); ?>
</body>

</html>

Edit_program.php

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- code design for editing a specific program into the data base
-->
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/program_sidebar.php'); ?>

<div class="span9" id="content">


<div class="row-fluid">
<!-- <a
href="add_program.php" class="btn btn-info"><i class="icon-plus-sign icon-large"></i> Add
Program</a> -->
<!-- block -->
<div id="" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Edit Program</div>
</div>
<div class="block-content collapse in">
<a href="program.php"><i
class="icon-arrow-left"></i> Back</a>

<?php
$query =
mysql_query("select * from program where program_id = '$get_id'")or die(mysql_error());
$row =
mysql_fetch_array($query);
?>

<form class="form-
horizontal" method="post">
<div class="control-
group">
<label
class="control-label" for="programCode">Program Code</label>
<div
class="controls">
<input
type="text" value="<?php echo $row['program_code']; ?>" name="program_code"
id="inputProgramCode" placeholder="Program Code" required>
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="programTitle">Program Title</label>
<div
class="controls">
<input
type="text" value="<?php echo $row['program_title']; ?>" class="span8" name="program_title"
id="inputProgramTitle" placeholder="Program Title" required>
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="NumberOfUnits">Number of Units</label>
<div
class="controls">
<input
type="text" value="<?php echo $row['unit']; ?>" class="span1" name="unit"
id="inputNumberOfUnits" required>
</div>
</div>

<div class="control-
group">
<label
class="control-label" for="programSemester">Semester</label>
<div
class="controls">
<select
name="semester" required>

<option></option>

<option <?php if ($row['semester'] == '1st') echo 'selected'; ?>>1st</option>

<option <?php if ($row['semester'] == '2nd') echo 'selected'; ?>>2nd</option>

</select>
</div>
</div>

<div class="control-
group">
<label
class="control-label" for="programDescription">Description</label>
<div
class="controls">

<textarea name="description" id="ckeditor_full">

<?php echo $row['description']; ?>

</textarea>
</div>
</div>
<div class="control-
group">
<div
class="controls">

<button
name="update" type="submit" class="btn btn-success"><i class="icon-save icon-large"></i>
Update</button>
</div>
</div>
</form>

<?php
if
(isset($_POST['update'])){
$program_code =
$_POST['program_code'];
$program_title =
$_POST['program_title'];
$unit =
$_POST['unit'];
$description =
$_POST['description'];
$semester =
$_POST['semester'];

mysql_query("update
program set program_code = '$program_code' ,

program_title = '$program_title',

unit = '$unit',

description = '$description',

semester = '$semester'

where program_id = '$get_id' ")or die(mysql_error());


mysql_query("insert
into activity_log (date,username,action) values(NOW(),'$user_username','Edit Program
$program_code')")or die(mysql_error());

?>
<script>
window.location =
"program.php";
</script>
<?php
}

?>

</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Edit_department.php

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- code design for editing a specific department into the data base
-->
<?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/department_sidebar.php'); ?>
<div class="span3" id="adduser">
<?php include('edit_department_form.php'); ?>

</div>
<div class="span6" id="">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Department List</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form
action="delete_department.php" method="post">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">
<a data-toggle="modal"
href="#department_delete" id="delete" class="btn btn-danger" name=""><i class="icon-trash
icon-large"></i></a>
<?php
include('modal_delete.php'); ?>
<thead>
<tr>

<th></th>

<th>Department</th>

<th>Pesron In-charge</th>

<th></th>
</tr>
</thead>
<tbody>

<?php

$user_query = mysql_query("select * from department")or die(mysql_error());

while($row = mysql_fetch_array($user_query)){

$id = $row['department_id'];

?>

<tr>
<td width="30">

<input id="optionsCheckbox" class="uniform_on" name="selector[]" type="checkbox"


value="<?php echo $id; ?>">

</td>

<td><?php echo $row['department_name']; ?></td>

<td><?php echo $row['dean']; ?></td>

<td width="30"><a href="edit_department.php<?php echo '?id='.$id; ?>" class="btn btn-


success"><i class="icon-pencil icon-large"></i></a></td>

</tr>
<?php
} ?>
</tbody>
</table>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Edit_class.php

<?php include('header.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- for editing a specific class into the data base
--> <?php include('navbar.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('sidebar/class_sidebar.php'); ?>
<div class="span3" id="adduser">
<?php include('edit_class_form.php'); ?>

</div>
<div class="span6" id="">
<div class="row-fluid">
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">Class List</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form
action="delete_class.php" method="post">
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="example">
<a data-
toggle="modal" href="#class_delete" id="delete" class="btn btn-danger" name=""><i
class="icon-trash icon-large"></i></a>

<?php include('modal_delete.php'); ?>


<thead>
<tr>

<th></th>

<th>Course Year And Section</th>

<th></th>
</tr>
</thead>
<tbody>
<?php
$class_query =
mysql_query("select * from class")or die(mysql_error());
while($class_row =
mysql_fetch_array($class_query)){
$id =
$class_row['class_id'];
?>

<tr>
<td
width="30">
<input
id="optionsCheckbox" class="uniform_on" name="selector[]" type="checkbox" value="<?php
echo $id; ?>">
</td>
<td><?php
echo $class_row['class_name']; ?></td>
<td
width="40"><a href="edit_class.php<?php echo '?id='.$id; ?>" class="btn btn-success"><i
class="icon-pencil icon-large"></i> </a></td>

</tr>
<?php } ?>

</tbody>
</table>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>

</html>

Login
<?php
include('dbcon.php');
session_start();
// validation of user id if the user is existing and having permission to access the
portal
$username = $_POST['username'];
$password = sha1(md5($_POST['password']));

$query = mysql_query("SELECT * FROM users WHERE username='$username'


AND password='$password'")or die(mysql_error());
$count = mysql_num_rows($query);
$row = mysql_fetch_array($query);

if ($count > 0){

$_SESSION['id']=$row['user_id'];

echo 'true';

mysql_query("insert into user_log


(username,login_date,user_id)values('$username',NOW(),".$row['user_id'].")")or
die(mysql_error());
}else{
echo 'false';
}

?>

Logout.php – End the session if loging out.

<?php
include('dbcon.php');
include('session.php');
// update the date and time of logout into activity log into user log
mysql_query("update user_log set logout_Date = NOW() where user_id = '$session_id' ")or
die(mysql_error());

session_destroy();
header('location:index.php');

?>

Index.php – the main page.


<?php
// the main code of portal
include('header.php');
?>
<body id="login">
<div class="container">
<form id="login_form" class="form-signin" method="post">
<h3 class="form-signin-heading"><i class="icon-lock"></i> Admin Login</h3>
<input type="text" class="input-block-level" id="usernmae" name="username"
placeholder="Username" required>
<input type="password" class="input-block-level" id="password" name="password"
placeholder="Password" required>
<button name="login" class="btn btn-success" type="submit"><i class="icon-signin icon-
"></i> Sign in</button>

</form>
<script>
jQuery(document).ready(function(){
jQuery("#login_form").submit(function(e){
e.preventDefault();
var formData = jQuery(this).serialize();
$.ajax({
type: "POST",
url: "login.php",
data: formData,
success: function(html){
if(html=='true')
{
$.jGrowl("Welcome to Student Online Access
Portal", { header: 'Access Granted Administrator Account' });
var delay = 2000;
setTimeout(function(){ window.location =
'dashboard.php' }, delay);
}
else
{
$.jGrowl("Please Check your username and
Password", { header: 'Login Failed' });
}
}

});
return false;
});
});
</script>

</div> <!-- /container -->


<?php include('script.php'); ?>
</body>
</html>

TEACHER AND STUDENT CODES

About.php - code for display the information about mission and vision core values of school.

<?php include('header_dashboard.php'); ?>


<body id="class_div">
<?php include('navbar_about.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12" id="content">
<div class="row-fluid">
<!-- block -->
<div class="block">
<div class="navbar navbar-inner
block-header">
<div id="" class="muted
pull-right"><a href="index.php"><i class="icon-arrow-left"></i> Back</a></div>
</div>
<!-- getting data from mysql database -->
<div class="block-content collapse in">
<div class="span12">
<!-- get the vision, mission, corevalues into the title -->
<!-- and the title is a part of the content table in your database -->
<?php
$vision_query
= mysql_query("select * from content where title = 'vision' ")or die(mysql_error());
$vision_row =
mysql_fetch_array($vision_query);
echo
$vision_row['content'];
?>
<hr>

<?php

$mission_query = mysql_query("select * from content where title = 'mission' ")or


die(mysql_error());
$mission_row
= mysql_fetch_array($mission_query);
echo
$mission_row['content'];
?>
<hr>
<?php

$corevalues_query = mysql_query("select * from content where title = 'core values' ")or


die(mysql_error());

$corevalues_row = mysql_fetch_array($corevalues_query);
echo
$corevalues_row['content'];
?>
</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

CODE FOR ADDING

Add_announcement.php

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body id="class_div">
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('teacher_add_announcement_sidebar.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<!-- getting school year from school year table . -->
<!-- using array to get the specific school year -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
// using $school_year_query_row to
get this 'school_year' and using this $school_year to get the data of array
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#"><b>My
Class</b></a><span class="divider">/</span></li>
<li><a href="#">School Year:
<?php echo $school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div class="block">
<div class="navbar navbar-inner block-header">
<div id="count_class" class="muted pull-right">

</div>
</div>
<div class="block-content collapse in">
<div class="span8">
<form class=""
id="add_downloadble" method="post" >
<div class="control-group">

<div class="controls">

<textarea name="content"
id="ckeditor_full"></textarea>
</div>
</div>

<!-- using this script we can use jquery for our function to call the id of
add_downloadable and in the add_downloadable there is the url to save all announcement
"add_announcement_save.php" and if the data is confirm succefully the location will go in the
add_announcement.php -->

<script>
jQuery(document).ready(function($){
$("#add_downloadble").submit(function(e){
e.preventDefault();
var formData = $(this).serialize();
$.ajax({
type: "POST",
url: "add_announcement_save.php",
data: formData,
success: function(html){
$.jGrowl("Announcement Successfully
Added", { header: 'Announcement Added' });
window.location = 'add_announcement.php';
}

});
});
});
</script>

</div>
<div class="span4">

<div class="alert alert-info">Check The Class you want to put this


file.</div>

<div class="pull-left">
Check All <input type="checkbox"
name="selectAll" id="checkAll" />
<script>
$("#checkAll").click(function () {

$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>

</div>
<table
cellpadding="0" cellspacing="0" border="0" class="table" id="">

<thead>
<tr>

<th></th>

<th>Class Name</th>

<th>program Code</th>
</tr>
</thead>
<tbody>

<?php $query = mysql_query("select * from teacher_class


LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where teacher_id =
'$session_id' and school_year = '$school_year' ")or die(mysql_error());
$count =
mysql_num_rows($query);

while($row =
mysql_fetch_array($query)){
$id =
$row['teacher_class_id'];

?>
<tr id="del<?php
echo $id; ?>">
<td
width="30">
<input
id="" class="" name="selector[]" type="checkbox" value="<?php echo $id; ?>">
</td>
<td><?php
echo $row['class_name']; ?></td>
<td><?php
echo $row['program_code']; ?></td>
</tr>

<?php } ?>

</tbody>
</table>

</div>
<div class="span10">
<hr>
<center>
<div class="control-group">
<div
class="controls">

<button name="Upload" type="submit" value="Upload" class="btn btn-success" /><i


class="icon-check"></i>&nbsp;Post</button>
</div>
</div>
</center>

</form>
</div>
</div>
</div>
<!-- /block -->
</div>

</div>
<?php/*
include('teacher_right_sidebar.php') */?>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Add_announcement_save.php – code for saving the announcement into database.

<?php
include('admin/dbcon.php');
include('session.php');
$content = $_POST['content'];
$id=$_POST['selector'];
$N = count($id);
// use loop to find an specific id of teacher user to identify the owner of new
announcement
for($i=0; $i < $N; $i++)
{
mysql_query("insert into teacher_class_announcements
(teacher_class_id,teacher_id,content,date) values('$id[$i]','$session_id','$content',NOW())")or
die(mysql_error());
mysql_query("insert into notification
(teacher_class_id,notification,date_of_notification,link) value('$id[$i]','Add
Annoucements',NOW(),'announcements_student.php')")or die(mysql_error());
}
?>

Announcements_student.php - getting the teacher announcement from teacher class id that the
student able to see the announcement from teacher.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('annoucement_link_student.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<!-- getting the teacher announcement from teacher class
id that the student able to see the announcement from teacher -->

<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
?>

<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a
href="#"><b>Announcements</b></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left">List of
Announcement</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<?php
$query_announcement =
mysql_query("select * from teacher_class_announcements

where teacher_class_id = '$get_id' order by date DESC

")or die(mysql_error());
$count =
mysql_num_rows($query_announcement);
if ($count > 0){
while($row =
mysql_fetch_array($query_announcement)){
$id =
$row['teacher_class_announcements_id'];
?>
<div
class="post" id="del<?php echo $id; ?>">
<?php echo
$row['content']; ?>

<hr>

<strong><i
class="icon-calendar"></i> <?php echo $row['date']; ?></strong>

</div>

<?php }}else{ ?>


<div class="alert alert-info"><i
class="icon-info-sign"></i> No Announcements Found.</div>
<?php } ?>
</div>

</div>
</div>
<!-- /block -->
</div>

</div>

<script type="text/javascript">
$(document).ready( function() {

$('.remove').click( function() {

var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_announcements.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Post is Successfully Deleted", { header: 'Data Delete' });

}
});

return false;
});
});

</script>

</div>

</div>

<?php include('footer.php'); ?>


</div>
<?php include('script.php'); ?>
</body>
</html>

Announcements.php - list of announcement.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('annoucement_link.php'); ?>
<div class="span5" id="content">
<div class="row-fluid">
<!-- breadcrumb -->

<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
?>

<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a
href="#"><b>Announcements</b></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form method="post">
<textarea name="content"
id="ckeditor_full"></textarea>
<br>
<button name="post" class="btn btn-
success"><i class="icon-check icon-large"></i> Post</button>
</form>
</div>

<?php
if (isset($_POST['post'])){
$content =
$_POST['content'];
mysql_query("insert into
teacher_class_announcements (teacher_class_id,teacher_id,content,date)
values('$get_id','$session_id','$content',NOW())")or die(mysql_error());
mysql_query("insert into
notification (teacher_class_id,notification,date_of_notification,link) value('$get_id','Add
Annoucements',NOW(),'announcements_student.php')")or die(mysql_error());
?>
<script>
window.location =
'announcements.php<?php echo '?id='.$get_id; ?>';
</script>
<?php
}
?>
</div>
</div>
<!-- /block -->
</div>

</div>

<div class="span4 row-fluid" id="addclass">


<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left">List of
Announcement</div>

</div>
<div class="block-content collapse in">
<div class="span12">
<?php
$query_announcement =
mysql_query("select * from teacher_class_announcements

where teacher_id = '$session_id' and teacher_class_id = '$get_id'


order by date DESC

")or die(mysql_error());
while($row =
mysql_fetch_array($query_announcement)){
$id =
$row['teacher_class_announcements_id'];
?>
<div
class="post" id="del<?php echo $id; ?>">
<?php echo
$row['content']; ?>

<hr>

<strong><i
class="icon-calendar"></i> <?php echo $row['date']; ?></strong>

<div
class="pull-right">
<a class="btn
btn-link" href="#<?php echo $id; ?>" data-toggle="modal" ><i class="icon-remove"></i> </a>
</div>

<div
class="pull-right">
<form
method="post" action="edit_post.php<?php echo '?id='.$get_id; ?>">
<input
type="hidden" name="id" value="<?php echo $id; ?>">

<button class="btn btn-link" name="edit"><i class="icon-pencil"></i> </button>

</form>
</div>

</div>
<?php
include("remove_sent_message_modal.php"); ?>
<?php } ?>
</div>
</div>
</div>
<!-- /block -->
</div>

<script type="text/javascript">
$(document).ready( function() {

$('.remove').click( function() {

var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_announcements.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Post is Successfully Deleted", { header: 'Data Delete' });

}
});

return false;
});
});

</script>

</div>

</div>

<?php include('footer.php'); ?>


</div>
<?php include('script.php'); ?>
</body>
</html>

Add_student.php – code for teacher if the teacher want to add student in her class from
database .

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('class_sidebar.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<div class="pull-right">
<a href="my_students.php<?php echo
'?id='.$get_id; ?>" class="btn btn-info"><i class="icon-arrow-left"></i> Back</a>
</div>
<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
?>

<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#">My Students</a><span
class="divider">/</span></li>
<li><a href="#"><b>Add
Student</b></a></li>
</ul>

<!-- end breadcrumb -->


<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form method="post"
action="">

<button
name="submit" type="submit" class="btn btn-info"><i class="icon-save"></i>&nbsp;Add
Student</button>
<br>
<br>

<table cellpadding="0" cellspacing="0"


border="0" class="table" id="example">

<thead>

<tr>

<th>Photo</th>
<th>Name</th>
<th>Course Year and Section</th>

<th></th>
</tr>
</thead>
<tbody>

<?php
// using leftjoin to connect the student class
id into teacher class id
// and using while loop the data that hold of query will be find as
specific getting the student id into array

$a = 0 ;
$query =
mysql_query("select * from student LEFT JOIN class on class.class_id = student.class_id

") or
die(mysql_error());
while ($row =
mysql_fetch_array($query)) {
$id = $row['student_id'];
$a++;

?>

<tr>
<input type="hidden"
name="test" value="<?php echo $a; ?>">
// the output will be
here..
<td width="70"><img class="img-rounded" src="<?php echo
$row['profile_pic']; ?>" height="50" width="40"></td>
<td><?php echo $row['firstname'] . " " . $row['lastname']; ?></td>
<td><?php echo
$row['class_name']; ?></td>

<td width="80">
<select
name="add_student<?php echo $a; ?>" class="span12">
<option></option>

<option>Add</option>
</select>

<input type="hidden"
name="student_id<?php echo $a; ?>" value="<?php echo $id; ?>">
<input type="hidden"
name="class_id<?php echo $a; ?>" value="<?php echo $get_id; ?>">
<input type="hidden"
name="teacher_id<?php echo $a; ?>" value="<?php echo $session_id; ?>">

</td>

<?php } ?>

</tr>

</tbody>
</table>

</form>

<?php
if (isset($_POST['submit'])){

$test = $_POST['test'];
for($b = 1; $b <= $test; $b++)
{

$test1 = "student_id".$b;
$test2 = "class_id".$b;
$test3 = "teacher_id".$b;
$test4 = "add_student".$b;

$id = $_POST[$test1];
$class_id = $_POST[$test2];
$teacher_id = $_POST[$test3];
$Add = $_POST[$test4];

$query = mysql_query("select * from teacher_class_student where student_id = '$id' and


teacher_class_id = '$class_id' ")or die(mysql_error());
$count = mysql_num_rows($query);

if ($count > 0){ ?>


<script>
alert('Student Already in the class');

</script>
<script>
window.location = "add_student.php<?php echo '?id='.$get_id; ?>";
</script>

<?php
}else if($Add == 'Add'){

mysql_query("insert into teacher_class_student (student_id,teacher_class_id,teacher_id)


values('$id','$class_id','$teacher_id') ")or die(mysql_error());

?>
<script>
window.location = "my_students.php<?php echo '?id='.$get_id; ?>";
</script>
<?php
}

?>

</tbody>
</table>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Add_quiz_to_class.php - adding of quizzes in every class of teacher.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('quiz_sidebar_teacher.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<!-- connect your created quiz into your class -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());

$school_year_query_row = mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a
href="#"><b>My Class</b></a><span class="divider">/</span></li>
<li><a
href="#">School Year: <?php echo $school_year_query_row['school_year']; ?></a><span
class="divider">/</span></li>
<li><a
href="#"><b>Quiz</b></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<div class="pull-right">
<a href="teacher_quiz.php"
class="btn btn-info"><i class="icon-arrow-left"></i> Back</a>
</div>

<form class="form-
horizontal" method="post">
<div class="control-
group">
<label
class="control-label" for="inputEmail">Quiz</label>
<div
class="controls">
<select
name="quiz_id">

<option></option>
<?php
$query = mysql_query("select * from quiz where teacher_id = '$session_id'")or
die(mysql_error());
while
($row = mysql_fetch_array($query)){ $id = $row['quiz_id']; ?>

<option value="<?php echo $id; ?>"><?php echo $row['quiz_title']; ?></option>


<?php
} ?>
</select>
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="inputPassword">Test Time (in minutes)</label>
<div
class="controls">
<input
type="text" class="span3" name="time" id="inputPassword" placeholder="Test Time" required>
</div>
</div>

<table
class="table" id="question">
<th></th>
<th>Class</th>
<th>program</th>
<th></th>

<tbody>
<?php $query = mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where teacher_id =
'$session_id' and school_year = '$school_year' ")or die(mysql_error());
$count =
mysql_num_rows($query);

while($row =
mysql_fetch_array($query)){
$id =
$row['teacher_class_id'];

?>
<tr>
<td width="30">
<input id="optionsCheckbox" class="uniform_on"
name="selector[]" type="checkbox" value="<?php echo $id; ?>">
</td>
<td><?php echo $row['class_name']; ?></td>
<td><?php echo $row['program_code']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>

<div class="control-
group">
<div
class="controls">

<button name="save"
type="submit" class="btn btn-info"><i class="icon-save"></i> Save</button>
</div>
</div>
</form>

<!-- select a specific


teacher class id and connect it into quiz id -->
<?php
if
(isset($_POST['save'])){
$quiz_id =
$_POST['quiz_id'];
$time =
$_POST['time'] * 60;

$id=$_POST['selector'];

$name_notification = 'Add Practice Quiz file';

$N =
count($id);
for($i=0; $i <
$N; $i++)
{
mysql_query("insert into class_quiz (teacher_class_id,quiz_time,quiz_id)
values('$id[$i]','$time','$quiz_id')")or die(mysql_error());

mysql_query("insert into notification


(teacher_class_id,notification,date_of_notification,link)
value('$id[$i]','$name_notification',NOW(),'student_quiz_list.php')")or die(mysql_error());
} ?>
<script>

window.location = 'teacher_quiz.php';
</script>
<?php
}
?>

</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Add_quiz.php - saving of quizzes into database.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('quiz_sidebar_teacher.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<!-- adding for a new quiz -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());

$school_year_query_row = mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a
href="#"><b>My Class</b></a><span class="divider">/</span></li>
<li><a
href="#">School Year: <?php echo $school_year_query_row['school_year']; ?></a><span
class="divider">/</span></li>
<li><a
href="#"><b>Quiz</b></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<div class="pull-right">
<a href="teacher_quiz.php"
class="btn btn-info"><i class="icon-arrow-left"></i> Back</a>
</div>

<form class="form-
horizontal" method="post">
<div class="control-
group">
<label
class="control-label" for="inputEmail">Quiz Title</label>
<div
class="controls">
<input
type="text" name="quiz_title" id="inputEmail" placeholder="Quiz Title">
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="inputPassword">Quiz Description</label>
<div
class="controls">
<input
type="text" class="span8" name="description" id="inputPassword" placeholder="Quiz
Description" required>
</div>
</div>

<div class="control-
group">
<div
class="controls">
<button name="save"
type="submit" class="btn btn-success"><i class="icon-save"></i> Save</button>
</div>
</div>
</form>

<?php
if
(isset($_POST['save'])){
$quiz_title =
$_POST['quiz_title'];
$description =
$_POST['description'];
mysql_query("insert
into quiz (quiz_title,quiz_description,date_added,teacher_id)
values('$quiz_title','$description',NOW(),'$session_id')")or die(mysql_error());
?>
<script>
window.location =
'teacher_quiz.php';
</script>
<?php
}
?>

</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body></html>
Add_question.php - adding a question for quizzes.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('quiz_sidebar_teacher.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<!-- this code is for adding a question for your created
quiz -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());

$school_year_query_row = mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a
href="#"><b>My Class</b></a><span class="divider">/</span></li>
<li><a
href="#">School Year: <?php echo $school_year_query_row['school_year']; ?></a><span
class="divider">/</span></li>
<li><a
href="#"><b>Quiz Question</b></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right">
<a href="quiz_question.php<?php
echo '?id='.$get_id; ?>" class="btn btn-success"><i class="icon-arrow-left"></i> Back</a>
</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form class="form-horizontal"
method="post">
<div class="control-group">
<label
class="control-label" for="inputPassword">Question</label>
<div
class="controls">

<textarea name="question" id="ckeditor_full" required></textarea>


</div>
</div>
<!-- <div
class="control-group">
<label
class="control-label" for="inputEmail">Points</label>
<div
class="controls">

<input
type="number" class="span1" name="points" min=1 max=5 required>
</div>
</div> -->
<div class="control-
group">
<label
class="control-label" for="inputEmail">Question Type:</label>
<div
class="controls">
<select
id="qtype" name="question_tpye" required>

<option value=""></option>

<?php

$query_question = mysql_query("select * from question_type")or die(mysql_error());

while($query_question_row = mysql_fetch_array($query_question)){

?>

<option value="<?php echo $query_question_row['question_type_id']; ?>"><?php echo


$query_question_row['question_type']; ?></option>

<?php } ?>
</select>
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="inputEmail"></label>
<div
class="controls">

<div id="opt11">

A: <input type="text" name="ans1" size="60"> <input name="answer" value="A"


type="radio"><br><br>

B: <input type="text" name="ans2" size="60"> <input name="answer" value="B"


type="radio"><br><br>

C: <input type="text" name="ans3" size="60"> <input name="answer" value="C"


type="radio"><br><br>

D: <input type="text" name="ans4" size="60"> <input name="answer" value="D"


type="radio"><br><br>

</div>

<div id="opt12">

<input name="correctt" value="True" type="radio">True<br /><br />

<input name="correctt" value="False" type="radio">False<br /><br />

</div>
</div>
</div>

<div class="control-group">
<div
class="controls">

<button name="save"
type="submit" class="btn btn-info"><i class="icon-save"></i> Save</button>
</div>
</div>

</form>

<?php
if (isset($_POST['save'])){
$question = $_POST['question'];
$points = $_POST['points'];
$type = $_POST['question_tpye'];
$answer = $_POST['answer'];

$ans1 = $_POST['ans1'];
$ans2 = $_POST['ans2'];
$ans3 = $_POST['ans3'];
$ans4 = $_POST['ans4'];

if ($type == '2'){
mysql_query("insert into quiz_question
(quiz_id,question_text,date_added,answer,question_type_id)
values('$get_id','$question',NOW(),'".$_POST['correctt']."','$type')")or
die(mysql_error());
}else{

mysql_query("insert into quiz_question


(quiz_id,question_text,date_added,answer,question_type_id)
values('$get_id','$question',NOW(),'$answer','$type')")or die(mysql_error());
$query = mysql_query("select * from quiz_question order by quiz_question_id
DESC LIMIT 1")or die(mysql_error());
$row = mysql_fetch_array($query);
$quiz_question_id = $row['quiz_question_id'];

mysql_query("insert into answer (quiz_question_id,answer_text,choices)


values('$quiz_question_id','$ans1','A')")or die(mysql_error());
mysql_query("insert into answer (quiz_question_id,answer_text,choices)
values('$quiz_question_id','$ans2','B')")or die(mysql_error());
mysql_query("insert into answer (quiz_question_id,answer_text,choices)
values('$quiz_question_id','$ans3','C')")or die(mysql_error());
mysql_query("insert into answer (quiz_question_id,answer_text,choices)
values('$quiz_question_id','$ans4','D')")or die(mysql_error());

?>
<script>
window.location = 'quiz_question.php<?php echo '?id='.$get_id; ?>'
</script>
<?php
}
?>
</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<script>
jQuery(document).ready(function(){
jQuery("#opt11").hide();
jQuery("#opt12").hide();
jQuery("#opt13").hide();

jQuery("#qtype").change(function(){
var x = jQuery(this).val();
if(x == '1') {
jQuery("#opt11").show();
jQuery("#opt12").hide();
jQuery("#opt13").hide();
} else if(x == '2') {
jQuery("#opt11").hide();
jQuery("#opt12").show();
jQuery("#opt13").hide();
} else {
jQuery("#opt11").hide();
jQuery("#opt12").hide();
jQuery("#opt13").hide();
}
});

});
</script>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>
Add_class.php - in this code the teacher can add a class from the database created by admin.
<!-- block -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"><h4><i class="icon-plus-sign"></i> Add
class</h4></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form id="add_class"
method="post" >
<div class="control-
group">
<label>Class
Name:</label>
<div class="controls">
<input
type="hidden" name="session_id" value="<?php echo $session_id; ?>">
<select name="class_id" class="class_id" required>
<option></option>
<?php
$query =
mysql_query("select * from class order by class_name");
while($row =
mysql_fetch_array($query)){

?>
<option
value="<?php echo $row['class_id']; ?>"><?php echo $row['class_name']; ?></option>
<?php } ?>
</select>
</div>
</div>

<div class="control-
group">

<label>program:</label>
<div class="controls">
<select name="program_id" class="class_id" required>
<option></option>
<?php
$query =
mysql_query("select * from program order by program_code");
while($row =
mysql_fetch_array($query)){
?>
<option
value="<?php echo $row['program_id']; ?>"><?php echo $row['program_title']; ?></option>
<?php } ?>
</select>
</div>
</div>

<div class="control-
group">
<label>School
Year:</label>
<div class="controls">
<?php
$query =
mysql_query("select * from school_year order by school_year DESC");
$row =
mysql_fetch_array($query);
?>
<input
class="span5" type="text" class="" name="school_year" value="<?php echo
$row['school_year']; ?>" readonly >
</div>
</div>
<div
class="control-group">
<div class="controls">

<button name="save" class="btn btn-success"><i class="icon-save"></i> Save</button>


</div>
</div>
</form>

<?php
if (isset($_POST['save'])){

$session_id = $_POST['session_id'];
$program_id =
$_POST['program_id'];
$class_id = $_POST['class_id'];
$school_year =
$_POST['school_year'];

// findind data of teacher id to


connect your new adding class that having a program id
$query = mysql_query("select *
from teacher_class where program_id = '$program_id' and class_id = '$class_id' and teacher_id =
'$session_id' and school_year = '$school_year' ")or die(mysql_error());
$count = mysql_num_rows($query);

if ($count > 0){ ?>


<script>
$.jGrowl("Class Already Exist", {
header: 'Add Class Failed!' });
</script>
<?php
}else{
mysql_query("insert into
teacher_class (teacher_id,program_id,class_id,thumbnails,school_year)
values('$session_id','$program_id','$class_id','uploads/classroom.jpg','$school_year')")or
die(mysql_error());

$teacher_class =
mysql_query("select * from teacher_class order by teacher_class_id DESC")or
die(mysql_error());
$teacher_row =
mysql_fetch_array($teacher_class);
$teacher_id =
$teacher_row['teacher_id'];
$teacher_class_id =
$teacher_row['teacher_class_id'];

$insert_query =
mysql_query("select * from student where class_id = '$class_id'")or die(mysql_error());
while($row =
mysql_fetch_array($insert_query)){
$id = $row['student_id'];
mysql_query("insert into
teacher_class_student (student_id,teacher_class_id,teacher_id)
values('$id','$teacher_class_id','$teacher_id') ")or die(mysql_error());
echo "yes";
}
?>
<script>
window.location =
"dashboard_teacher.php";
</script>

<?php
}
}
?>

</div>
</div>
</div>
<!-- /block -->

Add_assignment_save.php – this code is for restoring of assignment in the database.

<?php
include('admin/dbcon.php');
include('session.php');
require("opener_db.php");
$name=$_POST['name'];
$filedesc=$_POST['desc'];

$input_name = basename($_FILES['uploaded_file']['name']);
echo $input_name ;
if ($input_name == ""){
$id=$_POST['selector'];
$N = count($id);
// save and adding a new data of assignment your file that you
attach will be save because of thi code
for($i=0; $i < $N; $i++)
{
mysql_query("INSERT INTO assignment
(fdesc,fdatein,teacher_id,class_id) VALUES ('$filedesc',NOW(),'$session_id','$id[$i]')")or
die(mysql_error());
mysql_query("insert into notification
(teacher_class_id,date_of_notification,link) value('$id[$i]',NOW(),'assignment_student.php')")or
die(mysql_error());
}
}else{
$rd2 = mt_rand(1000, 9999) . "_File";
$filename = basename($_FILES['uploaded_file']['name']);
$ext = substr($filename, strrpos($filename, '.') + 1);
$newname = "uploads/" . $rd2 . "_" . $filename;
$name_notification = 'Add Assignment file name'." ".'<b>'.$name.'</b>';
(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $newname));
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
mysql_query("INSERT INTO assignment
(fdesc,floc,fdatein,teacher_id,fname,class_id) VALUES
('$filedesc','$newname',NOW(),'$session_id','$name','$id[$i]')")or die(mysql_error());
mysql_query("insert into notification
(teacher_class_id,notification,date_of_notification,link)
value('$id[$i]','$name_notification',NOW(),'assignment_student.php')")or die(mysql_error());
}
}
?>

Add_assignment.php – adding an assignment but not already restore into the database.
<?php include('header_dashboard.php'); ?>
<?php include('session.php'); ?>
<body id="class_div">
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('teacher_add_assignment_sidebar.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<!-- adding assignment is need to have a school year so i
use array to find th school year data -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#"><b>My
Class</b></a><span class="divider">/</span></li>
<li><a href="#">School Year:
<?php echo $school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div class="block">
<div class="navbar navbar-inner block-header">
<div id="count_class" class="muted pull-right">

</div>
</div>
<div class="block-content collapse in">
<div class="span4">
<form class=""
id="add_downloadble" method="post" enctype="multipart/form-data" name="upload" >
<div
class="control-group">

<label class="control-label" for="inputEmail">File</label>

<div class="controls">
<!-- to
attachment of file -->

<input name="uploaded_file" class="input-file uniform_on" id="fileInput" type="file" >

<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />

<input type="hidden" name="id" value="<?php echo $session_id ?>"/>

</div>
</div>
<div
class="control-group">

<div class="controls">

<input type="text" name="name" Placeholder="File Name" class="input">

</div>
</div>
<div
class="control-group">

<div class="controls">

<textarea id="assigntextare" placeholder="Description" name="desc"


required></textarea>

</div>
</div>

</div>
<div class="span8">

<div class="alert alert-info"><!-- Check The Class you want to put this
file.</div>
check the specific class to send your assignment -->
<div class="pull-left">
Check All <input type="checkbox"
name="selectAll" id="checkAll" />
<script>
$("#checkAll").click(function () {

$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>

</div>
<table
cellpadding="0" cellspacing="0" border="0" class="table" id="">

<thead>
<tr>

<th></th>

<th>Class Name</th>

<th>program Code</th>
</tr>

</thead>
<tbody>

<!-- using left join


we connect the teacher claas into teacher id -->
<?php $query = mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where teacher_id =
'$session_id' and school_year = '$school_year' ")or die(mysql_error());
$count =
mysql_num_rows($query);

while($row =
mysql_fetch_array($query)){
$id =
$row['teacher_class_id'];
?>
<tr id="del<?php
echo $id; ?>">
<td
width="30">
<input
id="" class="" name="selector[]" type="checkbox" value="<?php echo $id; ?>">
</td>
<td><?php
echo $row['class_name']; ?></td>
<td><?php
echo $row['program_code']; ?></td>
</tr>

<?php } ?>

</tbody>
</table>

</div>
<div class="span10">
<hr>
<center>
<div class="control-group">
<div
class="controls">

<button name="upload" type="submit" value="upload" class="btn btn-success" /><i


class="icon-upload-alt"></i>&nbsp;Upload</button>
</div>
</div>
</center>

</form>
</div>
</div>
</div>
<!-- /block -->
</div>
<script>
jQuery(document).ready(function($){
$("#add_downloadble").submit(function(e){
$.jGrowl("Uploading File Please Wait......", { sticky: true
});
e.preventDefault();
var _this = $(e.target);
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
url: "add_assignment_save.php",
data: formData,
success: function(html){
$.jGrowl("Assignment Successfully Added",
{ header: 'Assignment Added' });
window.location = 'add_assignment.php';
},
cache: false,
contentType: false,
processData: false
});
});
});
</script>

</div>
<?php/*
include('teacher_right_sidebar.php') */?>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

CODE FOR DELETE

Delete_quiz_question.php - deleting of quiz question that you create into the database.

<?php
include('dbcon.php');
if (isset($_POST['backup_delete'])){
$id=$_POST['selector'];
$get_id=$_POST['get_id'];
$N = count($id);
// selection of deleting of quiz
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM quiz_question where
quiz_question_id='$id[$i]'");
}
?>
<script>
window.location = 'quiz_question.php<?php echo '?id='.$get_id ?>';
</script>
<?php
}
?>

Delete_quiz.php - delete quiz into the database using this code.

<?php
include('dbcon.php');
if (isset($_POST['backup_delete'])){
$id=$_POST['selector'];
$N = count($id);
// selection for deleting of quiz
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM quiz where quiz_id='$id[$i]'");
}
header("location: teacher_quiz.php");
}
?>

Delete_file.php - deleting of file that you uploud or attached in assignment.

<?php
include('admin/dbcon.php');
$id = $_POST['id'];
// deleting of files that attach already
mysql_query("delete from files where file_id = '$id' ")or die(mysql_error());
?>

Delete_class_quiz.php - delete classquiz that teacher create .

<?php
include('dbcon.php');
// selection of quiz that you want delete
if (isset($_POST['backup_delete'])){
$get_id=$_GET['id'];
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM class_quiz where class_quiz_id='$id[$i]'")or
die(mysql_error());
}
?>
<script>
window.location = "class_quiz.php<?php echo '?id='.$get_id; ?>"
</script>
<?php
}
?>

Delete_class.php

<?php
include('admin/dbcon.php');
$get_id = $_POST['id'];
// deleting of class easier using this code if you try to delete the class in class teacher it will be
delete already in other like in the student data
mysql_query("delete from teacher_class where teacher_class_id = '$get_id' ")or
die(mysql_error());
mysql_query("delete from teacher_class_student where teacher_class_id = '$get_id' ")or
die(mysql_error());
mysql_query("delete from teacher_class_announcements where teacher_class_id = '$get_id'
")or die(mysql_error());
mysql_query("delete from teacher_notification where teacher_class_id = '$get_id' ")or
die(mysql_error());
mysql_query("delete from class_program_overview where teacher_class_id = '$get_id' ")or
die(mysql_error());
header('location:dashboard_teacher.php');
?>

Delete_backpack.php

<?php
include('dbcon.php');
if (isset($_POST['backup_delete'])){
$id=$_POST['selector'];
$N = count($id);
// if the teacher wants to delete or clear the backap
for($i=0; $i < $N; $i++)
{
$result = mysql_query("DELETE FROM teacher_backpack where file_id='$id[$i]'");
}
header("location: teacher_backpack.php");
}
?>

Delete_assignment.php

<?php
include('admin/dbcon.php');
$id = $_POST['id'];
$get_id = $_POST['get_id'];
// to delete the asignment data into data base
mysql_query("delete from assignment where assignment_id = '$id' ")or die(mysql_error());
?>
<script>
window.location = 'assignment.php<?php echo '?id='.$get_id; ?>'
</script>

EDITING CODE

Edit_quiz.php - you can edit your created quiz if there’s a wrong.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('quiz_sidebar_teacher.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());

$school_year_query_row = mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a
href="#"><b>My Class</b></a><span class="divider">/</span></li>
<li><a
href="#">School Year: <?php echo $school_year_query_row['school_year']; ?></a><span
class="divider">/</span></li>
<li><a
href="#"><b>Quiz</b></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<div class="pull-right">
<a href="teacher_quiz.php"
class="btn btn-info"><i class="icon-arrow-left"></i> Back</a>
</div>
<?php
$query = mysql_query("select *
from quiz where quiz_id = '$get_id'")or die(mysql_error());
$row = mysql_fetch_array($query);

?>
<form class="form-
horizontal" method="post">
<div class="control-
group">
<label
class="control-label" for="inputEmail">Quiz Title</label>
<div
class="controls">
<input
type="hidden" name="quiz_id" value="<?php echo $row['quiz_id']; ?>" id="inputEmail"
placeholder="Quiz Title">
<input
type="text" name="quiz_title" value="<?php echo $row['quiz_title']; ?>" id="inputEmail"
placeholder="Quiz Title">
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="inputPassword">Quiz Description</label>
<div
class="controls">
<input
type="text" value="<?php echo $row['quiz_description']; ?>" class="span8" name="description"
id="inputPassword" placeholder="Quiz Description" required>
</div>
</div>

<div class="control-
group">
<div
class="controls">
<button name="save"
type="submit" class="btn btn-success"><i class="icon-save"></i> Save</button>
</div>
</div>
</form>

<?php
if
(isset($_POST['save'])){
$quiz_id =
$_POST['quiz_id'];
$quiz_title =
$_POST['quiz_title'];
$description =
$_POST['description'];
mysql_query("update
quiz set quiz_title = '$quiz_title',quiz_description = '$description' where quiz_id = '$quiz_id'")or
die(mysql_error());
?>
<script>
window.location =
'teacher_quiz.php';
</script>
<?php
}
?>

</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Edit_question.php

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<?php $quiz_question_id = $_GET['quiz_question_id']; ?>
<body>
<!-- funtion for editing question -->
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('quiz_sidebar_teacher.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());

$school_year_query_row = mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a
href="#"><b>My Class</b></a><span class="divider">/</span></li>
<li><a
href="#">School Year: <?php echo $school_year_query_row['school_year']; ?></a><span
class="divider">/</span></li>
<li><a
href="#"><b>Quiz Question</b></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right">
<a href="quiz_question.php<?php
echo '?id='.$get_id; ?>" class="btn btn-success"><i class="icon-arrow-left"></i> Back</a>
</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<?php
$query =
mysql_query("select * FROM quiz_question
LEFT JOIN
question_type on quiz_question.question_type_id = question_type.question_type_id
where quiz_id =
'$get_id' and quiz_question_id = '$quiz_question_id' order by date_added DESC ")or
die(mysql_error());
$row =
mysql_fetch_array($query);
?>

<form class="form-horizontal"
method="post">
<div class="control-group">
<label
class="control-label" for="inputPassword">Question</label>
<div
class="controls">

<textarea name="question" id="ckeditor_full" required><?php echo


$row['question_text']; ?></textarea>
</div>
</div>
<!-- <div
class="control-group">
<label
class="control-label" for="inputEmail">Points</label>
<div
class="controls">

<input
type="number" class="span1" name="points" min=1 max=5 required>
</div>
</div> -->
<div class="control-
group">
<label
class="control-label" for="inputEmail">Question Type:</label>
<div
class="controls">
<select
id="qtype" name="question_tpye" required>
<option value="<?php echo $row['question_type_id']; ?>" ><?php echo
$row['question_type']; ?></option>

<?php

$query_question = mysql_query("select * from question_type")or die(mysql_error());

while($query_question_row = mysql_fetch_array($query_question)){

?>

<option value="<?php echo $query_question_row['question_type_id']; ?>"><?php echo


$query_question_row['question_type']; ?></option>

<?php } ?>

</select>
</div>
</div>
<div class="control-
group">
<label
class="control-label" for="inputEmail"></label>
<div
class="controls">
<div id="opt11">
<?php
$sqlz = mysql_query("SELECT * FROM answers WHERE q_id = ".$_GET['edit']."");
while($rowz = mysql_fetch_array($sqlz)){
if($rowz['choice'] == 'A'){
$a = $rowz['value'];
} else if($rowz['choice'] == 'B'){
$b = $rowz['value'];
} else if($rowz['choice'] == 'C'){
$c = $rowz['value'];
} else if($rowz['choice'] == 'D'){
$d = $rowz['value'];
}
}
?>
A.)<input type="text" name="ans1" size="60" value="<?php echo $a;?>"><input
name="correctm" value="A" <?php if($rowa['correct'] == 'A'){ echo 'checked'; }?>
type="radio"><br /><br />
B.)<input type="text" name="ans2" size="60" value="<?php echo $b;?>"><input
name="correctm" value="B" <?php if($rowa['correct'] == 'B'){ echo 'checked'; }?>
type="radio"><br /><br />
C.)<input type="text" name="ans3" size="60" value="<?php echo $c;?>"><input
name="correctm" value="C" <?php if($rowa['correct'] == 'C'){ echo 'checked'; }?>
type="radio"><br /><br />
D.)<input type="text" name="ans4" size="60" value="<?php echo $d;?>"><input
name="correctm" value="D" <?php if($rowa['correct'] == 'D'){ echo 'checked'; }?>
type="radio"><br /><br />
</div>
<div id="opt12">
<input name="correctt" <?php if($row['answer'] == 'True'){ echo 'checked'; }?>
value="t" type="radio">True<br /><br />
<input name="correctt" <?php if($row['answer'] == 'False'){ echo 'checked'; }?>
value="f" type="radio">False<br /><br />
</div>
</div>
</div>

<div class="control-group">
<div
class="controls">

<button name="save"
type="submit" class="btn btn-info"><i class="icon-save"></i> Save</button>
</div>
</div>

</form>

<?php
if (isset($_POST['save'])){
$question = $_POST['question'];
$points = $_POST['points'];
$type = $_POST['question_tpye'];
$answer = $_POST['answer'];

$ans1 = $_POST['ans1'];
$ans2 = $_POST['ans2'];
$ans3 = $_POST['ans3'];
$ans4 = $_POST['ans4'];
if ($type == '2'){
mysql_query("insert into quiz_question
(quiz_id,question_text,date_added,answer,question_type_id)
values('$get_id','$question',NOW(),'".$_POST['correctt']."','$type')")or
die(mysql_error());
}else{

mysql_query("insert into quiz_question


(quiz_id,question_text,date_added,answer,question_type_id)
values('$get_id','$question',NOW(),'$answer','$type')")or die(mysql_error());
$query = mysql_query("select * from quiz_question order by quiz_question_id
DESC LIMIT 1")or die(mysql_error());
$row = mysql_fetch_array($query);
$quiz_question_id = $row['quiz_question_id'];

mysql_query("insert into answer (quiz_question_id,answer_text,choices)


values('$quiz_question_id','$ans1','A')")or die(mysql_error());
mysql_query("insert into answer (quiz_question_id,answer_text,choices)
values('$quiz_question_id','$ans2','B')")or die(mysql_error());
mysql_query("insert into answer (quiz_question_id,answer_text,choices)
values('$quiz_question_id','$ans3','C')")or die(mysql_error());
mysql_query("insert into answer (quiz_question_id,answer_text,choices)
values('$quiz_question_id','$ans4','D')")or die(mysql_error());

?>
<script>
window.location = 'quiz_question.php<?php echo '?id='.$get_id; ?>'
</script>
<?php
}
?>
</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<script>
jQuery(document).ready(function(){
jQuery("#opt11").hide();
jQuery("#opt12").hide();
jQuery("#opt13").hide();
jQuery("#qtype").change(function(){
var x = jQuery(this).val();
if(x == '1') {
jQuery("#opt11").show();
jQuery("#opt12").hide();
jQuery("#opt13").hide();
} else if(x == '2') {
jQuery("#opt11").hide();
jQuery("#opt12").show();
jQuery("#opt13").hide();
}
});

});
</script>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Edit_post.php – If the user want to edit her/his post .

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<?php

$get_id1 = $_POST['id'];
?>
<!-- here is the function how you can edit your post -->
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('annoucement_link.php'); ?>
<div class="span9" id="content">

<div class="row-fluid">
<!-- breadcrumb -->

<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
?>

<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a
href="#"><b>Announcements</b></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">

<div class="navbar navbar-inner block-header">


<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<a href="announcements.php<?php
echo '?id='.$get_id; ?>"><i class="icon-arrow-left icon-large"></i> Back</a>
<br>
<br>
<!-- edit your announcemen -->t
<form method="post">
<?php
$query_announcement =
mysql_query("select * from teacher_class_announcements

where teacher_id = '$session_id' and


teacher_class_announcements_id = '$get_id1' and teacher_class_id = '$get_id' order by date
DESC

")or die(mysql_error());
$row =
mysql_fetch_array($query_announcement);
$id =
$row['teacher_class_announcements_id'];
?>
<input type="hidden" name="id"
value="<?php echo $id; ?>">
<textarea name="content"
id="ckeditor_full">
<?php echo $row['content']; ?>
</textarea>
<br>
<button name="post" class="btn btn-
info"><i class="icon-check icon-large"></i> Post</button>
</form>
</div>

<?php
if (isset($_POST['post'])){
$content =
$_POST['content'];
$id = $_POST['id'];

mysql_query("update
teacher_class_announcements set content = '$content' where teacher_class_announcements_id =
'$id' ")or die(mysql_error());
?>
<script>
window.location =
'announcements.php<?php echo '?id='.$get_id; ?>';
</script>
<?php
}
?>
</div>
</div>
<!-- /block -->
</div>

</div>

<script type="text/javascript">
$(document).ready( function() {
$('.remove').click( function() {

var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_announcements.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Post is Successfully Deleted", { header: 'Data Delete' });

}
});

return false;
});
});

</script>

</div>

</div>

<?php include('footer.php'); ?>


</div>
<?php include('script.php'); ?>
</body>
</html>

MAIN PAGE OF TEACHER AND STUDENT


Index.php
<?php

include('header.php');
?>
<!-- the main session the you can see -->
<body id="login">
<div class="container">
<div class="row-fluid">
<div class="span8"><div class="pull-center"><?php
include('title_index.php'); ?></div></div>
<div class="span4"><div class="pull-center"><?php
include('login_form.php'); ?></div></div>
</div>
<div class="row-fluid">
<div class="span12"><div class="index-footer"><?php
include('link.php'); ?></div></div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Login.php - process of validating the data of user if the user is existing and have a permission to
access a account.

<?php
// including the data base to find the data needs
include('admin/dbcon.php');
session_start();
$username = $_POST['username'];
$password = sha1(md5($_POST['password']));
/* student */
$query = "SELECT * FROM student WHERE username='$username'
AND password='$password'";
$result = mysql_query($query)or die(mysql_error());
$row = mysql_fetch_array($result);
$num_row = mysql_num_rows($result);

/* teacher */
$query_teacher = mysql_query("SELECT * FROM teacher WHERE
username='$username' AND password='$password'")or die(mysql_error());
$num_row_teacher = mysql_num_rows($query_teacher);
$row_teahcer = mysql_fetch_array($query_teacher);

if( $num_row > 0 ) {


$_SESSION['id']=$row['student_id'];
echo 'true_student';
}else if ($num_row_teacher > 0){
$_SESSION['id']=$row_teahcer['teacher_id'];
echo 'true';

}else{
echo 'false';
}

?>

Login_form.php – the output form design of login .

<form id="login_form1" class="form-signin" method="post">


<h3 class="form-signin-heading"><i class="icon-
lock"></i> Sign in</h3>
<input type="text" class="input-block-level"
id="username" name="username" placeholder="Username" required>
<input type="password" class="input-block-level"
id="password" name="password" placeholder="Password" required>
<button data-placement="right" title="Click Here to
Sign In" id="signin" name="login" class="btn btn-success" type="submit">
<i class="icon-signin icon-large"></i> Sign
in</button>

<script type="text/javascript">

$(document).ready(function(){

$('#signin').tooltip('show');

$('#signin').tooltip('hide');

});

</script>
</form>
<script>
jQuery(document).ready(function(){
jQuery("#login_form1").submit(function(e){
e.preventDefault();
var formData =
jQuery(this).serialize();
$.ajax({
type: "POST",
url: "login.php",
data: formData,
success: function(html){
if(html=='true')
{
$.jGrowl("Loading File
Please Wait......", { sticky: true });
$.jGrowl("Welcome to
Student Online Access Portal", { header: 'Access Granted' });
var delay = 1000;

setTimeout(function(){ window.location = 'dashboard_teacher.php' }, delay);


}else if (html ==
'true_student'){
$.jGrowl("Welcome
to Student Online Access Portal", { header: 'Access Granted' });
var delay = 1000;

setTimeout(function(){ window.location = 'student_notification.php' }, delay);


}else
{
$.jGrowl("Please Check your
username and Password", { header: 'Login Failed' });
}
}
});
return false;
});
});
</script>
<div id="button_form" class="form-signin" >
New to Student Online Access Portal (S.O.A.P)
<hr>
<h3 class="form-signin-heading"><i class="icon-edit"></i> Sign
up</h3>
<button data-placement="top" title="Sign In as Student"
id="signin_student" onclick="window.location='signup_student.php'" id="btn_student"
name="login" class="btn btn-success" type="submit">I`m a Student</button>
<div class="pull-right">
<button data-placement="top" title="Sign In as Teacher"
id="signin_teacher" onclick="window.location='signup_teacher.php'" name="login" class="btn
btn-success" type="submit">I`m a Teacher</button>
</div>
</div>

<script type="text/javascript">

$(document).ready(function(){
$('#signin_student').tooltip('show'); $('#signin_student').tooltip('hide');

});

</script>

<script type="text/javascript">

$(document).ready(function(){

$('#signin_teacher').tooltip('show'); $('#signin_teacher').tooltip('hide');

});

</script>

Logout.php – function to end the session.

<?php
session_start();
session_destroy();
header('location:index.php');
?>

Move_to_school_year.php- changing of year .


<!-- user delete modal -->
<div id="user_delete" class="modal hide fade" tabindex="-
1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">x</button>
<h3 id="myModalLabel">Copy File?</h3>
</div>
<div class="modal-body">

<center>
<div class="control-
group">
<label>To
what class School Year:</label>
<div class="controls">
<input
type="hidden" name="get_id" value="<?php echo $get_id; ?>">
<select name="school_year" class="">
<option></option>
<?php
$query1 =
mysql_query("select * from teacher_class where class_id ='$class_id' and school_year !=
'$school_year'")or die(mysql_error());
while($row =
mysql_fetch_array($query1)){

?>

<option><?php echo $row['school_year']; ?></option>


<input
type="hidden" name="teacher_class_id" value="<?php echo $row['teacher_class_id']; ?>">
<?php } ?>
</select>
</div>
</div>

<div
class="control-group">
<div class="controls">
<button
name="delete_user" class="btn btn-danger"><i class="icon-copy"></i> Copy</button>
</div>
</div>
</center>

<center>
<div class="control-
group">
<label>--------
----Or----------</label>
<div class="control-group">
<div class="controls">
<button
name="copy" class="btn btn-info"><i class="icon-copy"></i> Copy to Backpack</button>
</div>
</div>
</div>

</center>

<center>
<div class="control-
group">
<label>--------
----Or----------</label>
<div class="control-group">
<div class="controls">
<p>Share To:</p>

<div class="control-group">

<label>To:</label>
<div class="controls">
<select name="teacher_id1" class="" required>
<option></option>
<?php
$query =
mysql_query("select * from teacher order by firstname");
while($row =
mysql_fetch_array($query)){

?>

<option
value="<?php echo $row['teacher_id']; ?>"><?php echo $row['firstname']; ?> <?php echo
$row['lastname']; ?> </option>

<?php } ?>
</select>

</div>
</div>

<button
name="share" class="btn btn-success"><i class="icon-copy"></i> Share</button>
</div>
</div>
</div>

</center>

</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-
hidden="true"><i class="icon-remove icon-large"></i> Close</button>
</div>
</div>

My_classmate.php – this code is for student to easy see her/his classmate in specific class.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('my_classmates_link.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- code to see the other user that in the same class -->
<!-- breadcrumb -->
<?php $query = mysql_query("select * from
teacher_class_student
LEFT JOIN teacher_class ON
teacher_class.teacher_class_id = teacher_class_student.teacher_class_id
JOIN class ON class.class_id = teacher_class.class_id
JOIN program ON program.program_id =
teacher_class.program_id
where student_id = '$session_id'
")or die(mysql_error());
$row = mysql_fetch_array($query);
$id = $row['teacher_class_student_id'];
?>
<ul class="breadcrumb">
<li><a href="#"><?php echo
$row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$row['school_year']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><b>My
Classmates</b></a></li>
</ul>

<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<ul id="da-thumbs"
class="da-thumbs">
<?php

$my_student = mysql_query("SELECT *

FROM teacher_class_student

LEFT JOIN student ON student.student_id = teacher_class_student.student_id

INNER JOIN class ON class.class_id = student.class_id where teacher_class_id =


'$get_id' order by lastname ")or die(mysql_error());

while($row = mysql_fetch_array($my_student)){

$id = $row['teacher_class_student_id'];

?>

<li
id="del<?php echo $id; ?>">
<a
class="classmate_cursor" href="#">

<img id="student_avatar_class" src ="<?php echo $row['profile_pic'] ?>" width="124"


height="140" class="img-polaroid">

<div><span></span></div>
</a>
<p
class="class"><?php echo $row['lastname'];?></p>
<p
class="program"><?php echo $row['firstname']; ?></p>
</li>
<?php } ?>
</ul>
</tbody>
</table>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

My_classmates_link.php – to connect the student user into other student user and knowing
her/his classmate.

<div class="span3" id="sidebar">


<img id="avatar" src="<?php echo $row['profile_pic']; ?>" class="img-polaroid">
<ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
<li class=""><a href="dashboard_student.php"><i class="icon-
chevron-right"></i><i class="icon-chevron-left"></i>&nbsp;Back</a></li>
<li class="active"><a href="my_classmates.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-group"></i>&nbsp;My
Classmates</a></li>
<li class=""><a href="progress.php<?php echo '?id='.$get_id;
?>"><i class="icon-chevron-right"></i><i class="icon-bar-chart"></i>&nbsp;My
Progress</a></li>
<li class=""><a href="program_overview_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-file"></i>&nbsp;Program
Overview</a></li>
<li class=""><a href="downloadable_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
download"></i>&nbsp;Downloadable Materials</a></li>
<li class=""><a href="assignment_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
book"></i>&nbsp;Assignments</a></li>
<li class=""><a href="announcements_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-info-
sign"></i>&nbsp;Announcements</a></li>
<li class=""><a href="class_calendar_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
calendar"></i>&nbsp;Class Calendar</a></li>
<li class=""><a href="student_quiz_list.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
reorder"></i>&nbsp;Quiz</a></li>
</ul>
<?php /* include('search_other_class.php'); */ ?>
</div>

My_student.php – this code is for teacher to make easily see the list of her/his student in
specific class.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- code for teacher that can see the student in the sama class -->
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('class_sidebar.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<div class="pull-right">
<a href="add_student.php<?php echo
'?id='.$get_id; ?>" class="btn btn-info"><i class="icon-plus-sign"></i> Add Student</a>
<a href="print_student.php<?php echo
'?id='.$get_id; ?>" class="btn btn-success"><i class="icon-list"></i> Student List</a>
</div>
<?php include('my_students_breadcrums.php'); ?>
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right">
<?php
$my_student =
mysql_query("SELECT * FROM teacher_class_student

LEFT JOIN student ON student.student_id = teacher_class_student.student_id

INNER JOIN class ON class.class_id = student.class_id where teacher_class_id =


'$get_id' order by lastname ")or die(mysql_error());
$count_my_student =
mysql_num_rows($my_student);?>
Number of Students: <span
class="badge badge-info"><?php echo $count_my_student; ?></span>
</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<ul id="da-thumbs"
class="da-thumbs">
<?php

$my_student = mysql_query("SELECT * FROM teacher_class_student

LEFT JOIN student ON student.student_id = teacher_class_student.student_id

INNER JOIN class ON class.class_id = student.class_id where teacher_class_id =


'$get_id' order by lastname ")or die(mysql_error());

while($row = mysql_fetch_array($my_student)){

$id = $row['teacher_class_student_id'];

?>
<li
id="del<?php echo $id; ?>">

<a href="#">

<img id="student_avatar_class" src ="<?php echo $row['profile_pic'] ?>"


width="124" height="140" class="img-polaroid">

<div>

<span>

<p><?php ?></p>

</span>

</div>

</a>

<p class="class"><?php echo $row['lastname'];?></p>


<p class="program"><?php echo $row['firstname']; ?></p>

<a href="#<?php echo $id; ?>" data-toggle="modal"><i class="icon-trash"></i>


Remove</a>
</li>
<?php
include("remove_student_modal.php"); ?>
<?php } ?>
</ul>
<script
type="text/javascript">

$(document).ready( function() {

$('.remove').click( function() {

var id = $(this).attr("id");

$.ajax({

type: "POST",

url: "remove_student.php",

data: ({id: id}),

cache: false,

success: function(html){

$("#del"+id).fadeOut('slow', function(){ $(this).remove();});

$('#'+id).modal('hide');

$.jGrowl("Your Student is Successfully Remove", { header: 'Student


Remove' });

});

return false;

});
});

</script>
</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Notification_teacher.php - code for notifying the teacher if theres a message.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('teacher_notification_sidebar.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query = mysql_query("select * from
school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#"><b>My
Class</b></a><span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$school_year_query_row['school_year']; ?></a><span class="divider">/</span></li>
<li><a
href="#"><b>Notification</b></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<div class="pull-right">
Check All <input type="checkbox"
name="selectAll" id="checkAll" />
<script>
$("#checkAll").click(function () {

$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>

</div>

<form id="domainTable" action="read_teacher.php"


method="post">
<?php if($not_read == '0'){
}else{ ?>
<button id="delete"
class="btn btn-info" name="read"><i class="icon-check"></i> Read</button>

<?php } ?>

<?php $query = mysql_query("select * from


teacher_notification
LEFT JOIN teacher_class on
teacher_class.teacher_class_id = teacher_notification.teacher_class_id
LEFT JOIN student on student.student_id =
teacher_notification.student_id
LEFT JOIN assignment on assignment.assignment_id =
teacher_notification.assignment_id
LEFT JOIN class on teacher_class.class_id = class.class_id
LEFT JOIN program on teacher_class.program_id =
program.program_id
where teacher_class.teacher_id = '$session_id' order by
teacher_notification.date_of_notification DESC
")or die(mysql_error());
$count = mysql_num_rows($query);
while($row = mysql_fetch_array($query)){
$assignment_id = $row['assignment_id'];
$get_id = $row['teacher_class_id'];
$id = $row['teacher_notification_id'];

$query_yes_read = mysql_query("select * from


notification_read_teacher where notification_id = '$id' and teacher_id = '$session_id'")or
die(mysql_error());
$read_row = mysql_fetch_array($query_yes_read);

$yes = $read_row['student_read'];

?>
<div class="post"
id="del<?php echo $id; ?>">
<?php if ($yes ==
'yes'){
}else{
?>

// selection of
user that where is the notification trigger
<input id=""
name="selector[]" type="checkbox" value="<?php echo $id; ?>">
<?php } ?>

<strong><?php echo $row['firstname']." ".$row['lastname']; ?></strong>


<?php echo
$row['notification']; ?> In <b><?php echo $row['fname']; ?></b>
<a
href="<?php echo $row['link']; ?><?php echo '?id='.$get_id; ?>&<?php echo
'post_id='.$assignment_id; ?>">
<?php echo
$row['class_name']; ?>
<?php echo
$row['program_code']; ?>

</a>
<hr>
<div class="pull-
right">
<i class="icon-
calendar"></i>&nbsp;<?php echo $row['date_of_notification']; ?>
</div>
</div>
<?php
}
?>

</form>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Teacher_avatar.php – The profile view of teacher changing picture.

<?php
include('admin/dbcon.php');
include('session.php');

if (isset($_POST['change'])) {
// teacher changing profile pict

$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);

move_uploaded_file($_FILES["image"]["tmp_name"], "uploads/" .
$_FILES["image"]["name"]);
$location = "uploads/" . $_FILES["image"]["name"];

mysql_query("update teacher set


profile_pic = '$location' where teacher_id = '$session_id' ")or die(mysql_error());
?>

<script>
window.location =
"dashboard_teacher.php";
</script>

<?php } ?>

Teacher_count.php – to know how many teacher .


<?php
$school_year_query = mysql_query("select * from
school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<!-- to count how many teacher user in the data base -->
<?php $query_yes = mysql_query("select * from
teacher_notification
LEFT JOIN notification_read_teacher on
teacher_notification.teacher_notification_id = notification_read_teacher.notification_id
where teacher_id = '$session_id'
")or die(mysql_error());
$count_no = mysql_num_rows($query_yes);
?>
<?php $query = mysql_query("select * from
teacher_notification
LEFT JOIN teacher_class on
teacher_class.teacher_class_id = teacher_notification.teacher_class_id
LEFT JOIN student on student.student_id =
teacher_notification.student_id
LEFT JOIN assignment on assignment.assignment_id =
teacher_notification.assignment_id
LEFT JOIN class on teacher_class.class_id = class.class_id
LEFT JOIN program on teacher_class.program_id =
program.program_id
where teacher_class.teacher_id = '$session_id'
")or die(mysql_error());
$count = mysql_num_rows($query);
?>

<?php $not_read = $count - $count_no; ?>


Teacher_message.php – the list of message of teacher from other user.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('teacher_message_sidebar.php'); ?>
<div class="span6" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#">Message</a><span
class="divider">/</span></li>
<li><a
href="#"><b>Inbox</b></a><span class="divider">/</span></li>
<li><a href="#">School Year:
<?php echo $school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<ul class="nav nav-


pills">
<li class="active">
<a
href="teacher_message.php"><i class="icon-envelope-alt"></i>inbox</a>
</li>
<li class="">
<a
href="sent_message.php"><i class="icon-envelope-alt"></i>Sent messages</a>
</li>
</ul>

<?php
$query_announcement =
mysql_query("select * from message

LEFT JOIN teacher ON teacher.teacher_id = message.sender_id

where message.reciever_id = '$session_id' order by date_sended


DESC

")or die(mysql_error());
$count_my_message =
mysql_num_rows($query_announcement);
if ($count_my_message != '0'){
while($row =
mysql_fetch_array($query_announcement)){
$id = $row['message_id'];
$sender_id = $row['sender_id'];
$sender_name =
$row['sender_name'];
$reciever_name =
$row['reciever_name'];
?>
<div
class="post" id="del<?php echo $id; ?>">

<div
class="message_content">
<?php echo
$row['content']; ?>
</div>

<hr>
Send by:
<strong><?php echo $row['sender_name']; ?></strong>
<i
class="icon-calendar"></i> <?php echo $row['date_sended']; ?>

<div class="pull-right">
<a class="btn btn-link" href="#reply<?php echo $id; ?>" data-toggle="modal" ><i
class="icon-reply"></i> Reply </a>

</div>

<div class="pull-right">

<a class="btn btn-link" href="#<?php echo $id; ?>" data-toggle="modal" ><i


class="icon-remove"></i> Remove </a>

<?php include("remove_inbox_message_modal.php"); ?>

<?php include("reply_inbox_message_modal.php"); ?>

</div>
</div>

<?php }}else{ ?>


<div class="alert alert-info"><i
class="icon-info-sign"></i> No Inbox Messages</div>
<?php } ?>
</div>
</div>
</div>
<!-- /block -->
</div>

<script type="text/javascript">
$(document).ready( function() {
$('.remove').click( function() {
var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_inbox_message.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Sent message is Successfully Deleted", { header: 'Data
Delete' });
}
});
return false;
});
});
</script>
<script>
jQuery(document).ready(function(){
jQuery("#reply").submit(function(e){
e.preventDefault();
var id = $('.reply').attr("id");
var _this = $(e.target);
var formData = jQuery(this).serialize();
$.ajax({
type: "POST",
url: "reply.php",
data: formData,
success: function(html){
$.jGrowl("Message Successfully Sent", { header:
'Message Sent' });
$('#reply'+id).modal('hide');
}

});
return false;
});
});
</script>

</div>
<?php include('create_message.php') ?>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Teacher_message-teacher.php - the process of communication of same user teacher.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('teacher_message_sidebar.php'); ?>
<div class="span6" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#">Message</a><span
class="divider">/</span></li>
<li><a
href="#"><b>Inbox</b></a><span class="divider">/</span></li>
<li><a href="#">School Year:
<?php echo $school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<ul class="nav nav-


pills">
<li class="active">
<a
href="teacher_message.php"><i class="icon-envelope-alt"></i>inbox</a>
</li>
<li class="">
<a
href="sent_message.php"><i class="icon-envelope-alt"></i>Sent messages</a>
</li>
</ul>

<?php
$query_announcement =
mysql_query("select * from message

LEFT JOIN teacher ON teacher.teacher_id = message.sender_id


where message.reciever_id = '$session_id' order by date_sended
DESC

")or die(mysql_error());
while($row =
mysql_fetch_array($query_announcement)){
$id = $row['message_id'];
?>
<div
class="post" id="del<?php echo $id; ?>">
<div
class="message_content">
<?php echo
$row['content']; ?>
</div>

<hr>
Send by:
<strong><?php echo $row['sender_name']; ?></strong>
<i
class="icon-calendar"></i> <?php echo $row['date_sended']; ?>

<div class="pull-right">

<a class="btn btn-link" href="#<?php echo $id; ?>" data-toggle="modal" ><i


class="icon-remove"></i> Remove </a>

<?php include("remove_inbox_message_modal.php"); ?>

</div>
</div>

<?php } ?>

</div>
</div>
</div>
<!-- /block -->
</div>

<script type="text/javascript">
$(document).ready( function() {
$('.remove').click( function() {
var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_inbox_message.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Sent message is Successfully Deleted", { header: 'Data
Delete' });
}
});
return false;
});
});
</script>

</div>
<?php include('create_message_teacher.php') ?>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Update_password.php – function to update the new password into the database.

<?php
include('admin/dbcon.php');
include('session.php');
// to change the password
$new_password = sha1(md5($_POST['new_password']));
mysql_query("update teacher set password = '$new_password' where teacher_id =
'$session_id'")or die(mysql_error());
?>

View_submit_assignment.php- the lit of assignment that created and passed by student.


<?php include('header_dashboard.php'); ?>
<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<?php
$post_id = $_GET['post_id'];
if($post_id == ''){
?>
<script>
window.location = "assignment_student.php<?php echo '?id='.$get_id; ?>";
</script>
<?php
}

?>

<body id="studentTableDiv">
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('assignment_link.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">

<!-- breadcrumb -->

<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
?>

<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$class_row['school_year']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><b>Uploaded
Assignments</b></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right"><a href="assignment.php<?php echo
'?id='.$get_id; ?>"><i class="icon-arrow-left"></i> Back</a></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<?php
$query1 =
mysql_query("select * FROM assignment where assignment_id = '$post_id'")or
die(mysql_error());
$row1 =
mysql_fetch_array($query1);

?>
<div class="alert alert-
info">Submit Assignment in : <?php echo $row1['fname']; ?></div>

<div id="">

<table cellpadding="0" cellspacing="0" border="0" class="table"


id="">

<thead>
<tr>

<th>Date Upload</th>

<th>File Name</th>

<th>Description</th>

<th>Submitted by:</th>

<th></th>

<th>Grade</th>
</tr>

</thead>
<tbody>

<?php
$query =
mysql_query("select * FROM student_assignment
LEFT JOIN student
on student.student_id = student_assignment.student_id
where assignment_id
= '$post_id' order by assignment_fdatein DESC")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
$id =
$row['student_assignment_id'];
?>
<tr>
<td><?php echo
$row['assignment_fdatein']; ?></td>
<td><?php echo $row['fname']; ?></td>
<td><?php echo $row['fdesc']; ?></td>
<td><?php echo $row['firstname']." ".$row['lastname']; ?></td>
<td><a href="<?php echo $row['floc']; ?>"><i class="icon-download
icon-large"></i></a></td>
<td width="140">
<form
method="post" action="save_grade.php">
<input type="hidden"
class="span4" name="id" value="<?php echo $id; ?>">
<input type="hidden"
class="span4" name="post_id" value="<?php echo $post_id; ?>">
<input type="hidden"
class="span4" name="get_id" value="<?php echo $get_id; ?>">
<input type="text"
class="span4" name="grade" value="<?php echo $row['grade']; ?>">
<button name="save"
class="btn btn-success" id="btn_s"><i class="icon-save"></i> Save</button>
</form>
</td>
</tr>

<?php } ?>

</tbody>
</table>
</div>

</div>
</div>
</div>
<!-- /block -->
</div>
</div>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Print_student.php – function to print the list of student to haave a hardcopy.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- to print the list of student -->
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('class_sidebar.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<div class="pull-right">

<a id="print" onclick="window.print()"


class="btn btn-success"><i class="icon-print"></i> Print Student List</a>
</div>
<?php include('my_students_breadcrums.php'); ?>
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-right">

</div>
</div>
<div class="block-content collapse in">
<div class="span12">

<table
cellpadding="0" cellspacing="0" border="0" class="table" id="">

<thead>
<tr>

<th>Firstname</th>

<th>Lastname</th>
</tr>

</thead>
<tbody>

<?php

$my_student = mysql_query("SELECT * FROM teacher_class_student

LEFT JOIN student ON student.student_id = teacher_class_student.student_id

INNER JOIN class ON class.class_id = student.class_id where teacher_class_id =


'$get_id' order by lastname ")or die(mysql_error());

while($row = mysql_fetch_array($my_student)){

$id = $row['teacher_class_student_id'];

?>
<tr id="del<?php
echo $id; ?>">

<td><?php echo
$row['firstname']; ?></td>
<td><?php echo $row['lastname']; ?></td>

</tr>

<?php } ?>

</tbody>
</table>

</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Progress.php – the progress of student if the student is improve or not.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<!-- code for progression of user -->
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('progress_link_student.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->

<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
$class_id =
$class_row['class_id'];
$school_year =
$class_row['school_year'];
?>

<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$class_row['school_year']; ?></a> <span class="divider">/</span></li>
<li><a href="#">Progress</a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"><h4>
Assignment Grade Progress</h4></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<table
cellpadding="0" cellspacing="0" border="0" class="table" id="">

<thead>
<tr>

<th>Date Upload</th>

<th>Assignment</th>

<th>Grade</th>
</tr>

</thead>
<tbody>

<?php
$query =
mysql_query("select * FROM student_assignment
LEFT JOIN student
on student.student_id = student_assignment.student_id
RIGHT JOIN
assignment on student_assignment.assignment_id = assignment.assignment_id
WHERE
student_assignment.student_id = '$session_id'
order by fdatein
DESC")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
$id =
$row['student_assignment_id'];
$student_id =
$row['student_id'];
?>
<tr>
<td><?php echo
$row['fdatein']; ?></td>
<td><?php echo $row['fname']; ?></td>

<?php if ($session_id
== $student_id){ ?>
<td>
<span class="badge
badge-success"><?php echo $row['grade']; ?></span>
</td>
<?php }else{ ?>
<td></td>
<?php } ?>

</tr>

<?php } ?>

</tbody>
</table>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>

<div class="span9" id="content">


<div class="row-fluid">

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"><h4>
Practice Quiz Progress</h4></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<table cellpadding="0"
cellspacing="0" border="0" class="table" id="">
<thead>
<tr>

<th>Quiz Title</th>

<th>Description</th>

<th>Quiz Time (In Minutes)</th>

<th></th>
</tr>
</thead>
<tbody>
<?php
$query =
mysql_query("select * FROM class_quiz
LEFT JOIN quiz on
class_quiz.quiz_id = quiz.quiz_id
where
teacher_class_id = '$get_id' order by class_quiz_id DESC ")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
$id =
$row['class_quiz_id'];
$quiz_id =
$row['quiz_id'];
$quiz_time =
$row['quiz_time'];

$query1 =
mysql_query("select * from student_class_quiz where class_quiz_id = '$id' and student_id =
'$session_id'")or die(mysql_error());
$row1 =
mysql_fetch_array($query1);
$grade =
$row1['grade'];

?>
<?php if ($grade
==""){
}else{ ?>
<tr>
<td><?php echo
$row['quiz_title']; ?></td>
<td><?php echo $row['quiz_description']; ?></td>
<td><?php echo $row['quiz_time'] / 60; ?></td>
<td width="200">

<b>Already Taken
Score <?php echo $grade; ?></b>

</td>

<script type="text/javascript">

$(document).ready(function(){

$('#<?php echo $id; ?>Take This Quiz').tooltip('show');

$('#<?php echo $id; ?>Take This Quiz').tooltip('hide');

});

</script>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>

<?php /* include('downloadable_sidebar.php') */ ?>


</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body></html>
Quiz.link.php - using this code the quiz created by teacher can connec and view into the student
account.

<div class="span3" id="sidebar">


<img id="avatar" src="<?php echo $row['profile_pic']; ?>" class="img-polaroid">
<ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
<li class=""><a href="dashboard_teacher.php"><i class="icon-
chevron-right"></i><i class="icon-chevron-left"></i>&nbsp;Back</a></li>
<li class=""><a href="my_students.php<?php echo '?id='.$get_id;
?>"><i class="icon-chevron-right"></i><i class="icon-group"></i>&nbsp;My
Students</a></li>
<li class=""><a href="program_overview.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-file"></i>&nbsp;Program
Overview</a></li>
<li class=""><a href="downloadable.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
download"></i>&nbsp;Downloadable Materials</a></li>
<li class=""><a href="assignment.php<?php echo '?id='.$get_id;
?>"><i class="icon-chevron-right"></i><i class="icon-book"></i>&nbsp;Assignments</a></li>
<li class=""><a href="announcements.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-info-
sign"></i>&nbsp;Announcements</a></li>
<li class=""><a href="class_calendar.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
calendar"></i>&nbsp;Class Calendar</a></li>
<li class="active"><a href="class_quiz.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
list"></i>&nbsp;Quiz</a></li>
</ul>
<?php include('search_other_class.php'); ?>
</div>

Read_message.php – this code is for easily read the message from database.

<?php
include('session.php');
include('admin/dbcon.php');
if (isset($_POST['read'])){
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
$result = mysql_query("update message set message_status = 'read' where
message_id='$id[$i]'");
}
header("location: student_message.php");
}
?>
<!-- code for replying mail -->
<?php
if (isset($_POST['reply'])){
$sender_id = $_POST['sender_id'];
$sender_name = $_POST['name_of_sender'];
$my_name = $_POST['my_name'];
$my_message = $_POST['my_message'];

mysql_query("insert into message


(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$sender_id','$my_message',NOW(),'$session_id','$sender_name','$my_name')")or
die(mysql_error());
mysql_query("insert into message_sent
(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$sender_id','$my_message',NOW(),'$session_id','$sender_name','$my_name')")or
die(mysql_error());
?>
<script>
alert('Message Sent');
window.location ="student_message.php";
</script>
<?php

}
?>

Save_grade.php – saving of grade in database.

<?php
include('admin/dbcon.php');
// to save all grade in data base
$id = $_POST['id'];
$post_id = $_POST['post_id'];
$get_id = $_POST['get_id'];
$grade = $_POST['grade'];
mysql_query("update student_assignment set grade = '$grade' where student_assignment_id =
'$id'")or die(mysql_error());
?>
<script>
window.location = 'view_submit_assignment.php<?php echo
'?id='.$get_id.'&'.'post_id='.$post_id; ?>';
</script>
Reply.php - process that the user can reply back into the message from other user.

<?php
include('admin/dbcon.php');
include('session.php');
$sender_id = $_POST['sender_id'];
$sender_name = $_POST['name_of_sender'];
$my_name = $_POST['my_name'];
$my_message = $_POST['my_message'];
// insert into connect the id of sender id into receiver id
mysql_query("insert into message
(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$sender_id','$my_message',NOW(),'$session_id','$sender_name','$my_name')")or
die(mysql_error());
mysql_query("insert into message_sent
(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$sender_id','$my_message',NOW(),'$session_id','$sender_name','$my_name')")or
die(mysql_error());

?>

Reply_inbox_message_modal.php – the design view when reply .

<!-- Modal -->


<div id="reply<?php echo $id; ?>" class="modal hide fade" tabindex="-1" role="dialog" aria-
labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-
hidden="true">x</button>
<h3 id="myModalLabel">Reply</h3>
</div>
<div class="modal-body">
<form id="reply" class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputEmail">To:</label>
<div class="controls">
<input type="hidden" name="sender_id" id="inputEmail"
value="<?php echo $sender_id; ?>" readonly>
<input type="hidden" name="my_name" value="<?php echo
$reciever_name; ?>" readonly>
<input type="text" name="name_of_sender" id="inputEmail"
value="<?php echo $sender_name; ?>" readonly>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Content:</label>
<div class="controls">
<textarea name="my_message"></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">

</div>
</div>

</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-
remove icon-large"></i> Close</button>
<button type="submit" id="<?php echo $id; ?>" class="btn btn-success reply"><i
class="icon-reply"></i> Reply</button>
</div>
</form>

</div>

Search_class.php - code for easily find the specific class.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<!-- code for searchinga class -->
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('teacher_sidebar.php'); ?>
<div class="span6" id="content">
<div class="row-fluid">
<!-- breadcrumb -->

<ul class="breadcrumb">
<?php
$sy = $_POST['school_year'];
$school_year_query = mysql_query("select * from
school_year where school_year = '$sy'")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#"><b>My
Class</b></a><span class="divider">/</span></li>
<li><a href="#"><?php echo
$school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<ul id="da-
thumbs" class="da-thumbs">
<?php $query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where teacher_id =
'$session_id' and school_year = '$school_year' ")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
$id =
$row['teacher_class_id'];

?>
<li>
<a
href="my_students.php<?php echo '?id='.$id; ?>">

<img src ="<?php echo $row['thumbnails'] ?>" width="124" height="140" class="img-


polaroid">

<div>
<span>

<p><?php echo $row['class_name']; ?></p>

</span>

</div>
</a>
<p
class="class"><?php echo $row['class_name']; ?></p>
<p
class="program"><?php echo $row['program_code']; ?></p>
<a
href="#<?php echo $id; ?>" data-toggle="modal"><i class="icon-trash"></i> Remove</a>

</li>
<?php
include("delete_class_modal.php"); ?>

<?php } ?>
</ul>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>
<?php include('teacher_right_sidebar.php') ?>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Send_message.php – function for sending a message to other user.


<?php
include('admin/dbcon.php');
include('session.php');
$teacher_id = $_POST['teacher_id'];
$my_message = $_POST['my_message'];

// get the teacher id to identify where the message came from


$query = mysql_query("select * from teacher where teacher_id = '$teacher_id'")or
die(mysql_error());
$row = mysql_fetch_array($query);
$name = $row['firstname']." ".$row['lastname'];

$query1 = mysql_query("select * from teacher where teacher_id = '$session_id'")or


die(mysql_error());
$row1 = mysql_fetch_array($query1);
$name1 = $row1['firstname']." ".$row1['lastname'];
// after getting the data save the meassage wher the id of techer is assign

mysql_query("insert into message


(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$teacher_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
mysql_query("insert into message_sent
(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$teacher_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
?>

Send_message_student.php – this code is for students sending message to other user except
admin.

<?php
include('admin/dbcon.php');
include('session.php');
$teacher_id = $_POST['teacher_id'];
$my_message = $_POST['my_message'];

// get the did to sending a message to other user


$query = mysql_query("select * from teacher where teacher_id = '$teacher_id'")or
die(mysql_error());
$row = mysql_fetch_array($query);
$name = $row['firstname']." ".$row['lastname'];

$query1 = mysql_query("select * from student where student_id = '$session_id'")or


die(mysql_error());
$row1 = mysql_fetch_array($query1);
$name1 = $row1['firstname']." ".$row1['lastname'];

mysql_query("insert into message


(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$teacher_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
mysql_query("insert into message_sent
(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$teacher_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
?>

Send_message_student_to_student.php – function to communicate the student into the same


student.

<?php
include('admin/dbcon.php');
include('session.php');
$student_id = $_POST['student_id'];
$my_message = $_POST['my_message'];

$query = mysql_query("select * from student where student_id = '$student_id'")or


die(mysql_error());
$row = mysql_fetch_array($query);
$name = $row['firstname']." ".$row['lastname'];

$query1 = mysql_query("select * from student where student_id = '$session_id'")or


die(mysql_error());
$row1 = mysql_fetch_array($query1);
$name1 = $row1['firstname']." ".$row1['lastname'];

mysql_query("insert into message


(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$student_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
mysql_query("insert into message_sent
(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$student_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
?>
Send_message_teacher_to_student.php – function for communicate the teacher to the student.
<?php
include('admin/dbcon.php');
include('session.php');
$student_id = $_POST['student_id'];
$my_message = $_POST['my_message'];

$query = mysql_query("select * from student where student_id = '$student_id'")or


die(mysql_error());
$row = mysql_fetch_array($query);
$name = $row['firstname']." ".$row['lastname'];

$query1 = mysql_query("select * from teacher where teacher_id = '$session_id'")or


die(mysql_error());
$row1 = mysql_fetch_array($query1);
$name1 = $row1['firstname']." ".$row1['lastname'];

mysql_query("insert into message


(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$student_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
mysql_query("insert into message_sent
(reciever_id,content,date_sended,sender_id,reciever_name,sender_name)
values('$student_id','$my_message',NOW(),'$session_id','$name','$name1')")or
die(mysql_error());
?>

Sent_message.php - process when the message is successfully send it will restore into the
database .

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('teacher_message_sidebar.php'); ?>
<div class="span6" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#">Message</a><span
class="divider">/</span></li>
<li><a href="#"><b>Sent
Messages</b></a><span class="divider">/</span></li>
<li><a href="#">School Year:
<?php echo $school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<ul class="nav nav-


pills">
<li class="">
<a
href="teacher_message.php"><i class="icon-envelope-alt"></i>inbox</a>
</li>
<li class="active">
<a
href="sent_message.php"><i class="icon-envelope-alt"></i>Sent messages</a>
</li>
</ul>

<?php
$query_announcement =
mysql_query("select * from message_sent

LEFT JOIN teacher ON teacher.teacher_id =


message_sent.reciever_id

where sender_id = '$session_id' order by date_sended DESC

")or die(mysql_error());
$count_my_message =
mysql_num_rows($query_announcement);
if ($count_my_message != '0'){

while($row =
mysql_fetch_array($query_announcement)){
$id = $row['message_sent_id'];
?>
<div
class="post" id="del<?php echo $id; ?>">
<?php echo
$row['content']; ?>

<hr>
Sent to:
<strong><?php echo $row['reciever_name']; ?></strong>
<i
class="icon-calendar"></i> <?php echo $row['date_sended']; ?>

<div class="pull-right">

<a class="btn btn-link" href="#<?php echo $id; ?>" data-toggle="modal" ><i


class="icon-remove"></i> Remove </a>

<?php include("remove_sent_message_modal.php"); ?>

</div>
</div>
<?php }}else{ ?>
<div class="alert alert-info"><i
class="icon-info-sign"></i> No Message in your Sent Items</div>
<?php } ?>
</div>
</div>
</div>
<!-- /block -->
</div>

<script type="text/javascript">
$(document).ready( function() {

$('.remove').click( function() {

var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_sent_message.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Sent message is Successfully Deleted", { header: 'Data
Delete' });

}
});

return false;
});
});

</script>

</div>
<?php include('create_message.php') ?>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Signup_teacher.php – function when the teacher user is signup.

<?php include('header.php'); ?>


<body id="login">
<div class="container">
<div class="row-fluid">
<div class="span8">
<!-- sign up of teacher to have a more teacher -->
<?php include('title_index.php'); ?>

</div>
<div class="span4">

<?php include('signup_teacher_form.php'); ?>

</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="index-footer">
<?php include('link.php'); ?>
</div>
</div>
</div>
<!-- /container -->
<?php include('footer.php'); ?>
</div> <!-- /container -->
<?php include('script.php'); ?>
</body>
</html>

Signup_teacher_for.php - the design form of teacher signup.

<form id="signin_teacher" class="form-signin" method="post">


<h3 class="form-signin-heading"><i class="icon-
lock"></i> Sign up as Teacher</h3>
<input type="text" class="input-block-level"
name="firstname" placeholder="Firstname" required>
<input type="text" class="input-block-level"
name="lastname" placeholder="Lastname" required>
<label>Department</label>
<select name="department_id"
class="department_id_signup" required>
<option></option>
<?php
$query = mysql_query("select * from department
order by department_name ")or die(mysql_error());
while($row = mysql_fetch_array($query)){
?>
<option value="<?php echo $row['department_id']
?>"><?php echo $row['department_name']; ?></option>
<?php
}
?>
</select>
<input type="text" class="input-block-level"
id="username" name="username" placeholder="Username" required>
<input type="password" class="input-block-level"
id="password" name="password" placeholder="Password" required>
<input type="password" class="input-block-level"
id="cpassword" name="cpassword" placeholder="Re-type Password" required>
<button id="signin" name="login" class="btn btn-success"
type="submit"><i class="icon-check icon-large"></i> Sign in</button>
</form>
<!-- using this jquery it validate if the user name is existing and also th
password and if thers no the user can add join -->
<script>
jQuery(document).ready(function(){
jQuery("#signin_teacher").submit(function(e){
e.preventDefault();
var password = jQuery('#password').val();
var cpassword = jQuery('#cpassword').val();
if (password == cpassword){
var formData = jQuery(this).serialize();
$.ajax({
type: "POST",
url: "teacher_signup.php",
data: formData,
success: function(html){
if(html=='true')
{
$.jGrowl("Welcome to Student Online Access
Portal", { header: 'Sign up Success' });
var delay = 1000;
setTimeout(function(){ window.location =
'dashboard_teacher.php' }, delay);
}else{
$.jGrowl("Your data is not found in the
database", { header: 'Sign Up Failed' });
}
}
});

}else
{
$.jGrowl("Your data is not found in the database", {
header: 'Sign Up Failed' });
}
});
});
</script>
<center>
<a onclick="window.location='index.php'" id="btn_login" name="login"
class="btn" type="submit"><i class="icon-signin icon-large"></i> Click here to Login</a>
</center>
Signup_student.php - function when the student is signing up.

<?php include('header.php'); ?>


<body id="login">
<div class="container">
<div class="row-fluid">
<div class="span8">
<!-- signup area .. includes the student signin form to join -->
<?php include('title_index.php'); ?>

</div>
<div class="span4">

<?php include('student_signin_form.php'); ?>

</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="index-footer">
<?php include('link.php'); ?>
</div>
</div>
</div>
<!-- /container -->
<?php include('footer.php'); ?>
</div> <!-- /container -->
<?php include('script.php'); ?>
</body>
</html>

Student_message.php – the list of student message from other user.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('student_message_sidebar.php'); ?>
<div class="span6" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#">Message</a><span
class="divider">/</span></li>
<li><a
href="#"><b>Inbox</b></a><span class="divider">/</span></li>
<li><a href="#">School Year:
<?php echo $school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<ul class="nav nav-


pills">
<li class="active"><a
href="student_message.php"><i class="icon-envelope-alt"></i>inbox</a></li>
<li class=""><a
href="sent_message_student.php"><i class="icon-envelope-alt"></i>Sent messages</a></li>
</ul>

<?php
$query_announcement =
mysql_query("select * from message

LEFT JOIN student ON student.student_id = message.sender_id

where message.reciever_id = '$session_id' order by date_sended


DESC

")or die(mysql_error());
$count_my_message =
mysql_num_rows($query_announcement);
if ($count_my_message != '0'){
while($row =
mysql_fetch_array($query_announcement)){
$id = $row['message_id'];
$id_2 = $row['message_id'];
$status = $row['message_status'];
$sender_id = $row['sender_id'];
$sender_name =
$row['sender_name'];
$reciever_name =
$row['reciever_name'];
?>
<div
class="post" id="del<?php echo $id; ?>">
<div
class="message_content">
<?php echo
$row['content']; ?>
</div>
<div
class="pull-right">
<?php if
($status == 'read'){

?><span class="badge badge-success">Read</span><?php


}else{ ?>
<span
class="badge badge-important">Unread</span>
<?php } ?>
</div>

<hr>
Send by:
<strong><?php echo $row['sender_name']; ?></strong>
<i
class="icon-calendar"></i> <?php echo $row['date_sended']; ?>

<div class="pull-right">

<a class="btn btn-link" href="#reply<?php echo $id; ?>" data-toggle="modal"


><i class="icon-reply"></i> Reply </a>

</div>

<div class="pull-right">
<a class="btn btn-link" href="#<?php echo $id; ?>" data-toggle="modal" ><i
class="icon-remove"></i> Remove </a>

<?php include("remove_inbox_message_modal.php"); ?>

<?php include("reply_inbox_message_modal_student.php"); ?>

</div>
</div>

<?php }}else{ ?>


<div class="alert alert-info"><i
class="icon-info-sign"></i> No Message Inbox</div>
<?php } ?>

</div>
</div>
</div>
<!-- /block -->
</div>

<script type="text/javascript">
$(document).ready( function() {
$('.remove').click( function() {
var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_inbox_message.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Sent message is Successfully Deleted", { header: 'Data
Delete' });
}
});
return false;
});
});
</script>
<script>
jQuery(document).ready(function(){
jQuery("#reply").submit(function(e){
e.preventDefault();
var id = $('.reply').attr("id");
var _this = $(e.target);
var formData = jQuery(this).serialize();
$.ajax({
type: "POST",
url: "reply.php",
data: formData,
success: function(html){
$.jGrowl("Message Successfully Sent", { header:
'Message Sent' });
$('#reply'+id).modal('hide');
}

});
return false;
});
});
</script>

</div>
<?php include('create_message_student.php') ?>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Student_message_student.php – function for communication between the same student.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('student_message_sidebar.php'); ?>
<div class="span6" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<ul class="breadcrumb">
<?php
$school_year_query =
mysql_query("select * from school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#">Message</a><span
class="divider">/</span></li>
<li><a
href="#"><b>Inbox</b></a><span class="divider">/</span></li>
<li><a href="#">School Year:
<?php echo $school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form action="read_message.php" method="post">
<div class="pull-
right">
<button
class="btn btn-info" name="read"><i class="icon-check"></i> Read</button>

Check All <input type="checkbox"


name="selectAll" id="checkAll" />
<script>
$("#checkAll").click(function () {

$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>

</div>

<ul class="nav nav-


pills">
<li class="active"><a
href="student_message.php"><i class="icon-envelope-alt"></i>inbox</a></li>
<li class=""><a
href="sent_message_student.php"><i class="icon-envelope-alt"></i>Send messages</a></li>
</ul>
<?php
$query_announcement =
mysql_query("select * from message

LEFT JOIN student ON student.student_id = message.sender_id

where message.reciever_id = '$session_id' order by date_sended


DESC

")or die(mysql_error());
$count_my_message =
mysql_num_rows($query_announcement);
if ($count_my_message != '0'){
while($row =
mysql_fetch_array($query_announcement)){
$id = $row['message_id'];

$id_2 = $row['message_id'];
$status = $row['message_status'];
$sender_id = $row['sender_id'];
$sender_name =
$row['sender_name'];
$reciever_name =
$row['reciever_name'];
?>
<div
class="post" id="del<?php echo $id; ?>">
<div
class="message_content">
<?php echo
$row['content']; ?>
</div>
<div
class="pull-right">
<?php if
($status == 'read'){
}else{ ?>
<input id=""
class="" name="selector[]" type="checkbox" value="<?php echo $id; ?>">
<?php } ?>
</div>

<hr>
Send by:
<strong><?php echo $row['sender_name']; ?></strong>
<i
class="icon-calendar"></i> <?php echo $row['date_sended']; ?>

<div class="pull-right">

<a class="btn btn-link" href="#reply<?php echo $id; ?>" data-toggle="modal"


><i class="icon-reply"></i> Reply </a>

</div>

<div class="pull-right">

<a class="btn btn-link" href="#<?php echo $id; ?>" data-toggle="modal" ><i


class="icon-remove"></i> Remove </a>

<?php include("remove_inbox_message_modal.php"); ?>

<?php include("reply_inbox_message_modal_student.php"); ?>

</div>
</div>

<?php }}else{ ?>


<div class="alert alert-info"><i
class="icon-info-sign"></i> No Message Inbox</div>
<?php } ?>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>

<script type="text/javascript">
$(document).ready( function() {
$('.remove').click( function() {
var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_inbox_message.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Sent message is Successfully Deleted", { header: 'Data
Delete' });
}
});
return false;
});
});
</script>
</div>
<?php include('create_message_student_student.php') ?>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Student_notification.php – function tio notify the student if theres a message.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<body>
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('student_notification_sidebar.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->

<ul class="breadcrumb">
<?php
$school_year_query = mysql_query("select * from
school_year order by school_year DESC")or die(mysql_error());
$school_year_query_row =
mysql_fetch_array($school_year_query);
$school_year =
$school_year_query_row['school_year'];
?>
<li><a href="#"><b>My
Class</b></a><span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$school_year_query_row['school_year']; ?></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">

<form action="read.php" method="post">


<?php if($not_read == '0'){
}else{ ?>
<button id="delete" class="btn btn-info"
name="read"><i class="icon-check"></i> Read</button>

<div class="pull-right">
Check All <input type="checkbox"
name="selectAll" id="checkAll" />
<script>
$("#checkAll").click(function () {

$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>

</div>

<?php } ?>

<?php $query = mysql_query("select * from


teacher_class_student
LEFT JOIN teacher_class ON
teacher_class.teacher_class_id = teacher_class_student.teacher_class_id
LEFT JOIN class ON class.class_id =
teacher_class.class_id
LEFT JOIN program ON program.program_id =
teacher_class.program_id
LEFT JOIN teacher ON teacher.teacher_id =
teacher_class_student.teacher_id
JOIN notification ON notification.teacher_class_id =
teacher_class.teacher_class_id
where teacher_class_student.student_id = '$session_id' and
school_year = '$school_year' order by notification.date_of_notification DESC
")or die(mysql_error());
$count = mysql_num_rows($query);
if ($count > 0){
while($row = mysql_fetch_array($query)){
$get_id = $row['teacher_class_id'];
$id = $row['notification_id'];

$query_yes_read = mysql_query("select * from


notification_read where notification_id = '$id' and student_id = '$session_id'")or
die(mysql_error());
$read_row = mysql_fetch_array($query_yes_read);

$yes = $read_row['student_read'];

?>
<div class="post"
id="del<?php echo $id; ?>">
<?php if ($yes ==
'yes'){
}else{
?>
<input id="" class=""
name="selector[]" type="checkbox" value="<?php echo $id; ?>">
<?php } ?>

<strong><?php echo $row['firstname']." ".$row['lastname']; ?></strong>


<?php echo
$row['notification']; ?> In
<a
href="<?php echo $row['link']; ?><?php echo '?id='.$get_id; ?>">
<?php echo
$row['class_name']; ?>
<?php echo
$row['program_code']; ?>

</a>
<hr>
<div class="pull-
right">
<i class="icon-
calendar"></i>&nbsp;<?php echo $row['date_of_notification']; ?>
</div>
</div>
<?php
} }else{
?>
<div class="alert alert-info"><i class="icon-info-
sign"></i> No Notifications Found</div>
<?php
}
?>

</form>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Student_quiz.php – connector of quiz from teacher into student.

<div class="span3" id="sidebar">


<img id="avatar" src="<?php echo $row['profile_pic']; ?>" class="img-polaroid">
<ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
<li class=""><a href="dashboard_student.php"><i class="icon-
chevron-right"></i><i class="icon-chevron-left"></i>&nbsp;Back</a></li>
<li class=""><a href="my_classmates.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-group"></i>&nbsp;My
Classmates</a></li>
<li class=""><a href="progress.php<?php echo '?id='.$get_id;
?>"><i class="icon-chevron-right"></i><i class="icon-bar-chart"></i>&nbsp;My
Progress</a></li>
<li class=""><a href="program_overview_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-file"></i>&nbsp;Program
Overview</a></li>
<li class=""><a href="downloadable_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
download"></i>&nbsp;Downloadable Materials</a></li>
<li class=""><a href="assignment_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
book"></i>&nbsp;Assignments</a></li>
<li class=""><a href="announcements_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-info-
sign"></i>&nbsp;Announcements</a></li>
<li class=""><a href="class_calendar_student.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
calendar"></i>&nbsp;Class Calendar</a></li>
<li class="active"><a href="student_quiz_list.php<?php echo
'?id='.$get_id; ?>"><i class="icon-chevron-right"></i><i class="icon-
reorder"></i>&nbsp;Quiz</a></li>
</ul>
<?php /* include('search_other_class.php'); */ ?>
</div>

Student_quiz.php – list of student quiz.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<body>
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('student_quiz_link.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
$class_id =
$class_row['class_id'];
$school_year =
$class_row['school_year'];
?>
<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$class_row['school_year']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><b>Quiz</b></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<?php $query =
mysql_query("select * FROM class_quiz
LEFT JOIN quiz on
class_quiz.quiz_id = quiz.quiz_id
where
teacher_class_id = '$get_id' ")or die(mysql_error());
$count =
mysql_num_rows($query);
?>
<div id="" class="muted pull-right"><span class="badge badge-info"><?php
echo $count; ?></span></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<form
action="copy_file_student.php" method="post">

<?php
include('copy_to_backpack_modal.php'); ?>
<table cellpadding="0"
cellspacing="0" border="0" class="table" id="">
<thead>
<tr>

<th>Quiz Title</th>

<th>Description</th>
<th>Quiz Time (In Minutes)</th>

<th></th>
</tr>
</thead>
<tbody>
<?php
$query =
mysql_query("select * FROM class_quiz
LEFT JOIN quiz on
class_quiz.quiz_id = quiz.quiz_id
where
teacher_class_id = '$get_id' order by class_quiz_id DESC ")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
$id =
$row['class_quiz_id'];
$quiz_id =
$row['quiz_id'];
$quiz_time =
$row['quiz_time'];

$query1 =
mysql_query("select * from student_class_quiz where class_quiz_id = '$id' and student_id =
'$session_id'")or die(mysql_error());
$row1 =
mysql_fetch_array($query1);
$grade =
$row1['grade'];

?>
<tr>
<td><?php echo
$row['quiz_title']; ?></td>
<td><?php echo $row['quiz_description']; ?></td>
<td><?php echo $row['quiz_time'] / 60; ?></td>
<td width="200">
<?php if ($grade ==
""){ ?>
<a data-
placement="bottom" title="Take This Quiz" id="<?php echo $id; ?>Download"
href="take_test.php<?php echo '?id='.$get_id ?>&<?php echo 'class_quiz_id='.$id; ?>&<?php
echo 'test=ok' ?>&<?php echo 'quiz_id='.$quiz_id; ?>&<?php echo 'quiz_time='.$quiz_time;
?>"><i class="icon-check icon-large"></i> Take This Quiz</a>
<?php }else{ ?>
<b>Already Taken
Score <?php echo $grade; ?></b>
<?php } ?>
</td>

<script type="text/javascript">

$(document).ready(function(){

$('#<?php echo $id; ?>Take This Quiz').tooltip('show');

$('#<?php echo $id; ?>Take This Quiz').tooltip('hide');

});

</script>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Student_signing_form.php – design view whent the student is signing up.

<form id="signin_student" class="form-signin" method="post">


<h3 class="form-signin-heading"><i class="icon-lock"></i> Sign up as
Student</h3>
<input type="text" class="input-block-level" id="username"
name="username" placeholder="ID Number" required>
<input type="text" class="input-block-level" id="firstname"
name="firstname" placeholder="Firstname" required>
<input type="text" class="input-block-level" id="lastname"
name="lastname" placeholder="Lastname" required>
<label>Class</label>
<select name="class_id" class="class_id">
<option></option>
<?php
$query = mysql_query("select * from class order by class_name
")or die(mysql_error());
while($row = mysql_fetch_array($query)){
?>
<option value="<?php echo $row['class_id']; ?>"><?php echo
$row['class_name']; ?></option>
<?php
}
?>
</select>
<input type="password" class="input-block-level" id="password"
name="password" placeholder="Password" required>
<input type="password" class="input-block-level" id="cpassword"
name="cpassword" placeholder="Re-type Password" required>
<button id="signin" name="login" class="btn btn-success"
type="submit"><i class="icon-check icon-large"></i> Sign in</button>
</form>

<script>
jQuery(document).ready(function(){
jQuery("#signin_student").submit(function(e){
e.preventDefault();

var password = jQuery('#password').val();


var cpassword = jQuery('#cpassword').val();

if (password == cpassword){
var formData = jQuery(this).serialize();
$.ajax({
type: "POST",
url: "student_signup.php",
data: formData,
success: function(html){
if(html=='true')
{
$.jGrowl("Welcome to Student Online Access
Portal", { header: 'Sign up Success' });
var delay = 2000;
setTimeout(function(){ window.location =
'dashboard_student.php' }, delay);
}else if(html=='false'){
$.jGrowl("Student Information Does Not
Found In The Database Please Sure to Check Your ID Number or Firstname, Lastname and the
Section You Belong. ", { header: 'Sign Up Failed' });
}
}

});

}else
{
$.jGrowl("Student Information Does Not Found In
The Database", { header: 'Sign Up Failed' });
}
});
});
</script>
<center>
<a onclick="window.location='index.php'" id="btn_login" name="login"
class="btn" type="submit"><i class="icon-signin icon-large"></i> Click here to Login</a>
</center>

Student_signup.php – function when the student is signing up.

<?php
include('admin/dbcon.php');
session_start();
$username = $_POST['username'];
$password = sha1(md5($_POST['password']));
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$class_id = $_POST['class_id'];
// validation of data
$query = mysql_query("select * from student where username='$username' and
firstname='$firstname' and lastname='$lastname' and class_id = '$class_id'")or
die(mysql_error());
$row = mysql_fetch_array($query);
$id = $row['student_id'];

$count = mysql_num_rows($query);
if ($count > 0){
mysql_query("update student set password = '$password', status = 'Registered' where
student_id = '$id'")or die(mysql_error());
$_SESSION['id']=$id;
echo 'true';
}else{
echo 'false';
}
?>

Submit_assignment.php – function to save or add the assignment into database.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<?php
$post_id = $_GET['post_id'];
if($post_id == ''){
?>
<script>
window.location = "assignment_student.php<?php echo '?id='.$get_id; ?>";
</script>
<?php
}

?>
<!-- to submit the assignment and notify it into other user -->
<body id="studentTableDiv">
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('assignment_link_student.php'); ?>
<div class="span6" id="content">
<div class="row-fluid">
<!-- breadcrumb -->

<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
?>
<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$class_row['school_year']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><b>Uploaded
Assignments</b></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<?php
$query1 =
mysql_query("select * FROM assignment where assignment_id = '$post_id'")or
die(mysql_error());
$row1 =
mysql_fetch_array($query1);

?>
<div class="alert alert-
info">Submit Assignment in : <?php echo $row1['fname']; ?></div>

<div id="">

<table cellpadding="0" cellspacing="0" border="0" class="table"


id="">

<thead>
<tr>

<th>Date Upload</th>

<th>File Name</th>

<th>Description</th>
<th>Submitted by:</th>

<th>Grade</th>
</tr>

</thead>
<tbody>

<?php
$query =
mysql_query("select * FROM student_assignment
LEFT JOIN student
on student.student_id = student_assignment.student_id
where assignment_id
= '$post_id' order by assignment_fdatein DESC")or die(mysql_error());
while($row =
mysql_fetch_array($query)){
$id =
$row['student_assignment_id'];
$student_id =
$row['student_id'];
?>
<tr>
<td><?php echo
$row['assignment_fdatein']; ?></td>
<td><?php echo $row['fname']; ?></td>
<td><?php echo $row['fdesc']; ?></td>
<td><?php echo $row['firstname']." ".$row['lastname']; ?></td>
<?php if ($session_id
== $student_id){ ?>
<td>
<span class="badge
badge-success"><?php echo $row['grade']; ?></span>
</td>
<?php }else{ ?>
<td></td>
<?php } ?>

</tr>

<?php } ?>

</tbody>
</table>
</div>

</div>
</div>
</div>
<!-- /block -->
</div>

</div>
<?php include('submit_assignment_sidebar.php') ?>

</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

Take_test.php – function for taking a tet with timelimit and score.

<?php include('header_dashboard.php'); ?>


<?php include('session.php'); ?>

<?php $get_id = $_GET['id']; ?>


<?php $class_quiz_id = $_GET['class_quiz_id']; ?>
<?php $quiz_id = $_GET['quiz_id']; ?>
<?php $quiz_time = $_GET['quiz_time']; ?>

<?php $query1 = mysql_query("select * from student_class_quiz where student_id =


'$session_id' and class_quiz_id = '$class_quiz_id' ")or die(mysql_error());
$count = mysql_num_rows($query1);
?>

<?php
if ($count > 0){
}else{
mysql_query("insert into student_class_quiz (class_quiz_id,student_id,student_quiz_time)
values('$class_quiz_id','$session_id','$quiz_time')");
}
?>
<!-- this is for takinga test code theres a counting to limit the time of user to takinga test -->

<body>
<?php include('navbar_student.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('student_quiz_link.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<?php $class_query =
mysql_query("select * from teacher_class
LEFT JOIN class ON
class.class_id = teacher_class.class_id
LEFT JOIN program
ON program.program_id = teacher_class.program_id
where
teacher_class_id = '$get_id'")or die(mysql_error());
$class_row =
mysql_fetch_array($class_query);
$class_id =
$class_row['class_id'];
$school_year =
$class_row['school_year'];
?>
<ul class="breadcrumb">
<li><a href="#"><?php echo
$class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo
$class_row['program_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#">School Year: <?php echo
$class_row['school_year']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><b>Practice
Quiz</b></a></li>
</ul>
<!-- end breadcrumb -->

<!-- block -->


<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">

<?php
if($_GET['test'] == 'ok'){
/* $sqlp = mysql_query("SELECT * FROM groupcode WHERE course_code =
'".$row['course_code']."'"); */
$sqlp = mysql_query("SELECT * FROM class_quiz WHERE class_quiz_id =
'$class_quiz_id'")or die(mysql_error());
$rowp = mysql_fetch_array($sqlp);
/* mysql_query("UPDATE students SET `time-left` = ".$rowp['time']." WHERE stud_id =
'".$_SESSION['user_id']."'"); */
/* echo $rowp['time']; */
$x=0;
?>
<script>

jQuery(document).ready(function(){
var timer = 1;

jQuery(".questions-table input").hide();

setInterval(function(){
var timer =
jQuery("#timer").text();

jQuery("#timer").load("timer.ajax.php");
if(timer == 0){

jQuery(".questions-table input").hide();

jQuery("#submit-test").show();

jQuery("#msg").text("Time's up!!!\nPlease Submit your Answers");


} else {

jQuery(".questions-table input").show();
}
},990);
});
</script>
<form action="take_test.php<?php echo '?id='.$get_id; ?>&<?php echo
'class_quiz_id='.$class_quiz_id; ?>&<?php echo 'test=done' ?>&<?php echo 'quiz_id='.$quiz_id;
?>&<?php echo 'quiz_time='.$quiz_time; ?>" name="testform" method="POST" id="test-
form">
<?php
$sqla =
mysql_query("select * FROM class_quiz
LEFT JOIN quiz ON
quiz.quiz_id = class_quiz.quiz_id
where
teacher_class_id = '$get_id'
order by date_added
DESC ")or die(mysql_error());
/* $row =
mysql_fetch_array($sqla); */
$rowa =
mysql_fetch_array($sqla);

/* $rowa =
$row['quiz_id']; */
/* $sqla = mysql_query("SELECT * FROM class_quiz WHERE course_code =
'".$row['course_code']."'"); */

?>
<h3>Test Title:
<b><?php echo $rowa['quiz_title'];?></b></h3>

<p><b>Description:<?php echo $rowa['quiz_description'];?></b></p>


<p></p>
Time Remaining:<div
id="timer">1</div>
<div
id="msg"></div>
<script>
jQuery(document).ready(function(){
jQuery(".questions").each(function(){
jQuery(this).hide();
});
jQuery("#q_1").show();
});
</script>
<script>

jQuery(document).ready(function(){
var nq = 0;
var qn = 0;

jQuery(".nextq").click(function(){
qn =
jQuery(this).attr('qn');
nq =
parseInt(qn) + 1;

jQuery('#q_' + qn ).fadeOut();

jQuery('#q_' + nq ).show();
});
});
</script>
<table class="questions-table table">
<tr>
<th>#</th>
<th>Question</th>
</tr>
<?php
$sqlw = mysql_query("SELECT * FROM quiz_question where quiz_id = '$quiz_id'
ORDER BY RAND()");
$qt = mysql_num_rows($sqlw);
while($roww = mysql_fetch_array($sqlw)){
?>
<tr id="q_<?php echo $x=$x+1;?>" class="questions">
<td width="30" id="qa"><?php echo $x;?></td>
<td id="qa">
<?php echo $roww['question_text'];?>
<br>
<hr>
<?php
if($roww['question_type_id']=='2'){
?>
<input name="q-<?php echo $roww['quiz_question_id'];?>" value="True" type="radio">
True&nbsp;|&nbsp;<input name="q-<?php echo $roww['quiz_question_id'];?>" value="False"
type="radio"> False
<?php
} else if($roww['question_type_id']=='1') {
$sqly = mysql_query("SELECT * FROM answer WHERE quiz_question_id =
'".$roww['quiz_question_id']."'");
while($rowy = mysql_fetch_array($sqly)){
if($rowy['choices'] == 'A') {
?>
A.)<input name="q-<?php echo $roww['quiz_question_id'];?>" value="A" type="radio">
<?php echo $rowy['answer_text'];?><br /><br />
<?php } else if ($rowy['choices'] == 'B') {?>
B.) <input name="q-<?php echo $roww['quiz_question_id'];?>" value="B"
type="radio"> <?php echo $rowy['answer_text'];?><br /><br />
<?php } else if ($rowy['choices'] == 'C') {?>
C.) <input name="q-<?php echo $roww['quiz_question_id'];?>" value="C"
type="radio"> <?php echo $rowy['answer_text'];?><br /><br />
<?php } else if ($rowy['choices'] == 'D') {?>
D.) <input name="q-<?php echo $roww['quiz_question_id'];?>" value="D"
type="radio"> <?php echo $rowy['answer_text'];?><br /><br />
<?php
}
}
}
?>
<br/>
<button onclick="return false;" qn="<?php echo $x;?>" class="nextq btn btn-success"
id="next_<?php echo $x;?>">NEXT QUESTION <i class="icon-arrow-right"></i> </button>
<input type="hidden" name="x-<?php echo $x;?>" value="<?php echo
$roww['quiz_question_id'];?>">
</td>
</tr>
<?php
}
?>
<tr>
<td></td>
<td>
<button class="btn btn-info" id="submit-test" name="submit_answer"><i class="icon-
check"></i> Submit Answer</button>
<!-- <input type="submit" value="Submit My Answers" class="btn btn-info" id="submit-test"
name="submit_answer"><br /> -->
</td>
</tr>
</table>
<input type="hidden" name="x" value="<?php echo $x;?>">
</form>
<?php
} else if(isset($_POST['submit_answer'])){
$x1 = $_POST['x'];
$score = 0;
for($x=1;$x<=$x1;$x++){

$x2 = $_POST["x-$x"];
$q = $_POST["q-$x2"];

$sql = mysql_query("SELECT * FROM quiz_question WHERE quiz_question_id


= ".$x2."");
$row = mysql_fetch_array($sql);
if($row['answer'] == $q) {
$score= $score + 1;
}

} ?>
<a href="student_quiz_list.php<?php echo '?id='.$get_id; ?>"><i class="icon-arrow-
left"></i> Back</a>
<center>
<h3><br>Your score is <b><?php echo $score; ?></b> out of <b><?php echo ($x-1);
?></b><br/></h3>
</center>
<?php
/* echo "Your Percentage Grade is : <b>".$per."%</b>"; */
mysql_query("UPDATE student_class_quiz SET `student_quiz_time` = 3600, `grade` =
'".$score." out of ".($x-1)."' WHERE student_id = '$session_id' and class_quiz_id =
'$class_quiz_id'")or die(mysql_error());
?>
<script>
window.location = 'student_quiz_list.php<?php echo '?id='.$get_id; ?>';
</script>
<?php
} /* else { */
?>
<br />
<?php
/* $sql = mysql_query("SELECT * FROM students WHERE stud_id =
'".$_SESSION['user_id']."'");
$row = mysql_fetch_array($sql);
if(is_null($row['grade']) AND $row['time-left'] == 3600){ */
?>
<!-- <a href="?test=ok">Take the test now</a> -->
<?php
/* } else if(is_null($row['grade']) AND $row['time-left'] < 3600 AND $row['time-left'] > 0){
*/
?>
<!-- <a href="?test=ok">Continue your test</a> -->
<?php
/* } else if(!is_null($row['grade'])){
$sqlg = mysql_query("SELECT * FROM groupcode WHERE course_code =
'".$row['course_code']."'");
$rowg = mysql_fetch_array($sqlg);
echo "You have already taken <b>".$rowg['course_title']."</b> -
<b>".$rowg['course_code']."</b> test.";
}
if($row['grade']!=''){
mysql_query("UPDATE students SET `time-left` = 3600 WHERE stud_id =
'".$_SESSION['user_id']."'");
echo "<br />Your Grade for this Test is : <b>".$row['grade']."</b>";
}
} */
?>
</div>
<div class="block-content collapse in">
<div class="span12">

</div>
</div>
</div>
<!-- /block -->
</div>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>

S-ar putea să vă placă și