[SOLVED]integrating CI (php+java = reports)

#1
[eluser]kikz4life[/eluser]
is it possible in CI to work php + java . I'm trying to build a report using php but to display its format(html or xls, etc..) i used some java codes inside the php file and it works Smile but when i tried to CI a FATAL ERROR occured. Sad. I just used controller and the view for this.
My view.php
Code:
$myReport = "receipt_report2.rptdesign";

// load resources, .rpt files and images from the current working dir
$here = getcwd();

$ctx = java_context()->getServletContext();
$birtReportEngine =        java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook());


// Create a HTML render context
$renderContext = new java ("org.eclipse.birt.report.engine.api.HTMLRenderContext");
$renderContext->setBaseImageURL("$here/images");
$contextMap = new java("java.util.HashMap");
$CONTEXT = java("org.eclipse.birt.report.engine.api.EngineConstants")->APPCONTEXT_HTML_RENDER_CONTEXT;
$contextMap->put($CONTEXT, $renderContext );


// Load the report design
$design = $birtReportEngine->openReportDesign("${here}/${myReport}");
$task = $birtReportEngine->createRunAndRenderTask( $design );
$task->setAppContext( $contextMap );

// Add HTML render options
$options = new java("org.eclipse.birt.report.engine.api.HTMLRenderOption");
$options->setOutputFormat($options->OUTPUT_FORMAT_HTML);

// Create the output
$out = new java("java.io.ByteArrayOutputStream");
$options->setOutputStream($out);
$task->setRenderOption($options);
$task->run ();
$task->close();

// Return the generated output to the client
echo (string)$out;

also is it possible to call the myview outside CI directory but using the CI controller?

thanks

#2
[eluser]kikz4life[/eluser]
finally solved it.

#3
[eluser]Unknown[/eluser]
[quote author="kikz4life" date="1258700081"]finally solved it.[/quote]

hi kikz4life ..

how u solved it ??

I at the same trouble ..

Thx alot before ..

regards

#4
[eluser]kikz4life[/eluser]
just used html frames in the view then call it to your controller.

cheers


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.