ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 

Detailed Description

Definition at line 32 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 99 of file class.ilMDUtils.php.

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

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

100  {
101  global $tpl,$ilObjDataCache;
102 
103  include_once('Services/MetaData/classes/class.ilMDKeyword.php');
104  foreach(ilMDKeyword::_getKeywordsByLanguageAsString($a_rbac_id,$a_obj_id,$a_type) as $lng_code => $key_string)
105  {
106  $tpl->setCurrentBlock('mh_meta_item');
107  $tpl->setVariable('MH_META_NAME','keywords');
108  $tpl->setVariable('MH_META_LANG',$lng_code);
109  $tpl->setVariable('MH_META_CONTENT',$key_string);
110  $tpl->parseCurrentBlock();
111  }
112  include_once('Services/MetaData/classes/class.ilMDContribute.php');
113  foreach(ilMDContribute::_lookupAuthors($a_rbac_id,$a_obj_id,$a_type) as $author)
114  {
115  $tpl->setCurrentBlock('mh_meta_item');
116  $tpl->setVariable('MH_META_NAME','author');
117  $tpl->setVariable('MH_META_CONTENT',$author);
118  $tpl->parseCurrentBlock();
119  }
120 
121  }
static _lookupAuthors($a_rbac_id, $a_obj_id, $a_obj_type)
Lookup authors.
global $tpl
Definition: ilias.php:8
$a_type
Definition: workflow.php:93
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:

◆ _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 42 of file class.ilMDUtils.php.

References array.

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

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

◆ _parseCopyright()

static ilMDUtils::_parseCopyright (   $a_copyright)
static

Parse copyright.

public

Parameters
stringcopyright

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

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

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

133  {
134  include_once('Services/MetaData/classes/class.ilMDSettings.php');
135  $settings = ilMDSettings::_getInstance();
136  if(!$settings->isCopyrightSelectionActive())
137  {
138  return $a_copyright;
139  }
140  include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
142  }
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: