STopicSpecial.php 666 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @author: CeeFee
  4. * @description: 考试
  5. */
  6. class STopicSpecial extends MyActiveRecord
  7. {
  8. public static function model($className = __CLASS__)
  9. {
  10. return parent::model($className);
  11. }
  12. public function tableName()
  13. {
  14. return 'topic_special';
  15. }
  16. public function getTopicSpecials($topicIds)
  17. {
  18. $criteria = new CDbCriteria();
  19. $criteria->addInCondition('topic_id', $topicIds);
  20. $criteria->order = 'topic_id ASC, special_id ASC';
  21. $result = array();
  22. $query = getAttributes($this->findAll($criteria));
  23. if ($query)
  24. {
  25. foreach ($query AS $k => $v)
  26. {
  27. $result[$v['topic_id']][] = $v;
  28. }
  29. }
  30. return $result;
  31. }
  32. }