本文整理汇总了PHP中Persona::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Persona::model方法的具体用法?PHP Persona::model怎么用?PHP Persona::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Persona
的用法示例。
在下文中一共展示了Persona::model方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
/**
* 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));
}
示例2: array
?>
<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>
示例3: array
<?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');
示例4: array
</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>
示例5: actionBuscarAjax
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();
}
示例6: actionIndex
public function actionIndex()
{
$listaPersonas=Persona::model()->findAll();
$this->render('index', array('personas'=>$listaPersonas));
}
示例7: loadModel
/**
* 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;
}
示例8: array
<?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(); ?>
示例9: actionUpdate
/**
* 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));
}
示例10:
?>
<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 />
*/
?>