public function actionTest() { echo $this->convertVersion('2.0.0'); for ($i = 1; $i < 23; $i++) { echo HT_Lesson::model()->comLessonTime($i); } }
public function getLessons($departmentId) { $date = date("Y-m-d"); $endDate = date("Y-m-d", strtotime("+1 day")); $table_name = 'ht_lesson_student'; $data['lessons'] = array(); try { $con_hutong = Yii::app()->db_hutong; $result = $con_hutong->createCommand()->select('course_id,student_id,teacher_id,date,time,lesson_serial,lesson_arrange_id')->from($table_name)->where('date>=:BeginDate and date<=:EndDate and department_id=:DepartmentId and step>=0', array(':BeginDate' => $date, ':EndDate' => $endDate, ':DepartmentId' => $departmentId))->query(); foreach ($result as $row) { // 获取数据 $lesson = array(); $lesson['courseId'] = $row['course_id']; $lesson['courseName'] = HT_Lesson::model()->getCourseName($lesson['courseId']); $lessonCnt = HT_Lesson::model()->getLessonCnt($row['lesson_arrange_id']); $lesson['lessonSerial'] = $row['lesson_serial'] . '/' . $lessonCnt; $lesson['lessonTime'] = $row['time']; $lesson['teacherId'] = $row['teacher_id']; $lesson['studentId'] = $row['student_id']; // $lessonInfo['teacherName'] = HT_Member::model()->getNameByMemberId($lesson['teacherId']); if ($row['lesson_serial'] == 1) { $lesson['lastTime'] = ' '; $lesson['lessonContent'] = ' '; } else { $lessonData = HT_Lesson::model()->getLastLessonData($row['lesson_arrange_id'], $row['student_id'], $row['teacher_id'], $departmentId); $lesson['lastTime'] = $lessonData['lastTime']; $lesson['lessonContent'] = $lessonData['lastLessonContent']; } array_push($data['lessons'], $lesson); } } catch (Exception $e) { error_log($e); } return $data; }