/**
  * executeViewIndex
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewIndex(&$render)
 {
     $render->setTemplateName('xcforum_forumaccess_list.html');
     //$render->setAttribute('objects', $this->mObjects);
     //$render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     //$render->setAttribute('pageNavi', $this->mFilter->mNavi);
     parent::executeViewIndex($render);
 }
예제 #2
0
 /**
  * executeViewIndex
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewIndex(&$render)
 {
     $render->setTemplateName($this->mAsset->mDirname . '_post_list.html');
     //$render->setTemplateName($this->mAsset->mDirname . '_topic_view.html');
     $render->setAttribute('topicObj', $this->mTopicObj);
     $render->setAttribute('forumObj', $this->mForumObj);
     $render->setAttribute('objects', $this->mObjects);
     $render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     $render->setAttribute('pageNavi', $this->mFilter->mNavi);
     parent::executeViewInput($render);
 }
 /**
  * prepare
  * 
  * @param	void
  * 
  * @return	bool
  **/
 public function prepare()
 {
     parent::prepare();
     return true;
 }
예제 #4
0
 /**
  * executeViewIndex
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewIndex(&$render)
 {
     /*** Xcforum_ForumsHandler ***/
     $handler =& $this->_getHandler();
     $arr_bit_new = array();
     foreach ($this->mObjects as &$obj) {
         $forum_id = $obj->getshow('forum_id');
         $bit_new = $obj->getshow('forum_last_post_time') && !$obj->getshow('forum_topics_count') ? 1 : 0;
         $arr_bit_new[$forum_id] = $bit_new;
         $obj->initVar('bit_new', XOBJ_DTYPE_INT, '', false);
         $obj->set('bit_new', $bit_new);
         /*** Xcforum_PostsHandler ***/
         $mHandler =& $this->mAsset->getObject('handler', 'Posts', false);
         $last_post_id = $obj->getVar('forum_last_post_id');
         $mPostObj = $mHandler->get($last_post_id);
         if (is_object($mPostObj)) {
             //user's info
             $uid = $mPostObj->get('uid');
             if ($uid > 0) {
                 $users[$uid] = new XoopsUser($uid);
                 $uname = $users[$uid]->getUnameFromId($uid, $this->mod_config['use_name']);
                 $uname = !empty($uname) ? $uname : $users[$uid]->getUnameFromId($uid, 0);
                 $obj->initVar('forum_last_post_dispname', XOBJ_DTYPE_STRING, $uname, false);
                 unset($uname);
             } else {
                 $obj->initVar('forum_last_post_dispname', XOBJ_DTYPE_STRING, $mPostObj->get('guest_name'), false);
             }
             $obj->initVar('forum_last_post_icon', XOBJ_DTYPE_STRING, $mPostObj->get('icon'), false);
         }
         $handler->setModerateGroups($obj, $forum_id);
         $handler->setModerateUsers($obj, $forum_id);
     }
     //adump($this->mObjects);
     $render->setTemplateName($this->mAsset->mDirname . '_forum_list.html');
     //$render->setAttribute('objects', $this->mObjects);
     //$render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     //$render->setAttribute('mod_url', XOOPS_MODULE_URL . '/'. $this->mAsset->mDirname);
     //$render->setAttribute('mod_imageurl', XOOPS_MODULE_URL . '/'. $this->mAsset->mDirname . '/images');
     $render->setAttribute('arr_bit_new', $arr_bit_new);
     //$render->setAttribute('pageNavi', $this->mFilter->mNavi);
     $render->setAttribute('accessController', $this->mAccessController['main']);
     parent::executeViewIndex($render);
 }
