示例#1
0
 public function SocialViewAction()
 {
     $v_request = Project::getRequest();
     $v_current_userID = (int) Project::getUser()->getDbUser()->id;
     $data = array();
     $this->_get_categories($data, $v_categoryID);
     //$this->_BaseSiteData($data);
     $data['action'] = 'SocialView';
     $v_id = (int) $v_request->getKeyByNumber(0);
     if ($v_id > 0) {
         $v_sp_model = new SocialModel();
         $data['social_row'] = $v_sp_model->loadSocialRows($v_id);
         $v_tab_name = $data['social_row'][0]['name'];
         $v_encoding = mb_detect_encoding($v_tab_name);
         if (mb_strlen($v_tab_name, $v_encoding) > 50) {
             $v_tab_name = mb_substr($v_tab_name, 0, 50, $v_encoding) . '...';
         }
         //$data['tab_social_view'] = $v_tab_name;
         // ---
         $controller = new BaseCommentController();
         $data['comment_list'] = $controller->CommentList($v_id, $v_request->getKeyByNumber(1), 0, 'Social', 'SocialView', 'social', array($v_id));
         $data['add_comment_url'] = $v_request->createUrl('Social', 'SocialCommentAdd');
         $data['add_comment_element_id'] = $v_id;
         $data['add_comment_id'] = 0;
         // -- Проверка наличия внесение комментариев текущим пользователем по данной соц.позиции
         $v_sp_comment_model = new SocialCommentModel();
         $v_sp_votes_model = new SocialVotesModel();
         $v_count_comment = $v_sp_comment_model->GetCountRecComment($v_current_userID, $v_id);
         $v_count_votes = $v_sp_votes_model->GetCountRecVotes($v_current_userID, $v_id);
         $data['count_comment'] = $v_count_comment;
         $data['count_votes'] = $v_count_votes;
         // ---
         $this->_view->assign('tab_list', TabController::getSocialTabs(false, false, false, false, true, $v_tab_name));
         // Show tabs
         $this->_view->Social_View($data);
         $this->_view->parse();
     } else {
         Project::getResponse()->redirect($v_request->createUrl('Social', 'SocialMainList'));
     }
 }