public function setReportCriteriaInfoInRequest($formValues)
 {
     $employeeService = new EmployeeService();
     $jobService = new JobService();
     $empStatusService = new EmploymentStatusService();
     $companyStructureService = new CompanyStructureService();
     if (isset($formValues["employee"])) {
         $empNumber = $formValues["employee"];
         $employee = $employeeService->getEmployee($empNumber);
         $empName = $employee->getFirstAndLastNames();
         $this->getRequest()->setParameter('empName', $empName);
     }
     if (isset($formValues["employment_status"]) && $formValues["employment_status"] != 0) {
         $estatCode = $formValues["employment_status"];
         $estat = $empStatusService->getEmploymentStatusById($estatCode);
         $estatName = $estat->getName();
         $this->getRequest()->setParameter("empStatusName", $estatName);
     }
     if (isset($formValues["job_title"]) && $formValues["job_title"] != 0) {
         $jobTitCode = $formValues["job_title"];
         $jobTitle = $jobService->readJobTitle($jobTitCode);
         $jobTitName = $jobTitle->getJobTitName();
         $this->getRequest()->setParameter("jobTitName", $jobTitName);
     }
     if (isset($formValues["sub_unit"]) && $formValues["job_title"] != 0) {
         $value = $formValues["sub_unit"];
         $id = $value;
         $subunit = $companyStructureService->getSubunitById($id);
         $subUnitName = $subunit->getName();
         $this->getRequest()->setParameter("subUnit", $subUnitName);
     }
     $this->getRequest()->setParameter('attendanceDateRangeFrom', $formValues["attendance_date_range"]["from"]);
     $this->getRequest()->setParameter('attendanceDateRangeTo', $formValues["attendance_date_range"]["to"]);
 }
 public function getEmployeeName($employeeId)
 {
     $employeeService = new EmployeeService();
     $employee = $employeeService->getEmployee($employeeId);
     if ($employee->getMiddleName() != null) {
         return $employee->getFirstName() . " " . $employee->getMiddleName() . " " . $employee->getLastName();
     } else {
         return $employee->getFirstName() . " " . $employee->getLastName();
     }
 }
 public function execute($request)
 {
     $jsonArray = array();
     $employeeService = new EmployeeService();
     $employeeService->setEmployeeDao(new EmployeeDao());
     $supervisorList = $employeeService->getSupervisorIdListBySubordinateId($request->getGetParameter('id'));
     foreach ($supervisorList as $supervisorId) {
         $employee = $employeeService->getEmployee($supervisorId);
         $name = $employee->getFirstName() . " " . $employee->getMiddleName();
         $name = trim(trim($name) . " " . $employee->getLastName());
         $jsonArray[] = array('name' => $name, 'id' => $employee->getEmpNumber());
     }
     $jsonString = json_encode($jsonArray);
     echo $jsonString;
     exit;
 }
 public function execute($request)
 {
     $userObj = $this->getContext()->getUser()->getAttribute('user');
     $employeeIdOfTheUser = $userObj->getEmployeeNumber();
     $this->backAction = $request->getParameter('actionName');
     $this->timesheetId = $request->getParameter('timesheetId');
     $this->employeeId = $request->getParameter('employeeId');
     if ($this->employeeId == $employeeIdOfTheUser) {
         $this->employeeName == null;
     } else {
         $employeeService = new EmployeeService();
         $employee = $employeeService->getEmployee($this->employeeId);
         $this->employeeName = $employee->getFirstName() . " " . $employee->getLastName();
     }
     $timesheet = $this->getTimesheetService()->getTimesheetById($this->timesheetId);
     $this->date = $timesheet->getStartDate();
     $this->endDate = $timesheet->getEndDate();
     $this->startDate = $this->date;
     $this->noOfDays = $this->timesheetService->dateDiff($this->startDate, $this->endDate);
     $values = array('date' => $this->startDate, 'employeeId' => $this->employeeId, 'timesheetId' => $this->timesheetId, 'noOfDays' => $this->noOfDays);
     $this->timesheetForm = new TimesheetForm(array(), $values);
     $this->currentWeekDates = $this->timesheetForm->getDatesOfTheTimesheetPeriod($this->startDate, $this->endDate);
     $this->timesheetItemValuesArray = $this->timesheetForm->getTimesheet($this->startDate, $this->employeeId, $this->timesheetId);
     $this->messageData = array($request->getParameter('message[0]'), $request->getParameter('message[1]'));
     if ($this->timesheetItemValuesArray == null) {
         $this->totalRows = 0;
         $this->timesheetForm = new TimesheetForm(array(), $values);
     } else {
         $this->totalRows = sizeOf($this->timesheetItemValuesArray);
         $this->timesheetForm = new TimesheetForm(array(), $values);
     }
     if ($request->isMethod('post')) {
         if ($request->getParameter('btnSave')) {
             $backAction = $this->backAction;
             $this->getTimesheetService()->saveTimesheetItems($request->getParameter('initialRows'), $this->employeeId, $this->timesheetId, $this->currentWeekDates, $this->totalRows);
             $this->messageData = array('SUCCESS', __(TopLevelMessages::SAVE_SUCCESS));
             $startingDate = $this->timesheetService->getTimesheetById($this->timesheetId)->getStartDate();
             $this->redirect('time/' . $backAction . '?' . http_build_query(array('message' => $this->messageData, 'timesheetStartDate' => $startingDate, 'employeeId' => $this->employeeId)));
         }
         if ($request->getParameter('buttonRemoveRows')) {
             $this->messageData = array('SUCCESS', __('Successfully Removed'));
         }
     }
 }
 public function setReportCriteriaInfoInRequest($formValues)
 {
     $employeeService = new EmployeeService();
     $empStatusService = new EmploymentStatusService();
     $jobTitleService = new JobTitleService();
     $companyStructureService = new CompanyStructureService();
     if (isset($formValues["employeeId"]) || $formValues["employeeId"] == '-1') {
         if ($formValues["employeeId"] != '-1') {
             $empNumber = $formValues["employeeId"];
             $employee = $employeeService->getEmployee($empNumber);
             $empName = $employee->getFirstAndLastNames();
         } else {
             $empName = __("All");
         }
         $this->getRequest()->setParameter('empName', $empName);
     }
     if (isset($formValues["employeeStatus"]) && $formValues["employeeStatus"] != 0) {
         $estatCode = $formValues["employeeStatus"];
         $estat = $empStatusService->getEmploymentStatusById($estatCode);
         $estatName = $estat->getName();
         $this->getRequest()->setParameter("employeeStatus", $estatName);
     }
     if (isset($formValues["jobTitle"]) && $formValues["jobTitle"] != 0) {
         $jobTitCode = $formValues["jobTitle"];
         $jobTitle = $jobTitleService->getJobTitleById($jobTitCode);
         $jobTitName = $jobTitle->getJobTitleName();
         $this->getRequest()->setParameter("jobTitle", $jobTitName);
     }
     if (isset($formValues["subUnit"]) && $formValues["subUnit"] != 0) {
         $value = $formValues["subUnit"];
         $id = $value;
         $subunit = $companyStructureService->getSubunitById($id);
         $subUnitName = $subunit->getName();
         $this->getRequest()->setParameter("subUnit", $subUnitName);
     }
     $this->getRequest()->setParameter('attendanceDateRangeFrom', $formValues["fromDate"]);
     $this->getRequest()->setParameter('attendanceDateRangeTo', $formValues["toDate"]);
 }
 public function getEmployeeName($employeeId)
 {
     $employeeService = new EmployeeService();
     $employee = $employeeService->getEmployee($employeeId);
     return $employee->getFirstName() . " " . $employee->getLastName();
 }
    public function render($name, $value = null, $attributes = array(), $errors = array())
    {
        $empName = null;
        $empId = null;
        if ($value != null) {
            $service = new EmployeeService();
            if (is_array($value)) {
                $empId = isset($value['empId']) ? $value['empId'] : '';
                $empName = isset($value['empName']) ? $value['empName'] : '';
            } else {
                $empId = $value;
                $employee = $service->getEmployee($value);
                if (!empty($employee)) {
                    $empName = $employee->getFirstName() . " " . $employee->getMiddleName();
                    $empName = trim(trim($empName) . " " . $employee->getLastName());
                }
            }
        }
        $values = array_merge(array('empName' => '', 'empId' => ''), is_null($value) ? array() : array('empName' => $empName, 'empId' => $empId));
        $html = strtr($this->translate($this->getOption('template')), array('%empId%' => $this->getOption($this->attributes['id'] . '_' . 'empId')->render($name . '[empId]', $values['empId'], array('id' => $this->attributes['id'] . '_' . 'empId')), '%empName%' => $this->getOption($this->attributes['id'] . '_' . 'empName')->render($name . '[empName]', $values['empName'], array('id' => $this->attributes['id'] . '_' . 'empName'))));
        $noEmployeeMessage = __('No Employees Available');
        $requiredMessage = __(ValidationMessages::REQUIRED);
        $invalidMessage = __(ValidationMessages::INVALID);
        $typeHint = __('Type for hints') . ' ...';
        $javaScript = $javaScript = sprintf(<<<EOF
<script type="text/javascript">

    var employees = %s;
    var employeesArray = eval(employees);
    var errorMsge;
    var employeeFlag;
    var empId;
    var valid = false; 

\$(document).ready(function() {

            if (\$("#%s" + "_empName").val() == '') {
                \$("#%s" + "_empName").val('%s')
                .addClass("inputFormatHint");
            }

            \$("#%s" + "_empName").one('focus', function() {

                if (\$(this).hasClass("inputFormatHint")) {
                    \$(this).val("");
                    \$(this).removeClass("inputFormatHint");
                }
            })
            .data('typeHint', "{$typeHint}");
            

    \$("#%s" + "_empName").autocomplete(employees, {

            formatItem: function(item) {
                return \$('<div/>').text(item.name).html();
            },
            formatResult: function(item) {
                return item.name
            }
            ,matchContains:true
        }).result(function(event, item) {
            \$("#%s" + "_empId").val(item.id);
        }
    );

    \$('#btnSav').click(function() {
                \$('#defineReportForm input.inputFormatHint').val('');
                \$('#defineReportForm').submit();
        });

        \$('#defineReportFor').submit(function(){
            \$('#validationMsg').removeAttr('class');
            \$('#validationMsg').html("");
            var employeeFlag = validateInput();
            if(!employeeFlag) {
                \$('#validationMsg').attr('class', "messageBalloon_failure");
                \$('#validationMsg').html(errorMsge);
                return false;
            }
        });

 });

function validateInput(){

        var errorStyle = "background-color:#FFDFDF;";
        var empDateCount = employeesArray.length;
        var temp = false;
        var i;

        if(empDateCount==0){

            errorMsge = "{$noEmployeeMessage}";
            return false;
        }
        for (i=0; i < empDateCount; i++) {
            empName = \$.trim(\$('#%s' + '_empName').val()).toLowerCase();
            arrayName = employeesArray[i].name.toLowerCase();

            if (empName == arrayName) {
                \$('#%s' + '_empId').val(employeesArray[i].id);
                empId = employeesArray[i].id
                temp = true
                break;
            }
        }
        if(temp){
            valid = true;
            return true;
        }else if(empName == "" || empName == \$.trim("{$typeHint}").toLowerCase()){
            errorMsge = "{$requiredMessage}";
            return false;
        }else{
            if(valid != true){
            errorMsge = "{$invalidMessage}";
            return false;
            }else{
            return true;
            }
        }
    }
 </script>
EOF
, $this->getEmployeeListAsJson(sfContext::getInstance()->getUser()->getAttribute("user")->getEmployeeList()), $this->attributes['id'], $this->attributes['id'], $typeHint, $this->attributes['id'], $this->attributes['id'], $this->attributes['id'], $this->attributes['id'], $this->attributes['id']);
        return $html . $javaScript;
    }
 private function getEmployeeName($employeeId)
 {
     $employeeService = new EmployeeService();
     $employee = $employeeService->getEmployee($employeeId);
     $name = $employee->getFirstName() . " " . $employee->getLastName();
     if ($employee->getTerminationId()) {
         $name = $name . ' (' . __('Past Employee') . ')';
     }
     return $name;
 }
