ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCmiXapiVerbList Class Reference
+ Collaboration diagram for ilCmiXapiVerbList:

Public Member Functions

 isValidVerb ($verb)
 
 getVerbUri ($verb)
 
 getDynamicSelectOptions ($verbs)
 
 getSelectOptions ()
 

Static Public Member Functions

static getVerbTranslation (ilLanguage $lng, $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

 $verbs
 

Detailed Description

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

Member Function Documentation

◆ getDynamicSelectOptions()

ilCmiXapiVerbList::getDynamicSelectOptions (   $verbs)
Returns
array

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

References $DIC, and $verbs.

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

◆ getInstance()

static ilCmiXapiVerbList::getInstance ( )
static

◆ getSelectOptions()

ilCmiXapiVerbList::getSelectOptions ( )
Returns
array

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

References $DIC.

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

◆ getVerbTranslation()

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

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

References ilLanguage\txt().

Referenced by ilCmiXapiStatementsTableGUI\fillRow().

124  {
125  $verbMatch = preg_match('/\/([^\/]+)$/',$verb,$matches);
126  $shortVerb = $matches[1];
127  $langVar = preg_replace('/http(s)?:\/\//', '', $verb);
128  $langVar = str_replace('.', '', $langVar);
129  $langVar = str_replace('/', '_', $langVar);
130  $langVar = 'cmix_' . $langVar;
131  $translatedVerb = $lng->txt($langVar);
132  // check no translation found?
133  if (strpos($translatedVerb,'-cmix_') === 0)
134  {
135  return $shortVerb;
136  }
137  else
138  {
139  return $translatedVerb;
140  }
141  }
txt($a_topic, $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 (   $verb)
Parameters
string$shortVerbId
Returns
string

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

71  {
72  return 'http://adlnet.gov/expapi/verbs/'. $verb;
73  }

◆ isValidVerb()

ilCmiXapiVerbList::isValidVerb (   $verb)
Parameters
string$verbId
Returns
bool

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

62  {
63  return true;//not necessary for dynamic verbs: in_array($verb, $this->verbs);
64  }

Field Documentation

◆ $verbs

ilCmiXapiVerbList::$verbs
protected
Initial value:
= array(
'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 27 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 22 of file class.ilCmiXapiVerbList.php.

◆ FAILED

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

Definition at line 19 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 21 of file class.ilCmiXapiVerbList.php.

◆ SATISFIED

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

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


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