ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilBiblEntryTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
15 use \ILIAS\Modules\OrgUnit\ARHelper\DIC;
19 protected $filter_objects = array();
23 protected $applied_filter = array();
27 protected $facade;
31 protected $parent_obj;
32
33
41 {
42 $this->facade = $facade;
43 $this->setId('tbl_bibl_overview_' . $facade->iliasRefId());
44 $this->setPrefix('tbl_bibl_overview_' . $facade->iliasRefId());
45 $this->setFormName('tbl_bibl_overview_' . $facade->iliasRefId());
46 parent::__construct($a_parent_obj);
47 $this->parent_obj = $a_parent_obj;
48
49 //Number of records
50 $this->setEnableNumInfo(true);
51 $this->setShowRowsSelector(true);
52
53 $this->setEnableHeader(false);
54 $this->setFormAction($this->ctrl()->getFormAction($a_parent_obj));
55 $this->setRowTemplate('tpl.bibliographic_record_table_row.html', 'Modules/Bibliographic');
56 // enable sorting by alphabet -- therefore an unvisible column 'content' is added to the table, and the array-key 'content' is also delivered in setData
57 $this->addColumn($this->lng()->txt('a'), 'content', 'auto');
58 $this->initFilter();
59 $this->initData();
60 $this->setOrderField('content');
61 $this->setDefaultOrderField('content');
62 }
63
64
65 public function initFilter()
66 {
67 $available_fields_for_object = $this->facade->fieldFactory()->getAvailableFieldsForObjId($this->facade->iliasObjId());
68
69 foreach ($available_fields_for_object as $available_field) {
70 $filter = $this->facade->filterFactory()->findByFieldId($available_field->getId());
71 if (!empty($filter)) {
72 $filter_presentation = new ilBiblFieldFilterPresentationGUI($filter, $this->facade);
73 $field = $filter_presentation->getFilterItem();
74 $this->addAndReadFilterItem($field);
75 $this->filter_objects[$field->getPostVar()] = $filter;
76 }
77 }
78 }
79
80
84 protected function addAndReadFilterItem(ilTableFilterItem $field)
85 {
86 $this->addFilterItem($field);
87 $field->readFromSession();
88 if ($field instanceof ilCheckboxInputGUI) {
89 $this->applied_filter[$field->getPostVar()] = $field->getChecked();
90 ;
91 } else {
92 $this->applied_filter[$field->getPostVar()] = $field->getValue();
93 }
94 }
95
96
100 public function fillRow($a_set)
101 {
102 $ilBiblEntry = $this->facade->entryFactory()->findByIdAndTypeString($a_set['entry_id'], $a_set['entry_type']);
103 //TODO instanciate presentation gui class
104 $ilBiblOverviewGUI = new ilBiblEntryTablePresentationGUI($ilBiblEntry, $this->facade);
105 $this->tpl->setVariable('SINGLE_ENTRY', ilBiblEntryDetailPresentationGUI::prepareLatex($ilBiblOverviewGUI->getHtml()));
106 //Detail-Link
107 $this->ctrl->setParameter($this->parent_obj, ilObjBibliographicGUI::P_ENTRY_ID, $a_set['entry_id']);
108 $this->tpl->setVariable('DETAIL_LINK', $this->ctrl->getLinkTarget($this->parent_obj, 'showDetails'));
109 // generate/render links to libraries
110 $libraries = $this->facade->libraryFactory()->getAll();
111 $arr_library_link = array();
112 foreach ($libraries as $library) {
113 if ($library->getShowInList()) {
114 $presentation = new ilBiblLibraryPresentationGUI($library, $this->facade);
115 $arr_library_link[] = $presentation->getButton($this->facade, $ilBiblEntry);
116 }
117 }
118 if (count($arr_library_link)) {
119 $this->tpl->setVariable('LIBRARY_LINK', implode('<br/>', $arr_library_link));
120 }
121 }
122
123
124 protected function initData()
125 {
130 foreach ($this->applied_filter as $field_name => $field_value) {
131 if (!$field_value || (is_array($field_value) && count($field_value) == 0)) {
132 continue;
133 }
134 $filter = $this->filter_objects[$field_name];
135 $filter_info = new ilBiblTableQueryFilter();
136 $filter_info->setFieldName($field_name);
137 switch ($filter->getFilterType()) {
139 $filter_info->setFieldValue($field_value);
140 $filter_info->setOperator("IN");
141 break;
143 $filter_info->setFieldValue($field_value);
144 $filter_info->setOperator("=");
145 break;
147 $filter_info->setFieldValue("%{$field_value}%");
148 $filter_info->setOperator("LIKE");
149 break;
150 }
151
152 $query->addFilter($filter_info);
153 }
154
155 $entries = array();
156 $object_id = $this->facade->iliasObjId();
157 foreach (
158 $this->facade->entryFactory()
159 ->filterEntryIdsForTableAsArray($object_id, $query) as $entry
160 ) {
161 $ilBibliographicEntry = $this->facade->entryFactory()->findByIdAndTypeString($entry['entry_id'], $entry['entry_type']);
162 $entry['content'] = strip_tags($ilBibliographicEntry->getOverview());
163 $entries[] = $entry;
164 }
165
166 $this->setData($entries);
167 }
168}
An exception for terminatinating execution or to throw for unit testing.
static prepareLatex($string)
This feature has to be discussed by JF first.
Class ilDataCollectionField.
addAndReadFilterItem(ilTableFilterItem $field)
__construct(ilObjBibliographicGUI $a_parent_obj, ilBiblFactoryFacade $facade)
ilBiblEntryTableGUI constructor.
Class ilBiblEntryTablePresentationGUI.
Class ilBiblFactoryFacade.
Class ilBiblFieldFilterPresentationGUI.
Class ilBiblLibraryPresentationGUI.
Class ilBiblTableQueryInfo.
Class ilBiblTableQueryInfo.
This class represents a checkbox property in a property form.
Class ilObjBibliographicGUI.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
getFormAction()
Get Form action parameter.
setData($a_data)
set table data @access public
setEnableNumInfo($a_val)
Set enable num info.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setId($a_val)
Set id.
setOrderField($a_order_field)
set order column
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
Interface for property form input GUI classes that can be used in table filters.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$query