function process($parameters)
 {
     $registration = new Registration();
     if (!$registration->checkIfAdmin($_SESSION['id_user'])) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(["email" => $_POST['email'], "tariff" => $_POST['tariff'], "firstname" => $_POST['firstname'], "surname" => $_POST['surname'], "telephone" => $_POST['telephone'], 'address' => $_POST['address'], "startDate" => $_POST['startDate'], "ic" => $_POST['ic'], "p" => $registration->getRandomHash()]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $fakturoid = new FakturoidWrapper();
             $newCustomer = $fakturoid->createCustomer($data);
             if ($newCustomer == false) {
                 $result = ['s' => 'error', 'cs' => 'Bohužel se nepovedlo uložit data do Faktuoidu; zkus to prosím za pár minut', 'en' => 'Sorry, we didn\'n safe your data into Fakturoid; try it again after a couple of minutes please'];
             } else {
                 //add fakturoid_id into data structure
                 $data['fakturoid_id'] = $newCustomer->id;
                 $result = $registration->registerUser($data, $this->language);
             }
         }
         //change success message for admin
         if ($result['s'] == 'success') {
             $result = ['s' => 'success', 'cs' => 'Nový uživatel je úspěšně zaregistrován', 'en' => 'New member is successfully registred'];
         }
         $this->messages[] = $result;
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'forceRegistration';
 }
Ejemplo n.º 2
0
 function process($parameters)
 {
     $registration = new Registration();
     if ($registration->checkLogin()) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(['email' => $_POST['email'], 'tariff' => $_POST['tariff'], 'firstname' => $_POST['firstname'], 'surname' => $_POST['surname'], 'telephone' => $_POST['telephone'], 'address' => $_POST['address'], 'startDate' => $_POST['startDate'], 'ic' => $_POST['ic'], 'p' => $_POST['p']]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $result = $registration->registerUser($data, $this->language);
         }
         $this->messages[] = $result;
         //if register success, show registration form no more
         if ($result['s'] == 'success') {
             $this->redirect('');
         }
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'registration';
 }
Ejemplo n.º 3
0
 function process($parameters)
 {
     $registration = new Registration();
     if ($registration->checkLogin()) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(['email' => $_POST['email'], 'tariff' => $_POST['tariff'], 'firstname' => $_POST['firstname'], 'surname' => $_POST['surname'], 'telephone' => $_POST['telephone'], 'address' => $_POST['address'], 'startDate' => $_POST['startDate'], 'ic' => $_POST['ic'], 'p' => $_POST['p']]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $fakturoid = new FakturoidWrapper();
             $newCustomer = $fakturoid->createCustomer($data);
             if ($newCustomer == false) {
                 $result = ['s' => 'error', 'cs' => 'Bohužel se nepovedlo uložit data do Faktuoidu; zkus to prosím za pár minut', 'en' => 'Sorry, we didn\'n safe your data into Fakturoid; try it again after a couple of minutes please'];
             } else {
                 //add fakturoid_id into data structure
                 $data['fakturoid_id'] = $newCustomer->id;
                 $result = $registration->registerUser($data, $this->language);
             }
         }
         $this->messages[] = $result;
         //if register success, show registration form no more
         if ($result['s'] == 'success') {
             $this->redirect('');
         }
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'New user registration'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'registration';
 }
Ejemplo n.º 4
0
 function process($parameters)
 {
     $registration = new Registration();
     if (!$registration->checkIfAdmin($_SESSION['id_user'])) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(["email" => $_POST['email'], "tariff" => $_POST['tariff'], "firstname" => $_POST['firstname'], "surname" => $_POST['surname'], "telephone" => $_POST['telephone'], "startDate" => $_POST['startDate'], "ic" => $_POST['ic'], "p" => $registration->getRandomHash()]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $result = $registration->registerUser($data, $this->language);
         }
         $this->messages[] = $result;
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'forceRegistration';
 }