ILIAS  release_7 Revision v7.30-3-g800a261c036
ilBiblEntryTablePresentationGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilBiblEntryTablePresentationGUI:

Public Member Functions

 __construct (ilBiblEntry $entry, ilBiblFactoryFacadeInterface $facade)
 ilBiblEntryTablePresentationGUI constructor. More...
 
 getHtml ()
 
 setHtml ($html)
 
 getEntry ()
 
 setEntry ($entry)
 

Protected Member Functions

 render ()
 

Protected Attributes

 $entry
 
 $html = ''
 
 $facade
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilBiblEntryTablePresentationGUI

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 25 of file class.ilBiblEntryTablePresentationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBiblEntryTablePresentationGUI::__construct ( ilBiblEntry  $entry,
ilBiblFactoryFacadeInterface  $facade 
)

ilBiblEntryTablePresentationGUI constructor.

Parameters
\ilBiblEntry$entry

Definition at line 47 of file class.ilBiblEntryTablePresentationGUI.php.

References $entry, $facade, and render().

+ Here is the call graph for this function:

Member Function Documentation

◆ getEntry()

ilBiblEntryTablePresentationGUI::getEntry ( )
Returns
ilBiblEntry

Definition at line 144 of file class.ilBiblEntryTablePresentationGUI.php.

References $entry.

Referenced by render().

+ Here is the caller graph for this function:

◆ getHtml()

ilBiblEntryTablePresentationGUI::getHtml ( )
Returns
string

Definition at line 126 of file class.ilBiblEntryTablePresentationGUI.php.

References $html.

◆ render()

ilBiblEntryTablePresentationGUI::render ( )
protected
Returns
mixed|string
Deprecated:
Has to be refactored. Active records verwenden statt array

Definition at line 60 of file class.ilBiblEntryTablePresentationGUI.php.

References $attributes, getEntry(), and setHtml().

Referenced by __construct().

61  {
62  $attributes = $this->facade->entryFactory()->loadParsedAttributesByEntryId($this->getEntry()->getId());
63  //Get the model which declares which attributes to show in the overview table and how to show them
64  //example for overviewModels: $overviewModels['bib']['default'] => "[<strong>|bib_default_author|</strong>: ][|bib_default_title|. ]<Emph>[|bib_default_publisher|][, |bib_default_year|][, |bib_default_address|].</Emph>"
65  $overviewModels = $this->facade->overviewModelFactory()->getAllOverviewModelsByType($this->facade->type());
66  //get design for specific entry type or get filetypes default design if type is not specified
67  $entryType = $this->getEntry()->getType();
68  //if there is no model for the specific entrytype (book, article, ....) the entry overview will be structured by the default entrytype from the given filetype (ris, bib, ...)
69  if (!$overviewModels[$this->facade->typeFactory()->getDataTypeIdentifierByInstance($this->facade->entryFactory()->getFileType())][$entryType]) {
70  $entryType = 'default';
71  }
72  $single_entry = $overviewModels[$entryType];
73  //split the model into single attributes (which begin and end with a bracket, eg [|bib_default_title|. ] )
74  //such values are saved in $placeholders[0] while the same values but whithout brackets are saved in $placeholders[1] (eg |bib_default_title|. )
75  preg_match_all('/\[(.*?)\]/', $single_entry, $placeholders);
76  foreach ($placeholders[1] as $key => $placeholder) {
77  //cut a moedel attribute like |bib_default_title|. in three pieces while $cuts[1] is the attribute key for the actual value and $cuts[0] is what comes before respectively $cuts[2] is what comes after the value if it is not empty.
78  $cuts = explode('|', $placeholder);
79  //if attribute key does not exist, because it comes from the default entry (e.g. ris_default_u2), we replace 'default' with the entrys type (e.g. ris_book_u2)
80  if (!$attributes[$cuts[1]]) {
81  $attribute_elements = explode('_', $cuts[1]);
82  $attribute_elements[1] = strtolower($this->getEntry()->getType());
83  $cuts[1] = implode('_', $attribute_elements);
84  }
85  if ($attributes[$cuts[1]]) {
86  //if the attribute for the attribute key exists, replace one attribute in the overview text line of a single entry with its actual value and the text before and after the value given by the model
87  $single_entry = str_replace($placeholders[0][$key], $cuts[0] . $attributes[$cuts[1]]
88  . $cuts[2], $single_entry);
89  // replace the <emph> tags with a span, in order to make text italic by css
90  do {
91  $first_sign_after_begin_emph_tag = strpos(strtolower($single_entry), '<emph>')
92  + 6;
93  $last_sign_after_end_emph_tag = strpos(strtolower($single_entry), '</emph>');
94  $italic_text_length = $last_sign_after_end_emph_tag
95  - $first_sign_after_begin_emph_tag;
96  //would not be true if there is no <emph> tag left
97  if ($last_sign_after_end_emph_tag) {
98  $italic_text = substr($single_entry, $first_sign_after_begin_emph_tag, $italic_text_length);
99  //parse
100  $it_tpl = new ilTemplate("tpl.bibliographic_italicizer.html", true, true, "Modules/Bibliographic");
101  $it_tpl->setCurrentBlock("italic_section");
102  $it_tpl->setVariable('ITALIC_STRING', $italic_text);
103  $it_tpl->parseCurrentBlock();
104  //replace the emph tags and the text between with the parsed text from il_tpl
105  $text_before_emph_tag = substr($single_entry, 0, $first_sign_after_begin_emph_tag
106  - 6);
107  $text_after_emph_tag = substr($single_entry, $last_sign_after_end_emph_tag
108  + 7);
109  $single_entry = $text_before_emph_tag . $it_tpl->get()
110  . $text_after_emph_tag;
111  }
112  } while ($last_sign_after_end_emph_tag);
113  } else {
114  //if the attribute for the attribute key does not exist, just remove this attribute-key from the overview text line of a single entry
115  $single_entry = str_replace($placeholders[0][$key], '', $single_entry);
116  }
117  }
118 
119  $this->setHtml($single_entry);
120  }
$attributes
Definition: metadata.php:231
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEntry()

ilBiblEntryTablePresentationGUI::setEntry (   $entry)
Parameters
ilBiblEntry$entry

Definition at line 153 of file class.ilBiblEntryTablePresentationGUI.php.

References $entry.

◆ setHtml()

ilBiblEntryTablePresentationGUI::setHtml (   $html)
Parameters
string$html

Definition at line 135 of file class.ilBiblEntryTablePresentationGUI.php.

References $html.

Referenced by render().

+ Here is the caller graph for this function:

Field Documentation

◆ $entry

ilBiblEntryTablePresentationGUI::$entry
protected

Definition at line 31 of file class.ilBiblEntryTablePresentationGUI.php.

Referenced by __construct(), getEntry(), and setEntry().

◆ $facade

ilBiblEntryTablePresentationGUI::$facade
protected

Definition at line 39 of file class.ilBiblEntryTablePresentationGUI.php.

Referenced by __construct().

◆ $html

ilBiblEntryTablePresentationGUI::$html = ''
protected

Definition at line 35 of file class.ilBiblEntryTablePresentationGUI.php.

Referenced by getHtml(), and setHtml().


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