public function configure()
 {
     $labels = array();
     // Add employee filter checkbox and widgets
     $this->setWidget('bulk_assign', new sfWidgetFormInputCheckbox());
     //$this->setValidator('bulk_assign', new sfValidatorChoice(array('choices' => array(1), 'required' => false)));
     $this->setValidator('bulk_assign', new sfValidatorPass());
     $labels['bulk_assign'] = __('Add to Multiple Employees');
     $locationOptions = array('set_all_option_value' => true, 'all_option_value' => NULL, 'show_all_locations' => false);
     $locationWidget = new ohrmReportWidgetOperationalCountryLocationDropDown($locationOptions);
     $this->setWidget('location', $locationWidget);
     $labels['location'] = __('Location');
     //$locationChoices = $locationWidget->getValidValues();
     //$this->setValidator('location', new sfValidatorChoice(array('choices' => $locationChoices, 'required' => false)));
     $this->setValidator('location', new sfValidatorPass());
     $subUnitWidget = new ohrmWidgetSubUnitDropDown();
     $this->setWidget('subunit', $subUnitWidget);
     $labels['subunit'] = __('Sub Unit');
     $subUnitChoices = $subUnitWidget->getValidValues();
     $this->setValidator('subunit', new sfValidatorChoice(array('choices' => $subUnitChoices, 'required' => false)));
     $this->getWidgetSchema()->setLabels($labels);
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'viewLeaveEntitlements', 'LeaveEntitlementBulkAssignFilterForm');
     $this->widgetSchema->setNameFormat('entitlement_filter[%s]');
 }
 /**
  *
  * @return PluginQueryExtensionManager
  */
 public static function instance()
 {
     if (!self::$instance instanceof PluginFormMergeManager) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 3
0
 public function save()
 {
     $userId = sfContext::getInstance()->getUser()->getAttribute('user')->getUserId();
     $systemUserService = new SystemUserService();
     $posts = $this->getValues();
     $systemUserService->updatePassword($userId, $posts['newPassword']);
     //save secondary password
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->saveMergeForms($this, 'changeUserPassword', 'ChangeUserPasswordForm');
 }
 public function configure()
 {
     $widgets['emp_name'] = new ohrmWidgetEmployeeNameAutoFill(array('jsonList' => $this->getEmployeeListAsJson()), array('class' => 'formInputText'));
     $this->setWidgets($widgets);
     $this->setvalidators(array('emp_name' => new ohrmValidatorEmployeeNameAutoFill()));
     /* Setting job titles */
     $this->_setJobTitleWidget();
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'viewDirectory', 'EmployeeDirectorySearchForm');
     $this->getWidgetSchema()->setNameFormat('searchDirectory[%s]');
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
 }
Ejemplo n.º 5
0
 public function configure()
 {
     $this->setWidget('employee', new ohrmWidgetEmployeeNameAutoFill(array('loadingMethod' => 'ajax')));
     $this->setValidator('employee', new ohrmValidatorEmployeeNameAutoFill());
     $this->setLeaveTypeWidget();
     $inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
     $this->setWidget('date', new ohrmWidgetFormLeavePeriod(array()));
     $this->setValidator('date', new sfValidatorDateRange(array('from_date' => new ohrmDateValidator(array('required' => true)), 'to_date' => new ohrmDateValidator(array('required' => true)))));
     //$this->setWidget('date_from', new ohrmWidgetDatePicker(array(), array('id' => 'date_from')));
     //$this->setValidator('date_from', new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => true)));
     //$this->setWidget('date_to', new ohrmWidgetDatePicker(array(), array('id' => 'date_to')));
     //$this->setValidator('date_to', new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => true)));
     $this->setDefaultDates();
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'viewLeaveEntitlements', 'LeaveEntitlementsForm');
     $this->widgetSchema->setNameFormat('entitlements[%s]');
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
 }
