Exemplo n.º 1
0
        $data = array();
        $formatedColors = array();
        foreach ($loadPerJobs as $jobItem) {
            $data[$jobItem['name']] = $jobItem['nbDays'];
            $formatedColors[] = '#' . $jobItem['color'];
        }
        $seriesColors = '["' . implode('","', $formatedColors) . '"]';
        // ["#FFCD85","#C2DFFF"]
        $startTimestamp = NULL == $this->startTimestamp ? $this->execData['realStartTimestamp'] : $this->startTimestamp;
        $endTimestamp = NULL == $this->endTimestamp ? $this->execData['realEndTimestamp'] : $this->endTimestamp;
        $smartyVariables = array('loadPerJobIndicator_tableData' => $loadPerJobs, 'loadPerJobIndicator_jqplotData' => empty($data) ? NULL : Tools::array2json($data), 'loadPerJobIndicator_colors' => $formatedColors, 'loadPerJobIndicator_jqplotSeriesColors' => $seriesColors, 'loadPerJobIndicator_startDate' => Tools::formatDate("%Y-%m-%d", $startTimestamp), 'loadPerJobIndicator_endDate' => Tools::formatDate("%Y-%m-%d", $endTimestamp));
        if (false == $isAjaxCall) {
            $smartyVariables['loadPerJobIndicator_ajaxFile'] = self::getSmartySubFilename();
            $smartyVariables['loadPerJobIndicator_ajaxPhpURL'] = self::getAjaxPhpURL();
        }
        return $smartyVariables;
    }
    /**
     * a subset of variables usefull for loadPerJobIndicatorDiv and workingDaysPerJobChart
     * defined in LoadPerJobIndicator2_ajax.html
     *
     * @return array
     */
    public function getSmartyVariablesForAjax()
    {
        return $this->getSmartyVariables(true);
    }
}
// Initialize static variables
LoadPerJobIndicator2::staticInit();