//$ppslf = new PayPeriodScheduleFactory();
Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10);
$action = Misc::findSubmitButton();
switch ($action) {
    case 'add':
        Redirect::Page(URLBuilder::getURL(NULL, 'EditPayPeriodSchedule.php', FALSE));
        break;
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $ppslf = new PayPeriodScheduleListFactory();
        foreach ($ids as $id) {
            $ppslf->GetByIdAndCompanyId($id, $current_company->getId());
            foreach ($ppslf as $pay_period_schedule) {
                $pay_period_schedule->setDeleted($delete);
                $pay_period_schedule->Save();
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'PayPeriodScheduleList.php'));
        break;
    default:
        $ppslf = new PayPeriodScheduleListFactory();
        $ppslf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order));
        $pager = new Pager($ppslf);
        foreach ($ppslf as $pay_period_schedule) {
            $pay_period_schedules[] = array('id' => $pay_period_schedule->getId(), 'company_id' => $pay_period_schedule->getCompany(), 'name' => $pay_period_schedule->getName(), 'description' => $pay_period_schedule->getDescription(), 'type' => Option::getByKey($pay_period_schedule->getType(), $pay_period_schedule->getOptions('type')), 'deleted' => $pay_period_schedule->getDeleted());
        }
        $smarty->assign_by_ref('pay_period_schedules', $pay_period_schedules);