本文整理汇总了PHP中SJB_UserManager::createTemplateStructureForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::createTemplateStructureForUser方法的具体用法?PHP SJB_UserManager::createTemplateStructureForUser怎么用?PHP SJB_UserManager::createTemplateStructureForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_UserManager
的用法示例。
在下文中一共展示了SJB_UserManager::createTemplateStructureForUser方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommentsInfo
public static function getCommentsInfo($raw_comments)
{
$comments_tree = new SJB_CommentsTree($raw_comments);
$comments_tree->build();
$comments_to_listing = $comments_tree->toArray();
$comments = array();
foreach ($comments_to_listing as $comment) {
if (intval($comment['user_id']) > 0) {
$user = SJB_UserManager::getObjectBySID($comment['user_id']);
$comment['user'] = SJB_UserManager::createTemplateStructureForUser($user);
}
$comment['added'] = strtotime($comment['added']);
$comments[] = $comment;
}
return $comments;
}
示例2: sendInvoiceToCustomer
public static function sendInvoiceToCustomer($invoice_sid, $user_sid)
{
$invoice_info = SJB_InvoiceManager::getInvoiceInfoBySID($invoice_sid);
$invoice_structure = SJB_InvoiceManager::createInvoiceTemplate($invoice_info);
$user = SJB_UserManager::getObjectBySID($user_sid);
$userInfo = SJB_UserManager::createTemplateStructureForUser($user);
$parentSID = SJB_Array::get($userInfo, 'parent_sid');
if ($parentSID > 0) {
$user = SJB_UserManager::getObjectBySID($parentSID);
$userInfo = SJB_UserManager::createTemplateStructureForUser($user);
}
$data = array('user' => $userInfo, 'invoice' => $invoice_structure);
$email = SJB_EmailTemplateEditor::getEmail($userInfo['email'], self::SEND_INVOICE_SID, $data);
return $email->send('Send Invoice to Customer');
}
示例3: getContactInfo
/**
* retrieve user info like template structure
* @static
* @param int $userSID
* @param int $contactSID
* @return array|null
*/
public static function getContactInfo($userSID, $contactSID)
{
$result = SJB_DB::query('SELECT `contact_sid`, `note` FROM `private_message_contacts` WHERE `user_sid` = ?n AND `contact_sid` = ?n', $userSID, $contactSID);
if (!empty($result)) {
$contactInfo = array_pop($result);
$contact = SJB_UserManager::getObjectBySID($contactInfo['contact_sid']);
$contactInfo2 = !empty($contact) ? SJB_UserManager::createTemplateStructureForUser($contact) : null;
if ($contactInfo2) {
return array_merge($contactInfo, $contactInfo2);
}
}
return null;
}
示例4: createTemplateStructureForListing
/**
* @param SJB_Listing $listing
*/
public static function createTemplateStructureForListing($listing, $extraInfo = array())
{
$listing_info = parent::getObjectInfo($listing);
if (SJB_MemoryCache::has('listingTypeInfo' . $listing->getListingTypeSID())) {
$listing_type_info = SJB_MemoryCache::get('listingTypeInfo' . $listing->getListingTypeSID());
} else {
$listing_type_info = SJB_ListingTypeManager::getListingTypeInfoBySID($listing->getListingTypeSID());
SJB_MemoryCache::set('listingTypeInfo' . $listing->getListingTypeSID(), $listing_type_info);
}
foreach ($listing->getProperties() as $property) {
if ($property->isComplex()) {
$isPropertyEmpty = true;
$properties = $property->type->complex->getProperties();
$properties = is_array($properties) ? $properties : array();
foreach ($properties as $subProperty) {
if (!empty($listing_info['user_defined'][$property->getID()][$subProperty->getID()]) && is_array($listing_info['user_defined'][$property->getID()][$subProperty->getID()])) {
foreach ($listing_info['user_defined'][$property->getID()][$subProperty->getID()] as $subValue) {
if (!empty($subValue)) {
$isPropertyEmpty = false;
}
}
}
}
if ($isPropertyEmpty) {
$listing_info['user_defined'][$property->getID()] = '';
}
}
if ($property->getType() == 'list') {
$value = $property->getValue();
$properties = $property->type->property_info;
$listValues = isset($properties['list_values']) ? $properties['list_values'] : array();
foreach ($listValues as $listValue) {
if ($listValue['id'] == $value) {
$listing_info['user_defined'][$property->getID()] = $listValue['caption'];
}
}
} elseif ($property->getType() == 'multilist') {
$value = $property->getValue();
if (!is_array($property->getValue())) {
$value = explode(',', $property->getValue());
}
$properties = $property->type->property_info;
$listValues = isset($properties['list_values']) ? $properties['list_values'] : array();
$listing_info['user_defined'][$property->getID()] = array();
foreach ($listValues as $listValue) {
if (in_array($listValue['id'], $value)) {
$listing_info['user_defined'][$property->getID()][$listValue['id']] = $listValue['caption'];
}
}
} elseif ($property->getType() == 'location' && is_array($listing_info['user_defined'][$property->getID()])) {
foreach ($property->type->fields as $locationField) {
if (array_key_exists($locationField['id'], $listing_info['user_defined'][$property->getID()])) {
if ($locationField['id'] == 'State') {
$listValues = SJB_StatesManager::getStateNamesBySid($property->value['State'], 'state_name');
} else {
$listValues = isset($locationField['list_values']) ? $locationField['list_values'] : array();
}
$value = $property->getValue();
$value = isset($value[$locationField['id']]) ? $value[$locationField['id']] : '';
foreach ($listValues as $listValue) {
if ($listValue['id'] == $value) {
$listing_info['user_defined'][$property->getID()][$locationField['id']] = $listValue['caption'];
$listing_info['user_defined'][$property->getID()][$locationField['id'] . '_Code'] = $listValue['Code'];
$listing_info['user_defined'][$property->getID()][$locationField['id'] . '_Name'] = $listValue['Name'];
}
}
}
}
}
}
$cache = SJB_Cache::getInstance();
$cacheId = md5('SJB_UserManager::getObjectBySID' . $listing_info['system']['user_sid']);
$user_info = array();
if ($cache->test($cacheId)) {
$user_info = $cache->load($cacheId);
} else {
$user = SJB_UserManager::getObjectBySID($listing_info['system']['user_sid']);
$user_info = !empty($user) ? SJB_UserManager::createTemplateStructureForUser($user) : null;
$cache->save($user_info, $cacheId, array(SJB_Cache::TAG_USERS));
}
$productInfo = SJB_ProductsManager::createTemplateStructureForProduct($listing_info['system']['product_info']);
$priceForUpgradeToFeatured = 0;
$priceForUpgradeToPriority = 0;
if (!empty($listing_info['system']['product_info'])) {
$listingProductInfo = unserialize($listing_info['system']['product_info']);
$priceForUpgradeToFeatured = SJB_Array::get($listingProductInfo, 'upgrade_to_featured_listing_price', 0);
$priceForUpgradeToPriority = SJB_Array::get($listingProductInfo, 'upgrade_to_priority_listing_price', 0);
}
$structure = array('id' => $listing_info['system']['id'], 'type' => array('id' => $listing_type_info['id'], 'caption' => $listing_type_info['name']), 'user' => $user_info, 'activation_date' => $listing_info['system']['activation_date'], 'expiration_date' => $listing_info['system']['expiration_date'], 'featured' => $listing_info['system']['featured'], 'priority' => $listing_info['system']['priority'], 'views' => $listing_info['system']['views'], 'active' => $listing_info['system']['active'], 'product' => $productInfo, 'contract_id' => $listing_info['system']['contract_id'], 'number_of_pictures' => isset($listing_info['user_defined']['pictures']) ? count($listing_info['user_defined']['pictures']) : 0, 'approveStatus' => $listing_info['system']['status'], 'complete' => $listing_info['system']['complete'], 'external_id' => $listing_info['system']['external_id'], 'priceForUpgradeToFeatured' => $priceForUpgradeToFeatured, 'priceForUpgradeToPriority' => $priceForUpgradeToPriority);
if (SJB_Settings::getSettingByName('jobg8Installed') && SJB_PluginManager::isPluginActive('JobG8IntegrationPlugin')) {
$structure['jobType'] = JobG8::getJobProperty($listing_info['system']['id'], 'jobType');
}
if (array_search('comments', $extraInfo)) {
$structure['comments_num'] = SJB_CommentManager::getCommentsNumToListing($listing_info['system']['id']);
}
if (array_search('ratings', $extraInfo)) {
$structure['rating_num'] = SJB_Rating::getRatingNumToListing($listing_info['system']['id']);
//.........这里部分代码省略.........
示例5: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$displayForm = new SJB_Form();
$displayForm->registerTags($tp);
$invoiceSid = SJB_Request::getVar('sid', false);
if (SJB_Request::getVar('error', false)) {
SJB_FlashMessages::getInstance()->addWarning('TCPDF_ERROR');
}
$action = SJB_Request::getVar('action', false);
$paymentGateway = SJB_Request::getVar('payment_gateway', false);
$template = 'print_invoice.tpl';
$currentUserSID = SJB_UserManager::getCurrentUserSID();
$invoiceInfo = SJB_InvoiceManager::getInvoiceInfoBySID($invoiceSid);
if ($invoiceInfo) {
if ($currentUserSID == $invoiceInfo['user_sid']) {
$taxInfo = SJB_TaxesManager::getTaxInfoBySID($invoiceInfo['tax_info']['sid']);
$invoiceInfo = array_merge($invoiceInfo, $_REQUEST);
if (is_array($taxInfo)) {
$taxInfo = array_merge($invoiceInfo['tax_info'], $taxInfo);
} else {
$taxInfo = $invoiceInfo['tax_info'];
}
$invoice = new SJB_Invoice($invoiceInfo);
$invoice->setSID($invoiceSid);
$userInfo = SJB_UserManager::getUserInfoBySID($currentUserSID);
$username = $userInfo['CompanyName'] . ' ' . $userInfo['FirstName'] . ' ' . $userInfo['LastName'];
$user = SJB_UserManager::getObjectBySID($currentUserSID);
$productsSIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($userInfo['user_group_sid']);
$products = array();
foreach ($productsSIDs as $key => $productSID) {
$product = SJB_ProductsManager::getProductInfoBySID($productSID);
$products[$key] = $product;
}
$displayForm = new SJB_Form($invoice);
$displayForm->registerTags($tp);
$show = true;
if ($action == 'download_pdf_version' || $action == 'print') {
$show = false;
}
$tp->assign('show', $show);
$tp->assign('products', $products);
$tp->assign('invoice_sid', $invoiceSid);
$tp->assign('invoice_status', $invoiceInfo['status']);
$tp->assign('username', trim($username));
$tp->assign('user_sid', $currentUserSID);
$tp->assign('tax', $taxInfo);
$userStructure = SJB_UserManager::createTemplateStructureForUser($user);
$tp->assign('user', $userStructure);
$tp->assign('include_tax', $invoiceInfo['include_tax']);
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") . '/print-invoice/?sid=' . $invoiceSid . '&action=print&error=TCPDF_ERROR');
}
}
} else {
SJB_FlashMessages::getInstance()->addError('NOT_OWNER');
}
} else {
SJB_FlashMessages::getInstance()->addError('WRONG_INVOICE_ID_SPECIFIED');
}
if ($paymentGateway) {
$gatewaySID = SJB_PaymentGatewayManager::getSIDByID($paymentGateway);
$gatewayInfo = SJB_PaymentGatewayManager::getInfoBySID($gatewaySID);
$tp->assign('gatewayInfo', $gatewayInfo);
}
$tp->assign('paymentError', SJB_Request::getVar('payment_error', false));
$tp->display($template);
}
示例6: getFeaturedProfiles
/**
* @param int $numberOfProfiles
* @return array
*/
public static function getFeaturedProfiles($numberOfProfiles)
{
$logosInfo = SJB_UserProfileFieldManager::getFieldsInfoByType('logo');
$logoFields = array();
foreach ($logosInfo as $logoInfo) {
if (!empty($logoInfo['id'])) {
$logoFields[] = " `{$logoInfo['id']}` != '' ";
}
}
$whereLogo = empty($logos) ? '' : 'AND (' . implode(' OR ', $logoFields) . ')';
$usersInfo = SJB_DB::query("SELECT `sid` FROM `users` WHERE `featured`=1 AND `active`=1 {$whereLogo} ORDER BY RAND() LIMIT 0, ?n", $numberOfProfiles);
$users = array();
foreach ($usersInfo as $userInfo) {
$user = SJB_UserManager::getObjectBySID($userInfo['sid']);
$users[] = !empty($user) ? SJB_UserManager::createTemplateStructureForUser($user) : null;
}
return $users;
}
示例7: _getChargedTemplateProcessor
function _getChargedTemplateProcessor(&$listings_structure)
{
$tp = SJB_System::getTemplateProcessor();
$searchCriteria = $this->criteria_saver->getCriteria();
$listing_type_info = SJB_ListingTypeManager::getListingTypeInfoBySID($this->listing_type_sid);
if (!empty($listing_type_info['show_brief_or_detailed'])) {
$is_show_brief_or_detailed = $listing_type_info['show_brief_or_detailed'];
$show_brief_or_detailed = $this->criteria_saver->getBriefOrDetailedSearch();
$tp->assign("is_show_brief_or_detailed", $is_show_brief_or_detailed);
$tp->assign("show_brief_or_detailed", $show_brief_or_detailed);
}
$keywordsHighlight = '';
if (isset($searchCriteria['keywords']) && SJB_System::getSettingByName('use_highlight_for_keywords')) {
foreach ($searchCriteria['keywords'] as $type => $keywords) {
$keywordsTrim = trim($keywords);
if (!empty($keywordsTrim)) {
switch ($type) {
case 'like':
case 'exact_phrase':
$keywordsHighlight = json_encode($keywords);
break;
case 'all_words':
case 'any_words':
$keywordsHighlight = json_encode(explode(' ', $keywords));
break;
case 'boolean':
$keywordsHighlight = json_encode(SJB_BooleanEvaluator::parse($keywords, true));
break;
}
}
}
}
$view = !empty($this->requested_data['view']) ? $this->requested_data['view'] : 'list';
$tp->assign("keywordsHighlight", $keywordsHighlight);
$tp->assign("sorting_field", $this->listing_search_structure['sorting_field']);
$tp->assign("sorting_order", $this->listing_search_structure['sorting_order']);
$tp->assign("listing_search", $this->listing_search_structure);
$tp->assign("listings", $listings_structure);
$tp->assign("searchId", $this->searchId);
$tp->assign("view_on_map", SJB_System::getSettingByName('view_on_map'));
$tp->assign("view", $view);
$listing = new SJB_Listing(array(), $this->listing_type_sid);
$user = new SJB_User(array());
$listing_structure_meta_data = SJB_ListingManager::createMetadataForListing($listing, $user);
if (isset($searchCriteria['username']['equal'])) {
$userSID = SJB_UserManager::getUserSIDbyUsername($searchCriteria['username']['equal']);
$user = SJB_UserManager::getObjectBySID($userSID);
$userInfo = !empty($user) ? SJB_UserManager::createTemplateStructureForUser($user) : null;
$tp->assign("userInfo", $userInfo);
}
if (isset($searchCriteria['listing_type']['equal']) && SJB_System::getSettingByName('turn_on_refine_search_' . $searchCriteria['listing_type']['equal']) && $this->useRefine) {
$tp->assign("refineSearch", true);
}
$metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
$metadata = array("listing" => $metaDataProvider->getMetaData($listing_structure_meta_data));
$tp->assign("METADATA", $metadata);
return $tp;
}
示例8: sendAdminBannerAddedLetter
public static function sendAdminBannerAddedLetter($userSID, $bannerGroup)
{
$user = SJB_UserManager::getObjectBySID($userSID);
$user = SJB_UserManager::createTemplateStructureForUser($user);
$params = array('user' => $user, 'bannerGroup' => $bannerGroup);
$admin_email = SJB_Settings::getSettingByName('notification_email');
$email = SJB_EmailTemplateEditor::getEmail($admin_email, self::EMAIL_TEMPLATE_SID_SND_ADMIN_BANNER_ADDED_LTR, $params);
if ($email) {
return $email->send();
}
return null;
}
示例9: 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');
}
//.........这里部分代码省略.........
示例10: prepareTplVarsForUser
private function prepareTplVarsForUser($onlyUserGroupID = false)
{
$userGroups = SJB_UserGroupManager::getAllUserGroupsIDsAndCaptions();
foreach ($userGroups as $key => &$userGroupInfo) {
if ($onlyUserGroupID && $userGroupInfo['key'] != $onlyUserGroupID) {
unset($userGroups[$key]);
continue;
}
$user = SJB_ObjectMother::createUser(array(), $userGroupInfo['id']);
$fields = SJB_UserManager::createTemplateStructureForUser($user);
unset($fields['METADATA']);
unset($fields['password']);
$userGroupInfo['fields'] = $this->echoVars($fields);
}
$this->tp->assign('userGroups', $userGroups);
}