public function render($objName)
    {
        // get the current UI bizobj
        $bizform = Openbizx::getObject($objName);    // get the existing bizform object
        $bizobj = $bizform->getDataObj();

        $h=opendir($this->targetReportPath);
        if (!$h)
        {
            echo "cannot read dir ".$this->targetReportPath;
            exit;
        }
        // create a tmp csv file for hold the data, then feed csv file to report engine
        $uid = $this->getUniqueString();
        $tmpfname = $this->targetReportPath . $uid . ".csv";
        //echo "csv file is at $tmpfname.<br>";
        $fp = fopen($tmpfname, 'w');

        $keyList = $bizform->recordRow->GetSortControlKeys();
        $fieldNames = array();
        foreach($keyList as $key)
        {
            $fieldNames[] = $bizform->GetControl($key)->bizFieldName;
        }
        fputcsv($fp, $fieldNames);

        $recList = $bizobj->directFetch();
        foreach ($recList as $recArray)
        {
            unset($fieldValues);
            $fieldValues = array();
            $line = "";
            foreach($keyList as $key)
            {
                $fieldValues[] = $recArray[$bizform->GetControl($key)->bizFieldName];
            }
            fputcsv($fp, $fieldValues);
        }

        fclose($fp);

        $i = 0;
        foreach($keyList as $key)
        {
            $rpt_fields[$i]["name"] = $bizform->GetControl($key)->bizFieldName;
            $rpt_fields[$i]["type"] = $bizobj->getField($rpt_fields[$i]["name"])->type;
            $i++;
        }

        // dataobj.rptdesign.tpl
        // $rpt_data_dir, $rpt_title, $rpt_csv_file, $rpt_fields[](name,type)
        $smarty = TemplateHelper::getSmartyTemplate();
        $smarty->assign("rpt_data_dir", $this->targetReportPath);
        $smarty->assign("rpt_title", $bizform->title);
        $smarty->assign("rpt_csv_file", basename($tmpfname));
        $smarty->assign("rpt_fields", $rpt_fields);
        $reportContent = $smarty->fetch($this->rptTemplate);

        $tmpRptDsgn = $this->targetReportPath . $uid . ".rptdesign";
        //echo "temp rpt design file is at $tmpRptDsgn.<br>";
        $fp = fopen($tmpRptDsgn, 'w');
        fwrite($fp, $reportContent);
        fclose($fp);

        ob_clean();
        $designFileName = $uid . ".rptdesign";
        $content = "<div style='font-family:Arial; font-size:12px; background-color:#FCFCFC;'>";
        $content .= "Reports can be viewed as ";
        $content .= "<li><a href='".$this->birtViewer."/run?__report=report\\$designFileName' target='__blank'>HTML report</a></li>";
        $content .= "<li><a href='".$this->birtViewer."/run?__report=report\\$designFileName&__format=pdf' target='__blank'>PDF report</a></li>";
        $content .= "<li><a href='".$this->birtViewer."/frameset?__report=report\\$designFileName' target='__blank'>Interactive report</a></li>";
        $content .= "</div>";

        echo $content;
        exit;
    }
public function render($objName)
    {
        // get the current UI bizobj
        $bizform = Openbizx::getObject($objName);    // get the existing bizform object
        $bizobj = $bizform->getDataObj();

        $h=opendir($this->targetReportPath);
        if (!$h)
        {
            echo "cannot read dir ".$this->targetReportPath;
            exit;
        }
        // create a tmp csv file for hold the data, then feed csv file to report engine
        $uid = $this->getUniqueString();
        $tmpfname = $this->targetReportPath . $uid . ".csv";
        //echo "csv file is at $tmpfname.<br>";
        $fp = fopen($tmpfname, 'w');

        $keyList = $bizform->recordRow->GetSortControlKeys();
        $fieldNames = array();
        foreach($keyList as $key)
        {
            $fieldNames[] = $bizform->GetControl($key)->bizFieldName;
        }
        fputcsv($fp, $fieldNames);

        $recList = $bizobj->directFetch();
        foreach ($recList as $recArray)
        {
            unset($fieldValues);
            $fieldValues = array();
            $line = "";
            foreach($keyList as $key)
            {
                $fieldValues[] = $recArray[$bizform->GetControl($key)->bizFieldName];
            }
            fputcsv($fp, $fieldValues);
        }

        fclose($fp);

        $i = 0;
        foreach($keyList as $key)
        {
            $rpt_fields[$i]["name"] = $bizform->GetControl($key)->bizFieldName;
            $rpt_fields[$i]["type"] = $bizobj->getField($rpt_fields[$i]["name"])->type;
            $i++;
        }

        // dataobj.rptdesign.tpl
        // $rpt_data_dir, $rpt_title, $rpt_csv_file, $rpt_fields[](name,type)
        $smarty = TemplateHelper::getSmartyTemplate();
        $smarty->assign("rpt_data_dir", $this->targetReportPath);
        $smarty->assign("rpt_title", $bizform->title);
        $smarty->assign("rpt_csv_file", basename($tmpfname));
        $smarty->assign("rpt_fields", $rpt_fields);
        $reportContent = $smarty->fetch($this->rptTemplate);

        $tmpRptDsgn = $this->targetReportPath . $uid . ".rptdesign";
        //echo "temp rpt design file is at $tmpRptDsgn.<br>";
        $fp = fopen($tmpRptDsgn, 'w');
        fwrite($fp, $reportContent);
        fclose($fp);

        ob_clean();
        $designFileName = $uid . ".rptdesign";
        $content = "<div style='font-family:Arial; font-size:12px; background-color:#FCFCFC;'>";
        $content .= "Reports can be viewed as ";
        $content .= "<li><a href='".$this->birtViewer."/run?__report=report\\$designFileName' target='__blank'>HTML report</a></li>";
        $content .= "<li><a href='".$this->birtViewer."/run?__report=report\\$designFileName&__format=pdf' target='__blank'>PDF report</a></li>";
        $content .= "<li><a href='".$this->birtViewer."/frameset?__report=report\\$designFileName' target='__blank'>Interactive report</a></li>";
        $content .= "</div>";

        echo $content;
        exit;
    }
