ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMDUtils Class Reference
+ Collaboration diagram for ilMDUtils:

Static Public Member Functions

static _LOMDurationToArray (string $a_string)
 LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) This function tries to parse a given string in an array of months, days, hours, minutes and seconds. More...
 
static _fillHTMLMetaTags (int $a_rbac_id, int $a_obj_id, string $a_type)
 
static _parseCopyright (string $a_copyright)
 
static _getDefaultCopyright ()
 

Detailed Description

Definition at line 27 of file class.ilMDUtils.php.

Member Function Documentation

◆ _fillHTMLMetaTags()

static ilMDUtils::_fillHTMLMetaTags ( int  $a_rbac_id,
int  $a_obj_id,
string  $a_type 
)
static

Definition at line 75 of file class.ilMDUtils.php.

References $DIC, $tpl, ilMDKeyword\_getKeywordsByLanguageAsString(), and ilMDContribute\_lookupAuthors().

Referenced by ilObjLinkResourceGUI\executeCommand(), ilObjCourseGUI\infoScreen(), ilObjGroupGUI\infoScreen(), ilObjCourseGUI\renderObject(), and ilObjGroupGUI\viewObject().

75  : bool
76  {
77  global $DIC;
78 
79  // currently disabled due to mantis 0026864
80  return true;
81 
82  $tpl = $DIC['tpl'];
83  $ilObjDataCache = $DIC['ilObjDataCache'];
84 
86  $a_rbac_id,
87  $a_obj_id,
88  $a_type
89  ) as $lng_code => $key_string) {
90  $tpl->setCurrentBlock('mh_meta_item');
91  $tpl->setVariable('MH_META_NAME', 'keywords');
92  $tpl->setVariable('MH_META_LANG', $lng_code);
93  $tpl->setVariable('MH_META_CONTENT', $key_string);
94  $tpl->parseCurrentBlock();
95  }
96 
97  foreach (ilMDContribute::_lookupAuthors($a_rbac_id, $a_obj_id, $a_type) as $author) {
98  $tpl->setCurrentBlock('mh_meta_item');
99  $tpl->setVariable('MH_META_NAME', 'author');
100  $tpl->setVariable('MH_META_CONTENT', $author);
101  $tpl->parseCurrentBlock();
102  }
103  return true;
104  }
static _getKeywordsByLanguageAsString(int $a_rbac_id, int $a_obj_id, string $a_type)
global $DIC
Definition: feed.php:28
static _lookupAuthors(int $a_rbac_id, int $a_obj_id, string $a_obj_type)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDefaultCopyright()

static ilMDUtils::_getDefaultCopyright ( )
static

Definition at line 116 of file class.ilMDUtils.php.

References ilMDCopyrightSelectionEntry\createIdentifier(), and ilMDCopyrightSelectionEntry\getDefault().

Referenced by ilInfoScreenGUI\addMetaDataSections().

116  : string
117  {
119  return self::_parseCopyright(
121  );
122  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _LOMDurationToArray()

static ilMDUtils::_LOMDurationToArray ( string  $a_string)
static

LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) This function tries to parse a given string in an array of months, days, hours, minutes and seconds.

Returns
int[] e.g array(1,2,0,1,2) => 1 month,2 days, 0 hours, 1 minute, 2 seconds or empty array if not parsable

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

Referenced by ilMDEducational\_getTypicalLearningTimeSeconds(), ilMDEducational\getTypicalLearningTimeSeconds(), ilMDEditorGUI\listEducational(), ilMDEditorGUI\listQuickEdit_scorm(), and ilTypicalLearningTimeInputGUI\setValueByLOMDuration().

34  : array
35  {
36  $a_string = trim($a_string);
37  #$pattern = '/^(PT)?(\d{1,2}H)?(\d{1,2}M)?(\d{1,2}S)?$/i';
38  $pattern = '/^P(\d{1,2}M)?(\d{1,2}D)?(T(\d{1,2}H)?(\d{1,2}M)?(\d{1,2}S)?)?$/i';
39 
40  $months = $days = $hours = $min = $sec = null;
41  if (!preg_match($pattern, $a_string, $matches)) {
42  return [];
43  }
44  // Month
45  if (preg_match('/^P(\d+)M/i', $a_string, $matches)) {
46  $months = $matches[1];
47  }
48  // Days
49  if (preg_match('/(\d+)+D/i', $a_string, $matches)) {
50  #var_dump("<pre>",$matches,"<pre>");
51  $days = $matches[1];
52  }
53 
54  if (preg_match('/(\d+)+H/i', $a_string, $matches)) {
55  #var_dump("<pre>",$matches,"<pre>");
56  $hours = $matches[1];
57  }
58  if (preg_match('/T(\d{1,2}H)?(\d+)M/i', $a_string, $matches)) {
59  #var_dump("<pre>",$matches,"<pre>");
60  $min = $matches[2];
61  }
62  if (preg_match('/(\d+)S/i', $a_string, $matches)) {
63  #var_dump("<pre>",$matches,"<pre>");
64  $sec = $matches[1];
65  }
66 
67  // Hack for zero values
68  if (!$months && !$days && !$hours && !$min && !$sec) {
69  return [];
70  }
71 
72  return array((int) $months, (int) $days, (int) $hours, (int) $min, (int) $sec);
73  }
+ Here is the caller graph for this function:

◆ _parseCopyright()

static ilMDUtils::_parseCopyright ( string  $a_copyright)
static

Definition at line 106 of file class.ilMDUtils.php.

References ILIAS\LTI\ToolProvider\$settings, ilMDSettings\_getInstance(), ilMDCopyrightSelectionEntry\_lookupCopyright(), and ilMDCopyrightSelectionEntry\isEntry().

Referenced by ilInfoScreenGUI\addMetaDataSections(), ilLMPresentationGUI\showDownloadList(), and ilLMPresentationGUI\showPrintView().

106  : string
107  {
109  if (!$settings->isCopyrightSelectionActive()) {
110  return ilMDCopyrightSelectionEntry::isEntry($a_copyright) ? '' : $a_copyright;
111  }
112 
114  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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