当前位置: 首页>>代码示例>>PHP>>正文


PHP Products::getUseProdList方法代码示例

本文整理汇总了PHP中Products::getUseProdList方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::getUseProdList方法的具体用法?PHP Products::getUseProdList怎么用?PHP Products::getUseProdList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products的用法示例。


在下文中一共展示了Products::getUseProdList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionStruct

 public function actionStruct()
 {
     $id = $_POST['type_id'];
     $mType = $_POST['mType'];
     $products = new Products();
     $stuff = new Halfstaff();
     $dish = new Dishes();
     $prodList = $products->getUseProdList();
     $stuffList = $stuff->getUseStuffList();
     $dishList = $dish->getUseDishList();
     $dishModel = Menu::model()->with('dish')->findAll('t.type_id = :typeId AND mType = :mType', array(':typeId' => $id, ':mType' => $mType));
     $prodModel = Menu::model()->with('products')->findAll('t.type_id = :typeId AND mType = :mType', array(':typeId' => $id, ':mType' => $mType));
     $stuffModel = Menu::model()->with('halfstuff')->findAll('t.type_id = :typeId AND mType = :mType', array(':typeId' => $id, ':mType' => $mType));
     $listDep = CHtml::listData(Department::model()->findAll(), 'department_id', 'name');
     $this->renderPartial('struct', array('id' => $id, 'mType' => $mType, 'listDep' => $listDep, 'dishModel' => $dishModel, 'prodModel' => $prodModel, 'stuffModel' => $stuffModel, 'prodList' => $prodList, 'stuffList' => $stuffList, 'dishList' => $dishList));
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:16,代码来源:MenuController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $products = new Products();
     $provider = new Provider();
     $prodList = $products->getUseProdList();
     $provList = $provider->getProvList();
     $model = new Realize();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['provider'])) {
         $fakturaId = $this->beforeSave($_POST['provider']);
         $currentDate = date('Y-m-d');
         //echo $fakturaId;
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $messageType = 'warning';
             $message = "There are some errors " . count($_POST['product_id']);
             if ($_POST['product_id']) {
                 for ($i = 0; $i < count($_POST['product_id']); $i++) {
                     $models = new Realize();
                     $models->faktura_id = $fakturaId;
                     $models->prod_id = $_POST['product_id'][$i];
                     $models->price = $_POST['price'][$i];
                     $models->count = $this->changeToFloat($_POST['count'][$i]);
                     if ($models->save()) {
                         $messageType = 'success';
                         $message = "<strong>Well done!</strong> You successfully create data ";
                     }
                 }
             }
             Yii::app()->user->setFlash($messageType, $message);
             $transaction->commit();
             $this->redirect(array('dishes/checkMargin'));
         } catch (Exception $e) {
             $transaction->rollBack();
             Yii::app()->user->setFlash('error', "{$e->getMessage()}");
             //$this->refresh();
         }
     }
     $this->render('create', array('model' => $model, 'prodList' => $prodList, 'provList' => $provList));
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:45,代码来源:RealizeController.php

