Ejemplo n.º 1
0
 public function actionPhotos()
 {
     $query = new Query();
     $query->select('a.id, a.name, p.path, u.username, u.avatar')->from('{{%home_album}} as a')->join('LEFT JOIN', '{{%home_photo}} as p', 'p.album_id=a.id')->join('LEFT JOIN', '{{%user}} as u', 'a.created_by=u.id')->where('a.status=:type', [':type' => Album::TYPE_PUBLIC])->orderBy('a.id DESC');
     $photosResult = Tools::Pagination($query, 25);
     return $this->render('photos', ['photos' => $photosResult['result'], 'pages' => $photosResult['pages']]);
 }
Ejemplo n.º 2
0
 public function getPhotos()
 {
     $query = new Query();
     $query->select('id, name, path')->from('{{%home_photo}}')->where('album_id=:id', [':id' => $this->id]);
     $photos = Tools::Pagination($query);
     return ['photos' => $photos['result'], 'pages' => $photos['pages']];
 }
Ejemplo n.º 3
0
 /**
  * Lists all Feed models.
  * @return mixed
  */
 public function actionIndex()
 {
     $query = new Query();
     $query->select('id, content, feed_data, template, created_at')->from('{{%home_feed}}')->where('user_id=:user_id', [':user_id' => Yii::$app->user->id])->orderBy('created_at DESC');
     $pages = Tools::Pagination($query);
     return $this->render('index', ['feeds' => $pages['result'], 'pages' => $pages['pages']]);
 }
Ejemplo n.º 4
0
 public function actionPost($id)
 {
     $model = $this->findModel($id);
     $query = (new Query())->select('*')->from('{{%home_post}}')->where('user_id=:user_id', [':user_id' => $model->id])->orderBy('created_at DESC');
     $posts = Tools::Pagination($query);
     return $this->render('/user/post', ['model' => $model, 'posts' => $posts['result'], 'pages' => $posts['pages']]);
 }
Ejemplo n.º 5
0
 public function actionIndex()
 {
     $this->layout = '@app/modules/user/views/layouts/user';
     $query = new Query();
     $query = $query->select('*')->from('{{%home_post}}')->where('user_id=:user_id', [':user_id' => Yii::$app->user->id])->orderBy('created_at DESC');
     $pages = Tools::Pagination($query);
     return $this->render('index', ['posts' => $pages['result'], 'pages' => $pages['pages']]);
 }
Ejemplo n.º 6
0
 public function actionOutbox()
 {
     $user = $this->findUserModel();
     $query = new Query();
     $query->select('u.username, u.avatar, m.id, m.subject, m.read_indicator, m.created_at')->from('{{%user_message}} as m')->join('LEFT JOIN', '{{%user}} as u', 'u.id=m.sendto')->where('sendfrom=:sendfrom', [':sendfrom' => $user->id])->orderBy('m.created_at DESC');
     $pages = Tools::Pagination($query);
     return $this->render('messageList', ['messages' => $pages['result'], 'pages' => $pages['pages'], 'type' => 'outbox', 'count' => $this->getMessageCount()]);
 }
Ejemplo n.º 7
0
 public function actionForumpost()
 {
     $model = $this->findModel();
     $query = new Query();
     $query = $query->select('*')->from('{{%forum_post}}')->where(['user_id' => $model->id])->orderBy('created_at desc');
     $pages = Tools::Pagination($query);
     return $this->render('myposts', ['model' => $model, 'posts' => $pages['result'], 'pages' => $pages['pages']]);
 }
Ejemplo n.º 8
0
 public function actionInbox()
 {
     $user = $this->findUserModel();
     $query = new Query();
     $query->select('*')->from('{{%user_message}}')->where('sendto=:sendto', [':sendto' => $user->id])->orderBy('created_at DESC');
     $pages = Tools::Pagination($query);
     return $this->render('inbox', ['messages' => $pages['result'], 'pages' => $pages['pages'], 'count' => $this->getMessageCount()]);
 }
Ejemplo n.º 9
0
        echo $feed['username'];
        ?>
