function _mkObj($array) { $staff = new Staff(); $staff->setUserid($array["userid"]); $staff->setLastName($array["last_name"]); $staff->setFirstName($array["first_name"]); $staff->setUsername($array["username"]); $staff->setEmail($array["email"]); $staff->setContactNumber($array["contact_number"]); if ($array["circ_flg"] == "Y") { $staff->setCircAuth(true); } else { $staff->setCircAuth(false); } if ($array["circ_mbr_flg"] == "Y") { $staff->setCircMbrAuth(TRUE); } else { $staff->setCircMbrAuth(FALSE); } if ($array["catalog_flg"] == "Y") { $staff->setCatalogAuth(true); } else { $staff->setCatalogAuth(false); } if ($array["admin_flg"] == "Y") { $staff->setAdminAuth(true); } else { $staff->setAdminAuth(false); } if ($array["reports_flg"] == "Y") { $staff->setReportsAuth(TRUE); } else { $staff->setReportsAuth(FALSE); } if ($array["suspended_flg"] == "Y") { $staff->setSuspended(true); } else { $staff->setSuspended(false); } return $staff; }
function fetchStaff() { $array = $this->_conn->fetchRow(); if ($array == false) { return false; } $staff = new Staff(); $staff->setUserid($array["userid"]); $staff->setLastName($array["last_name"]); $staff->setFirstName($array["first_name"]); $staff->setUsername($array["username"]); if ($array["circ_flg"] == "Y") { $staff->setCircAuth(true); } else { $staff->setCircAuth(false); } if ($array["circ_mbr_flg"] == "Y") { $staff->setCircMbrAuth(TRUE); } else { $staff->setCircMbrAuth(FALSE); } if ($array["catalog_flg"] == "Y") { $staff->setCatalogAuth(true); } else { $staff->setCatalogAuth(false); } if ($array["admin_flg"] == "Y") { $staff->setAdminAuth(true); } else { $staff->setAdminAuth(false); } if ($array["reports_flg"] == "Y") { $staff->setReportsAuth(TRUE); } else { $staff->setReportsAuth(FALSE); } if ($array["suspended_flg"] == "Y") { $staff->setSuspended(true); } else { $staff->setSuspended(false); } return $staff; }
#**************************************************************************** $staff = new Staff(); $staff->setLastChangeUserid($_SESSION["userid"]); $staff->setUserid($_POST["userid"]); $staff->setLastName($_POST["last_name"]); $_POST["last_name"] = $staff->getLastName(); $staff->setFirstName($_POST["first_name"]); $_POST["first_name"] = $staff->getFirstName(); $staff->setUsername($_POST["username"]); $_POST["username"] = $staff->getUsername(); $staff->setCircAuth(isset($_POST["circ_flg"])); $staff->setCircMbrAuth(isset($_POST["circ_mbr_flg"])); $staff->setCatalogAuth(isset($_POST["catalog_flg"])); $staff->setAdminAuth(isset($_POST["admin_flg"])); $staff->setReportsAuth(isset($_POST["reports_flg"])); $staff->setSuspended(isset($_POST["suspended_flg"])); if (!$staff->validateData()) { $pageErrors["last_name"] = $staff->getLastNameError(); $pageErrors["username"] = $staff->getUsernameError(); $_SESSION["postVars"] = $_POST; $_SESSION["pageErrors"] = $pageErrors; header("Location: ../admin/staff_edit_form.php"); exit; } #************************************************************************** #* Update staff member #************************************************************************** $staffQ = new StaffQuery(); $staffQ->connect(); if ($staffQ->errorOccurred()) { $staffQ->close();