本文整理汇总了PHP中Box::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Box::save方法的具体用法?PHP Box::save怎么用?PHP Box::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box
的用法示例。
在下文中一共展示了Box::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Box();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Box'])) {
$model->attributes = $_POST['Box'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->box_id));
}
}
$this->render('create', array('model' => $model));
}
示例2: actionCreateFutureDeliveryDatesAndBoxes
/**
* Generate new delivery dates and boxes for each date
*/
public function actionCreateFutureDeliveryDatesAndBoxes()
{
$weeksInAdvance = SnapUtil::config('boxomatic/autoCreateDeliveryDates');
$latestDate = DeliveryDate::getLastEnteredDate();
if ($latestDate) {
$latestDate = strtotime($latestDate->date);
} else {
$latestDate = time();
}
$targetDate = strtotime('+' . $weeksInAdvance . ' weeks');
$BoxSizes = BoxSize::model()->findAll();
while ($latestDate <= $targetDate) {
// $dateStr = date('j-n-Y',$latestDate);
// $parts = explode('-',$dateStr);
// mktime(0,0,0,$parts[1],$parts[0],$parts[2]);
foreach (SnapUtil::config('boxomatic/deliveryDateLocations') as $day => $locationIds) {
if (!empty($locationIds)) {
$latestDate = strtotime('next ' . $day, $latestDate);
//var_dump(date('l, d-m-Y',$latestDate));
//$latestDateStr=date('Y-m-d',$latestDate);
//$latestDate=strtotime($latestDateStr . ' +1 week');
$newDateStr = date('Y-m-d', $latestDate);
$DeliveryDate = new DeliveryDate();
$DeliveryDate->date = $newDateStr;
$DeliveryDate->Locations = $locationIds;
$DeliveryDate->save();
foreach ($BoxSizes as $BoxSize) {
$Box = new Box();
$Box->size_id = $BoxSize->id;
$Box->box_price = $BoxSize->box_size_price;
$Box->delivery_date_id = $DeliveryDate->id;
$Box->save();
}
echo '<p>Created new delivery_date: ' . $DeliveryDate->date . '</p>';
}
}
}
echo '<p><strong>Finished.</strong></p>';
Yii::app()->end();
}
示例3: createBox
public function createBox($delivery_id, $order_id, $fulfillment_code, $boxcount)
{
$boxcount = intval($boxcount);
for ($i = 0; $i < $boxcount; $i++) {
$box = new \Box();
$box->delivery_id = $delivery_id;
$box->merchant_trans_id = $order_id;
$box->fulfillment_code = $fulfillment_code;
$box->box_id = strval($i + 1);
$box->save();
}
}
示例4: updateBox
public function updateBox($delivery_id, $order_id, $fulfillment_code, $box_count, $position)
{
for ($n = 0; $n < $box_count; $n++) {
$box = new Box();
$box->delivery_id = $delivery_id;
$box->order_id = $order_id;
$box->fulfillment_code = $fulfillment_code;
$box->box_id = $n + 1;
$box->position = $position;
$box->deliveryStatus = Config::get('jayon.trans_status_confirmed');
$box->courierStatus = Config::get('jayon.trans_cr_atmerchant');
$box->warehouseStatus = Config::get('jayon.trans_wh_atmerchant');
$box->pickupStatus = Config::get('jayon.trans_status_tobepickup');
$box->save();
}
}
示例5: updateBox
public function updateBox($delivery_id, $order_id, $fulfillment_code, $box_count)
{
for ($n = 0; $n < $box_count; $n++) {
$box = new Box();
$box->delivery_id = $delivery_id;
$box->order_id = $order_id;
$box->fulfillment_code = $fulfillment_code;
$box->box_id = $n + 1;
$box->save();
}
}
示例6: duplicate
/**
* Duplicate a Box and all its items
* @return boolean
*/
public function duplicate()
{
$newBox = new Box();
$newBox->attributes = $this->attributes;
$newBox->box_id = null;
$newBox->save();
foreach ($this->BoxItems as $BoxItem) {
$newBoxItem = new BoxItem();
$newBoxItem->attributes = $BoxItem->attributes;
$newBoxItem->box_item_id = null;
$newBoxItem->box_id = $newBox->box_id;
$newBoxItem->save();
}
return true;
}
示例7: save_box
public static function save_box($delivery_id, $merchant_trans_id, $fulfillment_code, $count)
{
$affected = Box::where('delivery_id', '=', $delivery_id)->where('merchant_trans_id', '=', $merchant_trans_id)->where('fulfillment_code', '=', $fulfillment_code)->delete();
for ($i = 0; $i < $count; $i++) {
$bd = new Box();
$bd->delivery_id = $delivery_id;
$bd->merchant_trans_id = $merchant_trans_id;
$bd->fulfillment_code = $fulfillment_code;
$bd->box_id = $i + 1;
$bd->save();
$bds = new Boxstatus();
$bds->delivery_id = $delivery_id;
$bds->merchant_trans_id = $merchant_trans_id;
$bds->fulfillment_code = $fulfillment_code;
$bds->box_id = $i + 1;
$bds->timestamp = date('Y-m-d H:i:s', time());
$bds->save();
}
}