repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
oat-sa/extension-tao-itemqti | model/qti/IdentifiedElement.php | IdentifiedElement.getIdentifier | public function getIdentifier($generate = true){
if(empty($this->identifier) && $generate){
//try generating an identifier
$relatedItem = $this->getRelatedItem();
if(!is_null($relatedItem)){
$this->identifier = $this->generateIdentifier();
}
... | php | public function getIdentifier($generate = true){
if(empty($this->identifier) && $generate){
//try generating an identifier
$relatedItem = $this->getRelatedItem();
if(!is_null($relatedItem)){
$this->identifier = $this->generateIdentifier();
}
... | [
"public",
"function",
"getIdentifier",
"(",
"$",
"generate",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"identifier",
")",
"&&",
"$",
"generate",
")",
"{",
"//try generating an identifier",
"$",
"relatedItem",
"=",
"$",
"this",
"->"... | get the identifier
@access public
@author Sam, <sam@taotesting.com>
@return string | [
"get",
"the",
"identifier"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/IdentifiedElement.php#L77-L86 |
oat-sa/extension-tao-itemqti | model/qti/IdentifiedElement.php | IdentifiedElement.setIdentifier | public function setIdentifier($identifier, $collisionFree = false){
$returnValue = false;
if(empty($identifier) || is_null($identifier)){
common_Logger::w('ss');
throw new \InvalidArgumentException("Id must not be empty");
}
if($this->isIdentifierAvailable($iden... | php | public function setIdentifier($identifier, $collisionFree = false){
$returnValue = false;
if(empty($identifier) || is_null($identifier)){
common_Logger::w('ss');
throw new \InvalidArgumentException("Id must not be empty");
}
if($this->isIdentifierAvailable($iden... | [
"public",
"function",
"setIdentifier",
"(",
"$",
"identifier",
",",
"$",
"collisionFree",
"=",
"false",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"identifier",
")",
"||",
"is_null",
"(",
"$",
"identifier",
")",
")",
... | Set a unique identifier.
If the identifier is already given to another qti element in the same item an InvalidArgumentException is thrown.
The option collisionFree allows to ensure that a new identifier is generated if a collision happens
@access public
@author Sam, <sam@taotesting.com>
@param string id
@return boole... | [
"Set",
"a",
"unique",
"identifier",
".",
"If",
"the",
"identifier",
"is",
"already",
"given",
"to",
"another",
"qti",
"element",
"in",
"the",
"same",
"item",
"an",
"InvalidArgumentException",
"is",
"thrown",
".",
"The",
"option",
"collisionFree",
"allows",
"to... | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/IdentifiedElement.php#L119-L148 |
oat-sa/extension-tao-itemqti | model/qti/IdentifiedElement.php | IdentifiedElement.validateCurrentIdentifier | public function validateCurrentIdentifier($collisionFree = false){
$returnValue = false;
if(empty($this->identifier)){
//empty identifier, nothing to check
$returnValue = true;
}else{
$returnValue = $this->setIdentifier($this->identifier, $collisionFree);
... | php | public function validateCurrentIdentifier($collisionFree = false){
$returnValue = false;
if(empty($this->identifier)){
//empty identifier, nothing to check
$returnValue = true;
}else{
$returnValue = $this->setIdentifier($this->identifier, $collisionFree);
... | [
"public",
"function",
"validateCurrentIdentifier",
"(",
"$",
"collisionFree",
"=",
"false",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"identifier",
")",
")",
"{",
"//empty identifier, nothing to check",
"$",
"... | Validate if the current identifier of the qti element does not collide with another one's
CollisionFree option allows to ensure that no collision subsides after the fonction call.
It indeed ensures that that the identifier becomes unique if it collides with another one's.
@param boolean $collisionFree
@return boolean | [
"Validate",
"if",
"the",
"current",
"identifier",
"of",
"the",
"qti",
"element",
"does",
"not",
"collide",
"with",
"another",
"one",
"s",
"CollisionFree",
"option",
"allows",
"to",
"ensure",
"that",
"no",
"collision",
"subsides",
"after",
"the",
"fonction",
"c... | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/IdentifiedElement.php#L158-L170 |
oat-sa/extension-tao-itemqti | model/qti/IdentifiedElement.php | IdentifiedElement.isIdentifierAvailable | public function isIdentifierAvailable($newIdentifier){
$returnValue = false;
if(empty($newIdentifier) || is_null($newIdentifier)){
throw new InvalidArgumentException("newIdentifier must be set");
}
if(!empty($this->identifier) && $newIdentifier == $this->identifier){
... | php | public function isIdentifierAvailable($newIdentifier){
$returnValue = false;
if(empty($newIdentifier) || is_null($newIdentifier)){
throw new InvalidArgumentException("newIdentifier must be set");
}
if(!empty($this->identifier) && $newIdentifier == $this->identifier){
... | [
"public",
"function",
"isIdentifierAvailable",
"(",
"$",
"newIdentifier",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"newIdentifier",
")",
"||",
"is_null",
"(",
"$",
"newIdentifier",
")",
")",
"{",
"throw",
"new",
"Inval... | Check if the given new identifier is valid in the current state of the qti element
@param string $newIdentifier
@return boolean
@throws InvalidArgumentException | [
"Check",
"if",
"the",
"given",
"new",
"identifier",
"is",
"valid",
"in",
"the",
"current",
"state",
"of",
"the",
"qti",
"element"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/IdentifiedElement.php#L179-L200 |
oat-sa/extension-tao-itemqti | model/qti/IdentifiedElement.php | IdentifiedElement.generateIdentifier | protected function generateIdentifier($prefix = ''){
$relatedItem = $this->getRelatedItem();
if(is_null($relatedItem)){
throw new QtiModelException('cannot generate the identifier because the element does not belong to any item');
}
$identifiedElementsCollection = $relatedIt... | php | protected function generateIdentifier($prefix = ''){
$relatedItem = $this->getRelatedItem();
if(is_null($relatedItem)){
throw new QtiModelException('cannot generate the identifier because the element does not belong to any item');
}
$identifiedElementsCollection = $relatedIt... | [
"protected",
"function",
"generateIdentifier",
"(",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"relatedItem",
"=",
"$",
"this",
"->",
"getRelatedItem",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"relatedItem",
")",
")",
"{",
"throw",
"new",
"QtiModelEx... | Create a unique identifier, based on the class if the qti element.
@access protected
@author Sam, <sam@taotesting.com>
@param string $prefix
@return mixed
@throws QtiModelException | [
"Create",
"a",
"unique",
"identifier",
"based",
"on",
"the",
"class",
"if",
"the",
"qti",
"element",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/IdentifiedElement.php#L213-L249 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.extract | public function extract(){
foreach($this->item->getComposingElements() as $element){
$this->extractImg($element);
$this->extractObject($element);
$this->extractStyleSheet($element);
$this->extractCustomElement($element);
if($this->getGetXinclude()){
... | php | public function extract(){
foreach($this->item->getComposingElements() as $element){
$this->extractImg($element);
$this->extractObject($element);
$this->extractStyleSheet($element);
$this->extractCustomElement($element);
if($this->getGetXinclude()){
... | [
"public",
"function",
"extract",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"item",
"->",
"getComposingElements",
"(",
")",
"as",
"$",
"element",
")",
"{",
"$",
"this",
"->",
"extractImg",
"(",
"$",
"element",
")",
";",
"$",
"this",
"->",
"ext... | Extract all assets from the current item
@return array the assets by type | [
"Extract",
"all",
"assets",
"from",
"the",
"current",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L98-L109 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.extractImg | private function extractImg(Element $element){
if($element instanceof Container){
foreach($element->getElements('oat\taoQtiItem\model\qti\Img') as $img){
$this->addAsset('img', $img->attr('src'));
}
}
} | php | private function extractImg(Element $element){
if($element instanceof Container){
foreach($element->getElements('oat\taoQtiItem\model\qti\Img') as $img){
$this->addAsset('img', $img->attr('src'));
}
}
} | [
"private",
"function",
"extractImg",
"(",
"Element",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"instanceof",
"Container",
")",
"{",
"foreach",
"(",
"$",
"element",
"->",
"getElements",
"(",
"'oat\\taoQtiItem\\model\\qti\\Img'",
")",
"as",
"$",
"img"... | Lookup and extract assets from IMG elements
@param Element $element container of the target element | [
"Lookup",
"and",
"extract",
"assets",
"from",
"IMG",
"elements"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L115-L121 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.extractObject | private function extractObject(Element $element){
if($element instanceof Container){
foreach($element->getElements('oat\taoQtiItem\model\qti\QtiObject') as $object){
$this->loadObjectAssets($object);
}
}
if($element instanceof QtiObject){
$this... | php | private function extractObject(Element $element){
if($element instanceof Container){
foreach($element->getElements('oat\taoQtiItem\model\qti\QtiObject') as $object){
$this->loadObjectAssets($object);
}
}
if($element instanceof QtiObject){
$this... | [
"private",
"function",
"extractObject",
"(",
"Element",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"instanceof",
"Container",
")",
"{",
"foreach",
"(",
"$",
"element",
"->",
"getElements",
"(",
"'oat\\taoQtiItem\\model\\qti\\QtiObject'",
")",
"as",
"$"... | Lookup and extract assets from a QTI Object
@param Element $element the element itself or a container of the target element | [
"Lookup",
"and",
"extract",
"assets",
"from",
"a",
"QTI",
"Object"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L127-L136 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.extractXinclude | private function extractXinclude(Element $element){
if($element instanceof Container){
foreach($element->getElements('oat\taoQtiItem\model\qti\Xinclude') as $xinclude){
$this->addAsset('xinclude', $xinclude->attr('href'));
}
}
} | php | private function extractXinclude(Element $element){
if($element instanceof Container){
foreach($element->getElements('oat\taoQtiItem\model\qti\Xinclude') as $xinclude){
$this->addAsset('xinclude', $xinclude->attr('href'));
}
}
} | [
"private",
"function",
"extractXinclude",
"(",
"Element",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"instanceof",
"Container",
")",
"{",
"foreach",
"(",
"$",
"element",
"->",
"getElements",
"(",
"'oat\\taoQtiItem\\model\\qti\\Xinclude'",
")",
"as",
"$... | Lookup and extract assets from IMG elements
@param Element $element container of the target element | [
"Lookup",
"and",
"extract",
"assets",
"from",
"IMG",
"elements"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L142-L148 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.extractStyleSheet | private function extractStyleSheet(Element $element){
if($element instanceof StyleSheet){
$href = $element->attr('href');
$this->addAsset('css', $href);
$parsedUrl = parse_url($href);
if ($this->isDeepParsing() && array_key_exists('path', $parsedUrl) && !array_ke... | php | private function extractStyleSheet(Element $element){
if($element instanceof StyleSheet){
$href = $element->attr('href');
$this->addAsset('css', $href);
$parsedUrl = parse_url($href);
if ($this->isDeepParsing() && array_key_exists('path', $parsedUrl) && !array_ke... | [
"private",
"function",
"extractStyleSheet",
"(",
"Element",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"instanceof",
"StyleSheet",
")",
"{",
"$",
"href",
"=",
"$",
"element",
"->",
"attr",
"(",
"'href'",
")",
";",
"$",
"this",
"->",
"addAsset",... | Lookup and extract assets from a stylesheet element
@param Element $element the stylesheet element | [
"Lookup",
"and",
"extract",
"assets",
"from",
"a",
"stylesheet",
"element"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L154-L169 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.loadObjectAssets | private function loadObjectAssets(QtiObject $object){
$type = $object->attr('type');
if(strpos($type, "image") !== false){
$this->addAsset('img', $object->attr('data'));
} else if (strpos($type, "video") !== false || strpos($type, "ogg") !== false){
$this->addAsset('vi... | php | private function loadObjectAssets(QtiObject $object){
$type = $object->attr('type');
if(strpos($type, "image") !== false){
$this->addAsset('img', $object->attr('data'));
} else if (strpos($type, "video") !== false || strpos($type, "ogg") !== false){
$this->addAsset('vi... | [
"private",
"function",
"loadObjectAssets",
"(",
"QtiObject",
"$",
"object",
")",
"{",
"$",
"type",
"=",
"$",
"object",
"->",
"attr",
"(",
"'type'",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"type",
",",
"\"image\"",
")",
"!==",
"false",
")",
"{",
"$",... | Loads assets from an QTI object element
@param QtiObject $object the object | [
"Loads",
"assets",
"from",
"an",
"QTI",
"object",
"element"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L216-L230 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.addAsset | private function addAsset($type, $uri)
{
if(!array_key_exists($type, $this->assets)){
$this->assets[$type] = array();
}
if(!empty($uri) && !in_array($uri, $this->assets[$type])){
$this->assets[$type][] = $uri;
}
} | php | private function addAsset($type, $uri)
{
if(!array_key_exists($type, $this->assets)){
$this->assets[$type] = array();
}
if(!empty($uri) && !in_array($uri, $this->assets[$type])){
$this->assets[$type][] = $uri;
}
} | [
"private",
"function",
"addAsset",
"(",
"$",
"type",
",",
"$",
"uri",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"assets",
")",
")",
"{",
"$",
"this",
"->",
"assets",
"[",
"$",
"type",
"]",
"=",
"array... | Add the asset to the current list
@param string $type the asset type: img, css, js, audio, video, font, etc.
@param string $uri the asset URI | [
"Add",
"the",
"asset",
"to",
"the",
"current",
"list"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L237-L245 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.loadCustomElementPropertiesAssets | private function loadCustomElementPropertiesAssets($properties) {
if (is_array($properties)) {
if (isset($properties['uri'])) {
$this->addAsset('document', urldecode($properties['uri']));
} else {
foreach($properties as $property) {
if ... | php | private function loadCustomElementPropertiesAssets($properties) {
if (is_array($properties)) {
if (isset($properties['uri'])) {
$this->addAsset('document', urldecode($properties['uri']));
} else {
foreach($properties as $property) {
if ... | [
"private",
"function",
"loadCustomElementPropertiesAssets",
"(",
"$",
"properties",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"properties",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"properties",
"[",
"'uri'",
"]",
")",
")",
"{",
"$",
"this",
"->",
... | Search assets URI in custom element properties
The PCI standard will be extended in the future with typed property value (boolean, integer, float, string, uri, html etc.)
Meanwhile, we use the special property name uri for the special type "URI" that represents a file URI.
Portable element using this reserved property ... | [
"Search",
"assets",
"URI",
"in",
"custom",
"element",
"properties",
"The",
"PCI",
"standard",
"will",
"be",
"extended",
"in",
"the",
"future",
"with",
"typed",
"property",
"value",
"(",
"boolean",
"integer",
"float",
"string",
"uri",
"html",
"etc",
".",
")",... | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L255-L267 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.loadCustomElementAssets | private function loadCustomElementAssets(Element $element)
{
if($this->getGetCustomElementDefinition()) {
$this->assets[$element->getTypeIdentifier()] = $element;
}
$xmls = array();
if($element instanceof PortableCustomInteraction || $element instanceof PortableInfoContr... | php | private function loadCustomElementAssets(Element $element)
{
if($this->getGetCustomElementDefinition()) {
$this->assets[$element->getTypeIdentifier()] = $element;
}
$xmls = array();
if($element instanceof PortableCustomInteraction || $element instanceof PortableInfoContr... | [
"private",
"function",
"loadCustomElementAssets",
"(",
"Element",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getGetCustomElementDefinition",
"(",
")",
")",
"{",
"$",
"this",
"->",
"assets",
"[",
"$",
"element",
"->",
"getTypeIdentifier",
"(",
"... | Load assets from the custom elements (CustomInteraction, PCI, PIC)
@param Element $element the custom element | [
"Load",
"assets",
"from",
"the",
"custom",
"elements",
"(",
"CustomInteraction",
"PCI",
"PIC",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L273-L307 |
oat-sa/extension-tao-itemqti | model/qti/AssetParser.php | AssetParser.loadStyleSheetAsset | private function loadStyleSheetAsset($css){
$imageRe = "/url\\s*\\(['|\"]?([^)]*\.(png|jpg|jpeg|gif|svg))['|\"]?\\)/mi";
$importRe = "/@import\\s*(url\\s*\\()?['\"]?([^;]*)['\"]/mi";
$fontFaceRe = "/@font-face\\s*\\{(.*)?\\}/mi";
$fontRe = "/url\\s*\\(['|\"]?([^)'|\"]*)['|\"]?\\)/i";
... | php | private function loadStyleSheetAsset($css){
$imageRe = "/url\\s*\\(['|\"]?([^)]*\.(png|jpg|jpeg|gif|svg))['|\"]?\\)/mi";
$importRe = "/@import\\s*(url\\s*\\()?['\"]?([^;]*)['\"]/mi";
$fontFaceRe = "/@font-face\\s*\\{(.*)?\\}/mi";
$fontRe = "/url\\s*\\(['|\"]?([^)'|\"]*)['|\"]?\\)/i";
... | [
"private",
"function",
"loadStyleSheetAsset",
"(",
"$",
"css",
")",
"{",
"$",
"imageRe",
"=",
"\"/url\\\\s*\\\\(['|\\\"]?([^)]*\\.(png|jpg|jpeg|gif|svg))['|\\\"]?\\\\)/mi\"",
";",
"$",
"importRe",
"=",
"\"/@import\\\\s*(url\\\\s*\\\\()?['\\\"]?([^;]*)['\\\"]/mi\"",
";",
"$",
"f... | Parse, extract and load assets from the stylesheet content
@param string $css the stylesheet content | [
"Parse",
"extract",
"and",
"load",
"assets",
"from",
"the",
"stylesheet",
"content"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/AssetParser.php#L329-L364 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/classificationMetadata/ClassificationEntryMetadataValue.php | ClassificationEntryMetadataValue.getEntryPath | static public function getEntryPath()
{
return [
LomMetadata::LOM_NAMESPACE . '#lom',
LomMetadata::LOM_NAMESPACE . '#classification',
LomMetadata::LOM_NAMESPACE . '#taxonPath',
LomMetadata::LOM_NAMESPACE . '#taxon',
LomMetadata::LOM_NAMESPACE . '#e... | php | static public function getEntryPath()
{
return [
LomMetadata::LOM_NAMESPACE . '#lom',
LomMetadata::LOM_NAMESPACE . '#classification',
LomMetadata::LOM_NAMESPACE . '#taxonPath',
LomMetadata::LOM_NAMESPACE . '#taxon',
LomMetadata::LOM_NAMESPACE . '#e... | [
"static",
"public",
"function",
"getEntryPath",
"(",
")",
"{",
"return",
"[",
"LomMetadata",
"::",
"LOM_NAMESPACE",
".",
"'#lom'",
",",
"LomMetadata",
"::",
"LOM_NAMESPACE",
".",
"'#classification'",
",",
"LomMetadata",
"::",
"LOM_NAMESPACE",
".",
"'#taxonPath'",
... | Get default entry path into DomDocument
@return array | [
"Get",
"default",
"entry",
"path",
"into",
"DomDocument"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/classificationMetadata/ClassificationEntryMetadataValue.php#L59-L69 |
oat-sa/extension-tao-itemqti | model/qti/Service.php | Service.getDataItemByRdfItem | public function getDataItemByRdfItem(core_kernel_classes_Resource $item, $langCode = '', $resolveXInclude = false)
{
$returnValue = null;
try {
//Parse it and build the QTI_Data_Item
$file = $this->getXmlByRdfItem($item, $langCode);
$qtiParser = new Parser($file)... | php | public function getDataItemByRdfItem(core_kernel_classes_Resource $item, $langCode = '', $resolveXInclude = false)
{
$returnValue = null;
try {
//Parse it and build the QTI_Data_Item
$file = $this->getXmlByRdfItem($item, $langCode);
$qtiParser = new Parser($file)... | [
"public",
"function",
"getDataItemByRdfItem",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"$",
"langCode",
"=",
"''",
",",
"$",
"resolveXInclude",
"=",
"false",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"try",
"{",
"//Parse it and build the QTI_Da... | Load a QTI_Item from an, RDF Item using the itemContent property of the
Item as the QTI xml
@access public
@author Somsack Sipasseuth, <somsack.sipasseuth@tudor.lu>
@param Resource item
@throws \common_Exception If $item is not representing an item with a QTI item model.
@return Item An item as a business object. | [
"Load",
"a",
"QTI_Item",
"from",
"an",
"RDF",
"Item",
"using",
"the",
"itemContent",
"property",
"of",
"the",
"Item",
"as",
"the",
"QTI",
"xml"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Service.php#L62-L99 |
oat-sa/extension-tao-itemqti | model/qti/Service.php | Service.getXmlByRdfItem | public function getXmlByRdfItem(core_kernel_classes_Resource $item, $language = '')
{
$itemService = taoItems_models_classes_ItemsService::singleton();
//check if the item is QTI item
if (! $itemService->hasItemModel($item, array(ItemModel::MODEL_URI))) {
throw new common_Except... | php | public function getXmlByRdfItem(core_kernel_classes_Resource $item, $language = '')
{
$itemService = taoItems_models_classes_ItemsService::singleton();
//check if the item is QTI item
if (! $itemService->hasItemModel($item, array(ItemModel::MODEL_URI))) {
throw new common_Except... | [
"public",
"function",
"getXmlByRdfItem",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"$",
"language",
"=",
"''",
")",
"{",
"$",
"itemService",
"=",
"taoItems_models_classes_ItemsService",
"::",
"singleton",
"(",
")",
";",
"//check if the item is QTI item",
... | Load the XML of the QTI item
@param core_kernel_classes_Resource $item
@param string $language
@return false|string
@throws common_Exception | [
"Load",
"the",
"XML",
"of",
"the",
"QTI",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Service.php#L109-L120 |
oat-sa/extension-tao-itemqti | model/qti/Service.php | Service.saveDataItemToRdfItem | public function saveDataItemToRdfItem(Item $qtiItem, core_kernel_classes_Resource $rdfItem)
{
$label = mb_substr($rdfItem->getLabel(), 0, 256, 'UTF-8');
//set the current data lang in the item content to keep the integrity
if ($qtiItem->hasAttribute('xml:lang') && !empty($qtiItem->getAttribu... | php | public function saveDataItemToRdfItem(Item $qtiItem, core_kernel_classes_Resource $rdfItem)
{
$label = mb_substr($rdfItem->getLabel(), 0, 256, 'UTF-8');
//set the current data lang in the item content to keep the integrity
if ($qtiItem->hasAttribute('xml:lang') && !empty($qtiItem->getAttribu... | [
"public",
"function",
"saveDataItemToRdfItem",
"(",
"Item",
"$",
"qtiItem",
",",
"core_kernel_classes_Resource",
"$",
"rdfItem",
")",
"{",
"$",
"label",
"=",
"mb_substr",
"(",
"$",
"rdfItem",
"->",
"getLabel",
"(",
")",
",",
"0",
",",
"256",
",",
"'UTF-8'",
... | Save a QTI_Item into an RDF Item, by exporting the QTI_Item to QTI xml
and saving it in the itemContent property of the RDF Item
@param \oat\taoQtiItem\model\qti\Item $qtiItem
@param core_kernel_classes_Resource $rdfItem
@return bool
@throws \common_exception_Error
@throws \common_exception_NotFound
@throws common_Exc... | [
"Save",
"a",
"QTI_Item",
"into",
"an",
"RDF",
"Item",
"by",
"exporting",
"the",
"QTI_Item",
"to",
"QTI",
"xml",
"and",
"saving",
"it",
"in",
"the",
"itemContent",
"property",
"of",
"the",
"RDF",
"Item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Service.php#L134-L154 |
oat-sa/extension-tao-itemqti | model/qti/Service.php | Service.loadItemFromFile | public function loadItemFromFile($file)
{
$returnValue = null;
if (is_string($file) && !empty($file)) {
//validate the file to import
try {
$qtiParser = new Parser($file);
$qtiParser->validate();
if (!$qtiParser->isValid()) {... | php | public function loadItemFromFile($file)
{
$returnValue = null;
if (is_string($file) && !empty($file)) {
//validate the file to import
try {
$qtiParser = new Parser($file);
$qtiParser->validate();
if (!$qtiParser->isValid()) {... | [
"public",
"function",
"loadItemFromFile",
"(",
"$",
"file",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"is_string",
"(",
"$",
"file",
")",
"&&",
"!",
"empty",
"(",
"$",
"file",
")",
")",
"{",
"//validate the file to import",
"try",
"{",
... | Load a QTI item from a qti file in parameter.
@param $file
@return null|Item
@throws Exception
@throws ParsingException | [
"Load",
"a",
"QTI",
"item",
"from",
"a",
"qti",
"file",
"in",
"parameter",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Service.php#L181-L205 |
oat-sa/extension-tao-itemqti | controller/AbstractRestQti.php | AbstractRestQti.getStatus | public function getStatus()
{
try {
if (!$this->hasRequestParameter(self::TASK_ID_PARAM)) {
throw new \common_exception_MissingParameter(self::TASK_ID_PARAM, $this->getRequestURI());
}
$data = $this->getTaskLogReturnData(
$this->getRequest... | php | public function getStatus()
{
try {
if (!$this->hasRequestParameter(self::TASK_ID_PARAM)) {
throw new \common_exception_MissingParameter(self::TASK_ID_PARAM, $this->getRequestURI());
}
$data = $this->getTaskLogReturnData(
$this->getRequest... | [
"public",
"function",
"getStatus",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRequestParameter",
"(",
"self",
"::",
"TASK_ID_PARAM",
")",
")",
"{",
"throw",
"new",
"\\",
"common_exception_MissingParameter",
"(",
"self",
"::",
"TASK_ID_... | Action to retrieve test import status from queue | [
"Action",
"to",
"retrieve",
"test",
"import",
"status",
"from",
"queue"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/AbstractRestQti.php#L64-L80 |
oat-sa/extension-tao-itemqti | controller/AbstractRestQti.php | AbstractRestQti.getTaskStatus | protected function getTaskStatus(EntityInterface $taskLogEntity)
{
if ($taskLogEntity->getStatus()->isCreated()) {
return __('In Progress');
} else if ($taskLogEntity->getStatus()->isCompleted()){
return __('Success');
}
return $taskLogEntity->getStatus()->ge... | php | protected function getTaskStatus(EntityInterface $taskLogEntity)
{
if ($taskLogEntity->getStatus()->isCreated()) {
return __('In Progress');
} else if ($taskLogEntity->getStatus()->isCompleted()){
return __('Success');
}
return $taskLogEntity->getStatus()->ge... | [
"protected",
"function",
"getTaskStatus",
"(",
"EntityInterface",
"$",
"taskLogEntity",
")",
"{",
"if",
"(",
"$",
"taskLogEntity",
"->",
"getStatus",
"(",
")",
"->",
"isCreated",
"(",
")",
")",
"{",
"return",
"__",
"(",
"'In Progress'",
")",
";",
"}",
"els... | Return 'Success' instead of 'Completed', required by the specified API.
@param EntityInterface $taskLogEntity
@return string | [
"Return",
"Success",
"instead",
"of",
"Completed",
"required",
"by",
"the",
"specified",
"API",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/AbstractRestQti.php#L88-L97 |
oat-sa/extension-tao-itemqti | model/qti/response/Template.php | Template.getRule | public function getRule(){
$returnValue = (string) '';
if($this->uri == self::MATCH_CORRECT){
$returnValue = taoQTI_models_classes_Matching_Matching::MATCH_CORRECT;
}else if($this->uri == self::MAP_RESPONSE){
$returnValue = taoQTI_models_classes_Matching_Matching::MAP_R... | php | public function getRule(){
$returnValue = (string) '';
if($this->uri == self::MATCH_CORRECT){
$returnValue = taoQTI_models_classes_Matching_Matching::MATCH_CORRECT;
}else if($this->uri == self::MAP_RESPONSE){
$returnValue = taoQTI_models_classes_Matching_Matching::MAP_R... | [
"public",
"function",
"getRule",
"(",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"uri",
"==",
"self",
"::",
"MATCH_CORRECT",
")",
"{",
"$",
"returnValue",
"=",
"taoQTI_models_classes_Matching_Matching",
... | Short description of method getRule
@access public
@author Cedric Alfonsi, <cedric.alfonsi@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"getRule"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Template.php#L131-L146 |
oat-sa/extension-tao-itemqti | model/qti/response/Template.php | Template.getTemplateContent | public function getTemplateContent(){
$standardRpTemplateFolder = dirname(__FILE__).'/../data/qtiv2p1/rptemplates/';
switch($this->uri){
case self::MATCH_CORRECT:
$returnValue = file_get_contents($standardRpTemplateFolder.'match_correct.xml');
break;
... | php | public function getTemplateContent(){
$standardRpTemplateFolder = dirname(__FILE__).'/../data/qtiv2p1/rptemplates/';
switch($this->uri){
case self::MATCH_CORRECT:
$returnValue = file_get_contents($standardRpTemplateFolder.'match_correct.xml');
break;
... | [
"public",
"function",
"getTemplateContent",
"(",
")",
"{",
"$",
"standardRpTemplateFolder",
"=",
"dirname",
"(",
"__FILE__",
")",
".",
"'/../data/qtiv2p1/rptemplates/'",
";",
"switch",
"(",
"$",
"this",
"->",
"uri",
")",
"{",
"case",
"self",
"::",
"MATCH_CORRECT... | Get the content of the response processing template identified by its uri
@todo make it dynamic in the future
@return string
@throws \oat\taoQtiItem\model\qti\exception\QtiModelException | [
"Get",
"the",
"content",
"of",
"the",
"response",
"processing",
"template",
"identified",
"by",
"its",
"uri"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Template.php#L155-L175 |
oat-sa/extension-tao-itemqti | model/qti/response/Template.php | Template.toQTI | public function toQTI(){
$returnValue = '';
if($this->uri != self::NONE){
//if there is actually a real response template involved, render the template
$tplRenderer = new taoItems_models_classes_TemplateRenderer(static::getTemplatePath().'/qti.rptemplate.tpl.php', array('uri' =... | php | public function toQTI(){
$returnValue = '';
if($this->uri != self::NONE){
//if there is actually a real response template involved, render the template
$tplRenderer = new taoItems_models_classes_TemplateRenderer(static::getTemplatePath().'/qti.rptemplate.tpl.php', array('uri' =... | [
"public",
"function",
"toQTI",
"(",
")",
"{",
"$",
"returnValue",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"uri",
"!=",
"self",
"::",
"NONE",
")",
"{",
"//if there is actually a real response template involved, render the template",
"$",
"tplRenderer",
"=",
... | Short description of method toQTI
@access public
@author Cedric Alfonsi, <cedric.alfonsi@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"toQTI"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Template.php#L221-L232 |
oat-sa/extension-tao-itemqti | model/portableElement/validator/PortableElementAssetValidator.php | PortableElementAssetValidator.validateAssets | public function validateAssets(PortableElementObject $object, $source, array $files=[])
{
$errorReport = \common_report_Report::createFailure('Portable element validation has failed.');
if (empty($files)) {
//if no files requested, get all all assets
try{
$fi... | php | public function validateAssets(PortableElementObject $object, $source, array $files=[])
{
$errorReport = \common_report_Report::createFailure('Portable element validation has failed.');
if (empty($files)) {
//if no files requested, get all all assets
try{
$fi... | [
"public",
"function",
"validateAssets",
"(",
"PortableElementObject",
"$",
"object",
",",
"$",
"source",
",",
"array",
"$",
"files",
"=",
"[",
"]",
")",
"{",
"$",
"errorReport",
"=",
"\\",
"common_report_Report",
"::",
"createFailure",
"(",
"'Portable element va... | Validate files by checking:
- Model requirement
- Existing as file or alias
@param PortableElementObject $object
@param string $source Temporary directory source
@param array $files Array of file relative path
@return bool
@throws PortableElementInvalidAssetException
@throws PortableElementInvalidModelException
@throw... | [
"Validate",
"files",
"by",
"checking",
":",
"-",
"Model",
"requirement",
"-",
"Existing",
"as",
"file",
"or",
"alias"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/validator/PortableElementAssetValidator.php#L45-L76 |
oat-sa/extension-tao-itemqti | model/portableElement/validator/PortableElementAssetValidator.php | PortableElementAssetValidator.getAssets | public function getAssets(PortableElementObject $object, $type=null)
{
$assets = [];
if (is_null($type) || ($type == 'runtime')) {
$assets = ['runtime' => $object->getRuntimePath()];
}
if (is_null($type) || ($type == 'creator')) {
if (! empty($object->getCrea... | php | public function getAssets(PortableElementObject $object, $type=null)
{
$assets = [];
if (is_null($type) || ($type == 'runtime')) {
$assets = ['runtime' => $object->getRuntimePath()];
}
if (is_null($type) || ($type == 'creator')) {
if (! empty($object->getCrea... | [
"public",
"function",
"getAssets",
"(",
"PortableElementObject",
"$",
"object",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"assets",
"=",
"[",
"]",
";",
"if",
"(",
"is_null",
"(",
"$",
"type",
")",
"||",
"(",
"$",
"type",
"==",
"'runtime'",
")",
... | Return all assets of a portable element in a array of string
Path is relative to Portable Element location
@param PortableElementObject $object
@param null $type Object key to focus
@return array List of file relative path
@throws PortableElementInvalidAssetException | [
"Return",
"all",
"assets",
"of",
"a",
"portable",
"element",
"in",
"a",
"array",
"of",
"string",
"Path",
"is",
"relative",
"to",
"Portable",
"Element",
"location"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/validator/PortableElementAssetValidator.php#L87-L126 |
oat-sa/extension-tao-itemqti | model/portableElement/validator/PortableElementAssetValidator.php | PortableElementAssetValidator.validFile | public function validFile($source, $file)
{
if (! file_exists($source)) {
throw new PortableElementParserException('Unable to locate extracted zip file.');
}
$filePath = rtrim($source, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . preg_replace('/^\.\//', '', $file);
if (... | php | public function validFile($source, $file)
{
if (! file_exists($source)) {
throw new PortableElementParserException('Unable to locate extracted zip file.');
}
$filePath = rtrim($source, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . preg_replace('/^\.\//', '', $file);
if (... | [
"public",
"function",
"validFile",
"(",
"$",
"source",
",",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"source",
")",
")",
"{",
"throw",
"new",
"PortableElementParserException",
"(",
"'Unable to locate extracted zip file.'",
")",
";",
"}",... | Valid a file if exists or alias
@param string $source Temporary directory source
@param string $file Path to the file
@return bool
@throws PortableElementInvalidAssetException
@throws PortableElementParserException | [
"Valid",
"a",
"file",
"if",
"exists",
"or",
"alias"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/validator/PortableElementAssetValidator.php#L137-L156 |
oat-sa/extension-tao-itemqti | model/portableElement/action/RegisterPortableElement.php | RegisterPortableElement.createFailure | private function createFailure($userMessage, $model = null){
$typeIdentifier = is_null($model) ? 'unknown type' : $model->getTypeIdentifier();
$message = 'The portable element cannot be registered "'.$typeIdentifier.'", reason: '.$userMessage;
\common_Logger::w($message);
return Report::... | php | private function createFailure($userMessage, $model = null){
$typeIdentifier = is_null($model) ? 'unknown type' : $model->getTypeIdentifier();
$message = 'The portable element cannot be registered "'.$typeIdentifier.'", reason: '.$userMessage;
\common_Logger::w($message);
return Report::... | [
"private",
"function",
"createFailure",
"(",
"$",
"userMessage",
",",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"typeIdentifier",
"=",
"is_null",
"(",
"$",
"model",
")",
"?",
"'unknown type'",
":",
"$",
"model",
"->",
"getTypeIdentifier",
"(",
")",
";",
... | Create a formatted failure report and log a warning
@param $userMessage
@param null $model
@return Report | [
"Create",
"a",
"formatted",
"failure",
"report",
"and",
"log",
"a",
"warning"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/action/RegisterPortableElement.php#L80-L85 |
oat-sa/extension-tao-itemqti | model/qti/expression/BaseValue.php | BaseValue.getRule | public function getRule()
{
$returnValue = (string) '';
// JSON ENCODE the value to get quote when quote are required function of the variable base type
// not so easy ;)
//$returnValue = json_encode($this->value);
// @todo make usable for complex variable such as ... | php | public function getRule()
{
$returnValue = (string) '';
// JSON ENCODE the value to get quote when quote are required function of the variable base type
// not so easy ;)
//$returnValue = json_encode($this->value);
// @todo make usable for complex variable such as ... | [
"public",
"function",
"getRule",
"(",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"// JSON ENCODE the value to get quote when quote are required function of the variable base type",
"// not so easy ;)",
"//$returnValue = json_encode($this->value);",
"// @todo ... | Short description of method getRule
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"getRule"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/expression/BaseValue.php#L52-L102 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.getBodyData | public function getBodyData(DOMElement $data, $removeNamespace = false, $keepEmptyTags = false){
//prepare the data string
$bodyData = '';
$saveOptions = $keepEmptyTags ? LIBXML_NOEMPTYTAG : 0;
$children = $data->childNodes;
foreach ($children as $child)
{
... | php | public function getBodyData(DOMElement $data, $removeNamespace = false, $keepEmptyTags = false){
//prepare the data string
$bodyData = '';
$saveOptions = $keepEmptyTags ? LIBXML_NOEMPTYTAG : 0;
$children = $data->childNodes;
foreach ($children as $child)
{
... | [
"public",
"function",
"getBodyData",
"(",
"DOMElement",
"$",
"data",
",",
"$",
"removeNamespace",
"=",
"false",
",",
"$",
"keepEmptyTags",
"=",
"false",
")",
"{",
"//prepare the data string",
"$",
"bodyData",
"=",
"''",
";",
"$",
"saveOptions",
"=",
"$",
"ke... | Get the body data (markups) of an element.
@param \DOMElement $data the element
@param boolean $removeNamespace if XML namespaces should be removed
@param boolean $keepEmptyTags if true, the empty tags are kept expanded (useful when tags are HTML)
@return string the body data (XML markup) | [
"Get",
"the",
"body",
"data",
"(",
"markups",
")",
"of",
"an",
"element",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L126-L144 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildItem | protected function buildItem(DOMElement $data){
//check on the root tag.
$itemId = (string) $data->getAttribute('identifier');
$this->logDebug('Started parsing of QTI item'.(isset($itemId) ? ' '.$itemId : ''), array('TAOITEMS'));
//create the item instance
$this->item = new Ite... | php | protected function buildItem(DOMElement $data){
//check on the root tag.
$itemId = (string) $data->getAttribute('identifier');
$this->logDebug('Started parsing of QTI item'.(isset($itemId) ? ' '.$itemId : ''), array('TAOITEMS'));
//create the item instance
$this->item = new Ite... | [
"protected",
"function",
"buildItem",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"//check on the root tag.",
"$",
"itemId",
"=",
"(",
"string",
")",
"$",
"data",
"->",
"getAttribute",
"(",
"'identifier'",
")",
";",
"$",
"this",
"->",
"logDebug",
"(",
"'Starte... | Build a QTI_Item from a DOMElement, the root tag of which is root assessmentItem
@param DOMElement $data
@return \oat\taoQtiItem\model\qti\Item
@throws InvalidArgumentException
@throws ParsingException
@throws UnsupportedQtiElement | [
"Build",
"a",
"QTI_Item",
"from",
"a",
"DOMElement",
"the",
"root",
"tag",
"of",
"which",
"is",
"root",
"assessmentItem"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L511-L601 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.loadNamespaces | protected function loadNamespaces(){
$namespaces = [];
foreach($this->queryXPath('namespace::*') as $node){
$name = preg_replace('/xmlns(:)?/', '', $node->nodeName);
if($name !== 'xml'){//always removed the implicit xml namespace
$namespaces[$name] = $node->nodeVa... | php | protected function loadNamespaces(){
$namespaces = [];
foreach($this->queryXPath('namespace::*') as $node){
$name = preg_replace('/xmlns(:)?/', '', $node->nodeName);
if($name !== 'xml'){//always removed the implicit xml namespace
$namespaces[$name] = $node->nodeVa... | [
"protected",
"function",
"loadNamespaces",
"(",
")",
"{",
"$",
"namespaces",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"queryXPath",
"(",
"'namespace::*'",
")",
"as",
"$",
"node",
")",
"{",
"$",
"name",
"=",
"preg_replace",
"(",
"'/xmlns(:)?... | Load xml namespaces into the item model | [
"Load",
"xml",
"namespaces",
"into",
"the",
"item",
"model"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L606-L618 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.loadSchemaLocations | protected function loadSchemaLocations(DOMElement $itemData){
$schemaLoc = preg_replace('/\s+/', ' ', trim($itemData->getAttributeNS($itemData->lookupNamespaceURI('xsi'), 'schemaLocation')));
$schemaLocToken = explode(' ', $schemaLoc);
$schemaCount = count($schemaLocToken);
if($schemaCou... | php | protected function loadSchemaLocations(DOMElement $itemData){
$schemaLoc = preg_replace('/\s+/', ' ', trim($itemData->getAttributeNS($itemData->lookupNamespaceURI('xsi'), 'schemaLocation')));
$schemaLocToken = explode(' ', $schemaLoc);
$schemaCount = count($schemaLocToken);
if($schemaCou... | [
"protected",
"function",
"loadSchemaLocations",
"(",
"DOMElement",
"$",
"itemData",
")",
"{",
"$",
"schemaLoc",
"=",
"preg_replace",
"(",
"'/\\s+/'",
",",
"' '",
",",
"trim",
"(",
"$",
"itemData",
"->",
"getAttributeNS",
"(",
"$",
"itemData",
"->",
"lookupName... | Load xml schema locations into the item model
@param DOMElement $itemData
@throws ParsingException | [
"Load",
"xml",
"schema",
"locations",
"into",
"the",
"item",
"model"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L626-L636 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildInteraction | protected function buildInteraction(DOMElement $data){
$returnValue = null;
if($data->nodeName === 'customInteraction'){
$returnValue = $this->buildCustomInteraction($data);
}else{
//build one of the standard interaction
try{
$type = ucfi... | php | protected function buildInteraction(DOMElement $data){
$returnValue = null;
if($data->nodeName === 'customInteraction'){
$returnValue = $this->buildCustomInteraction($data);
}else{
//build one of the standard interaction
try{
$type = ucfi... | [
"protected",
"function",
"buildInteraction",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"$",
"data",
"->",
"nodeName",
"===",
"'customInteraction'",
")",
"{",
"$",
"returnValue",
"=",
"$",
"this",
"->",
"buil... | Build a QTI_Interaction from a DOMElement (the root tag of this is an 'interaction' node)
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement $data
@return \oat\taoQtiItem\model\qti\interaction\Interaction
@throws ParsingException
@throws UnsupportedQtiElement
@throws interaction\InvalidArgumentEx... | [
"Build",
"a",
"QTI_Interaction",
"from",
"a",
"DOMElement",
"(",
"the",
"root",
"tag",
"of",
"this",
"is",
"an",
"interaction",
"node",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L660-L778 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildChoice | protected function buildChoice(DOMElement $data){
$className = '\\oat\\taoQtiItem\\model\\qti\\choice\\'.ucfirst($data->nodeName);
if(!class_exists($className)){
throw new ParsingException("The choice class does not exist ".$className);
}
$myChoice = new $className($this->e... | php | protected function buildChoice(DOMElement $data){
$className = '\\oat\\taoQtiItem\\model\\qti\\choice\\'.ucfirst($data->nodeName);
if(!class_exists($className)){
throw new ParsingException("The choice class does not exist ".$className);
}
$myChoice = new $className($this->e... | [
"protected",
"function",
"buildChoice",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"className",
"=",
"'\\\\oat\\\\taoQtiItem\\\\model\\\\qti\\\\choice\\\\'",
".",
"ucfirst",
"(",
"$",
"data",
"->",
"nodeName",
")",
";",
"if",
"(",
"!",
"class_exists",
"(",
"... | Build a QTI_Choice from a DOMElement (the root tag of this element
an 'choice' node)
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement $data
@return \oat\taoQtiItem\model\qti\choice\Choice
@throws ParsingException
@throws UnsupportedQtiElement
@throws choice\InvalidArgumentException
@see http:/... | [
"Build",
"a",
"QTI_Choice",
"from",
"a",
"DOMElement",
"(",
"the",
"root",
"tag",
"of",
"this",
"element",
"an",
"choice",
"node",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L793-L818 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildResponseDeclaration | protected function buildResponseDeclaration(DOMElement $data){
$myResponse = new ResponseDeclaration($this->extractAttributes($data), $this->item);
$data = simplexml_import_dom($data);
//set the correct responses
$correctResponseNodes = $data->xpath("*[name(.) = 'correctResponse']");
... | php | protected function buildResponseDeclaration(DOMElement $data){
$myResponse = new ResponseDeclaration($this->extractAttributes($data), $this->item);
$data = simplexml_import_dom($data);
//set the correct responses
$correctResponseNodes = $data->xpath("*[name(.) = 'correctResponse']");
... | [
"protected",
"function",
"buildResponseDeclaration",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"myResponse",
"=",
"new",
"ResponseDeclaration",
"(",
"$",
"this",
"->",
"extractAttributes",
"(",
"$",
"data",
")",
",",
"$",
"this",
"->",
"item",
")",
";",... | Short description of method buildResponseDeclaration
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement $data
@return \oat\taoQtiItem\model\qti\ResponseDeclaration
@see http://www.imsglobal.org/question/qti_v2p0/imsqti_infov2p0.html#element10074 | [
"Short",
"description",
"of",
"method",
"buildResponseDeclaration"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L829-L921 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildOutcomeDeclaration | protected function buildOutcomeDeclaration(DOMElement $data){
$outcome = new OutcomeDeclaration($this->extractAttributes($data));
$data = simplexml_import_dom($data);
if(isset($data->defaultValue)){
if(!is_null($data->defaultValue->value)){
$outcome->setDefaultValue... | php | protected function buildOutcomeDeclaration(DOMElement $data){
$outcome = new OutcomeDeclaration($this->extractAttributes($data));
$data = simplexml_import_dom($data);
if(isset($data->defaultValue)){
if(!is_null($data->defaultValue->value)){
$outcome->setDefaultValue... | [
"protected",
"function",
"buildOutcomeDeclaration",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"outcome",
"=",
"new",
"OutcomeDeclaration",
"(",
"$",
"this",
"->",
"extractAttributes",
"(",
"$",
"data",
")",
")",
";",
"$",
"data",
"=",
"simplexml_import_do... | Short description of method buildOutcomeDeclaration
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement data
@return oat\taoQtiItem\model\qti\OutcomeDeclaration | [
"Short",
"description",
"of",
"method",
"buildOutcomeDeclaration"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L931-L943 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildTemplateResponseProcessing | protected function buildTemplateResponseProcessing(DOMElement $data){
$returnValue = null;
if($data->hasAttribute('template') && $data->childNodes->length === 0){
$templateUri = (string) $data->getAttribute('template');
$returnValue = new Template($templateUri);
}elseif(... | php | protected function buildTemplateResponseProcessing(DOMElement $data){
$returnValue = null;
if($data->hasAttribute('template') && $data->childNodes->length === 0){
$templateUri = (string) $data->getAttribute('template');
$returnValue = new Template($templateUri);
}elseif(... | [
"protected",
"function",
"buildTemplateResponseProcessing",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"$",
"data",
"->",
"hasAttribute",
"(",
"'template'",
")",
"&&",
"$",
"data",
"->",
"childNodes",
"->",
"le... | Short description of method buildTemplateResponseProcessing
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement data
@return oat\taoQtiItem\model\qti\response\ResponseProcessing | [
"Short",
"description",
"of",
"method",
"buildTemplateResponseProcessing"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L953-L991 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildResponseProcessing | protected function buildResponseProcessing(DOMElement $data, Item $item){
$returnValue = null;
// try template
try{
$returnValue = $this->buildTemplateResponseProcessing($data);
try{
//warning: require to add interactions to the item to make it work
... | php | protected function buildResponseProcessing(DOMElement $data, Item $item){
$returnValue = null;
// try template
try{
$returnValue = $this->buildTemplateResponseProcessing($data);
try{
//warning: require to add interactions to the item to make it work
... | [
"protected",
"function",
"buildResponseProcessing",
"(",
"DOMElement",
"$",
"data",
",",
"Item",
"$",
"item",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"// try template",
"try",
"{",
"$",
"returnValue",
"=",
"$",
"this",
"->",
"buildTemplateResponseProcess... | Short description of method buildResponseProcessing
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement data
@param Item item
@return oat\taoQtiItem\model\qti\response\ResponseProcessing | [
"Short",
"description",
"of",
"method",
"buildResponseProcessing"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1002-L1039 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildCompositeResponseProcessing | protected function buildCompositeResponseProcessing(DOMElement $data, Item $item){
$returnValue = null;
// STRONGLY simplified summation detection
$patternCorrectTAO = '/responseCondition [count(./*) = 1 ] [name(./*[1]) = "responseIf" ] [count(./responseIf/*) = 2 ] [name(./responseIf/*[1]) = "m... | php | protected function buildCompositeResponseProcessing(DOMElement $data, Item $item){
$returnValue = null;
// STRONGLY simplified summation detection
$patternCorrectTAO = '/responseCondition [count(./*) = 1 ] [name(./*[1]) = "responseIf" ] [count(./responseIf/*) = 2 ] [name(./responseIf/*[1]) = "m... | [
"protected",
"function",
"buildCompositeResponseProcessing",
"(",
"DOMElement",
"$",
"data",
",",
"Item",
"$",
"item",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"// STRONGLY simplified summation detection",
"$",
"patternCorrectTAO",
"=",
"'/responseCondition [count(... | Short description of method buildCompositeResponseProcessing
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement data
@param Item item
@return oat\taoQtiItem\model\qti\response\ResponseProcessing | [
"Short",
"description",
"of",
"method",
"buildCompositeResponseProcessing"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1050-L1147 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildCustomResponseProcessing | protected function buildCustomResponseProcessing(DOMElement $data){
// Parse to find the different response rules
$responseRules = array();
$data = simplexml_import_dom($data);
$returnValue = new Custom($responseRules, $data->asXml());
return $returnValue;
} | php | protected function buildCustomResponseProcessing(DOMElement $data){
// Parse to find the different response rules
$responseRules = array();
$data = simplexml_import_dom($data);
$returnValue = new Custom($responseRules, $data->asXml());
return $returnValue;
} | [
"protected",
"function",
"buildCustomResponseProcessing",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"// Parse to find the different response rules",
"$",
"responseRules",
"=",
"array",
"(",
")",
";",
"$",
"data",
"=",
"simplexml_import_dom",
"(",
"$",
"data",
")",
"... | Short description of method buildCustomResponseProcessing
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement data
@return oat\taoQtiItem\model\qti\response\ResponseProcessing | [
"Short",
"description",
"of",
"method",
"buildCustomResponseProcessing"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1157-L1167 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildTemplatedrivenResponse | protected function buildTemplatedrivenResponse(DOMElement $data, $interactions){
$patternCorrectTAO = '/responseCondition [count(./*) = 1 ] [name(./*[1]) = "responseIf" ] [count(./responseIf/*) = 2 ] [name(./responseIf/*[1]) = "match" ] [name(./responseIf/match/*[1]) = "variable" ] [name(./responseIf/match/*[2... | php | protected function buildTemplatedrivenResponse(DOMElement $data, $interactions){
$patternCorrectTAO = '/responseCondition [count(./*) = 1 ] [name(./*[1]) = "responseIf" ] [count(./responseIf/*) = 2 ] [name(./responseIf/*[1]) = "match" ] [name(./responseIf/match/*[1]) = "variable" ] [name(./responseIf/match/*[2... | [
"protected",
"function",
"buildTemplatedrivenResponse",
"(",
"DOMElement",
"$",
"data",
",",
"$",
"interactions",
")",
"{",
"$",
"patternCorrectTAO",
"=",
"'/responseCondition [count(./*) = 1 ] [name(./*[1]) = \"responseIf\" ] [count(./responseIf/*) = 2 ] [name(./responseIf/*[1]) = \"m... | Short description of method buildTemplatedrivenResponse
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement $data
@param $interactions
@return TemplatesDriven
@throws UnexpectedResponseProcessing
@throws exception\QtiModelException
@throws response\InvalidArgumentException | [
"Short",
"description",
"of",
"method",
"buildTemplatedrivenResponse"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1221-L1357 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildObject | private function buildObject(DOMElement $data){
$attributes = $this->extractAttributes($data);
$returnValue = new QtiObject($attributes);
if($data->hasChildNodes()){
$nonEmptyChild = $this->getNonEmptyChildren($data);
if(count($nonEmptyChild) == 1 && reset($nonEmptyChil... | php | private function buildObject(DOMElement $data){
$attributes = $this->extractAttributes($data);
$returnValue = new QtiObject($attributes);
if($data->hasChildNodes()){
$nonEmptyChild = $this->getNonEmptyChildren($data);
if(count($nonEmptyChild) == 1 && reset($nonEmptyChil... | [
"private",
"function",
"buildObject",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"extractAttributes",
"(",
"$",
"data",
")",
";",
"$",
"returnValue",
"=",
"new",
"QtiObject",
"(",
"$",
"attributes",
")",
";",
"if... | Short description of method buildObject
@access private
@author Joel Bout, <joel.bout@tudor.lu>
@param DOMElement $data
@return \oat\taoQtiItem\model\qti\QtiObject | [
"Short",
"description",
"of",
"method",
"buildObject"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1392-L1416 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.getPortableElementSubclasses | private function getPortableElementSubclasses($superClassName){
$subClasses = [];
foreach(PortableModelRegistry::getRegistry()->getModels() as $model){
$portableElementClass = $model->getQtiElementClassName();
if(is_subclass_of($portableElementClass, $superClassName)){
... | php | private function getPortableElementSubclasses($superClassName){
$subClasses = [];
foreach(PortableModelRegistry::getRegistry()->getModels() as $model){
$portableElementClass = $model->getQtiElementClassName();
if(is_subclass_of($portableElementClass, $superClassName)){
... | [
"private",
"function",
"getPortableElementSubclasses",
"(",
"$",
"superClassName",
")",
"{",
"$",
"subClasses",
"=",
"[",
"]",
";",
"foreach",
"(",
"PortableModelRegistry",
"::",
"getRegistry",
"(",
")",
"->",
"getModels",
"(",
")",
"as",
"$",
"model",
")",
... | Return the list of registered php portable element subclasses
@return array | [
"Return",
"the",
"list",
"of",
"registered",
"php",
"portable",
"element",
"subclasses"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1559-L1568 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.getPortableElementClass | private function getPortableElementClass(DOMElement $data, $superClassName, $portableElementNodeName){
$portableElementClasses = $this->getPortableElementSubclasses($superClassName);
//start searching from globally declared namespace
foreach($this->item->getNamespaces() as $name => $uri){
... | php | private function getPortableElementClass(DOMElement $data, $superClassName, $portableElementNodeName){
$portableElementClasses = $this->getPortableElementSubclasses($superClassName);
//start searching from globally declared namespace
foreach($this->item->getNamespaces() as $name => $uri){
... | [
"private",
"function",
"getPortableElementClass",
"(",
"DOMElement",
"$",
"data",
",",
"$",
"superClassName",
",",
"$",
"portableElementNodeName",
")",
"{",
"$",
"portableElementClasses",
"=",
"$",
"this",
"->",
"getPortableElementSubclasses",
"(",
"$",
"superClassNam... | Get the PCI class associated to a dom node based on its namespace
Returns null if not a known PCI model
@param DOMElement $data
@return null | [
"Get",
"the",
"PCI",
"class",
"associated",
"to",
"a",
"dom",
"node",
"based",
"on",
"its",
"namespace",
"Returns",
"null",
"if",
"not",
"a",
"known",
"PCI",
"model"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1577-L1604 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildCustomInteraction | private function buildCustomInteraction(DOMElement $data){
$interaction = null;
$pciClass = $this->getPciClass($data);
if (!empty($pciClass)) {
$ns = null;
foreach($this->item->getNamespaces() as $name => $uri){
if($pciClass::NS_URI === $uri){
... | php | private function buildCustomInteraction(DOMElement $data){
$interaction = null;
$pciClass = $this->getPciClass($data);
if (!empty($pciClass)) {
$ns = null;
foreach($this->item->getNamespaces() as $name => $uri){
if($pciClass::NS_URI === $uri){
... | [
"private",
"function",
"buildCustomInteraction",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"interaction",
"=",
"null",
";",
"$",
"pciClass",
"=",
"$",
"this",
"->",
"getPciClass",
"(",
"$",
"data",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"pci... | Parse and build a custom interaction object
@param DOMElement $data
@return CustomInteraction
@throws ParsingException | [
"Parse",
"and",
"build",
"a",
"custom",
"interaction",
"object"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1621-L1665 |
oat-sa/extension-tao-itemqti | model/qti/ParserFactory.php | ParserFactory.buildInfoControl | private function buildInfoControl(DOMElement $data){
$infoControl = null;
$picClass = $this->getPicClass($data);
if(!empty($picClass)){
$ns = null;
foreach($this->item->getNamespaces() as $name => $uri){
if($picClass::NS_URI === $uri){
... | php | private function buildInfoControl(DOMElement $data){
$infoControl = null;
$picClass = $this->getPicClass($data);
if(!empty($picClass)){
$ns = null;
foreach($this->item->getNamespaces() as $name => $uri){
if($picClass::NS_URI === $uri){
... | [
"private",
"function",
"buildInfoControl",
"(",
"DOMElement",
"$",
"data",
")",
"{",
"$",
"infoControl",
"=",
"null",
";",
"$",
"picClass",
"=",
"$",
"this",
"->",
"getPicClass",
"(",
"$",
"data",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"picClass"... | Parse and build a info control
@param DOMElement $data
@return InfoControl
@throws ParsingException | [
"Parse",
"and",
"build",
"a",
"info",
"control"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ParserFactory.php#L1674-L1718 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/classificationMetadata/ImsManifestClassificationMetadataExtractor.php | ImsManifestClassificationMetadataExtractor.setClassificationMapping | public function setClassificationMapping($propertyUri, $classificationValue)
{
if (empty($propertyUri) || ! is_string($propertyUri)) {
throw new MetadataExtractionException(__('PropertyUri to map has to a valid uri'));
}
if (empty($classificationValue) || ! is_string($classificat... | php | public function setClassificationMapping($propertyUri, $classificationValue)
{
if (empty($propertyUri) || ! is_string($propertyUri)) {
throw new MetadataExtractionException(__('PropertyUri to map has to a valid uri'));
}
if (empty($classificationValue) || ! is_string($classificat... | [
"public",
"function",
"setClassificationMapping",
"(",
"$",
"propertyUri",
",",
"$",
"classificationValue",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"propertyUri",
")",
"||",
"!",
"is_string",
"(",
"$",
"propertyUri",
")",
")",
"{",
"throw",
"new",
"MetadataE... | Set the association between property uri and value to find into classification metadata source
@param $propertyUri
@param $classificationValue
@throws MetadataExtractionException | [
"Set",
"the",
"association",
"between",
"property",
"uri",
"and",
"value",
"to",
"find",
"into",
"classification",
"metadata",
"source"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/classificationMetadata/ImsManifestClassificationMetadataExtractor.php#L43-L52 |
oat-sa/extension-tao-itemqti | model/qti/response/interactionResponseProcessing/MapResponseTemplate.php | MapResponseTemplate.getRule | public function getRule()
{
$returnValue = (string) '';
$returnValue = 'if(isNull(null, getResponse("'.$this->getResponse()->getIdentifier().'"))) { '.
'setOutcomeValue("'.$this->getOutcome()->getIdentifier().'", 0); } else { '.
'setOutcomeValue("'.$this->getOutcome()->ge... | php | public function getRule()
{
$returnValue = (string) '';
$returnValue = 'if(isNull(null, getResponse("'.$this->getResponse()->getIdentifier().'"))) { '.
'setOutcomeValue("'.$this->getOutcome()->getIdentifier().'", 0); } else { '.
'setOutcomeValue("'.$this->getOutcome()->ge... | [
"public",
"function",
"getRule",
"(",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"$",
"returnValue",
"=",
"'if(isNull(null, getResponse(\"'",
".",
"$",
"this",
"->",
"getResponse",
"(",
")",
"->",
"getIdentifier",
"(",
")",
".",
"'\"... | Short description of method getRule
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"getRule"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/interactionResponseProcessing/MapResponseTemplate.php#L59-L71 |
oat-sa/extension-tao-itemqti | model/flyExporter/extractor/QtiExtractor.php | QtiExtractor.setItem | public function setItem(\core_kernel_classes_Resource $item)
{
$this->item = $item;
$this->loadXml($item);
return $this;
} | php | public function setItem(\core_kernel_classes_Resource $item)
{
$this->item = $item;
$this->loadXml($item);
return $this;
} | [
"public",
"function",
"setItem",
"(",
"\\",
"core_kernel_classes_Resource",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"item",
"=",
"$",
"item",
";",
"$",
"this",
"->",
"loadXml",
"(",
"$",
"item",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set item to extract
@param \core_kernel_classes_Resource $item
@return $this
@throws ExtractorException | [
"Set",
"item",
"to",
"extract"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/extractor/QtiExtractor.php#L83-L89 |
oat-sa/extension-tao-itemqti | model/flyExporter/extractor/QtiExtractor.php | QtiExtractor.loadXml | private function loadXml(\core_kernel_classes_Resource $item)
{
$itemService = Service::singleton();
try {
$xml = $itemService->getXmlByRdfItem($item);
if (empty($xml)) {
throw new ExtractorException('No content found for item ' . $item->getUri());
... | php | private function loadXml(\core_kernel_classes_Resource $item)
{
$itemService = Service::singleton();
try {
$xml = $itemService->getXmlByRdfItem($item);
if (empty($xml)) {
throw new ExtractorException('No content found for item ' . $item->getUri());
... | [
"private",
"function",
"loadXml",
"(",
"\\",
"core_kernel_classes_Resource",
"$",
"item",
")",
"{",
"$",
"itemService",
"=",
"Service",
"::",
"singleton",
"(",
")",
";",
"try",
"{",
"$",
"xml",
"=",
"$",
"itemService",
"->",
"getXmlByRdfItem",
"(",
"$",
"i... | Load Dom & Xpath of xml item content & register xpath namespace
@param \core_kernel_classes_Resource $item
@return $this
@throws ExtractorException | [
"Load",
"Dom",
"&",
"Xpath",
"of",
"xml",
"item",
"content",
"&",
"register",
"xpath",
"namespace"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/extractor/QtiExtractor.php#L98-L117 |
oat-sa/extension-tao-itemqti | model/flyExporter/extractor/QtiExtractor.php | QtiExtractor.run | public function run()
{
$this->extractInteractions();
$this->data = $line = [];
foreach ($this->interactions as $interaction) {
foreach ($this->columns as $column => $config) {
if (isset($config['callback'])
&& method_exists($this, $config['c... | php | public function run()
{
$this->extractInteractions();
$this->data = $line = [];
foreach ($this->interactions as $interaction) {
foreach ($this->columns as $column => $config) {
if (isset($config['callback'])
&& method_exists($this, $config['c... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"extractInteractions",
"(",
")",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"line",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"interactions",
"as",
"$",
"interaction",
")",
... | Launch interactions extraction
Transform interactions array to output data
Use callback & valuesAsColumns
@return $this | [
"Launch",
"interactions",
"extraction",
"Transform",
"interactions",
"array",
"to",
"output",
"data",
"Use",
"callback",
"&",
"valuesAsColumns"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/extractor/QtiExtractor.php#L140-L168 |
oat-sa/extension-tao-itemqti | model/flyExporter/extractor/QtiExtractor.php | QtiExtractor.extractInteractions | protected function extractInteractions()
{
$elements = [
// Multiple choice
'Choice' => ['domInteraction' => 'choiceInteraction', 'xpathChoice' => './/qti:simpleChoice'],
'Order' => ['domInteraction' => 'orderInteraction', 'xpathChoice' => './/qti:s... | php | protected function extractInteractions()
{
$elements = [
// Multiple choice
'Choice' => ['domInteraction' => 'choiceInteraction', 'xpathChoice' => './/qti:simpleChoice'],
'Order' => ['domInteraction' => 'orderInteraction', 'xpathChoice' => './/qti:s... | [
"protected",
"function",
"extractInteractions",
"(",
")",
"{",
"$",
"elements",
"=",
"[",
"// Multiple choice",
"'Choice'",
"=>",
"[",
"'domInteraction'",
"=>",
"'choiceInteraction'",
",",
"'xpathChoice'",
"=>",
"'.//qti:simpleChoice'",
"]",
",",
"'Order'",
"=>",
"[... | Extract all interaction by find interaction node & relative choices
Find right answer & resolve identifier to choice name
Output example of item interactions:
array (
[...],
array(
"id" => "56e7d1397ad57",
"type" => "Match",
"choices" => array (
"M" => "Mouse",
"S" => "Soda",
"W" => "Wheel",
"D" => "DarthVader",
"A" =>... | [
"Extract",
"all",
"interaction",
"by",
"find",
"interaction",
"node",
"&",
"relative",
"choices",
"Find",
"right",
"answer",
"&",
"resolve",
"identifier",
"to",
"choice",
"name",
"Output",
"example",
"of",
"item",
"interactions",
":",
"array",
"(",
"[",
"...",... | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/extractor/QtiExtractor.php#L208-L325 |
oat-sa/extension-tao-itemqti | model/flyExporter/extractor/QtiExtractor.php | QtiExtractor.sanitizeNodeToValue | protected function sanitizeNodeToValue($value)
{
$first = strpos($value, '>')+1;
$last = strrpos($value, '<')-$first;
$value = substr($value, $first, $last);
$value = str_replace('"', "'", $value);
return trim($value);
} | php | protected function sanitizeNodeToValue($value)
{
$first = strpos($value, '>')+1;
$last = strrpos($value, '<')-$first;
$value = substr($value, $first, $last);
$value = str_replace('"', "'", $value);
return trim($value);
} | [
"protected",
"function",
"sanitizeNodeToValue",
"(",
"$",
"value",
")",
"{",
"$",
"first",
"=",
"strpos",
"(",
"$",
"value",
",",
"'>'",
")",
"+",
"1",
";",
"$",
"last",
"=",
"strrpos",
"(",
"$",
"value",
",",
"'<'",
")",
"-",
"$",
"first",
";",
... | Remove first and last xml tag from string
Transform variable to string value
@param $value
@return string | [
"Remove",
"first",
"and",
"last",
"xml",
"tag",
"from",
"string",
"Transform",
"variable",
"to",
"string",
"value"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/extractor/QtiExtractor.php#L334-L341 |
oat-sa/extension-tao-itemqti | model/flyExporter/extractor/QtiExtractor.php | QtiExtractor.getRightAnswer | public function getRightAnswer($interaction, $params)
{
$return = ['BR_identifier' => [], 'BR_label'=>[]];
if (isset($interaction['responses'])) {
foreach ($interaction['responses'] as $response) {
$allResponses = explode(' ', trim($response));
$returnLab... | php | public function getRightAnswer($interaction, $params)
{
$return = ['BR_identifier' => [], 'BR_label'=>[]];
if (isset($interaction['responses'])) {
foreach ($interaction['responses'] as $response) {
$allResponses = explode(' ', trim($response));
$returnLab... | [
"public",
"function",
"getRightAnswer",
"(",
"$",
"interaction",
",",
"$",
"params",
")",
"{",
"$",
"return",
"=",
"[",
"'BR_identifier'",
"=>",
"[",
"]",
",",
"'BR_label'",
"=>",
"[",
"]",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"interaction",
"[",
... | Callback to retrieve right answers
Find $responses & resolve identifier with $choices
@param $interaction
@return string | [
"Callback",
"to",
"retrieve",
"right",
"answers",
"Find",
"$responses",
"&",
"resolve",
"identifier",
"with",
"$choices"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/extractor/QtiExtractor.php#L350-L384 |
oat-sa/extension-tao-itemqti | model/flyExporter/extractor/QtiExtractor.php | QtiExtractor.getChoices | public function getChoices($interaction)
{
$return = [];
if (isset($interaction['choices'])) {
$i = 1;
foreach ($interaction['choices'] as $identifier => $choice) {
$return['choice_identifier_' . $i] = $identifier;
$return['choice_label_' . $i]... | php | public function getChoices($interaction)
{
$return = [];
if (isset($interaction['choices'])) {
$i = 1;
foreach ($interaction['choices'] as $identifier => $choice) {
$return['choice_identifier_' . $i] = $identifier;
$return['choice_label_' . $i]... | [
"public",
"function",
"getChoices",
"(",
"$",
"interaction",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"interaction",
"[",
"'choices'",
"]",
")",
")",
"{",
"$",
"i",
"=",
"1",
";",
"foreach",
"(",
"$",
"interaction"... | Callback to retrieve all choices
Add dynamic column to have same columns number as other
@param $interaction
@return array | [
"Callback",
"to",
"retrieve",
"all",
"choices",
"Add",
"dynamic",
"column",
"to",
"have",
"same",
"columns",
"number",
"as",
"other"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/extractor/QtiExtractor.php#L408-L429 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.getRule | public function getRule(){
$returnValue = (string) '';
foreach($this->components as $irp){
$returnValue .= $irp->getRule();
}
foreach($this->getCompositionRules() as $rule){
$returnValue .= $rule->getRule();
}
return (string) $returnValue;
} | php | public function getRule(){
$returnValue = (string) '';
foreach($this->components as $irp){
$returnValue .= $irp->getRule();
}
foreach($this->getCompositionRules() as $rule){
$returnValue .= $rule->getRule();
}
return (string) $returnValue;
} | [
"public",
"function",
"getRule",
"(",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"irp",
")",
"{",
"$",
"returnValue",
".=",
"$",
"irp",
"->",
"getRule",
"(",
")",
";... | Short description of method getRule
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"getRule"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L79-L90 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.create | public static function create(Item $item){
$returnValue = new Summation($item);
foreach($item->getInteractions() as $interaction){
$irp = InteractionResponseProcessing::create(
None::CLASS_ID
, $interaction->getResponse()
... | php | public static function create(Item $item){
$returnValue = new Summation($item);
foreach($item->getInteractions() as $interaction){
$irp = InteractionResponseProcessing::create(
None::CLASS_ID
, $interaction->getResponse()
... | [
"public",
"static",
"function",
"create",
"(",
"Item",
"$",
"item",
")",
"{",
"$",
"returnValue",
"=",
"new",
"Summation",
"(",
"$",
"item",
")",
";",
"foreach",
"(",
"$",
"item",
"->",
"getInteractions",
"(",
")",
"as",
"$",
"interaction",
")",
"{",
... | Short description of method create
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param Item item
@return oat\taoQtiItem\model\qti\response\ResponseProcessing | [
"Short",
"description",
"of",
"method",
"create"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L126-L138 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.takeOverFrom | public static function takeOverFrom(ResponseProcessing $responseProcessing, Item $item){
$returnValue = null;
if($responseProcessing instanceof static){
// already good
$returnValue = $responseProcessing;
}elseif($responseProcessing instanceof Template){
// I... | php | public static function takeOverFrom(ResponseProcessing $responseProcessing, Item $item){
$returnValue = null;
if($responseProcessing instanceof static){
// already good
$returnValue = $responseProcessing;
}elseif($responseProcessing instanceof Template){
// I... | [
"public",
"static",
"function",
"takeOverFrom",
"(",
"ResponseProcessing",
"$",
"responseProcessing",
",",
"Item",
"$",
"item",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"$",
"responseProcessing",
"instanceof",
"static",
")",
"{",
"// already go... | Short description of method takeOverFrom
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param ResponseProcessing responseProcessing
@param Item item
@return oat\taoQtiItem\model\qti\response\Composite | [
"Short",
"description",
"of",
"method",
"takeOverFrom"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L149-L194 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.getInteractionResponseProcessing | public function getInteractionResponseProcessing(ResponseDeclaration $response){
foreach($this->components as $irp){
if($irp->getResponse() == $response){
$returnValue = $irp;
break;
}
}
if(is_null($returnValue)){
throw new comm... | php | public function getInteractionResponseProcessing(ResponseDeclaration $response){
foreach($this->components as $irp){
if($irp->getResponse() == $response){
$returnValue = $irp;
break;
}
}
if(is_null($returnValue)){
throw new comm... | [
"public",
"function",
"getInteractionResponseProcessing",
"(",
"ResponseDeclaration",
"$",
"response",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"irp",
")",
"{",
"if",
"(",
"$",
"irp",
"->",
"getResponse",
"(",
")",
"==",
"$",
"... | Short description of method getInteractionResponseProcessing
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param Response response
@return oat\taoQtiItem\model\qti\response\interactionResponseProcessing\InteractionResponseProcessing | [
"Short",
"description",
"of",
"method",
"getInteractionResponseProcessing"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L216-L227 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.getIRPByOutcome | public function getIRPByOutcome(OutcomeDeclaration $outcome){
foreach($this->components as $irp){
if($irp->getOutcome() == $outcome){
$returnValue = $irp;
break;
}
}
return $returnValue;
} | php | public function getIRPByOutcome(OutcomeDeclaration $outcome){
foreach($this->components as $irp){
if($irp->getOutcome() == $outcome){
$returnValue = $irp;
break;
}
}
return $returnValue;
} | [
"public",
"function",
"getIRPByOutcome",
"(",
"OutcomeDeclaration",
"$",
"outcome",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"irp",
")",
"{",
"if",
"(",
"$",
"irp",
"->",
"getOutcome",
"(",
")",
"==",
"$",
"outcome",
")",
"... | Short description of method getIRPByOutcome
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param Outcome outcome
@return oat\taoQtiItem\model\qti\response\interactionResponseProcessing\InteractionResponseProcessing | [
"Short",
"description",
"of",
"method",
"getIRPByOutcome"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L237-L246 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.replace | public function replace(InteractionResponseProcessing $newInteractionResponseProcessing){
$oldkey = null;
foreach($this->components as $key => $component){
if($component->getResponse() == $newInteractionResponseProcessing->getResponse()){
$oldkey = $key;
break... | php | public function replace(InteractionResponseProcessing $newInteractionResponseProcessing){
$oldkey = null;
foreach($this->components as $key => $component){
if($component->getResponse() == $newInteractionResponseProcessing->getResponse()){
$oldkey = $key;
break... | [
"public",
"function",
"replace",
"(",
"InteractionResponseProcessing",
"$",
"newInteractionResponseProcessing",
")",
"{",
"$",
"oldkey",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"key",
"=>",
"$",
"component",
")",
"{",
"if"... | Short description of method replace
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param InteractionResponseProcessing newInteractionResponseProcessing
@return mixed | [
"Short",
"description",
"of",
"method",
"replace"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L256-L270 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.toQTI | public function toQTI(){
$returnValue = "<responseProcessing>";
foreach($this->components as $irp){
$returnValue .= $irp->toQTI();
}
$returnValue .= $this->getCompositionQTI();
$returnValue .= "</responseProcessing>";
return (string) $returnValue;
} | php | public function toQTI(){
$returnValue = "<responseProcessing>";
foreach($this->components as $irp){
$returnValue .= $irp->toQTI();
}
$returnValue .= $this->getCompositionQTI();
$returnValue .= "</responseProcessing>";
return (string) $returnValue;
} | [
"public",
"function",
"toQTI",
"(",
")",
"{",
"$",
"returnValue",
"=",
"\"<responseProcessing>\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"irp",
")",
"{",
"$",
"returnValue",
".=",
"$",
"irp",
"->",
"toQTI",
"(",
")",
";",
"}"... | Short description of method toQTI
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"toQTI"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L279-L288 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.takeNoticeOfAddedInteraction | public function takeNoticeOfAddedInteraction(Interaction $interaction, Item $item){
$irp = InteractionResponseProcessing::create(
MatchCorrectTemplate::CLASS_ID, $interaction->getResponse(), $item
);
$this->add($irp);
} | php | public function takeNoticeOfAddedInteraction(Interaction $interaction, Item $item){
$irp = InteractionResponseProcessing::create(
MatchCorrectTemplate::CLASS_ID, $interaction->getResponse(), $item
);
$this->add($irp);
} | [
"public",
"function",
"takeNoticeOfAddedInteraction",
"(",
"Interaction",
"$",
"interaction",
",",
"Item",
"$",
"item",
")",
"{",
"$",
"irp",
"=",
"InteractionResponseProcessing",
"::",
"create",
"(",
"MatchCorrectTemplate",
"::",
"CLASS_ID",
",",
"$",
"interaction"... | Short description of method takeNoticeOfAddedInteraction
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param Interaction interaction
@param Item item
@return mixed | [
"Short",
"description",
"of",
"method",
"takeNoticeOfAddedInteraction"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L299-L304 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.takeNoticeOfRemovedInteraction | public function takeNoticeOfRemovedInteraction(Interaction $interaction, Item $item){
$irpExisted = false;
foreach($this->components as $key => $irp){
if($irp->getResponse() === $interaction->getResponse()){
unset($this->components[$key]);
$irpExisted = true;
... | php | public function takeNoticeOfRemovedInteraction(Interaction $interaction, Item $item){
$irpExisted = false;
foreach($this->components as $key => $irp){
if($irp->getResponse() === $interaction->getResponse()){
unset($this->components[$key]);
$irpExisted = true;
... | [
"public",
"function",
"takeNoticeOfRemovedInteraction",
"(",
"Interaction",
"$",
"interaction",
",",
"Item",
"$",
"item",
")",
"{",
"$",
"irpExisted",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"key",
"=>",
"$",
"irp",
"... | Short description of method takeNoticeOfRemovedInteraction
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param Interaction interaction
@param Item item
@return mixed | [
"Short",
"description",
"of",
"method",
"takeNoticeOfRemovedInteraction"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L315-L327 |
oat-sa/extension-tao-itemqti | model/qti/response/Composite.php | Composite.getForm | public function getForm(ResponseDeclaration $response){
$formContainer = new CompositeResponseOptions($this, $response);
$returnValue = $formContainer->getForm();
return $returnValue;
} | php | public function getForm(ResponseDeclaration $response){
$formContainer = new CompositeResponseOptions($this, $response);
$returnValue = $formContainer->getForm();
return $returnValue;
} | [
"public",
"function",
"getForm",
"(",
"ResponseDeclaration",
"$",
"response",
")",
"{",
"$",
"formContainer",
"=",
"new",
"CompositeResponseOptions",
"(",
"$",
"this",
",",
"$",
"response",
")",
";",
"$",
"returnValue",
"=",
"$",
"formContainer",
"->",
"getFor... | Short description of method getForm
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param Response response
@return tao_helpers_form_Form | [
"Short",
"description",
"of",
"method",
"getForm"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Composite.php#L337-L342 |
oat-sa/extension-tao-itemqti | model/qti/interaction/ImsPortableCustomInteraction.php | ImsPortableCustomInteraction.feed | public function feed(ParserFactory $parser, DOMElement $data, QtiNamespace $xmlns = null){
$this->setNamespace($xmlns);
$xmlnsName = $xmlns->getName();
$pciNodes = $parser->queryXPathChildren(array('portableCustomInteraction'), $data, $xmlnsName);
if(!$pciNodes->length) {
$... | php | public function feed(ParserFactory $parser, DOMElement $data, QtiNamespace $xmlns = null){
$this->setNamespace($xmlns);
$xmlnsName = $xmlns->getName();
$pciNodes = $parser->queryXPathChildren(array('portableCustomInteraction'), $data, $xmlnsName);
if(!$pciNodes->length) {
$... | [
"public",
"function",
"feed",
"(",
"ParserFactory",
"$",
"parser",
",",
"DOMElement",
"$",
"data",
",",
"QtiNamespace",
"$",
"xmlns",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setNamespace",
"(",
"$",
"xmlns",
")",
";",
"$",
"xmlnsName",
"=",
"$",
"xm... | Feed the pci instance with data provided in the pci dom node
@param ParserFactory $parser
@param DOMElement $data
@throws InvalidArgumentException
@throws QtiModelException | [
"Feed",
"the",
"pci",
"instance",
"with",
"data",
"provided",
"in",
"the",
"pci",
"dom",
"node"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/interaction/ImsPortableCustomInteraction.php#L155-L217 |
oat-sa/extension-tao-itemqti | model/search/QtiItemContentTokenizer.php | QtiItemContentTokenizer.getStrings | public function getStrings(\core_kernel_classes_Resource $resource)
{
try {
$ontologyFiles = $resource->getPropertyValues($this->getProperty(taoItems_models_classes_ItemsService::PROPERTY_ITEM_CONTENT));
if (empty($ontologyFiles)) {
return [];
}
} ... | php | public function getStrings(\core_kernel_classes_Resource $resource)
{
try {
$ontologyFiles = $resource->getPropertyValues($this->getProperty(taoItems_models_classes_ItemsService::PROPERTY_ITEM_CONTENT));
if (empty($ontologyFiles)) {
return [];
}
} ... | [
"public",
"function",
"getStrings",
"(",
"\\",
"core_kernel_classes_Resource",
"$",
"resource",
")",
"{",
"try",
"{",
"$",
"ontologyFiles",
"=",
"$",
"resource",
"->",
"getPropertyValues",
"(",
"$",
"this",
"->",
"getProperty",
"(",
"taoItems_models_classes_ItemsSer... | Get tokens as string[] extracted from a QTI file
XML inside qti.xml is parsed and all text is tokenized
@param \core_kernel_classes_Resource $resource
@return array | [
"Get",
"tokens",
"as",
"string",
"[]",
"extracted",
"from",
"a",
"QTI",
"file",
"XML",
"inside",
"qti",
".",
"xml",
"is",
"parsed",
"and",
"all",
"text",
"is",
"tokenized"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/search/QtiItemContentTokenizer.php#L42-L81 |
oat-sa/extension-tao-itemqti | model/qti/PortableElementTrait.php | PortableElementTrait.serializePortableProperties | private function serializePortableProperties($properties, $ns = '', $nsUri = '', $name = null, $element = null){
$document = null;
$result = '';
if ($element === null) {
$document = new \DomDocument();
$element = $ns ?
$document->createElementNS($nsUri, $... | php | private function serializePortableProperties($properties, $ns = '', $nsUri = '', $name = null, $element = null){
$document = null;
$result = '';
if ($element === null) {
$document = new \DomDocument();
$element = $ns ?
$document->createElementNS($nsUri, $... | [
"private",
"function",
"serializePortableProperties",
"(",
"$",
"properties",
",",
"$",
"ns",
"=",
"''",
",",
"$",
"nsUri",
"=",
"''",
",",
"$",
"name",
"=",
"null",
",",
"$",
"element",
"=",
"null",
")",
"{",
"$",
"document",
"=",
"null",
";",
"$",
... | Serialize an associative array of pci properties into a pci xml
@param array $properties
@param string $ns
@return string | [
"Serialize",
"an",
"associative",
"array",
"of",
"pci",
"properties",
"into",
"a",
"pci",
"xml"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/PortableElementTrait.php#L81-L126 |
oat-sa/extension-tao-itemqti | model/qti/PortableElementTrait.php | PortableElementTrait.extractProperties | private function extractProperties(DOMElement $propertiesNode, $ns = ''){
$properties = array();
$ns = $ns ? trim( $ns, ':' ) . ':' : '';
foreach($propertiesNode->childNodes as $prop){
if($prop instanceof DOMElement){
switch($prop->tagName){
cas... | php | private function extractProperties(DOMElement $propertiesNode, $ns = ''){
$properties = array();
$ns = $ns ? trim( $ns, ':' ) . ':' : '';
foreach($propertiesNode->childNodes as $prop){
if($prop instanceof DOMElement){
switch($prop->tagName){
cas... | [
"private",
"function",
"extractProperties",
"(",
"DOMElement",
"$",
"propertiesNode",
",",
"$",
"ns",
"=",
"''",
")",
"{",
"$",
"properties",
"=",
"array",
"(",
")",
";",
"$",
"ns",
"=",
"$",
"ns",
"?",
"trim",
"(",
"$",
"ns",
",",
"':'",
")",
".",... | Parse a pci properties dom node into an associative array
@param DOMElement $propertiesNode
@param string $ns
@return array | [
"Parse",
"a",
"pci",
"properties",
"dom",
"node",
"into",
"an",
"associative",
"array"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/PortableElementTrait.php#L135-L158 |
oat-sa/extension-tao-itemqti | model/qti/response/ConditionalExpression.php | ConditionalExpression.getRule | public function getRule()
{
$returnValue = (string) '';
$returnValue = 'if('.$this->getCondition()->getRule().') {';
foreach ($this->getActions() as $actions) {
$returnValue .= $actions->getRule();
}
$returnValue .= '}';
... | php | public function getRule()
{
$returnValue = (string) '';
$returnValue = 'if('.$this->getCondition()->getRule().') {';
foreach ($this->getActions() as $actions) {
$returnValue .= $actions->getRule();
}
$returnValue .= '}';
... | [
"public",
"function",
"getRule",
"(",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"$",
"returnValue",
"=",
"'if('",
".",
"$",
"this",
"->",
"getCondition",
"(",
")",
"->",
"getRule",
"(",
")",
".",
"') {'",
";",
"foreach",
"(",
... | Short description of method getRule
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"getRule"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/ConditionalExpression.php#L68-L83 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php | ImsManifestMetadataInjector.setMappings | protected function setMappings(array $mappings = array())
{
foreach ($mappings as $mapping) {
if (!$mapping instanceof ImsManifestMapping) {
$msg = "The mappings argument must be an array composed of ImsManifestMapping objects";
throw new InvalidArgumentException(... | php | protected function setMappings(array $mappings = array())
{
foreach ($mappings as $mapping) {
if (!$mapping instanceof ImsManifestMapping) {
$msg = "The mappings argument must be an array composed of ImsManifestMapping objects";
throw new InvalidArgumentException(... | [
"protected",
"function",
"setMappings",
"(",
"array",
"$",
"mappings",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"mappings",
"as",
"$",
"mapping",
")",
"{",
"if",
"(",
"!",
"$",
"mapping",
"instanceof",
"ImsManifestMapping",
")",
"{",
"$",
... | Set the ImsManifestMapping objects of this injector.
@param ImsManifestMapping[] $mappings An array of ImsManifestMapping objects.
@throws InvalidArgumentException If $mappings contains objects/values different from ImsManifestMapping. | [
"Set",
"the",
"ImsManifestMapping",
"objects",
"of",
"this",
"injector",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php#L65-L75 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php | ImsManifestMetadataInjector.addMapping | public function addMapping(ImsManifestMapping $mapping)
{
$mappings = $this->getMappings();
$ns = $mapping->getNamespace();
if (isset($mappings[$ns]) === false) {
$mappings[$ns] = $mapping;
}
$this->setMappings($mappings);
} | php | public function addMapping(ImsManifestMapping $mapping)
{
$mappings = $this->getMappings();
$ns = $mapping->getNamespace();
if (isset($mappings[$ns]) === false) {
$mappings[$ns] = $mapping;
}
$this->setMappings($mappings);
} | [
"public",
"function",
"addMapping",
"(",
"ImsManifestMapping",
"$",
"mapping",
")",
"{",
"$",
"mappings",
"=",
"$",
"this",
"->",
"getMappings",
"(",
")",
";",
"$",
"ns",
"=",
"$",
"mapping",
"->",
"getNamespace",
"(",
")",
";",
"if",
"(",
"isset",
"("... | Add an XML mapping to this Manifest Extractor.
If a mapping with an already registered XML namespace is given as
a $mapping, it is simply ignored.
@param ImsManifestMapping $mapping An XML mapping. | [
"Add",
"an",
"XML",
"mapping",
"to",
"this",
"Manifest",
"Extractor",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php#L96-L107 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php | ImsManifestMetadataInjector.removeMapping | public function removeMapping(ImsManifestMapping $mapping)
{
$mappings = $this->getMappings();
if (($key = array_search($mapping, $mappings, true)) !== false) {
unset($mappings[$key]);
}
} | php | public function removeMapping(ImsManifestMapping $mapping)
{
$mappings = $this->getMappings();
if (($key = array_search($mapping, $mappings, true)) !== false) {
unset($mappings[$key]);
}
} | [
"public",
"function",
"removeMapping",
"(",
"ImsManifestMapping",
"$",
"mapping",
")",
"{",
"$",
"mappings",
"=",
"$",
"this",
"->",
"getMappings",
"(",
")",
";",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"mapping",
",",
"$",
"mappings",... | Remove an already registered ImsManifestMapping.
If $mapping cannot be found as a previously registered mapping, nothing happens.
@param ImsManifestMapping $mapping An ImsManifestMapping object. | [
"Remove",
"an",
"already",
"registered",
"ImsManifestMapping",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php#L116-L123 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php | ImsManifestMetadataInjector.inject | public function inject($target, array $values)
{
/** @var $target DOMDocument */
if(! $target instanceof DOMDocument){
throw new MetadataInjectionException(__('The target must be an instance of DOMDocument'));
}
$map = [];
// Inject the mapping in the root node
... | php | public function inject($target, array $values)
{
/** @var $target DOMDocument */
if(! $target instanceof DOMDocument){
throw new MetadataInjectionException(__('The target must be an instance of DOMDocument'));
}
$map = [];
// Inject the mapping in the root node
... | [
"public",
"function",
"inject",
"(",
"$",
"target",
",",
"array",
"$",
"values",
")",
"{",
"/** @var $target DOMDocument */",
"if",
"(",
"!",
"$",
"target",
"instanceof",
"DOMDocument",
")",
"{",
"throw",
"new",
"MetadataInjectionException",
"(",
"__",
"(",
"'... | Inject some MetadataValue objects into the $target DOMElement object.
The injection will take care of serializing the MetadataValue objects into the correct sections of the
the IMS Manifest File, by looking at previously registered IMSManifestMapping objects.
@throws MetadataInjectionException If $target is not a DOM... | [
"Inject",
"some",
"MetadataValue",
"objects",
"into",
"the",
"$target",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php#L159-L222 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php | ImsManifestMetadataInjector.createMetadataElement | protected function createMetadataElement(MetadataValue $metadata, DOMElement $metadataNode, $map, DOMDocument $imsManifest)
{
$path = $metadata->getPath();
$path = array_reverse($path);
$uniqNodes = [];
if ($metadata instanceof ClassificationValue) {
$uniqNodes = array('... | php | protected function createMetadataElement(MetadataValue $metadata, DOMElement $metadataNode, $map, DOMDocument $imsManifest)
{
$path = $metadata->getPath();
$path = array_reverse($path);
$uniqNodes = [];
if ($metadata instanceof ClassificationValue) {
$uniqNodes = array('... | [
"protected",
"function",
"createMetadataElement",
"(",
"MetadataValue",
"$",
"metadata",
",",
"DOMElement",
"$",
"metadataNode",
",",
"$",
"map",
",",
"DOMDocument",
"$",
"imsManifest",
")",
"{",
"$",
"path",
"=",
"$",
"metadata",
"->",
"getPath",
"(",
")",
... | Add an element based on MetadataValue object to DomDocument
@param MetadataValue $metadata
@param DOMElement $metadataNode
@param $map
@param DOMDocument $imsManifest | [
"Add",
"an",
"element",
"based",
"on",
"MetadataValue",
"object",
"to",
"DomDocument"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMetadataInjector.php#L232-L271 |
oat-sa/extension-tao-itemqti | model/compile/QtiItemCompilerAssetBlacklist.php | QtiItemCompilerAssetBlacklist.isBlacklisted | public function isBlacklisted($assetPath)
{
foreach ($this->blacklist as $pattern){
if(preg_match($pattern, $assetPath) === 1){
return true;
}
}
return false;
} | php | public function isBlacklisted($assetPath)
{
foreach ($this->blacklist as $pattern){
if(preg_match($pattern, $assetPath) === 1){
return true;
}
}
return false;
} | [
"public",
"function",
"isBlacklisted",
"(",
"$",
"assetPath",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"blacklist",
"as",
"$",
"pattern",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"assetPath",
")",
"===",
"1",
")",
"{",
"r... | Allow to know if a path is blacklisted or not
@param string $assetPath
@return bool | [
"Allow",
"to",
"know",
"if",
"a",
"path",
"is",
"blacklisted",
"or",
"not"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/compile/QtiItemCompilerAssetBlacklist.php#L57-L66 |
oat-sa/extension-tao-itemqti | model/qti/Parser.php | Parser.validate | public function validate($schema = ''){
if (empty($schema)) {
// Let's detect NS in use...
$dom = new DOMDocument('1.0', 'UTF-8');
switch($this->sourceType){
case self::SOURCE_FLYFILE:
if ($this->source->exists()) {
... | php | public function validate($schema = ''){
if (empty($schema)) {
// Let's detect NS in use...
$dom = new DOMDocument('1.0', 'UTF-8');
switch($this->sourceType){
case self::SOURCE_FLYFILE:
if ($this->source->exists()) {
... | [
"public",
"function",
"validate",
"(",
"$",
"schema",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"schema",
")",
")",
"{",
"// Let's detect NS in use...",
"$",
"dom",
"=",
"new",
"DOMDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
"switch",
"... | Run the validation process
@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param string $schema
@return bool
@throws \Exception
@throws \common_Exception | [
"Run",
"the",
"validation",
"process"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Parser.php#L60-L106 |
oat-sa/extension-tao-itemqti | model/qti/Parser.php | Parser.load | public function load($resolveXInclude = false){
$returnValue = null;
if(!$this->valid){
libxml_use_internal_errors(true); //retrieve errors if no validation has been done previously
}
//load it using the DOMDocument library
$xml = new DOMDocument();
... | php | public function load($resolveXInclude = false){
$returnValue = null;
if(!$this->valid){
libxml_use_internal_errors(true); //retrieve errors if no validation has been done previously
}
//load it using the DOMDocument library
$xml = new DOMDocument();
... | [
"public",
"function",
"load",
"(",
"$",
"resolveXInclude",
"=",
"false",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
")",
"{",
"libxml_use_internal_errors",
"(",
"true",
")",
";",
"//retrieve errors if no valid... | load the file content, parse it and build the a QTI_Item instance
@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param boolean resolveXInclude
@return \oat\taoQtiItem\model\qti\Item | [
"load",
"the",
"file",
"content",
"parse",
"it",
"and",
"build",
"the",
"a",
"QTI_Item",
"instance"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Parser.php#L116-L169 |
oat-sa/extension-tao-itemqti | model/portableElement/exception/PortableElementException.php | PortableElementException.getReportMessages | public function getReportMessages()
{
$messages = array();
/** @var \common_report_Report $subReport */
foreach ($this->report as $subReport) {
$errors = [];
if ($subReport->containsError()) {
$errors = $subReport->getErrors();
}
... | php | public function getReportMessages()
{
$messages = array();
/** @var \common_report_Report $subReport */
foreach ($this->report as $subReport) {
$errors = [];
if ($subReport->containsError()) {
$errors = $subReport->getErrors();
}
... | [
"public",
"function",
"getReportMessages",
"(",
")",
"{",
"$",
"messages",
"=",
"array",
"(",
")",
";",
"/** @var \\common_report_Report $subReport */",
"foreach",
"(",
"$",
"this",
"->",
"report",
"as",
"$",
"subReport",
")",
"{",
"$",
"errors",
"=",
"[",
"... | Extract all report messages to simple array
@return array | [
"Extract",
"all",
"report",
"messages",
"to",
"simple",
"array"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/exception/PortableElementException.php#L68-L83 |
oat-sa/extension-tao-itemqti | model/AbstractInteractionRegistry.php | AbstractInteractionRegistry.set | public function set($qtiClass, $phpClass)
{
if (! class_exists($phpClass)) {
throw new common_exception_Error('Custom interaction class ' . $phpClass . ' not found');
}
if (! is_subclass_of($phpClass, $this->getInteractionClass())) {
throw new common_exception_Error('... | php | public function set($qtiClass, $phpClass)
{
if (! class_exists($phpClass)) {
throw new common_exception_Error('Custom interaction class ' . $phpClass . ' not found');
}
if (! is_subclass_of($phpClass, $this->getInteractionClass())) {
throw new common_exception_Error('... | [
"public",
"function",
"set",
"(",
"$",
"qtiClass",
",",
"$",
"phpClass",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"phpClass",
")",
")",
"{",
"throw",
"new",
"common_exception_Error",
"(",
"'Custom interaction class '",
".",
"$",
"phpClass",
".",
... | Register a new custom interaction
@param string $qtiClass
@param string $phpClass
@throws common_exception_Error | [
"Register",
"a",
"new",
"custom",
"interaction"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/AbstractInteractionRegistry.php#L47-L57 |
oat-sa/extension-tao-itemqti | model/qti/asset/handler/LocalAssetHandler.php | LocalAssetHandler.handle | public function handle($absolutePath, $relativePath)
{
if (!$this->itemSource) {
throw new \common_Exception('Missing required parameter: item source');
}
// store locally, in a safe directory
$safePath = '';
if (dirname($relativePath) !== '.') {
$saf... | php | public function handle($absolutePath, $relativePath)
{
if (!$this->itemSource) {
throw new \common_Exception('Missing required parameter: item source');
}
// store locally, in a safe directory
$safePath = '';
if (dirname($relativePath) !== '.') {
$saf... | [
"public",
"function",
"handle",
"(",
"$",
"absolutePath",
",",
"$",
"relativePath",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"itemSource",
")",
"{",
"throw",
"new",
"\\",
"common_Exception",
"(",
"'Missing required parameter: item source'",
")",
";",
"}",
... | Handle the process to add file from $itemSource->add()
@param $absolutePath
@param $relativePath
@return array
@throws \common_Exception
@throws \common_exception_Error | [
"Handle",
"the",
"process",
"to",
"add",
"file",
"from",
"$itemSource",
"-",
">",
"add",
"()"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/asset/handler/LocalAssetHandler.php#L53-L68 |
oat-sa/extension-tao-itemqti | model/QtiJsonItemCompiler.php | QtiJsonItemCompiler.compileJson | public function compileJson()
{
$report = $this->internalCompile();
if ($report->getType() == common_report_Report::TYPE_SUCCESS) {
// replace instances with strign identifiers
list($item, $publicDirectory, $privateDirectory) = $report->getData();
$report->setData... | php | public function compileJson()
{
$report = $this->internalCompile();
if ($report->getType() == common_report_Report::TYPE_SUCCESS) {
// replace instances with strign identifiers
list($item, $publicDirectory, $privateDirectory) = $report->getData();
$report->setData... | [
"public",
"function",
"compileJson",
"(",
")",
"{",
"$",
"report",
"=",
"$",
"this",
"->",
"internalCompile",
"(",
")",
";",
"if",
"(",
"$",
"report",
"->",
"getType",
"(",
")",
"==",
"common_report_Report",
"::",
"TYPE_SUCCESS",
")",
"{",
"// replace inst... | Generate JSON version of item
@return array consists of item URI, public directory id and private directory id | [
"Generate",
"JSON",
"version",
"of",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiJsonItemCompiler.php#L56-L65 |
oat-sa/extension-tao-itemqti | model/QtiJsonItemCompiler.php | QtiJsonItemCompiler.deployQtiItem | protected function deployQtiItem(
core_kernel_classes_Resource $item,
$language,
tao_models_classes_service_StorageDirectory $publicDirectory,
tao_models_classes_service_StorageDirectory $privateDirectory
)
{
$qtiService = Service::singleton();
// retrieve the m... | php | protected function deployQtiItem(
core_kernel_classes_Resource $item,
$language,
tao_models_classes_service_StorageDirectory $publicDirectory,
tao_models_classes_service_StorageDirectory $privateDirectory
)
{
$qtiService = Service::singleton();
// retrieve the m... | [
"protected",
"function",
"deployQtiItem",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"$",
"language",
",",
"tao_models_classes_service_StorageDirectory",
"$",
"publicDirectory",
",",
"tao_models_classes_service_StorageDirectory",
"$",
"privateDirectory",
")",
"{",
... | Desploy all the required files into the provided directories
@param core_kernel_classes_Resource $item
@param string $language
@param tao_models_classes_service_StorageDirectory $publicDirectory
@param tao_models_classes_service_StorageDirectory $privateDirectory
@return common_report_Report | [
"Desploy",
"all",
"the",
"required",
"files",
"into",
"the",
"provided",
"directories"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiJsonItemCompiler.php#L76-L126 |
oat-sa/extension-tao-itemqti | model/QtiJsonItemCompiler.php | QtiJsonItemCompiler.getItemPortableElements | private function getItemPortableElements(Element $qtiItem){
$portableElementService = new PortableElementService();
$portableElementService->setServiceLocator($this->getServiceLocator());
return [
'pci' => $portableElementService->getPortableElementByClass(PortableElementService::POR... | php | private function getItemPortableElements(Element $qtiItem){
$portableElementService = new PortableElementService();
$portableElementService->setServiceLocator($this->getServiceLocator());
return [
'pci' => $portableElementService->getPortableElementByClass(PortableElementService::POR... | [
"private",
"function",
"getItemPortableElements",
"(",
"Element",
"$",
"qtiItem",
")",
"{",
"$",
"portableElementService",
"=",
"new",
"PortableElementService",
"(",
")",
";",
"$",
"portableElementService",
"->",
"setServiceLocator",
"(",
"$",
"this",
"->",
"getServ... | Get the portable elements data in use in the item
@param Element $qtiItem
@return array | [
"Get",
"the",
"portable",
"elements",
"data",
"in",
"use",
"in",
"the",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiJsonItemCompiler.php#L133-L140 |
oat-sa/extension-tao-itemqti | model/QtiJsonItemCompiler.php | QtiJsonItemCompiler.getMetadataProperties | private function getMetadataProperties()
{
$triples = $this->getResource()->getRdfTriples();
$properties = [];
foreach ($triples as $triple){
$properties[$triple->predicate] = $triple->object;
}
//we also include a shortcut to the item URI
$properties['@ur... | php | private function getMetadataProperties()
{
$triples = $this->getResource()->getRdfTriples();
$properties = [];
foreach ($triples as $triple){
$properties[$triple->predicate] = $triple->object;
}
//we also include a shortcut to the item URI
$properties['@ur... | [
"private",
"function",
"getMetadataProperties",
"(",
")",
"{",
"$",
"triples",
"=",
"$",
"this",
"->",
"getResource",
"(",
")",
"->",
"getRdfTriples",
"(",
")",
";",
"$",
"properties",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"triples",
"as",
"$",
"tri... | Get the item properties as compiled metadata
@return array | [
"Get",
"the",
"item",
"properties",
"as",
"compiled",
"metadata"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiJsonItemCompiler.php#L146-L156 |
oat-sa/extension-tao-itemqti | model/Export/MetadataExporterForm.php | MetadataExporterForm.initForm | public function initForm()
{
$this->form = new \tao_helpers_form_xhtml_Form('export');
$this->form->setDecorators(array(
'element' => new \tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div')),
'group' => new \tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', '... | php | public function initForm()
{
$this->form = new \tao_helpers_form_xhtml_Form('export');
$this->form->setDecorators(array(
'element' => new \tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div')),
'group' => new \tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', '... | [
"public",
"function",
"initForm",
"(",
")",
"{",
"$",
"this",
"->",
"form",
"=",
"new",
"\\",
"tao_helpers_form_xhtml_Form",
"(",
"'export'",
")",
";",
"$",
"this",
"->",
"form",
"->",
"setDecorators",
"(",
"array",
"(",
"'element'",
"=>",
"new",
"\\",
"... | Create a form
@throws \Exception
@throws \common_Exception | [
"Create",
"a",
"form"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/MetadataExporterForm.php#L31-L54 |
oat-sa/extension-tao-itemqti | model/Export/MetadataExporterForm.php | MetadataExporterForm.initElements | public function initElements()
{
$date = new \DateTime();
$filename = 'metadata-' . $date->format('ymd');
$nameElt = \tao_helpers_form_FormFactory::getElement('filename', 'Textbox');
$nameElt->setDescription(__('File name'));
$nameElt->setValue($filename);
$nameElt->... | php | public function initElements()
{
$date = new \DateTime();
$filename = 'metadata-' . $date->format('ymd');
$nameElt = \tao_helpers_form_FormFactory::getElement('filename', 'Textbox');
$nameElt->setDescription(__('File name'));
$nameElt->setValue($filename);
$nameElt->... | [
"public",
"function",
"initElements",
"(",
")",
"{",
"$",
"date",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"filename",
"=",
"'metadata-'",
".",
"$",
"date",
"->",
"format",
"(",
"'ymd'",
")",
";",
"$",
"nameElt",
"=",
"\\",
"tao_helpers_form_F... | Init filename field
@throws \common_Exception | [
"Init",
"filename",
"field"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/MetadataExporterForm.php#L61-L74 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.fetch | public function fetch($identifier, $version=null)
{
$portableElements = $this->getAllVersions($identifier);
// No version, return latest version
if (is_null($version)) {
$this->krsortByVersion($portableElements);
return $this->getModel()->createDataObject(reset($port... | php | public function fetch($identifier, $version=null)
{
$portableElements = $this->getAllVersions($identifier);
// No version, return latest version
if (is_null($version)) {
$this->krsortByVersion($portableElements);
return $this->getModel()->createDataObject(reset($port... | [
"public",
"function",
"fetch",
"(",
"$",
"identifier",
",",
"$",
"version",
"=",
"null",
")",
"{",
"$",
"portableElements",
"=",
"$",
"this",
"->",
"getAllVersions",
"(",
"$",
"identifier",
")",
";",
"// No version, return latest version",
"if",
"(",
"is_null"... | Fetch a portable element with identifier & version
@param $identifier
@param null $version
@return PortableElementObject
@throws PortableElementNotFoundException | [
"Fetch",
"a",
"portable",
"element",
"with",
"identifier",
"&",
"version"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L79-L99 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.getAllVersions | protected function getAllVersions($identifier)
{
$portableElements = $this->get($identifier);
// No portable element found
if ($portableElements == '') {
throw new PortableElementNotFoundException(
$this->getModel()->getId() . ' with identifier "' . $identifier .... | php | protected function getAllVersions($identifier)
{
$portableElements = $this->get($identifier);
// No portable element found
if ($portableElements == '') {
throw new PortableElementNotFoundException(
$this->getModel()->getId() . ' with identifier "' . $identifier .... | [
"protected",
"function",
"getAllVersions",
"(",
"$",
"identifier",
")",
"{",
"$",
"portableElements",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"identifier",
")",
";",
"// No portable element found",
"if",
"(",
"$",
"portableElements",
"==",
"''",
")",
"{",
"... | Get all record versions regarding $model->getTypeIdentifier()
@param string $identifier
@return array
@throws PortableElementNotFoundException
@throws PortableElementInconsistencyModelException | [
"Get",
"all",
"record",
"versions",
"regarding",
"$model",
"-",
">",
"getTypeIdentifier",
"()"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L109-L121 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.get | private function get($identifier)
{
$fileSystem= $this->getConfigFileSystem();
if($fileSystem->has($identifier)){
return json_decode($fileSystem->read($identifier),true);
}
return false;
} | php | private function get($identifier)
{
$fileSystem= $this->getConfigFileSystem();
if($fileSystem->has($identifier)){
return json_decode($fileSystem->read($identifier),true);
}
return false;
} | [
"private",
"function",
"get",
"(",
"$",
"identifier",
")",
"{",
"$",
"fileSystem",
"=",
"$",
"this",
"->",
"getConfigFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fileSystem",
"->",
"has",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
"json_decode",
... | Retrieve the given element from list of portable element
@param string $identifier
@return string | [
"Retrieve",
"the",
"given",
"element",
"from",
"list",
"of",
"portable",
"element"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L128-L137 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.removeAll | public function removeAll()
{
$portableElements = $this->getAll();
foreach ($portableElements as $identifier => $versions) {
$this->removeAllVersions($identifier);
}
} | php | public function removeAll()
{
$portableElements = $this->getAll();
foreach ($portableElements as $identifier => $versions) {
$this->removeAllVersions($identifier);
}
} | [
"public",
"function",
"removeAll",
"(",
")",
"{",
"$",
"portableElements",
"=",
"$",
"this",
"->",
"getAll",
"(",
")",
";",
"foreach",
"(",
"$",
"portableElements",
"as",
"$",
"identifier",
"=>",
"$",
"versions",
")",
"{",
"$",
"this",
"->",
"removeAllVe... | Unregister all previously registered pci, in all version
Remove all assets | [
"Unregister",
"all",
"previously",
"registered",
"pci",
"in",
"all",
"version",
"Remove",
"all",
"assets"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L260-L266 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.unregister | public function unregister(PortableElementObject $object)
{
$object = $this->fetch($object->getTypeIdentifier(), $object->getVersion());
if (! $object->hasVersion()) {
$this->removeAllVersions($object);
} else {
$this->removeAssets($object);
$this->delete... | php | public function unregister(PortableElementObject $object)
{
$object = $this->fetch($object->getTypeIdentifier(), $object->getVersion());
if (! $object->hasVersion()) {
$this->removeAllVersions($object);
} else {
$this->removeAssets($object);
$this->delete... | [
"public",
"function",
"unregister",
"(",
"PortableElementObject",
"$",
"object",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"fetch",
"(",
"$",
"object",
"->",
"getTypeIdentifier",
"(",
")",
",",
"$",
"object",
"->",
"getVersion",
"(",
")",
")",
";"... | Unregister portable element by removing the given version data & asset files
If $model doesn't have version, all versions will be removed
@param PortableElementObject $object
@throws PortableElementNotFoundException
@throws PortableElementVersionIncompatibilityException
@throws \common_Exception | [
"Unregister",
"portable",
"element",
"by",
"removing",
"the",
"given",
"version",
"data",
"&",
"asset",
"files",
"If",
"$model",
"doesn",
"t",
"have",
"version",
"all",
"versions",
"will",
"be",
"removed"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L277-L287 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.getFilesFromPortableElement | protected function getFilesFromPortableElement(PortableElementObject $object)
{
$validator = $object->getModel()->getValidator();
return $validator->getAssets($object);
} | php | protected function getFilesFromPortableElement(PortableElementObject $object)
{
$validator = $object->getModel()->getValidator();
return $validator->getAssets($object);
} | [
"protected",
"function",
"getFilesFromPortableElement",
"(",
"PortableElementObject",
"$",
"object",
")",
"{",
"$",
"validator",
"=",
"$",
"object",
"->",
"getModel",
"(",
")",
"->",
"getValidator",
"(",
")",
";",
"return",
"$",
"validator",
"->",
"getAssets",
... | Get list of files following Pci Model
@param PortableElementObject $object
@return array
@throws \common_Exception | [
"Get",
"list",
"of",
"files",
"following",
"Pci",
"Model"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L347-L351 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.getRuntime | protected function getRuntime(PortableElementObject $object)
{
$object = $this->fetch($object->getTypeIdentifier(), $object->getVersion());
$runtime = $object->toArray();
$runtime['model'] = $object->getModelId();
$runtime['xmlns'] = $object->getNamespace();
$runtime['runtime... | php | protected function getRuntime(PortableElementObject $object)
{
$object = $this->fetch($object->getTypeIdentifier(), $object->getVersion());
$runtime = $object->toArray();
$runtime['model'] = $object->getModelId();
$runtime['xmlns'] = $object->getNamespace();
$runtime['runtime... | [
"protected",
"function",
"getRuntime",
"(",
"PortableElementObject",
"$",
"object",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"fetch",
"(",
"$",
"object",
"->",
"getTypeIdentifier",
"(",
")",
",",
"$",
"object",
"->",
"getVersion",
"(",
")",
")",
... | Return the runtime of a portable element
@param PortableElementObject $object
@return PortableElementObject
@throws PortableElementNotFoundException | [
"Return",
"the",
"runtime",
"of",
"a",
"portable",
"element"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L360-L370 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.getAliasVersion | private function getAliasVersion($versionString){
if(preg_match('/^[0-9]+\.[0-9]+\.\*$/', $versionString)){
//already an alias version string
return $versionString;
}else{
$version = SemVerParser::parse($versionString);
return $version->getMajor().'.'.$ver... | php | private function getAliasVersion($versionString){
if(preg_match('/^[0-9]+\.[0-9]+\.\*$/', $versionString)){
//already an alias version string
return $versionString;
}else{
$version = SemVerParser::parse($versionString);
return $version->getMajor().'.'.$ver... | [
"private",
"function",
"getAliasVersion",
"(",
"$",
"versionString",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^[0-9]+\\.[0-9]+\\.\\*$/'",
",",
"$",
"versionString",
")",
")",
"{",
"//already an alias version string",
"return",
"$",
"versionString",
";",
"}",
"else... | Get the alias version for a given version number, e.g. 2.1.5 becomes 2.1.*
@param $versionString
@return mixed | [
"Get",
"the",
"alias",
"version",
"for",
"a",
"given",
"version",
"number",
"e",
".",
"g",
".",
"2",
".",
"1",
".",
"5",
"becomes",
"2",
".",
"1",
".",
"*"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L377-L385 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.removeAssets | protected function removeAssets(PortableElementObject $object)
{
if (! $object->hasVersion()) {
throw new PortableElementVersionIncompatibilityException('Unable to delete asset files whitout model version.');
}
$object = $this->fetch($object->getTypeIdentifier(), $object->getVer... | php | protected function removeAssets(PortableElementObject $object)
{
if (! $object->hasVersion()) {
throw new PortableElementVersionIncompatibilityException('Unable to delete asset files whitout model version.');
}
$object = $this->fetch($object->getTypeIdentifier(), $object->getVer... | [
"protected",
"function",
"removeAssets",
"(",
"PortableElementObject",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"->",
"hasVersion",
"(",
")",
")",
"{",
"throw",
"new",
"PortableElementVersionIncompatibilityException",
"(",
"'Unable to delete asset files... | Remove all registered files for a PCI identifier from FileSystem
If $targetedVersion is given, remove only assets for this version
@param PortableElementObject $object
@return bool
@throws \common_Exception | [
"Remove",
"all",
"registered",
"files",
"for",
"a",
"PCI",
"identifier",
"from",
"FileSystem",
"If",
"$targetedVersion",
"is",
"given",
"remove",
"only",
"assets",
"for",
"this",
"version"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L445-L474 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.export | public function export(PortableElementObject $object)
{
$zip = new \ZipArchive();
$path = $this->getZipLocation($object);
if ($zip->open($path, \ZipArchive::CREATE) !== TRUE) {
throw new \common_Exception('Unable to create zipfile ' . $path);
}
$manifest = $this... | php | public function export(PortableElementObject $object)
{
$zip = new \ZipArchive();
$path = $this->getZipLocation($object);
if ($zip->open($path, \ZipArchive::CREATE) !== TRUE) {
throw new \common_Exception('Unable to create zipfile ' . $path);
}
$manifest = $this... | [
"public",
"function",
"export",
"(",
"PortableElementObject",
"$",
"object",
")",
"{",
"$",
"zip",
"=",
"new",
"\\",
"ZipArchive",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getZipLocation",
"(",
"$",
"object",
")",
";",
"if",
"(",
"$",
"zi... | Export a portable element to a zip package
@param PortableElementObject $object
@return string
@throws \common_Exception | [
"Export",
"a",
"portable",
"element",
"to",
"a",
"zip",
"package"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L505-L529 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementRegistry.php | PortableElementRegistry.getFileSystem | public function getFileSystem()
{
if (! $this->storage) {
$this->storage = $this->getServiceLocator()->get(PortableElementFileStorage::SERVICE_ID);
$this->storage->setServiceLocator($this->getServiceLocator());
$this->storage->setModel($this->getModel());
}
... | php | public function getFileSystem()
{
if (! $this->storage) {
$this->storage = $this->getServiceLocator()->get(PortableElementFileStorage::SERVICE_ID);
$this->storage->setServiceLocator($this->getServiceLocator());
$this->storage->setModel($this->getModel());
}
... | [
"public",
"function",
"getFileSystem",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"storage",
")",
"{",
"$",
"this",
"->",
"storage",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"PortableElementFileStorage",
"::",
"SERV... | Get the fly filesystem based on OPTION_FS configuration
@return PortableElementFileStorage | [
"Get",
"the",
"fly",
"filesystem",
"based",
"on",
"OPTION_FS",
"configuration"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementRegistry.php#L536-L544 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.