<?php require_once 'core/init.php'; if (!Session::exists('teacher_email') && !loggedIn()) { Redirect::to('index.php'); } if (Input::exists('post')) { $validate = new Validate(); $validation = $validate->check($_POST, array('mobile' => array('required' => true, 'min' => 10, 'max' => 10))); if ($validate->passed()) { $dep = new Teacher(); $add = $dep->add(Session::get('displayname'), Session::get('teacher_email'), 'teacher', Input::get('department'), Input::get('mobile'), '0'); if ($add == 1) { Session::destroy(); Redirect::to('includes/errors/not_approved.php'); $log = new Log(); $log->actionLog('Added Teacher'); } else { if ($add == 0) { echo 'Temporary Error, while creating saving information.'; } } } } /*******************************************************************************************************************************************/ /*******************************************************************************************************************************************/ /*******************************************************************************************************************************************/ /*******************************************************************************************************************************************/ ?> <!DOCTYPE html> <html>
<?php require_once '../core/init.php'; if (Input::exists('post') && privilege() != NULL) { $validate = new Validate(); $validation = $validate->check($_POST, array('name' => array('required' => true), 'email' => array('required' => true, 'email' => true), 'privilege' => array('required' => true), 'mobile' => array('required' => true, 'min' => 10, 'max' => 10))); if ($validate->passed()) { $dep = new Teacher(); $add = $dep->add(Input::get('name'), Input::get('email'), Input::get('privilege'), Input::get('department'), Input::get('mobile'), '1'); if ($add == 4) { echo '<div class="alert alert-danger alert-dismissible" role="alert">'; echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; echo 'Maximum no. of possible ' . Input::get('privilege') . ' exists.'; echo '</div>'; } else { if ($add == 3) { echo '<div class="alert alert-danger alert-dismissible" role="alert">'; echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; echo 'Sorry, you don\'t have privilege to add <b>' . Input::get('privilege') . '</b>. '; echo '</div>'; } else { if ($add == 2) { echo '<div class="alert alert-danger alert-dismissible" role="alert">'; echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; echo 'Teacher already registered'; echo '</div>'; } else { if ($add == 1) { $log = new Log(); $log->actionLog('Added Teacher'); echo '<div class="alert alert-success alert-dismissible" role="alert">';