public function run()
 {
     Wind::import('SRV:forum.srv.PwThreadList');
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     $threadList = new PwThreadList();
     $threadList->setPage($page)->setPerpage($perpage);
     Wind::import('SRV:forum.srv.threadList.PwMyThread');
     $dataSource = new PwMyThread($this->loginUser->uid);
     $threadList->execute($dataSource);
     $threads = $threadList->getList();
     $topic_type = array();
     foreach ($threads as &$v) {
         $topic_type[] = $v['topic_type'];
     }
     $topictypes = $topic_type ? Wekit::load('forum.PwTopicType')->fetchTopicType($topic_type) : array();
     $this->setOutput($threadList->total, 'count');
     $this->setOutput($threadList->page, 'page');
     $this->setOutput($threadList->perpage, 'perpage');
     $this->setOutput($threads, 'threads');
     $this->setOutput($topictypes, 'topictypes');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.article.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 /**
  * 无图版版块列表页
  */
 public function threadAction()
 {
     list($fid, $page) = $this->getInput(array('fid', 'page'), 'GET');
     /* @var $pwforum PwForumBo */
     Wind::import('SRV:forum.bo.PwForumBo');
     $pwforum = new PwForumBo($fid, true);
     $this->_checkForumRight($pwforum);
     /* @var $threadList PwThreadList */
     Wind::import('SRV:forum.srv.PwThreadList');
     $threadList = new PwThreadList();
     $threadList->setPage($page)->setPerpage(100);
     /* @var $dataSource PwCommonThread */
     Wind::import('SRV:forum.srv.threadList.PwCommonThread');
     $dataSource = new PwCommonThread($pwforum);
     $threadList->execute($dataSource);
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     if ($threadList->page <= 1) {
         $seoBo->setDefaultSeo($lang->getMessage('SEO:bbs.thread.run.title'), '', $lang->getMessage('SEO:bbs.thread.run.description'));
     }
     $seoBo->init('bbs', 'thread', $fid);
     $seoBo->set(array('{forumname}' => $pwforum->foruminfo['name'], '{forumdescription}' => Pw::substrs($pwforum->foruminfo['descrip'], 100, 0, false), '{classification}' => '', '{page}' => $threadList->page));
     Wekit::setV('seo', $seoBo);
     $this->setOutput($threadList->getList(), 'threadList');
     $this->setOutput($fid, 'fid');
     $this->setOutput($pwforum, 'pwforum');
     $this->setOutput($threadList->page, 'page');
     $this->setOutput($threadList->perpage, 'perpage');
     $this->setOutput($threadList->total, 'count');
     $this->setOutput($threadList->maxPage, 'totalpage');
     $this->setTemplate('simple_thread');
 }
Exemple #3
0
	/**
	 * 我的版块
	 */
	public function myAction() {
		if (!$this->loginUser->isExists()) {
			$this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/forum/my')));
		}
		$order = $this->getInput('order', 'get');
		$page = intval($this->getInput('page', 'get'));
		
		$threadList = new PwThreadList();
		// $this->runHook('c_thread_run', $forumDisplay);
		$threadList->setPage($page)->setPerpage(Wekit::C('bbs', 'thread.perpage'));
		
		Wind::import('SRV:forum.srv.threadList.PwMyForumThread');
		$dataSource = new PwMyForumThread($this->loginUser);
		if ($order == 'postdate') {
			$dataSource->setOrderBy($order);
		} else {
			$dataSource->setOrderBy('lastpost');
		}
		$threadList->execute($dataSource);
		$threaddb = $threadList->getList();
		$fids = array();
		foreach ($threaddb as $key => $value) {
			$fids[] = $value['fid'];
		}
		$forums = Wekit::load('forum.PwForum')->fetchForum($fids);
		
		$this->setOutput($threaddb, 'threadList');
		$this->setOutput($forums, 'forums');
		$this->setOutput($threadList->icon, 'icon');
		$this->setOutput($threadList->uploadIcon, 'uploadIcon');
		$this->setOutput($order, 'order');
		
		$this->setOutput($threadList->page, 'page');
		$this->setOutput($threadList->perpage, 'perpage');
		$this->setOutput($threadList->total, 'count');
		$this->setOutput($threadList->maxPage, 'totalpage');
		$this->setOutput($threadList->getUrlArgs(), 'urlargs');

		// seo设置
		Wind::import('SRV:seo.bo.PwSeoBo');
		$seoBo = PwSeoBo::getInstance();
		$lang = Wind::getComponent('i18n');
		$seoBo->setCustomSeo($lang->getMessage('SEO:bbs.forum.my.title'), '', '');
		Wekit::setV('seo', $seoBo);
	}
 /**
  * 关于某一个用户发布的贴子 (审核通过的)
  *
  * @param int $uid 
  * @param int $page 
  * @param string $type 
  * @access public
  * @return void
  */
 public function getThreadListByUid($uid, $page, $type)
 {
     $page = $page ? $page : 1;
     $perpage = 20;
     //
     $dataSource = new PwNativeThreadDataSource($uid, $this->_getForumService()->fids, $type);
     $threadList = new PwThreadList();
     $threadList->setPage($page)->setPerpage($perpage);
     $threadList->execute($dataSource);
     $threads = $threadList->getList();
     $this->threadPageCount = $threadList->maxPage;
     //
     $tids = array();
     if ($threads) {
         foreach ($threads as $thread) {
             $tids[] = $thread['tid'];
         }
     }
     return $tids;
 }
 /**
  * 我的帖子
  *
  */
 public function run()
 {
     Wind::import('SRV:forum.srv.PwThreadList');
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     !$perpage && ($perpage = 20);
     $threadList = new PwThreadList();
     $threadList->setPage($page)->setPerpage($perpage);
     $dataSource = null;
     if ($this->space->spaceUid == $this->loginUser->uid) {
         Wind::import('SRV:forum.srv.threadList.PwMyThread');
         $dataSource = new PwMyThread($this->space->spaceUid);
     } else {
         Wind::import('SRV:forum.srv.threadList.PwSpaceThread');
         $dataSource = new PwSpaceThread($this->space->spaceUid);
     }
     $threadList->execute($dataSource);
     $threads = $threadList->getList();
     $topic_type = array();
     foreach ($threads as &$v) {
         $topic_type[] = $v['topic_type'];
     }
     $topictypes = $topic_type ? Wekit::load('forum.PwTopicType')->fetchTopicType($topic_type) : array();
     $this->setOutput(array('uid' => $this->space->spaceUid), 'args');
     $this->setOutput($threadList->total, 'count');
     $this->setOutput($threadList->page, 'page');
     $this->setOutput($threadList->perpage, 'perpage');
     $this->setOutput($threadList->getList(), 'threads');
     $this->setOutput($topictypes, 'topictypes');
     $this->setOutput('thread', 'src');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $des = $lang->getMessage('SEO:space.thread.run.description', array($this->space->spaceUser['username']));
     if ($page <= 1) {
         $seoBo->setCustomSeo($lang->getMessage('SEO:space.thread.run.title', array($this->space->spaceUser['username'], $this->space->space['space_name'])), '', $des);
     } else {
         $seoBo->setCustomSeo($lang->getMessage('SEO:space.thread.run.page.title', array($this->space->spaceUser['username'], $page, $this->space->space['space_name'])), '', $des);
     }
     Wekit::setV('seo', $seoBo);
 }