ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilMDUtils.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 class ilMDUtils
28 {
35  public static function _LOMDurationToArray(string $a_string): array
36  {
37  global $DIC;
38 
39  $data_helper = $DIC->learningObjectMetadata()->dataHelper();
40 
41  $array = $data_helper->durationToArray($a_string);
42  // this function never returned the year, so we throw it away for backwards compatibility
43  array_shift($array);
44  return $array ?? [];
45  }
46 
47  public static function _fillHTMLMetaTags(int $a_rbac_id, int $a_obj_id, string $a_type): bool
48  {
49  global $DIC;
50 
51  // currently disabled due to mantis 0026864
52  return true;
53 
54  $tpl = $DIC['tpl'];
55  $ilObjDataCache = $DIC['ilObjDataCache'];
56 
58  $a_rbac_id,
59  $a_obj_id,
60  $a_type
61  ) as $lng_code => $key_string) {
62  $tpl->setCurrentBlock('mh_meta_item');
63  $tpl->setVariable('MH_META_NAME', 'keywords');
64  $tpl->setVariable('MH_META_LANG', $lng_code);
65  $tpl->setVariable('MH_META_CONTENT', $key_string);
66  $tpl->parseCurrentBlock();
67  }
68 
69  foreach (ilMDContribute::_lookupAuthors($a_rbac_id, $a_obj_id, $a_type) as $author) {
70  $tpl->setCurrentBlock('mh_meta_item');
71  $tpl->setVariable('MH_META_NAME', 'author');
72  $tpl->setVariable('MH_META_CONTENT', $author);
73  $tpl->parseCurrentBlock();
74  }
75  return true;
76  }
77 
82  public static function _parseCopyright(string $a_copyright): string
83  {
85  if (!$settings->isCopyrightSelectionActive()) {
86  return ilMDCopyrightSelectionEntry::isEntry($a_copyright) ? '' : $a_copyright;
87  }
88 
90  }
91 
95  public static function _getDefaultCopyright(): string
96  {
98  return self::_parseCopyright(
100  );
101  }
102 }
static _LOMDurationToArray(string $a_string)
LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) T...
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
static _parseCopyright(string $a_copyright)
Returns an empty string if copyright selection is not active, regardless of input.
static _getKeywordsByLanguageAsString(int $a_rbac_id, int $a_obj_id, string $a_type)
static _getDefaultCopyright()
Returns an empty string if copyright selection is not active.
static _fillHTMLMetaTags(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)