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


PHP Items::model方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($main_item_id)
 {
     $model = new OutboundItemsHistory();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $model->main_item_id = $main_item_id;
     if (isset($_POST['OutboundItemsHistory'])) {
         $model->attributes = $_POST['OutboundItemsHistory'];
         if ($model->save()) {
             $available_quantity = $model->available_quantity_in_stock - $model->quantity_moved;
             $current_quantity = $model->current_quantity_in_stock - $model->quantity_moved;
             //$q_moved=$model->quantity_moved;
             $itemModel = Items::model()->updateByPk($model->main_item_id, array('available_quantity' => $available_quantity + $model->quantity_moved, 'current_quantity' => $current_quantity + $model->quantity_moved));
             //if($model->save())
             $this->redirect(array('view', 'id' => $model->history_id_item));
         }
     }
     $this->render('create', array('model' => $model));
     /*original
     		if(isset($_POST['OutboundItemsHistory']))
     		{
     			$model->attributes=$_POST['OutboundItemsHistory'];
     			if($model->save())
     				$this->redirect(array('view','id'=>$model->history_id_item));
     		}
     
     		$this->render('create',array(
     			'model'=>$model,
     		));*/
 }
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:34,代码来源:OutboundItemsHistoryController.php

示例2: actionView

 public function actionView()
 {
     $slug = Yii::app()->request->getParam('slug');
     $criteria = new CDbCriteria();
     $criteria->condition = 'itm_slug=:itm_slug';
     $criteria->params = array(':itm_slug' => $slug);
     $model = Items::model()->find($criteria);
     $this->render('view', array('model' => $model));
 }
开发者ID:jayant06,项目名称:lukurug,代码行数:9,代码来源:ProductsController.php

示例3: getIAlltems

 public function getIAlltems()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     // $criteria=new CDbCriteria;
     // $criteria->compare('item_id',$this->item_id);
     // $criteria->compare('name',$this->name);
     return $Items = Items::model()->findAll();
 }
开发者ID:Henriquemvsantos,项目名称:GoNuts,代码行数:9,代码来源:Items.php

示例4: actionCreate

 public function actionCreate()
 {
     Yii::app()->clientScript->registerPackage('items-edit');
     if (!isset($_GET['id']) || NULL == ($model = Items::model()->findByAttributes(array('user_id' => Yii::app()->user->id, 'id' => (int) $_GET['id'])))) {
         $model = new Items();
     }
     if (isset($_POST['Items'])) {
         $model->attributes = $_POST['Items'];
         $fn = Files::model()->uploadFile('Items[image]');
         if ($fn) {
             $model->image = $fn['filename'];
         } elseif (isset($_POST['Items']['image_src'])) {
             $model->image = $_POST['Items']['image_src'];
         }
         $new = $model->isNewRecord;
         if ($model->save()) {
             $cats = isset($_POST['categories']) ? $_POST['categories'] : array();
             if (!$new && empty($cats)) {
                 ItemsCategory::model()->deleteAllByAttributes(array('item_id' => $model->id));
             } else {
                 if (!$new) {
                     $dbcats = ItemsCategory::model()->findAll('item_id=:iid', array('iid' => $model->id));
                     $ids = array();
                     foreach ($dbcats as $i => $dbc) {
                         if (false !== ($k = array_search($dbc->category_id, $cats))) {
                             unset($cats[$k]);
                             unset($dbc[$i]);
                         } else {
                             $ids[] = $dbc->category_id;
                         }
                     }
                     //deleteing corresponding categories
                     if (!empty($ids)) {
                         $ids = implode(",", $ids);
                         ItemsCategory::model()->deleteAll('item_id=:iid AND category_id IN (:cid)', array('iid' => $model->id, 'cid' => $ids));
                     }
                 }
                 if (!empty($cats)) {
                     foreach ($cats as $cat) {
                         $c = new ItemsCategory();
                         $c->attributes = array('category_id' => $cat, 'item_id' => $model->id);
                         $c->save();
                     }
                 }
             }
             Yii::app()->user->setFlash('ItemSaved', '1');
             $this->refresh();
         }
     }
     $this->render('_form', array('model' => $model));
 }
