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


PHP Transfer::save方法代码示例

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


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

示例1: action_changeShort

 public function action_changeShort()
 {
     echo 'test2';
     return;
     $member = \MemberQuery::create()->findOneById(1);
     $con = \Propel::getConnection();
     if (!$con->beginTransaction()) {
         throw new \Exception('Could not begin transaction');
     }
     try {
         $transfer = \TransferQuery::create()->findOneById(1);
         if (!$transfer) {
             $transfer = new \Transfer();
             $transfer->setMemberId($member->getId());
             $transfer->save($con);
             $transfer = \TransferQuery::create()->findOneById(1);
         }
         $transfer->setAmount($transfer->getAmount() + 2);
         $transfer->save($con);
         if (!$con->commit()) {
             throw new \Exception('Could not commit transaction');
         }
     } catch (\Exception $e) {
         $con->rollBack();
         throw $e;
     }
     print_r('<pre>');
     print_r($transfer->toArray());
     print_r('</pre>');
 }
开发者ID:nikonehauser,项目名称:pt,代码行数:30,代码来源:weight.controller.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @param integer $aid Allotment ID
  * @param integer $tid Transfer ID
  */
 public function actionCreate($aid, $tid)
 {
     if (Yii::app()->user->checkAccess($this->id . '.' . $this->action->id)) {
         $model = new Transfer();
         $model->transfer_date = date(Yii::app()->user->getDateFormat(false), time());
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Transfer'])) {
             $model->attributes = $_POST['Transfer'];
             $model->allotment_id = $aid;
             if (!is_null($tid)) {
                 $model->transfer_id = $tid;
             }
             if ($model->save()) {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         $this->render('create', array('model' => $model));
     } else {
         $this->accessDenied();
     }
 }
开发者ID:faisal80,项目名称:hms,代码行数:28,代码来源:TransferController.php

示例3: renderContent


//.........这里部分代码省略.........
                             $model->object_status = ConstantDefine::OBJECT_STATUS_PENDING;
                             $trans->type = ConstantDefine::TRANS_ROLE;
                             $trans->after_status = ConstantDefine::OBJECT_STATUS_PENDING;
                         } else {
                             $trans->type = ConstantDefine::TRANS_STATUS;
                             $trans->after_status = $model->object_status;
                         }
                         $trans->from_user_id = user()->id;
                         $trans->to_user_id = 0;
                         $trans->before_status = ConstantDefine::OBJECT_STATUS_DRAFT;
                     }
                     //The content is sent to PERSON DIRECTLY
                     if ($button == '2') {
                         $to_user_id = User::findPeople($model->person);
                         //Start to Transfer to the user and set the status to Pending
                         if ($to_user_id) {
                             $model->object_status = ConstantDefine::OBJECT_STATUS_PENDING;
                             $trans->from_user_id = user()->id;
                             $trans->to_user_id = $to_user_id->user_id;
                             $trans->type = ConstantDefine::TRANS_PERSON;
                             $trans->before_status = ConstantDefine::OBJECT_STATUS_PENDING;
                             $trans->after_status = ConstantDefine::OBJECT_STATUS_PENDING;
                         } else {
                             $model->addError('person', t('User not found'));
                         }
                     }
                     //Work with Resource Binding
                     $resource = array();
                     $resource_upload = array();
                     foreach ($content_resources as $res) {
                         $resource_upload[] = GxcHelpers::getArrayResourceObjectBinding('resource_upload_' . $res['type']);
                     }
                     $i = 0;
                     $count_resource = 0;
                     foreach ($content_resources as $cres) {
                         $j = 1;
                         foreach ($resource_upload[$i] as $res_up) {
                             $j++;
                             $count_resource++;
                         }
                         $i++;
                     }
                     $model->total_number_resource = $count_resource;
                     if ($model->save()) {
                         user()->setFlash('success', t('cms', 'Create new Content Successfully!'));
                         $trans->object_id = $model->object_id;
                         $trans->save();
                         // We have all the selected Terms for now
                         // We will add them to Object Terms
                         foreach ($selected_terms as $tx_key => $t) {
                             foreach ($t['terms'] as $key => $st_terms) {
                                 $obj_term = new ObjectTerm();
                                 $obj_term->object_id = $model->object_id;
                                 $obj_term->term_id = $st_terms['id'];
                                 $obj_term->data = $st_terms['data'];
                                 $obj_term->save();
                                 unset($obj_term);
                             }
                         }
                         //Update Resource Binding Here
                         $i = 0;
                         $count_resource = 0;
                         foreach ($content_resources as $cres) {
                             $j = 1;
                             foreach ($resource_upload[$i] as $res_up) {
                                 $obj_res = new ObjectResource();
                                 $obj_res->resource_id = $res_up['resid'];
                                 $obj_res->object_id = $model->object_id;
                                 $obj_res->description = '';
                                 $obj_res->type = $cres['type'];
                                 $obj_res->resource_order = $j;
                                 $obj_res->save();
                                 $j++;
                                 $count_resource++;
                             }
                             $i++;
                         }
                         //Re-init new Model
                         $model = new $types[$type]['class']();
                         $model->object_date = date('Y-m-d H:i:s');
                         Yii::app()->controller->refresh();
                     } else {
                         $model->object_date = date('Y-m-d H:i:s', $model->object_date);
                     }
                 }
                 $render_template = 'cmswidgets.views.object.object_form_widget';
                 if (file_exists(Yii::getPathOfAlias('common.content_type.' . strtolower($type) . '.object_form_widget') . '.php')) {
                     $render_template = 'common.content_type.' . strtolower($type) . '.object_form_widget';
                 }
                 $this->render($render_template, array('model' => $model, 'versions' => $versions, 'lang_exclude' => $lang_exclude, 'content_status' => $content_status, 'terms' => $terms, 'selected_terms' => $selected_terms, 'type' => $type, 'content_resources' => $content_resources));
             }
         } else {
             //The type is not in Content Type Definition
             $this->render('cmswidgets.views.object.object_start_widget', array('types' => $types));
         }
     } else {
         //There is no Type in $_GET
         $this->render('cmswidgets.views.object.object_start_widget', array('types' => $types));
     }
 }
