private function detail() { $product = new productModel(); $this->smarty->assign("productRecommend", $product->getAttrArticle("recommend")); $this->showNav(); $product = new productModel(); if (isset($_GET['id'])) { $product->id = $_GET["id"]; $oneProduct = $product->getOneProduct(); $this->smarty->assign("oneProduct", $oneProduct); } $this->smarty->assign("detail", true); }
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"); }