Ejemplo n.º 1
0
// load ForecastTemplates
$forecastTemplateFiles = \histou\Folder::loadFolders(array(FORECAST_TEMPLATE_FOLDER));
$forcastTemplateCache = new \histou\template\cache('forecast');
$forecastTemplates = $forcastTemplateCache->loadTemplates($forecastTemplateFiles, '\\histou\\template\\loader::loadForecastTemplate');
usort($forecastTemplates, '\\histou\\template\\Template::compare');
$fValid = !empty($forecastTemplates) && $forecastTemplates[0]->isValid();
\histou\Debug::add("ForecastTemplate order:");
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) {