ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $DIC.

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  }
global $DIC
Definition: feed.php:28

◆ getInstance()

◆ getSelectOptions()

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

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

References $DIC.

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  }
global $DIC
Definition: feed.php:28

◆ getVerbTranslation()

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

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

References ilLanguage\txt().

Referenced by ilCmiXapiStatementsTableGUI\fillRow().

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  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ 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://adlnet.gov/expapi/verbs/abandoned',
'http://adlnet.gov/expapi/verbs/answered',
'http://adlnet.gov/expapi/verbs/asked',
'http://adlnet.gov/expapi/verbs/attempted',
'http://adlnet.gov/expapi/verbs/attended',
'http://adlnet.gov/expapi/verbs/commented',
'http://adlnet.gov/expapi/verbs/completed',
'http://adlnet.gov/expapi/verbs/exited',
'http://adlnet.gov/expapi/verbs/experienced',
'http://adlnet.gov/expapi/verbs/failed',
'http://adlnet.gov/expapi/verbs/imported',
'http://adlnet.gov/expapi/verbs/initialized',
'http://adlnet.gov/expapi/verbs/interacted',
'http://adlnet.gov/expapi/verbs/launched',
'http://adlnet.gov/expapi/verbs/mastered',
'http://adlnet.gov/expapi/verbs/passed',
'http://adlnet.gov/expapi/verbs/preferred',
'http://adlnet.gov/expapi/verbs/progressed',
'http://adlnet.gov/expapi/verbs/registered',
'http://adlnet.gov/expapi/verbs/responded',
'http://adlnet.gov/expapi/verbs/resumed',
'http://adlnet.gov/expapi/verbs/satisfied',
'http://adlnet.gov/expapi/verbs/scored',
'http://adlnet.gov/expapi/verbs/shared',
'http://adlnet.gov/expapi/verbs/suspended',
'http://adlnet.gov/expapi/verbs/terminated',
'http://adlnet.gov/expapi/verbs/voided'
]

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

◆ 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: