Пример #1
0
    $topics = EventDatabaseManager::getAllTopics(true);
    View::outputAllTopics('edit_topics', $topics);
    View::linkToAddTopic();
    if (isset($_GET['topicID']) && is_numeric($_GET['topicID'])) {
        $topic = EventDatabaseManager::getTopic($_GET['topicID']);
        View::topicFormOutput($topic);
    }
}
//var_dump($_POST);
/*
 * Add, delete or edit mandant
 */
if (isset($_POST['company'])) {
    if (isset($_POST['deleteMandant']) && $_POST['deleteMandant'] == 'yes') {
        if (is_numeric($_GET['mandantID'])) {
            if (EventDatabaseManager::deleteMandant($_GET['mandantID'])) {
                echo MANDANT_DELETED_MESSAGE;
            } else {
                echo MANDANT_NOT_DELETED_MESSAGE;
            }
        }
    } else {
        if (isset($_GET['mandantID']) && is_numeric($_GET['mandantID'])) {
            EventDatabaseManager::updateMandant($_GET['mandantID'], mysql_real_escape_string($_POST['company']));
            $locations = EventDatabaseManager::getAllLocations();
            foreach ($locations as $id => $locationName) {
                if (isset($_POST['location_' . $id])) {
                    EventDatabaseManager::addLocationToMandant($_GET['mandantID'], $id);
                } else {
                    EventDatabaseManager::removeLocationFromMandant($_GET['mandantID'], $id);
                }