Example #1
0
Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10);
$action = Misc::findSubmitButton();
switch ($action) {
    case 'add':
        Redirect::Page(URLBuilder::getURL(array('pay_period_schedule_id' => $id), 'EditPayPeriod.php', FALSE));
        break;
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $pplf = new PayPeriodListFactory();
        $pplf->StartTransaction();
        foreach ($ids as $pay_period_id) {
            $pplf->GetByIdAndCompanyId($pay_period_id, $current_company->getId());
            foreach ($pplf as $pay_period) {
                $pay_period->setDeleted($delete);
                $pay_period->Save();
            }
        }
        //$pplf->FailTransaction();
        $pplf->CommitTransaction();
        Redirect::Page(URLBuilder::getURL(array('id' => $id), 'PayPeriodList.php'));
        break;
    default:
        $pplf = new PayPeriodListFactory();
        $ppslf = new PayPeriodScheduleListFactory();
        //$pplf->GetByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order) );
        //$pplf->GetByPayPeriodScheduleId($id, $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order) );
        $pplf->getByPayPeriodScheduleId($id, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);