예제 #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;
        }
    }
}
 /**
  * Returns the additional data for the events, such as full data for the event topic, event mandant, event address
  * @param Array $events
  * @return Array
  */
 private static function getEventFullValuesArray($events)
 {
     foreach ($events as $index => $event) {
         $topic = EventDatabaseManager::getTopic($event['topicID']);
         $mandant = EventDatabaseManager::getMandant($event['mandantID']);
         $address = EventDatabaseManager::getAddress($event['addressID']);
         $events[$index]['topic'] = $topic['Name'];
         $events[$index]['mandant'] = $mandant['company'];
         $events[$index]['address'] = $address->getAddressValue();
         $events[$index]['location'] = $address->getLocationName();
     }
     return $events;
 }