foreach ($forecastTemplates as $ftemplate) { \histou\Debug::add($ftemplate); } \histou\Debug::add("Is the first ForecastTemplate valid: " . \histou\Debug::printBoolean($fValid) . "\n"); if ($fValid) { $forecastTemplate = $forecastTemplates[0]; $className = get_class($forecastTemplate); if ($className == 'histou\\template\\Rule') { $forecast = \histou\template\loader::loadForecastTemplate($forecastTemplate->getFileName(), true); } if (isset($forecast)) { $forecast->setForecastDurations(); } } if (isset($template) && !empty($template)) { $className = get_class($template); if ($className == 'histou\\template\\Rule') { $dashboard = \histou\template\loader::loadTemplate($template->getFileName(), true)->generateDashboard($perfData); } elseif ($className == 'histou\\template\\Template' || $className == 'histou\\template\\SimpleTemplate') { $dashboard = $template->generateDashboard($perfData); } else { \histou\Basic::returnData(\histou\Debug::errorMarkdownDashboard("# unkown class {$className}"), 1); } if ($dashboard == null) { \histou\Basic::returnData(\histou\Debug::errorMarkdownDashboard('# Template did not return a dashboard!'), 1); } else { \histou\Basic::returnData($dashboard, 0); } } else { \histou\Basic::returnData(\histou\Debug::errorMarkdownDashboard('# No template found!'), 1); }