protected function validaterelation()
 {
     $required = array("section" => "Section", "subject" => "Subject", "teacher" => "Teacher");
     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';
             $arr_sub = $_POST['subject'];
             $arr_teacher = $_POST['teacher'];
             for ($i = 0; $i < count($arr_sub); $i++) {
                 $subRel = new SectionTeacherSubjectRelations($objPDO);
                 $subRel->setSectionId($_POST['section']);
                 $subRel->setSubjectId(intval($arr_sub[$i]));
                 $subRel->loadByClassSubject();
                 $subRel->setTeacherId(intval($arr_teacher[$i]));
                 $subRel->save();
             }
             echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/miscellaneous"/>';
         }
     } else {
         header('Location:http://localhost/cloud');
     }
 }