private function detail() { $nav = new navModel(); $article = new articleModel(); $product = new productModel(); if (isset($_GET['id']) && !empty($_GET['id'])) { //Tools::dump($_GET); $article->id = $_GET['id']; $article->updateArticle(); $oneArticle = $article->getOneArticle(); $product->cid = $oneArticle->cid; //Tools::dump($product->cid); //Tools::dump($product->getAllProductsByCID()); $this->smarty->assign("oneArticle", $oneArticle); $nav->id = $oneArticle->nid; $subNav = $nav->getOneNav(); $this->smarty->assign("subNav", $subNav); $nav->id = $subNav->pid; $mainNav = $nav->getOneNav(); $this->smarty->assign("mainNav", $mainNav); $this->smarty->assign("recommend", $product->getAllProductsByCID()); //Tools::dump($mainNav); } else { Tools::Redirect("", "home.php"); } }
private function show() { $this->showNav(); $article = new articleModel(); $nav = new navModel(); if ($_GET['id'] && !empty($_GET['id'])) { $nav->id = $_GET['id']; $oneNav = $nav->getOneNav(); $this->smarty->assign("oneNav", $oneNav); $allSubNav = $nav->getAllSubNavById(); //Tools::dump($oneNav); $arr = array(); foreach ($allSubNav as $value) { //Tools::dump($value); $article->nid = $value->id; //echo $article->nid."<br>"; //$arr[$value->name][]=$article->getSubNavArticle(); $arr[$value->name][] = $article->getArticleByNID(); } //Tools::dump($arr); $this->smarty->assign("articles", $arr); $this->smarty->assign("allSubNav", $allSubNav); } else { header("Location:index.php"); } }
function showArticleById($idArticle) { $articleModel = new articleModel(); $article = $articleModel->getArticle($idArticle); $commentModel = new commentModel(); $comment = $commentModel->getComments($idArticle); include 'view/viewArticle.php'; }
private function adminShow() { parent::page($this->model->getAdminAllCommentTotal(), 5); $article = new articleModel(); $user = new userModel(); //Tools::dump($this->model->getAdminAllComment()); $data = $this->model->getAdminAllComment(); foreach ($data as $value) { $article->id = $value->aid; $oneArticle = $article->getOneArticle(); //Tools::dump($oneArticle); $value->title = $oneArticle->title; switch ($value->state) { case 0: $value->state = "<span style='color:red;'>[否]</span>\r\n\t\t\t\t\t\t\t<a href='?a=comment&action=state&flag=show&id=" . $value->id . "'>通过</a>"; break; case 1: $value->state = "<span style='color:green;'>[是]</span>\r\n\t\t\t\t\t\t\t<a href='?a=comment&action=state&flag=hide&id=" . $value->id . "'>否决</a>\t"; } $user->id = $value->uid; $oneUser = $user->getOneUserByID(); $value->username = $oneUser->username; } $this->smarty->assign("data", $data); $this->smarty->assign("show", true); }
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; }
private function show() { $this->showNav(); //Tools::dump($_GET); $article = new articleModel(); $nav = new navModel(); if ($_GET['name'] && !empty($_GET['name'])) { $nav->name = $_GET['name']; $oneNav = $nav->getNavByName(); $this->smarty->assign("oneNav", $oneNav[0]); $article->nid = $oneNav[0]->id; $page = new Page($article->getArticleByNIDTotal(), 10); $article->limit = $page->limit; $articles = $article->getArticleByNID(); //Tools::dump($articles); $this->smarty->assign("page", $page->display()); $this->smarty->assign("articles", $articles); $this->smarty->assign("father", $_GET['father']); $this->smarty->assign("fid", $_GET['fid']); } else { header("Location:index.php"); } }
private function show() { $user = new userModel(); $upload = new UploadFile("pic", "public/uploads/member"); if (isset($_POST['send'])) { $user->id = $_POST['id']; $user->email = $_POST['email']; if ($_POST['pwd'] == $_POST['newpwd']) { $user->pwd = $_POST['newpwd']; } else { $user->pwd = md5($_POST['newpwd']); } if (is_uploaded_file($_FILES['pic']['tmp_name'])) { if ($upload->upload("pic")) { $user->icon = $upload->getNewName(); } } else { $user->icon = $_POST['newpic']; //echo "没有上传".$_POST['newpic']; } //Tools::dump($_POST); if ($user->updateUser()) { //echo "ok"; Tools::Redirect("会员资料修改成功", $_SERVER['HTTP_REFERER']); } else { if ($user->updateUser() == 0) { Tools::Redirect("会员资料没有修改", $_SERVER['HTTP_REFERER']); //echo "not changed"; } else { Tools::Redirect("会员资料修改失败", $_SERVER['HTTP_REFERER'], 2); } } } $comment = new commentModel(); $article = new articleModel(); $product = new productModel(); $ask = new askModel(); $quiz = new quizModel(); if ($_GET['id']) { $user->id = $_GET['id']; $oneUser = $user->getOneUserByID(); $this->smarty->assign("oneUser", $oneUser); ///////////////////////////////// $comment->uid = $_GET['id']; $allComments = $comment->getAllCommentsByUID(); foreach ($allComments as $key => $value) { $article->id = $value->aid; $oneArticle = $article->getOneArticle(); $value->title = $oneArticle->title; } $product->uid = $_GET['id']; $allOrders = $product->getAllOrdersByUID(); foreach ($allOrders as $value) { $pids = explode(",", $value->pid); $str = null; foreach ($pids as $v) { $product->id = $v; //Tools::dump($v); $oneProduct = $product->getOneProduct(); //Tools::dump($oneProduct); $str .= $oneProduct->name . ","; } $str = rtrim($str, ","); //Tools::dump($str); $value->pid = $str; switch ($value->payed) { case 0: $value->payed = "<span style='color:red;'>[未付]</span>"; break; case 1: $value->payed = "<span style='color:green;'>[已付]</span>"; } switch ($value->sent) { case 0: $value->sent = "<span style='color:red;'>[未发货]</span>"; break; case 1: $value->sent = "<span style='color:green;'>[已发货]</span>"; } } $ask->aid = $_GET['id']; $allAsks = $ask->getAllAskByAID(); $this->smarty->assign("allAsks", $allAsks); $this->smarty->assign("allOrders", $allOrders); $this->smarty->assign("allComments", $allComments); $quiz->uid = $_GET["id"]; $allScores = $quiz->getAllScoresByUID(); $course = new courseModel(); foreach ($allScores as $key => $value) { $course->id = $value->cid; $oneCourse = $course->getOneCourse(); $value->cid = $oneCourse->name; } $this->smarty->assign("allScores", $allScores); } $this->smarty->assign("show", true); }
private function showArticle() { $article = new articleModel(); $this->smarty->assign("headline", $article->getAttrArticle("headline")); $this->smarty->assign("focus", $article->getAttrArticle("focus")); $this->smarty->assign("topic", $article->getAttrArticle("topic")); //Tools::dump($article->getAttrArticle("pickup")); $this->smarty->assign("recommend", $article->getAttrArticle("recommend")); $this->smarty->assign("pickup", $article->getAttrArticle("pickup")); }