function &getRenderer($type, &$report)
 {
     $ret = false;
     if ($type == '') {
         return $ret;
     }
     // Check rendererValid function
     $isValid = xhelpReportRendererFactory::_rendererValid($type);
     if ($isValid) {
         // Step 2 - include script with faq adapter class
         require_once XHELP_RPT_RENDERER_PATH . '/' . $type . 'ReportRenderer.php';
         // Step 3 - create instance of adapter class
         $classname = 'xhelp' . $type . 'ReportRenderer';
         // Step 4 - return adapter class
         $ret = new $classname($report);
         return $ret;
     } else {
         return $ret;
     }
     //XHELP_RPT_RENDERER_PATH
 }
Beispiel #2
0
function runReport($reportName)
{
    global $xoopsOption, $xoopsTpl, $xoopsConfig, $xoopsUser, $xhelp_module_header, $paramVals;
    $classname = 'xhelp' . $reportName . 'Report';
    include_once XHELP_REPORT_PATH . '/' . $reportName . '.php';
    $report = new $classname();
    // Get any parameters for report
    $reportParams = $report->getParams();
    // Fill reportParameters with updated information
    if (count($reportParams) > 0) {
        foreach ($reportParams as $param) {
            if (isset($_REQUEST[$param->fieldname])) {
                if ($param->controltype == XHELP_CONTROL_DATETIME) {
                    $param->value = strtotime($_REQUEST[$param->fieldname]);
                } else {
                    $param->value = $_REQUEST[$param->fieldname];
                }
            } else {
                if (isset($paramVals[$param->fieldname])) {
                    if ($param->controltype == XHELP_CONTROL_DATETIME) {
                        $param->value = strtotime($paramVals[$param->fieldname]);
                    } else {
                        if (is_array($paramVals[$param->fieldname])) {
                            $param->values = $paramVals[$param->fieldname];
                        } else {
                            $param->value = $paramVals[$param->fieldname];
                        }
                    }
                }
            }
        }
        $report->extraWhere = $report->makeWhere($reportParams);
    }
    //$xoopsOption['template_main'] = 'xhelp_report.html';   // Set template
    require XOOPS_ROOT_PATH . '/header.php';
    // Include page header
    generateHeader($report);
    $oRenderer =& xhelpReportRendererFactory::getRenderer('html', $report);
    echo $oRenderer->render();
    $xoopsTpl->assign('xhelp_imagePath', XHELP_IMAGE_URL . '/');
    $xoopsTpl->assign('xoops_module_header', $xhelp_module_header);
    require XOOPS_ROOT_PATH . '/footer.php';
}