ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCmiXapiVerbList Class Reference
+ Collaboration diagram for ilCmiXapiVerbList:

Public Member Functions

 isValidVerb (string $verb)
 
 getVerbUri (string $verb)
 
 getDynamicSelectOptions (?array $verbs)
 
 getSelectOptions ()
 

Static Public Member Functions

static getVerbTranslation (ilLanguage $lng, string $verb)
 
static getInstance ()
 

Data Fields

const COMPLETED = 'http://adlnet.gov/expapi/verbs/completed'
 
const PASSED = 'http://adlnet.gov/expapi/verbs/passed'
 
const FAILED = 'http://adlnet.gov/expapi/verbs/failed'
 
const SATISFIED = 'http://adlnet.gov/expapi/verbs/satisfied'
 
const PROGRESSED = 'http://adlnet.gov/expapi/verbs/progressed'
 
const EXPERIENCED = 'http://adlnet.gov/expapi/verbs/experienced'
 

Protected Attributes

array $verbs
 

Detailed Description

Definition at line 30 of file class.ilCmiXapiVerbList.php.

Member Function Documentation

◆ getDynamicSelectOptions()

ilCmiXapiVerbList::getDynamicSelectOptions ( ?array  $verbs)

Definition at line 79 of file class.ilCmiXapiVerbList.php.

79 : array
80 {
81 global $DIC; /* @var \ILIAS\DI\Container $DIC */
82
83 $options = array(
84 '' => $DIC->language()->txt('cmix_all_verbs')
85 );
86
87 if (is_array($verbs)) {
88 foreach ($verbs as $verb) {
89 $verb = $verb['_id'];
90 $options[urlencode($verb)] = self::getVerbTranslation(
91 $DIC->language(),
92 $verb
93 );
94 }
95 }
96
97 return $options;
98 }
static getVerbTranslation(ilLanguage $lng, string $verb)
global $DIC
Definition: shib_login.php:26

References $DIC, $verbs, and getVerbTranslation().

+ Here is the call graph for this function:

◆ getInstance()

◆ getSelectOptions()

ilCmiXapiVerbList::getSelectOptions ( )
Returns
array<string, mixed>

Definition at line 103 of file class.ilCmiXapiVerbList.php.

103 : array
104 {
105 global $DIC; /* @var \ILIAS\DI\Container $DIC */
106
107 $options = array(
108 '' => $DIC->language()->txt('cmix_all_verbs')
109 );
110
111 foreach ($this->verbs as $verb) {
112 $options[urlencode($verb)] = self::getVerbTranslation(
113 $DIC->language(),
114 $verb
115 );
116 }
117
118 return $options;
119 }

References $DIC, and getVerbTranslation().

+ Here is the call graph for this function:

◆ getVerbTranslation()

static ilCmiXapiVerbList::getVerbTranslation ( ilLanguage  $lng,
string  $verb 
)
static

Definition at line 121 of file class.ilCmiXapiVerbList.php.

121 : string
122 {
123 $verbMatch = preg_match('/\/([^\/]+)$/', $verb, $matches);
124 $shortVerb = $matches[1];
125 $langVar = preg_replace('/http(s)?:\/\//', '', $verb);
126 $langVar = str_replace('.', '', $langVar);
127 $langVar = str_replace('/', '_', $langVar);
128 $langVar = 'cmix_' . $langVar;
129 $translatedVerb = $lng->txt($langVar);
130 // check no translation found?
131 if (strpos($translatedVerb, '-cmix_') === 0) {
132 return $shortVerb;
133 } else {
134 return $translatedVerb;
135 }
136 }
global $lng
Definition: privfeed.php:31

References $lng.

Referenced by ilCmiXapiStatementsTableGUI\fillRow(), getDynamicSelectOptions(), and getSelectOptions().

+ Here is the caller graph for this function:

◆ getVerbUri()

ilCmiXapiVerbList::getVerbUri ( string  $verb)

Definition at line 74 of file class.ilCmiXapiVerbList.php.

74 : string
75 {
76 return 'http://adlnet.gov/expapi/verbs/' . $verb;
77 }

◆ isValidVerb()

ilCmiXapiVerbList::isValidVerb ( string  $verb)

Definition at line 69 of file class.ilCmiXapiVerbList.php.

69 : bool
70 {
71 return true;//not necessary for dynamic verbs: in_array($verb, $this->verbs);
72 }

Field Documentation

◆ $verbs

array ilCmiXapiVerbList::$verbs
protected
Initial value:
= [
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
'http:
]
static http()
Fetches the global http state from ILIAS.

Definition at line 39 of file class.ilCmiXapiVerbList.php.

Referenced by getDynamicSelectOptions().

◆ COMPLETED

const ilCmiXapiVerbList::COMPLETED = 'http://adlnet.gov/expapi/verbs/completed'

◆ EXPERIENCED

const ilCmiXapiVerbList::EXPERIENCED = 'http://adlnet.gov/expapi/verbs/experienced'

Definition at line 37 of file class.ilCmiXapiVerbList.php.

◆ FAILED

const ilCmiXapiVerbList::FAILED = 'http://adlnet.gov/expapi/verbs/failed'

Definition at line 34 of file class.ilCmiXapiVerbList.php.

◆ PASSED

const ilCmiXapiVerbList::PASSED = 'http://adlnet.gov/expapi/verbs/passed'

◆ PROGRESSED

const ilCmiXapiVerbList::PROGRESSED = 'http://adlnet.gov/expapi/verbs/progressed'

Definition at line 36 of file class.ilCmiXapiVerbList.php.

◆ SATISFIED

const ilCmiXapiVerbList::SATISFIED = 'http://adlnet.gov/expapi/verbs/satisfied'

Definition at line 35 of file class.ilCmiXapiVerbList.php.


The documentation for this class was generated from the following file: