StudentToClass.php 845 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * 学生与班级关系模型类
  4. * @author jiangfei
  5. * @date 2015-09-01 18:28:00
  6. * @company 上海风车教育有限公司.
  7. */
  8. class StudentToClass extends MyActiveRecord{
  9. public static function model($className = __CLASS__){
  10. return parent::model($className);
  11. }
  12. public function tableName(){
  13. return "student_class_relation";
  14. }
  15. // 获取班级学生学号
  16. public function getStudentNoByStudentId($classId){
  17. $result = array();
  18. if (!empty($classId) && is_numeric($classId)) {
  19. //$criteria = new CDbCriteria();
  20. $getInfo = $this->findAll('class_id=:clid',array(':clid'=>$classId));
  21. if (!empty($getInfo)) {
  22. foreach ($getInfo as $val) {
  23. $result[$val->student_id] = $val->userno;
  24. }
  25. }
  26. }
  27. return $result;
  28. }
  29. }