$pglf = new PolicyGroupListFactory(); $pglf->getByIdAndCompanyID($id, $current_company->getID()); foreach ($pglf as $pg_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $pg_obj->getId(), 'name' => $pg_obj->getName(), 'meal_policy_ids' => $pg_obj->getMealPolicy(), 'break_policy_ids' => $pg_obj->getBreakPolicy(), 'holiday_policy_ids' => $pg_obj->getHolidayPolicy(), 'exception_policy_control_id' => $pg_obj->getExceptionPolicyControlID(), 'user_ids' => $pg_obj->getUser(), 'over_time_policy_ids' => $pg_obj->getOverTimePolicy(), 'premium_policy_ids' => $pg_obj->getPremiumPolicy(), 'round_interval_policy_ids' => $pg_obj->getRoundIntervalPolicy(), 'accrual_policy_ids' => $pg_obj->getAccrualPolicy(), 'created_date' => $pg_obj->getCreatedDate(), 'created_by' => $pg_obj->getCreatedBy(), 'updated_date' => $pg_obj->getUpdatedDate(), 'updated_by' => $pg_obj->getUpdatedBy(), 'deleted_date' => $pg_obj->getDeletedDate(), 'deleted_by' => $pg_obj->getDeletedBy()); } } $none_array_option = array('0' => TTi18n::gettext('-- None --')); $ulf = new UserListFactory(); $user_options = $ulf->getByCompanyIDArray($current_company->getId(), FALSE, TRUE); $otplf = new OverTimePolicyListFactory(); $over_time_policy_options = Misc::prependArray($none_array_option, $otplf->getByCompanyIDArray($current_company->getId(), FALSE)); $pplf = new PremiumPolicyListFactory(); $premium_policy_options = Misc::prependArray($none_array_option, $pplf->getByCompanyIDArray($current_company->getId(), FALSE)); $riplf = new RoundIntervalPolicyListFactory(); $round_interval_policy_options = Misc::prependArray($none_array_option, $riplf->getByCompanyIDArray($current_company->getId(), FALSE)); $mplf = new MealPolicyListFactory(); $meal_options = Misc::prependArray($none_array_option, $mplf->getByCompanyIdArray($current_company->getId(), FALSE)); $bplf = new BreakPolicyListFactory(); $break_options = Misc::prependArray($none_array_option, $bplf->getByCompanyIdArray($current_company->getId(), FALSE)); $epclf = new ExceptionPolicyControlListFactory(); $exception_options = Misc::prependArray($none_array_option, $epclf->getByCompanyIdArray($current_company->getId(), FALSE)); $hplf = new HolidayPolicyListFactory(); $holiday_policy_options = Misc::prependArray($none_array_option, $hplf->getByCompanyIdArray($current_company->getId(), FALSE)); $aplf = new AccrualPolicyListFactory(); $aplf->getByCompanyIdAndTypeID($current_company->getId(), array(20, 30)); //Calendar and Hour based. $accrual_options = Misc::prependArray($none_array_option, $aplf->getArrayByListFactory($aplf, FALSE)); //Select box options; $data['user_options'] = $user_options; $data['over_time_policy_options'] = $over_time_policy_options;
if (isset($id)) { BreadCrumb::setCrumb($title); $hplf = new HolidayPolicyListFactory(); $hplf->getByIdAndCompanyID($id, $current_company->getID()); foreach ($hplf as $hp_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $hp_obj->getId(), 'name' => $hp_obj->getName(), 'type_id' => $hp_obj->getType(), 'default_schedule_status_id' => $hp_obj->getDefaultScheduleStatus(), 'minimum_employed_days' => $hp_obj->getMinimumEmployedDays(), 'minimum_worked_period_days' => $hp_obj->getMinimumWorkedPeriodDays(), 'minimum_worked_days' => $hp_obj->getMinimumWorkedDays(), 'worked_scheduled_days' => $hp_obj->getWorkedScheduledDays(), 'minimum_worked_after_period_days' => $hp_obj->getMinimumWorkedAfterPeriodDays(), 'minimum_worked_after_days' => $hp_obj->getMinimumWorkedAfterDays(), 'worked_after_scheduled_days' => $hp_obj->getWorkedAfterScheduledDays(), 'average_time_days' => $hp_obj->getAverageTimeDays(), 'average_time_worked_days' => $hp_obj->getAverageTimeWorkedDays(), 'force_over_time_policy' => $hp_obj->getForceOverTimePolicy(), 'include_over_time' => $hp_obj->getIncludeOverTime(), 'include_paid_absence_time' => $hp_obj->getIncludePaidAbsenceTime(), 'minimum_time' => $hp_obj->getMinimumTime(), 'maximum_time' => $hp_obj->getMaximumTime(), 'round_interval_policy_id' => $hp_obj->getRoundIntervalPolicyID(), 'absence_policy_id' => $hp_obj->getAbsencePolicyID(), 'recurring_holiday_ids' => $hp_obj->getRecurringHoliday(), 'created_date' => $hp_obj->getCreatedDate(), 'created_by' => $hp_obj->getCreatedBy(), 'updated_date' => $hp_obj->getUpdatedDate(), 'updated_by' => $hp_obj->getUpdatedBy(), 'deleted_date' => $hp_obj->getDeletedDate(), 'deleted_by' => $hp_obj->getDeletedBy()); } } elseif ($action != 'submit') { //Defaults $data = array('default_schedule_status_id' => 20, 'minimum_employed_days' => 30, 'minimum_worked_period_days' => 30, 'minimum_worked_days' => 15, 'minimum_worked_after_period_days' => 0, 'minimum_worked_after_days' => 0, 'average_time_days' => 30, 'force_over_time_policy' => FALSE, 'include_over_time' => FALSE, 'include_paid_absence_time' => TRUE, 'minimum_time' => 0, 'maximum_time' => 0); } $aplf = new AbsencePolicyListFactory(); $absence_options = $aplf->getByCompanyIDArray($current_company->getId(), TRUE); $riplf = new RoundIntervalPolicyListFactory(); $round_interval_options = $riplf->getByCompanyIDArray($current_company->getId(), TRUE); $rhlf = new RecurringHolidayListFactory(); $recurring_holiday_options = $rhlf->getByCompanyIDArray($current_company->getId(), TRUE); $sf = new ScheduleFactory(); //Select box options; $data['type_options'] = $hpf->getOptions('type'); $data['schedule_status_options'] = $sf->getOptions('status'); $data['scheduled_day_options'] = $hpf->getOptions('scheduled_day'); $data['absence_options'] = $absence_options; $data['round_interval_options'] = $round_interval_options; $data['recurring_holiday_options'] = $recurring_holiday_options; $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('hpf', $hpf); $smarty->display('policy/EditHolidayPolicy.tpl');