function followedAction()
 {
     $MUID = $_GET['UID'];
     //传被访问者的信息
     $user = new user();
     $info = $user->getAllbyUID($MUID);
     $answer = new answer();
     $likeQ = new likeQ();
     $likeA = new likeA();
     $followu = new followU();
     $ffnum = $followu->getFollownumbyUID($MUID);
     //$this->view->followednum=$ffnum; //关注你的人的人数
     $uids = $followu->getUIDsbyFUID($MUID);
     //关注你的人的uid数组
     $this->view->pinfo = array('UID' => $MUID, 'nickname' => $info['nickname'], 'sex' => $info['sex'], 'image' => $info['image'], 'institute' => $info['institute'], 'grade' => $info['grade'], 'answernum' => $answer->getAnswernumbyUID($MUID), 'likenum' => $likeA->getLikenumbyUID($MUID) + $likeQ->getLikenumbyUID($MUID), 'follownum' => $ffnum, 'followednum' => count($uids));
     $FFPI = array();
     for ($i = 0; $i < count($uids); $i++) {
         $info = $user->getAllbyUID($uids[$i]);
         $FFPI[$i] = array("MUID" => $uids[$i], "Mnickname" => $info['nickname'], "Mimage" => $info['image'], 'Minstitute' => $info['institute'], "Mgrade" => $info['grade']);
     }
     $this->view->FPI = $FFPI;
     $this->render("homepage-follower");
 }
 public function answerAction()
 {
     session_start();
     if (isset($_SESSION['user'])) {
         $loginuser = $_SESSION['user'];
     } else {
         $loginuser = array('UID' => -1);
     }
     #名字要根据login的控制器改过来
     $UID = $loginuser['UID'];
     //if($_GET['P'] != null)
     //$APage=$_GET['P'];   #从前端获取ask的页码
     //else $APage=1;
     $APage = 1;
     //$UID=2;
     $this->view->PersonalInfo = array('UID' => $UID, 'image' => '');
     #$loginuser['image']);
     #$MUID=$this->getRequest()->getParam('MUID','');  #从前端的获取被访问者的UID
     $MUID = $_GET['UID'];
     $user = new user();
     $info = $user->getAllbyUID($MUID);
     $answer_tmp = new answer();
     $likeQ = new likeQ();
     $likeA = new likeA();
     $followu = new followU();
     $follownum = $followu->getFollownumbyUID($MUID);
     $followednum = $followu->getFollownumbyFUID($MUID);
     $farr = $followu->getFUIDsbyUID($UID);
     $isfollow = false;
     for ($i = 0; $i < count($farr); $i++) {
         if ($farr[$i] == $MUID) {
             $isfollow = true;
             break;
         }
     }
     $this->view->pinfo = array('UID' => $MUID, 'nickname' => $info['nickname'], 'sex' => $info['sex'], 'image' => $info['image'], 'institute' => $info['institute'], 'grade' => $info['grade'], 'answernum' => $answer_tmp->getAnswernumbyUID($MUID), 'likenum' => $this->getLikedNumByUID($MUID), 'follownum' => $follownum, 'followednum' => $followednum, 'isfollow' => $isfollow);
     $question = new question();
     $answer_tmp1 = new answer();
     $answer = array();
     $tag = new tag();
     $followq = new followQ();
     $AIDs = $answer_tmp1->getAIDsbyUID($MUID);
     $Anum = count($AIDs);
     $AID_Time_tmp = array();
     $m = 0;
     #为answer数组计数用
     for ($i = 0; $i < $Anum; $i++) {
         $AID_Time_tmp[$AIDs[$i]] = $answer_tmp1->getTimebyAID($AIDs[$i]);
     }
     arsort($AID_Time_tmp);
     foreach ($AID_Time_tmp as $aid => $time) {
         $a = $answer_tmp1->getAllbyAID($aid);
         $qid = $a['QID'];
         $answer[$m] = array('QID' => $qid, 'title' => $question->getAllbyQID($qid)['qtitle'], 'abstract' => $question->getAllbyQID($qid)['Qabstract'], 'Aabstract' => $a['AAbstract'], 'Atime' => $a['time'], 'follownum' => $followq->getFollownumbyQID($qid), 'answernum' => $answer_tmp->getAnswernumbyQID($qid), 'tag' => $tag->getTagbyQID($qid));
         $m++;
     }
     if ($Anum % 10 == 0) {
         $this->view->Pnum = $Anum / 10;
     } else {
         $this->view->Pnum = $Anum / 10 + 1;
     }
     $this->view->answer = array_slice($answer, ($APage - 1) * 10, 10);
     $this->view->url = "/personal/answer?UID={$MUID}&";
     $this->render("homepage-answer");
 }