/**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * Outputs form for creating or editing event
  * 
  * @param Event $event
  * @param int $topicID
  */
 public static function eventFormOutput($event = null, $topicID = null)
 {
     $output = "<div class='wrap'>\n<?php screen_icon(); ?>\n<h2>" . HEADER . "</h2>\n<form action = '' method = 'post' name = 'event'>\n<table>";
     if ($event != null) {
         $action_name = UPDATE_EVENT;
         $output .= "<tr><td><b>" . DELETE_EVENT . "?</b></td><td><input type='checkbox' id = 'deleteEvent' name='deleteEvent' value='yes'>";
         foreach (Event::$eventParamsNames as $name => $param) {
             $output .= View::eventFormFieldTitle($name) . View::eventFormFieldsOutput($param, $event->getParam($param)) . "</td></tr>";
         }
     } else {
         if ($topicID == null) {
             $action_name = ADD_EVENT;
             foreach (Event::$eventParamsNames as $name => $param) {
                 $output .= View::eventFormFieldTitle($name) . View::eventFormFieldsOutput($param) . "</td></tr>";
             }
         } else {
             $action_name = ADD_EVENT;
             $templateValues = EventDatabaseManager::getTopic($topicID);
             foreach (Event::$eventParamsNames as $name => $param) {
                 if ($param == 'topicID') {
                     $default = $topicID;
                 } else {
                     if (isset($templateValues['template_' . $param])) {
                         $default = $templateValues['template_' . $param];
                     } else {
                         $default = "";
                     }
                 }
                 $output .= View::eventFormFieldTitle($name) . View::eventFormFieldsOutput($param, $default) . "</td></tr>";
             }
         }
     }
     $output .= "<tr><td>" . EVENT_ACTION_PROMT . "?</td>\n            <td><input type='radio' name='event_action' value='load_templates'>" . LOAD_TEMPLATE_VALUES . "<br>\n<input type='radio' name='event_action' value='add_event' checked>{$action_name}</td>";
     $output .= ' </table><input type="button" disabled id = "eventButton" onclick = "eventFormSubmit()" value="' . BUTTON_SUBMIT . '"></form>';
     echo $output;
 }
Exemplo n.º 3
0
/**
 * Outputs the form for editing existing topic
 */
function edit_topics()
{
    View::loadScripts();
    $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);
    }
}