function main_default($eventData)
{
    global $gXmlDefinition, $gLocale, $gPageTitle;
    $main = new \Innomatic\Maintenance\MaintenanceHandler();
    $mainTime = $main->getLastMaintenanceTime();
    $tasks = $main->getTasksList();
    $tabs[0]['label'] = $gLocale->getStr('general_status.tab');
    $tabs[1]['label'] = $gLocale->getStr('general_report.tab');
    $tabs[2]['label'] = $gLocale->getStr('general_tasks.tab');
    $country = new \Innomatic\Locale\LocaleCountry(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCountry());
    $dateArray = $country->getDateArrayFromUnixTimestamp($mainTime);
    $row = 0;
    $gXmlDefinition = '<vertgroup>
      <children>

      <tab><name>general</name>
        <args>
          <tabs type="array">' . WuiXml::encode($tabs) . '</tabs>
          <tabactionfunction>general_tab_builder</tabactionfunction>
          <activetab>' . (isset($eventData['tab']) ? $eventData['tab'] : '') . '</activetab>
        </args>
        <children>

        <vertgroup>
          <children>

            <label><name>status</name>
              <args>
                <label type="encoded">' . urlencode($gLocale->getStr('status.label')) . '</label>
                <bold>true</bold>
              </args>
            </label>

        <horizgroup>
          <children>

            <label>
              <args>
                <label type="encoded">' . urlencode($gLocale->getStr('last_maintenance.label')) . '</label>
              </args>
            </label>

            <date>
              <args>
                <readonly>true</readonly>
                <type>date</type>
                <value type="array">' . WuiXml::encode($dateArray) . '</value>
              </args>
            </date>

            <date>
              <args>
                <readonly>true</readonly>
                <type>time</type>
                <value type="array">' . WuiXml::encode($dateArray) . '</value>
              </args>
            </date>

          </children>
        </horizgroup>

            <horizbar/>';
    $maintenanceResult =& \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getMaintenanceResult();
    if (is_array($maintenanceResult)) {
        $row = 0;
        $gXmlDefinition .= '
                <label>
                  <args>
                    <label type="encoded">' . urlencode($gLocale->getStr('report.label')) . '</label>
                    <bold>true</bold>
                  </args>
                </label>
        <grid><children>';
        foreach ($maintenanceResult as $task => $result) {
            $gXmlDefinition .= '<label row="' . $row . '" col="0">
              <args>
                <nowrap>true</nowrap>
                <label type="encoded">' . urlencode($tasks[$task]['description']) . '</label>
              </args>
            </label>
            <button row="' . $row . '" col="1">
              <args>
                <themeimage>' . ($result ? 'buttonok' : 'buttoncancel') . '</themeimage>
                <disabled>true</disabled>
              </args>
            </button>';
            $row++;
        }
        $gXmlDefinition .= '</children></grid><horizbar/>';
    }
    $gXmlDefinition .= '        <button>
              <args>
                <themeimage>buttonok</themeimage>
                <label type="encoded">' . urlencode($gLocale->getStr('run_maintenance.button')) . '</label>
                <horiz>true</horiz>
                <frame>false</frame>
                <action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default'), array('action', 'run_maintenance')))) . '</action>
              </args>
            </button>

          </children>
        </vertgroup>

        <vertgroup>
          <children>

            <label>
              <args>
                <label type="encoded">' . urlencode($gLocale->getStr('report.label')) . '</label>
                <bold>true</bold>
              </args>
            </label>

            <form><name>report</name>
              <args>
                <action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default'), array('action', 'set_report')))) . '</action>
              </args>
              <children>

            <grid>
              <children>

                <label row="0" col="0">
                  <args>
                    <label type="encoded">' . urlencode($gLocale->getStr('report_enabled.label')) . '</label>
                  </args>
                </label>

                <checkbox row="0" col="1"><name>reportenabled</name>
                  <args>
                    <disp>action</disp>
                    <checked>' . ($main->getReportsEnableStatus() ? 'true' : 'false') . '</checked>
                  </args>
                </checkbox>

                <label row="1" col="0">
                  <args>
                    <label type="encoded">' . urlencode($gLocale->getStr('report_email.label')) . '</label>
                  </args>
                </label>

                <string row="1" col="1"><name>reportemail</name>
                  <args>
                    <disp>action</disp>
                    <value type="encoded">' . urlencode($main->getReportsEmail()) . '</value>
                    <size>25</size>
                  </args>
                </string>

              </children>
            </grid>

            </children>
            </form>

            <horizbar/>

            <button>
              <args>
                <themeimage>buttonok</themeimage>
                <label type="encoded">' . urlencode($gLocale->getStr('apply.button')) . '</label>
                <horiz>true</horiz>
                <frame>false</frame>
                <formsubmit>report</formsubmit>
                <action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default'), array('action', 'set_report')))) . '</action>
              </args>
            </button>

          </children>
        </vertgroup>

        <vertgroup>
          <children>

            <label>
              <args>
                <label type="encoded">' . urlencode($gLocale->getStr('scheduled_tasks.label')) . '</label>
                <bold>true</bold>
              </args>
            </label>

            <form><name>settings</name>
              <args>
                <action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default'), array('action', 'set_general')))) . '</action>
              </args>
              <children>

                <grid>
                  <children>';
    reset($tasks);
    foreach ($tasks as $task) {
        $gXmlDefinition .= '<checkbox row="' . $row . '" col="0"><name type="encoded">' . urlencode($task['name'] . '_task') . '</name>
          <args>
            <disp>action</disp>
            <checked>' . ($task['enabled'] ? 'true' : 'false') . '</checked>
          </args>
        </checkbox>
        <label row="' . $row . '" col="1">
          <args>
            <label type="encoded">' . urlencode($task['description']) . '</label>
            <nowrap>false</nowrap>
          </args>
        </label>';
        $row++;
    }
    $gXmlDefinition .= '              </children>
                </grid>

              </children>
            </form>

        <horizbar/>

            <button>
              <args>
                <themeimage>buttonok</themeimage>
                <label type="encoded">' . urlencode($gLocale->getStr('apply.button')) . '</label>
                <horiz>true</horiz>
                <frame>false</frame>
                <formsubmit>settings</formsubmit>
                <action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default'), array('action', 'set_general')))) . '</action>
              </args>
            </button>

          </children>
          </vertgroup>

          </children>
        </tab>

      </children>
    </vertgroup>';
    $gPageTitle .= ' - ' . $gLocale->getStr('general.title');
}
 /**
  * Bootstraps the Innomatic container.
  *
  * @param string $home Complete path of the directory containing the
  * Innomatic webapp.
  * @param string $configuration Complete path of the Innomatic
  * configuration file.
  */
 public function bootstrap($home, $configuration)
 {
     if ($this->bootstrapped) {
         return;
     }
     $this->home = $home;
     // Reads the configuration
     $this->configurationFile = $configuration;
     $this->config = new InnomaticSettings($configuration);
     // *********************************************************************
     // PHP environment
     // *********************************************************************
     // PHP
     $timelimit = $this->config->value('PHPExecutionTimeLimit');
     if (!strlen($timelimit)) {
         $timelimit = 0;
     }
     set_time_limit($timelimit);
     ignore_user_abort(true);
     // Adds global override classes folder to the include path.
     set_include_path($this->home . 'core/overrides/classes/' . PATH_SEPARATOR . get_include_path());
     // *********************************************************************
     // Innomatic state, environment, mode, interface and edition
     // *********************************************************************
     // Waits until system is in upgrade phase
     if ($this->lockOverride == false) {
         while (file_exists($this->home . 'core/temp/upgrading_system_lock')) {
             $this->state = \Innomatic\Core\InnomaticContainer::STATE_UPGRADE;
             clearstatcache();
             sleep(1);
         }
     }
     // Checks if system is in setup phase and sets the state
     if (file_exists($this->home . 'core/temp/setup_lock')) {
         $this->state = \Innomatic\Core\InnomaticContainer::STATE_SETUP;
         if (extension_loaded('APD')) {
             apd_set_session_trace(35);
         }
     } else {
         switch ($this->config->value('PlatformState')) {
             case 'debug':
                 $this->state = \Innomatic\Core\InnomaticContainer::STATE_DEBUG;
                 if (extension_loaded('APD')) {
                     apd_set_session_trace(35);
                 }
                 break;
             case 'production':
                 $this->state = \Innomatic\Core\InnomaticContainer::STATE_PRODUCTION;
                 break;
             default:
                 $this->state = \Innomatic\Core\InnomaticContainer::STATE_PRODUCTION;
         }
     }
     // Environment
     switch ($this->config->value('PlatformEnvironment')) {
         case 'development':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_DEVELOPMENT;
             break;
         case 'integration':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_INTEGRATION;
             break;
         case 'staging':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_STAGING;
             break;
         case 'production':
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_PRODUCTION;
             break;
         default:
             $this->environment = \Innomatic\Core\InnomaticContainer::ENVIRONMENT_PRODUCTION;
     }
     // Interface
     //$this->interface = \Innomatic\Core\InnomaticContainer::INTERFACE_UNKNOWN;
     // Mode
     //$this->mode = \Innomatic\Core\InnomaticContainer::MODE_ROOT;
     // Edition
     if ($this->config->value('PlatformEdition') == 'enterprise' or $this->config->value('PlatformEdition') == 'singletenant') {
         $this->edition = \Innomatic\Core\InnomaticContainer::EDITION_SINGLETENANT;
     }
     // *********************************************************************
     // Pid and shutdown function
     // *********************************************************************
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
         $this->pid = md5(microtime());
         if (!file_exists($this->home . 'core/temp/pids/')) {
             @mkdir($this->home . 'core/temp/pids/');
         }
         touch($this->home . 'core/temp/pids/' . $this->pid, time());
         register_shutdown_function(array($this, 'shutdown'));
     }
     // *********************************************************************
     // Innomatic platform name
     // *********************************************************************
     $this->platformName = $this->config->value('PlatformName');
     $this->platformGroup = $this->config->value('PlatformGroup');
     // *********************************************************************
     // Innomatic error handler
     // *********************************************************************
     //set_error_handler(array($this, 'errorHandler'));
     // *********************************************************************
     // Innomatic root
     // *********************************************************************
     $this->country = $this->config->value('RootCountry');
     $this->language = $this->config->value('RootLanguage');
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
         // Innomatic central database
         //
         $dasnString = $this->config->value('RootDatabaseType') . '://' . $this->config->value('RootDatabaseUser') . ':' . $this->config->value('RootDatabasePassword') . '@' . $this->config->value('RootDatabaseHost') . ':' . $this->config->value('RootDatabasePort') . '/' . $this->config->value('RootDatabaseName') . '?' . 'logfile=' . $this->getHome() . 'core/log/innomatic_root_db.log';
         $this->rootDb = \Innomatic\Dataaccess\DataAccessFactory::getDataAccess(new \Innomatic\Dataaccess\DataAccessSourceName($dasnString));
         if (!$this->rootDb->connect()) {
             $this->abort('Database not connected');
         }
     }
     // *********************************************************************
     // Run time state and interface defined data
     // *********************************************************************
     // Debugger
     if ($this->state == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) {
         $this->loadTimer = new \Innomatic\Debug\LoadTime(LoadTime::LOADTIME_MODE_CONTINUOUS);
         $this->loadTimer->Mark('start');
         $this->dbLoadTimer = new \Innomatic\Debug\LoadTime(LoadTime::LOADTIME_MODE_STARTSTOP);
     }
     // Security
     $securityReportsInterval = $this->config->value('SecurityReportsInterval');
     if ($securityReportsInterval > 0) {
         $lastSecurityReport = $this->config->value('SecurityLastReportTime');
         if (!$lastSecurityReport or $lastSecurityReport < time() - $securityReportsInterval * 3600 * 24) {
             $innomaticSecurity = new \Innomatic\Security\SecurityManager();
             $innomaticSecurity->sendReport();
             unset($innomaticSecurity);
         }
     }
     unset($securityReportsInterval);
     // Maintenance
     $maintenanceHandler = new \Innomatic\Maintenance\MaintenanceHandler();
     $maintenanceInterval = $maintenanceHandler->getMaintenanceInterval();
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_MAINTENANCE and $maintenanceInterval > 0) {
         $lastMaintenance = $maintenanceHandler->getLastMaintenanceTime();
         if (!$lastMaintenance or $lastMaintenance < time() - $maintenanceInterval * 3600 * 24) {
             $innomaticMaintenance = new \Innomatic\Maintenance\MaintenanceHandler();
             $innomaticMaintenance->doMaintenance();
             $innomaticMaintenance->sendReport();
             unset($innomaticMaintenance);
         }
     }
     unset($maintenanceInterval);
     // *********************************************************************
     // Auto exec routines
     // *********************************************************************
     // Application reupdate check
     if (file_exists($this->home . 'core/temp/appinst/reupdate')) {
         $tmpmod = new \Innomatic\Application\Application($this->rootDb, '');
         $tmpmod->install($this->home . 'core/temp/appinst/reupdate');
         clearstatcache();
         if (file_exists($this->home . 'core/temp/appinst/reupdate')) {
             unlink($this->home . 'core/temp/appinst/reupdate');
         }
     }
     // Startup hook
     if ($this->state != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
         $hook = new \Innomatic\Process\Hook($this->rootDb, 'innomatic', 'instance');
         $null = '';
         switch ($hook->callHooks('startup', $null, '')) {
             case \Innomatic\Process\Hook::RESULT_ABORT:
                 $this->abort('Bootstrap aborted');
                 break;
         }
     }
     // Bootstrap end
     $this->bootstrapped = true;
 }