public function view()
 {
     $id = $_GET['id'];
     $customerRepository = new CustomerRepository($this->pdo);
     $customer = $customerRepository->getCustomer($id);
     $this->smarty->assign('header', 'Bekijk ' . $customer->name);
     $this->smarty->assign('customer', $customer);
     $this->smarty->display('customer/view.tpl');
 }
Example #2
0
 public function add()
 {
     $this->smarty->assign('header', 'Gebruiker aanmaken!');
     $this->smarty->assign('message', '');
     $this->smarty->assign('username', '');
     $this->smarty->assign('company_id', '');
     $customerRepository = new CustomerRepository($this->pdo);
     $customers = $customerRepository->getCustomers();
     $this->smarty->assign('customers', $customers);
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $customer_id = $_POST['customer_id'];
         if (empty($customer_id)) {
             $this->smarty->assign('message', 'Je hebt geen Customer geselecteerd, dat moet');
             $this->smarty->display('user/add.tpl');
         }
         $customer = $customerRepository->getCustomer($customer_id);
         $userRepository = new UserRepository($this->pdo);
         $user = $userRepository->addUser($_POST['username'], $_POST['password'], $customer);
         header('location: index.php?section=customer&action=index');
     } else {
         $this->smarty->display('user/add.tpl');
     }
 }