[Yii2]Config mailer gmail

Maret 29, 2018

sebagai catatan aja sih, pakai akun gmail buat reset password di Yii settingnya seperti ini di config,


...

'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => 'username@gmail.com',
'password' => 'passwordnya',
'port' => '465',
'encryption' => 'ssl', //SSL
'streamOptions' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
]
],

Iklan

[TIPS] Menambahkan Export Excel dan PDF di widget Datatables Yii2

Februari 24, 2018

sama seperti tips sebelumnya saya masih pakai https://github.com/fedemotta/yii2-widget-datatables sebagain extension pengganti grdiview Yii2 selain kartik, OK langsung aja,sesuai readme nya di untuk export bisa tambahkan


<span class="pl-s1"><span class="pl-s"><span class="pl-pds">"</span>tableTools<span class="pl-pds">"</span></span><span class="pl-k">=></span>[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>aButtons<span class="pl-pds">"</span></span><span class="pl-k">=></span> [ </span> <span class="pl-s1"> [</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>copy<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Copy to clipboard<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>csv<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Save to CSV<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>xls<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>oSelectorOpts<span class="pl-pds">"</span></span><span class="pl-k">=></span> [<span class="pl-s"><span class="pl-pds">"</span>page<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">'</span>current<span class="pl-pds">'</span></span>]</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>pdf<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Save to PDF<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>print<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Print<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],</span> <span class="pl-s1"> ]</span> <span class="pl-s1"> ]
</span>

eh nyatanya itu not work, krn dia pakai flash, akhirnya saya modify sedikit (ngapus sedikit) dari sintax sebelumnya, awalnya

saya komen di bagian tableTools jadi

selanjutnya kita tambahakan js dan css di file appasset.php ,
button export dari datatable https://datatables.net/extensions/buttons/examples/initialisation/export.html

public $css = [
'css/site.css',
' https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css',
'https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css',
];
public $js = [
'js/FileSaver.js',
' https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js',
'https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js',
'https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js',
'https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js',
'https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js',
];

terus di confignya widget datatable

Ok sudah tampilnya jd gini deh

 


[TIPS] Penggunaan Widget Datatables Yii

Februari 13, 2018

sebagai catatan kecil, awal saya menggunakan gridview dari kartik,krn client terbiasa melihat grid dari datatables, akhirnya saya ikuti krn Yii juga bisa ketemulah widget di github https://github.com/fedemotta/yii2-widget-datatables , saya pakai sesuai kebutuhan, responsif juga OK , tipsnya

# datatables secara default ga responsive tp bisa ditambahkan cdn responsive dr datables disini https://cdn.datatables.net/responsive/2.2.1/

# jika ingin hanyar render datatablesnya gunakan renderAjax() bukan renderPartial

#jika ingin gunakan Pjax sebagai reload grid dan editable dari kartik (https://github.com/kartik-v/yii2-editable) ,otomatis penggunaan gridnya juga harus gridview empu kartik,  na dari itu saya sedikit edit widget class extendnya saya arahkan ke gridview kartik, seterusnya pjax di kartik harus false , gunakan pjax bawaan Yii, contoh


Pjax::begin(['id'=>'list_data'])

datatables

Pjax::end()

,

na untuk editable jika sudah submit data, agar reload, tambahakn ini


'editableOptions' => [

... ... ...

'pjaxContainerId'=>'list_data',
'pluginEvents' => [
'editableSuccess' => "function(event, val, form, data) {"
. " getdata() }",
],

],

getData sendiri ada function yg isinya  jQuery.pjax.reload({container: ‘#list_data’});


[Jasa] Sms Gateway foxpro

Desember 19, 2017

kalau mau aplikasi dekstop sms gateway foxpro, saya jual contohnya baik penggunaan At Command, kelebihan pakai At Command bisa semua modem bisa pakai database apapun termasuk dbf , bisa membaca dan mengirim sms baik kurang dari 160 karakter bisa juga lebih dari 160 karakter, kalau mau modify bisa pakai timer untuk autoreply

hubungi saya di WA : 081311212216


Tips – Trik Desain Laporan di PHP

Juni 28, 2017

Sesuai judul deh, saya ada kasus nih desain laporan di PHP, pake HTML enaknya yaa kan kebetulan saya pake Mpdf, yang ribet dari php ini adalah bikin laporan (menurut saya sih) karena harus berkutat di tag tr,td, collspan,rowspan kadang saya males , saya sempat mikir ada ga yang drag drop HTML kaya DW, lamaaaa sudah berkutat tr td buat bikin repot akhirnya saya punya alternatif biar mempercepat kerjaan tanpa mikir sususan tag table dan kawan kawannya apalgi pake Css biar pas sesuai permintaan klient, contoh kaya digambar ini

berikut caranya Baca entri selengkapnya »