/** * 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 = Obras::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'El enlace o direccion solicitado no existe'); } return $model; }
/** * 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 Obras the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Obras::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->error($a, 'id_persona'); ?> </div> <div class="form-group input-group col-sm-12<?php echo $a->hasErrors('id_obra') ? ' has-error' : ''; ?> "> <div class="input-group"> <span class="input-group-addon"> <i class="fa fa-building-o fa-fw"></i> </span> <?php echo $form->dropDownList($a, 'id_obra', Obras::items(1), array('class' => 'form-control', 'title' => 'Indique el nombre de la Obra')); ?> <?php echo $a->hasErrors('id_obra') ? "<span class='input-group-addon danger'><span class='glyphicon glyphicon-remove'></span></span>" : ''; ?> </div> <?php echo $form->error($a, 'id_obra'); ?> </div> <div class="form-group input-group col-sm-12<?php echo $a->hasErrors('nro_cuenta') ? ' has-error' : ''; ?> ">
<?php /* @var $this ObrasController */ /* @var $model Obras */ $this->breadcrumbs = array('Obras' => array('admin'), 'Gestionar'); $this->menu = array(array('label' => 'Nueva Obra', 'url' => array('create'))); ?> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'obras-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'itemsCssClass' => 'table table-striped table-hover table-bordered', 'columns' => array('nombre_obra', 'direccion', array('header' => 'Fecha de Inicio', 'name' => 'fech_ini', 'value' => function ($data) { return date("d-m-Y", strtotime($data->fech_ini)); }), array('header' => 'Fecha Fin', 'name' => 'fech_fin', 'value' => function ($data) { return date("d-m-Y", strtotime($data->fech_fin)); }), array('header' => 'Estatus', 'name' => 'status', 'filter' => CHtml::listData(Obras::getOnoffs(), 'id', 'title'), 'value' => function ($data) { if ($data->status == '1') { return "Activa"; } else { return "Inactiva"; } }), array('class' => 'CButtonColumn', 'htmlOptions' => buttonWidth(), 'template' => template(), 'buttons' => viewVisible())))); ?> <div class="col-sm-6"> <div class="list-group"> <a href="#" class="list-group-item active"> Menú </a> <a href="index.php?r=obras/create" class="list-group-item">Nueva obra</a> </div> <?php function viewVisible()