Ejemplo n.º 6
0
 public function configure()
 {
     $this->setWidgets(array('employee_name' => new ohrmWidgetEmployeeNameAutoFill(array('loadingMethod' => 'ajax')), 'id' => new sfWidgetFormInputText()));
     $this->_setEmployeeStatusWidget();
     $this->_setTerminatedEmployeeWidget();
     $this->setWidget('supervisor_name', new sfWidgetFormInputText());
     $this->setValidator('supervisor_name', new sfValidatorString(array('required' => false)));
     /* Setting job titles */
     $this->_setJobTitleWidget();
     /* Setting sub divisions */
     $this->_setSubunitWidget();
     $this->setValidator('employee_name', new ohrmValidatorEmployeeNameAutoFill());
     $this->setValidator('id', new sfValidatorString(array('required' => false)));
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'viewEmployeeList', 'EmployeeSearchForm');
     $this->widgetSchema->setNameFormat('empsearch[%s]');
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
     sfWidgetFormSchemaFormatterBreakTags::setNoOfColumns(4);
     $this->getWidgetSchema()->setFormFormatterName('BreakTags');
 }
Ejemplo n.º 7
0
 public function configure()
 {
     $userRoleList = $this->getAssignableUserRoleList();
     $statusList = $this->getStatusList();
     $widgets = array();
     $widgets['userName'] = new sfWidgetFormInputText();
     $widgets['userType'] = new sfWidgetFormSelect(array('choices' => $userRoleList));
     $widgets['employeeName'] = new ohrmWidgetEmployeeNameAutoFill();
     $widgets['status'] = new sfWidgetFormSelect(array('choices' => $statusList));
     $this->setWidgets($widgets);
     $validators = array();
     $validators['userName'] = new sfValidatorString(array('required' => false));
     $validators['userType'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($userRoleList)));
     $validators['employeeName'] = new ohrmValidatorEmployeeNameAutoFill();
     $validators['status'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($statusList)));
     $this->setValidators($validators);
     //merge location filter
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'viewSystemUsers', 'SearchSystemUserForm');
     $this->getWidgetSchema()->setNameFormat('searchSystemUser[%s]');
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
 }
Ejemplo n.º 8
0
 public function save()
 {
     $posts = $this->getValues();
     $file = $posts['photofile'];
     //        print_r($file);die;
     //saving employee
     $employee = new Employee();
     $employee->firstName = $posts['firstName'];
     $employee->lastName = $posts['lastName'];
     $employee->middleName = $posts['middleName'];
     $employee->employeeId = $posts['employeeId'];
     $employeeService = $this->getEmployeeService();
     $employeeService->saveEmployee($employee);
     $empNumber = $employee->empNumber;
     //saving emp picture
     if ($file instanceof sfValidatedFile && $file->getOriginalName() != "") {
         $empPicture = new EmpPicture();
         $empPicture->emp_number = $empNumber;
         $tempName = $file->getTempName();
         $empPicture->picture = file_get_contents($tempName);
         $empPicture->filename = $file->getOriginalName();
         $empPicture->file_type = $file->getType();
         $empPicture->size = $file->getSize();
         list($width, $height) = getimagesize($file->getTempName());
         $sizeArray = $this->pictureSizeAdjust($height, $width);
         $empPicture->width = $sizeArray['width'];
         $empPicture->height = $sizeArray['height'];
         $empPicture->save();
     }
     if ($this->createUserAccount) {
         $this->saveUser($empNumber);
     }
     //merge location dropdown
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->saveMergeForms($this, 'addEmployee', 'AddEmployeeForm');
     return $empNumber;
 }
