Esempio n. 1
0
 private function welcome()
 {
     $article = new articleModel();
     $articleNum = $article->getArticleNum();
     $user = new userModel();
     $dict = new dictModel();
     $feedback = new feedbackModel();
     $entryNum = $dict->getAllEntryTotal2();
     //echo ($articleNum);
     $userNum = $user->getAllUserTotal();
     $examination = new examinationModel();
     $examNum = $examination->getExamNum();
     $this->smarty->assign("aaa", $dict->getAllEntryTotal2());
     $this->smarty->assign("rrr", $dict->getAllReportWordsTotal2());
     //Tools::dump($feedback->getAllNewFeedbackTotal());
     $this->smarty->assign("fff", $feedback->getAllNewFeedbackTotal());
     $this->smarty->assign("examNum", $examNum);
     $this->smarty->assign("userNum", $userNum);
     $this->smarty->assign("articleNum", $articleNum);
     $this->smarty->display("admin/welcome.html");
     exit;
 }
Esempio n. 2
0
 private function result()
 {
     $this->showNav();
     if (isset($_POST['send'])) {
         $course = new courseModel();
         $course->id = $_POST['cid'];
         $oneCourse = $course->getOneCourse();
         $this->smarty->assign("oneCourse", $oneCourse);
         $user = new userModel();
         $user->id = $_SESSION['oneUserName']->id;
         $oneUser = $user->getOneUserByID();
         $this->smarty->assign("oneUser", $oneUser);
         $user->updateCountdown();
         $num = 0;
         $str .= "";
         $resultNum = 0;
         //echo $_POST['choiceNum'];
         while ($i < $_POST['choiceNum']) {
             $i++;
             $num++;
             //echo $_POST['choice'.($i)]
             $this->model->id = $_POST['choice' . $i];
             //echo $this->model->id."<br>";
             $oneChoice = $this->model->getOneChoice();
             //Tools::dump($_POST['choice'][$i]);
             //echo $_POST['choice'][$_POST['choice'.($i)]]."<br>";
             if ($oneChoice->answer == $_POST['choice'][$_POST['choice' . $i]]) {
                 $str .= "<div class='item'><dt>" . $num . "." . $oneChoice->question;
                 $str .= "<span class='glyphicon glyphicon-ok right'></span>";
                 $str .= "</dt>";
                 $resultNum++;
             } else {
                 $str .= "<div class='item'><dt>" . $num . "." . $oneChoice->question;
                 $str .= "<span class='glyphicon glyphicon-remove wrong'></span>";
                 $str .= "</dt>";
                 if ($_POST['choice'][$_POST['choice' . $i]] != '') {
                     $str .= "<dd class='failed'><b style='color:green;'>正确答案是:" . $oneChoice->answer . "</b>,";
                     $str .= "<span class='wrong'>您选择的是:" . $_POST['choice'][$_POST['choice' . $i]] . "。<span></dd>";
                     $str .= "<dd style='margin-bottom:3px;' class='alert alert-danger'><b style='color:red'>提示:</b>" . $oneChoice->tips . "</dd>";
                 } else {
                     $str .= "<dd class='wrong'>您未答此题</dd>";
                 }
             }
             $str .= "<dd>A." . $oneChoice->a . "</dd>";
             $str .= "<dd>B." . $oneChoice->b . "</dd>";
             $str .= "<dd>C." . $oneChoice->c . "</dd>";
             $str .= "<dd>D." . $oneChoice->d . "</dd></div>";
         }
         ////////judge/////////////////
         $num2 = 0;
         $str2 .= "";
         $resultNum2 = 0;
         //echo $_POST['choiceNum'];
         //echo $_POST['judgeNum'];
         while ($j < $_POST['judgeNum']) {
             $j++;
             $num2++;
             //echo $_POST['choice'.($i)]
             $this->model->id = $_POST['judge' . $j];
             $oneJudge = $this->model->getOneJudge();
             //Tools::dump($_POST['choice'][$i]);
             //echo $_POST['choice'][$_POST['choice'.($i)]]."<br>";
             if ($oneJudge->answer == $_POST['judge'][$_POST['judge' . $j]]) {
                 $str2 .= "<div class='item'><dt>" . $num2 . "." . $oneJudge->question;
                 $str2 .= "<span class='glyphicon glyphicon-ok right'></span>";
                 $str2 .= "</dt></div>";
                 $resultNum2++;
             } else {
                 $str2 .= "<div class='item'><dt>" . $num2 . "." . $oneJudge->question;
                 $str2 .= "<span class='glyphicon glyphicon-remove wrong'></span>";
                 $str2 .= "</dt>";
                 if ($_POST['judge'][$_POST['judge' . $j]] != '') {
                     switch ($oneJudge->answer) {
                         case '1':
                             $answer = "正确";
                             break;
                         case "0":
                             $answer = "错误";
                     }
                     switch ($_POST['judge'][$_POST['judge' . $j]]) {
                         case '1':
                             $answer2 = "正确";
                             break;
                         case "0":
                             $answer2 = "错误";
                     }
                     $str2 .= "<dd><span class='wrong'>正确答案是:" . $answer . "</span>,";
                     $str2 .= "<span class='wrong'>您选择的是:" . $answer2 . "。<span></dd>";
                     $str2 .= "<dd style='margin-bottom:3px;' class='alert alert-danger'><b style='color:red'>提示:</b>" . $oneJudge->tips . "</dd>";
                 } else {
                     $str2 .= "<dd class='wrong'>您未答此题</dd>";
                 }
                 $str2 .= "<dd>A.正确,";
                 $str2 .= "B.错误</dd></div>";
             }
         }
         //
         $user = new userModel();
         $examination = new examinationModel();
         $userLeaderboard = $examination->getUserLeaderboard();
         $allCourse = $course->getFrontCourse();
         $arr = array();
         foreach ($allCourse as $key => $value) {
             $examination->cid = $value->id;
             $hotExam = $examination->getExamByCID();
             foreach ($hotExam as $k => $v) {
                 $user->id = $v->uid;
                 $oneUser = $user->getOneUserByID();
                 $v->uid = $oneUser->username;
             }
             $arr[$value->name] = $hotExam;
         }
         //Tools::dump($arr);
         $this->smarty->assign("arr", $arr);
         $this->model->uid = $_POST['uid'];
         $this->model->cid = $_POST['cid'];
         $this->model->total = $_POST['choiceNum'] + $_POST['judgeNum'];
         $this->model->ticked = count($_POST['judge']) + count($_POST['choice']);
         $this->model->rightNum = $resultNum + $resultNum2;
         //$this->model->score=$resultNum*10+$resultNum2*10;
         $this->model->score = number_format(($resultNum + $resultNum2) / ($_POST['choiceNum'] + $_POST['judgeNum']) * 100, 2);
         $this->model->createExam();
     }
     $this->smarty->assign("total", $_POST['choiceNum'] + $_POST['judgeNum']);
     $this->smarty->assign("ticked", count($_POST['judge']) + count($_POST['choice']));
     $this->smarty->assign("choiceOutput", $str);
     $this->smarty->assign("judgeOutput", $str2);
     $this->smarty->assign("resultNum", $resultNum);
     $this->smarty->assign("resultNum2", $resultNum2);
     $this->smarty->assign("score", number_format(($resultNum + $resultNum2) / ($_POST['choiceNum'] + $_POST['judgeNum']) * 100, 2));
     $this->smarty->assign("result", true);
 }
