本文整理汇总了PHP中SJB_UserManager::isUserExistsByUserSid方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::isUserExistsByUserSid方法的具体用法?PHP SJB_UserManager::isUserExistsByUserSid怎么用?PHP SJB_UserManager::isUserExistsByUserSid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_UserManager
的用法示例。
在下文中一共展示了SJB_UserManager::isUserExistsByUserSid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$template = SJB_Request::getVar('template', 'manage_invoices.tpl');
$searchTemplate = SJB_Request::getVar('search_template', 'invoice_search_form.tpl');
$action = SJB_Request::getVar('action_name');
if (!empty($action)) {
$invoicesSIDs = SJB_Request::getVar('invoices', array());
$_REQUEST['restore'] = 1;
switch ($action) {
case 'paid':
foreach (array_keys($invoicesSIDs) as $invoiceSID) {
$invoice = SJB_InvoiceManager::getObjectBySID($invoiceSID);
$userSID = $invoice->getPropertyValue('user_sid');
if (SJB_UserManager::isUserExistsByUserSid($userSID)) {
$items = $invoice->getPropertyValue('items');
$productSIDs = $items['products'];
foreach ($productSIDs as $key => $productSID) {
if ($productSID != -1) {
if (SJB_ProductsManager::isProductExists($productSID)) {
$productInfo = $invoice->getItemValue($key);
$listingNumber = $productInfo['qty'];
$contract = new SJB_Contract(array('product_sid' => $productSID, 'numberOfListings' => $listingNumber, 'is_recurring' => $invoice->isRecurring()));
$contract->setUserSID($userSID);
$contract->setPrice($items['amount'][$key]);
if ($contract->saveInDB()) {
SJB_ListingManager::activateListingsAfterPaid($userSID, $productSID, $contract->getID(), $listingNumber);
SJB_ShoppingCart::deleteItemFromCartBySID($productInfo['shoppingCartRecord'], $userSID);
$bannerInfo = $productInfo['banner_info'];
if ($productInfo['product_type'] == 'banners' && !empty($bannerInfo)) {
$bannersObj = new SJB_Banners();
$bannersObj->addBanner($bannerInfo['title'], $bannerInfo['link'], $bannerInfo['bannerFilePath'], $bannerInfo['sx'], $bannerInfo['sy'], $bannerInfo['type'], 0, $bannerInfo['banner_group_sid'], $bannerInfo, $userSID, $contract->getID());
$bannerGroup = $bannersObj->getBannerGroupBySID($bannerInfo['banner_group_sid']);
SJB_AdminNotifications::sendAdminBannerAddedLetter($userSID, $bannerGroup);
}
if ($contract->isFeaturedProfile()) {
SJB_UserManager::makeFeaturedBySID($userSID);
}
if (SJB_UserNotificationsManager::isUserNotifiedOnSubscriptionActivation($userSID)) {
SJB_Notifications::sendSubscriptionActivationLetter($userSID, $productInfo);
}
}
}
} else {
$type = SJB_Array::getPath($items, 'custom_info/' . $key . '/type');
switch ($type) {
case 'featuredListing':
$listingId = SJB_Array::getPath($items, 'custom_info/' . $key . '/listing_id');
SJB_ListingManager::makeFeaturedBySID($listingId);
break;
case 'priorityListing':
$listingId = SJB_Array::getPath($items, 'custom_info/' . $key . '/listing_id');
SJB_ListingManager::makePriorityBySID($listingId);
break;
case 'activateListing':
$listingsIds = explode(",", SJB_Array::getPath($items, 'custom_info/' . $key . '/listings_ids'));
foreach ($listingsIds as $listingId) {
SJB_ListingManager::activateListingBySID($listingId);
}
break;
}
}
}
SJB_Statistics::addStatisticsFromInvoice($invoice);
}
$total = $invoice->getPropertyValue('total');
if ($total > 0) {
$gatewayID = $invoice->getPropertyValue('payment_method');
$gatewayID = isset($gatewayID) ? $gatewayID : 'cash_payment';
$transactionId = md5($invoiceSID . $gatewayID);
$transactionInfo = array('transaction_id' => $transactionId, 'invoice_sid' => $invoiceSID, 'amount' => $total, 'payment_method' => $gatewayID, 'user_sid' => $invoice->getPropertyValue('user_sid'));
$transaction = new SJB_Transaction($transactionInfo);
SJB_TransactionManager::saveTransaction($transaction);
}
SJB_InvoiceManager::markPaidInvoiceBySID($invoiceSID);
SJB_PromotionsManager::markPromotionAsPaidByInvoiceSID($invoiceSID);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-invoices/");
break;
case 'unpaid':
foreach (array_keys($invoicesSIDs) as $invoiceSID) {
SJB_InvoiceManager::markUnPaidInvoiceBySID($invoiceSID);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-invoices/');
break;
case 'delete':
foreach (array_keys($invoicesSIDs) as $invoiceSID) {
SJB_InvoiceManager::deleteInvoiceBySID($invoiceSID);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-invoices/');
break;
default:
unset($_REQUEST['restore']);
break;
}
}
/***************************************************************/
$_REQUEST['action'] = 'search';
$invoice = new SJB_Invoice(array());
$invoice->addProperty(array('id' => 'username', 'type' => 'string', 'value' => '', 'is_system' => true));
//.........这里部分代码省略.........
示例2: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$template = 'edit_invoice.tpl';
$errors = array();
$invoiceErrors = array();
$invoiceSID = SJB_Request::getVar('sid', false);
$action = SJB_Request::getVar('action', false);
$tcpdfError = SJB_Request::getVar('error', false);
if ($tcpdfError) {
$invoiceErrors[] = $tcpdfError;
}
$invoiceInfo = SJB_InvoiceManager::getInvoiceInfoBySID($invoiceSID);
$user_structure = null;
if ($invoiceInfo) {
$product_info = array();
if (array_key_exists('custom_info', $invoiceInfo['items'])) {
$product_info = $invoiceInfo['items']['custom_info'];
}
$invoiceInfo = array_merge($invoiceInfo, $_REQUEST);
$invoiceInfo['items']['custom_info'] = $product_info;
$includeTax = $invoiceInfo['include_tax'];
$invoice = new SJB_Invoice($invoiceInfo);
$invoice->setSID($invoiceSID);
$userSID = $invoice->getPropertyValue('user_sid');
$userExists = SJB_UserManager::isUserExistsByUserSid($userSID);
$subUserSID = $invoice->getPropertyValue('subuser_sid');
if (!empty($subUserSID)) {
$userInfo = SJB_UserManager::getUserInfoBySID($subUserSID);
$username = $userInfo['username'] . '/' . $userInfo['email'];
} else {
$userInfo = SJB_UserManager::getUserInfoBySID($userSID);
$username = $userInfo['FirstName'] . ' ' . $userInfo['LastName'] . ' ' . $userInfo['ContactName'] . ' ' . $userInfo['CompanyName'] . '/' . $userInfo['email'];
}
$taxInfo = $invoice->getPropertyValue('tax_info');
$productsSIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($userInfo['user_group_sid']);
$products = array();
foreach ($productsSIDs as $key => $productSID) {
$productInfo = SJB_ProductsManager::getProductInfoBySID($productSID);
if (!empty($productInfo['pricing_type']) && $productInfo['pricing_type'] == 'volume_based') {
$volumeBasedPricing = $productInfo['volume_based_pricing'];
$minListings = min($volumeBasedPricing['listings_range_from']);
$maxListings = max($volumeBasedPricing['listings_range_to']);
$countListings = array();
for ($i = $minListings; $i <= $maxListings; $i++) {
$countListings[$i]['number_of_listings'] = $i;
for ($j = 1; $j <= count($volumeBasedPricing['listings_range_from']); $j++) {
if ($i >= $volumeBasedPricing['listings_range_from'][$j] && $i <= $volumeBasedPricing['listings_range_to'][$j]) {
$countListings[$i]['price'] = $volumeBasedPricing['price_per_unit'][$j];
}
}
}
$productInfo['count_listings'] = $countListings;
}
$products[$key] = $productInfo;
}
$addForm = new SJB_Form($invoice);
$addForm->registerTags($tp);
$tp->assign('userExists', $userExists);
$tp->assign('products', $products);
$tp->assign('invoice_sid', $invoiceSID);
$tp->assign('include_tax', $includeTax);
$tp->assign('username', trim($username));
if ($action) {
switch ($action) {
case 'save':
case 'apply':
$invoiceErrors = $invoice->isValid();
if (empty($invoiceErrors) && $addForm->isDataValid($errors)) {
$invoice->setFloatNumbersIntoValidFormat();
SJB_InvoiceManager::saveInvoice($invoice);
if ($action == 'save') {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/manage-invoices/');
}
} else {
$invoiceDate = SJB_I18N::getInstance()->getInput('date', $invoice->getPropertyValue('date'));
$invoice->setPropertyValue('date', $invoiceDate);
}
$invoice->setFloatNumbersIntoValidFormat();
$taxInfo['tax_amount'] = SJB_I18N::getInstance()->getInput('float', $taxInfo['tax_amount']);
break;
case 'print':
case 'download_pdf_version':
$user = SJB_UserManager::getObjectBySID($userSID);
$user_structure = SJB_UserManager::createTemplateStructureForUser($user);
$template = 'print_invoice.tpl';
$username = SJB_Array::get($user_structure, 'CompanyName') . ' ' . SJB_Array::get($user_structure, 'FirstName') . ' ' . SJB_Array::get($user_structure, 'LastName');
$tp->assign('username', trim($username));
$tp->assign('user', $user_structure);
$tp->assign('tax', $taxInfo);
if ($action == 'download_pdf_version') {
$template = 'invoice_to_pdf.tpl';
$filename = 'invoice_' . $invoiceSID . '.pdf';
try {
SJB_HelperFunctions::html2pdf($tp->fetch($template), $filename);
exit;
} catch (Exception $e) {
SJB_Error::writeToLog($e->getMessage());
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/edit-invoice/?sid=' . $invoiceSID . '&error=TCPDF_ERROR');
}
//.........这里部分代码省略.........