示例#9
0
 protected function _isCorrectEmployee($id, $name)
 {
     $flag = true;
     if (!empty($name) && $id == 0) {
         $flag = false;
     }
     if (!empty($name) && !empty($id)) {
         $employeeService = new EmployeeService();
         $employee = $employeeService->getEmployee($id);
         $nameArray = explode(' ', $name);
         if (count($nameArray) == 2 && strtolower($employee->getFirstName() . ' ' . $employee->getLastName()) != strtolower($name)) {
             $flag = false;
         } elseif (count($nameArray) == 3 && strtolower($employee->getFullName()) != strtolower($name)) {
             $flag = false;
         }
     }
     if ($flag) {
         return true;
     } else {
         return false;
     }
 }
 public function getDescriptionForScheduleInterview($object)
 {
     $interviewId = $object->getInterviewId();
     $jobInterview = $this->getInterviewService()->getInterviewById($interviewId);
     $interviewers = $object->getInterviewers();
     $interviewers = explode("_", $interviewers);
     if ($jobInterview->getInterviewTime() == '00:00:00') {
         $time = "";
     } else {
         $time = __("at") . " " . date('H:i', strtotime($jobInterview->getInterviewTime())) . " ";
     }
     $interviewersNameList = array();
     $employeeService = new EmployeeService();
     for ($i = 0; $i < sizeof($interviewers) - 1; $i++) {
         $interviewersNameList[] = $employeeService->getEmployee($interviewers[$i])->getFullName();
     }
     return __($object->getPerformerName()) . " " . __("scheduled") . " " . $jobInterview->getInterviewName() . " " . __("on") . " " . set_datepicker_date_format($jobInterview->getInterviewDate()) . " " . $time . __("with") . " " . implode(", ", $interviewersNameList) . " " . __("for") . " " . $object->getCandidateVacancyName();
 }