Esempio n. 3
0
 public function score()
 {
     $exam = new examinationModel();
     //Tools::dump($exam->getScore());
     $this->smarty->assign("score", $exam->getScore());
     $this->smarty->assign("showScore", true);
     $this->smarty->display("home/member.html");
 }
Esempio n. 4
0
 public function main()
 {
     if ($_SESSION['oneUserName']) {
         $this->smarty->assign("logged", true);
         $user = new userModel();
         $user->id = $_SESSION['oneUserName']->id;
         $oneUser = $user->getOneUserByID();
         $this->smarty->assign("oneUser", $oneUser);
     } else {
         $this->smarty->assign("logged", false);
     }
     switch ($_GET['action']) {
         case "vote":
             $this->castVote();
             break;
         case "logout":
             $this->logout();
             break;
     }
     $this->getUser();
     $this->showAD();
     $this->showVote();
     $this->showNav();
     $this->showArticle();
     $product = new productModel();
     $allProducts = $product->getHotProducts();
     $course = new courseModel();
     //$ask=new askModel();
     //$askLeaderboard=$ask->askLeaderboard();
     //$this->smarty->assign("askLeaderboard",$askLeaderboard);
     //Tools::dump($askLeaderboard);
     //$AllAsk=$ask->getAllAsks();
     $user = new userModel();
     $examination = new examinationModel();
     $userLeaderboard = $examination->getUserLeaderboard();
     //Tools::dump($userLeaderboard);
     $allCourse = $course->getFrontCourse();
     //$arr=[];
     // 		$arr=array();
     // 		foreach ($allCourse as $key=>$value){
     // 		    $examination->cid=$value->id;
     // 		    $hotExam=$examination->getExamByCID();
     // 		    foreach ($hotExam as $k=>$v){
     // 		        $user->id=$v->uid;
     // 		        $oneUser=$user->getOneUserByID();
     // 		        $v->uid=$oneUser->username;
     // 		    }
     // 		    $arr[$value->name]=$hotExam;
     // 		}
     foreach ($userLeaderboard as $key => $value) {
         $user->id = $value->uid;
         $course->id = $value->cid;
         $value->cid = $course->getOneCourse()->name;
         $oneUser = $user->getOneUserByID();
         $value->uid = $oneUser->username;
     }
     //Tools::dump($userLeaderboard);
     $this->smarty->assign("newExam", $userLeaderboard);
     $this->smarty->assign("userLeaderboard", $userLeaderboard);
     //Tools::dump($AllAsk);
     /* foreach ($AllAsk as $key=>$value){
     		    $user->id=$value->aid;
     		    $oneUser=$user->getOneUserByID();
     		    $course->id=$value->cid;
     		    $oneCourse=$course->getOneCourse();
     		    $value->courseName=$oneCourse->name;
     		    $ask->id=$value->id;
     		    $value->answerNum=$ask->getAllAnswersTotal();
     		    $value->username=$oneUser->username;
     		} */
     $download = new downloadModel();
     //Tools::dump($download->getDownloadNum());
     //Tools::dump($download->getDownloadNum());
     //$this->smarty->assign("downloadLeaderboard",$download->getDownloadNum());
     $this->smarty->assign("downloadLeaderboard", $download->getLatestDownload());
     //Tools::dump($AllAsk);
     /* $this->smarty->assign("AllAsk",$AllAsk); */
     $this->smarty->assign("AllAsk", false);
     $this->smarty->assign("allProducts", $allProducts);
     $product = new productModel();
     $this->smarty->assign("productRecommend", $product->getAttrArticle("recommend"));
     $this->smarty->display("home/home.html");
 }