开发者ID:BGCX067,项目名称:facecom-svn-to-git,代码行数:51,代码来源:ItemsController.php

示例5: actionCreate

 public function actionCreate()
 {
     $index = new Zend_Search_Lucene(Yii::getPathOfAlias('application.' . $this->_indexFiles), true);
     $items = Items::model()->findAll();
     foreach ($items as $item) {
         $doc = new Zend_Search_Lucene_Document();
         Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
         $doc->addField(Zend_Search_Lucene_Field::keyword('part_number', CHtml::encode($item->part_number), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::Text('name', CHtml::encode($item->name), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::Text('description', CHtml::encode($item->description), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::Text('barcode', CHtml::encode($item->barcode), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::float('available_quantity', CHtml::encode($item->available_quantity), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::float('current_quantity', CHtml::encode($item->current_quantity), 'utf-8'));
         $index->addDocument($doc);
     }
     $index->commit();
     echo 'Lucene index created';
 }
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:18,代码来源:SearchController.php

示例6: processCart

 public function processCart()
 {
     $cart_items = Yii::app()->session['cartItems'];
     $fabrics = array();
     $items = array();
     if (!empty($cart_items)) {
         $fabricIds = array();
         $itemIds = array();
         foreach ($cart_items as $key => $cartArr) {
             if ($key == 'fabric') {
                 foreach ($cartArr as $fabId => $fabArr) {
                     $fabricIds[] = $fabId;
                 }
             }
             if ($key == 'item') {
                 foreach ($cartArr as $itemId => $itemArr) {
                     $itemIds[] = $itemId;
                 }
             }
         }
         $fabCriteria = new CDbCriteria();
         $itmCriteria = new CDbCriteria();
         $fabIds = '';
         if (!empty($fabricIds)) {
             $fabIds = implode(',', $fabricIds);
             $fabCriteria->condition = 'fab_id in (' . $fabIds . ')';
             $fabrics = Fabrics::model()->findAll($fabCriteria);
         }
         $itmIds = '';
         if (!empty($itemIds)) {
             $itmIds = implode(',', $itemIds);
             $itmCriteria->condition = 'itm_id in (' . $itmIds . ')';
             $items = Items::model()->findAll($itmCriteria);
         }
     }
     $data['items'] = $items;
     $data['fabrics'] = $fabrics;
     return $data;
 }
开发者ID:jayant06,项目名称:lukurug,代码行数:39,代码来源:CartController.php

示例7: array

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'item-on-order-form', 'enableAjaxValidation' => false));
?>

<?php 
/**COLLECTING THE DATA*/
$purchase_id = $_GET['po_id'];
$item_id = $_GET['item_id'];
$model->purchase_order_id = $purchase_id;
$model->items_id = $item_id;
//*SINCE FIRST STATUS OF ITEM IS DRAFT*//
$model->item_status = 1;
/*THIS IS FOR THE CURRENT ITEMS Which is being added*/
$itemModel = Items::model()->findByPk($item_id);
$purchaseModel = PurchaseOrder::model()->findByPk($purchase_id);
/*THIS IS To get the items which are already orrderd**/
$items_on_order_model = PurchaseOrder::model()->getItemsOnOrder($purchase_id);
$model->suppliers_id = $purchaseModel->suppliers_id;
$model->unit_price = $itemModel->sale_price;
?>


	<p class="note">Fields with <span class="required">*</span> are required.</p>

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

<!-- FIRST PART OF THE FORM WHICH DISPLAYS PURCHASE ORDER DETAILS --> 
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:31,代码来源:_form.php

示例8: beforeSave

 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord) {
             $this->created = time();
             $this->total_price = $this->unit_price * $this->quantity_ordered;
             $x = $this->unit_price;
             $itemModel = Items::model()->updateByPk($this->items_id, array('sale_price' => $x));
         } else {
             $x = $this->unit_price;
             $itemModel = Items::model()->updateByPk($this->items_id, array('sale_price' => $x));
             $this->modified = time();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:18,代码来源:ItemOnOrder.php

示例9: actionJsonSearch

 public function actionJsonSearch($keyword)
 {
     /*$model=new Items('freeSearch');
     //		$keyword=$_GET['search_data'];
     				$keyword=$_GET['search_data'];
     			//$this->render('jsonSearch', array('results' => $results));
     		//echo "key value is ".$keyword;	
     //		$this->render('jsonSearch',array('model'=>$model,
     //										 'dataProvider'=>results,
     //										 ));
     
     
     //		if(isset($_GET['search_data']))
     //		{
     			
     //			$keyword=$_GET['search_data'];
     			//$model->=$_GET['Items'];
     //	   		$this->render('admin',array(
     //			'model'=>$model,
     //			));
     //			
     			//echo "key value is ".$keyword;
     //			echo "key value is ".$keyword;
     			//$keyword=$id;
     			//$this->render('jsonSearch',array('model'=>$model,));
     //		}*/
     $model = Items::model()->freeSearch($keyword);
     //echo "I  M ".$keyword;
     $this->render('jsonSearch', array('model' => $model));
 }
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:30,代码来源:ItemsController.php

示例10: loadModel

 /**
  * 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 = Items::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:Henriquemvsantos,项目名称:GoNuts,代码行数:13,代码来源:ItemsController.php

示例11: freeSearch

 public function freeSearch($keyword)
 {
     /*Creating a new criteria for search*/
     $criteria = new CDbCriteria();
     $criteria->compare('name', $keyword, true, 'OR');
     $criteria->compare('barcode', $keyword, true, 'OR');
     $criteria->compare('part_number', $keyword, true, 'OR');
     /*result limit*/
     $criteria->limit = 100;
     /*When we want to return model*/
     return Items::model()->findAll($criteria);
     /*To return active dataprovider uncomment the following code*/
     /*
     return new CActiveDataProvider($this, array(
     	'criteria'=>$criteria,
     ));
     */
 }
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:18,代码来源:Items.php

示例12: actionUpdateStatus

 public function actionUpdateStatus($id)
 {
     echo 'ID ID ' . $id;
     if (!empty($_GET['all_recieved'])) {
         $all_recieved = $_GET['all_recieved'];
     }
     if ($id == 0 && $all_recieved == 'true') {
         $purchase_id = $_GET['purchase_id'];
         echo $purchase_id;
         $items_on_order_model = PurchaseOrder::model()->getItemsOnOrder($purchase_id);
         foreach ($items_on_order_model as $ordered_items) {
             $item_id = $ordered_items->id;
             echo '<hr>ITEM IUS IS     ' . $item_id;
             if ($ordered_items->item_status == 2) {
                 ItemOnOrder::model()->updateByPk($item_id, array('item_status' => 3, 'quantity_recieved' => $ordered_items->quantity_ordered));
             }
             //end of if
         }
         //end of foreach
         $this->redirect(array('/purchaseOrder/orderRecieved/', 'id' => $purchase_id));
     } else {
         $model = $this->loadModel($id);
         $current_quantity_recieved = $model->quantity_recieved;
         if (isset($_POST['ItemOnOrder'])) {
             $model->attributes = $_POST['ItemOnOrder'];
             $status = $model->item_status;
             $diff = $model->ordered_recieved_difference;
             $model->quantity_recieved = $model->quantity_recieved + $diff;
             $quantity_recieved = $model->quantity_recieved;
             $quantity_ordered = $model->quantity_ordered;
             echo "<br> QUANTIY RECIEVED  " . $quantity_recieved;
             echo "<br> QUANTIY ORDERED  " . $quantity_ordered;
             echo "<br> DIFF  " . $diff;
             /*
              * WE have set the flag as 3 for recieved and 6 for damaged
              * we will do funny calculations based on that
              * 
              */
             if ($status == 3) {
                 $comments = $diff . ' recieved. ';
                 //$comments.=' under the purchase order number '.$model->purchaseOrder->order_number;
                 $comments .= ' Processed by ' . Yii::app()->user->name . " on " . date("d-M-y H:i") . '<br>';
                 $model->comments .= $comments;
                 if ($quantity_ordered == $quantity_recieved) {
                     $model->item_status = 3;
                     //i.e. all items are recieved
                 } elseif ($quantity_ordered > $quantity_recieved) {
                     $model->item_status = 4;
                     ////i.e. partiually recieved
                     echo "RECIEVD is  " . $model->quantity_recieved;
                 } elseif ($quantity_ordered < $quantity_recieved) {
                     $model->item_status = 2;
                     //status reset
                 } else {
                     $this->redirect(array('/purchaseOrder/orderRecieved/', 'id' => $purchase_id));
                 }
                 //end of else
             }
             //end of if of status 50
             if ($status == 6) {
                 /*THIS MEANS ALL PARTS WERE DAMAGED*/
                 if ($quantity_ordered == $quantity_recieved) {
                     $model->item_status = 6;
                 } else {
                     $model->item_status = 7;
                     //this is partially damaged item model
                 }
                 //echo 'QUANTITRY DAMAGED  '.$diff;
                 $model->quantity_damaged = $diff;
                 $model->quantity_recieved = $current_quantity_recieved;
                 //$model->quantity_recieved=0.0;
                 /*THIS IS DONE, else the system will store in quantity recieved also*/
                 //$model->quantity_recieved=$current_quantity_recieved;
                 //	echo 'QUANTITRY Recieved'.$model->quantity_recieved;
                 $comments = $diff;
                 $comments .= ' damaged. ';
                 $comments .= ' Processed by: ' . Yii::app()->user->name . " on " . date("d-M-y H:i") . '<br>';
                 $quantity_recieved = 0.0;
                 $model->comments .= $comments;
             }
             ///end of if status 51
             /*IF any quantity is recieved it wil be added to inbound and the items details will also be updated*/
             if ($quantity_recieved > 0) {
                 echo 'Logic to add in inbound';
                 $inbound_model = new InboundItemsHistory();
                 $main_item_id = $model->items_id;
                 $item_model = Items::model()->findByPk($main_item_id);
                 $current_stock = $item_model->current_quantity;
                 $available_stock = $item_model->available_quantity;
                 $quantity_moved = $quantity_recieved;
                 $inbound_model->main_item_id = $model->items_id;
                 $inbound_model->quantity_moved = $quantity_recieved;
                 $inbound_model->items_on_order_id = $model->id;
                 $inbound_model->comments .= $comments . 'Purchase Order Number =' . $model->purchaseOrder->order_number;
                 $inbound_model->available_quantity_in_stock = $quantity_moved + $available_stock;
                 $inbound_model->current_quantity_in_stock = $quantity_moved + $current_stock;
                 if ($inbound_model->save()) {
                     echo 'saved';
                     Items::model()->updateByPk($main_item_id, array('available_quantity' => $quantity_moved + $available_stock, 'current_quantity' => $quantity_moved + $current_stock));
                 } else {
//.........这里部分代码省略.........
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:101,代码来源:ItemOnOrderController.php

示例13: updateitemstable

 public function updateitemstable($id, $stockvalue)
 {
     $itemModel = Items::model()->findByPk($id);
     $itemModel->updateByPk($id, array('available_quantity' => $stockvalue, 'current_quantity' => $stockvalue));
     echo '<hr>' . $itemModel->available_quantity . "<BR>" . $itemModel->current_quantity;
 }
开发者ID:EmmanuelFernando,项目名称:rapport-stock-control,代码行数:6,代码来源:ApiController.php


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