public function actionInforme() { if ($_POST["start"]) { set_time_limit(600); # mPDF $pdf = Yii::app()->ePdf->mpdf('', 'A4', '', '', '', '', '', '', '', '', 'P'); $pdf->writeHTMLfooter = false; $pdf->writeHTMLheader = false; $pdf->DeflMargin = 5; $pdf->DefrMargin = 5; $pdf->tMargin = 5; $pdf->bMargin = 5; $pdf->w = 297; //manually set width $pdf->h = 209.8; //manually set height # render (full page) $pdf->WriteHTML($this->renderPartial('_cover', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_temperature', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_storage', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_clean', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_oil', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_rats', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_chlorine', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_verification', array(), true)); $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_verification2', array(), true)); // Custom controls $criteria = new CDbCriteria(); $criteria->condition = "UserID = :userid"; $criteria->params = array(':userid' => Yii::app()->user->ID); $modelControls = Control::model()->findAll($criteria); if (count($modelControls) > 0) { foreach ($modelControls as $control) { $pdf->Addpage(); $pdf->WriteHTML($this->renderPartial('_control', array('model' => $control), true)); } } # Outputs ready PDF $pdf->Output('APPC_' . date("d/m/Y") . '.pdf', 'D'); } else { $this->render('selector'); } }
public function Top($num) { $criteria = new CDbCriteria(); $criteria->condition = "UserID = :userid"; $criteria->params = array(':userid' => Yii::app()->user->ID); $criteria->limit = $num; $model = Control::model()->findAll($criteria); $result = ""; $result .= "<table cellpadding='5' cellspacing='0' border='0' style='border-collapse: collapse;'>"; $result .= "<tr><td><b>Punto critico</b></td><td><b>Control</b></td></tr>"; foreach ($model as $customer) { $result .= "<tr>"; $result .= "<td><a href='" . Yii::app()->createURL('/APPC/point/update/', array('id' => $customer->ID)) . "'>" . Functions::stringCut($customer->point->Name, 25) . "</a></td>"; $result .= "<td><a href='" . Yii::app()->createURL('/APPC/point/update/', array('id' => $customer->ID)) . "'>" . Functions::stringCut($customer->Name, 25) . "</a></td>"; $result .= "</tr>"; } $result .= "</table>"; return $result; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Control::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<td><b>Fecha de comienzo:</b></td><td><?php echo date("d/m/Y", strtotime($model->Startdate)); ?> </td> <td><b>Fecha de finalizacion:</b></td><td><?php echo date("d/m/Y", strtotime($model->Enddate)); ?> </td> </tr> <tr> <td><b>Empleado:</b></td><td><?php echo $model->worker->Fullname; ?> </td> <td><b>Frecuencia:</b></td><td><?php echo Control::model()->giveFrecuency($model->Frecuency); ?> </td> </tr> <tr> <td colspan="4"> </td> </tr> <tr> <td colspan="4"><b>Tarea:</b></td> </tr> <tr> <td colspan="4"><?php echo $model->Task; ?> </td> </tr>