Пример #1
0
 public function configure()
 {
     $this->userId = $this->getOption('userId');
     $empNameStyle = array("class" => "formInputText inputFormatHint", "maxlength" => 200, "value" => __("Type for hints") . "...");
     if (!empty($this->userId)) {
         $this->edited = true;
         $empNameStyle = array("class" => "formInputText", "maxlength" => 200);
     }
     $userRoleList = $this->getAssignableUserRoleList();
     $statusList = $this->getStatusList();
     $this->setWidgets(array('userId' => new sfWidgetFormInputHidden(), 'userType' => new sfWidgetFormSelect(array('choices' => $userRoleList), array("class" => "formSelect", "maxlength" => 3)), 'employeeName' => new ohrmWidgetEmployeeNameAutoFill(array(), $empNameStyle), 'userName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 20)), 'status' => new sfWidgetFormSelect(array('choices' => $statusList), array("class" => "formSelect", "maxlength" => 3)), 'chkChangePassword' => new sfWidgetFormInputCheckbox(array(), array('class' => 'chkChangePassword')), 'password' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText password", "maxlength" => 20)), 'confirmPassword' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText password", "maxlength" => 20))));
     $this->setValidators(array('userId' => new sfValidatorNumber(array('required' => false)), 'userType' => new sfValidatorChoice(array('required' => true, 'choices' => array_keys($userRoleList))), 'employeeName' => new ohrmValidatorEmployeeNameAutoFill(), 'userName' => new sfValidatorString(array('required' => true, 'max_length' => 20)), 'password' => new sfValidatorString(array('required' => false, 'max_length' => 20)), 'confirmPassword' => new sfValidatorString(array('required' => false, 'max_length' => 20)), 'status' => new sfValidatorString(array('required' => true, 'max_length' => 1)), 'chkChangePassword' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->setNameFormat('systemUser[%s]');
     if ($this->userId != null) {
         $this->setDefaultValues($this->userId);
     } else {
         $this->setDefault('userType', 2);
     }
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
     //merge secondary password
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'saveSystemUser', 'SystemUserForm');
     sfWidgetFormSchemaFormatterBreakTags::setNoOfColumns(1);
     $this->getWidgetSchema()->setFormFormatterName('BreakTags');
 }
Пример #2
0
 public function configure()
 {
     $this->setWidgets(array('userId' => new sfWidgetFormInputHidden(), 'currentPassword' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText", "maxlength" => 20)), 'newPassword' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText", "maxlength" => 20)), 'confirmNewPassword' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText", "maxlength" => 20))));
     $this->setValidators(array('userId' => new sfValidatorNumber(array('required' => false)), 'currentPassword' => new sfValidatorString(array('required' => true, 'max_length' => 20)), 'newPassword' => new sfValidatorString(array('required' => true, 'max_length' => 20)), 'confirmNewPassword' => new sfValidatorString(array('required' => true, 'max_length' => 20))));
     $this->widgetSchema->setNameFormat('changeUserPassword[%s]');
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
     //merge secondary password
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->mergeForms($this, 'changeUserPassword', 'ChangeUserPasswordForm');
     sfWidgetFormSchemaFormatterBreakTags::setNoOfColumns(1);
     $this->getWidgetSchema()->setFormFormatterName('BreakTags');
 }
Пример #3
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');
 }
Пример #4
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());
     sfWidgetFormSchemaFormatterBreakTags::setNoOfColumns(3);
     $this->getWidgetSchema()->setFormFormatterName('BreakTags');
 }
