Exemplo n.º 1
0
    $pluginDataProvider = unserialize($_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardId]);
    if (FALSE == $pluginDataProvider) {
        $logger->error("PluginDataProvider unserialize error (dashboardId = {$dashboardId}");
        Tools::sendBadRequest("PluginDataProvider unserialize error");
    }
    $smartyHelper = new SmartyHelper();
    if ('getLoadPerJobIndicator2' == $action) {
        $startTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("loadPerJob_startdate"));
        $endTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("loadPerJob_enddate"));
        // update dataProvider
        $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp);
        $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endTimestamp);
        $indicator = new LoadPerJobIndicator2($pluginDataProvider);
        $indicator->execute();
        $data = $indicator->getSmartyVariablesForAjax();
        // construct the html table
        foreach ($data as $smartyKey => $smartyVariable) {
            $smartyHelper->assign($smartyKey, $smartyVariable);
            #$logger->debug("key $smartyKey = ".var_export($smartyVariable, true));
        }
        $html = $smartyHelper->fetch(LoadPerJobIndicator2::getSmartySubFilename());
        $data['loadPerJob_htmlTable'] = $html;
        // return html & chart data
        $jsonData = json_encode($data);
        echo $jsonData;
    } else {
        Tools::sendNotFoundAccess();
    }
} else {
    Tools::sendUnauthorizedAccess();
}