function CreateCourse($year, $semester, $department, $courseName, $professor, $minrating, $maxrating)
 {
     $courseModel = new CourseModel();
     $courseArray = $courseModel->getCourse($year, $semester, $department, $courseName, $professor, $minrating, $maxrating);
     $result = "<table class = 'courseTable table'><tr>\r\n                            <th width = '75px' >Year: </th>\r\n                            <th>Semester: </th>\r\n                            <th>Department: </th>\r\n                            <th>Course Name: </th>\r\n                            <th>Professor: </th>\r\n                            <th>Rating: </th>\r\n                        </tr>";
     foreach ($courseArray as $key => $course) {
         $result = $result . "\r\n                        \r\n                        <tr>\r\n                            <td>{$course->year}</td>\r\n                            <td>{$course->semester}</td>\r\n                            <td>{$course->department}</td>\r\n                            <td>{$course->courseName}</td>\r\n                            <td>{$course->professor}</td>\r\n                            <td>{$course->rating}</td>\r\n                        </tr>\r\n\t\t\t\t\t\t<tr><td></td>\r\n\t\t\t\t\t\t\t<th>Summary: </th>\r\n                            <td colspan='3'>{$course->summary}</td>\r\n\t\t\t\t\t\t</tr>";
     }
     $result .= "</table>";
     return $result;
 }
Пример #2
0
 /**
  * 试卷列表
  */
 function listAction()
 {
     $pagesize = 15;
     $courseId = (int) $this->get('course_id', 0);
     $paperId = (int) $this->get('paper_id', 0);
     $type = (int) $this->get('type', 0);
     $courseModel = new CourseModel();
     $course = $courseModel->getCourse($courseId);
     if (!$course) {
         $this->redirect("/error/?errno=" . Common_Error::ERROR_COURSE_NOT_EXISTS);
     }
     $schoolModel = new SchoolModel();
     $school = $schoolModel->getSchool($course['school_id']);
     if (!$school) {
         $this->redirect("/error/?errno=" . Common_Error::ERROR_SCHOOL_NOT_EXISTS);
     }
     $paperModel = new PaperModel();
     //$list = $paperModel -> getList($courseId, $paperId, $type, $pagesize);
     $list = $paperModel->getAll($courseId);
     if (!$list) {
         $this->redirect("/error/?errno=" . Common_Error::ERROR_COURSE_NOT_EXISTS);
     }
     $courseModel = new CourseModel();
     $practiseList = $courseModel->getCoursePractiseList($courseId);
     $uSecList = $courseModel->getUserCourseSection($this->uid, $courseId);
     $uSectionIds = $uSecList ? array_keys($uSecList) : array();
     foreach ($list as $k => $section) {
         $list[$k] = array('id' => $section['id'], "name" => $section['name']);
         $list[$k]['last'] = isset($uSectionIds[0]) && $section['id'] == $uSectionIds[0] ? 1 : 0;
         $list[$k]['practise_video_list'] = isset($practiseList[$section['id']]) ? $practiseList[$section['id']] : array();
         if (empty($list[$k]['practise_video_list'])) {
             $list[$k]['practise_video_list_for_android'] = array();
             continue;
         }
         foreach ($list[$k]['practise_video_list'] as $seq => $videoId) {
             $list[$k]['practise_video_list_for_android'][] = array("practise_seq" => $seq, "practise_video_id" => $videoId);
         }
     }
     if ($this->isMobile) {
         $this->displayJson(Common_Error::ERROR_SUCCESS, $list);
     }
     $course['practise_num'] = $courseModel->getCoursePractiseNum($courseId);
     $course['user_practise_num'] = $courseModel->getUserCoursePractiseNum($this->uid, $courseId);
     $course['duration_minute'] = round($paperModel->getPaperDuration($courseId) / 60, 0);
     $course['user_spend_minute'] = round($paperModel->getUserPaperDuration($this->uid, $courseId) / 60, 0);
     $course['teachers'] = $courseModel->getCourseTeachers($courseId);
     $this->assign("school", $school);
     $this->assign("course", $course);
     $this->assign('paper_list', $list);
 }
Пример #3
0
 public function init()
 {
     parent::init();
     $this->sectionId = (int) $this->get("section_id", 0);
     $this->sectionId = !$this->sectionId ? (int) $this->post("section_id", 0) : $this->sectionId;
     if ($this->sectionId == 0) {
         $this->redirect("/error/?errno=" . Common_Error::ERROR_PARAM);
     }
     $courseModel = new CourseModel();
     $this->section = $courseModel->getSection($this->sectionId);
     $this->chapter = $courseModel->getSection($this->section['parent_id']);
     $this->course = $courseModel->getCourse($this->section['course_id']);
     $userModel = new UserModel();
     $this->teacher = $userModel->getTeacher($this->section['teacher_id']);
     //记录用户学习数据
     $courseModel->updateUserSection($this->uid, $this->section['id'], $this->course['id']);
     //课程学习人数
     $this->incrCourseViewNum();
 }
Пример #4
0
 /**
  * 课程介绍(app内嵌)
  */
 function profileAction()
 {
     $profile = array();
     $courseId = $this->get('course_id', 0);
     $courseModel = new CourseModel();
     $course = $courseModel->getCourse($courseId);
     if ($course) {
         $profile['id'] = $course['id'];
         $profile['name'] = $course['name'];
         $profile['info'] = $course['info'];
         $profile['teachers'] = $courseModel->getCourseTeachers($courseId);
     }
     if ($this->ajax || $this->platform == 'ios') {
         $this->displayJson(Common_Error::ERROR_SUCCESS, $profile);
     }
     $this->assign("profile", $profile);
 }