Beispiel #1
0
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $slf = new StationListFactory();
        foreach ($ids as $id) {
            $slf->GetByIdAndCompanyId($id, $current_company->getId());
            foreach ($slf as $station) {
                $station->setDeleted($delete);
                $station->Save();
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'StationList.php'));
        break;
    default:
        $slf = new StationListFactory();
        $slf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($slf);
        foreach ($slf as $station) {
            $stations[] = array('id' => $station->GetId(), 'type' => Option::getByKey($station->getType(), $station->getOptions('type')), 'status' => Option::getByKey($station->getStatus(), $station->getOptions('status')), 'source' => $station->getSource(), 'station' => $station->getStation(), 'short_station' => Misc::TruncateString($station->getStation(), 15), 'description' => Misc::TruncateString($station->getDescription(), 30), 'deleted' => $station->getDeleted());
            unset($description);
        }
        $smarty->assign_by_ref('stations', $stations);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('station/StationList.tpl');