<?php require_once '../includes/header.php'; $a = new Availability(); if (Input::exists('get')) { try { $delete = $a->edit(['deleted' => 1], [['id', '=', Input::get('id')], ['cid', '=', $user->data()->id]]); if ($delete === true) { Session::flash('success', 'Availability deleted.'); } else { Session::flash('error', 'Unable to delete availability.'); } } catch (Exception $e) { Session::flash('error', $e->getMessage()); } Redirect::to('./availability.php'); }
<?php $pagetitle = "Edit Availability"; require_once 'includes/header.php'; $a = new Availability(); if (Input::exists('post')) { try { $validate = new Validate(); $validation = $validate->check($_POST, array('date' => array('field_name' => 'Date', 'required' => true), 'from' => array('field_name' => 'Time', 'required' => true), 'to' => array('field_name' => 'Time Until', 'required' => true))); if ($validation->passed()) { $test = $a->edit(array('date' => Input::get('date'), 'time_from' => Input::get('from') . ':00', 'time_until' => Input::get('to') . ':00'), [['id', '=', Input::get('id')], ['cid', '=', $user->data()->id]]); Session::flash('success', 'Availability edtited.'); Redirect::to('./availability.php#myavailability'); } } catch (Exception $e) { echo $e->getMessage(); } } $availability = $a->get(['id' => Input::get('id')])[0]; ?> <div class="row"> <div class="col-md-10 col-md-offset-1"> <h3 class="text-center">My Availability</h3><br> <div class="panel panel-default"> <div class="panel-heading">Edit Availability</div> <div class="panel-body"> <div class="col-md-8 col-md-offset-2"> <form class="form-horizontal" action="" method="post"> <fieldset> <div class="form-group">
<?php $pagetitle = "Schedule a Session"; require_once "../includes/header.php"; $a = new Availability(); if (Input::exists('post')) { try { $validate = new Validate(); $validation = $validate->check($_POST, array('type' => array('field_name' => 'Report Type', 'required' => true), 'position' => array('field_name' => 'Position', 'required' => true), 'from' => array('field_name' => 'Time From', 'required' => true, 'time_less' => 'until', 'time_same' => 'until'), 'until' => array('field_name' => 'Time Until', 'required' => true))); if ($validation->passed()) { $from = new DateTime(Input::get('from')); $start = Input::get('date') . ' ' . $from->format("H:i:s"); $until = new DateTime(Input::get('until')); $finish = Input::get('date') . ' ' . $until->format("H:i:s"); $s->add(array('student' => Input::get('student'), 'mentor' => $user->data()->id, 'position_id' => Input::get('position'), 'report_type' => Input::get('type'), 'start' => $start, 'finish' => $finish)); $a->edit(['deleted' => 1], [['id', '=', Input::get('availability_id')]]); Session::flash('success', 'Session added.'); Redirect::to('./'); } else { echo '<div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="panel panel-danger"> <div class="panel-heading"> <h3 class="panel-title">The following errors occured:</h3> </div> <div class="panel-body">'; foreach ($validation->errors() as $error) { echo $error . '<br>'; } echo '</div> </div>