示例#11
0
}
$userRoleManager = sfContext::getInstance()->getUserRoleManager();
$entities = array('Employee' => $empNumber);
// Old links require empNumber padded with 0's
$idLength = OrangeConfig::getInstance()->getSysConf()->getEmployeeIdLength();
$paddedEmpNumber = str_pad($empNumber, $idLength, "0", STR_PAD_LEFT);
$employeeService = new EmployeeService();
$empPicture = $employeeService->getEmployeePicture($empNumber);
$width = '150';
$height = '180';
$photographPermissions = $userRoleManager->getDataGroupPermissions(array('photograph'), array(), array(), $self, $entities);
if (!empty($empPicture) && $photographPermissions->canRead()) {
    $width = $empPicture->width;
    $height = $empPicture->height;
}
$employee = $employeeService->getEmployee($empNumber);
$allowedActions = $userRoleManager->getAllowedActions(WorkflowStateMachine::FLOW_EMPLOYEE, $employee->getState());
$allowActivate = in_array(WorkflowStateMachine::EMPLOYEE_ACTION_REACTIVE, $allowedActions);
$allowTerminate = in_array(WorkflowStateMachine::EMPLOYEE_ACTION_TERMINATE, $allowedActions);
?>

<form id="frmEmp" action=""></form>
<div id="pimleftmenu">
    <?php 
