protected function validate()
 {
     $required = array("section" => "Section", "subject" => "Subject");
     global $user;
     if ($user->checkAdmin() == true) {
         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...';
             global $objPDO;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_teacher_subject_class.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_relations_class.php';
             $arr = $_POST['subject'];
             $subRel = new SubjectRelations($objPDO);
             $teaRel = new SectionTeacherSubjectRelations($objPDO);
             $teaRel->deleteByClassId($_POST['section']);
             $subRel->deleteByClassId($_POST['section']);
             for ($i = 0; $i < count($arr); $i++) {
                 $subRel = new SubjectRelations($objPDO);
                 $subRel->setClassId($_POST['section']);
                 $subRel->setSubjectId(intval($arr[$i]));
                 $subRel->save();
             }
             echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/miscellaneous"/>';
         }
     } else {
         header('Location:http://localhost/cloud');
     }
 }
 protected function selectsubjects()
 {
     global $user;
     global $objPDO;
     $student = new student($objPDO, $user->getuserId());
     $headMenu = array("username" => $student->getName());
     if ($user->checkAdmin() == true) {
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_class.php';
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_relations_class.php';
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php';
         $sec = new Section($objPDO);
         $sections = $sec->getSectionArray();
         $rel = new SubjectRelations($objPDO);
         $subjects = array();
         foreach ($sections as $key => $value) {
             $subjects[$key] = $rel->getByClassId($key);
         }
         $sub = new Subject($objPDO);
         $subject_name = $sub->getSubjectArray();
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/examination_subjects.php';
     } else {
         header('Location:http://localhost/cloud');
     }
 }