Inheritance: extends Nette\Object, implements IteratorAggregate, implements ArrayAccess
Ejemplo n.º 1
0
 /**
  * @param PayPal $payPal
  * @param Session $session
  */
 public function __construct(PayPal $payPal, Session $session)
 {
     parent::__construct();
     $this->payPal = $payPal;
     $this->session = $session->getSection('PayPalExpress');
     $this->session->setExpiration('+10 minutes');
     if (empty($this->session->token)) {
         $this->session->token = $this->_ec = Strings::random(6);
     }
 }
Ejemplo n.º 2
0
 /**
  * Optional, if you set Session than enable automatic language dection.
  *
  * @param Http\Session $session
  * @return self
  */
 public function setSession(Http\Session $session, $live = '+1 week')
 {
     $this->section = $session->getSection(__CLASS__);
     if (!isset($this->section->language)) {
         $this->setLanguage($this->detectLanguage());
         $this->section->setExpiration($live);
     }
     return $this;
 }
 /**
  * Closes the window
  * @param  string $location	 
  * @return void
  */
 public function close($location = NULL)
 {
     $this->storage->remove();
     $this->open = FALSE;
     if (!$this->presenter->isAjax()) {
         if (isset($location)) {
             $this->presenter->redirect($location);
         } else {
             $this->presenter->redirect('this');
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * @param Form $form
  * @return void Zpracovani formulare - pridani noveho komentare
  */
 public function formSucceeded(Form $form)
 {
     //nacteni a smazani session
     $values = \Nette\Utils\ArrayHash::from($this->commentSession->content);
     $this->commentSession->remove();
     //ulozit novy prispevek ke clanku
     $this->article = $this->articleRepository->getById($values->articleId);
     if (isset($this->myUser)) {
         $values->user = $this->myUser;
         $values->name = NULL;
     } else {
         $values->user = NULL;
     }
     //vytvoreni komentu, prirazeni ke clanku a ulozeni
     $newComment = new \App\Model\Entities\Comment($this->article, $values->user, $values->name, $values->content);
     $this->articleRepository->getEntityManager()->persist($newComment);
     $this->article->addComment($newComment);
     $this->articleRepository->getEntityManager()->flush();
     $this->redirect('this');
 }
Ejemplo n.º 5
0
 /**
  * Confirmation of paypal payment
  */
 public function confirmExpressCheckout(SessionSection $ses)
 {
     $query = array('amount' => $ses->amount, 'payerID' => $ses->payerID, 'token' => $ses->token, 'paymentAction' => $ses->paymentType, 'currencyCode' => $ses->currencyCodeType, 'ipAdress' => urlencode($_SERVER['SERVER_NAME']));
     $request = new Request($query);
     $request->setMethod('DoExpressCheckoutPayment');
     // Same as $request->addQuery(array('method', '...'));
     $response = $this->call($request);
     if ($response->success) {
         $ses->remove();
     }
     return $response;
 }
Ejemplo n.º 6
0
 /**
  * Clear all data from the persistent storage
  *
  * @return void
  */
 public function clearAll()
 {
     $this->session->remove();
 }
Ejemplo n.º 7
0
 /**
  *
  */
 public function cartClear()
 {
     $this->shopCart->remove();
 }
Ejemplo n.º 8
0
 /**
  * @param  string
  * @return self
  */
 public function remove($name)
 {
     $this->session->offsetUnset($name);
     return $this;
 }
Ejemplo n.º 9
0
 protected function getSessionSection()
 {
     $ns = $this->namespace ?: 'default';
     return $this->session->getSection("LT-{$ns}");
 }
Ejemplo n.º 10
0
 public function remove()
 {
     $this->sessionSection->remove();
 }