本文整理汇总了PHP中Employee类的典型用法代码示例。如果您正苦于以下问题:PHP Employee类的具体用法?PHP Employee怎么用?PHP Employee使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Employee类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBulkAssignLeaveEntitlements
public function testBulkAssignLeaveEntitlements()
{
$this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmLeavePlugin/test/fixtures/LeaveEntitlement.yml';
TestDataService::populate($this->fixture);
$dao = new LeaveEntitlementDao();
$limit = 5000;
$empList = array();
$employeeService = new EmployeeService();
$employeeService->setEmployeeDao(new EmployeeDao());
for ($i = 0; $i < $limit; $i++) {
$employee = new Employee();
$employee->setFirstName($i);
$employee = $employeeService->saveEmployee($employee);
array_push($empList, $employee->getEmpNumber());
}
$start_time = microtime(true);
$leaveEntitlement = new LeaveEntitlement();
$leaveEntitlement->setLeaveTypeId(1);
$leaveEntitlement->setCreditedDate(date('Y-m-d'));
$leaveEntitlement->setEntitlementType(LeaveEntitlement::ENTITLEMENT_TYPE_ADD);
$leaveEntitlement->setDeleted(0);
$leaveEntitlement->setNoOfDays(2);
$leaveEntitlement->setFromDate('2012-01-01');
$leaveEntitlement->setToDate('2012-08-01');
$result = $dao->bulkAssignLeaveEntitlements($empList, $leaveEntitlement);
$deference = microtime(true) - $start_time;
$this->assertEquals(count($empList), $result, "Time Deference - " . $deference);
echo "Add Entitlement 5000 Time " . $deference;
}
示例2: getLeavesForMeAndSubordinates
public function getLeavesForMeAndSubordinates($req){
$shareCalendar = $this->baseService->settingsManager->getSetting("Leave: Share Calendar to Whole Company");
$map = json_decode('{"employee":["Employee","id","first_name+last_name"],"leave_type":["LeaveType","id","name"]}');
$employee = $this->baseService->getElement('Employee',$this->getCurrentProfileId(),null,true);
if($shareCalendar != "1"){
$subordinate = new Employee();
$subordinates = $subordinate->Find("supervisor = ?",array($employee->id));
$subordinatesIds = $employee->id;
foreach($subordinates as $sub){
if($subordinatesIds != ""){
$subordinatesIds.=",";
}
$subordinatesIds.=$sub->id;
}
$employeeLeave = new EmployeeLeave();
$startDate = date("Y-m-d H:i:s",$req->start);
$endDate = date("Y-m-d H:i:s",$req->end);
$list = $employeeLeave->Find("employee in (".$subordinatesIds.") and status in ('Approved','Pending') and ((date_start >= ? and date_start <= ? ) or (date_end >= ? and date_end <= ?))",array($startDate,$endDate,$startDate,$endDate));
}else{
$employeeLeave = new EmployeeLeave();
$startDate = date("Y-m-d H:i:s",$req->start);
$endDate = date("Y-m-d H:i:s",$req->end);
$list = $employeeLeave->Find("status in ('Approved','Pending') and ((date_start >= ? and date_start <= ? ) or (date_end >= ? and date_end <= ?))",array($startDate,$endDate,$startDate,$endDate));
}
if(!$list){
LogManager::getInstance()->info($employeeLeave->ErrorMsg());
}
if(!empty($map)){
$list = $this->baseService->populateMapping($list,$map);
}
$data = array();
foreach($list as $leave){
$data[] = $this->leaveToEvent($leave);
}
$holiday = new HoliDay();
$holidays = $holiday->Find("1=1",array());
foreach($holidays as $holiday){
$data[] = $this->holidayToEvent($holiday);
}
echo json_encode($data);
exit();
}
示例3: compareEmployee
private function compareEmployee(Employee $objectOne, Employee $objectTwo)
{
if ($objectOne->getRank() == $objectTwo->getRank()) {
return 0;
}
return $objectOne->getRank() < $objectTwo->getRank() ? -1 : 1;
}
示例4: displayEmployee
public function displayEmployee($value, $tr)
{
$template = $this->context->smarty->createTemplate('controllers/logs/employee_field.tpl', $this->context->smarty);
$employee = new Employee((int) $tr['id_employee']);
$template->assign(array('employee_image' => $employee->getImage(), 'employee_name' => $value));
return $template->fetch();
}
示例5: getInitData
public function getInitData($req)
{
$data = array();
$employees = new Employee();
$data['numberOfEmployees'] = $employees->Count("1 = 1");
$company = new CompanyStructure();
$data['numberOfCompanyStuctures'] = $company->Count("1 = 1");
$user = new User();
$data['numberOfUsers'] = $user->Count("1 = 1");
$project = new Project();
$data['numberOfProjects'] = $project->Count("status = 'Active'");
$attendance = new Attendance();
$data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
if (empty($data['numberOfAttendanceLastWeek'])) {
$data['numberOfAttendanceLastWeek'] = 0;
}
$empLeave = new EmployeeLeave();
$data['numberOfLeaves'] = $empLeave->Count("date_start > '" . date("Y-m-d") . "'");
$timeEntry = new EmployeeTimeEntry();
$data['numberOfAttendanceLastWeek'] = $timeEntry->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
$candidate = new Candidate();
$data['numberOfCandidates'] = $candidate->Count("1 = 1");
$job = new Job();
$data['numberOfJobs'] = $job->Count("status = 'Active'");
$course = new Course();
$data['numberOfCourses'] = $course->Count("1 = 1");
return new IceResponse(IceResponse::SUCCESS, $data);
}
示例6: getDashboardItemData
public function getDashboardItemData()
{
$data = array();
$emp = new Employee();
$data['numberOfEmployees'] = $emp->Count("1 = 1");
return $data;
}
示例7: getData
public function getData($report, $req)
{
$leaveActionManager = new LeavesActionManager();
$department = $req['department'];
$employeeId = $req['employee'];
if (($employeeId == "NULL" || empty($employeeId)) && ($department == "NULL" || empty($department))) {
$emp = new Employee();
$employees = $emp->Find("status = 'Active'", array());
} else {
if ($employeeId != "NULL" && !empty($employeeId)) {
$emp = new Employee();
$employees = $emp->Find("id = ?", array($employeeId));
} else {
$emp = new Employee();
$employees = $emp->Find("department = ? and status = 'Active'", array($department));
}
}
$reportData = array();
$reportData[] = array("Employee ID", "Employee", "Leave Type", "Pending", "Approved", "Rejected", "Canceled", "Available", "To be Accrued", "Carried Forward from Previous Years");
foreach ($employees as $employee) {
$leaveEntitlements = $leaveActionManager->getEntitlementByEmployee($employee)->getObject();
foreach ($leaveEntitlements as $leaveEntitlement) {
$reportData[] = array($employee->employee_id, $employee->first_name . " " . $employee->last_name, $leaveEntitlement['name'], $leaveEntitlement['pendingLeaves'], $leaveEntitlement['approvedLeaves'], $leaveEntitlement['rejectedLeaves'], $leaveEntitlement['cancelRequestedLeaves'], $leaveEntitlement['availableLeaves'], $leaveEntitlement['tobeAccrued'], $leaveEntitlement['carriedForward']);
}
}
return $reportData;
}
示例8: grantAccess
/**
* Grant access to the WiFi network to an employee
* @param Employee $employee
* @return bool
*/
public function grantAccess(Employee $employee)
{
//now, it's a network with "access control"
if ($employee->getAccessLevel() === Employee::ACCESS_LEVEL_HIGH) {
return $this->wifiNetwork->grantAccess($employee);
}
return false;
}
示例9: getEmployeeById
private function getEmployeeById($id)
{
$sup = new Employee();
$sup->Load("id = ?", array($id));
if ($sup->id != $id) {
error_log("Employee not found");
return null;
}
return $sup;
}
示例10: getEmployeeById
private function getEmployeeById($id)
{
$sup = new Employee();
$sup->Load("id = ?", array($id));
if ($sup->id != $id) {
LogManager::getInstance()->info("Employee not found");
return null;
}
return $sup;
}
示例11: editgroup
public function editgroup($id)
{
$employeeId = Session::get('userEmployeeId');
$employee = new Employee();
$employeeInfo = $employee->getEmployeeInfoById($employeeId);
// Show details of a user.
$group = Group::findOrFail($id);
$perms = array("view" => 1, "create" => 2, "update" => 3, "delete" => 4);
$permissions = Permission::all();
return View::make('admin.editgroup')->with('group', $group)->with('perms', $perms)->with('permissions', $permissions)->with('employeeInfo', $employeeInfo);
}
示例12: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
if (Tools::isSubmit('submitDatePicker')) {
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) or !Validate::isDate($to = Tools::getValue('datepickerTo'))) {
$this->_errors[] = Tools::displayError('Date specified is invalid');
}
}
if (Tools::isSubmit('submitDateDay')) {
$from = date('Y-m-d');
$to = date('Y-m-d');
}
if (Tools::isSubmit('submitDateDayPrev')) {
$yesterday = time() - 60 * 60 * 24;
$from = date('Y-m-d', $yesterday);
$to = date('Y-m-d', $yesterday);
}
if (Tools::isSubmit('submitDateMonth')) {
$from = date('Y-m-01');
$to = date('Y-m-t');
}
if (Tools::isSubmit('submitDateMonthPrev')) {
$m = date('m') == 1 ? 12 : date('m') - 1;
$y = $m == 12 ? date('Y') - 1 : date('Y');
$from = $y . '-' . $m . '-01';
$to = $y . '-' . $m . date('-t', mktime(12, 0, 0, $m, 15, $y));
}
if (Tools::isSubmit('submitDateYear')) {
$from = date('Y-01-01');
$to = date('Y-12-31');
}
if (Tools::isSubmit('submitDateYearPrev')) {
$from = date('Y') - 1 . date('-01-01');
$to = date('Y') - 1 . date('-12-31');
}
if (isset($from) and isset($to) and !sizeof($this->_errors)) {
$employee = new Employee($cookie->id_employee);
$employee->stats_date_from = $from;
$employee->stats_date_to = $to;
$employee->update();
Tools::redirectAdmin($_SERVER['REQUEST_URI']);
}
if (Tools::getValue('submitSettings')) {
if ($this->tabAccess['edit'] === '1') {
$currentIndex .= '&module=' . Tools::getValue('module');
$this->_postConfig($this->_fieldsSettings);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
if (sizeof($this->_errors)) {
AdminTab::displayErrors();
}
}
示例13: deleteProfileImage
public function deleteProfileImage($req)
{
$profileId = $this->getCurrentProfileId();
$subordinate = new Employee();
$subordinatesCount = $subordinate->Count("supervisor = ? and id = ?", array($profileId, $req->id));
if ($this->user->user_level == 'Admin' || $this->user->employee == $req->id || $subordinatesCount == 1) {
$fs = FileService::getInstance();
$res = $fs->deleteProfileImage($req->id);
return new IceResponse(IceResponse::SUCCESS, $res);
}
return new IceResponse(IceResponse::ERROR, "Not allowed to delete profile image");
}
示例14: createFakerEmployee
protected function createFakerEmployee()
{
$faker = Faker::create();
for ($i = 1; $i < 50; $i++) {
$employee = new Employee();
$employee->first_name = $faker->firstName;
$employee->last_name = $faker->lastName;
$employee->email = $faker->email;
$employee->hire_date = $faker->date($format = 'Y-m-d');
$employee->password = $faker->password;
$employee->save();
}
}
示例15: run
public function run()
{
$employee = new Employee();
$employee->name = 'Ganesh';
$employee->email = 'ganesh@oodoo.co.in';
$employee->password = '00d00@ganesh';
$employee->password_confirmation = '00d00@ganesh';
$employee->mobile = '9999999999';
$employee->active = 1;
$employee->save();
$employee::$rules = [];
$employee->generateEmployeeId();
}