Пример #5
0
 public function configure()
 {
     $widgets = array();
     $labels = array();
     $validators = array();
     $defaults = array();
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N', 'OrangeDate'));
     $inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
     // From and To Date
     $widgets['calFromDate'] = new ohrmWidgetDatePickerNew(array(), array('id' => 'calFromDate'));
     $labels['calFromDate'] = __('From');
     $widgets['calToDate'] = new ohrmWidgetDatePickerNew(array(), array('id' => 'calToDate'));
     $labels['calToDate'] = __('To');
     // Set default from/to to current leave period.
     $leavePeriod = $this->getLeavePeriodService()->getCurrentLeavePeriod();
     $defaults['calFromDate'] = set_datepicker_date_format($leavePeriod->getStartDate());
     $endDate = new DateTime($leavePeriod->getEndDate());
     $endDate->add(new DateInterval("P1Y"));
     $toDate = $endDate->format("Y-m-d");
     $defaults['calToDate'] = set_datepicker_date_format($toDate);
     $validators['calFromDate'] = new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => false), array('invalid' => 'Date format should be' . $inputDatePattern));
     $validators['calToDate'] = new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => false), array('invalid' => 'Date format should be' . $inputDatePattern));
     // Leave Statuses
     $leaveStatusChoices = Leave::getStatusTextList();
     if ($this->mode == self::MODE_MY_LEAVE_LIST) {
         $defaultStatuses = array_keys($leaveStatusChoices);
     } else {
         $defaultStatuses = array(Leave::LEAVE_STATUS_LEAVE_PENDING_APPROVAL);
     }
     $widgets['chkSearchFilter'] = new ohrmWidgetCheckboxGroup(array('choices' => $leaveStatusChoices, 'show_all_option' => true, 'default' => $defaultStatuses));
     $labels['chkSearchFilter'] = 'Show Leave with Status';
     $defaults['chkSearchFilter'] = $defaultStatuses;
     $validators['chkSearchFilter'] = new sfValidatorChoice(array('choices' => array_keys($leaveStatusChoices), 'required' => false, 'multiple' => true));
     if ($this->mode != self::MODE_MY_LEAVE_LIST) {
         $widgets['txtEmployee'] = new ohrmWidgetEmployeeNameAutoFill(array('employeeList' => $this->getEmployeeList()));
         $labels['txtEmployee'] = __('Employee');
         $validators['txtEmployee'] = new ohrmValidatorEmployeeNameAutoFill();
         $widgets['cmbSubunit'] = new ohrmWidgetSubUnitDropDown();
         $labels['cmbSubunit'] = __('Sub Unit');
         $subUnitChoices = $widgets['cmbSubunit']->getValidValues();
         $validators['cmbSubunit'] = new sfValidatorChoice(array('choices' => $subUnitChoices, 'required' => false));
         // TODO check cmbWithTerminated if searching for terminated employee
         $widgets['cmbWithTerminated'] = new sfWidgetFormInputCheckbox(array('value_attribute_value' => 'on'));
         $labels['cmbWithTerminated'] = __('Include Past Employees');
         $validators['cmbWithTerminated'] = new sfValidatorBoolean(array('true_values' => array('on'), 'required' => false));
     }
     $this->setWidgets($widgets);
     $this->getWidgetSchema()->setLabels($labels);
     $this->setvalidators($validators);
     $this->setDefaults($defaults);
     $this->getWidgetSchema()->setNameFormat('leaveList[%s]');
     sfWidgetFormSchemaFormatterBreakTags::setNoOfColumns(1);
     $this->getWidgetSchema()->setFormFormatterName('BreakTags');
     // Validate that if both from and to date are given, form date is before to date.
     $this->getValidatorSchema()->setPostValidator(new ohrmValidatorSchemaCompare('calFromDate', sfValidatorSchemaCompare::LESS_THAN_EQUAL, 'calToDate', array('throw_global_error' => true, 'skip_if_one_empty' => true), array('invalid' => 'The from date ("%left_field%") must be before the to date ("%right_field%")')));
 }
Пример #6
0
 public function configure()
 {
     $this->loggedUserId = $this->getOption('loggedUserId');
     $this->userType = $this->getUserType();
     $this->searchParam['employeeId'] = $this->getOption('employeeId');
     $this->searchParam['cmbWithTerminated'] = $this->getOption('cmbWithTerminated');
     $this->empId = $this->getOption('empId');
     $this->setupEmployeeList();
     $this->setCurrentLeavePeriodId();
     // This should be called before _setLeavePeriodWidgets()
     if ($this->hasAdministrativeFilters()) {
         $employeeId = 0;
         $empName = "";
         if (!is_null($this->searchParam['employeeId'])) {
             $employeeId = $this->searchParam['employeeId'];
             $employeeService = $this->getEmployeeService();
             $employee = $employeeService->getEmployee($this->searchParam['employeeId']);
             $empName = $employee->getFullName();
         }
         /* Setting default values */
         $this->setDefault('txtEmpName', array('empName' => $empName, 'empId' => $employeeId));
         $this->setDefault('cmbLeavePeriod', $this->currentLeavePeriodId);
         $this->setDefault('hdnSubjectedLeavePeriod', $this->_getLeavePeriod());
         if ($this->searchParam['cmbWithTerminated'] == 'on') {
             $this->setDefault('cmbWithTerminated', true);
         }
     }
     $this->setWidgets($this->getFormWidgets());
     $this->setValidators($this->getFormValidators());
     $this->getWidgetSchema()->setNameFormat('leaveSummary[%s]');
     $this->getWidgetSchema()->setLabels($this->getFormLabels());
     sfWidgetFormSchemaFormatterBreakTags::setNoOfColumns(2);
     $this->getWidgetSchema()->setFormFormatterName('BreakTags');
 }
 /**
  *
  * @param int $noOfColumns 
  */
 public static function setNoOfColumns($noOfColumns)
 {
     self::$noOfColumns = $noOfColumns;
 }