-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from oat-sa/feature/association-response-const…
…raints New AssociationValidityConstraint class.
- Loading branch information
Showing
25 changed files
with
1,250 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2013-2014 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* Copyright (c) 2013-2016 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* | ||
* @author Jérôme Bogaerts <[email protected]> | ||
* @license GPLv2 | ||
|
@@ -23,7 +23,8 @@ | |
namespace qtism\data\content\interactions; | ||
|
||
use qtism\data\QtiComponentCollection; | ||
|
||
use qtism\data\state\ResponseValidityConstraint; | ||
use qtism\data\state\AssociationValidityConstraint; | ||
use qtism\data\content\BlockStaticCollection; | ||
use \InvalidArgumentException; | ||
|
||
|
@@ -180,6 +181,30 @@ public function getContent() | |
{ | ||
return $this->content; | ||
} | ||
|
||
/** | ||
* @see qtism\data\content\interactions\Interaction::getResponseValidityConstraint() | ||
*/ | ||
public function getResponseValidityConstraint() | ||
{ | ||
$responseValidityConstraint = new ResponseValidityConstraint( | ||
$this->getResponseIdentifier(), | ||
0, | ||
0 | ||
); | ||
|
||
foreach ($this->getComponentsByClassName(array('gapImg', 'gapText')) as $gapChoice) { | ||
$responseValidityConstraint->addAssociationValidityConstraint( | ||
new AssociationValidityConstraint( | ||
$gapChoice->getIdentifier(), | ||
$gapChoice->getMatchMin(), | ||
$gapChoice->getMatchMax() | ||
) | ||
); | ||
} | ||
|
||
return $responseValidityConstraint; | ||
} | ||
|
||
/** | ||
* @see \qtism\data\content\interactions\BlockInteraction::getComponents() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2013-2014 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* Copyright (c) 2013-2016 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* | ||
* @author Jérôme Bogaerts <[email protected]> | ||
* @license GPLv2 | ||
|
@@ -23,6 +23,8 @@ | |
namespace qtism\data\content\interactions; | ||
|
||
use qtism\data\QtiComponentCollection; | ||
use qtism\data\state\ResponseValidityConstraint; | ||
use qtism\data\state\AssociationValidityConstraint; | ||
use \InvalidArgumentException; | ||
|
||
/** | ||
|
@@ -145,6 +147,30 @@ public function getAssociableHotspots() | |
{ | ||
return $this->associableHotspots; | ||
} | ||
|
||
/** | ||
* @see qtism\data\content\interactions\Interaction::getResponseValidityConstraint() | ||
*/ | ||
public function getResponseValidityConstraint() | ||
{ | ||
$responseValidityConstraint = new ResponseValidityConstraint( | ||
$this->getResponseIdentifier(), | ||
0, | ||
0 | ||
); | ||
|
||
foreach ($this->getComponentsByClassName(array('gapImg', 'gapText')) as $gapChoice) { | ||
$responseValidityConstraint->addAssociationValidityConstraint( | ||
new AssociationValidityConstraint( | ||
$gapChoice->getIdentifier(), | ||
$gapChoice->getMatchMin(), | ||
$gapChoice->getMatchMax() | ||
) | ||
); | ||
} | ||
|
||
return $responseValidityConstraint; | ||
} | ||
|
||
/** | ||
* @see \qtism\data\content\interactions\BlockInteraction::getComponents() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.