default:
     if ((!isset($user_date_id) or isset($user_date_id) and $user_date_id == '') and $user_id != '' and $filter_date != '') {
         Debug::Text('User Date ID not passed, inserting one.', __FILE__, __LINE__, __METHOD__, 10);
         $user_date_id = UserDateFactory::findOrInsertUserDate($user_id, $filter_date);
     }
     if ($user_date_id != '') {
         $udtlf = new UserDateTotalListFactory();
         $udtlf->getByUserDateIDAndStatusAndType($user_date_id, array(10, 20, 30), array(10, 20, 30, 40, 100), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
         $pager = new Pager($udtlf);
         $blf = new BranchListFactory();
         $branch_options = $blf->getByCompanyIdArray($current_company->getId());
         $dlf = new DepartmentListFactory();
         $department_options = $dlf->getByCompanyIdArray($current_company->getId());
         //Absence policies
         $otplf = new AbsencePolicyListFactory();
         $absence_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE);
         //Overtime policies
         $otplf = new OverTimePolicyListFactory();
         $over_time_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE);
         //Premium policies
         $pplf = new PremiumPolicyListFactory();
         $premium_policy_options = $pplf->getByCompanyIDArray($current_company->getId(), TRUE);
         $job_options = array();
         $job_item_options = array();
         if ($current_company->getProductEdition() == 20) {
             $jlf = new JobListFactory();
             $job_options = $jlf->getByCompanyIdArray($current_company->getId(), FALSE);
             $jilf = new JobItemListFactory();
             $job_item_options = $jilf->getByCompanyIdArray($current_company->getId(), TRUE);
         }
         $day_total_time = array('total_time' => 0, 'worked_time' => 0, 'difference' => 0);
        $hpf->FailTransaction();
    default:
        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;
}