if (isset($_POST['is_staff'])) { $is_staff = '1'; } else { $is_staff = '0'; } if (isset($_POST['enabled'])) { $enabled = '1'; } else { $enabled = '0'; } $staff->setName($_POST['name']); $staff->setSecName($_POST['secondname']); $staff->setAdress($_POST['adress']); $staff->setCity($_POST['city']); $staff->setJbg($_POST['jbg']); $staff->setEmail($_POST['email']); $staff->setPasswd($_POST['passwd']); $staff->setPhone($_POST['phone']); $staff->setMphone($_POST['mphone']); $staff->setIsStaff($is_staff); $staff->setImageUrl($image_url); $staff->setPhotoId($photo_id); $staff->setWorkPlace($_POST['work_place']); $staff->setSalary($_POST['salary']); $staff->setIsAdmin($is_admin); $staff->setEnabled($enabled); $id = $userDao->createStafs($staff->getName(), $staff->getSecName(), $staff->getAdress(), $staff->getCity(), $staff->getJbg(), $staff->getEmail(), $staff->getPasswd(), $staff->getPhone(), $staff->getMphone(), $staff->getIsStaff(), $staff->getImageUrl(), $staff->getPhotoId(), $staff->getWorkPlace(), $staff->getSalary(), $staff->getIsAdmin(), $staff->getEnabled()); } //print_r("ID nakon createStafs iznosi: ".$id); $resultsshow = $userDao->showUser($id); $row = $resultsshow->fetch_assoc();
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; }
#* Checking for post vars. Go back to form if none found. #**************************************************************************** if (count($_POST) == 0) { header("Location: ../admin/staff_new_form.php"); exit; } #**************************************************************************** #* Validate data #**************************************************************************** $staff = new Staff(); $staff->setLastChangeUserid($_SESSION["userid"]); $staff->setLastName($_POST["last_name"]); $_POST["last_name"] = $staff->getLastName(); $staff->setFirstName($_POST["first_name"]); $_POST["first_name"] = $staff->getFirstName(); $staff->setEmail($_POST["email"]); $_POST["email"] = $staff->getEmail(); $staff->setContactNumber($_POST["contact_number"]); $_POST["contact_number"] = $staff->getContactNumber(); $staff->setUsername($_POST["username"]); $_POST["username"] = $staff->getUsername(); $staff->setPwd($_POST["pwd"]); $_POST["pwd"] = $staff->getPwd(); $staff->setPwd2($_POST["pwd2"]); $_POST["pwd2"] = $staff->getPwd2(); $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"])); $validData = $staff->validateData();