开发者ID:pramana08,项目名称:GXC-CMS-2,代码行数:101,代码来源:ObjectCreateWidget.php

示例4: renderContent


//.........这里部分代码省略.........
             }
             //Re-Set the Status based on what User Chooose
             //The content is sent to ROLES OR STATUS
             if ($button == '1') {
                 //Check if the object_status is number or character
                 if (!is_numeric($object->object_status)) {
                     //Set the status to Pending
                     $trans->note = $object->object_status;
                     $object->object_status = ConstantDefine::OBJECT_STATUS_PENDING;
                     $trans->type = ConstantDefine::TRANS_ROLE;
                     $trans->after_status = ConstantDefine::OBJECT_STATUS_PENDING;
                 } else {
                     $trans->type = ConstantDefine::TRANS_STATUS;
                     $trans->after_status = $object->object_status;
                 }
                 $trans->from_user_id = user()->id;
                 $trans->to_user_id = 0;
                 $trans->before_status = ConstantDefine::OBJECT_STATUS_DRAFT;
             }
             //The content is sent to PERSON DIRECTLY
             if ($button == '2') {
                 $to_user_id = User::findPeople($object->person);
                 //Start to Transfer to the user and set the status to Pending
                 if ($to_user_id) {
                     $object->object_status = ConstantDefine::OBJECT_STATUS_PENDING;
                     $trans->from_user_id = user()->id;
                     $trans->to_user_id = $to_user_id->user_id;
                     $trans->type = ConstantDefine::TRANS_PERSON;
                     $trans->before_status = ConstantDefine::OBJECT_STATUS_PENDING;
                     $trans->after_status = ConstantDefine::OBJECT_STATUS_PENDING;
                 } else {
                     $object->addError('person', t('User not found'));
                 }
             }
             //Work with Resource Binding
             $resource = array();
             $resource_upload = array();
             foreach ($content_resources as $res) {
                 $resource_upload[] = GxcHelpers::getArrayResourceObjectBinding('resource_upload_' . $res['type']);
             }
             $i = 0;
             $count_resource = 0;
             foreach ($content_resources as $cres) {
                 $j = 1;
                 foreach ($resource_upload[$i] as $res_up) {
                     $j++;
                     $count_resource++;
                 }
                 $i++;
             }
             $object->total_number_resource = $count_resource;
             if ($object->save()) {
                 user()->setFlash('success', t('cms', 'Update content Successfully!'));
                 $trans->object_id = $object->object_id;
                 $trans->save();
                 //This is the update process, we should delete old
                 //Object Term binding
                 ObjectTerm::model()->deleteAll('object_id = :id', array(':id' => $object->object_id));
                 // We have all the selected Terms for now
                 // We will add them to Object Terms
                 foreach ($selected_terms as $tx_key => $t) {
                     foreach ($t['terms'] as $key => $st_terms) {
                         $obj_term = new ObjectTerm();
                         $obj_term->object_id = $object->object_id;
                         $obj_term->term_id = $st_terms['id'];
                         $obj_term->data = $st_terms['data'];
                         $obj_term->save();
                         unset($obj_term);
                     }
                 }
                 //Re update for Resource
                 ObjectResource::model()->deleteAll('object_id = :id', array(':id' => $object->object_id));
                 $i = 0;
                 $count_resource = 0;
                 foreach ($content_resources as $cres) {
                     $j = 1;
                     foreach ($resource_upload[$i] as $res_up) {
                         $obj_res = new ObjectResource();
                         $obj_res->resource_id = $res_up['resid'];
                         $obj_res->object_id = $object->object_id;
                         $obj_res->description = '';
                         $obj_res->type = $cres['type'];
                         $obj_res->resource_order = $j;
                         $obj_res->save();
                         $j++;
                         $count_resource++;
                     }
                     $i++;
                 }
             }
             $object->object_date = date('Y-m-d H:i:s', $object->object_date);
         }
         //Start Render the Form
         $render_template = 'cmswidgets.views.object.object_form_widget';
         if (file_exists(Yii::getPathOfAlias('common.content_type.' . strtolower($type) . '.object_form_widget') . '.php')) {
             $render_template = 'common.content_type.' . strtolower($type) . '.object_form_widget';
         }
         $this->render($render_template, array('model' => $object, 'versions' => $versions, 'lang_exclude' => $lang_exclude, 'content_status' => $content_status, 'terms' => $terms, 'selected_terms' => $selected_terms, 'type' => $type, 'content_resources' => $content_resources));
     }
 }
