public function delete($id) { $article = Department::find_by_id($id); if ($article->delete()) { return true; } }
<?php require_once "inc/initialize.php"; require_once "inc/vendor/autoload.php"; use Carbon\Carbon; // Instance of Carbon Class with the current time $date_now = new Carbon('now'); if (!$session->is_logged_in()) { header("location: index.php"); } $user = User::find_by_id($session->id); if (isset($user->programme_id)) { $prog = Programme::find_by_id($user->programme_id); } if (isset($prog->department_id)) { $dept = Department::find_by_id($prog->department_id); } if (isset($dept->faculty_id)) { $fac = Faculty::find_by_id($dept->faculty_id); } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>University of Jos, Nigeria - Transcript System</title> <?php require_once LIB_PATH . DS . 'javascript.php'; require_once LIB_PATH . DS . 'css.php'; ?> <style type="text/css">
public function findDepartment($id) { $empDept = Department::find_by_id($id); if ($empDept) { return $empDept; //print_r($empRole); } else { return false; } }
/** * this section is required * to update employee role */ public function UpdateEmpRole() { $rEmployee = Employee::find_by_id($_POST['empid']); $rEmployee->emp_post = $_POST['emppost']; $rEmployee->emp_dept = $_POST['empdept']; $empDept = Department::find_by_id($_POST['empdept']); $Tlog = new Transaction(); $Tlog->com_id = $empDept->dept_code; $Tlog->trans_type = "HR DEPARTMENT"; $Tlog->trans_description = "Employee assigned to " . $empDept->dept_name . " Department"; $Tlog->datecreated = date("Y-m-d H:i:s"); $Tlog->user_id = $_SESSION['emp_ident']; $empRole = Roles::find_by_id($_POST['emppost']); $Tlog2 = new Transaction(); $Tlog2->com_id = $empRole->main_id; $Tlog2->trans_type = "HR DEPARTMENT"; $Tlog2->trans_description = "Employee assigned " . $empRole->role_name . " Role"; $Tlog2->datecreated = date("Y-m-d H:i:s"); $Tlog2->user_id = $_SESSION['emp_ident']; if ($rEmployee->update()) { $Tlog2->create(); $Tlog->create(); return true; } else { return false; } }