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


PHP Warehouse::model方法代码示例

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


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

示例1: 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 = Warehouse::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:7thZoneTechnology,项目名称:inventory-2,代码行数:13,代码来源:WarehouseController.php

示例2: array

                       }', 'select' => 'js:function(event, ui){
                        	document.getElementById(\'keterangan\').innerHTML = \'Code : \'+ui.item.code;
                        	document.getElementById(\'component_id\').value = ui.item.id;
                        }'), 'htmlOptions' => array('style' => 'height:25px;width:200px;padding:0px 5px;', 'class' => 'mf'), 'htmlOptions' => array('style' => 'width:50%;')));
?>
		<input type="hidden" name="component_id" id="component_id">
		</div>
	
	<div class="row">
	<b id="keterangan">
	</b></div>	
	
	<div class="row">	 
		<label>From Warehouse</label>
		<?php 
echo CHtml::dropDownList('warehouse_from', '', CHtml::listData(Warehouse::model()->findAll(), 'id', 'name_warehouse'), array('empty' => '-- select warehouse --'));
?>
	</div>
	
	<div class="row">	 
		<label>To Warehouse</label>
		<?php 
echo CHtml::dropDownList('warehouse_to', '', CHtml::listData(Warehouse::model()->findAll(), 'id', 'name_warehouse'), array('empty' => '-- select warehouse --'));
?>
	</div>
	
	<div class="row">
	<label>Qty</label>
	<input type="text" id="qty" name="qty" size="8">
	</div>
</div>		
开发者ID:7thZoneTechnology,项目名称:inventory-2,代码行数:31,代码来源:_form.php

示例3: actionStepOne

 public function actionStepOne()
 {
     $this->inAccession = true;
     // Have we arrived here with an accession hash, allowing us to track this contact through accession?
     if (isset($_GET['accessionhash'])) {
         $Accession = $this->getAccessionRecord();
         $this->checkStep($Accession, 1);
     } else {
         $Accession = new Accession();
         $Accession->step = 1;
     }
     $this->pageTitle = 'Welcome to ' . Yii::app()->name . ' | Step One | Accession';
     if (isset($_POST['Accession'])) {
         if ($_POST['Accession']['terms_agreed'] === '1') {
             // Accession hash will be null if they've signed up from the public link
             if (is_null($Accession->accession_hash)) {
                 $Accession->accession_hash = sha1(rand(1, 99999) . microtime(true));
             }
             // TERMS ARE AGREED! We're good to go. Set up all the models
             $Accession->terms_agreed = date('Y-m-d H:i:s');
             if (!$Accession->save()) {
                 print_r($Accession->errors);
                 exit;
             }
             // Now they've agreed terms, update the invite (if they had one)
             if ($Accession->invite_id) {
                 $Invite = Invite::model()->findByPk($Accession->invite_id);
                 if (!is_null($Invite)) {
                     $Invite->status = Invite::STATUS_ACCEPTED;
                     $Invite->save(true, array('status'));
                 }
             }
             $new = false;
             // If it's a new contact coming to the list, we just have a blank row
             // If they've come via an invite then we copy their Store row
             if (is_null($Accession->original_store2contact_id)) {
                 // This contact is new
                 $Store = new Store();
                 // Create a new warehouse row
                 $Warehouse = new Warehouse();
                 $Warehouse->save();
                 // Set the warehouse id to the accession model
                 $Accession->warehouse_id = $Warehouse->id;
                 $Accession->save(true, array('warehouse_id'));
                 $new = true;
             } else {
                 // This contact came from an invite
                 // Grab their previous data
                 $Store2Contact = Store2Contact::model()->findByPk($Accession->original_store2contact_id);
                 // Get the contact's warehouse_id - this identifies them uniquely, even if they have multiple instances in Store
                 $Warehouse = Warehouse::model()->findByPk($Store2Contact->contact_warehouse_id);
                 $ExistingStore = Store::model()->findByPk($Store2Contact->store_id);
                 // Now make a new store to duplicate their info to
                 $Store = new Store();
                 $Store->attributes = $ExistingStore->attributes;
                 $Store->id = null;
             }
             // Set the org ID to THE LIST
             $Store->origin_organisation_id = 10;
             // Try to save the Store
             if (!$Store->save()) {
                 print 'Store errors:<br>';
                 print_r($Store->errors);
                 exit;
             }
             // Also create a new Store2Contact row
             $Store2Contact = new Store2Contact();
             $Store2Contact->store_id = $Store->id;
             $Store2Contact->contact_warehouse_id = $Warehouse->id;
             $Store2Contact->origin_id = 10;
             if (!$Store2Contact->save()) {
                 print 'Store2Contact errors:<br>';
                 print_r($Store2Contact->errors);
                 exit;
             }
             // Now also save the new Store2Contact ID to Accession
             $Accession->store2contact_id = $Store2Contact->id;
             if ($new) {
                 $Accession->original_store2contact_id = $Store2Contact->id;
             }
         }
         if ($Accession->save(true, array('terms_agreed', 'store2contact_id', 'original_store2contact_id'))) {
             $this->updateStep($Accession, 1);
             $this->redirect(array('accession/stepTwo', 'accessionhash' => $Accession->accession_hash));
         }
     }
     $this->render('step1', array('Accession' => $Accession, 'progress' => 1));
 }
开发者ID:newga,项目名称:newga,代码行数:88,代码来源:AccessionController.php


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