ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBiblLibraryPresentationGUI Class Reference

Class ilBiblLibraryPresentationGUI. More...

+ Collaboration diagram for ilBiblLibraryPresentationGUI:

Public Member Functions

 __construct (\ilBiblLibraryInterface $library, \ilBiblFactoryFacade $facade)
 ilBiblLibraryPresentationGUI constructor. More...
 
 generateLibraryLink (ilBiblEntry $entry, $type)
 
 getButton (ilBiblFactoryFacadeInterface $bibl_factory_facade, ilBiblEntry $entry)
 
 formatAttribute ($a, $type, $attributes, $prefix)
 

Protected Attributes

 $library
 
 $facade
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblLibraryPresentationGUI::__construct ( \ilBiblLibraryInterface  $library,
\ilBiblFactoryFacade  $facade 
)

ilBiblLibraryPresentationGUI constructor.

Parameters
\ilBiblLibraryInterface$library

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

References $facade, and $library.

Member Function Documentation

◆ formatAttribute()

ilBiblLibraryPresentationGUI::formatAttribute (   $a,
  $type,
  $attributes,
  $prefix 
)
Parameters
String$a
String$type
array$attributes
String$prefix
Deprecated:
REFACTOR type via type factory verwenden
Returns
String

Definition at line 142 of file class.ilBiblLibraryPresentationGUI.php.

References $attributes, and $type.

Referenced by generateLibraryLink().

143  {
144  if ($type == 'ris') {
145  switch ($a) {
146  case 'ti':
147  $a = "title";
148  break;
149  case 't1':
150  $a = "title";
151  break;
152  case 'au':
153  $a = "author";
154  break;
155  case 'sn':
156  if (strlen($attributes[$prefix . "sn"]) <= 9) {
157  $a = "issn";
158  } else {
159  $a = "isbn";
160  }
161  break;
162  case 'py':
163  $a = "date";
164  break;
165  case 'is':
166  $a = "issue";
167  break;
168  case 'vl':
169  $a = "volume";
170  break;
171  }
172  } elseif ($type = 'bib') {
173  switch ($a) {
174  case 'number':
175  $a = "issue";
176  break;
177  case 'year':
178  $a = "date";
179  break;
180  }
181  }
182 
183  return $a;
184  }
$type
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
+ Here is the caller graph for this function:

◆ generateLibraryLink()

ilBiblLibraryPresentationGUI::generateLibraryLink ( ilBiblEntry  $entry,
  $type 
)
Parameters
\ilBiblEntry$entry
$type
Deprecated:
REFACTOR Mit Attribute Objekten arbeiten statt mit Array. Evtl. URL Erstellung vereinfachen
Returns
string

Definition at line 43 of file class.ilBiblLibraryPresentationGUI.php.

References $attributes, $type, ilBiblTypeFactoryInterface\DATA_TYPE_BIBTEX, ilBiblTypeFactoryInterface\DATA_TYPE_RIS, formatAttribute(), ilBiblEntry\getId(), and ilBiblEntry\getType().

Referenced by getButton().

44  {
45  $attributes = $this->facade->entryFactory()->loadParsedAttributesByEntryId($entry->getId());
46  $type = $this->facade->typeFactory()->getInstanceForString($type);
47  switch ($type->getId()) {
49  $prefix = "bib_default_";
50  if (!empty($attributes[$prefix . "isbn"])) {
51  $attr = array( "isbn" );
52  } elseif (!empty($attributes[$prefix . "pmid"])) {
53  $attr = array( "pmid" );
54  } elseif (!empty($attributes[$prefix . "doi"])) {
55  $attr = array( "doi" );
56  } elseif (!empty($attributes[$prefix . "issn"])) {
57  $attr = array( "issn" );
58  } else {
59  $attr = array( "title", "author", "year", "number", "volume" );
60  }
61  break;
63  $prefix = "ris_" . strtolower($entry->getType()) . "_";
64  if (!empty($attributes[$prefix . "sn"])) {
65  $attr = array( "sn" );
66  } elseif (!empty($attributes[$prefix . "do"])) {
67  $attr = array( "do" );
68  } else {
69  $attr = array( "ti", "t1", "au", "py", "is", "vl" );
70  }
71  break;
72  }
73 
74  $url_params = "?";
75  if (sizeof($attr) == 1) {
76  if (($attr[0] == "doi") || ($attr[0] == "pmid")) {
77  $url_params .= "id=" . $this->formatAttribute($attr[0], $type, $attributes, $prefix)
78  . "%3A" . $attributes[$prefix . $attr[0]];
79  } elseif ($attr[0] == "do") {
80  $url_params .= "id=" . $this->formatAttribute($attr[0], $type, $attributes, $prefix)
81  . "i%3A" . $attributes[$prefix . $attr[0]];
82  } else {
83  $url_params .= $this->formatAttribute($attr[0], $type, $attributes, $prefix) . "="
84  . urlencode($attributes[$prefix . $attr[0]]);
85  }
86  } else {
87  foreach ($attr as $a) {
88  if (array_key_exists($prefix . $a, $attributes)) {
89  if (strlen($url_params) > 1) {
90  $url_params .= "&";
91  }
92  $url_params .= $this->formatAttribute($a, $type, $attributes, $prefix) . "="
93  . urlencode($attributes[$prefix . $a]);
94  }
95  }
96  }
97 
98  // return full link
99  $full_link = $this->library->getUrl() . $url_params;
100 
101  return $full_link;
102  }
$type
formatAttribute($a, $type, $attributes, $prefix)
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getButton()

ilBiblLibraryPresentationGUI::getButton ( ilBiblFactoryFacadeInterface  $bibl_factory_facade,
ilBiblEntry  $entry 
)
Parameters
\ilBiblFactoryFacadeInterface$bibl_factory_facade
\ilBiblEntry$entry
Returns
string

Definition at line 111 of file class.ilBiblLibraryPresentationGUI.php.

References generateLibraryLink(), ilLinkButton\getInstance(), ilImageLinkButton\getInstance(), and ilBiblFactoryFacadeInterface\type().

112  {
113  if ($this->library->getImg()) {
114  $button = ilImageLinkButton::getInstance();
115  $button->setUrl($this->generateLibraryLink($entry, $bibl_factory_facade->type()->getStringRepresentation()));
116  $button->setImage($this->library->getImg(), false);
117  $button->setTarget('_blank');
118 
119  return $button->render();
120  } else {
121  $button = ilLinkButton::getInstance();
122  $button->setUrl($this->generateLibraryLink($entry, $bibl_factory_facade->type()->getStringRepresentation()));
123  $button->setTarget('_blank');
124  $button->setCaption('bibl_link_online');
125 
126  return $button->render();
127  }
128  }
+ Here is the call graph for this function:

Field Documentation

◆ $facade

ilBiblLibraryPresentationGUI::$facade
protected

Definition at line 19 of file class.ilBiblLibraryPresentationGUI.php.

Referenced by __construct().

◆ $library

ilBiblLibraryPresentationGUI::$library
protected

Definition at line 14 of file class.ilBiblLibraryPresentationGUI.php.

Referenced by __construct().


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