Esempio n. 1
0
 /**
  * Lists all Indikator models.
  * @return mixed
  */
 public function actionIndex($tgl)
 {
     $searchModel = new IndikatorSearch(['TGL' => $tgl]);
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $dataProvider->getSort()->defaultOrder = ['updated_at' => SORT_DESC, 'created_at' => SORT_DESC];
     if (Yii::$app->request->isAjax) {
         return $this->renderAjax('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     } else {
         return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     }
 }
Esempio n. 2
0
 public function actionExportPdfDetail($tgl)
 {
     $dates = $this->getDates($tgl);
     $asset = Asset::find()->where(['TGL' => $dates[0]])->one();
     $assetat = Assetat::find()->where(['TGL' => $dates[2]])->one();
     $searchModel = new IndikatorSearch(['TGL' => $tgl]);
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $html = $this->renderPartial('_detail_pdf', ['asset' => $asset, 'assetat' => $assetat, 'dataProvider' => $dataProvider, 'dates' => $dates]);
     //function mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P') {
     $mpdf = new \mPDF('c', 'A4', 0, '', 15, 10, 15, 10, 10, 10);
     $header = ['L' => ['content' => date('d-M-Y H:i:s'), 'font-family' => 'sans', 'font-style' => '', 'font-size' => '9'], 'C' => [], 'R' => ['content' => 'Page {PAGENO} of {nbpg}', 'font-family' => 'sans', 'font-style' => '', 'font-size' => '9'], 'line' => 1];
     $mpdf->SetFooter($header, 'O');
     $mpdf->SetDisplayMode('fullpage');
     $mpdf->list_indent_first_level = 0;
     // 1 or 0 - whether to indent the first level of a list
     $mpdf->WriteHTML($html);
     $mpdf->Output($this->id . '_' . date('YmdHis') . '.pdf', 'D');
     exit;
 }