ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMDUtils Class Reference
+ Collaboration diagram for ilMDUtils:

Static Public Member Functions

static _LOMDurationToArray ($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 ($a_rbac_id, $a_obj_id, $a_type)
 Fill html meta tags. More...
 
static _parseCopyright ($a_copyright)
 Parse copyright. More...
 
static _getDefaultCopyright ()
 

Detailed Description

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

Member Function Documentation

◆ _fillHTMLMetaTags()

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

Fill html meta tags.

public

Parameters
intrbac_id
intobj_id
stringobj type

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

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

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

88  {
89  global $DIC;
90 
91  // currently disabled due to mantis 0026864
92  return true;
93 
94  $tpl = $DIC['tpl'];
95  $ilObjDataCache = $DIC['ilObjDataCache'];
96 
97  include_once('Services/MetaData/classes/class.ilMDKeyword.php');
98  foreach (ilMDKeyword::_getKeywordsByLanguageAsString($a_rbac_id, $a_obj_id, $a_type) as $lng_code => $key_string) {
99  $tpl->setCurrentBlock('mh_meta_item');
100  $tpl->setVariable('MH_META_NAME', 'keywords');
101  $tpl->setVariable('MH_META_LANG', $lng_code);
102  $tpl->setVariable('MH_META_CONTENT', $key_string);
103  $tpl->parseCurrentBlock();
104  }
105  include_once('Services/MetaData/classes/class.ilMDContribute.php');
106  foreach (ilMDContribute::_lookupAuthors($a_rbac_id, $a_obj_id, $a_type) as $author) {
107  $tpl->setCurrentBlock('mh_meta_item');
108  $tpl->setVariable('MH_META_NAME', 'author');
109  $tpl->setVariable('MH_META_CONTENT', $author);
110  $tpl->parseCurrentBlock();
111  }
112  }
static _lookupAuthors($a_rbac_id, $a_obj_id, $a_obj_type)
Lookup authors.
global $DIC
Definition: goto.php:24
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
static _getKeywordsByLanguageAsString($a_rbac_id, $a_obj_id, $a_type)
Get keywords by language as string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDefaultCopyright()

static ilMDUtils::_getDefaultCopyright ( )
static

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

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

Referenced by ilInfoScreenGUI\addMetaDataSections().

134  : string
135  {
137  return self::_parseCopyright(
139  );
140  }
static createIdentifier($a_entry_id)
Create identifier for entry id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _LOMDurationToArray()

static ilMDUtils::_LOMDurationToArray (   $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.

Parameters
stringstring to parse
Returns
array e.g array(1,2,0,1,2) => 1 month,2 days, 0 hours, 1 minute, 2 seconds or false if not parsable

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

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

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

◆ _parseCopyright()

static ilMDUtils::_parseCopyright (   $a_copyright)
static

Parse copyright.

public

Parameters
stringcopyright

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

References ilMDSettings\_getInstance(), ilMDCopyrightSelectionEntry\_lookupCopyright(), and ilMDCopyrightSelectionEntry\isEntry().

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

124  {
125  include_once('Services/MetaData/classes/class.ilMDSettings.php');
127  if (!$settings->isCopyrightSelectionActive()) {
128  return ilMDCopyrightSelectionEntry::isEntry($a_copyright) ? '' : $a_copyright;
129  }
130  include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
132  }
static _getInstance()
get instance
static _lookupCopyright($a_cp_string)
lookup copyright by entry id
+ 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: