public function course($num = 0) { $str = null; $course = new courseModel(); foreach ($course->getAllCourse() as $key => $value) { if ($num == $value->id) { $selected = "selected='selected'"; } else { $selected = ''; } $str .= "<option value='" . $value->id . "' " . $selected . ">" . $value->name . "</option>"; } $this->smarty->assign("course", $str); }
private function show() { $course = new courseModel(); $AllCourse = $course->getAllCourse(); $courseStr = null; foreach ($AllCourse as $value) { $courseStr .= $value->id . ","; } $courseStr = rtrim($courseStr, ","); //echo $levelStr; if (empty($_GET['kind'])) { $this->model->kind = $courseStr; } else { $this->model->kind = $_GET['kind']; } parent::page($this->model->getAllAskTotal()); $AllAsk = $this->model->getAllAsk(); foreach ($AllAsk as $key => $value) { $course->id = $value->cid; $oneCourse = $course->getOneCourse(); $value->courseName = $oneCourse->name; $this->model->id = $value->id; $value->answerNum = $this->model->getAllAnswersTotal(); } $this->course($_GET['kind']); //Tools::dump($AllAsk); $this->smarty->assign("AllAsk", $AllAsk); $this->smarty->assign("show", true); }
private function showCourse() { $course = new courseModel(); $page = new Page($course->getAllCourseTotal(), 5); $course->limit = $page->limit; $allCourse = $course->getAllCourse(); foreach ($allCourse as $key => $value) { switch ($value->state) { case 0: $value->state = "<span style='color:red;'>[否]</span>\r\n\t\t\t\t\t\t\t<a href='?a=learning&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=learning&action=state&flag=hide&id=" . $value->id . "'>隐藏</a>\t"; } } $this->course(); //Tools::dump($allCourse); $this->smarty->assign("num", $page->listRowsBegin()); $this->smarty->assign("page", $page->display()); $this->smarty->assign("data", $allCourse); $this->smarty->assign("showCourse", true); }