예제 #5
0
 /**
  * executeViewIndex
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewIndex(&$render)
 {
     // permissions
     $params = array();
     $params['uid'] = $this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser') ? $this->mRoot->mContext->mXoopsUser->get('uid') : 0;
     $params['can_read'] = true;
     $params['can_post'] = in_array($this->forum_id, $this->mForumAcc['post']);
     $params['can_edit'] = in_array($this->forum_id, $this->mForumAcc['edit']);
     $params['can_delete'] = in_array($this->forum_id, $this->mForumAcc['delete']);
     $params['can_reply'] = in_array($this->forum_id, $this->mForumAcc['post']);
     $params['isadminormod'] = $this->mod_isadmin ? true : in_array($this->forum_id, $this->mForumAcc['moderate']);
     $params['mod_config'] =& $this->mod_config;
     //adump($mObj);
     if (isset($this->forum_id) && $this->forum_id > 0) {
         if (isset($this->mForumAcc) && count($this->mForumAcc) > 0) {
             if (in_array($this->forum_id, $this->mForumAcc['can_read'])) {
                 $this->mForumObj->initVar('can_post', XOBJ_DTYPE_INT, $params['can_post'], false);
                 $isadminormod = $this->mod_isadmin || $params['isadminormod'];
                 $this->mForumObj->initVar('isadminormod', XOBJ_DTYPE_INT, $isadminormod, false);
             }
         }
     }
     foreach ($this->mObjects as &$mObj) {
         $mObj->initVar('topic_votes_avg', XOBJ_DTYPE_INT, (int) $mObj->get('topic_votes_sum') / ((int) $mObj->get('topic_votes_count') - 0.01), false);
         $bit_new = (int) $mObj->get('topic_last_post_time') > @$mObj->get('u2t_time') ? 1 : 0;
         $bit_hot = (int) $mObj->get('topic_votes_count') > $this->mod_config['hot_threshold'] ? 1 : 0;
         $mObj->initVar('bit_new', XOBJ_DTYPE_INT, $bit_new, false);
         $mObj->initVar('bit_hot', XOBJ_DTYPE_INT, $bit_hot, false);
         $mObj->initVar('topic_votes_src', XOBJ_DTYPE_STRING, "", false);
         $mObj->initVar('topic_page_jump', XOBJ_DTYPE_STRING, "", false);
         $params['guest_name'] = $mObj->get('fp_guest_name');
         $rtn = Xcforum_Utils::getPosterData($mObj->get('topic_first_uid'), $params);
         $poster_dispname = isset($rtn['poster_dispname']) ? $rtn['poster_dispname'] : "";
         $poster_uname = isset($rtn['poster_uname']) ? $rtn['poster_uname'] : "";
         $poster_name = isset($rtn['poster_name']) ? $rtn['poster_name'] : "";
         $poster_gname = isset($rtn['poster_gname']) ? $rtn['poster_gname'] : "";
         $mObj->initVar('first_post_dispname', XOBJ_DTYPE_STRING, $poster_dispname, false);
         $mObj->initVar('first_post_uname', XOBJ_DTYPE_STRING, $poster_uname, false);
         $mObj->initVar('first_post_name', XOBJ_DTYPE_STRING, $poster_name, false);
         $mObj->initVar('first_post_gname', XOBJ_DTYPE_STRING, $poster_gname, false);
         $params['guest_name'] = $mObj->get('lp_guest_name');
         $rtn = Xcforum_Utils::getPosterData($mObj->get('topic_last_uid'), $params);
         $poster_dispname = isset($rtn['poster_dispname']) ? $rtn['poster_dispname'] : "";
         $poster_uname = isset($rtn['poster_uname']) ? $rtn['poster_uname'] : "";
         $poster_name = isset($rtn['poster_name']) ? $rtn['poster_name'] : "";
         $poster_gname = isset($rtn['poster_gname']) ? $rtn['poster_gname'] : "";
         $mObj->initVar('last_post_dispname', XOBJ_DTYPE_STRING, $poster_dispname, false);
         $mObj->initVar('last_post_uname', XOBJ_DTYPE_STRING, $poster_uname, false);
         $mObj->initVar('last_post_name', XOBJ_DTYPE_STRING, $poster_name, false);
         $mObj->initVar('last_post_gname', XOBJ_DTYPE_STRING, $poster_gname, false);
     }
     //$render->setTemplateName($this->mAsset->mDirname . '_topics_list.html');
     $render->setTemplateName($this->mAsset->mDirname . '_topic_list.html');
     $render->setAttribute('forumObj', $this->mForumObj);
     //$render->setAttribute('objects', $this->mObjects);
     //$render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     $render->setAttribute('pageNavi', $this->mFilter->mNavi);
     //adump($this->mFilter->mNavi);
     $render->setAttribute('solved_options', $this->solved_options);
     $render->setAttribute('query', $this->query4assign);
     $q_solved = (int) $this->mRoot->mContext->mRequest->getRequest('solved');
     if ($q_solved > 0) {
         $qstr_solved = "&solved=" . $q_solved;
     }
     $q_txt = $this->mRoot->mContext->mRequest->getRequest('txt');
     if ($q_txt) {
         $qstr_txt = "&txt=" . htmlspecialchars($q_txt, ENT_QUOTES, _CHARSET);
     }
     $qstr = $qstr_solved || $qstr_txt ? $qstr_solved . $qstr_txt : "";
     $render->setAttribute('qstr', $qstr);
     $render->setAttribute('topic_hits', $this->topic_hits);
     // pagenav
     $pagenav = '';
     //$query4nav = 'topic_id=' . $topic_id ;
     $query4nav = 'action=TopicsList';
     $query4nav .= $this->forum_id > 0 ? '&forum_id=' . $this->forum_id : '';
     // LIMIT
     $num = $this->mod_config['topics_per_page'] < 5 ? 5 : (int) $this->mod_config['topics_per_page'];
     $pos = 0;
     if ($this->topic_hits > $num) {
         // POS
         $pos = $this->mRoot->mContext->mRequest->getRequest('start');
         //$pos = isset( $pos ) ? (int)$pos : (($postorder == 0) || ($postorder == 2) ? (int)(($this->topic_hits-1) / $num) * $num : 0) ;
         $pos = isset($pos) ? (int) $pos : 0;
         require_once XCFORUM_TRUST_PATH . '/class/Pagenav.class.php';
         $pagenav_obj = new XcforumPagenav($this->topic_hits, $num, $pos, 'start', $query4nav);
         $pagenav = $pagenav_obj->getNav();
         $render->setAttribute('pagenav', $pagenav);
     }
     parent::executeViewIndex($render);
 }