public function render(array $params = array()) { if (!isset($params['member']) && !$params['member'] instanceof \Member) { throw new \Exception('Invalid param member for account index view.'); } $this->member = $params['member']; $tabName = isset($params['tab']) ? $params['tab'] : CURRENT_MODULE_ACTION; $linkNames = $this->i18nView['navigation_links']; $this->navigationLinks = []; $arr = ['index', 'invoice', 'rtree', 'htree']; $memberType = $this->member->getType(); if ($memberType > \Member::TYPE_MEMBER) { $arr[] = 'invitation'; } if ($memberType >= \Member::TYPE_CEO) { $arr[] = 'bonus_payments'; $arr[] = 'bonus_levels'; } foreach ($arr as $linkName) { $locale = $linkNames[$linkName]; array_push($this->navigationLinks, [\Tbmt\Router::toAccountTab($linkName), $locale, $linkName === $tabName ? true : false]); } $name = \Tbmt\AccountController::MODULE_NAME; require MODULES_DIR . $name . DIRECTORY_SEPARATOR . $name . '.' . $tabName . '.tab.view.php'; $name = NS_ROOT_PART . 'view\\' . ucfirst($name) . ucfirst($tabName) . 'Tab'; $contentView = new $name(); $this->tabContent = $contentView->render($params); return $this->renderFile(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.account.html', $params); }
protected function init() { $locales = \Tbmt\Localizer::plain('common'); $this->textBrandName = $locales['brand_name']; $viewCommon = \Tbmt\Localizer::get('view.common'); $linkNames = $viewCommon['navigation_links']; $subLinkNames = $viewCommon['navigation_sublinks']; $this->navigationLinks = []; foreach (['projects', 'member', 'about', 'account'] as $linkName) { $locale = $linkNames[$linkName]; $sublinks = null; if (isset($subLinkNames[$linkName])) { $sublinks = []; foreach ($subLinkNames[$linkName] as $action => $name) { array_push($sublinks, [\Tbmt\Router::toModule($linkName, $action), $name, $action === CURRENT_MODULE_ACTION ? true : false]); } } array_push($this->navigationLinks, [\Tbmt\Router::toModule($linkName), $locale, $linkName === CURRENT_MODULE ? true : false, $sublinks]); } $this->isLoggedIn = \Tbmt\Session::isLoggedIn(); if (!$this->isLoggedIn) { $accountLinks =& $this->navigationLinks[count($this->navigationLinks) - 1]; $accountLinks[1] = $viewCommon['member_login']; unset($accountLinks[3]); } $this->baseUrl = \Tbmt\Router::toBase(); $this->locales = $viewCommon; }
protected function init() { $this->i18nView = \Tbmt\Localizer::get('view.common'); $this->textBrandName = $this->i18nView['brand_name']; $this->textBrandMail = \Tbmt\Config::get('brand.mail'); $linkNames = $this->i18nView['navigation_links']; $subLinkNames = $this->i18nView['navigation_sublinks']; $this->navigationLinks = []; foreach (['projects', 'member', 'about', 'impressum', 'account'] as $linkName) { $locale = $linkNames[$linkName]; $sublinks = null; if (isset($subLinkNames[$linkName])) { $sublinks = []; foreach ($subLinkNames[$linkName] as $action => $name) { $anchor = ''; if (is_array($name)) { $anchor = '#' . $name[2]; $action = $name[0]; $name = $name[1]; } array_push($sublinks, [\Tbmt\Router::toModule($linkName, $action) . $anchor, $name, defined('CURRENT_MODULE_ACTION') && $action === CURRENT_MODULE_ACTION ? true : false]); } } array_push($this->navigationLinks, [\Tbmt\Router::toModule($linkName), $locale, defined('CURRENT_MODULE') && $linkName === CURRENT_MODULE ? true : false, $sublinks]); } $this->isLoggedIn = \Tbmt\Session::isLoggedIn(); if (!$this->isLoggedIn) { $accountLinks =& $this->navigationLinks[count($this->navigationLinks) - 1]; $accountLinks[1] = $this->i18nView['member_login']; unset($accountLinks[3]); } $this->navigationIcons = ['road', 'lightbulb-o', 'envelope', 'legal', 'user']; $this->baseUrl = \Tbmt\Router::toBase(); $this->i18nView = $this->i18nView; }
public static function createPayPal($invoiceNumber, \PropelPDO $con) { $i18n = Localizer::get('payment'); // ### Payer // A resource representing a Payer that funds a payment // For direct credit card payments, set payment method // to 'credit_card' and add an array of funding instruments. $payer = new Payer(); $payer->setPaymentMethod("paypal"); // ### Itemized information // (Optional) Lets you specify item wise // information $item1 = new Item(); $item1->setName($i18n['item_name'])->setDescription($i18n['item_description'])->setCurrency(TransactionEntity::$BASE_CURRENCY)->setQuantity(1)->setTax(0)->setPrice(TransactionEntity::$MEMBER_FEE); $itemList = new ItemList(); $itemList->setItems(array($item1)); // ### Amount // Lets you specify a payment amount. // You can also specify additional details // such as shipping, tax. $amount = new Amount(); $amount->setCurrency(TransactionEntity::$BASE_CURRENCY)->setTotal(TransactionEntity::$MEMBER_FEE); // ### Transaction // A transaction defines the contract of a // payment - what is the payment for and who // is fulfilling it. $transaction = new Transaction(); $transaction->setAmount($amount)->setItemList($itemList)->setDescription($i18n['transaction_description'])->setInvoiceNumber($invoiceNumber); // ### Redirect urls // Set the urls that the buyer must be redirected to after // payment approval/ cancellation. $success = Router::toModule('account', 'index'); $failure = Router::toModule('guide', 'index', ['purchase_failed' => true]); $redirectUrls = new RedirectUrls(); $redirectUrls->setReturnUrl($success)->setCancelUrl($failure); // ### Payment // A Payment Resource; create one using // the above types and intent set to sale 'sale' $payment = new Payment(); $payment->setIntent("sale")->setPayer($payer)->setRedirectUrls($redirectUrls)->setExperienceProfileId(self::getPaymentExperienceProfileId())->setTransactions(array($transaction)); // ### Create Payment // Create a payment by calling the payment->create() method // with a valid ApiContext (See bootstrap.php for more on `ApiContext`) // The return object contains the state. $apiContext = self::getApiContext(); $payment->create($apiContext); return $payment; }
/** * [buildPurchaseAgreements description] * @return [type] */ static function buildPurchaseAgreements() { return \Tbmt\Localizer::getInsert('common.purchase_agreemensts', ['terms' => '' . self::buildLink(\Tbmt\Localizer::get('common.terms'), \Tbmt\Router::toModule('about', 'terms'), '', 'target="_blank"'), 'privacy' => '' . self::buildLink(\Tbmt\Localizer::get('common.privacy'), \Tbmt\Router::toModule('about', 'privacy'), '', 'target="_blank"'), 'cancelation_right' => '' . self::buildLink(\Tbmt\Localizer::get('common.cancelation_right'), \Tbmt\Router::toModule('about', 'cancelation_right'), '', 'target="_blank"')], false); }
/** * #9 * @param \Member $member * @return [type] */ public static function sendFundsLevelUpgrade(\Member $referrer, \Member $recruited) { $email = $referrer->getEmail(); $locale = Localizer::get('mail.funds_level_upgrade'); $fullName = \Tbmt\view\Factory::buildMemberFullNameString($referrer); $recruited_fullname = \Tbmt\view\Factory::buildMemberFullNameString($recruited); return self::send($email, $fullName, $locale['subject'], Localizer::insert($locale['body'], ['fullname' => $fullName, 'recruited_fullname' => $recruited_fullname, 'video_link' => \Tbmt\Router::toVideo(), 'adv1amount' => self::getLocalizedTRA(\Transaction::REASON_ADVERTISED_LVL1), 'adv2amount' => self::getLocalizedTRA(\Transaction::REASON_ADVERTISED_LVL2), 'advindirectamount' => self::getLocalizedTRA(\Transaction::REASON_ADVERTISED_INDIRECT), 'after6weeksamount' => Localizer::numFormat(300000, 0)], false)); }