ClassExamPrinter.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * 打印管理模型类
  4. * @author jiangfei
  5. * @date 2015-10-20 15:30:00
  6. * @company 上海风车教育有限公司.
  7. */
  8. // class Exam extends CActiveRecord{
  9. class ClassExamPrinter extends MyActiveRecord{
  10. public static function model($className = __CLASS__){
  11. return parent::model($className);
  12. }
  13. public function tableName(){
  14. return 'class_exam_printer';
  15. }
  16. // 打印任务列表
  17. public function getPrintList(){
  18. $data = array();
  19. $criteria = new CDbCriteria();
  20. $criteria->addCondition('is_print=0');
  21. $criteria->limit = 20;
  22. $criteria->order = 'add_time desc';
  23. return $this->findAll($criteria);
  24. /* $total = $this->count($criteria);
  25. $pager = new CPagination($total);
  26. $criteria->order = 'print_time desc';
  27. $pager->pageSize = 20;
  28. $pager->applyLimit($criteria);
  29. $data['result']=$this->findAll($criteria);
  30. $data['page']=$pager;
  31. $data['page_total']= $total;
  32. return $data; */
  33. }
  34. // 打印任务列表
  35. public function getResultList($classIds = array())
  36. {
  37. $data = array();
  38. $criteria = new CDbCriteria();
  39. //$criteria->addCondition('is_print=0');
  40. if ($classIds AND is_array($classIds))
  41. {
  42. $criteria->addInCondition('class_id', $classIds);
  43. }
  44. $total = $this->count($criteria);
  45. $pager = new CPagination($total);
  46. $criteria->order = 'add_time desc, class_id ASC';
  47. $pager->pageSize = 20;
  48. $pager->applyLimit($criteria);
  49. $data['result']=$this->findAll($criteria);
  50. $data['page']=$pager;
  51. $data['page_total']= $total;
  52. return $data;
  53. }
  54. }