예제 #1
0
 protected function validate()
 {
     $required = array("section" => "Section", "date" => "Date", "students" => "Students");
     global $user;
     global $objPDO;
     $student = new Student($objPDO, $user->getuserId());
     if ($user->checkAdmin() == true || $student->checkTeacher()) {
         if (isset($_POST)) {
             foreach ($required as $key => $value) {
                 if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
                     echo $value . ' is Required<br/>';
                     return;
                 }
             }
             echo 'Saving...';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/attendence_class.php';
             $arr = $_POST['students'];
             $attRel = new Attendence($objPDO);
             $attRel->deleteBySectionDate($_POST['section'], $_POST['date']);
             for ($i = 0; $i < count($arr); $i++) {
                 $attRel = new Attendence($objPDO);
                 $attRel->setSectionId(intval($_POST['section']));
                 $attRel->setDate($_POST['date']);
                 $attRel->setStudentId(intval($arr[$i]));
                 if (isset($_POST[$arr[$i]])) {
                     $attRel->setPresence(1);
                 } else {
                     $attRel->setPresence(0);
                 }
                 $attRel->save();
             }
             echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/attendance/create"/>';
         }
     } else {
         header('Location:http://localhost/cloud');
     }
 }
예제 #2
0
 protected function create_student()
 {
     $required = array("heading" => "Heading", "content" => "Content", "importance" => "Notice Type");
     global $user;
     global $objPDO;
     $student = new Student($objPDO, $user->getuserId());
     if ($user->checkAdmin() == true || $student->checkTeacher() || $student->checkStudent()) {
         if (isset($_POST)) {
             foreach ($required as $key => $value) {
                 if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
                     echo $value . ' is Required<br/>';
                     return;
                 }
             }
             echo 'Saving...';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_notice_class.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_profile_class.php';
             $allowed_tags = "<div><span><p><img><br><br/><a><b><u><i><style><audio><video><embed><iframe><tr><td><table><sup><sub><title>";
             $info = $_POST['content'];
             $info = preg_replace('/&lt;script\\b[^>]*>(.*?)\\/script&gt;/i', '', $info);
             $info = preg_replace('/<script\\b[^>]*>(.*?)\\/script>/i', '', $info);
             $head = mysql_real_escape_string(addslashes(strip_tags($_POST['heading'])));
             $info = mysql_real_escape_string(addslashes(strip_tags($info, $allowed_tags)));
             $type = $_POST['importance'];
             $stu = new StudentProfile($objPDO);
             $user_id = $user->getuserId();
             $notice = new StudentNotice($objPDO);
             $notice->setHeading($head);
             $notice->setInfo($info);
             $notice->setType($type);
             $notice->setStudentId($user_id);
             $notice->save();
             echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/notice/student"/>';
         }
     } else {
         header('Location:http://localhost/cloud');
     }
 }