"/>
                        </a>
                        <div class="profile-details">
                            <a class="user-name" href="<?php 
        echo Url::toRoute(['/user/view', 'id' => $feed['username']]);
        ?>
" rel="author">
                                <?php 
        echo Html::encode($feed['username']);
        ?>
                            </a>
                            <p>
                                <em><?php 
        echo Tools::formatTime($feed['created_at']);
        ?>
</em>
                            </p>
                        </div>
                    </div>
                    <p class="content">
                        <?php 
        if (!empty($feed['content'])) {
            echo Html::encode($feed['content']);
        } else {
            echo strtr($feed['template'], unserialize($feed['feed_data']));
        }
        ?>
                    </p>
                </div>
Ejemplo n.º 10
0
><?php 
        echo Html::encode($thread['title']);
        ?>
</span></a>
                            </h4>
                            <?php 
        echo Html::a(Html::encode($thread['username']), ['/user/view', 'id' => $thread['username']], ['class' => 'thread-nickname']);
        ?>
                            <span class="thread-time">| <?php 
        echo Tools::formatTime($thread['created_at']);
        ?>
</span>
                        </div>
                        <div class="thread-main">
                            <?php 
        echo HtmlPurifier::process(Tools::htmlSubString($thread['content'], 300, Url::toRoute(['/forum/thread/view', 'id' => $thread['id']])));
        ?>
                        </div>
                        <div class="pull-right thread-right">
                            <?php 
        if (Yii::$app->user->id == $thread['user_id']) {
            echo Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . Yii::t('app', 'Update'), ['/forum/thread/update', 'id' => $thread['id']]);
        }
        ?>
                            <?php 
        echo Html::a('<span class="glyphicon glyphicon-comment"></span> ' . Yii::t('app', 'Reply'), ['/forum/thread/view', 'id' => $thread['id']]);
        ?>
 
                            <?php 
        if (Yii::$app->user->id == $thread['user_id'] || Yii::$app->user->id == $model->user_id) {
            ?>
Ejemplo n.º 11
0
$this->registerMetaTag(['name' => 'description', 'content' => $model['summary']]);
?>
<article class="content">
  <header>
    <a href="<?php 
echo Url::toRoute(['/explore/view-post', 'id' => $model['id']]);
?>
">
      <h1><?php 
echo Html::encode($model['title']);
?>
</h1>
    </a>
    <address class="meccaddress">
      <time><span class="glyphicon glyphicon-time"></span> <?php 
echo Tools::formatTime($model['created_at']);
?>
</time>
      <?php 
if (!empty($model['origin'])) {
    echo " - 来源:" . Html::encode($model['origin']);
}
?>
      - 
      <?php 
if (!empty($post['author'])) {
    echo Html::a('<span class="glyphicon glyphicon-user"></span> ' . Html::encode($model['author']), ['/user/view', 'id' => $model['author']]);
} else {
    echo '<span class="glyphicon glyphicon-user"></span> ' . Html::encode($model['username']);
}
?>
Ejemplo n.º 12
0
if (!empty($posts)) {
    ?>
            <?php 
    foreach ($posts as $post) {
        ?>
                <article class="item widget-container fluid-height social-entry" id="<?php 
        echo $post['id'];
        ?>
">
                    <div class="widget-content">
                        <h3><?php 
        echo Html::a(Html::encode($post['title']), ['/home/post/view', 'id' => $post['id']]);
        ?>
</h3>
                        <?php 
        echo HtmlPurifier::process(Tools::htmlSubString($post['content'], 200, Url::toRoute(['/home/post/view', 'id' => $post['id']])));
        ?>
                    </div>
                    <?php 
        if (Yii::$app->user->id === $model->id) {
            ?>
                        <div class="widget-footer">
                            <div class="footer-detail">
                                &nbsp;
                                <a href="<?php 
            echo Url::toRoute(['/home/post/delete', 'id' => $post['id']]);
            ?>
" data-clicklog="delete" onclick="return false;" title="<?php 
            echo Yii::t('app', 'Are you sure to delete it?');
            ?>
">
Ejemplo n.º 13
0
if ($data->is_broadcast) {
    echo "color:#ff6f3d;";
}
?>
">
                  <?php 
echo Html::a(Html::encode($user['username']), ['/user/view', 'id' => $user['username']]);
?>
            </p>
        </div>
    </div>
    <div class="col-sm-10">
        <div class="thread-head">
            <span class="glyphicon glyphicon-time"></span>
            <?php 
echo \app\components\Tools::formatTime($data->created_at);
?>
        </div>
        <div class="thread-main">
            <h3><?php 
echo Html::a(Html::encode($data->title), $data->url);
?>
</h3>
            <div class="content">
             <?php 
echo HtmlPurifier::process($data->content);
?>
            </div>
        </div>
    </div>
</div>
Ejemplo n.º 14
0
        <li <?php 
    echo $message['read_indicator'] == false ? 'class="unread"' : '';
    ?>
>
            <a href="<?php 
    echo \yii\helpers\Url::toRoute(['/user/message/view', 'id' => $message['id']]);
    ?>
">
                <div class="header">
                    <span class="action"><i class="fa fa-square-o"></i></span>
                    <span class="from"><i class="glyphicon glyphicon-user"></i> <?php 
    echo Html::encode(\app\modules\user\models\User::getInfo($message['sendfrom'])['username']);
    ?>
</span>
                    <span class="date"><span class="glyphicon glyphicon-time"></span> <?php 
    echo Tools::formatTime($message['created_at']);
    ?>
</span>
                </div>
                <div class="title">
                    <span class="action"><i class="fa fa-star-o"></i><i class="fa fa-star bg"></i></span>
                    <?php 
    echo Html::encode($message['subject']);
    ?>
                </div>
            </a>
        </li>
    <?php 
}
?>
</ul>
Ejemplo n.º 15
0
 /**
  * 获取所有关注的用户信息
  * @param string $type 类型,'following':关注用户, 'follower':粉丝
  */
 public function getFollow($type)
 {
     $query = new Query();
     switch ($type) {
         case 'following':
             $query->select('u.id, u.username, u.avatar')->from('{{%user}} as u')->join('LEFT JOIN', '{{%user_follow}} as f', 'f.people_id = u.id')->where('f.user_id = :user_id', [':user_id' => $this->id])->orderBy('f.id DESC');
             break;
         case 'follower':
             $query->select('u.id, u.username, u.avatar')->from('{{%user}} as u')->join('LEFT JOIN', '{{%user_follow}} as f', 'f.user_id = u.id')->where('f.people_id = :user_id', [':user_id' => $this->id])->orderBy('f.id DESC');
             break;
         default:
             return false;
             break;
     }
     return Tools::Pagination($query);
 }
Ejemplo n.º 16
0
                                        </a>
                                    </div>
                                    <dl style="margin-bottom:0">
                                        <dt>
                                            <?php 
                echo Html::a(Html::encode($subBoard['name']), ['/forum/board/view', 'id' => $subBoard['id']]);
                ?>
                                        </dt>
                                        <dd class="hidden-xs" data-toggle="tooltip" data-placement="top" title="Thread Count">
                                            <i class="glyphicon glyphicon-comment"></i> <?php 
                echo Board::getThreadCount($subBoard['id']);
                ?>
 
                                        </dd>
                                        <dd class="hidden-xs"><i class="glyphicon glyphicon-time"></i> <?php 
                echo Tools::formatTime(Board::getLastThread($subBoard['id'])['created_at']);
                ?>
</dd>
                                    </dl>
                                </td>
                            <?php 
            }
            ?>
                            <?php 
            $counter += 1;
            ?>
                        <?php 
        }
        ?>
                    </tr>
                <?php 
Ejemplo n.º 17
0
            ?>
</dd>
                                </dl>
                            </td>
                            <td class="hidden-xs" style="width:100px;">
                                <i class="glyphicon glyphicon-comment"></i> <?php 
            echo Board::getThreadCount($subBoard['id']);
            ?>
 
                            </td>
                            <td class="hidden-xs" style="width:150px;">
                                <i class="glyphicon glyphicon-user"></i> <?php 
            echo $lastThread['username'];
            ?>
 <br>
                                <i class="glyphicon glyphicon-time"></i> <?php 
            echo Tools::formatTime($lastThread['created_at']);
            ?>
                            </td>
                        </tr>
                    <?php 
        }
        ?>
                <?php 
    }
    ?>
            </tbody>
        </table>
    </div>
