Example #1
0
/**
 * Outputs the form for editing existing mandant
 */
function edit_mandants()
{
    View::loadScripts();
    if (isset($_GET['order'])) {
        $orderAttribute = mysql_real_escape_string($_GET['order']);
    } else {
        $orderAttribute = "mandantID";
    }
    $mandants = EventDatabaseManager::getAllMandants($orderAttribute);
    View::outputAllMandants('edit_mandants', $mandants);
    View::linkToAddMandant();
    if (isset($_GET['mandantID']) && is_numeric($_GET['mandantID'])) {
        $mandant = EventDatabaseManager::getMandant($_GET['mandantID']);
        $locations = EventDatabaseManager::getAllLocations();
        $mandantLocations = EventDatabaseManager::getMandantLocations($_GET['mandantID']);
        View::mandantFormOutput($mandant['mandantID'], $mandant['company'], $locations, $mandantLocations);
    } else {
        if (isset($_GET['mandantID'])) {
            echo MANDANT_ID_INCORRECT_MESSAGE;
        }
    }
}