Ejemplo n.º 9
0
 public function configure()
 {
     $reportTypes = array(0 => '-- ' . __('Select') . ' --', self::REPORT_TYPE_LEAVE_TYPE => 'Leave Type', self::REPORT_TYPE_EMPLOYEE => 'Employee');
     // Valid report types, skip 0 option
     $validReportTypes = array_slice(array_keys($reportTypes), 1);
     $this->setWidget('report_type', new sfWidgetFormChoice(array('choices' => $reportTypes)));
     $this->setValidator('report_type', new sfValidatorChoice(array('choices' => $validReportTypes), array('invalid' => CommonMessages::REQUIRED_FIELD, 'required' => true)));
     $this->setWidget('employee', new ohrmWidgetEmployeeNameAutoFill(array('loadingMethod' => 'ajax')));
     $this->setValidator('employee', new ohrmValidatorEmployeeNameAutoFill());
     $this->_setLeaveTypeWidget();
     $this->setWidget('date', new ohrmWidgetFormLeavePeriod(array()));
     $this->setWidget('job_title', new sfWidgetFormChoice(array('choices' => $this->getJobTitleChoices())));
     $this->setWidget('location', new ohrmReportWidgetOperationalCountryLocationDropDown());
     $this->setWidget('sub_unit', new ohrmWidgetSubDivisionList());
     $this->setWidget('include_terminated', new sfWidgetFormInputCheckbox(array('value_attribute_value' => 'on')));
     $this->setValidator('location', new sfValidatorString(array('required' => false)));
     $this->setValidator('job_title', new sfValidatorChoice(array('choices' => array_keys($this->getJobTitleChoices()))));
     $this->setValidator('sub_unit', new sfValidatorString(array('required' => false)));
     $this->setValidator('include_terminated', new sfValidatorString(array('required' => false)));
     $this->setValidator('date', new sfValidatorDateRange(array('from_date' => new ohrmDateValidator(array('required' => true)), 'to_date' => new ohrmDateValidator(array('required' => true)))));
     $this->setDefaultDates();
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'viewLeaveBalanceReport', 'LeaveBalanceReportForm');
     $this->widgetSchema->setNameFormat('leave_balance[%s]');
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
 }
Ejemplo n.º 10
0
 public function save()
 {
     $userId = $this->getValue('userId');
     $password = $this->getValue('password');
     $changePasswordCheck = $this->getValue('chkChangePassword');
     $changePasword = false;
     if (empty($userId)) {
         $user = new SystemUser();
         $user->setDateEntered(date('Y-m-d H:i:s'));
         $user->setCreatedBy($this->getOption('sessionUser')->getUserId());
         $user->setUserPassword($this->getValue('password'));
         $changePasword = true;
     } else {
         $this->edited = true;
         $user = $this->getSystemUserService()->getSystemUser($userId);
         $user->setDateModified(date('Y-m-d H:i:s'));
         $user->setModifiedUserId($this->getOption('sessionUser')->getUserId());
         if (!empty($changePasswordCheck)) {
             $user->setUserPassword($this->getValue('password'));
             $changePasword = true;
         }
     }
     $user->setUserRoleId($this->getValue('userType'));
     $empData = $this->getValue('employeeName');
     $user->setEmpNumber($empData['empId']);
     $user->setUserName($this->getValue('userName'));
     $user->setStatus($this->getValue('status'));
     $savedUser = $this->getSystemUserService()->saveSystemUser($user, $changePasword);
     if ($savedUser instanceof SystemUser) {
         $this->setDefault('userId', $savedUser->getId());
     }
     //save secondary password
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->saveMergeForms($this, 'saveSystemUser', 'SystemUserForm');
     return $savedUser;
 }
