示例#1
0
 public function actionIndex()
 {
     //var_dump($_GET);
     if (isset($_GET['id_inkind'])) {
         $criteria = new CDbCriteria(array('condition' => 'id_inkind=' . $_GET['id_inkind']));
         $data = Inkind::items($_GET['id_inkind']);
         $inkind = $data->inkind;
         $kindparent = Kindparent::items($data->id_parent);
         $dataProvider = new CActiveDataProvider('Product', array('pagination' => array('pageSize' => 6), 'criteria' => $criteria));
         $this->render('index', array('dataProvider' => $dataProvider, 'kindparent' => $kindparent, 'inkind' => $inkind));
         $id_inkind = $_GET['id_inkind'];
         $baseUrl = Yii::app()->createUrl('product/index', array('id_inkind' => $id_inkind));
         Yii::app()->user->setReturnUrl($baseUrl);
         //var_dump(Yii::app()->user->returnUrl);
     } else {
         $dataProvider = new CActiveDataProvider('Product');
         $this->render('index', array('dataProvider' => $dataProvider));
     }
 }
示例#2
0
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'inkind';
     $criteria->distinct = true;
     $t['unselectValue'] = NULL;
     $this->inkind = Inkind::model()->findAll($criteria);
     //var_dump($this->inkind);
     for ($i = 0; $i < count($this->inkind); $i++) {
         $t[$this->inkind[$i]->inkind] = $this->inkind[$i]->inkind;
     }
     $t['unselectValue'] = '';
     $this->inkind = $t;
     $t = [];
     // var_dump($this->inkind);
     $criteria = new CDbCriteria();
     $criteria->select = 'kindparent';
     $criteria->distinct = true;
     $t['unselectValue'] = NULL;
     $this->kindparent = Kindparent::model()->findAll($criteria);
     //var_dump($this->inkind);
     for ($i = 0; $i < count($this->kindparent); $i++) {
         $t[$this->kindparent[$i]->kindparent] = $this->kindparent[$i]->kindparent;
     }
     $this->kindparent = $t;
     $t = [];
     // var_dump($this->kindparent);
     $criteria = new CDbCriteria();
     $criteria->select = 'producer';
     $criteria->distinct = true;
     //$t['uncheckValue']=NULL;
     $this->producer = Producer::model()->findAll($criteria);
     //var_dump($this->inkind);
     for ($i = 0; $i < count($this->producer); $i++) {
         $t[$this->producer[$i]->producer] = $this->producer[$i]->producer;
     }
     $this->producer = $t;
     $t = [];
     $form = new ProductSelectForm();
     $form->clearErrors();
     if (isset($_POST['ProductSelectForm'])) {
         $form->attributes = $_POST['ProductSelectForm'];
     }
     // if (isset($_POST['ProductSelectForm'])) {
     //   $form->kindparent=$_POST['ProductSelectForm']['kindparent'];
     // $form->inkind=$_POST['ProductSelectForm']['inkind'];
     //    $form->producer=$_POST['ProductSelectForm']['producer'];}
     //$form->min=$_POST['ProductSelectForm']['min'];
     //$form->max=$_POST['ProductSelectForm']['max'];
     // var_dump($_POST['ProductSelectForm']);
     // }
     //var_dump($_POST);
     //  var_dump($form->validate());
     //    if (isset($_POST['ProductSelectForm'])&&(!$form->validate())) {
     //  unset($_POST['SiteSearchForm']);
     //   $form->clearErrors();
     // $form->addError('ProductSelectForm','Задайте условия поиска');
     //  $z=$form->getErrors();
     // var_dump($z);
     // }
     // }
     // var_dump($_GET);
     $this->render('productSelect', array('form' => $form, 'inkind' => $this->inkind, 'kindparent' => $this->kindparent, 'producer' => $this->producer));
     $form->clearErrors();
 }
示例#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 $id the ID of the model to be loaded
  * @return Inkind the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Inkind::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#4
0
<?php

/* @var $this ProductController */
/* @var $model Product */
$data = Inkind::items($model->id_inkind);
$inkind = $data->inkind;
$kindparent = Kindparent::items($data->id_parent);
$this->breadcrumbs = array("{$kindparent}" => array("/product/search/", 'searchString' => $kindparent), "{$inkind}" => Yii::app()->user->returnUrl, "#id={$model->id_product}");
$this->menu = array(array('label' => 'List Product', 'url' => array('index')), array('label' => 'Create Product', 'url' => array('create')), array('label' => 'Update Product', 'url' => array('update', 'id' => $model->id_product)), array('label' => 'Delete Product', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id_product), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Product', 'url' => array('admin')));
?>

<h1>Характеристики товара с #id=<?php 
echo $model->id_product;
?>
</h1>
<br />

<br />
<?php 
$this->renderPartial('_view', array('data' => $model));
?>