/** * Short description of method __construct * * @access public * @author Joel Bout, <*****@*****.**> * @param array responseRules * @param string xml * @return mixed */ public function __construct($responseRules, $xml) { $this->responseRules = $responseRules; parent::__construct(); $this->setData($xml, false); }
/** * Short description of method __construct * * @access public * @author Joel Bout, <*****@*****.**> * @param Item item * @param string outcomeIdentifier * @return mixed */ public function __construct(Item $item, $outcomeIdentifier = 'SCORE') { parent::__construct(); $this->outcomeIdentifier = $outcomeIdentifier; $outcomeExists = false; foreach ($item->getOutcomes() as $outcome) { if ($outcome->getIdentifier() == $outcomeIdentifier) { $outcomeExists = true; break; } } if (!$outcomeExists) { $outcomes = $item->getOutcomes(); $outcomes[] = new OutcomeDeclaration(array('identifier' => $outcomeIdentifier, 'baseType' => 'float', 'cardinality' => 'single')); $item->setOutcomes($outcomes); } }
/** * Short description of method __construct * * @access public * @author Cedric Alfonsi, <*****@*****.**> * @param string uri * @return mixed */ public function __construct($uri) { //automatically transform to qti 2.1 templates: switch ($uri) { case self::MATCH_CORRECT_qtiv2p0: case self::MATCH_CORRECT_qtiv2p2: $uri = self::MATCH_CORRECT; break; case self::MAP_RESPONSE_qtiv2p0: case self::MAP_RESPONSE_qtiv2p2: $uri = self::MAP_RESPONSE; break; case self::MAP_RESPONSE_POINT_qtiv2p0: case self::MAP_RESPONSE_POINT_qtiv2p2: $uri = self::MAP_RESPONSE_POINT; break; } if ($uri != self::MATCH_CORRECT && $uri != self::MAP_RESPONSE && $uri != self::MAP_RESPONSE_POINT) { throw new common_Exception("Unknown response processing template '{$uri}'"); } $this->uri = $uri; $extDir = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getDir(); $this->file = $extDir . 'model/qti/data/qtiv2p1/rptemplates/' . basename($this->uri) . '.xml'; if (!file_exists($this->file)) { throw new Exception("Unable to load response processing template {$this->uri} in {$this->file}"); } parent::__construct(); }