Ejemplo n.º 1
0
 public static function ActionMain($id)
 {
     $post = PostModel::getPostsById($id);
     $post['id'] = $id;
     $variables = ['template' => 'events.php', 'links' => ['slider.css', 'events.css'], 'scripts' => ['slider.js'], 'post' => $post, 'postCount' => PostModel::getPostsCount(), 'quizes' => PostModel::getQuizToPost($id)];
     $variables = array_merge_recursive(self::getMainVariables(), $variables);
     Template::render('template.php', $variables);
 }
Ejemplo n.º 2
0
 public static function ActionAddPost()
 {
     if (UserModel::isUserLoggedIn() and isset($_POST['title']) and isset($_POST['header']) and isset($_POST['content']) and isset($_POST['photos'])) {
         $title = $_POST['title'];
         $header = $_POST['header'];
         $text = $_POST['content'];
         $photos = json_decode($_POST['photos']);
         PostModel::addPost($title, $header, $text, $photos);
     }
     header('Location: /event/' . PostModel::getPostsCount());
 }