function action_message_list()
 {
     $authentification = new Authentification();
     $auth_opt = $authentification->get_auth_opt();
     $model = new Model_Message();
     $data = $model->get_message_list();
     $this->view->generate('view_message.php', 'view_skeleton.php', $data, $auth_opt);
 }
 function action_people()
 {
     $authentification = new Authentification();
     $auth_opt = $authentification->get_auth_opt();
     $model = new Model_People();
     if ($_GET['recieve'] == 1) {
         $data = $model->search_people();
         $options['user_id'] = $_SESSION['user_id'];
         $options['subscribes'] = $model->get_subscribes();
         $this->view->generate('view_people.php', 'view_skeleton.php', $data, $auth_opt, $options);
     } else {
         $this->view->generate('view_people.php', 'view_skeleton.php', $data, $auth_opt, $options);
     }
 }
 function action_add_training()
 {
     $authentification = new Authentification();
     $auth_opt = $authentification->get_auth_opt();
     $model = new Model_Training();
     $data = $model->get_all_exercises();
     $options['kos'] = $model->get_all_sports();
     //var_dump($options);
     if ($_GET['recieve'] == 1) {
         $model->add_training();
         $options['result'] = 'Training sucessfully added!';
         $this->view->generate('view_add_training.php', 'view_skeleton.php', $data, $auth_opt, $options);
     } else {
         if ($_GET['recieve'] == 2) {
             $model->add_exercise();
             $options['result'] = 'Exercise sucessfully added!';
             $this->view->generate('view_add_training.php', 'view_skeleton.php', $data, $auth_opt, $options);
         } else {
             $this->view->generate('view_add_training.php', 'view_skeleton.php', $data, $auth_opt, $options);
         }
     }
 }
 function action_index()
 {
     $model = new Model_Main();
     $host = $_SERVER['HTTP_HOST'];
     if ($_GET['logout'] == 1) {
         $authentification = new Authentification();
         $authentification->logout();
     }
     if ($_GET['recieve'] == 1) {
         if ($model->try_login($_POST['email'], $_POST['password'])) {
             $authentification = new Authentification();
             $auth_opt = $authentification->get_auth_opt();
             echo '<script type="text/javascript">location.href = "http://' . $host . '/Feed/feed";</script>';
         } else {
             $options['def_email'] = $_POST['email'];
             $options['result'] = 'Login error!';
             $this->view->generate('view_main_login.php', 'view_skeleton_main.php', $data, $auth_opt, $options);
         }
     } else {
         $this->view->generate('view_main_login.php', 'view_skeleton_main.php');
     }
 }
 function action_feed()
 {
     $authentification = new Authentification();
     $auth_opt = $authentification->get_auth_opt();
     $model = new Model_Feed();
     if (isset($_GET['delete'])) {
         $model->delete_post($_GET['delete']);
     }
     if (isset($_GET['like_post_id'])) {
         $model->like_post($_GET['like_post_id'], $_SESSION['user_id']);
     }
     if (isset($_GET['recieve_comment'])) {
         $model->add_comment($_GET['recieve_comment']);
     }
     if ($_GET['recieve_post'] == 1) {
         if (isset($_FILES['userfile']['tmp_name'])) {
             $destination = 'images/' . $_FILES['userfile']['name'];
             move_uploaded_file($_FILES['userfile']['tmp_name'], $destination);
         }
         $model->add_post($destination);
     }
     $data = $model->get_posts($_SESSION['user_id']);
     $this->view->generate('view_feed.php', 'view_skeleton.php', $data, $auth_opt);
 }