1<?php 2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */ 3 4/** 5 * Factory for test player 6 * 7 * @author Björn Heyser <bheyser@databay.de> 8 * @version $Id$ 9 * 10 * @package Modules/Test 11 */ 12class ilTestPlayerFactory 13{ 14 /** 15 * object instance of current test 16 * 17 * @var ilObjTest 18 */ 19 private $testOBJ = null; 20 21 /** 22 * constructor 23 * 24 * @param ilObjTest $testOBJ 25 */ 26 public function __construct(ilObjTest $testOBJ) 27 { 28 $this->testOBJ = $testOBJ; 29 } 30 31 /** 32 * creates and returns an instance of a player gui 33 * that corresponds to the current test mode 34 * 35 * @return ilTestPlayerAbstractGUI 36 */ 37 public function getPlayerGUI() 38 { 39 switch ($this->testOBJ->getQuestionSetType()) { 40 case ilObjTest::QUESTION_SET_TYPE_FIXED: 41 42 require_once 'Modules/Test/classes/class.ilTestPlayerFixedQuestionSetGUI.php'; 43 return new ilTestPlayerFixedQuestionSetGUI($this->testOBJ); 44 45 case ilObjTest::QUESTION_SET_TYPE_RANDOM: 46 47 require_once 'Modules/Test/classes/class.ilTestPlayerRandomQuestionSetGUI.php'; 48 return new ilTestPlayerRandomQuestionSetGUI($this->testOBJ); 49 50 case ilObjTest::QUESTION_SET_TYPE_DYNAMIC: 51 52 require_once 'Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php'; 53 return new ilTestPlayerDynamicQuestionSetGUI($this->testOBJ); 54 } 55 } 56} 57