public function render ( $ objName ) { // get the current UI bizobj $ bizform = Openbizx :: getObject ( $ objName ) ; // get the existing bizform object $ bizobj = $ bizform -> getDataObj ( ) ; $ h = opendir ( $ this -> targetReportPath ) ; if ( ! $ h ) { echo "cannot read dir " . $ this -> targetReportPath ; exit ; } // create a tmp csv file for hold the data, then feed csv file to report engine $ uid = $ this -> getUniqueString ( ) ; $ tmpfname = $ this -> targetReportPath . $ uid . ".csv" ; //echo "csv file is at $tmpfname.<br>"; $ fp = fopen ( $ tmpfname , 'w' ) ; $ keyList = $ bizform -> recordRow -> GetSortControlKeys ( ) ; $ fieldNames = array ( ) ; foreach ( $ keyList as $ key ) { $ fieldNames [ ] = $ bizform -> GetControl ( $ key ) -> bizFieldName ; } fputcsv ( $ fp , $ fieldNames ) ; $ recList = $ bizobj -> directFetch ( ) ; foreach ( $ recList as $ recArray ) { unset ( $ fieldValues ) ; $ fieldValues = array ( ) ; $ line = "" ; foreach ( $ keyList as $ key ) { $ fieldValues [ ] = $ recArray [ $ bizform -> GetControl ( $ key ) -> bizFieldName ] ; } fputcsv ( $ fp , $ fieldValues ) ; } fclose ( $ fp ) ; $ i = 0 ; foreach ( $ keyList as $ key ) { $ rpt_fields [ $ i ] [ "name" ] = $ bizform -> GetControl ( $ key ) -> bizFieldName ; $ rpt_fields [ $ i ] [ "type" ] = $ bizobj -> getField ( $ rpt_fields [ $ i ] [ "name" ] ) -> type ; $ i ++ ; } // dataobj.rptdesign.tpl // $rpt_data_dir, $rpt_title, $rpt_csv_file, $rpt_fields[](name,type) $ smarty = TemplateHelper :: getSmartyTemplate ( ) ; $ smarty -> assign ( "rpt_data_dir" , $ this -> targetReportPath ) ; $ smarty -> assign ( "rpt_title" , $ bizform -> title ) ; $ smarty -> assign ( "rpt_csv_file" , basename ( $ tmpfname ) ) ; $ smarty -> assign ( "rpt_fields" , $ rpt_fields ) ; $ reportContent = $ smarty -> fetch ( $ this -> rptTemplate ) ; $ tmpRptDsgn = $ this -> targetReportPath . $ uid . ".rptdesign" ; //echo "temp rpt design file is at $tmpRptDsgn.<br>"; $ fp = fopen ( $ tmpRptDsgn , 'w' ) ; fwrite ( $ fp , $ reportContent ) ; fclose ( $ fp ) ; ob_clean ( ) ; $ designFileName = $ uid . ".rptdesign" ; $ content = "<div style='font-family:Arial; font-size:12px; background-color:#FCFCFC;'>" ; $ content .= "Reports can be viewed as " ; $ content .= "<li><a href='" . $ this -> birtViewer . "/run?__report=report\\$designFileName' target='__blank'>HTML report</a></li>" ; $ content .= "<li><a href='" . $ this -> birtViewer . "/run?__report=report\\$designFileName&__format=pdf' target='__blank'>PDF report</a></li>" ; $ content .= "<li><a href='" . $ this -> birtViewer . "/frameset?__report=report\\$designFileName' target='__blank'>Interactive report</a></li>" ; $ content .= "</div>" ; echo $ content ; exit ; }
render the report output

@param string $objName object name which is the bizform name
@return void
render the report output