private function createDefaultCellarLoc($cellar_id) { $newCellarLoc = new CellarLocation(); $newCellarLoc->cellar_id = $cellar_id; $newCellarLoc->location = "Other"; $newCellarLoc->location_desc = "Location not assigned"; $newCellarLoc->save(); return $newCellarLoc->cellar_loc_id; }
<b><?php echo CHtml::encode('Celler Owner'); ?> :</b> <?php echo CHtml::encode($data->owner->first_name . " " . $data->owner->last_name); ?> <br /> <b><?php echo CHtml::encode('Default Location'); ?> :</b> <?php $temp_cellar_loc = CellarLocation::model()->findByPk($data->default_cellar_loc_id); echo CHtml::encode($temp_cellar_loc->location); ?> <br /> <b><?php echo CHtml::encode('Total Bottles in Cellar'); ?> :</b> <?php echo CHtml::encode($data->getTotalBottlesInCellar()); ?> <br /> <br /> <b><?php
?> <?php $this->widget('CStarRating', array('model' => $model, 'attribute' => 'rating', 'minRating' => 80, 'maxRating' => 100, 'starCount' => 20, 'readOnly' => false)); ?> <br> <?php echo $form->error($model, 'rating'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'cellar_loc_id'); ?> <?php $wineries_list = CHtml::listData(CellarLocation::model()->findAllByAttributes(array('cellar_id' => $model->cellar_id)), 'cellar_loc_id', 'location'); asort($wineries_list); echo $form->dropDownList($model, 'cellar_loc_id', $wineries_list, array('empty' => '(Select a Location)')); ?> <?php echo $form->error($model, 'cellar_loc_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'cost'); ?> <?php echo $form->textField($model, 'cost', array('size' => 10, 'maxlength' => 10)); ?>
/** * 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 CellarLocation the loaded model * @throws CHttpException */ public function loadModel($id) { $model = CellarLocation::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }