<span class="glyphicon glyphicon-plus"></span> </button> </span> </div> </div> </div> <!--medida--> <div class="form-group"> <label class="control-label col-sm-2">Medida *</label> <div class="col-sm-10"> <div class="input-group"> <select name="idMedida" class="form-control" tabindex="4" required> <option value="">Selecione uma opção...</option> <?php $medidas = Medida::findAll(); ?> <?php foreach ($medidas as $medida) { ?> <option value="<?php echo $medida->getIdMedida(); ?> "><?php echo $medida->getNmMedida(); ?> </option> <?php } ?> </select>
/** * 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 = Medida::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php if (!isset($_GET['id'])) { include "html/idxCRUD.php"; include "lst/lstMedida.php"; } else { $medida = Medida::find($_GET['id']); if ($medida) { include "reg/regMedida.php"; } else { echo "Medida inexistente!"; } } include "frm/frmMedida.php";
?> <?php // echo $form->textFieldRow($model,'Id',array('class'=>'span5','maxlength'=>20)); ?> <?php echo $form->textFieldRow($model, 'CodProducto', array('class' => 'span2', 'maxlength' => 40)); ?> <?php echo $form->textFieldRow($model, 'Descripcion', array('class' => 'span5', 'maxlength' => 200)); ?> <?php echo $form->dropDownListRow($model, 'UniMedida', CHtml::listData(Medida::model()->findAll(), 'Id', 'Descripcion'), array('empty' => ' ')); ?> <?php // echo $form->dropDownList($model,'UniMedida',CHtml::listData(Medida::model()->findAll(),'Id','Descripcion'),array('empty'=>' ')); ?> <?php echo $form->dropDownListRow($model, 'CodCategoria', CHtml::listData(Categoria::model()->findAll(), 'CodCategoria', 'Descripcion'), array('empty' => ' ')); ?> <?php echo $form->textFieldRow($model, 'CanExistencia', array('class' => 'span2')); ?> <?php // echo $form->textFieldRow($model,'PreCompra',array('class'=>'span5','maxlength'=>10));
public function getMenuMedida() { return CHtml::listData(Medida::model()->findAll(), 'Id', 'Descripcion'); }