Example #1
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     //$model->setEavAttributes(array('attribute1' => 'value1', 'attribute2' => 'value2'));
     if (isset($_POST['Item'])) {
         $model->attributes = $_POST['Item'];
         $model->deleteEavAttributes();
         if (isset($_POST['ItemeavE']) && isset($_POST['ItemeavE'])) {
             $model->setEavAttributes(array_combine($_POST['ItemeavE'], $_POST['ItemeavV']));
             ////saveEavAttributes
         }
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $cat = CHtml::listData(Itemcategory::model()->findAll(), 'id', 'name');
     $units = CHtml::listData(Itemunit::model()->findAll(), 'id', 'name');
     $this->render('update', array('model' => $model, 'cat' => $cat, 'units' => $units));
 }
Example #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 = Itemunit::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #3
0
//echo $form->dropDownList($model, "[$i]name", CHtml::listData(Item::model()->findAll(), 'id', 'name'));
?>
</td>

    <td><b><?php 
echo $form->labelEx($model, 'qty');
?>
</b><?php 
echo $form->textField($model, "[{$i}]qty", array('class' => 'detail'));
?>
</td>
    <td><b><?php 
echo $form->labelEx($model, 'unit_id');
?>
</b><?php 
echo $form->dropDownList($model, "[{$i}]unit_id", CHtml::listData(Itemunit::model()->findAll(), 'id', 'name'), array('class' => 'detail untSelect'));
//,array()
?>
</td>
    <td><b><?php 
echo $form->labelEx($model, 'iItem');
?>
</b><?php 
echo $form->textField($model, "[{$i}]iItem", array('class' => 'detail'));
?>
</td>
    <td><b><?php 
echo $form->labelEx($model, 'currency_id');
?>
</b><?php 
echo $form->dropDownList($model, "[{$i}]currency_id", CHtml::listData(Currates::model()->GetRateList(), 'currency_id', 'name'), array('class' => 'detail currSelect'));