/**
  * 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 Km the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Km::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#2
0
	<div class="row">
		<p>Mời bạn nhập tên tác giả</p>
		<?php 
$this->widget('CAutoComplete', array('model' => $model, 'attribute' => 'author', 'url' => array('suggestTags'), 'multiple' => true, 'htmlOptions' => array('size' => 50, 'class' => 'form-control input-traodoi')));
?>
		<p class="hint">Có thể nhập được nhiều tác giả</p>
		<?php 
echo $form->error($model, 'author');
?>
	</div>

	<div class="row">
		<p>Nhập phần trăm khuyến mãi</p>
		<?php 
echo $form->dropDownList($model, 'km_id', CHtml::listData(Km::model()->findAll(), 'id', 'phantram'), array('class' => 'form-control input-traodoi'));
?>
		<?php 
echo $form->error($model, 'km_id');
?>
	</div>

	<div class="row">
		<p>Nhập tên sách</p>
		<?php 
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 200, 'class' => 'form-control input-traodoi'));
?>
		<?php 
echo $form->error($model, 'name');
?>
	</div>