<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'water-request-geometry-zones-form', 'action' => CController::createUrl('waterRequestGeometryZones/update', array('id' => $model->id)), 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true))); ?> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'zone_name', array('for' => 'WaterRequestGeometryZones_zone_name')); ?> <?php echo $form->dropDownList($model, 'zone_name', CHtml::listData(Zones::model()->findAll('active=:active', array(':active' => true)), 'name', 'description'), array('empty' => Yii::t('waterrequest', 'Select Category'), 'onChange' => 'javascript:refresh_zone_parameters_form();', 'id' => 'WaterRequestGeometryZones_zone', 'class' => 'selector')); ?> <?php echo $form->error($model, 'zone_name'); ?> </div> <br/> <br/> <div id="zone_parameter"> <?php $prop_model = new WaterRequestGeometryZoneProperties(); $zone = $model->zone_name; //Yii::log(print_r($zone, true),CLogger::LEVEL_INFO,'_popup_edit'); while ($zone != null) { $params = ZonesWaterRequestParameters::model()->active_parameters()->findAll('zone=:zone', array(':zone' => $zone)); if ($params) {
/** * 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 string $id the identifier of the model to be loaded */ public function loadModel($id) { $model = Zones::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Verify the existence of children associated with the area. * Returns true if the area has children. */ public function hasChild() { $zones = Zones::model()->findByAttributes(array('parent_zone_name' => $this->name)); if (count($zones)) { return true; } return false; }