Ejemplo n.º 1
0
 public function action_index()
 {
     $view = View::factory('home/my/profile');
     $clients = new Model_Client();
     $user_email = Session::instance()->get('email');
     $get_user_data = $clients->get_user_data($user_email);
     $view->valute = $clients->get_user_valute($user_email);
     $view->data = $get_user_data;
     $this->template->content = $view->render();
     if ($this->request->method() === Request::POST) {
         $valute = $this->request->post('valute');
         $name = $this->request->post('name');
         $surname = $this->request->post('surname');
         if (empty($valute) || empty($name)) {
             $this->request->redirect('profile');
         }
         $clients = new Model_Client();
         $email = Session::instance()->get('email');
         $data = array('valute' => $valute, 'name' => $name, 'surname' => $surname);
         $change_user_data = $clients->change_user_data($data, $email);
         if (!$change_user_data) {
             throw new Exception("Error");
         }
         $this->request->redirect('profile');
     }
 }
Ejemplo n.º 2
0
 public function action_index()
 {
     $view = View::factory('cart/list');
     $session = Session::instance()->get('email');
     $cart = new Model_Cart();
     $view->products = $cart->get_products_from_cart($session);
     $clients = new Model_Client();
     $view->valute = $clients->get_user_valute($session);
     $this->template->content = $view->render();
 }
Ejemplo n.º 3
0
 public function action_index()
 {
     $view = View::factory('home/main');
     $products = new Model_Product();
     $clients = new Model_Client();
     $user_session = Session::instance()->get('email');
     $view->valute = $clients->get_user_valute($user_session);
     $view->last_products = $products->get_newest_products();
     $view->discounts = $products->get_products_with_discounts();
     $this->template->content = $view->render();
 }
Ejemplo n.º 4
0
 public function action_item()
 {
     $product_id = $this->request->param('id');
     if (empty($product_id)) {
         throw new Exception("ID must not be empty!");
     }
     $view = View::factory('products/info');
     $products = new Model_Product();
     $clients = new Model_Client();
     $view->products = $products->get_product_by_id($product_id);
     $user_email = Session::instance()->get('email');
     $view->valute = $clients->get_user_valute($user_email);
     $this->template->content = $view->render();
 }
Ejemplo n.º 5
0
 public function before()
 {
     parent::before();
     $config = Kohana::$config->load('common');
     $this->template->name = $config->name;
     $this->template->stylesheets = $config->stylesheets;
     $categories = new Model_Category();
     $client = new Model_Client();
     $product = new Model_Product();
     $this->template->products = $product->get_random_product_with_discount();
     $this->template->valute = $client->get_user_valute(Session::instance()->get('email'));
     $this->template->categories = $categories->get_list_of_categories();
     $this->template->users = $client->get_user_data(Session::instance()->get('email'));
     $this->template->scripts = $config->scripts;
 }