Ejemplo n.º 1
0
}
Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10);
$action = Misc::findSubmitButton();
switch ($action) {
    case 'add':
        Redirect::Page(URLBuilder::getURL(NULL, 'EditStation.php'));
        break;
    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);
        }