示例3: actionUpdate

 /**
  * 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)
 {
     $chosenStuff = array();
     $prod_id = CHtml::listData(HalfstuffStructure::model()->findAll(array("condition" => "halfstuff_id = {$id} AND types = 1")), 'halfstruct_id', 'prod_id');
     $stuff_id = CHtml::listData(HalfstuffStructure::model()->findAll(array("condition" => "halfstuff_id = {$id} AND types = 2")), 'halfstruct_id', 'prod_id');
     $chosenProduct = Products::model()->with('stuffStruct')->findAllByPk($prod_id, 'stuffStruct.halfstuff_id = :halfstuff_id AND stuffStruct.types = :types', array(':halfstuff_id' => $id, ':types' => 1));
     foreach ($stuff_id as $key => $value) {
         $chosenStuff[$key] = HalfstuffStructure::model()->with('stuff')->findAllByPk($key, 't.halfstuff_id = :halfstuff_id AND types = :types', array(':halfstuff_id' => $id, ':types' => 2));
     }
     $model = $this->loadModel($id);
     $products = new Products();
     $prodList = $products->getUseProdList();
     $stuffList = $model->getUseStuffList();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Halfstaff'])) {
         $messageType = 'warning';
         $message = "There are some errors ";
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $_POST['Halfstaff']['count'] = $this->changeToFloat($_POST['Halfstaff']['count']);
             if ($_POST['Halfstaff']['count'] == '' or $_POST['Halfstaff']['count'] == 0) {
                 $_POST['Halfstaff']['count'] = 1;
             }
             $model->attributes = $_POST['Halfstaff'];
             $messageType = 'success';
             $message = "<strong>Well done!</strong> You successfully update data ";
             if ($model->save()) {
                 HalfstuffStructure::model()->deleteAll('halfstuff_id=:halfstuff_id', array(':halfstuff_id' => $id));
                 if ($_POST['product_id'] != null) {
                     $count = 0;
                     $prodMes = "prod>";
                     for ($i = 0; $i < count($_POST['product_id']); $i++) {
                         $ss = $this->changeToFloat($_POST['prod'][$i]);
                         $struct = new HalfstuffStructure();
                         $struct->halfstuff_id = $id;
                         $struct->prod_id = $_POST['product_id'][$i];
                         $struct->amount = $ss;
                         $struct->types = 1;
                         if ($struct->save()) {
                             $messageType = 'success';
                             $prodMes .= $struct->prod_id . ":" . $struct->amount . ",";
                             $message = "<strong>Well done!</strong> Your successfully create data ";
                         }
                         $count++;
                     }
                 }
                 if ($_POST['stuff_id'] != null) {
                     $count = 0;
                     $stuffMes = "stuff>";
                     for ($i = 0; $i < count($_POST['stuff_id']); $i++) {
                         $ss = $this->changeToFloat($_POST['stuff'][$i]);
                         $struct = new HalfstuffStructure();
                         $struct->halfstuff_id = $model->halfstuff_id;
                         $struct->prod_id = $_POST['stuff_id'][$i];
                         $struct->amount = $ss;
                         $struct->types = 2;
                         if ($struct->save()) {
                             $stuffMes .= $struct->prod_id . ":" . $struct->amount . ",";
                         }
                         $count++;
                     }
                 }
                 $this->logs('update', 'halfstaff', $model->halfstuff_id, $model->name . "->" . $prodMes . "=>" . $stuffMes);
                 $transaction->commit();
                 Yii::app()->user->setFlash($messageType, $message);
                 $this->redirect(array('view', 'id' => $model->halfstuff_id));
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             Yii::app()->user->setFlash('error', "{$e->getMessage()}");
             // $this->refresh();
         }
         $model->attributes = $_POST['Halfstaff'];
         if ($model->save()) {
         }
         $this->redirect(array('view', 'id' => $model->halfstuff_id));
     }
     $this->render('update', array('model' => $model, 'chosenProduct' => $chosenProduct, 'chosenStuff' => $chosenStuff, 'prodList' => $prodList, 'stuffList' => $stuffList));
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:85,代码来源:HalfstaffController.php

示例4: actionRefreshAdd

 public function actionRefreshAdd()
 {
     $prod = new Products();
     $prodList = $prod->getUseProdList();
     $stuff = new Halfstaff();
     $stuffList = $stuff->getUseStuffList();
     $this->renderPartial('refreshAdd', array('stuffList' => $stuffList, 'prodList' => $prodList, 'form' => $_POST['form']));
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:8,代码来源:DishesController.php

示例5: actionRequest

 public function actionRequest()
 {
     $products = new Products();
     $provider = new Provider();
     $prodList = $products->getUseProdList();
     $provList = $provider->getProvList();
     $depId = Department::model()->findAll();
     $dates = date('Y-m-d H:i:s');
     $command = Yii::app()->db->createCommand();
     $expense = new Expense();
     if (isset($_POST['request'])) {
         $command->insert('request', array('req_date' => $dates, 'provider_id' => $_POST['provider']));
         $lastId = Yii::app()->db->lastInsertID;
         foreach ($_POST['request'] as $key => $val) {
             foreach ($val as $keys => $value) {
                 $count = $expense->changeToFloat($value['count']);
                 $command->insert('request_prod', array('request_id' => $lastId, 'prod_id' => $keys, 'depId' => $key, 'count' => $count));
             }
         }
         $this->redirect(array('view', 'id' => $lastId));
     }
     $this->render('request', array('depId' => $depId, 'prodList' => $prodList, 'provList' => $provList));
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:23,代码来源:FakturaController.php


注:本文中的Products::getUseProdList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。