Annotation of db/prgsrc/drupal/modules/chgk_db/classes/DbQuestionFactory.class.php, revision 1.1
1.1 ! roma7 1: <?php
! 2: require_once(dirname(__FILE__)."/DbQuestion.class.php");
! 3: require_once(dirname(__FILE__)."/DbFactory.class.php");
! 4:
! 5: class DbQuestionFactory extends DbFactory {
! 6: protected $prefix = 'DbQuestion';
! 7: private $field;
! 8: private $value;
! 9: private $map = array(
! 10: 'Я' => 'Jeopardy'
! 11: );
! 12:
! 13: public function getQuestion($row) {
! 14: $this->row = $row;
! 15: if ($this->classExists()) {
! 16: $ref = new ReflectionClass($this->getClassName());
! 17: $result = $ref->newInstance($row);
! 18: } else {
! 19: $result = new DbQuestion($row);
! 20: }
! 21: return $result;
! 22: }
! 23:
! 24: protected function getClassName() {
! 25:
! 26: if (!(isset($this->map[$this->row->Type]))) return 'DbQuestion';
! 27:
! 28: return 'DbQuestion'.$this->map[$this->row->Type];
! 29: }
! 30: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>