示例#1
0
 public function render()
 {
     // TODO Do not use global
     global $microblogTemplates, $pageTitle, $pageAuthor, $post;
     $postView = new PostView();
     $activitiesView = new ActivitiesView();
     $profileView = new ProfileView();
     $followView = new FollowView();
     $tpl = new \rubisco\text\SimpleTemplate($microblogTemplates);
     $tpl->pageAuthor = $pageAuthor;
     $tpl->pageTitle = $pageTitle;
     $tpl->showLog = '';
     $tpl->login = "******";
     $tpl->infoMessage = $this->m->getLastInfoMessagesAsHTML();
     $tpl->postView = '';
     $tpl->activities = $activitiesView->html();
     $tpl->profile = $profileView->html();
     $tpl->follow = $followView->html();
     if ($this->m->isLogin()) {
         $tpl->showLog = '<li><a href="?showLog=1">Show Log</a></li>';
         $tpl->login = "******";
         $tpl->postView = $postView->html($post['message'], $post['to']);
     }
     $this->m->clearLastInfoMessages();
     $content = $tpl->render('head') . $tpl->render('main') . $tpl->render('foot');
     header('Content-Type: text/html; charset=utf-8');
     header('Content-Length: ' . strlen($content));
     echo $content;
 }
示例#2
0
 public function addPost($user_id, $title, $content)
 {
     $post = new Post();
     $post->savePost($user_id, $title, $content);
     $view = new PostView();
     $view->renderSavedPost();
 }
 public function actionPost($groupid, $postid)
 {
     $group = Group::model()->findByPk($groupid);
     $group->viewNum = $group->viewNum + 1;
     $post = Post::model()->findByPk($postid);
     $post->viewNum = $post->viewNum + 1;
     if ($group->save() && $post->save()) {
         $postView = new PostView();
         $postView->userId = Yii::app()->user->isGuest ? 0 : Yii::app()->user->id;
         $postView->ip = Yii::app()->request->getUserHostAddress();
         $postView->postid = $postid;
         $postView->save();
     }
 }
示例#4
0
    /**
     * @param LoginView $v
     * @param PostView $pv
     */
    public function render(LoginView $v, PostView $pv)
    {
        echo '<!DOCTYPE html>
                <html>
                    <head>
                         <meta charset="utf-8">
                         <title>The Blogster</title>
                    </head>
                    <body>
                        <h1>Blogster A.K.A The Reddit of 1995</h1>
                        <div class="container">
                            ' . $v->response() . '

                            ' . $pv->show() . '
                        </div>
                    </body>
                </html>';
    }
示例#5
0
文件: view.php 项目: pumi11/veselkina
    } elseif ($_POST['file_url']) {
        if ($file->uploadFromurl($_POST['file_url'])) {
            $loc = $country['name'] . "?add_point=" . $_POST['modal_point'] . '#Point' . $_POST['modal_point'];
            header("Location: {$loc}");
        } else {
            $loc = $country['name'] . "?error=" . $file->getErrorMsg();
            header("Location: {$loc}");
        }
    }
} elseif ($_POST and $_GET['add'] == 1) {
    //Добавление новой точки
    $View = new PostView($country['id'], $_POST);
    $View->insert();
} elseif ($_POST and $_GET['edit'] == 1 and $_POST['Point_id']) {
    //редактирвоание записи
    $View = new PostView($country['id'], $_POST);
    $View->update($_POST['Point_id']);
}
include $_SERVER['DOCUMENT_ROOT'] . "/head.php";
?>



<?php 
if (isset($_GET['error'])) {
    ?>
<div class="alert alert-danger fade in" style="position: fixed;right: 50%">
    <a href="#" class="close" data-dismiss="alert">&times;</a>
    <strong>Ошибка!</strong> <?php 
    echo htmlspecialchars($_GET['error']);
    ?>