Esempio n. 1
0
 public function actionTimetable($type, $timeFrom, $timeTo)
 {
     $id = 0;
     if ($this->getUser()->isLoggedIn()) {
         $id = $this->getUser()->getId();
     }
     list($timeFrom, $timeTo) = \App\Model\DateHelpers::wholeWeeks($timeFrom, $timeTo);
     $result = $this->dataModel->getLessonsForType($type, $timeFrom, $timeTo, $id);
     $this->sendResponse(new \Nette\Application\Responses\JsonResponse($result));
 }
Esempio n. 2
0
 /**
  * Performs an authentication against e.g. database.
  * and returns IIdentity on success or throws AuthenticationException
  * @return Nette\Security\Identity
  * @throws Nette\Security\AuthenticationException
  */
 function authenticate(array $credentials)
 {
     list($username, $password) = $credentials;
     $result = $this->dataModel->login($username, $password);
     $clientId = (int) $result->ID_KLIENT;
     if (!$clientId) {
         throw new Security\AuthenticationException('Nesprávné přihlašovací údaje.');
     }
     $clientResult = $this->dataModel->getClientData($clientId);
     $data = array('isAdmin' => isset($this->adminList[$clientId]), 'id' => $clientId, 'login_id' => (int) $result->ID_PRIHLASENI, 'name_full' => (string) $clientResult->JMENO . ' ' . (string) $clientResult->PRIJMENI, 'name' => (string) $clientResult->JMENO, 'lastname' => (string) $clientResult->PRIJMENI, 'email' => (string) $clientResult->EMAIL, 'phone' => (string) $clientResult->TEL_MOB, 'credits' => (int) $clientResult->KREDIT, 'info' => (string) $clientResult->POPIS);
     return new Security\Identity($clientId, null, $data);
 }
Esempio n. 3
0
 public function renderUser($sekce)
 {
     if ($this->getUser()->isLoggedIn()) {
         $this->template->future = false;
         switch ($sekce) {
             case 'rezervace':
                 $this->template->section = 'booking';
                 $this->template->history = $this->dataModel->getBookingHistory($this->getUser()->getId());
                 $this->template->future = $this->dataModel->getBookingList($this->getUser()->getId());
                 break;
             default:
                 $this->template->section = 'user';
                 $data = $this->getUser()->getIdentity()->getData();
                 $subscriptionInfo = $this->dataModel->getExpirationDate($this->getUser()->getId());
                 Debugger::barDump($subscriptionInfo);
                 $data['has_subscription_info'] = false;
                 if ($subscriptionInfo) {
                     $subscriptionEnd = new \DateTime((string) $subscriptionInfo->DO_KDY);
                     $data['entries_name'] = (string) $subscriptionInfo->NAZEV;
                     $data['entries_available'] = (int) $subscriptionInfo->ZDARMA;
                     $data['entries_left'] = (int) $subscriptionInfo->ZBYVA;
                     $data['subscription_expire'] = $subscriptionEnd->format('d.m.Y');
                     $data['has_subscription_info'] = true;
                 }
                 $this->template->user = $data;
         }
     } else {
         $this->flashMessage('Pro vstup do uživatelské sekce se musíte přihlásit.', self::FLASH_ERROR);
         $this->redirect('Homepage:default');
     }
 }
 public function renderSearch($page = 1, $value)
 {
     if ($value != null) {
         $data = new DataModel();
         $results = $data->search($value, $page);
         $component = $this->getComponent('movieList');
         $component->enable = true;
         $component->results = $results->results;
         $component->page = $page;
         $component->totalPages = $results->total_pages;
         $component->searched = $value;
         $component->redrawControl();
     }
 }