예제 #1
0
 public static function getAll()
 {
     self::$_items = array();
     $models = self::model()->findAll();
     foreach ($models as $model) {
         self::$_items[$model->id] = $model->name;
     }
     return self::$_items;
 }
예제 #2
0
 /**
  * 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 = Tagdir::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #3
0
echo $form->labelEx($model, 'name');
?>
		<?php 
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 128));
?>
		<?php 
echo $form->error($model, 'name');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'dir_id');
?>
		<?php 
$tag = Tagdir::getAll();
array_unshift($tag, '请选择');
?>
		<?php 
echo $form->dropDownList($model, 'dir_id', $tag);
?>
		<?php 
echo $form->error($model, 'dir_id');
?>
	</div>
	<div class="row buttons">
		<?php 
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save');
?>
	</div>