/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $user = Usuario::model()->findbyPk(Yii::app()->user->getId()); $acceso = Usuario::privilegiado($user->rol_id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Responsable'])) { $model->attributes = $_POST['Responsable']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $status = BmStatus::model()->findAll(); $personas = Persona::model()->listAll(); $this->render('update', array('model' => $model, 'status' => $status, 'personas' => $personas, 'acceso' => $acceso)); }
?> <div id="flashMsg" class="flash-messages"> </div> <div class="widget blue"> <div class="widget-title"> <h4> <i class="icon-fire-extinguisher"></i> <?php echo Yii::t('AweCrud.app', 'Manage'); ?> <?php echo FaltasEstudiante::label(2); ?> </h4> <span class="tools"> <a href="javascript:;" class="icon-chevron-down"></a> <!--a href="javascript:;" class="icon-remove"></a--> </span> </div> <div class="widget-body"> <?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'faltas-estudiante-grid', 'type' => 'striped bordered hover advance', 'dataProvider' => $model->search(), 'columns' => array('NRO_FALTAS', 'TOTAL_DIAS_CURSO', array('name' => 'PERSONA_ID', 'value' => 'isset($data->pERSONA) ? $data->pERSONA : null', 'filter' => CHtml::listData(Persona::model()->findAll(), 'ID', Persona::representingColumn())), array('name' => 'CURSO_EDICION_ID', 'value' => 'isset($data->cURSOEDICION) ? $data->cURSOEDICION : null', 'filter' => CHtml::listData(CursoEdicion::model()->findAll(), 'ID', CursoEdicion::representingColumn())), array('class' => 'CButtonColumn', 'template' => '{update} {delete}', 'afterDelete' => 'function(link,success,data){ if(success) { $("#flashMsg").empty(); $("#flashMsg").css("display",""); $("#flashMsg").html(data).animate({opacity: 1.0}, 5500).fadeOut("slow"); } }', 'buttons' => array('update' => array('label' => '<button class="btn btn-primary"><i class="icon-pencil"></i></button>', 'options' => array('title' => 'Actualizar'), 'imageUrl' => false), 'delete' => array('label' => '<button class="btn btn-danger"><i class="icon-trash"></i></button>', 'options' => array('title' => 'Eliminar'), 'imageUrl' => false)), 'htmlOptions' => array('width' => '80px'))))); ?> </div> </div>
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'trabajador-form', 'enableAjaxValidation' => false)); ?> <p class="note">Campos marcados con <span class="required">*</span> son obligatorios.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo '<b>Cedula</b><br/>'; ?> <?php echo $form->dropDownList($model, 'Persona_idPersona', CHtml::listData(Persona::model()->findAll(), 'idPersona', 'Cedula'), array('empty' => 'Seleccione una persona por su cédula')); ?> <?php echo $form->error($model, 'Persona_idPersona'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'Nacionalidad'); ?> <?php echo $form->dropDownList($model, 'Nacionalidad', array('' => '', 'V' => 'Venezolano', 'E' => 'Extranjero')); ?> <?php echo $form->error($model, 'Nacionalidad');
</h4> <span class="tools"> <a href="javascript:;" class="icon-chevron-down"></a> <!--a href="javascript:;" class="icon-remove"></a--> </span> </div> <div class="widget-body"> <?php echo $form->textFieldRow($model, 'NOTA'); ?> <?php echo $form->dropDownListRow($model, 'PERSONA_ID', array('' => ' -- Seleccione -- ') + CHtml::listData(Persona::model()->findAll(), 'ID', Persona::representingColumn())); ?> <?php echo $form->dropDownListRow($model, 'CURSO_EDICION_ID', array('' => ' -- Seleccione -- ') + CHtml::listData(CursoEdicion::model()->findAll(), 'ID', CursoEdicion::representingColumn())); ?> </div> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'success', 'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'))); ?> <?php $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('AweCrud.app', 'Cancel'), 'htmlOptions' => array('onclick' => 'javascript:history.go(-1)'))); ?> </div> </div>
public function actionBuscarAjax() { if (isset($_POST['cedula']) && $_POST['cedula'] != NULL) { $cedula = $_POST['cedula']; $pdata = PersonaData::model()->findByAttributes(array('cedula' => $cedula)); if ($pdata != NULL) { $persona = Persona::model()->find(array('condition' => 'pd.cedula=' . $cedula, 'join' => 'JOIN persona_data as pd ON t.pdata_id = pd.id')); if ($persona != NULL) { echo CJSON::encode(array('value1' => $persona->id, 'value2' => $pdata->nombre, 'value3' => $pdata->profesion_id, 'value4' => $pdata->sexo_id, 'value5' => $persona->dependencia_id, 'value6' => $persona->cargo_id)); } else { echo CJSON::encode(array('value1' => 0, 'value2' => $pdata->nombre, 'value3' => $pdata->profesion_id, 'value4' => $pdata->sexo_id, 'value5' => 0, 'value6' => 0)); } Yii::app()->end(); } } echo CJSON::encode(array('value1' => 0, 'value2' => '', 'value3' => 0, 'value4' => 0, 'value5' => 0, 'value6' => 0)); Yii::app()->end(); }
public function actionIndex() { $listaPersonas=Persona::model()->findAll(); $this->render('index', array('personas'=>$listaPersonas)); }
/** * 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 = Persona::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->labelEx($model, 'CentroSalud_idCentroSalud'); ?> <?php echo $form->dropDownList($model, 'CentroSalud_idCentroSalud', CHtml::listData(CentroSalud::model()->findAll(), 'idCentroSalud', 'Nombre'), array('empty' => 'Seleccione Centro Medico')); ?> <?php echo $form->error($model, 'CentroSalud_idCentroSalud'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'Trabajador_idTrabajador'); ?> <?php echo $form->dropDownList($model, 'Trabajador_idTrabajador', CHtml::listData(Persona::model()->findAll(), 'idPersona', 'Cedula'), array('empty' => 'Cedula de persona involucadra')); ?> <?php echo $form->error($model, 'Trabajador_idTrabajador'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Aceptar' : 'Save'); ?> </div> <?php $this->endWidget(); ?>
<?php echo $form->labelEx($model, 'idPersona');?> <?php echo $form->dropDownList($model,'idPersona',CHtml::listData(Persona::model()->findAll(array('order'=>'idPersona')),'idPersona', 'apellido', 'nombre'),array('empty'=>'Seleccionar..' ));?> <?php echo $form->textFieldRow($model,'legajo',array('class'=>'span5','maxlength'=>20)); ?> <?php echo $form->textFieldRow($model,'lua',array('class'=>'span5')); ?> <?php echo $form->labelEx($model, 'idPadre');?> <?php echo $form->dropDownList($model,'idPadre',CHtml::listData(Persona::model()->findAll(array('order'=>'idPersona')),'idPersona', 'apellido', 'nombre'),array('empty'=>'Seleccionar..' ));?> <?php echo $form->labelEx($model, 'idMadre');?> <?php echo $form->dropDownList($model,'idMadre',CHtml::listData(Persona::model()->findAll(array('order'=>'idPersona')),'idPersona', 'apellido', 'nombre'),array('empty'=>'Seleccionar..' ));?> <?php echo $form->labelEx($model, 'idTutor');?> <?php echo $form->dropDownList($model,'idTutor',CHtml::listData(Persona::model()->findAll(array('order'=>'idPersona')),'idPersona', 'apellido', 'nombre'),array('empty'=>'Seleccionar..' ));?> <?php echo $form->labelEx($model, 'idCliente');?> <?php echo $form->dropDownList($model,'idCliente',CHtml::listData(Persona::model()->findAll(array('order'=>'idPersona')),'idPersona', 'apellido', 'nombre'),array('empty'=>'Seleccionar..' ));?> <?php echo $form->textFieldRow($model,'nombreCompleto')?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array( 'buttonType'=>'submit', 'type'=>'primary', 'label'=>$model->isNewRecord ? 'Crear' : 'Guardar', )); ?> </div> <?php $this->endWidget(); ?>
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { /*$model=$this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if(isset($_POST['FichaMedica'])) { $model->attributes=$_POST['FichaMedica']; if($model->save()) $this->redirect(array('view','id'=>$model->idFicha_Medica)); } $this->render('update',array( 'model'=>$model, ));*/ $model1 = $this->loadModel($id); $model2 = Persona::model()->findByAttributes(array('idPersona' => $model1->idPariente)); if (isset($_POST['FichaMedica'], $_POST['Persona'])) { // populate input data to $a and $b $model1->attributes = $_POST['FichaMedica']; $model2->attributes = $_POST['Persona']; // validate BOTH $a and $b $valid = $model1->validate(); $valid = $model2->validate() && $valid; if ($valid) { $model2->save(false); $model1->idPariente = $model2->idPersona; $model1->save(); } } if (isset($_POST['FichaMedica'], $_POST['Persona'])) { $model1->attributes = $_POST['FichaMedica']; $model2->attributes = $_POST['Persona']; if ($model1->save() && $model2->save()) { $this->redirect(array('view', 'id' => $model1->idFicha_Medica)); } } $this->render('create', array('model2' => $model2, 'model1' => $model1)); }
?> <br /> <b><?php echo 'Cedula'; ?> :</b> <?php echo Persona::model()->find(' idPersona = ' . $data->idPariente)->Cedula; ?> <br /> <b><?php echo 'Telefono'; ?> :</b> <?php echo Persona::model()->find(' idPersona = ' . $data->idPariente)->Telefono; ?> <br /> <?php /* <b><?php echo CHtml::encode($data->getAttributeLabel('idPariente')); ?>:</b> <?php echo CHtml::encode($data->idPariente); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('Parentesco')); ?>:</b> <?php echo CHtml::encode($data->Parentesco); ?> <br /> */ ?>
?> <br /> <b><?php echo 'Nombre'; ?> :</b> <?php echo Persona::model()->find(' idPersona = ' . $data->Persona_idPersona)->Nombre; ?> <br /> <b><?php echo 'Apellido'; ?> :</b> <?php echo Persona::model()->find(' idPersona = ' . $data->Persona_idPersona)->Apellido; ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('Nacionalidad')); ?> :</b> <?php echo CHtml::encode($data->Nacionalidad); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('Sexo')); ?>