- Beranda
- Templates & Scripts Stuff
Zend Framework Lounge
...
![okzfaruoqi](https://s.kaskus.id/user/avatar/2010/03/20/default.png)
![Avatar border](https://s.kaskus.id/images/avatarborder/1.gif)
TS
okzfaruoqi
Zend Framework Lounge
Zend Framework
Rule in here:
e book Zend Framework yang ane punya:
tambahan lagi video tutorial integrasi ZF ma netbeans gan,jdi editornya netbeans :
download Zend Framework :
Langkah Langkah menguasai Zend Framework :
Index Tutorial
regards...
*nb : tolong rate ya gan biar tambah awet ne lapak ...
![thumbsup emoticon-thumbsup](https://s.kaskus.id/images/smilies/sumbangan/47.gif)
*thanks juga yg udh ngasih ijo ...![thumbsup emoticon-thumbsup](https://s.kaskus.id/images/smilies/sumbangan/47.gif)
![Big Grin emoticon-Big Grin](https://s.kaskus.id/images/smilies/sumbangan/14.gif)
![Zend Framework Lounge](https://dl.kaskus.id/framework.zend.com/images/head-bottom-picture.png)
Quote:
Rule in here:
Spoiler for "Rule":
Quote:
e book Zend Framework yang ane punya:
Quote:
tambahan lagi video tutorial integrasi ZF ma netbeans gan,jdi editornya netbeans :
Quote:
Quote:
download Zend Framework :
Quote:
Langkah Langkah menguasai Zend Framework :
Quote:
Quote:
Index Tutorial
Quote:
Quote:
regards...
*nb : tolong rate ya gan biar tambah awet ne lapak ...
![thumbsup emoticon-thumbsup](https://s.kaskus.id/images/smilies/sumbangan/47.gif)
*thanks juga yg udh ngasih ijo ...
![thumbsup emoticon-thumbsup](https://s.kaskus.id/images/smilies/sumbangan/47.gif)
![Big Grin emoticon-Big Grin](https://s.kaskus.id/images/smilies/sumbangan/14.gif)
![Zend Framework Lounge](https://dl.kaskus.id/framework.zend.com/images/head-bottom-picture.png)
0
47.4K
1.1K
![Guest](https://s.kaskus.id/user/avatar/default.png)
![Avatar border](https://s.kaskus.id/images/avatarborder/1.gif)
Komentar yang asik ya
Mari bergabung, dapatkan informasi dan teman baru!
![Templates & Scripts Stuff](https://s.kaskus.id/r200x200/ficon/image-442.png)
Templates & Scripts Stuff![KASKUS Official KASKUS Official](https://s.kaskus.id/kaskus-next/next-assets/images/icon-official-badge.svg)
2.5KThread•681Anggota
Tampilkan semua post
![PusHm0v](https://s.kaskus.id/user/avatar/2005/12/19/default.png)
![Avatar border](https://s.kaskus.id/images/avatarborder/1.gif)
PusHm0v
#142
Make Jasper Report dengan Zend Framework
Coba sharing gimana make/manggil jasper dari Zend dengan library PHPJavaBridge ![Smilie emoticon-Smilie](https://s.kaskus.id/images/smilies/sumbangan/15.gif)
untuk output excel menurut ane masih kurang bagus, soalna kalo kita design di iReport antar objek (textbox, label, etc) gak dirapet2in ntar ada row/kolom yg digabung/merge otomatis ma si jasper. Walopun kita dah pake option IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS n IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS pas compile report...
CMIIW![Smilie emoticon-Smilie](https://s.kaskus.id/images/smilies/sumbangan/15.gif)
![Smilie emoticon-Smilie](https://s.kaskus.id/images/smilies/sumbangan/15.gif)
![Smilie emoticon-Smilie](https://s.kaskus.id/images/smilies/sumbangan/15.gif)
PHP Code:
class JasperController extends Zend_Controller_Action
{
private $reportPath;
private $javaOutputStream;
private $dbhost,$dbname,$dbuser,$dbpass;
public function init()
{
$options = $this->getInvokeArg('bootstrap'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>->getOptions();
$this->reportPath = $options['jasper']['reportPath']; //directory/folder file jasper ( .jrmxl )
$this->javaBridge = $options['jasper']['javaBridge']; //directory / folder library PHP JavaBridge
$this->dbhost = $options['resources']['db']['params']['host']; //hostname database
$this->dbname = $options['resources']['db']['params']['dbname']; //nama database
$this->dbuser = $options['resources']['db']['params']['username']; //user database
$this->dbpass = $options['resources']['db']['params']['password']; //password database
include_once($this->javaBridge."java/Java.inc");
$this->javaOutputStream = new java("java.io.ByteArrayOutputStream");
}
private function getParam($params)
{
$newParam = new Java("java.util.HashMap");
foreach ($params as $param => $value)
{
$newParam->put($param, $value);
}
$newParam->put('SUBREPORT_DIR',$this->reportPath);
return $newParam;
}
private function getReport($type='pdf',$params,$filename='report.jrmxl',$outputname='report'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>
{
try
{
$Conn = new Java("org.altic.jasperReports.JdbcConnection");
$Conn->setDriver("com.mysql.jdbc.Driver");
$Conn->setConnectString("jdbc:mysql://" . $this->dbhost . "/" . $this->dbname);
$Conn->setUser($this->dbuser);
$Conn->setPassword($this->dbpass);
$arrayParam = $this->getParam($params);
$compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager");
$report = $compileManager->compileReport($this->reportPath . $filename);
$fillManager = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
$jasperPrint = $fillManager->fillReport($report, $arrayParam,$Conn->getConnection());
$outputPath =$this->reportPath . $outputname . '.' . $type;
set_time_limit(120);
java_set_file_encoding("ISO-8859-1");
if ($type == 'pdf'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>
{
$exporter = new java("net.sf.jasperreports.engine.export.JRPdfExporter");
$exParm = java("net.sf.jasperreports.engine.JRExporterParameter");
$exporter->setParameter($exParm->JASPER_PRINT, $jasperPrint);
$exporter->setParameter($exParm->OUTPUT_STREAM, $this->javaOutputStream);
$exporter->exportReport();
header('Content-Type: application/pdf'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Content-Transfer-Encoding: binary'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Content-disposition: attachment; filename="'.$outputname.'.pdf"'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Pragma: no-cache'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Expires: 0'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
echo java_cast($this->javaOutputStream->toByteArray(),"S");
}
elseif ($type == 'xls'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>
{
$exporter = new java("net.sf.jasperreports.engine.export.JExcelApiExporter");
$exParm = java("net.sf.jasperreports.engine.JRExporterParameter");
$exXlsParm = java("net.sf.jasperreports.engine.export.JRXlsExporterParameter");
$exporter->setParameter($exParm->JASPER_PRINT, $jasperPrint);
$exporter->setParameter($exParm->OUTPUT_STREAM, $this->javaOutputStream);
$exporter->setParameter($exXlsParm->IS_ONE_PAGE_PER_SHEET, false); //Continues, semua data di 1 worksheet
$exporter->setParameter($exXlsParm->IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, true); //Ilangin space diantara baris, biasana mengakibatkan row gak rapet2 di excel
$exporter->setParameter($exXlsParm->IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, true); //Idem, tapi buat kolom
$exporter->setParameter($exXlsParm->IS_DETECT_CELL_TYPE, true); //Otomatis detek type cell (numerik, string, etc)
$exporter->setParameter($exXlsParm->IS_WHITE_PAGE_BACKGROUND, false);
$exporter->exportReport();
header('Content-Type: application/xls'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Content-Transfer-Encoding: binary'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Content-disposition: attachment; filename="'.$outputname.'.xls"'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Pragma: no-cache'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
header('Expires: 0'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>;
echo java_cast($this->javaOutputStream->toByteArray(),"S");
}
}
catch( JavaException $e)
{
echo $e;
}
}
public function cetakreportAction()
{
$this->_helper->viewRenderer->setNoRender(); //gak pake view
$type = 'pdf'; //output sebagai file PDF, kalo Excel tinggal ganti pake 'xls'
$params = array('param1' => 'parameter ke 1'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>; //parameter buat si report <img src="https://s.kaskus.id/images/smilies/sumbangan/15.gif" data-sceditor-emoticon=":)" border="0" alt="emoticon-Smilie" title="Smilie"/>
$this->getReport($type,$params,'boq3.jrxml','boq3'<img src="https://s.kaskus.id/images/smilies/sumbangan/13.gif" data-sceditor-emoticon=";)" border="0" alt="emoticon-Wink" title="Wink"/>; //boq3.jrxml adalah nama file jasper/ireport
}
}
untuk output excel menurut ane masih kurang bagus, soalna kalo kita design di iReport antar objek (textbox, label, etc) gak dirapet2in ntar ada row/kolom yg digabung/merge otomatis ma si jasper. Walopun kita dah pake option IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS n IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS pas compile report...
CMIIW
![Smilie emoticon-Smilie](https://s.kaskus.id/images/smilies/sumbangan/15.gif)
![Smilie emoticon-Smilie](https://s.kaskus.id/images/smilies/sumbangan/15.gif)
0