Esempio n. 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));
 }
Esempio n. 2
0
<?php

$this->widget('EExcelView', array('id' => 'item-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'ajaxUpdate' => TRUE, 'ajaxType' => 'POST', 'columns' => array('id', 'name', array('name' => 'category_id', 'filter' => CHtml::listData(Itemcategory::model()->findAll(), 'id', 'name'), 'value' => 'isset($data->Category)?$data->Category->name:0'), 'parent_item_id', 'isProduct', 'saleprice', array('class' => 'bootstrap.widgets.TbButtonColumn'))));
?>





Esempio n. 3
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 = Itemcategory::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 4
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'item-template-form', 'enableAjaxValidation' => false));
?>

	<?php 
echo $form->errorSummary($model);
?>

	<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 255));
?>

        <?php 
$models = Itemcategory::model()->findAll(array('order' => 'name'));
$list = CHtml::listData($models, 'id', 'name');
$htmlOptions = array("class" => 'span5', 'id' => ucfirst($this->id) . '_Itemcategory_id');
$select = CHtml::dropDownList(ucfirst($this->id) . '[Itemcategory_id]', 0, $list, $htmlOptions);
?>
            <label for="ItemTemplate_Itemcategory_id" class="required">Item Category <span class="required">*</span></label>
        <?php 
echo $select;
?>
            <?php 
//echo $form->textFieldRow($model,'AccType_id',array('class'=>'span5'));
if (isset($items)) {
    $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('app', 'Add new'), 'type' => 'primary', 'htmlOptions' => array('onclick' => '$("#addnew").dialog("open"); return false;')));
    $this->widget('EExcelView', array('id' => 'acc-templateItem-grid', 'dataProvider' => $items->search(), 'filter' => $items, 'columns' => array(array('name' => 'eavFields_id', 'value' => '$data->EavFields->name'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{remove}', 'buttons' => array('remove' => array('label' => '<i class="glyphicon glyphicon-remove"></i>', 'url' => '$data->id', 'options' => array('onclick' => 'deleteTempItm(this);return false;')))))));
}
?>