if (!loggedIn()) { Redirect::to('index.php'); } else { if (loggedIn() && !Session::exists('teacher_id')) { Session::destroy(); Redirect::to('includes/errors/unauthorized.php'); } } if (Input::exists()) { $validate = new Validate(); $validation = $validate->check($_POST, array('course_id' => array('required' => true), 'examtype' => array('required' => true), 'category' => array('required' => true))); if ($validate->passed()) { $input = Input::get('course_id'); $input = explode(',', Input::get('course_id')); $m = new Marks(); if ($m->exportCSV($input[0], $input[1], Input::get('examtype'), Input::get('category'))) { echo '<div class="alert alert-success 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 '<strong>Export successful</strong>'; echo '</div>'; } else { 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 'Temporary Error!'; echo '</div>'; } } else { echo '<div class="alert alert-warning 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>'; foreach ($validate->errors() as $errors) { switch ($errors) {