コード例 #1
0
 /**
  * 回复列表
  */
 public function replyAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $count = $this->_getThreadExpandDs()->countDisabledPostByUid($this->loginUser->uid);
     if ($count) {
         $tmpPosts = $this->_getThreadExpandDs()->getDisabledPostByUid($this->loginUser->uid, $limit, $start);
         $posts = $tids = array();
         foreach ($tmpPosts as $v) {
             $tids[] = $v['tid'];
         }
         $threads = $this->_getThreadDs()->fetchThread($tids);
         foreach ($tmpPosts as $v) {
             $v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30);
             $v['content'] = Pw::substrs($v['content'], 30);
             $v['created_time'] = PW::time2str($v['created_time'], 'auto');
             $posts[] = $v;
         }
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($posts, 'posts');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.article.reply.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
コード例 #2
0
 /**
  * 我的回复
  *
  */
 public function postAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $count = $this->_getCountPost($this->space->spaceUid, $this->loginUser->uid);
     if ($count) {
         $tmpPosts = $this->_getPost($this->space->spaceUid, $this->loginUser->uid, $limit, $start);
         $posts = $tids = array();
         foreach ($tmpPosts as $v) {
             $tids[] = $v['tid'];
         }
         $threads = $this->_getThreadDs()->fetchThread($tids);
         foreach ($tmpPosts as $v) {
             $v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30);
             $v['content'] = Pw::substrs($v['content'], 30);
             $v['created_time'] = PW::time2str($v['created_time'], 'auto');
             $posts[] = $v;
         }
     }
     $args = array('uid' => $this->space->spaceUid);
     $this->setOutput($args, 'args');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($posts, 'posts');
     $this->setOutput('thread', 'src');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $des = $lang->getMessage('SEO:space.thread.post.description', array($this->space->spaceUser['username']));
     if ($page <= 1) {
         $seoBo->setCustomSeo($lang->getMessage('SEO:space.thread.post.title', array($this->space->spaceUser['username'], $this->space->space['space_name'])), '', $des);
     } else {
         $seoBo->setCustomSeo($lang->getMessage('SEO:space.thread.post.page.title', array($this->space->spaceUser['username'], $page, $this->space->space['space_name'])), '', $des);
     }
     Wekit::setV('seo', $seoBo);
 }
コード例 #3
0
ファイル: PwSpaceModel.php プロジェクト: YoursBoss/nextwind
 protected function modelPostList($limit, $page)
 {
     $ds = Wekit::load('forum.PwThread');
     list($offset, $limit) = Pw::page2limit($page, $limit);
     $count = $ds->countPostByUid($this->spaceUid);
     if ($count) {
         $tmpPosts = $ds->getPostByUid($this->spaceUid, $limit, $offset);
         $posts = $tids = array();
         foreach ($tmpPosts as $v) {
             $tids[] = $v['tid'];
         }
         $threads = $this->_getThreadDs()->fetchThread($tids);
         foreach ($tmpPosts as $v) {
             $v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30);
             $v['content'] = Pw::substrs($v['content'], 30);
             $v['created_time'] = PW::time2str($v['created_time'], 'auto');
             $posts[] = $v;
         }
     }
     return array($count, $posts);
 }