STopicItemOption.php 666 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @author: CeeFee
  4. * @description: 考试
  5. */
  6. class STopicItemOption 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_item_option';
  15. }
  16. public function getTopicItemOptions($topicIds)
  17. {
  18. $criteria = new CDbCriteria();
  19. $criteria->addInCondition('topic_id', $topicIds);
  20. $criteria->order = 'topic_id ASC, sort_order 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. }