include_partial('photo', array('empNumber' => $empNumber, 'width' => $width, 'height' => $height, 'editMode' => isset($editPhotoMode) ? $editPhotoMode : false, 'fullName' => htmlspecialchars($form->fullName), 'photographPermissions' => $photographPermissions));
?>
    <ul class="pimleftmenu">
        <li class="l1 parent">
            <a href="#" class="expanded" onclick="showHideSubMenu(this);">
                <span class="parent personal"><?php 
echo __("Personal");
示例#12
0
 /**
  * Get Employee object with values filled using form values
  */
 public function getEmployee()
 {
     $employeeService = new EmployeeService();
     $employee = $employeeService->getEmployee($this->getValue('emp_number'));
     $joinedDate = $employee->joined_date;
     $jobTitle = $this->getValue('job_title');
     $employee->job_title_code = $jobTitle;
     $empStatus = $this->getValue('emp_status');
     if ($empStatus == '') {
         $employee->emp_status = null;
     } else {
         $employee->emp_status = $empStatus;
     }
     $eeoCat = $this->getValue('eeo_category');
     if ($eeoCat == '') {
         $employee->eeo_cat_code = null;
     } else {
         $employee->eeo_cat_code = $eeoCat;
     }
     $employee->work_station = $this->getValue('sub_unit');
     $employee->joined_date = $this->getValue('joined_date');
     if ($joinedDate != '' && $joinedDate != $this->getValue('joined_date')) {
         $this->isJoinDateChanged = true;
     }
     // Location
     $location = $this->getValue('location');
     $foundLocation = false;
     //
     // Unlink all locations except current.
     //
     foreach ($employee->getLocations() as $empLocation) {
         if ($location == $empLocation->id) {
             $foundLocation = true;
         } else {
             $employee->unlink('locations', $empLocation->id);
         }
     }
     //
     // Link location if not already linked
     //
     if (!$foundLocation) {
         $employee->link('locations', $location);
     }
     // contract details
     $empContract = new EmpContract();
     $empContract->emp_number = $employee->empNumber;
     $empContract->start_date = $this->getValue('contract_start_date');
     $empContract->end_date = $this->getValue('contract_end_date');
     $empContract->contract_id = 1;
     $employee->contracts[0] = $empContract;
     return $employee;
 }