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 | helpers/CssHelper.php | CssHelper.downloadCssFile | public static function downloadCssFile(\core_kernel_classes_resource $item, $lang, $styleSheetPath){
$directory = \taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);
$file = $directory->getFile($styleSheetPath);
if ($file->exists()) {
return $file->re... | php | public static function downloadCssFile(\core_kernel_classes_resource $item, $lang, $styleSheetPath){
$directory = \taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);
$file = $directory->getFile($styleSheetPath);
if ($file->exists()) {
return $file->re... | [
"public",
"static",
"function",
"downloadCssFile",
"(",
"\\",
"core_kernel_classes_resource",
"$",
"item",
",",
"$",
"lang",
",",
"$",
"styleSheetPath",
")",
"{",
"$",
"directory",
"=",
"\\",
"taoItems_models_classes_ItemsService",
"::",
"singleton",
"(",
")",
"->... | Download existing CSS file
@param \core_kernel_classes_resource $item
@param string $lang
@param string $styleSheetPath
@return string css on success | [
"Download",
"existing",
"CSS",
"file"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/CssHelper.php#L63-L71 |
oat-sa/extension-tao-itemqti | helpers/CssHelper.php | CssHelper.arrayToCss | public static function arrayToCss($array){
$css = '';
// rebuild CSS
foreach($array as $key1 => $value1){
$css .= $key1 . '{';
foreach($value1 as $key2 => $value2){
// in the case that the code is embedded in a media query
if(is_array($va... | php | public static function arrayToCss($array){
$css = '';
// rebuild CSS
foreach($array as $key1 => $value1){
$css .= $key1 . '{';
foreach($value1 as $key2 => $value2){
// in the case that the code is embedded in a media query
if(is_array($va... | [
"public",
"static",
"function",
"arrayToCss",
"(",
"$",
"array",
")",
"{",
"$",
"css",
"=",
"''",
";",
"// rebuild CSS",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key1",
"=>",
"$",
"value1",
")",
"{",
"$",
"css",
".=",
"$",
"key1",
".",
"'{'",
";",... | Convert incoming CSS array to proper CSS
@param $array
@return string | [
"Convert",
"incoming",
"CSS",
"array",
"to",
"proper",
"CSS"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/CssHelper.php#L120-L146 |
oat-sa/extension-tao-itemqti | helpers/CssHelper.php | CssHelper.loadCssFile | public static function loadCssFile(\core_kernel_classes_resource $item, $lang, $styleSheet) {
$directory = \taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);
// no user style sheet has been created yet
$file = $directory->getFile($styleSheet);
if (! $fi... | php | public static function loadCssFile(\core_kernel_classes_resource $item, $lang, $styleSheet) {
$directory = \taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);
// no user style sheet has been created yet
$file = $directory->getFile($styleSheet);
if (! $fi... | [
"public",
"static",
"function",
"loadCssFile",
"(",
"\\",
"core_kernel_classes_resource",
"$",
"item",
",",
"$",
"lang",
",",
"$",
"styleSheet",
")",
"{",
"$",
"directory",
"=",
"\\",
"taoItems_models_classes_ItemsService",
"::",
"singleton",
"(",
")",
"->",
"ge... | Loads the content of a css file into a css array
Returns an empty stylesheet if it does not yet exist
@param \core_kernel_classes_resource $item
@param string $lang
@param string $styleSheet
@return array array with structure of 'selector' => rules | [
"Loads",
"the",
"content",
"of",
"a",
"css",
"file",
"into",
"a",
"css",
"array",
"Returns",
"an",
"empty",
"stylesheet",
"if",
"it",
"does",
"not",
"yet",
"exist"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/CssHelper.php#L157-L169 |
oat-sa/extension-tao-itemqti | helpers/QtiRunner.php | QtiRunner.getVariableValues | public static function getVariableValues(Variable $variable) {
$returnValue = array();
$baseType = $variable->getBaseType();
$cardinalityType = $variable->getCardinality();
$value = $variable->getValue();
// This only works if the variable has a value ;)
if ($v... | php | public static function getVariableValues(Variable $variable) {
$returnValue = array();
$baseType = $variable->getBaseType();
$cardinalityType = $variable->getCardinality();
$value = $variable->getValue();
// This only works if the variable has a value ;)
if ($v... | [
"public",
"static",
"function",
"getVariableValues",
"(",
"Variable",
"$",
"variable",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"$",
"baseType",
"=",
"$",
"variable",
"->",
"getBaseType",
"(",
")",
";",
"$",
"cardinalityType",
"=",
"$",
... | Get the intrinsic values of a given QTI $variable.
@param Variable $variable
@return array | [
"Get",
"the",
"intrinsic",
"values",
"of",
"a",
"given",
"QTI",
"$variable",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/QtiRunner.php#L48-L76 |
oat-sa/extension-tao-itemqti | helpers/QtiRunner.php | QtiRunner.getPrivatePathByLanguage | public static function getPrivatePathByLanguage(tao_models_classes_service_StorageDirectory $directory) {
$lang = \common_session_SessionManager::getSession()->getDataLanguage();
if (!$directory->has($lang) && $directory->has(DEFAULT_LANG)) {
$lang = DEFAULT_LANG;
}
... | php | public static function getPrivatePathByLanguage(tao_models_classes_service_StorageDirectory $directory) {
$lang = \common_session_SessionManager::getSession()->getDataLanguage();
if (!$directory->has($lang) && $directory->has(DEFAULT_LANG)) {
$lang = DEFAULT_LANG;
}
... | [
"public",
"static",
"function",
"getPrivatePathByLanguage",
"(",
"tao_models_classes_service_StorageDirectory",
"$",
"directory",
")",
"{",
"$",
"lang",
"=",
"\\",
"common_session_SessionManager",
"::",
"getSession",
"(",
")",
"->",
"getDataLanguage",
"(",
")",
";",
"... | Get the flysystem path to the compilation folder described by $directory.
@param tao_models_classes_service_StorageDirectory $directory The root directory resource where the item is stored.
@return string The flysystem path to the private folder with a trailing directory separator. | [
"Get",
"the",
"flysystem",
"path",
"to",
"the",
"compilation",
"folder",
"described",
"by",
"$directory",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/QtiRunner.php#L84-L92 |
oat-sa/extension-tao-itemqti | helpers/QtiRunner.php | QtiRunner.getContentVariableElements | public static function getContentVariableElements(tao_models_classes_service_StorageDirectory $directory)
{
$jsonFile = self::getPrivatePathByLanguage($directory) . 'variableElements.json';
$data = $directory->read($jsonFile);
return json_decode($data, true);
} | php | public static function getContentVariableElements(tao_models_classes_service_StorageDirectory $directory)
{
$jsonFile = self::getPrivatePathByLanguage($directory) . 'variableElements.json';
$data = $directory->read($jsonFile);
return json_decode($data, true);
} | [
"public",
"static",
"function",
"getContentVariableElements",
"(",
"tao_models_classes_service_StorageDirectory",
"$",
"directory",
")",
"{",
"$",
"jsonFile",
"=",
"self",
"::",
"getPrivatePathByLanguage",
"(",
"$",
"directory",
")",
".",
"'variableElements.json'",
";",
... | Get the JSON QTI Model representing the elements (A.K.A. components) that vary over time for
the item stored in $directory.
@param tao_models_classes_service_StorageDirectory $directory
@return array A JSON decoded array. | [
"Get",
"the",
"JSON",
"QTI",
"Model",
"representing",
"the",
"elements",
"(",
"A",
".",
"K",
".",
"A",
".",
"components",
")",
"that",
"vary",
"over",
"time",
"for",
"the",
"item",
"stored",
"in",
"$directory",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/QtiRunner.php#L101-L106 |
oat-sa/extension-tao-itemqti | helpers/QtiRunner.php | QtiRunner.getRubricBlocks | public static function getRubricBlocks(tao_models_classes_service_StorageDirectory $directory, $view) {
$returnValue = array();
$elements = self::getContentVariableElements($directory);
foreach ($elements as $serial => $data) {
if (isset($data['qti... | php | public static function getRubricBlocks(tao_models_classes_service_StorageDirectory $directory, $view) {
$returnValue = array();
$elements = self::getContentVariableElements($directory);
foreach ($elements as $serial => $data) {
if (isset($data['qti... | [
"public",
"static",
"function",
"getRubricBlocks",
"(",
"tao_models_classes_service_StorageDirectory",
"$",
"directory",
",",
"$",
"view",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"$",
"elements",
"=",
"self",
"::",
"getContentVariableElements",
... | Get rubric block visible by the given "view"
@param tao_models_classes_service_StorageDirectory $directory
@param type $view
@return array | [
"Get",
"rubric",
"block",
"visible",
"by",
"the",
"given",
"view"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/QtiRunner.php#L115-L132 |
oat-sa/extension-tao-itemqti | helpers/QtiRunner.php | QtiRunner.getFeedbacks | public static function getFeedbacks(tao_models_classes_service_StorageDirectory $directory, AssessmentItemSession $itemSession) {
$returnValue = array();
$feedbackClasses = array('modalFeedback', 'feedbackInline', 'feedbackBlock');
$elements = self::getContentVariableElements($... | php | public static function getFeedbacks(tao_models_classes_service_StorageDirectory $directory, AssessmentItemSession $itemSession) {
$returnValue = array();
$feedbackClasses = array('modalFeedback', 'feedbackInline', 'feedbackBlock');
$elements = self::getContentVariableElements($... | [
"public",
"static",
"function",
"getFeedbacks",
"(",
"tao_models_classes_service_StorageDirectory",
"$",
"directory",
",",
"AssessmentItemSession",
"$",
"itemSession",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"$",
"feedbackClasses",
"=",
"array",
"... | Get the feedback to be displayed on an AssessmentItemSession
@param tao_models_classes_service_StorageDirectory $directory
@param \qtism\runtime\tests\AssessmentItemSession $itemSession
@return array | [
"Get",
"the",
"feedback",
"to",
"be",
"displayed",
"on",
"an",
"AssessmentItemSession"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/QtiRunner.php#L141-L184 |
oat-sa/extension-tao-itemqti | model/themes/ItemThemeInstaller.php | ItemThemeInstaller.remove | public function remove($themeIds) {
$themeIds = (array)$themeIds;
foreach($themeIds as $themeId) {
$prefixedId = $this->getPrefixedThemeId($themeId);
if(!$this->themeExists($prefixedId)) {
continue;
}
$this->registry->unregisterTheme($prefi... | php | public function remove($themeIds) {
$themeIds = (array)$themeIds;
foreach($themeIds as $themeId) {
$prefixedId = $this->getPrefixedThemeId($themeId);
if(!$this->themeExists($prefixedId)) {
continue;
}
$this->registry->unregisterTheme($prefi... | [
"public",
"function",
"remove",
"(",
"$",
"themeIds",
")",
"{",
"$",
"themeIds",
"=",
"(",
"array",
")",
"$",
"themeIds",
";",
"foreach",
"(",
"$",
"themeIds",
"as",
"$",
"themeId",
")",
"{",
"$",
"prefixedId",
"=",
"$",
"this",
"->",
"getPrefixedTheme... | Remove themes from the configuration
@param array|string $themeIds
@return bool | [
"Remove",
"themes",
"from",
"the",
"configuration"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/themes/ItemThemeInstaller.php#L129-L140 |
oat-sa/extension-tao-itemqti | model/themes/ItemThemeInstaller.php | ItemThemeInstaller.add | public function add(array $themes) {
foreach($themes as $themeId => $label) {
$prefixedId = $this->getPrefixedThemeId($themeId);
if($this->themeExists($prefixedId)) {
continue;
}
$this->register($themeId, $label);
}
$this->logInf... | php | public function add(array $themes) {
foreach($themes as $themeId => $label) {
$prefixedId = $this->getPrefixedThemeId($themeId);
if($this->themeExists($prefixedId)) {
continue;
}
$this->register($themeId, $label);
}
$this->logInf... | [
"public",
"function",
"add",
"(",
"array",
"$",
"themes",
")",
"{",
"foreach",
"(",
"$",
"themes",
"as",
"$",
"themeId",
"=>",
"$",
"label",
")",
"{",
"$",
"prefixedId",
"=",
"$",
"this",
"->",
"getPrefixedThemeId",
"(",
"$",
"themeId",
")",
";",
"if... | @param array $themes
@return bool | [
"@param",
"array",
"$themes"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/themes/ItemThemeInstaller.php#L148-L160 |
oat-sa/extension-tao-itemqti | model/themes/ItemThemeInstaller.php | ItemThemeInstaller.update | public function update(array $themes) {
foreach($themes as $themeId => $label) {
$this->remove($themeId);
$this->register($themeId, $label);
}
$this->logInfo('Item themes updated: ' . implode(',', array_keys($themes)));
return true;
} | php | public function update(array $themes) {
foreach($themes as $themeId => $label) {
$this->remove($themeId);
$this->register($themeId, $label);
}
$this->logInfo('Item themes updated: ' . implode(',', array_keys($themes)));
return true;
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"themes",
")",
"{",
"foreach",
"(",
"$",
"themes",
"as",
"$",
"themeId",
"=>",
"$",
"label",
")",
"{",
"$",
"this",
"->",
"remove",
"(",
"$",
"themeId",
")",
";",
"$",
"this",
"->",
"register",
"("... | @param array $themes
@return bool | [
"@param",
"array",
"$themes"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/themes/ItemThemeInstaller.php#L168-L175 |
oat-sa/extension-tao-itemqti | model/themes/ItemThemeInstaller.php | ItemThemeInstaller.setDefault | public function setDefault($themeId) {
$prefixedId = $this->getPrefixedThemeId($themeId);
if(!$this->themeExists($prefixedId)) {
$this->logInfo($themeId . ' not installed, could not set to default');
return false;
}
$this->registry->setDefaultTheme('items', $pref... | php | public function setDefault($themeId) {
$prefixedId = $this->getPrefixedThemeId($themeId);
if(!$this->themeExists($prefixedId)) {
$this->logInfo($themeId . ' not installed, could not set to default');
return false;
}
$this->registry->setDefaultTheme('items', $pref... | [
"public",
"function",
"setDefault",
"(",
"$",
"themeId",
")",
"{",
"$",
"prefixedId",
"=",
"$",
"this",
"->",
"getPrefixedThemeId",
"(",
"$",
"themeId",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"themeExists",
"(",
"$",
"prefixedId",
")",
")",
"{",
... | Set the current theme
@param $themeId
@return boolean|\common_report_Report | [
"Set",
"the",
"current",
"theme"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/themes/ItemThemeInstaller.php#L185-L195 |
oat-sa/extension-tao-itemqti | model/themes/ItemThemeInstaller.php | ItemThemeInstaller.reset | public function reset() {
$map = $this->registry->getMap();
if(empty($map['items']['available'])) {
return false;
}
foreach($map['items']['available'] as $theme) {
// exclude themes that don't belong to this customer
if($theme['id'] === 'tao' || 0 !== ... | php | public function reset() {
$map = $this->registry->getMap();
if(empty($map['items']['available'])) {
return false;
}
foreach($map['items']['available'] as $theme) {
// exclude themes that don't belong to this customer
if($theme['id'] === 'tao' || 0 !== ... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"registry",
"->",
"getMap",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"map",
"[",
"'items'",
"]",
"[",
"'available'",
"]",
")",
")",
"{",
"return",
"false",
";",... | Reset the item theme registry to its initial values
@return bool|\common_report_Report | [
"Reset",
"the",
"item",
"theme",
"registry",
"to",
"its",
"initial",
"values"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/themes/ItemThemeInstaller.php#L203-L237 |
oat-sa/extension-tao-itemqti | model/themes/ItemThemeInstaller.php | ItemThemeInstaller.themeExists | public function themeExists($themeId) {
// while this seem to be obsolete in most cases
// it can be useful when the function is called from the outside
$prefixedId = $this->getPrefixedThemeId($themeId);
$map = $this->registry->getMap();
if(empty($map['items']['available'])) {
... | php | public function themeExists($themeId) {
// while this seem to be obsolete in most cases
// it can be useful when the function is called from the outside
$prefixedId = $this->getPrefixedThemeId($themeId);
$map = $this->registry->getMap();
if(empty($map['items']['available'])) {
... | [
"public",
"function",
"themeExists",
"(",
"$",
"themeId",
")",
"{",
"// while this seem to be obsolete in most cases",
"// it can be useful when the function is called from the outside",
"$",
"prefixedId",
"=",
"$",
"this",
"->",
"getPrefixedThemeId",
"(",
"$",
"themeId",
")"... | Is a theme already registered?
@param $themeId
@return bool | [
"Is",
"a",
"theme",
"already",
"registered?"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/themes/ItemThemeInstaller.php#L246-L260 |
oat-sa/extension-tao-itemqti | model/themes/ItemThemeInstaller.php | ItemThemeInstaller.getPrefixedThemeId | protected function getPrefixedThemeId($themeId) {
if($themeId === 'tao') {
return $themeId;
}
if(preg_match('~^' . $this->extensionId . '[A-Z]~', $themeId)) {
return $themeId;
}
return $this->extensionId . ucfirst($themeId);
} | php | protected function getPrefixedThemeId($themeId) {
if($themeId === 'tao') {
return $themeId;
}
if(preg_match('~^' . $this->extensionId . '[A-Z]~', $themeId)) {
return $themeId;
}
return $this->extensionId . ucfirst($themeId);
} | [
"protected",
"function",
"getPrefixedThemeId",
"(",
"$",
"themeId",
")",
"{",
"if",
"(",
"$",
"themeId",
"===",
"'tao'",
")",
"{",
"return",
"$",
"themeId",
";",
"}",
"if",
"(",
"preg_match",
"(",
"'~^'",
".",
"$",
"this",
"->",
"extensionId",
".",
"'[... | Prefix theme id base on extension id from calling class. Pass through if already prefixed
@param $themeId
@return string | [
"Prefix",
"theme",
"id",
"base",
"on",
"extension",
"id",
"from",
"calling",
"class",
".",
"Pass",
"through",
"if",
"already",
"prefixed"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/themes/ItemThemeInstaller.php#L270-L278 |
oat-sa/extension-tao-itemqti | helpers/QtiFile.php | QtiFile.getQtiFileContent | public static function getQtiFileContent(core_kernel_classes_Resource $item, $language = '')
{
$itemDirectory = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $language);
return $itemDirectory->getFile(self::FILE)->read();
} | php | public static function getQtiFileContent(core_kernel_classes_Resource $item, $language = '')
{
$itemDirectory = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $language);
return $itemDirectory->getFile(self::FILE)->read();
} | [
"public",
"static",
"function",
"getQtiFileContent",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"$",
"language",
"=",
"''",
")",
"{",
"$",
"itemDirectory",
"=",
"taoItems_models_classes_ItemsService",
"::",
"singleton",
"(",
")",
"->",
"getItemDirectory",
... | Get content of qti.xml following an item + language
@param core_kernel_classes_Resource $item
@param string $language
@return false|string
@throws \common_Exception | [
"Get",
"content",
"of",
"qti",
".",
"xml",
"following",
"an",
"item",
"+",
"language"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/helpers/QtiFile.php#L42-L46 |
oat-sa/extension-tao-itemqti | model/Export/ItemMetadataByClassExportHandler.php | ItemMetadataByClassExportHandler.getExportForm | public function getExportForm(core_kernel_classes_Resource $resource)
{
if ($resource instanceof \core_kernel_classes_Class) {
$formData = ['class' => $resource];
} else {
$formData = ['class' => $this->getClass($resource)];
}
$form = new MetadataExporterForm(... | php | public function getExportForm(core_kernel_classes_Resource $resource)
{
if ($resource instanceof \core_kernel_classes_Class) {
$formData = ['class' => $resource];
} else {
$formData = ['class' => $this->getClass($resource)];
}
$form = new MetadataExporterForm(... | [
"public",
"function",
"getExportForm",
"(",
"core_kernel_classes_Resource",
"$",
"resource",
")",
"{",
"if",
"(",
"$",
"resource",
"instanceof",
"\\",
"core_kernel_classes_Class",
")",
"{",
"$",
"formData",
"=",
"[",
"'class'",
"=>",
"$",
"resource",
"]",
";",
... | Create MetadataExporterForm with class uri
@param core_kernel_classes_Resource $resource
@return \tao_helpers_form_Form | [
"Create",
"MetadataExporterForm",
"with",
"class",
"uri"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/ItemMetadataByClassExportHandler.php#L56-L66 |
oat-sa/extension-tao-itemqti | model/Export/ItemMetadataByClassExportHandler.php | ItemMetadataByClassExportHandler.getClassToExport | protected function getClassToExport($uri)
{
$resource = $this->getResource($uri);
if ($resource->isClass()) {
$classToExport = $this->getClass($uri);
} else {
$classToExport = reset($resource->getTypes());
}
return $classToExport;
} | php | protected function getClassToExport($uri)
{
$resource = $this->getResource($uri);
if ($resource->isClass()) {
$classToExport = $this->getClass($uri);
} else {
$classToExport = reset($resource->getTypes());
}
return $classToExport;
} | [
"protected",
"function",
"getClassToExport",
"(",
"$",
"uri",
")",
"{",
"$",
"resource",
"=",
"$",
"this",
"->",
"getResource",
"(",
"$",
"uri",
")",
";",
"if",
"(",
"$",
"resource",
"->",
"isClass",
"(",
")",
")",
"{",
"$",
"classToExport",
"=",
"$"... | Get class to export, from resource uri or class uri
If parameter is null, check id http parameter
@param null $uri
@return \core_kernel_classes_Class|mixed
@throws \common_exception_BadRequest | [
"Get",
"class",
"to",
"export",
"from",
"resource",
"uri",
"or",
"class",
"uri",
"If",
"parameter",
"is",
"null",
"check",
"id",
"http",
"parameter"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/ItemMetadataByClassExportHandler.php#L129-L140 |
oat-sa/extension-tao-itemqti | controller/QtiCreator.php | QtiCreator.createItem | public function createItem()
{
if(!\tao_helpers_Request::isAjax()){
throw new common_exception_BadRequest('wrong request mode');
}
$clazz = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
if ($clazz->isClass()) {
$clazz = new \core_kernel_... | php | public function createItem()
{
if(!\tao_helpers_Request::isAjax()){
throw new common_exception_BadRequest('wrong request mode');
}
$clazz = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
if ($clazz->isClass()) {
$clazz = new \core_kernel_... | [
"public",
"function",
"createItem",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"tao_helpers_Request",
"::",
"isAjax",
"(",
")",
")",
"{",
"throw",
"new",
"common_exception_BadRequest",
"(",
"'wrong request mode'",
")",
";",
"}",
"$",
"clazz",
"=",
"new",
"\\",
"... | create a new QTI item
@throws common_exception_BadRequest
@throws common_exception_Error
@requiresRight id WRITE | [
"create",
"a",
"new",
"QTI",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiCreator.php#L70-L101 |
oat-sa/extension-tao-itemqti | controller/QtiCreator.php | QtiCreator.getCreatorConfig | protected function getCreatorConfig(core_kernel_classes_Resource $item){
$config = new CreatorConfig();
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
$creatorConfig = $ext->getConfig('qtiCreator');
if (is_array($creatorConfig)) {
foreac... | php | protected function getCreatorConfig(core_kernel_classes_Resource $item){
$config = new CreatorConfig();
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
$creatorConfig = $ext->getConfig('qtiCreator');
if (is_array($creatorConfig)) {
foreac... | [
"protected",
"function",
"getCreatorConfig",
"(",
"core_kernel_classes_Resource",
"$",
"item",
")",
"{",
"$",
"config",
"=",
"new",
"CreatorConfig",
"(",
")",
";",
"$",
"ext",
"=",
"\\",
"common_ext_ExtensionsManager",
"::",
"singleton",
"(",
")",
"->",
"getExte... | Get the configuration of the Item Creator
@param core_kernel_classes_Resource $item the selected item
@return CreatorConfig the configration | [
"Get",
"the",
"configuration",
"of",
"the",
"Item",
"Creator"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiCreator.php#L234-L287 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.addInteraction | public function addInteraction(Interaction $interaction, $body){
$returnValue = false;
if(!is_null($interaction)){
$returnValue = $this->getBody()->setElement($interaction, $body);
}
return (bool) $returnValue;
} | php | public function addInteraction(Interaction $interaction, $body){
$returnValue = false;
if(!is_null($interaction)){
$returnValue = $this->getBody()->setElement($interaction, $body);
}
return (bool) $returnValue;
} | [
"public",
"function",
"addInteraction",
"(",
"Interaction",
"$",
"interaction",
",",
"$",
"body",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"interaction",
")",
")",
"{",
"$",
"returnValue",
"=",
"$",
"this",
... | Short description of method addInteraction
@access public
@author Sam, <sam@taotesting.com>
@param Interaction $interaction
@param $body
@return bool | [
"Short",
"description",
"of",
"method",
"addInteraction"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L189-L197 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.removeInteraction | public function removeInteraction(Interaction $interaction){
$returnValue = false;
if(!is_null($interaction)){
$returnValue = $this->getBody()->removeElement($interaction);
}
return (bool) $returnValue;
} | php | public function removeInteraction(Interaction $interaction){
$returnValue = false;
if(!is_null($interaction)){
$returnValue = $this->getBody()->removeElement($interaction);
}
return (bool) $returnValue;
} | [
"public",
"function",
"removeInteraction",
"(",
"Interaction",
"$",
"interaction",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"interaction",
")",
")",
"{",
"$",
"returnValue",
"=",
"$",
"this",
"->",
"getBody",
... | Short description of method removeInteraction
@access public
@author Sam, <sam@taotesting.com>
@param Interaction $interaction
@return bool | [
"Short",
"description",
"of",
"method",
"removeInteraction"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L207-L215 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.setOutcomes | public function setOutcomes($outcomes){
$this->outcomes = array();
foreach($outcomes as $outcome){
if(!$outcome instanceof OutcomeDeclaration){
throw new \InvalidArgumentException("wrong entry in outcomes list");
}
$this->addOutcome($outcome);
... | php | public function setOutcomes($outcomes){
$this->outcomes = array();
foreach($outcomes as $outcome){
if(!$outcome instanceof OutcomeDeclaration){
throw new \InvalidArgumentException("wrong entry in outcomes list");
}
$this->addOutcome($outcome);
... | [
"public",
"function",
"setOutcomes",
"(",
"$",
"outcomes",
")",
"{",
"$",
"this",
"->",
"outcomes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"outcomes",
"as",
"$",
"outcome",
")",
"{",
"if",
"(",
"!",
"$",
"outcome",
"instanceof",
"OutcomeDecl... | Short description of method setOutcomes
@access public
@author Sam, <sam@taotesting.com>
@param
array outcomes
@return mixed
@throws InvalidArgumentException | [
"Short",
"description",
"of",
"method",
"setOutcomes"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L266-L274 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.addOutcome | public function addOutcome(OutcomeDeclaration $outcome){
$this->outcomes[$outcome->getSerial()] = $outcome;
$outcome->setRelatedItem($this);
} | php | public function addOutcome(OutcomeDeclaration $outcome){
$this->outcomes[$outcome->getSerial()] = $outcome;
$outcome->setRelatedItem($this);
} | [
"public",
"function",
"addOutcome",
"(",
"OutcomeDeclaration",
"$",
"outcome",
")",
"{",
"$",
"this",
"->",
"outcomes",
"[",
"$",
"outcome",
"->",
"getSerial",
"(",
")",
"]",
"=",
"$",
"outcome",
";",
"$",
"outcome",
"->",
"setRelatedItem",
"(",
"$",
"th... | add an outcome declaration to the item
@param \oat\taoQtiItem\model\qti\OutcomeDeclaration $outcome | [
"add",
"an",
"outcome",
"declaration",
"to",
"the",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L281-L284 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.getOutcome | public function getOutcome($serial){
$returnValue = null;
if(!empty($serial)){
if(isset($this->outcomes[$serial])){
$returnValue = $this->outcomes[$serial];
}
}
return $returnValue;
} | php | public function getOutcome($serial){
$returnValue = null;
if(!empty($serial)){
if(isset($this->outcomes[$serial])){
$returnValue = $this->outcomes[$serial];
}
}
return $returnValue;
} | [
"public",
"function",
"getOutcome",
"(",
"$",
"serial",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"serial",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"outcomes",
"[",
"$",
"serial",
"]",
"... | Short description of method getOutcome
@access public
@author Sam, <sam@taotesting.com>
@param
string serial
@return \oat\taoQtiItem\model\qti\OutcomeDeclaration | [
"Short",
"description",
"of",
"method",
"getOutcome"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L306-L316 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.removeOutcome | public function removeOutcome(OutcomeDeclaration $outcome){
$returnValue = (bool) false;
if(!is_null($outcome)){
if(isset($this->outcomes[$outcome->getSerial()])){
unset($this->outcomes[$outcome->getSerial()]);
$returnValue = true;
}
}else... | php | public function removeOutcome(OutcomeDeclaration $outcome){
$returnValue = (bool) false;
if(!is_null($outcome)){
if(isset($this->outcomes[$outcome->getSerial()])){
unset($this->outcomes[$outcome->getSerial()]);
$returnValue = true;
}
}else... | [
"public",
"function",
"removeOutcome",
"(",
"OutcomeDeclaration",
"$",
"outcome",
")",
"{",
"$",
"returnValue",
"=",
"(",
"bool",
")",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"outcome",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
... | Short description of method removeOutcome
@access public
@author Sam, <sam@taotesting.com>
@param OutcomeDeclaration $outcome
@return bool | [
"Short",
"description",
"of",
"method",
"removeOutcome"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L326-L343 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.getIdentifiedElements | public function getIdentifiedElements(){
$returnValue = $this->getBody()->getIdentifiedElements();
$returnValue->addMultiple($this->getOutcomes());
$returnValue->addMultiple($this->getResponses());
$returnValue->addMultiple($this->getModalFeedbacks());
return $returnValue;
} | php | public function getIdentifiedElements(){
$returnValue = $this->getBody()->getIdentifiedElements();
$returnValue->addMultiple($this->getOutcomes());
$returnValue->addMultiple($this->getResponses());
$returnValue->addMultiple($this->getModalFeedbacks());
return $returnValue;
} | [
"public",
"function",
"getIdentifiedElements",
"(",
")",
"{",
"$",
"returnValue",
"=",
"$",
"this",
"->",
"getBody",
"(",
")",
"->",
"getIdentifiedElements",
"(",
")",
";",
"$",
"returnValue",
"->",
"addMultiple",
"(",
"$",
"this",
"->",
"getOutcomes",
"(",
... | Get recursively all included identified QTI elements in the object (identifier => Object)
@return array | [
"Get",
"recursively",
"all",
"included",
"identified",
"QTI",
"elements",
"in",
"the",
"object",
"(",
"identifier",
"=",
">",
"Object",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L425-L432 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.toXHTML | public function toXHTML($options = array(), &$filtered = array()){
$template = static::getTemplatePath().'/xhtml.item.tpl.php';
// get the variables to use in the template
$variables = $this->getAttributeValues();
$variables['stylesheets'] = array();
foreach($this->getStyleshee... | php | public function toXHTML($options = array(), &$filtered = array()){
$template = static::getTemplatePath().'/xhtml.item.tpl.php';
// get the variables to use in the template
$variables = $this->getAttributeValues();
$variables['stylesheets'] = array();
foreach($this->getStyleshee... | [
"public",
"function",
"toXHTML",
"(",
"$",
"options",
"=",
"array",
"(",
")",
",",
"&",
"$",
"filtered",
"=",
"array",
"(",
")",
")",
"{",
"$",
"template",
"=",
"static",
"::",
"getTemplatePath",
"(",
")",
".",
"'/xhtml.item.tpl.php'",
";",
"// get the v... | Short description of method toXHTML
@access public
@author Sam, <sam@taotesting.com>
@param array $options
@param array $filtered
@return string | [
"Short",
"description",
"of",
"method",
"toXHTML"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L443-L495 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.toXML | public function toXML($validate = false){
$returnValue = '';
$qti = $this->toQTI();
// render and clean the xml
$dom = new DOMDocument('1.0', 'UTF-8');
$domDocumentConfig = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getConfig('XMLParser');
... | php | public function toXML($validate = false){
$returnValue = '';
$qti = $this->toQTI();
// render and clean the xml
$dom = new DOMDocument('1.0', 'UTF-8');
$domDocumentConfig = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getConfig('XMLParser');
... | [
"public",
"function",
"toXML",
"(",
"$",
"validate",
"=",
"false",
")",
"{",
"$",
"returnValue",
"=",
"''",
";",
"$",
"qti",
"=",
"$",
"this",
"->",
"toQTI",
"(",
")",
";",
"// render and clean the xml",
"$",
"dom",
"=",
"new",
"DOMDocument",
"(",
"'1.... | Short description of method toQTI
@access public
@author Sam, <sam@taotesting.com>
@param boolean $validate (optional) Validate the XML output against QTI Specification (XML Schema). Default is false.
@return string
@throws exception\QtiModelException | [
"Short",
"description",
"of",
"method",
"toQTI"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L577-L620 |
oat-sa/extension-tao-itemqti | model/qti/Item.php | Item.toArray | public function toArray($filterVariableContent = false, &$filtered = array()){
$data = parent::toArray($filterVariableContent, $filtered);
$data['namespaces'] = $this->getNamespaces();
$data['schemaLocations'] = $this->getSchemaLocations();
$data['stylesheets'] = $this->getArraySerialize... | php | public function toArray($filterVariableContent = false, &$filtered = array()){
$data = parent::toArray($filterVariableContent, $filtered);
$data['namespaces'] = $this->getNamespaces();
$data['schemaLocations'] = $this->getSchemaLocations();
$data['stylesheets'] = $this->getArraySerialize... | [
"public",
"function",
"toArray",
"(",
"$",
"filterVariableContent",
"=",
"false",
",",
"&",
"$",
"filtered",
"=",
"array",
"(",
")",
")",
"{",
"$",
"data",
"=",
"parent",
"::",
"toArray",
"(",
"$",
"filterVariableContent",
",",
"$",
"filtered",
")",
";",... | Serialize item object into json format, handy to be used in js | [
"Serialize",
"item",
"object",
"into",
"json",
"format",
"handy",
"to",
"be",
"used",
"in",
"js"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Item.php#L625-L636 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.isQtiItem | private function isQtiItem(core_kernel_classes_Resource $itemResource){
$itemService = taoItems_models_classes_ItemsService::singleton();
return $itemService->hasItemModel($itemResource, [ItemModel::MODEL_URI]);
} | php | private function isQtiItem(core_kernel_classes_Resource $itemResource){
$itemService = taoItems_models_classes_ItemsService::singleton();
return $itemService->hasItemModel($itemResource, [ItemModel::MODEL_URI]);
} | [
"private",
"function",
"isQtiItem",
"(",
"core_kernel_classes_Resource",
"$",
"itemResource",
")",
"{",
"$",
"itemService",
"=",
"taoItems_models_classes_ItemsService",
"::",
"singleton",
"(",
")",
";",
"return",
"$",
"itemService",
"->",
"hasItemModel",
"(",
"$",
"... | Check if the resource in argument is a valid qti item
@param core_kernel_classes_Resource $itemResource
@return boolean | [
"Check",
"if",
"the",
"resource",
"in",
"argument",
"is",
"a",
"valid",
"qti",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L44-L47 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.getItemContent | private function getItemContent(core_kernel_classes_Resource $itemResource, $langCode = '')
{
if ($this->isQtiItem($itemResource)) {
$itemContent = Service::singleton()
->getDataItemByRdfItem($itemResource, $langCode)
->toXML();
if (!empty($itemConten... | php | private function getItemContent(core_kernel_classes_Resource $itemResource, $langCode = '')
{
if ($this->isQtiItem($itemResource)) {
$itemContent = Service::singleton()
->getDataItemByRdfItem($itemResource, $langCode)
->toXML();
if (!empty($itemConten... | [
"private",
"function",
"getItemContent",
"(",
"core_kernel_classes_Resource",
"$",
"itemResource",
",",
"$",
"langCode",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isQtiItem",
"(",
"$",
"itemResource",
")",
")",
"{",
"$",
"itemContent",
"=",
"Servic... | Get the item content for a qti item resource
@param core_kernel_classes_Resource $itemResource
@param string $langCode
@return SimpleXMLElement | [
"Get",
"the",
"item",
"content",
"for",
"a",
"qti",
"item",
"resource"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L56-L68 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.setItemContent | private function setItemContent(SimpleXMLElement $content, core_kernel_classes_Resource $itemResource)
{
if ($this->isQtiItem($itemResource)) {
return Service::singleton()->saveXmlItemToRdfItem($content->asXML(), $itemResource);
}
return false;
} | php | private function setItemContent(SimpleXMLElement $content, core_kernel_classes_Resource $itemResource)
{
if ($this->isQtiItem($itemResource)) {
return Service::singleton()->saveXmlItemToRdfItem($content->asXML(), $itemResource);
}
return false;
} | [
"private",
"function",
"setItemContent",
"(",
"SimpleXMLElement",
"$",
"content",
",",
"core_kernel_classes_Resource",
"$",
"itemResource",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isQtiItem",
"(",
"$",
"itemResource",
")",
")",
"{",
"return",
"Service",
"::",
... | Set the item content for a qti item resource
@param SimpleXMLElement $content
@param core_kernel_classes_Resource $itemResource
@return bool | [
"Set",
"the",
"item",
"content",
"for",
"a",
"qti",
"item",
"resource"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L77-L84 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.getBodyStyles | public function getBodyStyles(core_kernel_classes_Resource $itemResource, $langCode = ''){
$itemContent = $this->getItemContent($itemResource, $langCode);
if(is_null($itemContent)){
throw new \common_Exception('cannot find valid qti item content');
}else{
$classAttr = (st... | php | public function getBodyStyles(core_kernel_classes_Resource $itemResource, $langCode = ''){
$itemContent = $this->getItemContent($itemResource, $langCode);
if(is_null($itemContent)){
throw new \common_Exception('cannot find valid qti item content');
}else{
$classAttr = (st... | [
"public",
"function",
"getBodyStyles",
"(",
"core_kernel_classes_Resource",
"$",
"itemResource",
",",
"$",
"langCode",
"=",
"''",
")",
"{",
"$",
"itemContent",
"=",
"$",
"this",
"->",
"getItemContent",
"(",
"$",
"itemResource",
",",
"$",
"langCode",
")",
";",
... | Get the array of body style classes set to the itemBody of a qti item
@param core_kernel_classes_Resource $itemResource
@param string $langCode
@return array
@throws \common_Exception | [
"Get",
"the",
"array",
"of",
"body",
"style",
"classes",
"set",
"to",
"the",
"itemBody",
"of",
"a",
"qti",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L94-L105 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.addBodyStyles | public function addBodyStyles($styleNames, core_kernel_classes_Resource $itemResource, $langCode = ''){
$itemContent = $this->getItemContent($itemResource, $langCode);
if(!is_null($itemContent) && !empty($styleNames)){
$classAttr = (string) $itemContent->itemBody['class'];
foreac... | php | public function addBodyStyles($styleNames, core_kernel_classes_Resource $itemResource, $langCode = ''){
$itemContent = $this->getItemContent($itemResource, $langCode);
if(!is_null($itemContent) && !empty($styleNames)){
$classAttr = (string) $itemContent->itemBody['class'];
foreac... | [
"public",
"function",
"addBodyStyles",
"(",
"$",
"styleNames",
",",
"core_kernel_classes_Resource",
"$",
"itemResource",
",",
"$",
"langCode",
"=",
"''",
")",
"{",
"$",
"itemContent",
"=",
"$",
"this",
"->",
"getItemContent",
"(",
"$",
"itemResource",
",",
"$"... | Add an array of body style classes to the itemBody of a qti item
@param core_kernel_classes_Resource $itemResource
@param string $langCode
@return boolean
@throws \common_Exception | [
"Add",
"an",
"array",
"of",
"body",
"style",
"classes",
"to",
"the",
"itemBody",
"of",
"a",
"qti",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L115-L133 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.getClassBodyStyles | public function getClassBodyStyles(core_kernel_classes_Class $itemClass){
$usages = [];
$union = [];
$intersect = [];
$items = $itemClass->getInstances(true);
$i = 0;
foreach($items as $item){
if($this->isQtiItem($item)){
try{
... | php | public function getClassBodyStyles(core_kernel_classes_Class $itemClass){
$usages = [];
$union = [];
$intersect = [];
$items = $itemClass->getInstances(true);
$i = 0;
foreach($items as $item){
if($this->isQtiItem($item)){
try{
... | [
"public",
"function",
"getClassBodyStyles",
"(",
"core_kernel_classes_Class",
"$",
"itemClass",
")",
"{",
"$",
"usages",
"=",
"[",
"]",
";",
"$",
"union",
"=",
"[",
"]",
";",
"$",
"intersect",
"=",
"[",
"]",
";",
"$",
"items",
"=",
"$",
"itemClass",
"-... | Get an array that give the style usage within an tao item subclasses.
It only takes into account qti item with a no-empty content
@param core_kernel_classes_Class $itemClass
@return array | [
"Get",
"an",
"array",
"that",
"give",
"the",
"style",
"usage",
"within",
"an",
"tao",
"item",
"subclasses",
".",
"It",
"only",
"takes",
"into",
"account",
"qti",
"item",
"with",
"a",
"no",
"-",
"empty",
"content"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L168-L194 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.addClassBodyStyles | public function addClassBodyStyles($styleNames, core_kernel_classes_Class $itemClass, $recursive = true){
$updatedItems = [];
$items = $itemClass->getInstances($recursive);
foreach($items as $item){
if($this->isQtiItem($item)){
if($this->addBodyStyles($styleNames, $it... | php | public function addClassBodyStyles($styleNames, core_kernel_classes_Class $itemClass, $recursive = true){
$updatedItems = [];
$items = $itemClass->getInstances($recursive);
foreach($items as $item){
if($this->isQtiItem($item)){
if($this->addBodyStyles($styleNames, $it... | [
"public",
"function",
"addClassBodyStyles",
"(",
"$",
"styleNames",
",",
"core_kernel_classes_Class",
"$",
"itemClass",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"$",
"updatedItems",
"=",
"[",
"]",
";",
"$",
"items",
"=",
"$",
"itemClass",
"->",
"getInst... | Add an array of body style classes to the itemBody of all qti items in given class
@param array $styleNames
@param core_kernel_classes_Class $itemClass
@param boolean $recursive | [
"Add",
"an",
"array",
"of",
"body",
"style",
"classes",
"to",
"the",
"itemBody",
"of",
"all",
"qti",
"items",
"in",
"given",
"class"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L203-L214 |
oat-sa/extension-tao-itemqti | model/style/StyleService.php | StyleService.removeClassBodyStyles | public function removeClassBodyStyles($styleNames, core_kernel_classes_Class $itemClass, $recursive = true){
$updatedItems = [];
$items = $itemClass->getInstances($recursive);
foreach($items as $item){
if($this->isQtiItem($item)){
if($this->removeBodyStyles($styleName... | php | public function removeClassBodyStyles($styleNames, core_kernel_classes_Class $itemClass, $recursive = true){
$updatedItems = [];
$items = $itemClass->getInstances($recursive);
foreach($items as $item){
if($this->isQtiItem($item)){
if($this->removeBodyStyles($styleName... | [
"public",
"function",
"removeClassBodyStyles",
"(",
"$",
"styleNames",
",",
"core_kernel_classes_Class",
"$",
"itemClass",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"$",
"updatedItems",
"=",
"[",
"]",
";",
"$",
"items",
"=",
"$",
"itemClass",
"->",
"getI... | Remove an array of body style classes from the itemBody of all qti items in given class
@param array $styleNames
@param core_kernel_classes_Class $itemClass
@param boolean $recursive | [
"Remove",
"an",
"array",
"of",
"body",
"style",
"classes",
"from",
"the",
"itemBody",
"of",
"all",
"qti",
"items",
"in",
"given",
"class"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleService.php#L223-L234 |
oat-sa/extension-tao-itemqti | model/qti/metadata/exporter/MetadataExporter.php | MetadataExporter.inject | public function inject($identifier, $imsManifest)
{
if (! $imsManifest instanceof \DOMDocument) {
throw new MetadataExportException(__('Metadata export requires an instance of DomManifest to inject metadata'));
}
parent::inject($identifier, $imsManifest);
} | php | public function inject($identifier, $imsManifest)
{
if (! $imsManifest instanceof \DOMDocument) {
throw new MetadataExportException(__('Metadata export requires an instance of DomManifest to inject metadata'));
}
parent::inject($identifier, $imsManifest);
} | [
"public",
"function",
"inject",
"(",
"$",
"identifier",
",",
"$",
"imsManifest",
")",
"{",
"if",
"(",
"!",
"$",
"imsManifest",
"instanceof",
"\\",
"DOMDocument",
")",
"{",
"throw",
"new",
"MetadataExportException",
"(",
"__",
"(",
"'Metadata export requires an i... | Inject an identified metadata value to a dom IMS manifest
{@inheritdoc} | [
"Inject",
"an",
"identified",
"metadata",
"value",
"to",
"a",
"dom",
"IMS",
"manifest"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/exporter/MetadataExporter.php#L62-L69 |
oat-sa/extension-tao-itemqti | model/qti/metadata/exporter/MetadataExporter.php | MetadataExporter.registerMetadataService | protected function registerMetadataService()
{
$metadataService = $this->getServiceLocator()->get(MetadataService::SERVICE_ID);
$metadataService->setOption(MetadataService::EXPORTER_KEY, $this);
$this->getServiceManager()->register(MetadataService::SERVICE_ID, $metadataService);
} | php | protected function registerMetadataService()
{
$metadataService = $this->getServiceLocator()->get(MetadataService::SERVICE_ID);
$metadataService->setOption(MetadataService::EXPORTER_KEY, $this);
$this->getServiceManager()->register(MetadataService::SERVICE_ID, $metadataService);
} | [
"protected",
"function",
"registerMetadataService",
"(",
")",
"{",
"$",
"metadataService",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
";",
"$",
"metadataService",
"->",
"setOption",
"(",
... | Allow to register, into the config, the current exporter service | [
"Allow",
"to",
"register",
"into",
"the",
"config",
"the",
"current",
"exporter",
"service"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/exporter/MetadataExporter.php#L74-L79 |
oat-sa/extension-tao-itemqti | scripts/PortableReloadEventListener.php | PortableReloadEventListener.reloadPortableDevDirectory | public static function reloadPortableDevDirectory(ItemCreatorLoad $event)
{
$customInteractionDirs = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getConfig('debug_portable_element');
if(is_array($customInteractionDirs)){
$service = new PortableElementServic... | php | public static function reloadPortableDevDirectory(ItemCreatorLoad $event)
{
$customInteractionDirs = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getConfig('debug_portable_element');
if(is_array($customInteractionDirs)){
$service = new PortableElementServic... | [
"public",
"static",
"function",
"reloadPortableDevDirectory",
"(",
"ItemCreatorLoad",
"$",
"event",
")",
"{",
"$",
"customInteractionDirs",
"=",
"\\",
"common_ext_ExtensionsManager",
"::",
"singleton",
"(",
")",
"->",
"getExtensionById",
"(",
"'taoQtiItem'",
")",
"->"... | Re-register a portable element from its source directory
The list of portable elements to re-register is configure in the config file {TAO_ROOT}/config/taoQtiItem/debug_portable_element.conf.php
e.g.
return [
'myPci1' => 'qtiItemPci/views/js/pciCreator/dev/myPci1/',
'myPci2' => '/home/sam/dev/pcis/myPci2/'
];
@param I... | [
"Re",
"-",
"register",
"a",
"portable",
"element",
"from",
"its",
"source",
"directory",
"The",
"list",
"of",
"portable",
"elements",
"to",
"re",
"-",
"register",
"is",
"configure",
"in",
"the",
"config",
"file",
"{",
"TAO_ROOT",
"}",
"/",
"config",
"/",
... | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/scripts/PortableReloadEventListener.php#L25-L46 |
oat-sa/extension-tao-itemqti | model/qti/asset/AssetManager.php | AssetManager.loadAssetHandler | public function loadAssetHandler($assetHandler)
{
if (!$assetHandler instanceof AssetHandler) {
throw new AssetManagerException('Asset handler "' . get_class($assetHandler) . '" is not supported by AssetManager');
}
$this->assetHandlers[] = $assetHandler;
return $this;
... | php | public function loadAssetHandler($assetHandler)
{
if (!$assetHandler instanceof AssetHandler) {
throw new AssetManagerException('Asset handler "' . get_class($assetHandler) . '" is not supported by AssetManager');
}
$this->assetHandlers[] = $assetHandler;
return $this;
... | [
"public",
"function",
"loadAssetHandler",
"(",
"$",
"assetHandler",
")",
"{",
"if",
"(",
"!",
"$",
"assetHandler",
"instanceof",
"AssetHandler",
")",
"{",
"throw",
"new",
"AssetManagerException",
"(",
"'Asset handler \"'",
".",
"get_class",
"(",
"$",
"assetHandler... | Load an asset handler associated
@param $assetHandler
@return $this
@throws AssetManagerException | [
"Load",
"an",
"asset",
"handler",
"associated"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/asset/AssetManager.php#L54-L61 |
oat-sa/extension-tao-itemqti | model/qti/asset/AssetManager.php | AssetManager.importAuxiliaryFiles | public function importAuxiliaryFiles(QtiResource $qtiItemResource)
{
$qtiFile = $this->getSource() . \helpers_File::urlToPath($qtiItemResource->getFile());
foreach ($qtiItemResource->getAuxiliaryFiles() as $auxiliaryFile) {
$absolutePath = $this->getAbsolutePath($auxiliaryFile);
... | php | public function importAuxiliaryFiles(QtiResource $qtiItemResource)
{
$qtiFile = $this->getSource() . \helpers_File::urlToPath($qtiItemResource->getFile());
foreach ($qtiItemResource->getAuxiliaryFiles() as $auxiliaryFile) {
$absolutePath = $this->getAbsolutePath($auxiliaryFile);
... | [
"public",
"function",
"importAuxiliaryFiles",
"(",
"QtiResource",
"$",
"qtiItemResource",
")",
"{",
"$",
"qtiFile",
"=",
"$",
"this",
"->",
"getSource",
"(",
")",
".",
"\\",
"helpers_File",
"::",
"urlToPath",
"(",
"$",
"qtiItemResource",
"->",
"getFile",
"(",
... | Import auxiliaryFile e.q. css, js...
@param QtiResource $qtiItemResource
@return $this
@throws AssetManagerException
@throws InvalidSourcePathException | [
"Import",
"auxiliaryFile",
"e",
".",
"q",
".",
"css",
"js",
"..."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/asset/AssetManager.php#L119-L141 |
oat-sa/extension-tao-itemqti | model/qti/asset/AssetManager.php | AssetManager.importDependencyFiles | public function importDependencyFiles(QtiResource $qtiItemResource, $dependencies)
{
$qtiFile = $this->getSource() . \helpers_File::urlToPath($qtiItemResource->getFile());
foreach ($qtiItemResource->getDependencies() as $dependenciesFile) {
if (!isset($dependencies[$dependenciesFile])) {... | php | public function importDependencyFiles(QtiResource $qtiItemResource, $dependencies)
{
$qtiFile = $this->getSource() . \helpers_File::urlToPath($qtiItemResource->getFile());
foreach ($qtiItemResource->getDependencies() as $dependenciesFile) {
if (!isset($dependencies[$dependenciesFile])) {... | [
"public",
"function",
"importDependencyFiles",
"(",
"QtiResource",
"$",
"qtiItemResource",
",",
"$",
"dependencies",
")",
"{",
"$",
"qtiFile",
"=",
"$",
"this",
"->",
"getSource",
"(",
")",
".",
"\\",
"helpers_File",
"::",
"urlToPath",
"(",
"$",
"qtiItemResour... | Import dependencies files
@param QtiResource $qtiItemResource
@param $dependencies
@return $this
@throws AssetManagerException | [
"Import",
"dependencies",
"files"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/asset/AssetManager.php#L151-L171 |
oat-sa/extension-tao-itemqti | model/qti/asset/AssetManager.php | AssetManager.importAsset | protected function importAsset($absolutePath, $relativePath)
{
/** @var AssetHandler $assetHandler */
foreach ($this->assetHandlers as $assetHandler) {
if ($assetHandler->isApplicable($relativePath)) {
$info = $assetHandler->handle($absolutePath, $relativePath);
... | php | protected function importAsset($absolutePath, $relativePath)
{
/** @var AssetHandler $assetHandler */
foreach ($this->assetHandlers as $assetHandler) {
if ($assetHandler->isApplicable($relativePath)) {
$info = $assetHandler->handle($absolutePath, $relativePath);
... | [
"protected",
"function",
"importAsset",
"(",
"$",
"absolutePath",
",",
"$",
"relativePath",
")",
"{",
"/** @var AssetHandler $assetHandler */",
"foreach",
"(",
"$",
"this",
"->",
"assetHandlers",
"as",
"$",
"assetHandler",
")",
"{",
"if",
"(",
"$",
"assetHandler",... | Loop each assetHandlers populated by loadAssetHandler()
The first applicable return info about file handling processing
and break chain.
@param $absolutePath
@param $relativePath
@throws AssetManagerException | [
"Loop",
"each",
"assetHandlers",
"populated",
"by",
"loadAssetHandler",
"()",
"The",
"first",
"applicable",
"return",
"info",
"about",
"file",
"handling",
"processing",
"and",
"break",
"chain",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/asset/AssetManager.php#L216-L232 |
oat-sa/extension-tao-itemqti | model/qti/choice/Choice.php | Choice.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 booean
@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/choice/Choice.php#L70-L101 |
oat-sa/extension-tao-itemqti | model/qti/choice/Choice.php | Choice.toForm | public function toForm(){
$returnValue = null;
$choiceFormClass = '\\oat\\taoQtiItem\\controller\\QTIform\\choice\\'.ucfirst(static::$qtiTagName);
if(!class_exists($choiceFormClass)){
throw new QtiModelException("the class {$choiceFormClass} does not exist");
}else{
... | php | public function toForm(){
$returnValue = null;
$choiceFormClass = '\\oat\\taoQtiItem\\controller\\QTIform\\choice\\'.ucfirst(static::$qtiTagName);
if(!class_exists($choiceFormClass)){
throw new QtiModelException("the class {$choiceFormClass} does not exist");
}else{
... | [
"public",
"function",
"toForm",
"(",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"$",
"choiceFormClass",
"=",
"'\\\\oat\\\\taoQtiItem\\\\controller\\\\QTIform\\\\choice\\\\'",
".",
"ucfirst",
"(",
"static",
"::",
"$",
"qtiTagName",
")",
";",
"if",
"(",
"!",
... | Return the form to edit the current instance
@access public
@author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
@return tao_helpers_form_Form | [
"Return",
"the",
"form",
"to",
"edit",
"the",
"current",
"instance"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/choice/Choice.php#L110-L123 |
oat-sa/extension-tao-itemqti | model/qti/Resource.php | Resource.isAllowed | public static function isAllowed($type){
return (!empty($type) && (in_array($type, self::$allowedTypes))) || self::isAssessmentItem($type) || self::isAssessmentTest($type);
} | php | public static function isAllowed($type){
return (!empty($type) && (in_array($type, self::$allowedTypes))) || self::isAssessmentItem($type) || self::isAssessmentTest($type);
} | [
"public",
"static",
"function",
"isAllowed",
"(",
"$",
"type",
")",
"{",
"return",
"(",
"!",
"empty",
"(",
"$",
"type",
")",
"&&",
"(",
"in_array",
"(",
"$",
"type",
",",
"self",
"::",
"$",
"allowedTypes",
")",
")",
")",
"||",
"self",
"::",
"isAsse... | Check if the given type is allowed as a QTI Resource
@param string $type
@return boolean | [
"Check",
"if",
"the",
"given",
"type",
"is",
"allowed",
"as",
"a",
"QTI",
"Resource"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Resource.php#L124-L126 |
oat-sa/extension-tao-itemqti | model/qti/OutcomeDeclaration.php | OutcomeDeclaration.toJSON | public function toJSON(){
$outcomeValue = null;
if($this->defaultValue != ''){
$outcomeValue = Array($this->defaultValue);
}else if($this->getAttributeValue('baseType') == 'integer' || $this->getAttributeValue('baseType') == 'float'){
$outcomeValue = Array(0);
}el... | php | public function toJSON(){
$outcomeValue = null;
if($this->defaultValue != ''){
$outcomeValue = Array($this->defaultValue);
}else if($this->getAttributeValue('baseType') == 'integer' || $this->getAttributeValue('baseType') == 'float'){
$outcomeValue = Array(0);
}el... | [
"public",
"function",
"toJSON",
"(",
")",
"{",
"$",
"outcomeValue",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"defaultValue",
"!=",
"''",
")",
"{",
"$",
"outcomeValue",
"=",
"Array",
"(",
"$",
"this",
"->",
"defaultValue",
")",
";",
"}",
"else"... | get the outcome in JSON format
@deprecated now use the new qtism lib for response evaluation
@access public
@author Joel Bout, <joel.bout@tudor.lu> | [
"get",
"the",
"outcome",
"in",
"JSON",
"format"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/OutcomeDeclaration.php#L86-L104 |
oat-sa/extension-tao-itemqti | model/qti/exception/UnexpectedResponseProcessing.php | UnexpectedResponseProcessing.getUserMessage | public function getUserMessage() {
$requestedUri = $this->getRequestedUri();
if (empty($requestedUri) === true) {
return __('An unexpected error occured while dealing with Response Processing.');
}
else {
return __('The Response Processing Template "%s" is not sup... | php | public function getUserMessage() {
$requestedUri = $this->getRequestedUri();
if (empty($requestedUri) === true) {
return __('An unexpected error occured while dealing with Response Processing.');
}
else {
return __('The Response Processing Template "%s" is not sup... | [
"public",
"function",
"getUserMessage",
"(",
")",
"{",
"$",
"requestedUri",
"=",
"$",
"this",
"->",
"getRequestedUri",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"requestedUri",
")",
"===",
"true",
")",
"{",
"return",
"__",
"(",
"'An unexpected error occ... | Returns a human-readable message describing the error that occured.
@return string | [
"Returns",
"a",
"human",
"-",
"readable",
"message",
"describing",
"the",
"error",
"that",
"occured",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/exception/UnexpectedResponseProcessing.php#L94-L103 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementFileStorage.php | PortableElementFileStorage.registerFiles | public function registerFiles(PortableElementObject $object, $files, $source)
{
$registered = false;
$fileSystem = $this->getFileStorage();
$source = $this->sanitizeSourceAsDirectory($source);
foreach ($files as $file) {
if(!$object->isRegistrableFile($file)){
... | php | public function registerFiles(PortableElementObject $object, $files, $source)
{
$registered = false;
$fileSystem = $this->getFileStorage();
$source = $this->sanitizeSourceAsDirectory($source);
foreach ($files as $file) {
if(!$object->isRegistrableFile($file)){
... | [
"public",
"function",
"registerFiles",
"(",
"PortableElementObject",
"$",
"object",
",",
"$",
"files",
",",
"$",
"source",
")",
"{",
"$",
"registered",
"=",
"false",
";",
"$",
"fileSystem",
"=",
"$",
"this",
"->",
"getFileStorage",
"(",
")",
";",
"$",
"s... | Register files associated to a PCI track by $typeIdentifier
@refactor improve response
@param PortableElementObject $object
@param string[] $files Relative path of portable element files
@param string $source Location of temporary directory
@return bool
@throws PortableElementFileStorageException | [
"Register",
"files",
"associated",
"to",
"a",
"PCI",
"track",
"by",
"$typeIdentifier"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementFileStorage.php#L87-L114 |
oat-sa/extension-tao-itemqti | model/portableElement/storage/PortableElementFileStorage.php | PortableElementFileStorage.unregisterFiles | public function unregisterFiles(PortableElementObject $object, $files)
{
$deleted = true;
$filesystem = $this->getFileStorage();
foreach ($files as $relPath) {
$fileId = $this->getPrefix($object) . $relPath;
if (!$filesystem->has($fileId)) {
throw new ... | php | public function unregisterFiles(PortableElementObject $object, $files)
{
$deleted = true;
$filesystem = $this->getFileStorage();
foreach ($files as $relPath) {
$fileId = $this->getPrefix($object) . $relPath;
if (!$filesystem->has($fileId)) {
throw new ... | [
"public",
"function",
"unregisterFiles",
"(",
"PortableElementObject",
"$",
"object",
",",
"$",
"files",
")",
"{",
"$",
"deleted",
"=",
"true",
";",
"$",
"filesystem",
"=",
"$",
"this",
"->",
"getFileStorage",
"(",
")",
";",
"foreach",
"(",
"$",
"files",
... | Unregister files by removing them from FileSystem
@param PortableElementObject $object
@param $files
@return bool
@throws \common_Exception | [
"Unregister",
"files",
"by",
"removing",
"them",
"from",
"FileSystem"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/storage/PortableElementFileStorage.php#L124-L136 |
oat-sa/extension-tao-itemqti | model/style/StyleRegistry.php | StyleRegistry.getAllStyles | public function getAllStyles()
{
$styles = [];
foreach (self::getRegistry()->getMap() as $id => $styleData ){
$styles[$id] = $styleData;
}
return $styles;
} | php | public function getAllStyles()
{
$styles = [];
foreach (self::getRegistry()->getMap() as $id => $styleData ){
$styles[$id] = $styleData;
}
return $styles;
} | [
"public",
"function",
"getAllStyles",
"(",
")",
"{",
"$",
"styles",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"getRegistry",
"(",
")",
"->",
"getMap",
"(",
")",
"as",
"$",
"id",
"=>",
"$",
"styleData",
")",
"{",
"$",
"styles",
"[",
"$",
"... | Get all styles available from the registry
@return array | [
"Get",
"all",
"styles",
"available",
"from",
"the",
"registry"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleRegistry.php#L56-L63 |
oat-sa/extension-tao-itemqti | model/style/StyleRegistry.php | StyleRegistry.register | public function register($id, $styleData)
{
if (self::getRegistry()->isRegistered($id)) {
common_Logger::w('Style already registered');
}
if($this->isValidStyleData($styleData)){
self::getRegistry()->set($id, $styleData);
}else{
common_Logger::w('I... | php | public function register($id, $styleData)
{
if (self::getRegistry()->isRegistered($id)) {
common_Logger::w('Style already registered');
}
if($this->isValidStyleData($styleData)){
self::getRegistry()->set($id, $styleData);
}else{
common_Logger::w('I... | [
"public",
"function",
"register",
"(",
"$",
"id",
",",
"$",
"styleData",
")",
"{",
"if",
"(",
"self",
"::",
"getRegistry",
"(",
")",
"->",
"isRegistered",
"(",
"$",
"id",
")",
")",
"{",
"common_Logger",
"::",
"w",
"(",
"'Style already registered'",
")",
... | Register a style
@param string $id
@param array $styleData | [
"Register",
"a",
"style"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/style/StyleRegistry.php#L81-L92 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.setElement | public function setElement(Element $qtiElement, $body = '', $integrityCheck = true, $requiredPlaceholder = true){
return $this->setElements(array($qtiElement), $body, $integrityCheck, $requiredPlaceholder);
} | php | public function setElement(Element $qtiElement, $body = '', $integrityCheck = true, $requiredPlaceholder = true){
return $this->setElements(array($qtiElement), $body, $integrityCheck, $requiredPlaceholder);
} | [
"public",
"function",
"setElement",
"(",
"Element",
"$",
"qtiElement",
",",
"$",
"body",
"=",
"''",
",",
"$",
"integrityCheck",
"=",
"true",
",",
"$",
"requiredPlaceholder",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"setElements",
"(",
"array",
... | add one qtiElement into the body
if the body content is not specified, it appends to the end
@access public
@author Sam, <sam@taotesting.com>
@return boolean | [
"add",
"one",
"qtiElement",
"into",
"the",
"body",
"if",
"the",
"body",
"content",
"is",
"not",
"specified",
"it",
"appends",
"to",
"the",
"end"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L89-L91 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.edit | public function edit($body, $integrityCheck = false){
if(!is_string($body)){
throw new InvalidArgumentException('a QTI container must have a body of string type');
}
if($integrityCheck && !$this->checkIntegrity($body)){
return false;
}
$this->body = $body;... | php | public function edit($body, $integrityCheck = false){
if(!is_string($body)){
throw new InvalidArgumentException('a QTI container must have a body of string type');
}
if($integrityCheck && !$this->checkIntegrity($body)){
return false;
}
$this->body = $body;... | [
"public",
"function",
"edit",
"(",
"$",
"body",
",",
"$",
"integrityCheck",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"body",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'a QTI container must have a body of string type'"... | modify the content of the body
@param string $body
@param bool $integrityCheck
@return bool | [
"modify",
"the",
"content",
"of",
"the",
"body"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L157-L166 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.checkIntegrity | public function checkIntegrity($body, &$missingElements = null){
$returnValue = true;
foreach($this->elements as $element){
if(strpos($body, $element->getPlaceholder()) === false){
$returnValue = false;
if(is_array($missingElements)){
$mi... | php | public function checkIntegrity($body, &$missingElements = null){
$returnValue = true;
foreach($this->elements as $element){
if(strpos($body, $element->getPlaceholder()) === false){
$returnValue = false;
if(is_array($missingElements)){
$mi... | [
"public",
"function",
"checkIntegrity",
"(",
"$",
"body",
",",
"&",
"$",
"missingElements",
"=",
"null",
")",
"{",
"$",
"returnValue",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"strpos",... | Check if modifying the body won't have an element placeholder deleted
@param string $body
@return boolean | [
"Check",
"if",
"modifying",
"the",
"body",
"won",
"t",
"have",
"an",
"element",
"placeholder",
"deleted"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L174-L191 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.fixNonvoidTags | public function fixNonvoidTags($html) {
return preg_replace_callback('~(<([\w]+)[^>]*?)(\s*/>)~u', function ($matches) {
// something went wrong
if(empty($matches[2])) {
// do nothing
return $matches[0];
}
// regular void elements
... | php | public function fixNonvoidTags($html) {
return preg_replace_callback('~(<([\w]+)[^>]*?)(\s*/>)~u', function ($matches) {
// something went wrong
if(empty($matches[2])) {
// do nothing
return $matches[0];
}
// regular void elements
... | [
"public",
"function",
"fixNonvoidTags",
"(",
"$",
"html",
")",
"{",
"return",
"preg_replace_callback",
"(",
"'~(<([\\w]+)[^>]*?)(\\s*/>)~u'",
",",
"function",
"(",
"$",
"matches",
")",
"{",
"// something went wrong",
"if",
"(",
"empty",
"(",
"$",
"matches",
"[",
... | Converts <foo/> to <foo></foo> unless foo is a proper void element such as img etc.
@param $html
@return mixed | [
"Converts",
"<foo",
"/",
">",
"to",
"<foo",
">",
"<",
"/",
"foo",
">",
"unless",
"foo",
"is",
"a",
"proper",
"void",
"element",
"such",
"as",
"img",
"etc",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L199-L214 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.getElement | public function getElement($serial){
$returnValue = null;
if(isset($this->elements[$serial])){
$returnValue = $this->elements[$serial];
}
return $returnValue;
} | php | public function getElement($serial){
$returnValue = null;
if(isset($this->elements[$serial])){
$returnValue = $this->elements[$serial];
}
return $returnValue;
} | [
"public",
"function",
"getElement",
"(",
"$",
"serial",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"serial",
"]",
")",
")",
"{",
"$",
"returnValue",
"=",
"$",
"this",
"->",
"ele... | Get the element by its serial
@param string $serial
@return oat\taoQtiItem\model\qti\Element | [
"Get",
"the",
"element",
"by",
"its",
"serial"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L244-L253 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.getElements | public function getElements($className = ''){
$returnValue = array();
if($className){
foreach($this->elements as $serial => $element){
if($element instanceof $className){
$returnValue[$serial] = $element;
}
}
}else{
... | php | public function getElements($className = ''){
$returnValue = array();
if($className){
foreach($this->elements as $serial => $element){
if($element instanceof $className){
$returnValue[$serial] = $element;
}
}
}else{
... | [
"public",
"function",
"getElements",
"(",
"$",
"className",
"=",
"''",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"className",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"as",
"$",
"serial",
"=>",
"$",
... | Get all elements of the given type
Returns all elements if class name is not specified
@param string $className
@return array | [
"Get",
"all",
"elements",
"of",
"the",
"given",
"type",
"Returns",
"all",
"elements",
"if",
"class",
"name",
"is",
"not",
"specified"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L262-L278 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.toQTI | public function toQTI(){
$returnValue = $this->getBody();
foreach($this->elements as $element){
$returnValue = str_replace($element->getPlaceholder(), $element->toQTI(), $returnValue);
}
return (string) $returnValue;
} | php | public function toQTI(){
$returnValue = $this->getBody();
foreach($this->elements as $element){
$returnValue = str_replace($element->getPlaceholder(), $element->toQTI(), $returnValue);
}
return (string) $returnValue;
} | [
"public",
"function",
"toQTI",
"(",
")",
"{",
"$",
"returnValue",
"=",
"$",
"this",
"->",
"getBody",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"as",
"$",
"element",
")",
"{",
"$",
"returnValue",
"=",
"str_replace",
"(",
"$",
"elem... | Export the data to QTI XML format
@access public
@author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
@return string | [
"Export",
"the",
"data",
"to",
"QTI",
"XML",
"format"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L335-L343 |
oat-sa/extension-tao-itemqti | model/qti/container/Container.php | Container.toArray | public function toArray($filterVariableContent = false, &$filtered = array()){
$data = array(
'serial' => $this->getSerial(),
'body' => $this->getBody(),
'elements' => $this->getArraySerializedElementCollection($this->getElements(), $filterVariableContent, $filtered),
... | php | public function toArray($filterVariableContent = false, &$filtered = array()){
$data = array(
'serial' => $this->getSerial(),
'body' => $this->getBody(),
'elements' => $this->getArraySerializedElementCollection($this->getElements(), $filterVariableContent, $filtered),
... | [
"public",
"function",
"toArray",
"(",
"$",
"filterVariableContent",
"=",
"false",
",",
"&",
"$",
"filtered",
"=",
"array",
"(",
")",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'serial'",
"=>",
"$",
"this",
"->",
"getSerial",
"(",
")",
",",
"'body'",
... | Get the array representation of the Qti Element.
Particularly helpful for data transformation, e.g. json
@access public
@author Sam, <sam@taotesting.com>
@return array | [
"Get",
"the",
"array",
"representation",
"of",
"the",
"Qti",
"Element",
".",
"Particularly",
"helpful",
"for",
"data",
"transformation",
"e",
".",
"g",
".",
"json"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/container/Container.php#L353-L367 |
oat-sa/extension-tao-itemqti | controller/RestQtiItem.php | RestQtiItem.import | public function import()
{
try {
if ($this->getRequestMethod() != Request::HTTP_POST) {
throw new \common_exception_NotImplemented('Only post method is accepted to import Qti package.');
}
// Get valid package parameter
$package = $this->getUp... | php | public function import()
{
try {
if ($this->getRequestMethod() != Request::HTTP_POST) {
throw new \common_exception_NotImplemented('Only post method is accepted to import Qti package.');
}
// Get valid package parameter
$package = $this->getUp... | [
"public",
"function",
"import",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"getRequestMethod",
"(",
")",
"!=",
"Request",
"::",
"HTTP_POST",
")",
"{",
"throw",
"new",
"\\",
"common_exception_NotImplemented",
"(",
"'Only post method is accepted to i... | Import file entry point by using $this->service
Check POST method & get valid uploaded file | [
"Import",
"file",
"entry",
"point",
"by",
"using",
"$this",
"-",
">",
"service",
"Check",
"POST",
"method",
"&",
"get",
"valid",
"uploaded",
"file"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/RestQtiItem.php#L82-L130 |
oat-sa/extension-tao-itemqti | controller/RestQtiItem.php | RestQtiItem.importDeferred | public function importDeferred()
{
try {
if ($this->getRequestMethod() != Request::HTTP_POST) {
throw new \common_exception_NotImplemented('Only post method is accepted to import Qti package.');
}
$task = ImportQtiItem::createTask(
$this->... | php | public function importDeferred()
{
try {
if ($this->getRequestMethod() != Request::HTTP_POST) {
throw new \common_exception_NotImplemented('Only post method is accepted to import Qti package.');
}
$task = ImportQtiItem::createTask(
$this->... | [
"public",
"function",
"importDeferred",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"getRequestMethod",
"(",
")",
"!=",
"Request",
"::",
"HTTP_POST",
")",
"{",
"throw",
"new",
"\\",
"common_exception_NotImplemented",
"(",
"'Only post method is accep... | Import item package through the task queue. | [
"Import",
"item",
"package",
"through",
"the",
"task",
"queue",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/RestQtiItem.php#L143-L175 |
oat-sa/extension-tao-itemqti | controller/RestQtiItem.php | RestQtiItem.addExtraReturnData | protected function addExtraReturnData(EntityInterface $taskLogEntity)
{
$data = [];
if ($taskLogEntity->getReport()) {
$plainReport = $this->getPlainReport($taskLogEntity->getReport());
//the third report is report of import test
$itemsReport = array_slice($plai... | php | protected function addExtraReturnData(EntityInterface $taskLogEntity)
{
$data = [];
if ($taskLogEntity->getReport()) {
$plainReport = $this->getPlainReport($taskLogEntity->getReport());
//the third report is report of import test
$itemsReport = array_slice($plai... | [
"protected",
"function",
"addExtraReturnData",
"(",
"EntityInterface",
"$",
"taskLogEntity",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"taskLogEntity",
"->",
"getReport",
"(",
")",
")",
"{",
"$",
"plainReport",
"=",
"$",
"this",
"->",
"g... | Add extra values to the JSON returned.
@param EntityInterface $taskLogEntity
@return array | [
"Add",
"extra",
"values",
"to",
"the",
"JSON",
"returned",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/RestQtiItem.php#L183-L200 |
oat-sa/extension-tao-itemqti | controller/RestQtiItem.php | RestQtiItem.getUploadedPackage | protected function getUploadedPackage()
{
if (!$this->hasRequestParameter(self::RESTITEM_PACKAGE_NAME)) {
throw new \common_exception_MissingParameter(self::RESTITEM_PACKAGE_NAME, __CLASS__);
}
$file = \tao_helpers_Http::getUploadedFile(self::RESTITEM_PACKAGE_NAME);
if ... | php | protected function getUploadedPackage()
{
if (!$this->hasRequestParameter(self::RESTITEM_PACKAGE_NAME)) {
throw new \common_exception_MissingParameter(self::RESTITEM_PACKAGE_NAME, __CLASS__);
}
$file = \tao_helpers_Http::getUploadedFile(self::RESTITEM_PACKAGE_NAME);
if ... | [
"protected",
"function",
"getUploadedPackage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRequestParameter",
"(",
"self",
"::",
"RESTITEM_PACKAGE_NAME",
")",
")",
"{",
"throw",
"new",
"\\",
"common_exception_MissingParameter",
"(",
"self",
"::",
"REST... | Return a valid uploaded file
@return string
@throws \common_Exception
@throws \common_exception_Error
@throws \common_exception_MissingParameter
@throws \common_exception_BadRequest
@throws \oat\tao\helpers\FileUploadException | [
"Return",
"a",
"valid",
"uploaded",
"file"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/RestQtiItem.php#L212-L229 |
oat-sa/extension-tao-itemqti | controller/RestQtiItem.php | RestQtiItem.createQtiItem | public function createQtiItem()
{
try {
// Check if it's post method
if ($this->getRequestMethod()!=Request::HTTP_POST) {
throw new \common_exception_NotImplemented('Only post method is accepted to create empty item.');
}
$label = $this->hasRe... | php | public function createQtiItem()
{
try {
// Check if it's post method
if ($this->getRequestMethod()!=Request::HTTP_POST) {
throw new \common_exception_NotImplemented('Only post method is accepted to create empty item.');
}
$label = $this->hasRe... | [
"public",
"function",
"createQtiItem",
"(",
")",
"{",
"try",
"{",
"// Check if it's post method",
"if",
"(",
"$",
"this",
"->",
"getRequestMethod",
"(",
")",
"!=",
"Request",
"::",
"HTTP_POST",
")",
"{",
"throw",
"new",
"\\",
"common_exception_NotImplemented",
"... | Create an empty item | [
"Create",
"an",
"empty",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/RestQtiItem.php#L234-L255 |
oat-sa/extension-tao-itemqti | controller/RestQtiItem.php | RestQtiItem.export | public function export() {
try {
if ($this->getRequestMethod()!=Request::HTTP_GET) {
throw new \common_exception_NotImplemented('Only GET method is accepted to export QIT Item.');
}
if(!$this->hasRequestParameter('id')) {
... | php | public function export() {
try {
if ($this->getRequestMethod()!=Request::HTTP_GET) {
throw new \common_exception_NotImplemented('Only GET method is accepted to export QIT Item.');
}
if(!$this->hasRequestParameter('id')) {
... | [
"public",
"function",
"export",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"getRequestMethod",
"(",
")",
"!=",
"Request",
"::",
"HTTP_GET",
")",
"{",
"throw",
"new",
"\\",
"common_exception_NotImplemented",
"(",
"'Only GET method is accepted to exp... | render an item as a Qti zip package
@author christophe GARCIA <christopheg@taotesting.com> | [
"render",
"an",
"item",
"as",
"a",
"Qti",
"zip",
"package"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/RestQtiItem.php#L261-L302 |
oat-sa/extension-tao-itemqti | controller/RestQtiItem.php | RestQtiItem.createClass | public function createClass()
{
try {
$class = $this->createSubClass(new \core_kernel_classes_Class(TaoOntology::ITEM_CLASS_URI));
$result = [
'message' => __('Class successfully created.'),
'class-uri' => $class->getUri(),
];
... | php | public function createClass()
{
try {
$class = $this->createSubClass(new \core_kernel_classes_Class(TaoOntology::ITEM_CLASS_URI));
$result = [
'message' => __('Class successfully created.'),
'class-uri' => $class->getUri(),
];
... | [
"public",
"function",
"createClass",
"(",
")",
"{",
"try",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"createSubClass",
"(",
"new",
"\\",
"core_kernel_classes_Class",
"(",
"TaoOntology",
"::",
"ITEM_CLASS_URI",
")",
")",
";",
"$",
"result",
"=",
"[",
"'mes... | Create an Item Class
Label parameter is mandatory
If parent class parameter is an uri of valid test class, new class will be created under it
If not parent class parameter is provided, class will be created under root class
Comment parameter is not mandatory, used to describe new created class
@return \core_kernel_cl... | [
"Create",
"an",
"Item",
"Class"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/RestQtiItem.php#L314-L334 |
oat-sa/extension-tao-itemqti | model/qti/response/ResponseCondition.php | ResponseCondition.getRule | public function getRule()
{
$returnValue = (string) '';
// Get the if / elseif conditions and the associated actions
foreach ($this->responseIfs as $responseElseIf){
$returnValue .= (empty($returnValue) ? '' : ' else ').$responseElseIf->getRule();
}
... | php | public function getRule()
{
$returnValue = (string) '';
// Get the if / elseif conditions and the associated actions
foreach ($this->responseIfs as $responseElseIf){
$returnValue .= (empty($returnValue) ? '' : ' else ').$responseElseIf->getRule();
}
... | [
"public",
"function",
"getRule",
"(",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"// Get the if / elseif conditions and the associated actions",
"foreach",
"(",
"$",
"this",
"->",
"responseIfs",
"as",
"$",
"responseElseIf",
")",
"{",
"$",
... | 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/ResponseCondition.php#L71-L94 |
oat-sa/extension-tao-itemqti | model/qti/ManifestParserFactory.php | ManifestParserFactory.getResourcesFromManifest | public static function getResourcesFromManifest( SimpleXMLElement $source)
{
$returnValue = array();
//check of the root tag
if($source->getName() != 'manifest'){
throw new ParsingException("incorrect manifest root tag");
}
$resourceNodes = $source->xpath("//*[name(.)='resource']");
foreac... | php | public static function getResourcesFromManifest( SimpleXMLElement $source)
{
$returnValue = array();
//check of the root tag
if($source->getName() != 'manifest'){
throw new ParsingException("incorrect manifest root tag");
}
$resourceNodes = $source->xpath("//*[name(.)='resource']");
foreac... | [
"public",
"static",
"function",
"getResourcesFromManifest",
"(",
"SimpleXMLElement",
"$",
"source",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"//check of the root tag",
"if",
"(",
"$",
"source",
"->",
"getName",
"(",
")",
"!=",
"'manifest'",
"... | Enables you to build the QTI_Resources from a manifest xml data node
Content Packaging 1.1)
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param SimpleXMLElement source
@return array
@see http://www.imsglobal.org/question/qti_v2p0/imsqti_intgv2p0.html#section10003 | [
"Enables",
"you",
"to",
"build",
"the",
"QTI_Resources",
"from",
"a",
"manifest",
"xml",
"data",
"node",
"Content",
"Packaging",
"1",
".",
"1",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/ManifestParserFactory.php#L50-L98 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.resetAttributes | public function resetAttributes(){
$this->attributes = array();
foreach($this->getUsedAttributes() as $attributeClass){
if(class_exists($attributeClass) && is_subclass_of($attributeClass, 'oat\\taoQtiItem\\model\\qti\\attribute\\Attribute')){
$attribute = new $attributeClass(... | php | public function resetAttributes(){
$this->attributes = array();
foreach($this->getUsedAttributes() as $attributeClass){
if(class_exists($attributeClass) && is_subclass_of($attributeClass, 'oat\\taoQtiItem\\model\\qti\\attribute\\Attribute')){
$attribute = new $attributeClass(... | [
"public",
"function",
"resetAttributes",
"(",
")",
"{",
"$",
"this",
"->",
"attributes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getUsedAttributes",
"(",
")",
"as",
"$",
"attributeClass",
")",
"{",
"if",
"(",
"class_exists",
"(",... | Reset the attributes values to the default values defined by the standard | [
"Reset",
"the",
"attributes",
"values",
"to",
"the",
"default",
"values",
"defined",
"by",
"the",
"standard"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L93-L103 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.removeAttributeValue | public function removeAttributeValue($name){
if(isset($this->attributes[$name])){
$this->attributes[$name]->setNull();
}
} | php | public function removeAttributeValue($name){
if(isset($this->attributes[$name])){
$this->attributes[$name]->setNull();
}
} | [
"public",
"function",
"removeAttributeValue",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"attributes",
"[",
"$",
"name",
"]",
"->",
"setNull",
"(",
... | Remove the actual value of an attribute, distinguish from empty value
@param string $name | [
"Remove",
"the",
"actual",
"value",
"of",
"an",
"attribute",
"distinguish",
"from",
"empty",
"value"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L114-L118 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.setAttributes | public function setAttributes($values){
if(is_array($values)){
foreach($values as $name => $value){
$this->setAttribute($name, $value);
}
}else{
throw new InvalidArgumentException('"values" must be an array');
}
} | php | public function setAttributes($values){
if(is_array($values)){
foreach($values as $name => $value){
$this->setAttribute($name, $value);
}
}else{
throw new InvalidArgumentException('"values" must be an array');
}
} | [
"public",
"function",
"setAttributes",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"... | Set the attributes for the the Qti Element
Argument format: array(attributeName => value)
@param array $values
@throws InvalidArgumentException | [
"Set",
"the",
"attributes",
"for",
"the",
"the",
"Qti",
"Element",
"Argument",
"format",
":",
"array",
"(",
"attributeName",
"=",
">",
"value",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L127-L137 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.setAttribute | public function setAttribute($name, $value){
$returnValue = false;
if(is_null($value)){
return $returnValue;
}
if(isset($this->attributes[$name])){
$datatypeClass = $this->attributes[$name]->getType();
// check if the attribute needs an element lev... | php | public function setAttribute($name, $value){
$returnValue = false;
if(is_null($value)){
return $returnValue;
}
if(isset($this->attributes[$name])){
$datatypeClass = $this->attributes[$name]->getType();
// check if the attribute needs an element lev... | [
"public",
"function",
"setAttribute",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"returnValue",
";",
"}",
"if",
"(",
"isset",
"(",
"$"... | Set the value of an attribute
@param string $name
@param mixed $value
@return boolean
@throws InvalidArgumentException
@throws \oat\taoQtiItem\model\qti\exception\QtiModelException | [
"Set",
"the",
"value",
"of",
"an",
"attribute"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L148-L193 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.validateAttribute | public function validateAttribute($name, $value = null){
$returnValue = false;
if(isset($this->attributes[$name])){
if(is_null($value)){
$value = $this->attributes[$name]->getValue();
}
$datatypeClass = $this->attributes[$name]->getType();
... | php | public function validateAttribute($name, $value = null){
$returnValue = false;
if(isset($this->attributes[$name])){
if(is_null($value)){
$value = $this->attributes[$name]->getValue();
}
$datatypeClass = $this->attributes[$name]->getType();
... | [
"public",
"function",
"validateAttribute",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"if",
"(",... | Validate an attribute of the element, at the element level
(the validator of the attributes are on the attribute level)
@param string $name
@param mixed $value
@return boolean
@throws \oat\taoQtiItem\model\qti\exception\QtiModelException | [
"Validate",
"an",
"attribute",
"of",
"the",
"element",
"at",
"the",
"element",
"level",
"(",
"the",
"validator",
"of",
"the",
"attributes",
"are",
"on",
"the",
"attribute",
"level",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L204-L242 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getIdentifiedElement | public function getIdentifiedElement($identifier, $elementClasses = array()){
$returnValue = null;
if(!is_array($elementClasses)){
throw new InvalidArgumentException('elementClasses must be an array');
}
$relatedItem = $this->getRelatedItem();
if(!is_null($relatedI... | php | public function getIdentifiedElement($identifier, $elementClasses = array()){
$returnValue = null;
if(!is_array($elementClasses)){
throw new InvalidArgumentException('elementClasses must be an array');
}
$relatedItem = $this->getRelatedItem();
if(!is_null($relatedI... | [
"public",
"function",
"getIdentifiedElement",
"(",
"$",
"identifier",
",",
"$",
"elementClasses",
"=",
"array",
"(",
")",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"elementClasses",
")",
")",
"{",
"throw",
"new... | Find the identified object corresponding to the identifier string
The optional argument $elementClasses search a specific QTI element class
@param string $identifier
@param array $elementClasses
@return \oat\taoQtiItem\model\qti\IdentifiedElement | [
"Find",
"the",
"identified",
"object",
"corresponding",
"to",
"the",
"identifier",
"string",
"The",
"optional",
"argument",
"$elementClasses",
"search",
"a",
"specific",
"QTI",
"element",
"class"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L252-L277 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.attr | public function attr($name, $value = null){
if(is_null($value)){
return $this->getAttributeValue($name);
}else{
return $this->setAttribute($name, $value);
}
} | php | public function attr($name, $value = null){
if(is_null($value)){
return $this->getAttributeValue($name);
}else{
return $this->setAttribute($name, $value);
}
} | [
"public",
"function",
"attr",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getAttributeValue",
"(",
"$",
"name",
")",
";",
"}",
"else",
"{",
"ret... | Short handy method to get/set an attribute value
@param string $name
@param mixed $value
@return mixed | [
"Short",
"handy",
"method",
"to",
"get",
"/",
"set",
"an",
"attribute",
"value"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L296-L302 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.addClass | public function addClass($className) {
$oldClassName = $this->getAttributeValue('class');
$oldClassNameArr = $oldClassName ? explode(' ', $oldClassName) : array();
$classNameArr = array_merge($oldClassNameArr, explode(' ', $className));
// housekeeping
$classNameArr = ar... | php | public function addClass($className) {
$oldClassName = $this->getAttributeValue('class');
$oldClassNameArr = $oldClassName ? explode(' ', $oldClassName) : array();
$classNameArr = array_merge($oldClassNameArr, explode(' ', $className));
// housekeeping
$classNameArr = ar... | [
"public",
"function",
"addClass",
"(",
"$",
"className",
")",
"{",
"$",
"oldClassName",
"=",
"$",
"this",
"->",
"getAttributeValue",
"(",
"'class'",
")",
";",
"$",
"oldClassNameArr",
"=",
"$",
"oldClassName",
"?",
"explode",
"(",
"' '",
",",
"$",
"oldClass... | Add a CSS class to the item body
@author Dieter Raber <dieter@taotesting.com>
@param $className one or more class names, separated by space | [
"Add",
"a",
"CSS",
"class",
"to",
"the",
"item",
"body"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L310-L317 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.removeClass | public function removeClass($className) {
$oldClassName = $this->getAttributeValue('class');
$oldClassNameArr = $oldClassName ? explode(' ', $oldClassName) : array();
unset($oldClassNameArr[array_search($className, $oldClassNameArr)]);
$this->setAttribute('class', implode(' ', $oldCla... | php | public function removeClass($className) {
$oldClassName = $this->getAttributeValue('class');
$oldClassNameArr = $oldClassName ? explode(' ', $oldClassName) : array();
unset($oldClassNameArr[array_search($className, $oldClassNameArr)]);
$this->setAttribute('class', implode(' ', $oldCla... | [
"public",
"function",
"removeClass",
"(",
"$",
"className",
")",
"{",
"$",
"oldClassName",
"=",
"$",
"this",
"->",
"getAttributeValue",
"(",
"'class'",
")",
";",
"$",
"oldClassNameArr",
"=",
"$",
"oldClassName",
"?",
"explode",
"(",
"' '",
",",
"$",
"oldCl... | Add a CSS class from the item body
@author Dieter Raber <dieter@taotesting.com>
@param $className | [
"Add",
"a",
"CSS",
"class",
"from",
"the",
"item",
"body"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L325-L330 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getAttributeValue | public function getAttributeValue($name){
$returnValue = null;
if($this->hasAttribute($name)){
$returnValue = $this->attributes[$name]->getValue();
}
return $returnValue;
} | php | public function getAttributeValue($name){
$returnValue = null;
if($this->hasAttribute($name)){
$returnValue = $this->attributes[$name]->getValue();
}
return $returnValue;
} | [
"public",
"function",
"getAttributeValue",
"(",
"$",
"name",
")",
"{",
"$",
"returnValue",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"hasAttribute",
"(",
"$",
"name",
")",
")",
"{",
"$",
"returnValue",
"=",
"$",
"this",
"->",
"attributes",
"[",
... | Get the attribute's actual value (not as an Attribute object)
@param string $name
@return mixed | [
"Get",
"the",
"attribute",
"s",
"actual",
"value",
"(",
"not",
"as",
"an",
"Attribute",
"object",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L348-L354 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getAttributeValues | public function getAttributeValues($filterNull = true){
$returnValue = array();
foreach($this->attributes as $name => $attribute){
if(!$filterNull || !$attribute->isNull()){
$returnValue[$name] = $attribute->getValue();
}
}
return $returnValue;
... | php | public function getAttributeValues($filterNull = true){
$returnValue = array();
foreach($this->attributes as $name => $attribute){
if(!$filterNull || !$attribute->isNull()){
$returnValue[$name] = $attribute->getValue();
}
}
return $returnValue;
... | [
"public",
"function",
"getAttributeValues",
"(",
"$",
"filterNull",
"=",
"true",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"name",
"=>",
"$",
"attribute",
")",
"{",
"if",
"(",... | Get all attributes' values
@return array | [
"Get",
"all",
"attributes",
"values"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L361-L369 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getTemplateQti | public static function getTemplateQti(){
if(empty(static::$qtiTagName)){
throw new QtiModelException('The element has no tag name defined : '.get_called_class());
}
$template = static::getTemplatePath().'/qti.'.static::$qtiTagName.'.tpl.php';
if(!file_exists($template)){
... | php | public static function getTemplateQti(){
if(empty(static::$qtiTagName)){
throw new QtiModelException('The element has no tag name defined : '.get_called_class());
}
$template = static::getTemplatePath().'/qti.'.static::$qtiTagName.'.tpl.php';
if(!file_exists($template)){
... | [
"public",
"static",
"function",
"getTemplateQti",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"static",
"::",
"$",
"qtiTagName",
")",
")",
"{",
"throw",
"new",
"QtiModelException",
"(",
"'The element has no tag name defined : '",
".",
"get_called_class",
"(",
")",
"... | Get the absolute path of the template of the qti.xml
@return string
@throws \oat\taoQtiItem\model\qti\exception\QtiModelException | [
"Get",
"the",
"absolute",
"path",
"of",
"the",
"template",
"of",
"the",
"qti",
".",
"xml"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L387-L397 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getTemplateQtiVariables | protected function getTemplateQtiVariables(){
$variables = array();
$variables['tag'] = static::$qtiTagName;
$variables['attributes'] = $this->getAttributeValues();
if($this instanceof FlowContainer){
$variables['body'] = $this->getBody()->toQTI();
}
return $... | php | protected function getTemplateQtiVariables(){
$variables = array();
$variables['tag'] = static::$qtiTagName;
$variables['attributes'] = $this->getAttributeValues();
if($this instanceof FlowContainer){
$variables['body'] = $this->getBody()->toQTI();
}
return $... | [
"protected",
"function",
"getTemplateQtiVariables",
"(",
")",
"{",
"$",
"variables",
"=",
"array",
"(",
")",
";",
"$",
"variables",
"[",
"'tag'",
"]",
"=",
"static",
"::",
"$",
"qtiTagName",
";",
"$",
"variables",
"[",
"'attributes'",
"]",
"=",
"$",
"thi... | Get the variables to be used in the qti.xml template
@return array | [
"Get",
"the",
"variables",
"to",
"be",
"used",
"in",
"the",
"qti",
".",
"xml",
"template"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L404-L413 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.toQTI | public function toQTI(){
$template = static::getTemplateQti();
$variables = $this->getTemplateQtiVariables();
if(isset($variables['attributes'])){
$variables['attributes'] = $this->xmlizeOptions($variables['attributes'], true);
}
$tplRenderer = new taoItems_models_cl... | php | public function toQTI(){
$template = static::getTemplateQti();
$variables = $this->getTemplateQtiVariables();
if(isset($variables['attributes'])){
$variables['attributes'] = $this->xmlizeOptions($variables['attributes'], true);
}
$tplRenderer = new taoItems_models_cl... | [
"public",
"function",
"toQTI",
"(",
")",
"{",
"$",
"template",
"=",
"static",
"::",
"getTemplateQti",
"(",
")",
";",
"$",
"variables",
"=",
"$",
"this",
"->",
"getTemplateQtiVariables",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"variables",
"[",
"'a... | Export the data to the QTI XML format
@return string | [
"Export",
"the",
"data",
"to",
"the",
"QTI",
"XML",
"format"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L420-L431 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.toArray | public function toArray($filterVariableContent = false, &$filtered = array()){
$data = array();
$data['serial'] = $this->getSerial();
$tag = $this->getQtiTag();
if(!empty($tag)){
$data['qtiClass'] = $tag;
}
$attributes = $this->getAttributeValues();
$... | php | public function toArray($filterVariableContent = false, &$filtered = array()){
$data = array();
$data['serial'] = $this->getSerial();
$tag = $this->getQtiTag();
if(!empty($tag)){
$data['qtiClass'] = $tag;
}
$attributes = $this->getAttributeValues();
$... | [
"public",
"function",
"toArray",
"(",
"$",
"filterVariableContent",
"=",
"false",
",",
"&",
"$",
"filtered",
"=",
"array",
"(",
")",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"data",
"[",
"'serial'",
"]",
"=",
"$",
"this",
"->",
"get... | Get the array representation of the Qti Element.
Particularly helpful for data transformation, e.g. json
@param $filterVariableContent
@param array $filtered
@return array | [
"Get",
"the",
"array",
"representation",
"of",
"the",
"Qti",
"Element",
".",
"Particularly",
"helpful",
"for",
"data",
"transformation",
"e",
".",
"g",
".",
"json"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L441-L462 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getTemplatePath | public static function getTemplatePath(){
if(empty(self::$templatesPath)){
$dir = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getDir();
self::$templatesPath = $dir.'model/qti/templates/';
}
$returnValue = self::$templatesPath;
retu... | php | public static function getTemplatePath(){
if(empty(self::$templatesPath)){
$dir = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getDir();
self::$templatesPath = $dir.'model/qti/templates/';
}
$returnValue = self::$templatesPath;
retu... | [
"public",
"static",
"function",
"getTemplatePath",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"templatesPath",
")",
")",
"{",
"$",
"dir",
"=",
"\\",
"common_ext_ExtensionsManager",
"::",
"singleton",
"(",
")",
"->",
"getExtensionById",
"(",
... | Get the main template directory
@access public
@author Sam, <sam@taotesting.com>
@return string | [
"Get",
"the",
"main",
"template",
"directory"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L471-L479 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.setRelatedItem | public function setRelatedItem(Item $item, $force = false){
$returnValue = false;
if(!is_null($this->relatedItem) && $this->relatedItem->getSerial() == $item->getSerial()){
$returnValue = true; // identical
}elseif(!$force && !is_null($this->relatedItem)){
throw new QtiM... | php | public function setRelatedItem(Item $item, $force = false){
$returnValue = false;
if(!is_null($this->relatedItem) && $this->relatedItem->getSerial() == $item->getSerial()){
$returnValue = true; // identical
}elseif(!$force && !is_null($this->relatedItem)){
throw new QtiM... | [
"public",
"function",
"setRelatedItem",
"(",
"Item",
"$",
"item",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"returnValue",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"relatedItem",
")",
"&&",
"$",
"this",
"->",
"relat... | Set the item the current Qti Element belongs to.
The related item assignment is propagated to all containing Qti Element of the current one.
The "force" option allows changing the associated item (even if it has already been defined)
@param \oat\taoQtiItem\model\qti\Item $item
@param boolean $force
@return boolean
@th... | [
"Set",
"the",
"item",
"the",
"current",
"Qti",
"Element",
"belongs",
"to",
".",
"The",
"related",
"item",
"assignment",
"is",
"propagated",
"to",
"all",
"containing",
"Qti",
"Element",
"of",
"the",
"current",
"one",
".",
"The",
"force",
"option",
"allows",
... | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L491-L530 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getComposingElements | public function getComposingElements($className = ''){
$returnValue = array();
if($className === ''){
$className = 'oat\taoQtiItem\model\qti\Element';
}
$reflection = new ReflectionClass($this);
foreach($reflection->getProperties() as $property){
if(!$pr... | php | public function getComposingElements($className = ''){
$returnValue = array();
if($className === ''){
$className = 'oat\taoQtiItem\model\qti\Element';
}
$reflection = new ReflectionClass($this);
foreach($reflection->getProperties() as $property){
if(!$pr... | [
"public",
"function",
"getComposingElements",
"(",
"$",
"className",
"=",
"''",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"className",
"===",
"''",
")",
"{",
"$",
"className",
"=",
"'oat\\taoQtiItem\\model\\qti\\Element'",
";... | Recursively get all Qti Elements contained within the current Qti Element
@param string $className
@return array | [
"Recursively",
"get",
"all",
"Qti",
"Elements",
"contained",
"within",
"the",
"current",
"Qti",
"Element"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L538-L575 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.xmlizeOptions | protected function xmlizeOptions($formalOpts = array(), $recursive = false){
$returnValue = (string) '';
if(!is_array($formalOpts)){
throw new InvalidArgumentException('formalOpts must be an array, '.gettype($formalOpts).' given');
}
$options = (!$recursive) ? $this->getAttr... | php | protected function xmlizeOptions($formalOpts = array(), $recursive = false){
$returnValue = (string) '';
if(!is_array($formalOpts)){
throw new InvalidArgumentException('formalOpts must be an array, '.gettype($formalOpts).' given');
}
$options = (!$recursive) ? $this->getAttr... | [
"protected",
"function",
"xmlizeOptions",
"(",
"$",
"formalOpts",
"=",
"array",
"(",
")",
",",
"$",
"recursive",
"=",
"false",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"formalOpts",
")",
... | This method enables you to build a string of attributes for an xml node
from the Qti Element attributes according to their types.
@access protected
@author Sam, <sam@taotesting.com>
@param array formalOpts
@param boolean recursive
@return string | [
"This",
"method",
"enables",
"you",
"to",
"build",
"a",
"string",
"of",
"attributes",
"for",
"an",
"xml",
"node",
"from",
"the",
"Qti",
"Element",
"attributes",
"according",
"to",
"their",
"types",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L596-L636 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.getSerial | public function getSerial(){
if(empty($this->serial)){
$this->serial = $this->buildSerial();
}
$returnValue = $this->serial;
return (string) $returnValue;
} | php | public function getSerial(){
if(empty($this->serial)){
$this->serial = $this->buildSerial();
}
$returnValue = $this->serial;
return (string) $returnValue;
} | [
"public",
"function",
"getSerial",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"serial",
")",
")",
"{",
"$",
"this",
"->",
"serial",
"=",
"$",
"this",
"->",
"buildSerial",
"(",
")",
";",
"}",
"$",
"returnValue",
"=",
"$",
"this",
"... | Obtain a serial for the instance of the class that implements the
@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@return string | [
"Obtain",
"a",
"serial",
"for",
"the",
"instance",
"of",
"the",
"class",
"that",
"implements",
"the"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L645-L652 |
oat-sa/extension-tao-itemqti | model/qti/Element.php | Element.buildSerial | protected function buildSerial(){
if(DEBUG_MODE){
//in debug mode, use more meaningful serials
$clazz = strtolower(get_class($this));
$prefix = substr($clazz, strpos($clazz, 'taoqtiitem\\model\\qti\\') + 21).'_';
$serial = str_replace('.', '', uniqid($prefix, tru... | php | protected function buildSerial(){
if(DEBUG_MODE){
//in debug mode, use more meaningful serials
$clazz = strtolower(get_class($this));
$prefix = substr($clazz, strpos($clazz, 'taoqtiitem\\model\\qti\\') + 21).'_';
$serial = str_replace('.', '', uniqid($prefix, tru... | [
"protected",
"function",
"buildSerial",
"(",
")",
"{",
"if",
"(",
"DEBUG_MODE",
")",
"{",
"//in debug mode, use more meaningful serials",
"$",
"clazz",
"=",
"strtolower",
"(",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"$",
"prefix",
"=",
"substr",
"(",
"... | create a unique serial number
@access protected
@author Sam, <sam@taotesting.com>
@return string | [
"create",
"a",
"unique",
"serial",
"number"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/Element.php#L661-L675 |
oat-sa/extension-tao-itemqti | model/Export/QTIPackedItemExporter.php | QTIPackedItemExporter.containsItem | protected function containsItem()
{
$found = false;
if ($this->hasManifest()) {
foreach ($this->getManifest()->getElementsByTagName('resource') as $resourceNode) {
/** @var \DOMElement $resourceNode */
if ($resourceNode->getAttribute('identifier') == $this... | php | protected function containsItem()
{
$found = false;
if ($this->hasManifest()) {
foreach ($this->getManifest()->getElementsByTagName('resource') as $resourceNode) {
/** @var \DOMElement $resourceNode */
if ($resourceNode->getAttribute('identifier') == $this... | [
"protected",
"function",
"containsItem",
"(",
")",
"{",
"$",
"found",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"hasManifest",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getManifest",
"(",
")",
"->",
"getElementsByTagName",
"(",
"'r... | Whenever the item is already in the manifest
@return boolean | [
"Whenever",
"the",
"item",
"is",
"already",
"in",
"the",
"manifest"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/QTIPackedItemExporter.php#L94-L107 |
oat-sa/extension-tao-itemqti | model/Export/QTIPackedItemExporter.php | QTIPackedItemExporter.exportManifest | public function exportManifest($options = [], $exportResult = [])
{
$base = $this->buildBasePath();
$zipArchive = $this->getZip();
$qtiFile = '';
$qtiResources = array();
$sharedAssets = isset($exportResult['portableAssets']) ? $exportResult['portableAssets'] : [];
... | php | public function exportManifest($options = [], $exportResult = [])
{
$base = $this->buildBasePath();
$zipArchive = $this->getZip();
$qtiFile = '';
$qtiResources = array();
$sharedAssets = isset($exportResult['portableAssets']) ? $exportResult['portableAssets'] : [];
... | [
"public",
"function",
"exportManifest",
"(",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"exportResult",
"=",
"[",
"]",
")",
"{",
"$",
"base",
"=",
"$",
"this",
"->",
"buildBasePath",
"(",
")",
";",
"$",
"zipArchive",
"=",
"$",
"this",
"->",
"getZip",
... | Build, merge and export the IMS Manifest into the target ZIP archive.
@throws | [
"Build",
"merge",
"and",
"export",
"the",
"IMS",
"Manifest",
"into",
"the",
"target",
"ZIP",
"archive",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/QTIPackedItemExporter.php#L124-L219 |
oat-sa/extension-tao-itemqti | model/CustomInteractionRegistry.php | CustomInteractionRegistry.register | public static function register($qtiClass, $phpClass) {
if (!class_exists($phpClass)) {
throw new common_exception_Error('Custom interaction class '.$phpClass.' not found');
}
if (!is_subclass_of($phpClass, 'oat\taoQtiItem\model\qti\interaction\CustomInteraction')) {
thro... | php | public static function register($qtiClass, $phpClass) {
if (!class_exists($phpClass)) {
throw new common_exception_Error('Custom interaction class '.$phpClass.' not found');
}
if (!is_subclass_of($phpClass, 'oat\taoQtiItem\model\qti\interaction\CustomInteraction')) {
thro... | [
"public",
"static",
"function",
"register",
"(",
"$",
"qtiClass",
",",
"$",
"phpClass",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"phpClass",
")",
")",
"{",
"throw",
"new",
"common_exception_Error",
"(",
"'Custom interaction class '",
".",
"$",
"ph... | Register a new custom interaction
@param string $qtiClass
@param string $phpClass
@deprecated
@throws common_exception_Error | [
"Register",
"a",
"new",
"custom",
"interaction"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/CustomInteractionRegistry.php#L65-L76 |
oat-sa/extension-tao-itemqti | model/CustomInteractionRegistry.php | CustomInteractionRegistry.getCustomInteractions | public static function getCustomInteractions() {
$taoQtiItem = common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
$map = $taoQtiItem->getConfig(self::CONFIG_ID);
return is_array($map) ? $map : array();
} | php | public static function getCustomInteractions() {
$taoQtiItem = common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
$map = $taoQtiItem->getConfig(self::CONFIG_ID);
return is_array($map) ? $map : array();
} | [
"public",
"static",
"function",
"getCustomInteractions",
"(",
")",
"{",
"$",
"taoQtiItem",
"=",
"common_ext_ExtensionsManager",
"::",
"singleton",
"(",
")",
"->",
"getExtensionById",
"(",
"'taoQtiItem'",
")",
";",
"$",
"map",
"=",
"$",
"taoQtiItem",
"->",
"getCo... | Returns a list of registered custom interactions.
With the qti classes as keys and the php classnames that
implementat these interactions as values
@deprecated
@return array | [
"Returns",
"a",
"list",
"of",
"registered",
"custom",
"interactions",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/CustomInteractionRegistry.php#L87-L91 |
oat-sa/extension-tao-itemqti | model/CustomInteractionRegistry.php | CustomInteractionRegistry.getCustomInteractionByName | public static function getCustomInteractionByName($name){
$all = self::getCustomInteractions();
if(isset($all[$name])){
return $all[$name];
}
return '';
} | php | public static function getCustomInteractionByName($name){
$all = self::getCustomInteractions();
if(isset($all[$name])){
return $all[$name];
}
return '';
} | [
"public",
"static",
"function",
"getCustomInteractionByName",
"(",
"$",
"name",
")",
"{",
"$",
"all",
"=",
"self",
"::",
"getCustomInteractions",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"all",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
... | Get the php class that represents a custom interaction from its class attribute
@param string $name
@deprecated
@return string | [
"Get",
"the",
"php",
"class",
"that",
"represents",
"a",
"custom",
"interaction",
"from",
"its",
"class",
"attribute"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/CustomInteractionRegistry.php#L101-L107 |
oat-sa/extension-tao-itemqti | model/portableElement/parser/itemParser/PortableElementItemParser.php | PortableElementItemParser.importPortableElementFile | public function importPortableElementFile($absolutePath, $relativePath)
{
if ($this->isPortableElementAsset($relativePath)) {
//marked the file as being ok to be imported in the end
$this->importingFiles[] = $relativePath;
//@todo remove qti file used by PCI
... | php | public function importPortableElementFile($absolutePath, $relativePath)
{
if ($this->isPortableElementAsset($relativePath)) {
//marked the file as being ok to be imported in the end
$this->importingFiles[] = $relativePath;
//@todo remove qti file used by PCI
... | [
"public",
"function",
"importPortableElementFile",
"(",
"$",
"absolutePath",
",",
"$",
"relativePath",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPortableElementAsset",
"(",
"$",
"relativePath",
")",
")",
"{",
"//marked the file as being ok to be imported in the end",
... | Handle pci import process for a file
@param $absolutePath
@param $relativePath
@return array
@throws \common_Exception
@throws \tao_models_classes_FileNotFoundException | [
"Handle",
"pci",
"import",
"process",
"for",
"a",
"file"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/parser/itemParser/PortableElementItemParser.php#L85-L98 |
oat-sa/extension-tao-itemqti | model/portableElement/parser/itemParser/PortableElementItemParser.php | PortableElementItemParser.getFileInfo | public function getFileInfo($path, $relPath) {
if (file_exists($path)) {
return array(
'name' => basename($path),
'uri' => $relPath,
'mime' => \tao_helpers_File::getMimeType($path),
'filePath' => $path,
'size' => filesi... | php | public function getFileInfo($path, $relPath) {
if (file_exists($path)) {
return array(
'name' => basename($path),
'uri' => $relPath,
'mime' => \tao_helpers_File::getMimeType($path),
'filePath' => $path,
'size' => filesi... | [
"public",
"function",
"getFileInfo",
"(",
"$",
"path",
",",
"$",
"relPath",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"return",
"array",
"(",
"'name'",
"=>",
"basename",
"(",
"$",
"path",
")",
",",
"'uri'",
"=>",
"$",
"re... | Get details about file
@param $path
@param $relPath
@return array
@throws \tao_models_classes_FileNotFoundException | [
"Get",
"details",
"about",
"file"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/parser/itemParser/PortableElementItemParser.php#L129-L142 |
oat-sa/extension-tao-itemqti | model/portableElement/parser/itemParser/PortableElementItemParser.php | PortableElementItemParser.feedRequiredFiles | protected function feedRequiredFiles(Item $item)
{
$this->requiredFiles = [];
$this->portableObjects = [];
$this->picModels = [];
$models = $this->getPortableFactory()->getModels();
foreach ($models as $model) {
$className = $model->getQtiElementClassName();
... | php | protected function feedRequiredFiles(Item $item)
{
$this->requiredFiles = [];
$this->portableObjects = [];
$this->picModels = [];
$models = $this->getPortableFactory()->getModels();
foreach ($models as $model) {
$className = $model->getQtiElementClassName();
... | [
"protected",
"function",
"feedRequiredFiles",
"(",
"Item",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"requiredFiles",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"portableObjects",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"picModels",
"=",
"[",
"]",
";",
"$... | Feed the instance with portable related data extracted from the item
@param Item $item
@throws \common_Exception | [
"Feed",
"the",
"instance",
"with",
"portable",
"related",
"data",
"extracted",
"from",
"the",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/parser/itemParser/PortableElementItemParser.php#L170-L185 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.