예제 #3
0
 protected function validateconfirm()
 {
     $required = array("teacher_id" => "Teacher Id", "admission_date" => "Admission Date", "name" => "Name", "subject_id" => "Subject", "date_of_birth" => "Date of Birth", "gender" => "Gender", "mobile" => "Mobile");
     global $user;
     global $objPDO;
     $student = new Student($objPDO, $user->getuserId());
     if ($user->checkAdmin() == true || $student->checkTeacher() == true) {
         if (isset($_POST)) {
             foreach ($required as $key => $value) {
                 if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
                     echo $value . ' is Required<br/>';
                     return;
                 }
             }
             if (!is_numeric($_POST['mobile'])) {
                 echo "Mobile number must be Numeric";
             } else {
                 if (isset($_POST['permanent_pincode']) && $_POST['permanent_pincode'] != '' && !is_numeric($_POST['permanent_pincode']) || isset($_POST['correspondence_pincode']) && $_POST['correspondence_pincode'] != '' && !is_numeric($_POST['correspondence_pincode'])) {
                     echo "Pincode must be Numeric";
                 } else {
                     echo 'Saving...';
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php';
                     $teacherProfile = new Teacher($objPDO);
                     if ($user->checkAdmin() == true) {
                         $teacher_id = $_GET['uid'];
                     } else {
                         $teacher_id = $student->getID();
                     }
                     if ($_POST['blood_group'] == 'select') {
                         unset($_POST['blood_group']);
                     }
                     $teacherProfile->loadByUserId($teacher_id);
                     $teacherProfile->setByArray($_POST);
                     $teacherProfile->save();
                     echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/teacher/view/' . $teacher_id . '"/>';
                 }
             }
         }
     } else {
         echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/teacher/view/"/>';
     }
 }
 protected function savemarks()
 {
     $required = array("exam_subject_id" => "Examination", "student" => "Student Id", "total_marks" => "Total Marks");
     global $user;
     global $objPDO;
     $student = new Student($objPDO, $user->getuserId());
     if ($user->checkAdmin() == true || $student->checkTeacher()) {
         if (isset($_POST)) {
             foreach ($required as $key => $value) {
                 if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
                     echo $value . ' is Required<br/>';
                     return;
                 }
             }
             $flag = true;
             foreach ($_POST['student'] as $key => $value) {
                 if (!isset($_POST['total_marks'][$key]) || !is_numeric($_POST['total_marks'][$key])) {
                     $flag = false;
                 }
             }
             if ($flag == false) {
                 echo 'Enter All Students Marks (you may use -1 for not attended)';
                 return;
             }
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/marks_splitup_class.php';
             $split_ups = new MarksSplitup($objPDO);
             $split = $split_ups->getByExamSubjectId($_POST['exam_subject_id']);
             $split_marks = array();
             foreach ($split as $key => $value) {
                 if (!isset($_POST[$value['id']])) {
                     echo 'Marks Split Up Required (If Not Needed Change Marks Split Up Settings)';
                     return;
                 } else {
                     foreach ($_POST[$value['id']] as $k => $v) {
                         if ($v == "" || !is_numeric($v)) {
                             echo 'Marks Split Up Required (If Not Needed Change Marks Split Up Settings)';
                             return;
                         } else {
                             $split_marks[$k][$value['id']] = $v;
                         }
                     }
                 }
             }
             echo 'Saving...';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/exam_marks_class.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/splitup_marks_class.php';
             $total_marks = $_POST['total_marks'];
             $student = $_POST['student'];
             foreach ($student as $key => $value) {
                 $exam = new ExamMarks($objPDO);
                 $exam->setExamSubjectId($_POST['exam_subject_id']);
                 $exam->setStudentId($value);
                 $exam->setByExamStudentID($_POST['exam_subject_id'], $value);
                 $exam->setMarks($total_marks[$key]);
                 $exam->autoGrade();
                 $exam->save();
                 $exam_marks_id = $exam->getID();
                 if ($split_marks) {
                     foreach ($split_marks[$key] as $k => $v) {
                         $split = new SplitupMarks($objPDO);
                         $split->setExamMarksId($exam_marks_id);
                         $split->setSplitUpId($k);
                         $split->setMarks($v);
                         $split->save();
                     }
                 }
             }
             echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/examination"/>';
         }
     } else {
         header('Location:http://localhost/cloud');
     }
 }
 protected function searchresult()
 {
     global $user;
     global $objPDO;
     $student = new Student($objPDO, $user->getuserId());
     $search = $_POST['search_input'];
     require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_profile_class.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/parent_class.php';
     $studentProfile = new StudentProfile($objPDO);
     $spec = NULL;
     if (isset($_GET['uid'])) {
         $spec = $_GET['uid'];
     } else {
         if ($search != '' && $search[0] == '#') {
             $search = substr($search, 1);
             $spec = 'roll';
         } else {
             if ($search != '' && $search[0] == '@') {
                 $search = substr($search, 1);
                 $spec = 'name';
             } else {
                 if ($search != '' && $search[0] == '^') {
                     $search = substr($search, 1);
                     $spec = 'admission';
                 } else {
                     if ($search != '' && $search[0] == '*') {
                         $search = substr($search, 1);
                         $spec = 'class';
                     }
                 }
             }
         }
     }
     if ($search != '' && $spec == NULL && ($user->checkAdmin() || $student->checkTeacher())) {
         $roll_match = $studentProfile->SearchByRollNo($search, 1);
         $admission_match = $studentProfile->SearchByAdmissionNumber($search, 1);
         $name_match = $studentProfile->SearchByName($search, 1);
         $class_match = $studentProfile->SearchByClass($search, 1);
         echo '<div class="results"><span style="font-family:tahoma; font-weight:bold;font-size:15px">Displaying Search Results for "';
         echo $search;
         echo '"</span></div>';
         //start of roll no search
         $i = 0;
         echo '<div class="roll_search">';
         for ($i = 0; $i < count($roll_match); $i++) {
             if ($i == 0) {
                 echo '<div class="search_heading">Roll Number Matches</div>';
                 echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
             }
             if ($i % 2 == 0) {
                 echo '<tr>';
             } else {
                 echo '<tr class="search_result_item">';
             }
             $start = stripos($roll_match[$i]['roll_no'], $search);
             $end = $start + strlen($search) - 1;
             $block = $roll_match[$i]['roll_no'];
             $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
             echo '<td>' . $roll_match[$i]['admission_number'] . '</td>';
             echo '<td>' . $highlighted . '</td>';
             echo '<td>' . $roll_match[$i]['name'] . '</td>';
             echo '<td>' . $roll_match[$i]['class_level'] . '</td>';
             echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $roll_match[$i]['user_id'] . '">View Profile</a></td>';
             echo '</tr>';
         }
         echo '</table></div>';
         //end of roll no search
         //start of admission no search
         $i = 0;
         echo '<div class="admission_search">';
         for ($i = 0; $i < count($admission_match); $i++) {
             if ($i == 0) {
                 echo '<div class="search_heading">Admission Number Matches</div>';
                 echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
             }
             if ($i % 2 == 0) {
                 echo '<tr>';
             } else {
                 echo '<tr class="search_result_item">';
             }
             $start = stripos($admission_match[$i]['admission_number'], $search);
             $end = $start + strlen($search) - 1;
             $block = $admission_match[$i]['admission_number'];
             $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
             echo '<td>' . $highlighted . '</td>';
             echo '<td>' . $admission_match[$i]['roll_no'] . '</td>';
             echo '<td>' . $admission_match[$i]['name'] . '</td>';
             echo '<td>' . $admission_match[$i]['class_level'] . '</td>';
             echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $admission_match[$i]['user_id'] . '">View Profile</a></td>';
             echo '</tr>';
         }
         echo '</table></div>';
         //end of admission no search
         //start of name search
         $i = 0;
         echo '<div class="name_search">';
         for ($i = 0; $i < count($name_match); $i++) {
             if ($i == 0) {
                 echo '<div class="search_heading">Student Name Matches</div>';
                 echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
             }
             if ($i % 2 == 0) {
                 echo '<tr>';
             } else {
                 echo '<tr class="search_result_item">';
             }
             $start = stripos($name_match[$i]['name'], $search);
             $end = $start + strlen($search) - 1;
             $block = $name_match[$i]['name'];
             $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
             echo '<td>' . $name_match[$i]['admission_number'] . '</td>';
             echo '<td>' . $name_match[$i]['roll_no'] . '</td>';
             echo '<td>' . $highlighted . '</td>';
             echo '<td>' . $name_match[$i]['class_level'] . '</td>';
             echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $name_match[$i]['user_id'] . '">View Profile</a></td>';
             echo '</tr>';
         }
         echo '</table></div>';
         //end of name search
         //start of class search
         $i = 0;
         echo '<div class="class_search">';
         for ($i = 0; $i < count($class_match); $i++) {
             if ($i == 0) {
                 echo '<div class="search_heading">Class Matches</div>';
                 echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
             }
             if ($i % 2 == 0) {
                 echo '<tr>';
             } else {
                 echo '<tr class="search_result_item">';
             }
             $start = stripos($class_match[$i]['class_level'], $search);
             $end = $start + strlen($search) - 1;
             $block = $class_match[$i]['class_level'];
             $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
             echo '<td>' . $class_match[$i]['admission_number'] . '</td>';
             echo '<td>' . $class_match[$i]['roll_no'] . '</td>';
             echo '<td>' . $class_match[$i]['name'] . '</td>';
             echo '<td>' . $highlighted . '</td>';
             echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $class_match[$i]['user_id'] . '">View Profile</a></td>';
             echo '</tr>';
         }
         echo '</table></div>';
         //end of roll no search
     } else {
         if ($spec == 'roll' && $search != '') {
             $roll_match = $studentProfile->SearchByRollNo($search);
             echo '<div class="results"><span style="font-family:tahoma; font-weight:bold;font-size:15px">Displaying Search Results for "';
             echo $search;
             echo '"</span></div>';
             //start of roll no search
             $i = 0;
             echo '<div class="roll_search">';
             for ($i = 0; $i < count($roll_match); $i++) {
                 if ($i == 0) {
                     echo '<div class="search_heading">Roll Number Matches</div>';
                     echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
                 }
                 if ($i % 2 == 0) {
                     echo '<tr>';
                 } else {
                     echo '<tr class="search_result_item">';
                 }
                 $start = stripos($roll_match[$i]['roll_no'], $search);
                 $end = $start + strlen($search) - 1;
                 $block = $roll_match[$i]['roll_no'];
                 $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
                 echo '<td>' . $roll_match[$i]['admission_number'] . '</td>';
                 echo '<td>' . $highlighted . '</td>';
                 echo '<td>' . $roll_match[$i]['name'] . '</td>';
                 echo '<td>' . $roll_match[$i]['class_level'] . '</td>';
                 echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $roll_match[$i]['user_id'] . '">View Profile</a></td>';
                 echo '</tr>';
             }
             echo '</table></div>';
             //end of roll no search
         } else {
             if ($search != "" && $spec == 'name') {
                 $name_match = $studentProfile->SearchByName($search);
                 echo '<div class="results"><span style="font-family:tahoma; font-weight:bold;font-size:15px">Displaying Search Results for "';
                 echo $search;
                 echo '"</span></div>';
                 //start of name search
                 $i = 0;
                 echo '<div class="name_search">';
                 for ($i = 0; $i < count($name_match); $i++) {
                     if ($i == 0) {
                         echo '<div class="search_heading">Student Name Matches</div>';
                         echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
                     }
                     if ($i % 2 == 0) {
                         echo '<tr>';
                     } else {
                         echo '<tr class="search_result_item">';
                     }
                     $start = stripos($name_match[$i]['name'], $search);
                     $end = $start + strlen($search) - 1;
                     $block = $name_match[$i]['name'];
                     $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
                     echo '<td>' . $name_match[$i]['admission_number'] . '</td>';
                     echo '<td>' . $name_match[$i]['roll_no'] . '</td>';
                     echo '<td>' . $highlighted . '</td>';
                     echo '<td>' . $name_match[$i]['class_level'] . '</td>';
                     echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $name_match[$i]['user_id'] . '">View Profile</a></td>';
                     echo '</tr>';
                 }
                 echo '</table></div>';
                 //end of name search
             } else {
                 if ($search != "" && $spec == 'admission') {
                     $admission_match = $studentProfile->SearchByAdmissionNumber($search);
                     echo '<div class="results"><span style="font-family:tahoma; font-weight:bold;font-size:15px">Displaying Search Results for "';
                     echo $search;
                     echo '"</span></div>';
                     //start of admission no search
                     $i = 0;
                     echo '<div class="admission_search">';
                     for ($i = 0; $i < count($admission_match); $i++) {
                         if ($i == 0) {
                             echo '<div class="search_heading">Admission Number Matches</div>';
                             echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
                         }
                         if ($i % 2 == 0) {
                             echo '<tr>';
                         } else {
                             echo '<tr class="search_result_item">';
                         }
                         $start = stripos($admission_match[$i]['admission_number'], $search);
                         $end = $start + strlen($search) - 1;
                         $block = $admission_match[$i]['admission_number'];
                         $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
                         echo '<td>' . $highlighted . '</td>';
                         echo '<td>' . $admission_match[$i]['roll_no'] . '</td>';
                         echo '<td>' . $admission_match[$i]['name'] . '</td>';
                         echo '<td>' . $admission_match[$i]['class_level'] . '</td>';
                         echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $admission_match[$i]['user_id'] . '">View Profile</a></td>';
                         echo '</tr>';
                     }
                     echo '</table></div>';
                     //end of admission no search
                 } else {
                     if ($search != "" && $spec == 'class') {
                         $class_match = $studentProfile->SearchByClass($search);
                         echo '<div class="results"><span style="font-family:tahoma; font-weight:bold;font-size:15px">Displaying Search Results for "';
                         echo $search;
                         echo '"</span></div>';
                         //start of class search
                         $i = 0;
                         echo '<div class="class_search">';
                         for ($i = 0; $i < count($class_match); $i++) {
                             if ($i == 0) {
                                 echo '<div class="search_heading">Class Matches</div>';
                                 echo '<table class="search_result"><tr class="search_head"><td>Admission Number</td><td>Roll Number</td><td>Name</td><td>Class</td><td>View</td></tr>';
                             }
                             if ($i % 2 == 0) {
                                 echo '<tr>';
                             } else {
                                 echo '<tr class="search_result_item">';
                             }
                             $start = stripos($class_match[$i]['class_level'], $search);
                             $end = $start + strlen($search) - 1;
                             $block = $class_match[$i]['class_level'];
                             $highlighted = substr($block, 0, $start) . '<span class="search_highlight">' . substr($block, $start, strlen($search)) . '</span>' . substr($block, $end + 1);
                             echo '<td>' . $class_match[$i]['admission_number'] . '</td>';
                             echo '<td>' . $class_match[$i]['roll_no'] . '</td>';
                             echo '<td>' . $class_match[$i]['name'] . '</td>';
                             echo '<td>' . $highlighted . '</td>';
                             echo '<td><a class="link" href="http://localhost/cloud/studentprofile/view/' . $class_match[$i]['user_id'] . '">View Profile</a></td>';
                             echo '</tr>';
                         }
                         echo '</table></div>';
                         //end of class search
                     }
                 }
             }
         }
     }
 }