Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 /**
  * [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);
 }