Created
November 20, 2014 11:03
-
-
Save anonymous/4ff09d15ad570edef326 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ContractForm_Step3 extends MultiFormStep { | |
protected static $fields; | |
public static $next_steps = 'ContractForm_Step4'; | |
function Title() { | |
return _t("ContractForm.StepNum", "Step", array("num" => 3)); | |
} | |
function Subtitle() { | |
return "Other things"; | |
} | |
function getFields() { | |
if(!self::$fields) { | |
$yes_no = array('Yes' => _t('Common.Yes'), 'No' => _t('Common.No')); | |
$periods = array( | |
'Weeks' => _t('Common.Weeks'), | |
'Months' => _t('Common.Months'), | |
'Years' => _t('Common.Years') | |
); | |
$LoS = array( | |
'After successful completion of your probationary period' => 'after successful completion of the probationary period', | |
'After 1 week' => 'after 1 week', | |
'After 1 month' => _t('ContractForm.NI_LoS_1m'), | |
'After 3 months' => _t('ContractForm.NI_LoS_3m'), | |
'After 6 months' => _t('ContractForm.NI_LoS_6m'), | |
'After 1 year' => _t('ContractForm.NI_LoS_1y'), | |
'After 2 years' => _t('ContractForm.NI_LoS_2y'), | |
'After 3 years' => _t('ContractForm.NI_LoS_3y'), | |
'After 4 years' => _t('ContractForm.NI_LoS_4y'), | |
'After 5 years' => _t('ContractForm.NI_LoS_5y') | |
); | |
$RequiredNotice_period = array( | |
'Weeks' => 'Weeks', | |
'Months' => 'Months' | |
); | |
$fields = new FieldList( | |
HeaderField::create('Section_OptionalClauses', _t('ContractForm.OptionalClauses')), | |
OptionsetField::create('ContractualRightToConductDrugTests', null, $yes_no) | |
->setRightTitle('Yes is recommended'), | |
OptionsetField::create('AccessToIT', null, $yes_no), | |
OptionsetField::create('DataProtection', null, $yes_no) | |
->setRightTitle('Yes is recommended'), | |
OptionsetField::create('SearchAndSecurity', null, $yes_no), | |
OptionsetField::create('Uniforms', null, $yes_no), | |
DropdownField::create('WhenWillEmployeeReceiveUniform', null, array( | |
'FirstDay' => _t('ContractForm.WhenWillEmployeeReceiveUniform_FirstDay'), | |
'FirstWeek' => _t('ContractForm.WhenWillEmployeeReceiveUniform_FirstWeek'), | |
'Probation' => _t('ContractForm.WhenWillEmployeeReceiveUniform_Probation') | |
))->displayIf('Uniforms')->isEqualTo('Yes')->end(), | |
OptionsetField::create('DeductWagesForDamageToUniform', null, $yes_no) | |
->displayIf('Uniforms')->isEqualTo('Yes')->end(), | |
OptionsetField::create('MobileDevices', 'Personal Mobile Devices', $yes_no) | |
->setRightTitle('\'Yes\' is recommended'), | |
OptionsetField::create('SocialNetworking', null, $yes_no) | |
->setRightTitle('\'Yes\' is recommended'), | |
OptionsetField::create('DrivingLicenseRequired', null, $yes_no), | |
OptionsetField::create('CompanyCar', null, $yes_no), | |
DropdownField::create('CompanyCarUses', null, array( | |
'Business' => _t('ContractForm.CompanyCarUses_Business'), | |
'BusinessAndPrivate' => _t('ContractForm.CompanyCarUses_BusinessAndPrivate'), | |
'BusinessAndPrivateRestricted' => _t('ContractForm.CompanyCarUses_BusinessAndPrivateRestricted') | |
))->displayIf('CompanyCar')->isEqualTo('Yes')->end(), | |
DropdownField::create('WhoPaysForFuelCosts', null, array( | |
'CompanyForBusinessUsage' => _t('ContractForm.WhoPaysForFuelCosts_CompanyForBusinessUsage'), | |
'CompanyForAnyUsage' => _t('ContractForm.WhoPaysForFuelCosts_CompanyForAnyUsage'), | |
'CompanyForMileage' => _t('ContractForm.WhoPaysForFuelCosts_CompanyForMileage') | |
))->displayIf('CompanyCar')->isEqualTo('Yes')->end(), | |
HeaderField::create('Section_Confidentiality', _t('ContractForm.Section_Confidentiality')) | |
->setDescription(_t('ContractForm.Section_Confidentiality_help')), | |
OptionsetField::create('EmployeesKeepConfidentialInfo', null, $yes_no) | |
->setRightTitle('Yes is recommended'), | |
HeaderField::create('Section_OutsideBusinessInterests', _t('ContractForm.Section_OutsideBusinessInterests')), | |
OptionsetField::create('AllowEmployeeCarryOutOtherWorkOutwithCompanyHours', null, $yes_no) | |
->setRightTitle('No is recommended'), | |
HeaderField::create('Section_GrievanceProcedure', _t('ContractForm.Section_GrievanceProcedure')) | |
->setDescription(_t('ContractForm.Section_GrievanceProcedure_help')), | |
OptionsetField::create('HavePublishedGrievanceProcedure', null, $yes_no) | |
->setRightTitle('If you do not have a published grievance procedure a standard procedure will be generated with this contract.'), | |
DropdownField::create('AddressGrievancesTo', 'Where should the employee address any grievances to?', array( | |
'your supervisor' => 'to your Supervisor', | |
'your line manager' => 'to your Line Manager', | |
'the HR department' => 'to the HR Department' | |
)), | |
DropdownField::create('WhereCanEmployeesFindGrievanceProcedure', null, array( | |
'LineManager' => _t('Common.CanBeObtainedFrom_LineManager'), | |
'Office' => _t('Common.CanBeObtainedFrom_Office'), | |
'HR' => _t('Common.CanBeObtainedFrom_HR'), | |
'ThisContract' => _t('Common.CanBeObtainedFrom_ThisContract'), | |
'FinanceDept' => _t('Common.CanBeObtainedFrom_FinanceDept') | |
))->displayIf('HavePublishedGrievanceProcedure')->isEqualTo('Yes')->end(), | |
HeaderField::create('Section_DisciplinaryProcedure', _t('ContractForm.Section_DisciplinaryProcedure')) | |
->setDescription(_t('ContractForm.Section_DisciplinaryProcedure_help')), | |
OptionsetField::create('HavePublishedDiscProc', null, $yes_no) | |
->setRightTitle('If you do not have a published disciplinary procedure a standard procedure will be generated with this contract.'), | |
DropdownField::create('WhereCanEmployeesFindDiscProc', null, array( | |
'LineManager' => _t('Common.CanBeObtainedFrom_LineManager'), | |
'Office' => _t('Common.CanBeObtainedFrom_Office'), | |
'HR' => _t('Common.CanBeObtainedFrom_HR'), | |
'ThisContract' => _t('Common.CanBeObtainedFrom_ThisContract'), | |
'FinanceDept' => _t('Common.CanBeObtainedFrom_FinanceDept'), | |
'EmployeeHandbook' => 'from employee handbook' | |
))->displayIf('HavePublishedDiscProc')->isEqualTo('Yes')->end(), | |
HeaderField::create('Section_NoticeOfTermination_Employee', _t('ContractForm.Section_NoticeOfTermination_Employee')) | |
->setDescription(_t('ContractForm.Section_NoticeOfTermination_Employee_help')), | |
DropdownField::create('WhenEmployeeRequiredToGiveNotice', null, array( | |
'from the first day of employment' => 'from the first day of employment', | |
'after 1 week of employment' => 'after 1 week of employment', | |
'after 1 month of employment' => 'after 1 month of employment' | |
)), | |
FieldGroup::create( | |
DropdownField::create('RequiredNoticeToBeGiven_Number', 'Number', array_combine(range(1, 12), range(1, 12))), | |
DropdownField::create('RequiredNoticeToBeGiven_Period', 'Period', $RequiredNotice_period) | |
)->setName('RequiredNoticeToBeGiven'), | |
OptionsetField::create('AmountOfNoticeIncreaseWithLoS', null, $yes_no), | |
//NI = Notice Increase | |
FieldGroup::create( | |
HeaderField::create('NI_LoS', _t('ContractForm.LengthOfService'), 6), | |
HeaderField::create('NI_Number', _t('Common.Number'), 6), | |
HeaderField::create('NI_Period', _t('Common.Period'), 6), | |
DropdownField::create('NI_1_LoS', '', $LoS), | |
DropdownField::create('NI_1_Number', '', array_combine(range(1, 12), range(1, 12))), | |
DropdownField::create('NI_1_Period', '', $RequiredNotice_period), | |
DropdownField::create('NI_2_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('NI_2_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('NI_2_Period', '', $RequiredNotice_period)->setEmptyString(''), | |
DropdownField::create('NI_3_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('NI_3_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('NI_3_Period', '', $RequiredNotice_period)->setEmptyString(''), | |
DropdownField::create('NI_4_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('NI_4_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('NI_4_Period', '', $RequiredNotice_period)->setEmptyString(''), | |
DropdownField::create('NI_5_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('NI_5_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('NI_5_Period', '', $RequiredNotice_period)->setEmptyString('') | |
)->setName('RequiredNoticeIncreaseDetails') | |
->setColumnCount(3) | |
->displayIf('AmountOfNoticeIncreaseWithLoS')->isEqualTo('Yes')->end(), | |
HeaderField::create('Section_NoticeOfTermination_Employer', _t('ContractForm.Section_NoticeOfTermination_Employer')) | |
->setDescription(_t('ContractForm.Section_NoticeOfTermination_Employer_help')), | |
OptionsetField::create('GiveStatutoryNoticePeriods', null, $yes_no), | |
//EmplNotice | |
FieldGroup::create( | |
HeaderField::create('EmplNotice', _t('ContractForm.LengthOfService'), 6), | |
HeaderField::create('EmplNotice_Number', _t('Common.Number'), 6), | |
HeaderField::create('EmplNotice_Period', _t('Common.Period'), 6), | |
DropdownField::create('EmplNotice_1_LoS', '', $LoS), | |
DropdownField::create('EmplNotice_1_Number', '', array_combine(range(1, 12), range(1, 12))), | |
DropdownField::create('EmplNotice_1_Period', '', $periods), | |
DropdownField::create('EmplNotice_2_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('EmplNotice_2_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('EmplNotice_2_Period', '', $periods)->setEmptyString(''), | |
DropdownField::create('EmplNotice_3_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('EmplNotice_3_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('EmplNotice_3_Period', '', $periods)->setEmptyString(''), | |
DropdownField::create('EmplNotice_4_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('EmplNotice_4_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('EmplNotice_4_Period', '', $periods)->setEmptyString(''), | |
DropdownField::create('EmplNotice_5_LoS', '', $LoS)->setEmptyString(''), | |
DropdownField::create('EmplNotice_5_Number', '', array_combine(range(1, 12), range(1, 12)))->setEmptyString(''), | |
DropdownField::create('EmplNotice_5_Period', '', $periods)->setEmptyString('') | |
)->setName('TerminationNoticeForEmploy ee') | |
->setColumnCount(3) | |
->displayIf('GiveStatutoryNoticePeriods')->isEqualTo('No')->end(), | |
OptionsetField::create('ReserveRightToGardenLeave', null, $yes_no) | |
); | |
foreach ($fields as &$field) { | |
if($name = _t('ContractForm.'.$field->Name)) { | |
$field->setTitle($name); | |
} | |
if($description = _t('ContractForm.'.$field->Name.'_help')) { | |
$field->setDescription($description); | |
} | |
} | |
self::$fields = $fields; | |
} | |
return self::$fields; | |
} | |
function getValidator() { | |
return new RequiredFields(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment