public function actionUpdate($id) {
$model = $this->loadModel($id);
$paziente = $model->ccIdFk->paziente->shortName;
//metto post_progetto per gestire l'arrivo dei dati.
if (isset($_POST['Progetto'])) {
//blabla
}
$this->render('update', array(
'model' => $model
));
}
la mia view update
<?php
/**
* update.php
* @version 1.0 28/02/2013
* @package Progetti
* @subpackage views/genereale/
* @author Pasquale Pellicani
* @author Emanuele Ferrarini <emanuele.ferrarini@gmail.com>
*
*/
/* @var $this DefaultController */
/* @var $model Proroga */
?>
<?php
$this->breadcrumbs = array(
'Pazienti' => array('/pazienti'),
$model->ccIdFk->paziente->anagrafica->nomeCompleto => array('/pazienti/generale/cartelle&id=' . $model->ccIdFk->pz_fk_id),
'Cartella num ' . $model->ccIdFk->cc_codice=> array('/cartelleCliniche/&id='.$model->cc_id_fk)
);
$cartellaClinica = $model->ccIdFk->cc_codice;
$cognomePaziente = $model->ccIdFk->paziente->cognome;
$nomePaziente = $model->ccIdFk->paziente->nome;
?>
<h1>Aggiornamento proroga della Cart. clinica n.
<?php echo $cartellaClinica.' di '.$cognomePaziente.' '.$nomePaziente;?></h1>
<?php echo $this->renderPartial('viewPerForm',
array(
'model'=>$model
)); ?>
e la view partial
<?php
/**
* view.php
* @version 1.0 28/02/2013
* @package progetti
* @subpackage views/proroga
* @author Pasquale Pellicani
* @author Emanuele Ferrarini <emanuele.ferrarini@gmail.com>
*
*/
/* @var $this ProgettoController */
/* @var $model Proroga */
isset($update) ? $update = 1 : $update = 0;
?>
<div class="form" style="padding:2em;">
<?php
CHtml::$afterRequiredLabel = '';
$form = $this->beginWidget('CActiveForm', array(
'id' => 'proroga-form',
'enableAjaxValidation' => false,
));
Yii::app()->getClientScript()->registerScript('tastoInvioDisabilitato', '
$("form").keypress(function (evt) {
//Deterime where our character code is coming from within the event
var charCode = evt.charCode || evt.keyCode;
if (charCode == 13) { //Enter key\'s keycode
return false;
}
});
', CClientScript::POS_READY);
?>
<div class="block-content">
<h1>Modifica Proroga</h1>
<?php $this->renderPartialPerTipologia('_panelform') ?>
<?php $this->renderPartialPerTipologia('_fase_form', array('model' => $model, 'update' => $update, 'form' => $form)); ?>
<?php $this->renderPartialPerTipologia('_diagnosi_form', array('model' => $model, 'update' => $update, 'form' => $form)); ?>
<?php $this->renderPartialPerTipologia('_trattamenti_form', array('model' => $model, 'update' => $update, 'form' => $form)); ?>
<?php $this->renderPartialPerTipologia('_equipe_form', array('model' => $model, 'update' => $update, 'form' => $form)); ?>
<?php $this->renderPartialPerTipologia('_test_form', array('model' => $model, 'update' => $update, 'form' => $form)); ?>
<?php $this->renderPartialPerTipologia('_obiettivi_form', array('model' => $model, 'update' => $update, 'form' => $form)); ?>
<?php $this->renderPartialPerTipologia('_note_form', array('model' => $model, 'update' => $update, 'form' => $form)); ?>
</div>
<!-- BUTTON -->
<div class="b" style="margin-bottom:2em;margin-top:2em;">
<center><a name="end"></a>
<?php echo CHtml::submitButton('Aggiorna', array('class' => 'big-button')); ?>
</center>
</div>
<?php $this->endWidget(); ?>
</div>
<script>
var div = $('.controls-buttons');
var start_top = $(div).offset().top;
var start_right = $(div).offset().left-150;
$.event.add(window, "scroll", function() {
var p = $(window).scrollTop();
$(div).css('position', ((p) > start_top) ? 'fixed' : 'static');
$(div).css('top', ((p) > start_top) ? '0px' : '');
$(div).css('left', ((p) > start_top) ? start_right : '');
$(div).css('z-index', 999990);
});
</script>