echo $form->textField($model, 'name', array('class' => 'span4', 'size' => 60, 'maxlength' => 200)); ?> </div> <div class="controls"><?php echo $form->error($model, 'name'); ?> </div> </div> <div class="control-group"> <div class="control-label"><?php echo $form->labelEx($model, 'supportCategories'); ?> </div> <div class="controls"><?php $categories = new SupportCategories(); echo $form->dropDownList($model, 'supportCategories', $categories->getDropdown(), array('empty' => '---', 'class' => 'span4')); ?> </div> <div class="controls"><?php echo $form->error($model, 'supportCategories'); ?> </div> </div> <div class="control-group"> <div class="control-label"><?php echo $form->labelEx($model, 'phone'); ?> </div> <div class="controls"><?php
public function getDropdown() { global $dataDropdown; $dataDropdown = array(); $parents = SupportCategories::model()->with('levelTop')->findALl(); foreach ($parents as $parent) { $dataDropdown[$parent->id] = $parent->name; $this->_subDropDown($parent->childCategories); } return $dataDropdown; }
/** * 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 SupportCategories the loaded model * @throws CHttpException */ public function loadModel($id) { $model = SupportCategories::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }