archives

Archive for

Mencetak Laporan dengan mprint in Yii Framework

mprint sebuah ekstensi di Yii Framework yang dibuat oleh http://www.bennadel.com, ekstensi ini bisa di download di http://www.yiiframework.com/forum/index.php?app=core&module=attach&section=attach&attach_id=1373 atau http://www.yiiframework.com/extension/mprint/.
setelah di download, ekstrak di bawah direktori protected/extension/
setelah di ekstrak langkah terakhir adalah buat file di view/nama-modelnya/laporan.php

<?php
$this->breadcrumbs=array(
'Hunian'=>array('index'),
'Manage',
);

Yii::app()->clientScript->registerScript(‘search’, ”
$(‘.search-button’).click(function(){
$(‘.search-form’).toggle();
return false;
});
$(‘.search-form form’).submit(function(){
$.fn.yiiGridView.update(‘hunian-grid’, {
data: $(this).serialize()
});
return false;
});
“);
?>

<h1>Laporan Hunian</h1>

<?php
$this->widget(‘ext.mPrint.mPrint’, array(
‘title’ => ‘Laporan Hunian’,          //the title of the document. Defaults to the HTML title
‘tooltip’ => ‘Print’,        //tooltip message of the print icon. Defaults to ‘print’
‘text’ => ‘Print Hunian’,   //text which will appear beside the print icon. Defaults to NULL
‘element’ => ‘#page’,        //the element to be printed.
‘exceptions’ => array(       //the element/s which will be ignored
‘.summary’,
‘.search-form’,
‘.breadcrumbs’,
‘.ddsmoothmenu’,
‘.yiiPager’,
‘.footer’,
),
‘publishCss’ => true,       //publish the CSS for the whole page?
//’visible’ => Yii::app()->user->checkAccess(‘print’),  //should this be visible to the current user?
// ‘alt’ => ‘print’,       //text which will appear if image can’t be loaded
// ‘debug’ => true,            //enable the debugger to see what you will get
‘id’ => ‘print-div’         //id of the print link
));
?>
—–isi sesuai dengan grid anda—–

Advertisements