Exemplo n.º 1
1
function likeQaction()
{
    $likeq = new likeQ();
    if ($_GET) {
        $set = array($UID = $this->getRequest()->getparam("UID", ""), $QID = $this->getRequest()->getparam("QID", ""), $data = date('Y-m-d h-m-s'));
        $likeq->insertLikeA($set);
    }
}
Exemplo n.º 2
1
 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");
 }
Exemplo n.º 3
0
 public function askAction()
 {
     session_start();
     if (isset($_SESSION['user'])) {
         $loginuser = $_SESSION['user'];
     } else {
         $loginuser = array('UID' => -1);
     }
     #名字要根据login的控制器改过来
     $UID = $loginuser['UID'];
     //$UID=2;
     #if($_GET['P'] != null)
     #$QPage=$_GET['P'];   #从前端获取ask的页码
     #else $QPage=1;
     $QPage = 1;
     $tag = new tag();
     $this->view->url = "\\personal\\ask";
     //$this->view->Tag=$tag.getAllTags();
     #$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), 'likeQnum' => $likeQ->getLikenumbyUID($MUID), 'follownum' => $follownum, 'followednum' => $followednum, 'isfollow' => $isfollow);
     file_put_contents("E:/out.txt", $info);
     $question = new question();
     $followq = new followQ();
     $followu = new followU();
     $ask_tmp = new ask();
     $answer1 = new answer();
     $tag = new tag();
     $QIDs = $ask_tmp->getQIDsbyUID($MUID);
     $Qnum = count($QIDs);
     $QID_Time_tmp = array();
     $ask = array();
     $m = 0;
     #计数用
     for ($i = 0; $i < $Qnum; $i++) {
         $QID_Time_tmp[$QIDs[$i]] = $ask_tmp->getAskTimebyQID($QIDs[$i]);
     }
     arsort($QID_Time_tmp);
     foreach ($QID_Time_tmp as $qid => $time) {
         $q = $question->getAllbyQID($qid);
         $ask[$m] = array('QID' => $qid, 'title' => $q['qtitle'], 'abstract' => $q['Qabstract'], 'follownum' => $followq->getFollownumbyQID($qid), 'answernum' => $answer1->getAnswernumbyQID($qid), 'tag' => $tag->getTagbyQID($qid), 'Atime' => $QID_Time_tmp[$qid]);
         $m++;
     }
     if ($Qnum % 10 == 0) {
         $this->view->QpageNum = $Qnum / 10;
     } else {
         $this->view->QpageNum = $Qnum / 10 + 1;
     }
     $this->view->ask = array_slice($ask, ($QPage - 1) * 10, 10);
     //$this->render("ask");
     $this->render("homepage-ask");
 }