本文整理汇总了PHP中Tiki_Profile::fromDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Tiki_Profile::fromDb方法的具体用法?PHP Tiki_Profile::fromDb怎么用?PHP Tiki_Profile::fromDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tiki_Profile
的用法示例。
在下文中一共展示了Tiki_Profile::fromDb方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request_payment
function request_payment()
{
global $prefs, $user;
$tikilib = TikiLib::lib('tiki');
$paymentlib = TikiLib::lib('payment');
$total = $this->get_total();
if ($total > 0 || $this->total_no_discount) {
// if anonymous shopping to set pref as to which shopperinfo to show in description
if (empty($user) && $prefs['payment_cart_anonymous'] === 'y') {
$shopperinfo_descvar = 'email';
// TODO: make this a pref
if (!empty($_SESSION['shopperinfo'][$shopperinfo_descvar])) {
$shopperinfo_desc = $_SESSION['shopperinfo'][$shopperinfo_descvar];
$description = tra($prefs['payment_cart_heading']) . " ({$shopperinfo_desc})";
} else {
$description = tra($prefs['payment_cart_heading']);
}
} else {
$description = tra($prefs['payment_cart_heading']) . " ({$user})";
}
$invoice = $paymentlib->request_payment($description, $total, $prefs['payment_default_delay'], $this->get_description());
foreach ($this->get_behaviors() as $behavior) {
$paymentlib->register_behavior($invoice, $behavior['event'], $behavior['behavior'], $behavior['arguments']);
}
} else {
$invoice = 0;
foreach ($this->get_behaviors() as $behavior) {
if ($behavior['event'] == 'complete') {
$name = $behavior['behavior'];
$file = dirname(__FILE__) . "/behavior/{$name}.php";
$function = 'payment_behavior_' . $name;
require_once $file;
call_user_func_array($function, $behavior['arguments']);
}
}
}
// Handle anonymous user (not logged in) shopping that require only email
if (!$user || isset($_SESSION['forceanon']) && $_SESSION['forceanon'] == 'y') {
if (!empty($_SESSION['shopperinfo'])) {
// should also check for pref that this anonymous shopping feature is on
// First create shopper info in shopper tracker
global $record_profile_items_created;
$record_profile_items_created = array();
if (!empty($_SESSION['shopperinfoprofile'])) {
$shopper_profile_name = $_SESSION['shopperinfoprofile'];
} else {
$shopper_profile_name = $prefs['payment_cart_anonshopper_profile'];
}
$shopperprofile = Tiki_Profile::fromDb($shopper_profile_name);
$profileinstaller = new Tiki_Profile_Installer();
$profileinstaller->forget($shopperprofile);
// profile can be installed multiple times
$profileinstaller->setUserData($_SESSION['shopperinfo']);
$profileinstaller->install($shopperprofile);
// Then set user to shopper ID
$cartuser = $record_profile_items_created[0];
$record_profile_items_created = array();
} else {
$this->empty_cart();
return $invoice;
}
} else {
$cartuser = $user;
}
$userInput = array('user' => $cartuser, 'time' => $tikilib->now, 'total' => $total, 'invoice' => $invoice, 'weight' => $this->get_total_weight());
if (!$user || isset($_SESSION['forceanon']) && $_SESSION['forceanon'] == 'y') {
$orderprofile = Tiki_Profile::fromDb($prefs['payment_cart_anonorders_profile']);
$orderitemprofile = Tiki_Profile::fromDb($prefs['payment_cart_anonorderitems_profile']);
} else {
$orderprofile = Tiki_Profile::fromDb($prefs['payment_cart_orders_profile']);
$orderitemprofile = Tiki_Profile::fromDb($prefs['payment_cart_orderitems_profile']);
}
if ($user && $prefs['payment_cart_orders'] == 'y' || !$user && $prefs['payment_cart_anonymous'] == 'y') {
if (!$orderprofile) {
TikiLib::lib('errorreport')->report(tra('Advanced Shopping Cart setup error: Orders profile missing.'));
return false;
}
$profileinstaller = new Tiki_Profile_Installer();
$profileinstaller->forget($orderprofile);
// profile can be installed multiple times
$profileinstaller->setUserData($userInput);
} else {
$profileinstaller = '';
}
global $record_profile_items_created;
$record_profile_items_created = array();
if ($user && $prefs['payment_cart_orders'] == 'y' || !$user && $prefs['payment_cart_anonymous'] == 'y') {
$profileinstaller->install($orderprofile, 'none');
}
$content = $this->get_content();
foreach ($content as $info) {
if (!isset($info['is_gift_certificate']) || !$info['is_gift_certificate']) {
$process_info = $this->process_item($invoice, $total, $info, $userInput, $cartuser, $profileinstaller, $orderitemprofile);
}
}
$email_template_ids = array();
if (isset($process_info['product_classes']) && is_array($process_info['product_classes'])) {
$product_classes = array_unique($process_info['product_classes']);
} else {
$product_classes = array();
//.........这里部分代码省略.........