Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Escuelas::find();
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['escuela' => $this->escuela]);
     $query->andFilterWhere(['=', 'idescuela', $this->idescuela]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if ($this->idescuela != '') {
         return $dataProvider;
     } else {
         return true;
     }
 }
Esempio n. 2
0
 public function actionImprimir()
 {
     // get your HTML raw content without any layouts or scrip
     $Escuelas = Escuelas::find()->all();
     $content = $this->renderPartial('_imprimir', ['Escuelas' => $Escuelas]);
     $header = $this->renderPartial('_header', ['Escuelas' => $Escuelas]);
     $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]);
     // return the pdf output as per the destination setting
     return $pdf->render();
 }