<?php 
}
Ejemplo n.º 18
0
 /**
  * 获取论坛的评论
  */
 public function getComments()
 {
     $query = new Query();
     $query = $query->select('t.id, t.title, t.content, p.user_id, p.content as comment, p.created_at, u.username, u.avatar')->from('{{%forum_post}} as p')->join('LEFT JOIN', '{{%forum_thread}} as t', 'p.thread_id=t.id')->join('LEFT JOIN', '{{%user}} as u', 'u.id=p.user_id')->where('t.user_id=:user_id and p.user_id !=:user_id', [':user_id' => $this->id])->orderBy('p.created_at DESC');
     return Tools::Pagination($query);
 }
Ejemplo n.º 19
0
                                <a href="<?php 
        echo Url::toRoute(['/forum/thread/view', 'id' => $thread['id']]);
        ?>
"><span class="media-title" <?php 
        //if($thread->is_broadcast) echo 'style="color:#ff6f3d"';
        ?>
><?php 
        echo Html::encode($thread['title']);
        ?>
</span></a>
                            </h4>
                            <?php 
        echo Html::a(Html::encode($thread['username']), ['/user/view', 'id' => $thread['username']], ['class' => 'thread-nickname']);
        ?>
                            <span class="thread-time">| <?php 
        echo \app\components\Tools::formatTime($thread['created_at']);
        ?>
