Пример #1
0
<?php $form=$this->beginWidget('booster.widgets.TbActiveForm',array(
	'id'=>'conductor-form',
	'enableAjaxValidation'=>true,
	'type' => 'horizontal',
    'htmlOptions' => array('class' => 'well', 'enctype' => 'multipart/form-data'),
)); ?>

<?php if (!$model->isNewRecord) {
	$modelFamiliares = Familiar::model()->findByPk($model->id_persona);
}?>

<?php
	if ($model->isNewRecord) {
		$user = Yii::app()->getComponent('user');
		$user->setFlash('info','<strong>¡Atento!</strong> Antes de agregar a un <em>Conductor</em>, 
			debes agregarlo a <strong><em>' . CHtml::link('Persona', array('/persona/create')) . 
			'</em></strong>.');

		$this->widget('booster.widgets.TbAlert', array(
		    'fade' => true,
		    'closeText' => '¡ENTENDIDO!', // false equals no close link
		    'userComponentId' => 'user',
		));
	}
?>

<p class="help-block">Campos con (<span class="required">*</span>) son requeridos.</p>

<?php echo $form->errorSummary(array($model, $modelFamiliares)); ?>
	
	<?php if ($model->isNewRecord) : ?>
 /**
  * Muestra el PDF de el Detalle de Conductor.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionVerConductor($id)
 {
     $this->layout = "//layouts/pdf";
     $mPDF1 = Yii::app()->ePdf->mpdf('c', 'LETTER-P');
     $model = $this->loadModel($id);
     $modelFamiliares = Familiar::model()->findByPk($this->loadModel($id)->id_persona);
     $mPDF1->WriteHtml($this->render('pdf/view_con_pdf', array('model' => $model, 'modelFamiliares' => $modelFamiliares), true));
     $mPDF1->Output($model->id . ".pdf", 'I');
 }
 /**
  * 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 $id the ID of the model to be loaded
  * @return Familiar the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Familiar::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }