public function verificaestado($id, $idevento) { //sacando el estado de la guia,si no necuentra datos genera error $modelosolpe = $this->loadmodel($id); $estado = $modelosolpe->estado; $evento = Eventos::model()->findByPk($idevento); if ($evento->estadoinicial == $estado) { //si el estado es el adecuado return $evento->estadofinal; //devolver el nuevo estado ya que es valido } else { return null; //en caso de no proceder devolver null } }
<div class="wide form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'coti-form', 'enableClientValidation' => false, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true), 'enableAjaxValidation' => true)); ?> <?php echo $form->errorSummary($model); ?> <?php //construyendo el array de las opciones del menu en base al array de los eventos segun el estado actual del dccumento $acciones = Eventos::model()->findAll("codocu='" . $model->coddocu . "' AND estadoinicial= '" . $model->codestado . "' "); $botones = array(); $aux = array(); foreach ($acciones as $clave => $valor) { $aux = array('label' => $valor['descripcion'], 'icon-position' => 'left', 'icon' => 'check', 'url' => array('procesarguia', 'id' => $model->idguia, 'ev' => $valor['id'])); //pasando los parametros id guia e id evento para procesar array_push($botones, $aux); $aux = array(); } $this->widget('ext.JuiButtonSet.JuiButtonSet', array('items' => $botones, 'htmlOptions' => array('style' => 'clear: both;'))); ?> <?php $this->widget('zii.widgets.jui.CJuiTabs', array('tabs' => array('Inicio' => array('id' => 'tab_motorycaja', 'content' => $this->renderPartial('tab_uno', array('form' => $form, 'model' => $model), TRUE)), 'Comerciales' => array('id' => 'tab_motorycaja2', 'content' => $this->renderPartial('tab_dos', array('form' => $form, 'model' => $model), TRUE)), 'Adicionales' => array('id' => 'tab_motorycaja3', 'content' => $this->renderPartial('tab_tres', array('form' => $form, 'model' => $model), TRUE))), 'options' => array('collapsible' => false), 'id' => 'MyTabi')); ?>
/** * 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 Eventos the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Eventos::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
$datos = CHtml::listData(Documentos::model()->findAll(array('order' => 'desdocu')), 'coddocu', 'desdocu'); echo $form->DropDownList($model, 'codocu', $datos, array('empty' => '--Seleccione un documento--')); ?> <?php echo $form->error($model, 'codocu'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'idevento'); ?> <?php $datos = CHtml::listData(Eventos::model()->findAll("codocu='101'"), 'id', 'descripcion'); echo $form->DropDownList($model, 'idevento', $datos, array('empty' => '--Seleccione un evento--')); ?> <?php echo $form->error($model, 'idevento'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'codigo_objeto'); ?>