</span>
                        </div>
                        <div class="thread-main">
                            <?php 
        echo HtmlPurifier::process($thread['content']);
        ?>
                        </div>
                        <div class="pull-right thread-right">
                            <?php 
        echo Html::a('<span class="glyphicon glyphicon-comment"></span> ' . Yii::t('app', 'Reply'), ['/forum/thread/view', 'id' => $thread['id']]);
        ?>
 
                            <?php 
        if (Yii::$app->user->id == $thread['user_id'] || Yii::$app->user->id == $model->user_id) {
Ejemplo n.º 20
0
                        </a>
                      </span>
                      <div class="mecc col-md-9">
                        <a class="mecctitle" href="<?php 
    echo Url::toRoute(['/explore/view-post', 'id' => $post['id']]);
    ?>
" target="_blank">
                          <h2>
                              <?php 
    echo Html::encode($post['title']);
    ?>
                          </h2>
                        </a>
                        <address class="meccaddress">
                          <time><span class="glyphicon glyphicon-time"></span> <?php 
    echo Tools::formatTime($post['created_at']);
    ?>
</time>
                          - 
                          <?php 
    if (!empty($post['author'])) {
        echo Html::a('<span class="glyphicon glyphicon-user"></span> ' . Html::encode($post['author']), ['/user/view', 'id' => $post['author']]);
    } else {
        echo '<span class="glyphicon glyphicon-user"></span> ' . Html::encode($post['username']);
    }
    ?>
                          -
                          <span title="<?php 
    echo Yii::t('app', 'View Count');
    ?>
"><span class="glyphicon glyphicon-eye-open"></span> <?php 
Ejemplo n.º 21
0
 public function getBroadcasts()
 {
     $query = new Query();
     $query = $query->select('*')->from('{{%forum_broadcast}}' . ' p')->where('forum_id=:forum_id', [':forum_id' => $this->id])->orderBy('created_at DESC');
     return \app\components\Tools::Pagination($query);
 }
Ejemplo n.º 22
0
 /**
  * 获取话题
  * @return array
  */
 public function getThreads()
 {
     $query = new Query();
     $query->select('t.id, t.title, t.content, t.created_at, t.user_id, u.username, u.avatar')->from('{{%forum_thread}} as t')->join('LEFT JOIN', '{{%user}} as u', 'u.id=t.user_id')->where('t.board_id=:id', [':id' => $this->id])->orderBy('t.created_at DESC');
     $result = Tools::Pagination($query);
     return ['threads' => $result['result'], 'pages' => $result['pages']];
 }
Ejemplo n.º 23
0
 /**
  * 获取回复的帖子
  * @return array
  */
 public function getPosts()
 {
     $query = new Query();
     $query->select('p.id,  p.content, p.created_at, p.user_id, u.username, u.avatar')->from('{{%forum_post}} as p')->join('LEFT JOIN', '{{%user}} as u', 'u.id=p.user_id')->where('p.thread_id=:id', [':id' => $this->id]);
     $result = Tools::Pagination($query);
     return ['posts' => $result['result'], 'pages' => $result['pages']];
 }
Ejemplo n.º 24
0
use yii\helpers\HtmlPurifier;
/* @var $this yii\web\View */
/* @var $model app\modules\home\models\Post */
$this->title = $model->title . '_' . $model->user['username'];
$this->params['user'] = $model->user;
$this->params['profile'] = $model->userProfile;
$this->params['userData'] = $model->userData;
?>
<div class="post-view">

    <h1 class="post-title"><?php 
echo Html::encode($model->title);
?>
</h1>
    <div class="post-meta"><i class="glyphicon glyphicon-time icon-muted"></i> <?php 
echo \app\components\Tools::formatTime($model->created_at);
?>
</div>
    <div class="post-content">
       <?php 
echo HtmlPurifier::process($model->content);
?>
    </div>
       <?php 
$post_tags = $model->tags ? explode(',', $model->tags) : array();
$tags_len = count($post_tags);
?>
    <?php 
if ($tags_len > 0) {
    ?>
        <span class="tags">
Ejemplo n.º 25
0
        ?>
</h3>
                            <?php 
        //$this->beginWidget('HtmlPurifier');
        ?>
                            <?php 
        echo $post['content'];
        ?>
                            <?php 
        //$this->endWidget();
        ?>
                        </div>
                        <div class="post-footer">
                            <div class="time">
                                <?php 
        echo \app\components\Tools::formatTime($post['created_at']);
        ?>
                            </div>
                        </div>
                    </div>
                </div>
            </li>
        <?php 
    }
    ?>
    </ul>
    <?php 
    echo LinkPager::widget(['pagination' => $pages]);
} else {
    ?>
    <div class="no-data-found">
Ejemplo n.º 26
0
        <?php 
foreach ($model->feeds['feeds'] as $feed) {
    ?>
            <li class="post-item">
                <div class="post-content">
                    <?php 
    if (!empty($feed->content)) {
        echo Html::encode($feed->content);
    } else {
        echo strtr($feed['template'], unserialize($feed['feed_data']));
    }
    ?>
                </div>
                <div class="clearfix"></div>
                <div class="post-info">
                    <i class="glyphicon glyphicon-time icon-muted"></i> <?php 
    echo Tools::formatTime($feed->created_at);
    ?>
                </div>
            </li>
        <?php 
}
?>
        <?php 
echo InfiniteScrollPager::widget(['pagination' => $model->posts['pages'], 'widgetId' => '#content']);
?>
      </ul>
    </div><!-- activity-list -->
  </div>
</div>
Ejemplo n.º 27
0
                                        <img width="50" height="50" class="social-avatar pull-left" src="<?php 
    echo Yii::getAlias('@avatar') . $user->avatar;
    ?>
" />
                                        <div class="profile-details">
                                            <a class="user-name" href="<?php 
    echo Url::toRoute(['/user/view', 'id' => $user->username]);
    ?>
">
                                                <?php 
    echo Html::encode($user->username);
    ?>
                                            </a>
                                            <p>
                                                <em><?php 
    echo Tools::formatTime($comment['created_at']);
    ?>
</em>
                                            </p>
                                        </div>
                                    </div>
                                    <p class="content">
                                        <?php 
    if (!empty($comment['title'])) {
        ?>
                                            <h3><?php 
        echo Html::a(Html::encode($comment['title']), ['/home/comment/view', 'id' => $comment['id']]);
        ?>
</h3>
                                        <?php 
    }