本文整理汇总了PHP中Transfer类的典型用法代码示例。如果您正苦于以下问题:PHP Transfer类的具体用法?PHP Transfer怎么用?PHP Transfer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transfer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>');
}
示例2: display
public function display()
{
// Cancel the transfer if a request is submitted.
if (isset($_POST['cancel'])) {
$transfer = new Transfer();
$transfer->cancelSessions();
unset($_POST['cancel']);
$pos = strrpos($_SERVER['HTTP_REFERER'], '/');
$pos = strlen($_SERVER['HTTP_REFERER']) - $pos;
header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "New-Funds-Transfer");
// Otherwise process the transfer.
} elseif (isset($_POST['submit'])) {
unset($_POST['submit']);
// To negate any back button issues.
if (!isset($_SESSION['transferDate']) || !isset($_SESSION['transferDescription']) || !isset($_SESSION['transferRemitter']) || !isset($_SESSION['transferAmount'])) {
header('Location: New-Funds-Transfer');
}
if (isset($_POST['password'])) {
$validate = new Validation();
// Validate the password.
try {
$validate->password($_POST['password']);
} catch (ValidationException $e) {
$_SESSION['error'] = $e->getError();
}
if (isset($_SESSION['error'])) {
unset($_POST['password']);
header('Location: New-Funds-Transfer');
} else {
$user = new Users();
$user->userID = $_SESSION['userID'];
$user->password = $_POST['password'];
unset($_POST['password']);
// Confirm the password is corredt.
try {
$user->confirmPassword();
} catch (ValidationException $e) {
$_SESSION['error'] = $e->getError();
}
if (isset($_SESSION['error'])) {
header('Location: New-Funds-Transfer');
} else {
// If everything is ok, process the transfer and display
// the Transfer Acknowledgement Page
$account = new Account();
$account->accountID = $_SESSION['transferAccountID'];
if ($account->processTransfer()) {
include 'view/layout/transferack.php';
} else {
// Otherwise return to the Check Transfer page.
$checkTransfer = new CheckTransfer();
$checkTransfer->init();
include 'view/layout/checktransfer.php';
}
}
}
}
}
}
示例3: initialize
/**
* @see Application::initialize()
*/
public function initialize(Transfer $transfer)
{
$template = new Template('');
$template->baseUrl = dirname($transfer->server('PHP_SELF'));
if ($template->baseUrl != '/') {
$template->baseUrl = $template->baseUrl . '/';
}
$transfer->baseTpl = $template;
$transfer->layout = $template->derive($this->getTemplatesPath() . 'layout.phtml');
}
示例4: sendContactMail
public function sendContactMail($name, $email, $message, $transferId, $hiddenMessage, $title)
{
if ($hiddenMessage == "" && isset($title)) {
$transfer = new Transfer();
$transferInfo = $transfer->getTransferById($transferId);
$mailMessage = $this->createMailMessage($name, $email, $message, $transferInfo);
$betreff = "Nachricht von Dhamma-Reise";
$header = 'From: dhamma-reise@edelbyte.de' . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'Content-Type:text/plain" \\r\\n' . 'X-Mailer: PHP/' . phpversion();
$this->debug("NEW MAIL MESSAGE", "Sending mail to: " . $transferInfo['email'] . "\n" . $betreff . $mailMessage);
mail($transferInfo['email'], $betreff, $mailMessage, $header, "-f dhamma-reise@edelbyte.de");
}
}
示例5: instanceUrl
/**
* Get API URL for this Stripe transfer reversal.
*
* @throws \Arcanedev\Stripe\Exceptions\InvalidRequestException
*
* @return string
*/
public function instanceUrl()
{
if (is_null($id = $this['id'])) {
throw new InvalidRequestException('Could not determine which URL to request: class instance has invalid ID [null]', null);
}
return implode('/', [Transfer::classUrl(), urlencode(str_utf8($this['transfer'])), 'reversals', urlencode(str_utf8($id))]);
}
示例6: testAllCharge
public function testAllCharge()
{
self::authorizeFromEnv();
$transfers = Transfer::all(array('limit' => 3, 'offset' => 0));
if (count($transfers['data'])) {
$transfer = Transfer::retrieve($transfers['data'][0]->id);
$charges = $transfer->charges->all(array('limit' => 3, 'offset' => 0));
}
}
示例7: transfers
/**
* @param array|null $params
*
* @return Collection of the Recipient's Transfers
*/
public function transfers($params = null)
{
if ($params === null) {
$params = array();
}
$params['recipient'] = $this->id;
$transfers = Transfer::all($params, $this->_opts);
return $transfers;
}
示例8: testTransferUpdateMetadataAll
public function testTransferUpdateMetadataAll()
{
$recipient = self::createTestRecipient();
self::authorizeFromEnv();
$transfer = Transfer::create(array('amount' => 100, 'currency' => 'usd', 'recipient' => $recipient->id));
$transfer->metadata = array('test' => 'foo bar');
$transfer->save();
$updatedTransfer = Transfer::retrieve($transfer->id);
$this->assertSame('foo bar', $updatedTransfer->metadata['test']);
}
示例9: instanceUrl
/**
* @return string The API URL for this Stripe transfer reversal.
*/
public function instanceUrl()
{
$id = $this['id'];
$transfer = $this['transfer'];
if (!$id) {
throw new Error\InvalidRequest("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null);
}
$id = Util\Util::utf8($id);
$transfer = Util\Util::utf8($transfer);
$base = Transfer::classUrl();
$transferExtn = urlencode($transfer);
$extn = urlencode($id);
return "{$base}/{$transferExtn}/reversals/{$extn}";
}
示例10: showFormInventory
/**
* Print the config form for restrictions
*
* @return Nothing (display)
**/
function showFormInventory()
{
global $DB, $CFG_GLPI;
if (!self::canView()) {
return false;
}
$canedit = Config::canUpdate();
if ($canedit) {
echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>";
}
echo "<div class='center' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __('Assets') . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td width='30%'>" . __('Enable the financial and administrative information by default') . "</td>";
echo "<td width='20%'>";
Dropdown::ShowYesNo('auto_create_infocoms', $CFG_GLPI["auto_create_infocoms"]);
echo "</td><td width='20%'> " . __('Restrict monitor management') . "</td>";
echo "<td width='30%'>";
$this->dropdownGlobalManagement("monitors_management_restrict", $CFG_GLPI["monitors_management_restrict"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Software category deleted by the dictionary rules') . "</td><td>";
SoftwareCategory::dropdown(array('value' => $CFG_GLPI["softwarecategories_id_ondelete"], 'name' => "softwarecategories_id_ondelete"));
echo "</td><td> " . __('Restrict device management') . "</td><td>";
$this->dropdownGlobalManagement("peripherals_management_restrict", $CFG_GLPI["peripherals_management_restrict"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Beginning of fiscal year') . "</td><td>";
Html::showDateField("date_tax", array('value' => $CFG_GLPI["date_tax"], 'maybeempty' => false, 'canedit' => true, 'min' => '', 'max' => '', 'showyear' => false));
echo "</td><td> " . __('Restrict phone management') . "</td><td>";
$this->dropdownGlobalManagement("phones_management_restrict", $CFG_GLPI["phones_management_restrict"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Automatic fields (marked by *)') . "</td><td>";
$tab = array(0 => __('Global'), 1 => __('By entity'));
Dropdown::showFromArray('use_autoname_by_entity', $tab, array('value' => $CFG_GLPI["use_autoname_by_entity"]));
echo "</td><td> " . __('Restrict printer management') . "</td><td>";
$this->dropdownGlobalManagement("printers_management_restrict", $CFG_GLPI["printers_management_restrict"]);
echo "</td></tr>";
echo "</table>";
if (Session::haveRightsOr("transfer", array(CREATE, UPDATE)) && Session::isMultiEntitiesMode()) {
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('Automatic transfer of computers') . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Template for the automatic transfer of computers in another entity') . "</td><td>";
Transfer::dropdown(array('value' => $CFG_GLPI["transfers_id_auto"], 'name' => "transfers_id_auto", 'emptylabel' => __('No automatic transfer')));
echo "</td></tr>";
echo "</table>";
}
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='4'>" . __('Automatically update of the elements related to the computers');
echo "</th><th colspan='2'>" . __('Unit management') . "</th></tr>";
echo "<tr><th> </th>";
echo "<th>" . __('Alternate username') . "</th>";
echo "<th>" . __('User') . "</th>";
echo "<th>" . __('Group') . "</th>";
echo "<th>" . __('Location') . "</th>";
echo "<th>" . __('Status') . "</th>";
echo "</tr>";
$fields = array("contact", "user", "group", "location");
echo "<tr class='tab_bg_2'>";
echo "<td> " . __('When connecting or updating') . "</td>";
$values[0] = __('Do not copy');
$values[1] = __('Copy');
foreach ($fields as $field) {
echo "<td>";
$fieldname = "is_" . $field . "_autoupdate";
Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
echo "</td>";
}
echo "<td>";
State::dropdownBehaviour("state_autoupdate_mode", __('Copy computer status'), $CFG_GLPI["state_autoupdate_mode"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td> " . __('When disconnecting') . "</td>";
$values[0] = __('Do not delete');
$values[1] = __('Clear');
foreach ($fields as $field) {
echo "<td>";
$fieldname = "is_" . $field . "_autoclean";
Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
echo "</td>";
}
echo "<td>";
State::dropdownBehaviour("state_autoclean_mode", __('Clear status'), $CFG_GLPI["state_autoclean_mode"]);
echo "</td></tr>";
if ($canedit) {
echo "<tr class='tab_bg_2'>";
echo "<td colspan='6' class='center'>";
echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
echo "</td></tr>";
}
echo "</table></div>";
Html::closeForm();
//.........这里部分代码省略.........
示例11: updateComputerNoTranfer
/**
* Update computer to not change entity (transfer not allowed)
*
* @test
*/
public function updateComputerNoTranfer()
{
global $DB;
$DB->connect();
$transfer = new Transfer();
$computer = new Computer();
$pfiComputerInv = new PluginFusioninventoryInventoryComputerInventory();
$pfEntity = new PluginFusioninventoryEntity();
// Manual transfer computer to entity 2
$transfer->getFromDB(1);
$item_to_transfer = array("Computer" => array(1 => 1));
$transfer->moveItems($item_to_transfer, 2, $transfer->fields);
$computer->getFromDB(1);
$this->assertEquals(2, $computer->fields['entities_id'], 'Transfer move computer');
$this->AgentEntity(1, 2, 'Transfer computer on entity 2');
// Define entity 2 not allowed to transfer
$ents_id = $pfEntity->add(array('entities_id' => 2, 'transfers_id_auto' => 0));
$this->assertEquals(2, $ents_id, 'Entity 2 defined with no transfer');
// Update computer and computer must not be transfered (keep in entoty 2)
$a_inventory = array();
$a_inventory['CONTENT']['HARDWARE'] = array('NAME' => 'pc1');
$a_inventory['CONTENT']['BIOS'] = array('SSN' => 'xxyyzz');
$pfiComputerInv->import("pc-2013-02-13", "", $a_inventory);
// Update
$this->assertEquals(1, countElementsInTable('glpi_computers'), 'Must have only 1 computer');
$computer->getFromDB(1);
$this->assertEquals(2, $computer->fields['entities_id'], 'Computer must not be transfered');
$this->AgentEntity(1, 2, 'Agent must stay with entity 2');
}
示例12: retrieveByClient
static public function retrieveByClient($status, $client_id = null)
{
//echo $status;
$types= array('all','sell','purchase','switch');
$statuses= array('all','pending','completed','cancelled');
if(!in_array($status,$statuses))
if(!in_array($status,$types))
die('Wrong status when getting transfer collection!');
$IsTypeOriented = in_array($status,$statuses) ? false: true;
if(!$client_id)
die('Should add case for all clients!');
$transactions= array();
if($IsTypeOriented)
$addition = ($status!= 'all') ? " AND types = '$status'" : "";
else
$addition = ($status!= 'all') ? " AND status = '$status'" : "";
$query = " SELECT t.id, t.created_at, t.comment, a.name aname, i.fund_name name,
i.ISIN code, t.status, t.types, t.amount, t.trade_date, t.settlement_date
FROM transfers t, custody_ac a, fund i
WHERE t.id_client = '$client_id' AND a.id = t.id_custody1 AND i.id = t.id_isin $addition ";
$qres=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_assoc($qres))
{
$transfer = new Transfer();
$transfer->setId($row['id']);
$transfer->setStatus($row['status']);
$transfer->setType($row['types']);
$transfer->setComment($row['comment']);
$transfer->setSecurity($row['name']);
$transfer->setAmount($row['amount']);
$transfer->setIsin($row['code']);
$transfer->setTradeDate($row['trade_date']);
$transfer->setSettlementDate($row['settlement_date']);
$transfer->setAccount($row['aname']);
$transfer->setCreatedAt($row['created_at']);
$transfers[] = $transfer;
}
return $transfers;
}
示例13: 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];
//.........这里部分代码省略.........
示例14: 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";
示例15: Transfer
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Html::header(__('Transfer'), '', 'admin', 'rule', 'transfer');
$transfer = new Transfer();
$transfer->checkGlobal(READ);
if (isset($_POST['transfer'])) {
if (isset($_SESSION['glpitransfer_list'])) {
if (!Session::haveAccessToEntity($_POST['to_entity'])) {
Html::displayRightError();
}
$transfer->moveItems($_SESSION['glpitransfer_list'], $_POST['to_entity'], $_POST);
unset($_SESSION['glpitransfer_list']);
echo "<div class='b center'>" . __('Operation successful') . "<br>";
echo "<a href='central.php'>" . __('Back') . "</a></div>";
Html::footer();
exit;
}
} else {
if (isset($_POST['clear'])) {