Ejemplo n.º 11
0
 public function configure()
 {
     $empNumber = $this->getOption('empNumber');
     $employee = $this->getOption('employee');
     $this->fullName = $employee->getFullName();
     $jobTitleId = $employee->job_title_code;
     $empTerminatedId = $employee->termination_id;
     $jobTitles = $this->_getJobTitles($jobTitleId);
     $employeeStatuses = $this->_getEmpStatuses();
     $eeoCategories = $this->_getEEOCategories();
     $subDivisions = $this->_getSubDivisions();
     $locations = $this->_getLocations($employee);
     $empService = new EmployeeService();
     $attachmentList = $empService->getEmployeeAttachments($empNumber, 'contract');
     if (count($attachmentList) > 0) {
         $this->attachment = $attachmentList[0];
     }
     $contractUpdateChoices = array(self::CONTRACT_KEEP => __('Keep Current'), self::CONTRACT_DELETE => __('Delete Current'), self::CONTRACT_UPLOAD => __('Replace Current'));
     // Note: Widget names were kept from old non-symfony version
     $this->setWidgets(array('emp_number' => new sfWidgetFormInputHidden(), 'job_title' => new sfWidgetFormSelect(array('choices' => $jobTitles)), 'emp_status' => new sfWidgetFormSelect(array('choices' => $employeeStatuses)), 'terminated_date' => new ohrmWidgetDatePicker(array(), array('id' => 'job_terminated_date')), 'termination_reason' => new sfWidgetFormTextarea(), 'eeo_category' => new sfWidgetFormSelect(array('choices' => $eeoCategories)), 'sub_unit' => new sfWidgetFormSelect(array('choices' => $subDivisions)), 'location' => new sfWidgetFormSelect(array('choices' => $locations)), 'joined_date' => new ohrmWidgetDatePicker(array(), array('id' => 'job_joined_date')), 'contract_start_date' => new ohrmWidgetDatePicker(array(), array('id' => 'job_contract_start_date')), 'contract_end_date' => new ohrmWidgetDatePicker(array(), array('id' => 'job_contract_end_date')), 'contract_file' => new sfWidgetFormInputFile(), 'contract_update' => new sfWidgetFormChoice(array('expanded' => true, 'choices' => $contractUpdateChoices))));
     // Default values
     $this->setDefault('emp_number', $empNumber);
     $this->setDefault('emp_status', $employee->emp_status);
     if (!empty($jobTitleId)) {
         $this->setDefault('job_title', $jobTitleId);
         $jobTitle = $this->getJobTitleService()->getJobTitleById($jobTitleId);
         //print_r($jobTitle);exit;
         if (!empty($jobTitle)) {
             $this->jobSpecAttachment = $jobTitle->getJobSpecificationAttachment();
         }
     }
     if (!empty($empTerminatedId)) {
         $this->empTermination = $employee->getEmployeeTerminationRecord();
     }
     $this->setDefault('eeo_category', $employee->eeo_cat_code);
     $inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
     sfContext::getInstance()->getConfiguration()->loadHelpers('OrangeDate');
     $this->setDefault('sub_unit', $employee->work_station);
     // Assign first location
     $locationList = $employee->locations;
     if (count($locationList) > 0) {
         $this->setDefault('location', $locationList[0]->id);
     }
     $contracts = $employee->contracts;
     if (count($contracts) > 0) {
         $contract = $contracts[0];
         $this->setDefault('contract_start_date', set_datepicker_date_format($contract->start_date));
         $this->setDefault('contract_end_date', set_datepicker_date_format($contract->end_date));
     }
     $this->setDefault('joined_date', set_datepicker_date_format($employee->joined_date));
     $this->setDefault('contract_update', self::CONTRACT_KEEP);
     $this->setValidators(array('emp_number' => new sfValidatorString(array('required' => true)), 'job_title' => new sfValidatorChoice(array('required' => false, 'choices' => array_keys($jobTitles))), 'emp_status' => new sfValidatorString(array('required' => false)), 'terminated_date' => new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => false), array('invalid' => 'Date format should be ' . $inputDatePattern)), 'termination_reason' => new sfValidatorString(array('required' => false)), 'eeo_category' => new sfValidatorChoice(array('required' => false, 'choices' => array_keys($eeoCategories))), 'sub_unit' => new sfValidatorChoice(array('required' => false, 'choices' => array_keys($subDivisions))), 'location' => new sfValidatorChoice(array('required' => false, 'choices' => array_keys($locations))), 'joined_date' => new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => false), array('invalid' => 'Date format should be ' . $inputDatePattern)), 'contract_start_date' => new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => false), array('invalid' => 'Date format should be ' . $inputDatePattern)), 'contract_end_date' => new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => false), array('invalid' => 'Date format should be ' . $inputDatePattern)), 'contract_file' => new sfValidatorFile(array('required' => false, 'max_size' => 1000000), array('max_size' => __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE))), 'contract_update' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->setNameFormat('job[%s]');
     // set up post validator method
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'postValidate'))));
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'viewJobDetails', 'EmployeeJobDetailsForm');
 }