开发者ID:pramana08,项目名称:GXC-CMS-2,代码行数:101,代码来源:ObjectUpdateWidget.php

示例5: doOldImport

 public function doOldImport()
 {
     DB::delete('DELETE FROM `cache`');
     // delete old data:
     foreach (Auth::user()->accounts()->get() as $acc) {
         $acc->delete();
     }
     foreach (Auth::user()->budgets()->get() as $b) {
         $b->delete();
     }
     foreach (Auth::user()->categories()->get() as $b) {
         $b->delete();
     }
     foreach (Auth::user()->beneficiaries()->get() as $b) {
         $b->delete();
     }
     foreach (Icon::get() as $icon) {
         $icon->delete();
     }
     $data = file_get_contents('http://commondatastorage.googleapis.com/nder/import.json');
     $json = json_decode($data);
     $map = array();
     $map['accounts'] = array();
     $map['icons'] = array();
     // all accounts:
     foreach ($json->accounts as $account) {
         $newAccount = new Account();
         $newAccount->name = Crypt::encrypt($account->name);
         $newAccount->balance = floatval($account->balance);
         $newAccount->fireflyuser_id = Auth::user()->id;
         $newAccount->date = $account->date;
         $newAccount->save();
         $map['accounts'][$account->id] = $newAccount->id;
     }
     // all icons:
     foreach ($json->icons as $icon) {
         $newIcon = new Icon();
         $newIcon->file = $icon->file;
         $newIcon->save();
         $map['icons'][intval($icon->id)] = $newIcon->id;
     }
     // all beneficiaries:
     foreach ($json->beneficiaries as $ben) {
         $nb = new Beneficiary();
         $nb->fireflyuser_id = Auth::user()->id;
         $nb->name = Crypt::encrypt($ben->name);
         $nb->save();
         $map['beneficiaries'][$ben->id] = $nb->id;
     }
     // all budgets
     foreach ($json->budgets as $bd) {
         $nbg = new Budget();
         $nbg->fireflyuser_id = Auth::user()->id;
         $nbg->name = Crypt::encrypt($bd->name);
         $nbg->date = $bd->date;
         $nbg->amount = floatval($bd->amount);
         $nbg->save();
         $map['budgets'][$bd->id] = $nbg->id;
     }
     // all categories:
     foreach ($json->categories as $c) {
         $nc = new Category();
         $nc->fireflyuser_id = Auth::user()->id;
         $nc->icon_id = intval($map['icons'][intval($c->icon_id)]);
         $nc->name = Crypt::encrypt($c->name);
         $nc->showtrend = intval($c->showtrend);
         $nc->save();
         $map['categories'][$c->id] = $nc->id;
     }
     foreach ($json->targets as $t) {
         $nt = new Target();
         $nt->fireflyuser_id = Auth::user()->id;
         $nt->account_id = $map['accounts'][$t->account_id];
         $nt->description = Crypt::encrypt($t->description);
         $nt->amount = floatval($t->amount);
         $nt->duedate = $t->duedate;
         $nt->startdate = $t->startdate;
         $nt->save();
         $map['targets'][$t->id] = $nt->id;
     }
     foreach ($json->transactions as $t) {
         $nt = new Transaction();
         $nt->fireflyuser_id = Auth::user()->id;
         $nt->account_id = $map['accounts'][$t->account_id];
         $nt->budget_id = is_null($t->budget_id) ? NULL : intval($map['budgets'][$t->budget_id]);
         $nt->category_id = is_null($t->category_id) ? NULL : $map['categories'][$t->category_id];
         $nt->beneficiary_id = is_null($t->beneficiary_id) ? NULL : $map['beneficiaries'][$t->beneficiary_id];
         $nt->description = Crypt::encrypt($t->description);
         $nt->amount = floatval($t->amount);
         $nt->date = $t->date;
         $nt->onetime = intval($t->onetime);
         $nt->save();
         $map['transactions'][$t->id] = $nt->id;
     }
     foreach ($json->transfers as $t) {
         $nt = new Transfer();
         $nt->fireflyuser_id = Auth::user()->id;
         $nt->account_from = $map['accounts'][$t->account_from];
         $nt->account_to = $map['accounts'][$t->account_to];
         $nt->category_id = is_null($t->category_id) ? NULL : $map['categories'][$t->category_id];
//.........这里部分代码省略.........
开发者ID:jcyh,项目名称:nder-firefly,代码行数:101,代码来源:ImportController.php

示例6: dirname

<?php

echo 'test1';
include dirname(__FILE__) . '/bootstrap.php';
$member = \MemberQuery::create()->findOneById(1);
$con = \Propel::getConnection();
if (!$con->beginTransaction()) {
    throw new \Exception('Could not begin transaction');
}
try {
    $transfer = \TransferQuery::create()->findOneById(1);
    if (!$transfer) {
        $transfer = new \Transfer();
        $transfer->setMemberId($member->getId());
        $transfer->save($con);
        $transfer = \TransferQuery::create()->findOneById(1);
    }
    $transfer->setAmount($transfer->getAmount() + 2);
    $transfer->save($con);
    if (!$con->commit()) {
        throw new \Exception('Could not commit transaction');
    }
} catch (\Exception $e) {
    $con->rollBack();
    throw $e;
}
print_r('<pre>');
print_r($transfer->toArray());
print_r('</pre>');
echo "\n CONSISTENCY 2\n";
开发者ID:nikonehauser,项目名称:pt,代码行数:30,代码来源:consistency2.php

示例7: newTransfer

 public function newTransfer()
 {
     $transfer = new Transfer();
     $transfer->amount = floatval(Input::get('amount'));
     $transfer->description = Input::get('description');
     $transfer->fireflyuser_id = Auth::user()->id;
     $transfer->date = Input::get('date');
     // account_from (special)
     if (!is_null(Input::get('account_from'))) {
         $account = Auth::user()->accounts()->find(Input::get('account_from'));
         if (!is_null($account)) {
             $transfer->account_from = $account->id;
         }
     }
     // account_to (special)
     if (!is_null(Input::get('account_to'))) {
         $account = Auth::user()->accounts()->find(Input::get('account_to'));
         if (!is_null($account)) {
             $transfer->account_to = $account->id;
         }
     }
     // category (special)
     if (strlen(Input::get('category')) > 0) {
         $categories = Auth::user()->categories()->get();
         //->where('name','=',Input::get('category'))->first();
         $category = null;
         foreach ($categories as $cat) {
             if (Crypt::decrypt($cat->name) == Input::get('category')) {
                 $category = $cat;
                 break;
             }
         }
         unset($cat, $categories);
         if (is_null($category)) {
             $category = new Category();
             $category->fireflyuser_id = Auth::user()->id;
             $category->name = Input::get('category');
             $category->showtrend = 0;
             $category->icon_id = Icon::first()->id;
             $validator = Validator::make($category->toArray(), Category::$rules);
             if ($validator->passes()) {
                 $category->name = Crypt::encrypt($category->name);
                 $category->save();
                 $transfer->category_id = $category->id;
             }
         } else {
             $transfer->category_id = $category->id;
         }
     }
     // budget (special)
     if (intval(Input::get('budget')) > 0) {
         $budget = Auth::user()->budgets()->find(intval(Input::get('budget')));
         if (!is_null($budget)) {
             $transfer->budget_id = $budget->id;
         }
     }
     // target (special)
     if (strlen(Input::get('target')) > 0) {
         $targets = Auth::user()->targets()->get();
         //->where('name','=',Input::get('category'))->first();
         $target = null;
         foreach ($targets as $t) {
             if (Crypt::decrypt($t->description) == Input::get('target')) {
                 $transfer->target_id = $t->id;
                 break;
             }
         }
         unset($targets, $t);
     }
     $validator = Validator::make($transfer->toArray(), Transfer::$rules);
     $transfer->description = Crypt::encrypt($transfer->description);
     if ($validator->fails()) {
         return Redirect::to('/home/transfer/add')->withErrors($validator)->withInput();
     } else {
         $transfer->save();
         return Redirect::to('/home');
     }
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:78,代码来源:TransferController.php

示例8: doTransfer

 public function doTransfer()
 {
     $trade_key = Input::get('trade_key');
     $amount = Input::get('amount');
     $wallet_id = Input::get('wallet_id');
     $password = Input::get('password');
     $wallet = Wallet::find($wallet_id);
     $balance = new Balance();
     $user = Confide::user();
     if (Hash::check($password, $user->password)) {
         $user_receive = User::where('trade_key', $trade_key)->first();
         $amount_balance = $balance->getBalance($wallet->id);
         if (!isset($user_receive->username)) {
             return Redirect::to('user/transfer-coin/' . $wallet->id)->with('error', 'Sorry. The trade key not exist!');
         } elseif ($user_receive->id == $user->id) {
             return Redirect::to('user/transfer-coin/' . $wallet->id)->with('error', 'Sorry. You can not referrer to yourself!');
         } elseif ($amount_balance < $amount) {
             return Redirect::to('user/transfer-coin/' . $wallet->id)->with('error', 'Amount should be less than or equal to your balance.');
         } else {
             if ($balance->takeMoney($amount, $wallet->id, $user->id)) {
                 $balance->addMoney($amount, $wallet->id, $user_receive->id);
                 $transfer_his = new Transfer();
                 $transfer_his->sender = $user->id;
                 $transfer_his->receiver = $user_receive->id;
                 $transfer_his->wallet_id = $wallet->id;
                 $transfer_his->amount = $amount;
                 $transfer_his->save();
                 return Redirect::to('user/transfer-coin/' . $wallet->id)->with('success', 'You sent to user "' . $user_receive->username . '" ' . $amount . ' ' . $wallet->getType($wallet->id) . '.');
             }
         }
     } else {
         return Redirect::to('user/transfer-coin/' . $wallet->id)->with('error', "Password invalid.");
     }
 }
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:34,代码来源:UserController.php

示例9: Insurance

        $newLoan->save();
    }
    if (isset($_POST['insTo'])) {
        $newIns = new Insurance();
        $newIns->set($_GET['id'], strtotime($_POST['insTo']));
        $newIns->save();
    }
    if (isset($_POST['visaTo'])) {
        $newVisa = new Visa();
        $newVisa->set($_GET['id'], strtotime($_POST['visaTo']));
        $newVisa->save();
    }
    if (isset($_POST['transFrom'])) {
        $newTrans = new Transfer();
        $newTrans->set($_GET['id'], $_POST['assoc'], strtotime($_POST['transFrom']));
        $newTrans->save();
    }
    $teams = Team::find_all();
    $assocs = Assoc::find_all();
    if ($player->category == 1) {
        $contracts = Contract::find_by_sql("SELECT * FROM contracts WHERE player={$player->id} ORDER BY date_of_reg ASC");
        $insurances = Insurance::find_by_sql("SELECT * FROM insurances WHERE player={$player->id} ORDER BY added_on ASC");
        $visas = Visa::find_by_sql("SELECT * FROM visas WHERE player={$player->id} ORDER BY added_on ASC");
        $loans = Loan::find_by_sql("SELECT * FROM loans WHERE player={$player->id} ORDER BY start ASC");
        $transfers = Transfer::find_by_sql("SELECT * FROM transfers WHERE player={$player->id} ORDER BY start ASC");
        $contractTeam = $player->find_contract_team();
        $currentTeam = $player->find_current_team();
        $transTo = Assoc::find_by_sql("SELECT * FROM assocs WHERE id = (SELECT assoc FROM transfers WHERE player = {$_GET['id']} AND returned = 0)");
    }
}
?>
开发者ID:kunal-bajpai,项目名称:gfa,代码行数:31,代码来源:playerView.php


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