本文整理汇总了PHP中Employee::addEmployee方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::addEmployee方法的具体用法?PHP Employee::addEmployee怎么用?PHP Employee::addEmployee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::addEmployee方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store()
{
$employeeData['id'] = str_random(50);
$employeeData['name'] = Input::get('name');
$employeeData['address'] = Input::get('address');
$employeeData['referenceNumber'] = Input::get('referenceNumber');
$employeeData['insuranceNumber'] = Input::get('insuranceNumber');
$employeeData['dob'] = Input::get('dob');
$employeeData['note'] = Input::get('note');
$employee = new Employee();
$result = $employee->addEmployee($employeeData);
if ($result == true) {
return Redirect::to('employee')->with('message', 'The employee has been added.');
} else {
return Redirect::to('employee')->with('message', 'The employee could not be added.');
}
}
示例2: Employee
<?php
require_once '../config/config.php';
require_once '../controller/autoload.php';
require_once '../model/dropdownValues.php';
$emp_obj = new Employee($_POST);
if (isset($_POST['submit'])) {
$validate = $emp_obj->validate();
if ($validate['errorFlag'] == true) {
$displayErrors = implode('<br>', $validate['errorMessage']);
echo $displayErrors;
} else {
$emp_obj->addEmployee();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Register</title>
<script type = "text/javascript" src = "../../js/Validate.js"></script>
<link rel = "stylesheet" type = "text/css"
href = "../../css/register.css"/>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script> $(document).ready(function() { $("#datepicker").datepicker({ maxDate: new Date("31/12/1997"),minDate: new Date("31/12/1965"),defaultDate: new Date("12/11/1985"),dateFormat: "yy/mm/dd" });}); </script>
<h1 align = "right">Employee Details</h1>
</head>
<body>
<form method = "POST" action = "">
<table align = "right" cellpadding = "10" class = "table">
示例3: User
//Add
$newUser = new User();
$newUser->setEID($EID);
$newUser->setCID($CID);
$newUser->setEmail($Email);
//Assume that the added employees are normal staff, and can have privileges promoted later if needed
$newUser->setRoleID(4);
User::addUser($newUser);
$User = User::getUserByEmpInfo($EID, $CID);
$newEmployee = new Employee();
$newEmployee->setCID($CID);
$newEmployee->setEID($EID);
$newEmployee->setFname($Fname);
$newEmployee->setLname($Lname);
$newEmployee->setPhoneNum($PhoneNum);
Employee::addEmployee($newEmployee);
} else {
//Update
$User->setEmail($Email);
$User->saveToDB();
$employee = Employee::getEmployeeByUID($User->getUID());
$employee->setFname($Fname);
$employee->setLname($Lname);
$employee->setPhoneNum($PhoneNum);
$employee->saveToDB();
}
}
header('Location:https://' . $_SESSION['redir'] . "?result=" . urlencode("File Uploaded"));
} else {
header('Location:https://' . $_SESSION['redir'] . "?result=" . urlencode("File Upload Error"));
}
示例4: header
header('Location:https://' . $_SESSION['redir'] . "?result=Error: Invalid Form Post. Please Try Again");
exit;
}
$User = new User();
$User->setEmail($_POST["Email"]);
$User->setRoleID($_POST["RoleID"]);
$User->setEID($_POST["EID"]);
if ($_SESSION['hradmin']['CID'] == 1) {
$User->setCID($_POST['CID']);
} else {
$User->setCID($_SESSION['hradmin']['CID']);
}
if (!$User->addUser($User)) {
header('Location:https://' . $_SESSION['redir'] . "?result=Error: User with this information already exists");
exit;
}
$Employee = new Employee();
$Employee->setEID($_POST["EID"]);
$Employee->setCID($_POST["CID"]);
$Employee->setFname($_POST["Fname"]);
$Employee->setLname($_POST["Lname"]);
$Employee->setPhoneNum($_POST["PhoneNum"]);
Employee::addEmployee($Employee);
include_once "../../bossflex/DB/Models/Company.php";
/** @var Company $Company */
$Company = Company::getCompanyByID($User->getCID());
/** @var User $addedUser */
$addedUser = User::getUserByEmpInfo($_POST["EID"], $_POST["CID"]);
include_once "../../bossflex/Helpers/Email.php";
Email::sendVerificationEmail($addedUser->getEmail(), $Employee->getFname(), $Company->getCname(), $addedUser->getUID(), $addedUser->getVarString());
header('Location:https://' . $_SESSION['redir'] . "?result=User created");
示例5: Validate
</div>
</div>
</div>
<?php
if (Input::exists()) {
$validate = new Validate();
$validation = $validate->check($_POST, array('fname' => array('name' => 'Full Name', 'required' => true, 'min' => 2, 'max' => 50), 'lname' => array('name' => 'Last Name', 'required' => true, 'min' => 2, 'max' => 50), 'tel' => array('name' => 'Phone Number', 'required' => true, 'min' => 10, 'unique' => 'tbl_employee'), 'email' => array('name' => 'Email', 'unique' => 'tbl_employee'), 'address' => array('name' => 'Street Address', 'required' => true, 'min' => 2, 'max' => 50), 'city' => array('name' => 'City', 'required' => true, 'min' => 2, 'max' => 50), 'state' => array('name' => 'State', 'required' => true, 'min' => 2, 'max' => 50), 'postcode' => array('name' => 'PostCode', 'required' => true, 'min' => 2, 'max' => 50), 'country' => array('name' => 'Country', 'required' => true), 'job' => array('name' => 'Job', 'required' => true), 'pwd' => array('name' => 'Password', 'required' => true, 'min' => 8, 'max' => 50), 'rpassword' => array('name' => 'Confirm password', 'required' => true, 'matches' => 'pwd'), 'comment' => array('name' => 'Comment', 'max' => 100)));
if ($validation->passed()) {
$em = new Employee();
$img = new Image();
$address = new Address();
$id = $em->provideID('employee');
$img->checkimage('image', 'insert');
try {
$em->addEmployee(array('user_id' => $id, 'fname' => Input::get('fname'), 'lname' => Input::get('lname'), 'icnumber' => Input::get('icnumber'), 'dob' => Input::get('dob'), 'image' => $img->getimage(), 'image_name' => $img->getimagename(), 'image_type' => $img->getimagetype(), 'email' => Input::get('email'), 'tel' => Input::get('tel'), 'gender' => Input::get('gender'), 'pwd' => Crytion::generatehash(Input::get('pwd')), 'notes' => Input::get('comment'), 'salary' => Input::get('salary'), 'date_reg' => date('d-m-Y H:i:s'), 'job_id' => Input::get('job')));
$address->addAddress(array('person_id' => $id, 'add_street' => Input::get('address'), 'add_city' => Input::get('city'), 'add_state' => Input::get('state'), 'add_post' => Input::get('postcode'), 'country_id' => Input::get('country')));
if (!$em->passed() && !$address->passed()) {
Session::put('form-error', $em->errors());
} else {
Session::put('form-success', 'Creating Account Success');
}
} catch (Exception $e) {
die($e->getMessage());
}
} else {
Session::put('form-error', $validation->errors());
}
}
$assign = Crytion::decryt64(Session::get('assign'));
$user_id = Crytion::decryt64(Session::get('user_id'));