ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMediaObjectUsagesTableGUI Class Reference

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

+ Inheritance diagram for ilMediaObjectUsagesTableGUI:
+ Collaboration diagram for ilMediaObjectUsagesTableGUI:

Public Member Functions

 __construct (object $a_parent_obj, string $a_parent_cmd, ilObjMediaObject $a_media_object, bool $a_include_hist=false)
 
 getItems ()
 Get items of current folder. More...
 
 getFirstWritableRefId (int $a_obj_id)
 
- Public Member Functions inherited from ilTable2GUI
 __construct (?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
 
 setOpenFormTag (bool $a_val)
 
 getOpenFormTag ()
 
 setCloseFormTag (bool $a_val)
 
 getCloseFormTag ()
 
 determineLimit ()
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 determineSelectedColumns ()
 
 isColumnSelected (string $col)
 
 getSelectedColumns ()
 
 resetOffset (bool $a_in_determination=false)
 
 initFilter ()
 
 getParentObject ()
 
 getParentCmd ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setNoEntriesText (string $a_text)
 
 getNoEntriesText ()
 
 setIsDataTable (bool $a_val)
 
 getIsDataTable ()
 
 setEnableTitle (bool $a_enabletitle)
 
 getEnableTitle ()
 
 setEnableHeader (bool $a_enableheader)
 
 getEnableHeader ()
 
 setEnableNumInfo (bool $a_val)
 
 getEnableNumInfo ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setOrderField (string $a_order_field)
 
 getOrderField ()
 
 setData (array $a_data)
 
 getData ()
 
 dataExists ()
 
 setPrefix (string $a_prefix)
 
 getPrefix ()
 
 addFilterItem (ilTableFilterItem $a_input_item, bool $a_optional=false)
 
 addFilterItemByMetaType (string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
 Add filter by standard type. More...
 
 getFilterItems (bool $a_optionals=false)
 
 getFilterItemByPostVar (string $a_post_var)
 
 setFilterCols (int $a_val)
 
 getFilterCols ()
 
 setDisableFilterHiding (bool $a_val=true)
 
 getDisableFilterHiding ()
 
 isFilterSelected (string $a_col)
 Is given filter selected? More...
 
 getSelectedFilters ()
 
 determineSelectedFilters ()
 
 setCustomPreviousNext (string $a_prev_link, string $a_next_link)
 
 setFormAction (string $a_form_action, bool $a_multipart=false)
 
 getFormAction ()
 
 setFormName (string $a_name="")
 
 getFormName ()
 
 setId (string $a_val)
 
 getId ()
 
 setDisplayAsBlock (bool $a_val)
 
 getDisplayAsBlock ()
 
 setSelectAllCheckbox (string $a_select_all_checkbox, bool $a_select_all_on_top=false)
 
 setExternalSorting (bool $a_val)
 
 getExternalSorting ()
 
 setFilterCommand (string $a_val, string $a_caption="")
 
 getFilterCommand ()
 
 setResetCommand (string $a_val, string $a_caption="")
 
 getResetCommand ()
 
 setExternalSegmentation (bool $a_val)
 
 getExternalSegmentation ()
 
 setRowTemplate (string $a_template, string $a_template_dir="")
 Set row template. More...
 
 setDefaultOrderField (string $a_defaultorderfield)
 
 getDefaultOrderField ()
 
 setDefaultOrderDirection (string $a_defaultorderdirection)
 
 getDefaultOrderDirection ()
 
 setDefaultFilterVisiblity (bool $a_status)
 
 getDefaultFilterVisibility ()
 
 clearCommandButtons ()
 
 addCommandButton (string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
 
 addCommandButtonInstance (ilButtonBase $a_button)
 
 addMultiItemSelectionButton (string $a_sel_var, array $a_options, string $a_cmd, string $a_text, string $a_default_selection='')
 
 setCloseCommand (string $a_link)
 
 addMultiCommand (string $a_cmd, string $a_text)
 
 addHiddenInput (string $a_name, string $a_value)
 
 addHeaderCommand (string $a_href, string $a_text, string $a_target="", string $a_img="")
 
 setTopCommands (bool $a_val)
 
 getTopCommands ()
 
 addColumn (string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
 
 getNavParameter ()
 
 setOrderLink (string $key, string $order_dir)
 
 fillHeader ()
 
 determineOffsetAndOrder (bool $a_omit_offset=false)
 
 storeNavParameter ()
 
 getHTML ()
 Get HTML. More...
 
 numericOrdering (string $a_field)
 Should this field be sorted numeric? More...
 
 render ()
 
 writeFilterToSession ()
 
 resetFilter ()
 
 fillFooter ()
 
 getLinkbar (string $a_num)
 
 fillHiddenRow ()
 
 fillActionRow ()
 
 setHeaderHTML (string $html)
 
 storeProperty (string $type, string $value)
 
 loadProperty (string $type)
 
 getCurrentState ()
 get current settings for order, limit, columns and filter More...
 
 setContext (string $id)
 
 getContext ()
 
 setShowRowsSelector (bool $a_value)
 Toggle rows-per-page selector. More...
 
 getShowRowsSelector ()
 
 getLimit ()
 
 getOffset ()
 
 setExportFormats (array $formats)
 Set available export formats. More...
 
 setPrintMode (bool $a_value=false)
 
 getPrintMode ()
 
 getExportMode ()
 
 exportData (int $format, bool $send=false)
 Export and optionally send current table data. More...
 
 setEnableAllCommand (bool $a_value)
 
 setRowSelectorLabel (string $row_selector_label)
 
 getRowSelectorLabel ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 
- Public Member Functions inherited from ilTableGUI
 __construct (array $a_data=[], bool $a_global_tpl=true)
 
 setTemplate (ilTemplate $a_tpl)
 
 getTemplateObject ()
 
 setData (array $a_data)
 Set table data. More...
 
 getData ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setHelp (string $a_help_page, string $a_help_icon, string $a_help_icon_alt="")
 
 setHeaderNames (array $a_header_names)
 
 getColumnCount ()
 
 setHeaderVars (array $a_header_vars, array $a_header_params=[])
 
 setColumnWidth (array $a_column_width)
 set table column widths More...
 
 setOneColumnWidth (string $a_column_width, int $a_column_number)
 
 setMaxCount (int $a_max_count)
 set max. More...
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 set max. More...
 
 getLimit ()
 
 setPrefix (string $a_prefix)
 set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort separately) More...
 
 setOffset (int $a_offset)
 set dataset offset More...
 
 getOffset ()
 
 setOrderColumn (string $a_order_column="", string $a_default_column="")
 
 getOrderColumn ()
 
 setOrderDirection (string $a_order_direction)
 
 getOrderDirection ()
 
 setFooter (string $a_style, string $a_previous="", string $a_next="")
 
 enable (string $a_module_name)
 
 disable (string $a_module_name)
 
 sortData ()
 
 render ()
 
 renderHeader ()
 
 setOrderLink (string $key, string $order_dir)
 
 setStyle (string $a_element, string $a_style)
 
 getStyle (string $a_element)
 
 setBase (string $a_base)
 
 getBase ()
 
 getFormName ()
 get the name of the parent form More...
 
 setFormName (string $a_name="cmd")
 
 getSelectAllCheckbox ()
 get the name of the checkbox that should be toggled with a select all button More...
 
 setSelectAllCheckbox (string $a_select_all_checkbox)
 
 clearActionButtons ()
 
 addActionButton (string $btn_name, string $btn_value)
 

Protected Member Functions

 fillRow (array $a_set)
 
- Protected Member Functions inherited from ilTable2GUI
 getRequestedValues ()
 
 prepareOutput ()
 Anything that must be done before HTML is generated. More...
 
 isFilterVisible ()
 Check if filter is visible: manually shown (session, db) or default value set. More...
 
 isAdvMDFilter (ilAdvancedMDRecordGUI $a_gui, ilTableFilterItem $a_element)
 Check if filter element is based on adv md. More...
 
 fillRow (array $a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilTableFilterItem $a_item)
 Get current filter value. More...
 
 setFilterValue (ilTableFilterItem $a_item, $a_value)
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel (ilExcel $a_excel, int &$a_row)
 Excel Version of Fill Header. More...
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV (ilCSVWriter $a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 CSV Version of Fill Row. More...
 

Protected Attributes

bool $include_hist
 
ilAccessHandler $access
 
ilObjMediaObject $media_object
 
ilTree $repo_tree
 
- Protected Attributes inherited from ilTable2GUI
string $requested_nav_par2 = ""
 
string $requested_nav_par = ""
 
string $requested_nav_par1 = ""
 
ILIAS Table TableGUIRequest $table_request = null
 
array $selected_columns = []
 
ilCtrl $ctrl
 
object $parent_obj = null
 
string $parent_cmd = ""
 
string $close_command = ""
 
string $top_anchor = "il_table_top"
 
array $filters = array()
 
array $optional_filters = array()
 
string $filter_cmd = 'applyFilter'
 
string $reset_cmd = 'resetFilter'
 
int $filter_cols = 5
 
bool $ext_sort = false
 
bool $ext_seg = false
 
string $context = ""
 
array $mi_sel_buttons = []
 
bool $disable_filter_hiding = false
 
bool $top_commands = true
 
array $selectable_columns = array()
 
array $selected_column = array()
 
bool $show_rows_selector = true
 
bool $rows_selector_off = false
 
bool $nav_determined = false
 
bool $limit_determined = false
 
bool $filters_determined = false
 
bool $columns_determined = false
 
bool $open_form_tag = true
 
bool $close_form_tag = true
 
array $export_formats = []
 
int $export_mode = 0
 
bool $print_mode = false
 
bool $enable_command_for_all = false
 
bool $restore_filter = false
 
array $restore_filter_values = []
 
bool $default_filter_visibility = false
 
array $sortable_fields = array()
 
bool $prevent_double_submission = true
 
string $row_selector_label = ""
 
bool $select_all_on_top = false
 
array $sel_buttons = []
 
string $nav_value = ''
 
string $noentriestext = ''
 
string $css_row = ''
 
bool $display_as_block = false
 
string $description = ''
 
string $id = ""
 
bool $custom_prev_next = false
 
string $reset_cmd_txt = ""
 
string $defaultorderfield = ""
 
string $defaultorderdirection = ""
 
array $column = []
 
bool $datatable = false
 
bool $num_info = false
 
bool $form_multipart = false
 
array $row_data = []
 
string $order_field = ""
 
array $selected_filter = []
 
string $form_action = ""
 
string $formname = ""
 
string $sort_order = ""
 
array $buttons = []
 
array $multi = []
 
array $hidden_inputs = []
 
array $header_commands = []
 
string $row_template = ""
 
string $row_template_dir = ""
 
string $filter_cmd_txt = ""
 
string $custom_prev = ""
 
string $custom_next = ""
 
array $raw_post_data = null
 
ilGlobalTemplateInterface $main_tpl
 
- Protected Attributes inherited from ilTableGUI
string $sort_order
 
string $link_params
 
array $header_params
 
 $tpl
 
ilLanguage $lng
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTable2GUI
static getAllCommandLimit ()
 
- Static Public Member Functions inherited from ilTableGUI
static linkbar (string $AScript, int $AHits, int $ALimit, int $AOffset, array $AParams=array(), array $ALayout=array(), string $prefix='')
 
- Data Fields inherited from ilTable2GUI
const FILTER_TEXT = 1
 
const FILTER_SELECT = 2
 
const FILTER_DATE = 3
 
const FILTER_LANGUAGE = 4
 
const FILTER_NUMBER_RANGE = 5
 
const FILTER_DATE_RANGE = 6
 
const FILTER_DURATION_RANGE = 7
 
const FILTER_DATETIME_RANGE = 8
 
const FILTER_CHECKBOX = 9
 
const EXPORT_EXCEL = 1
 
const EXPORT_CSV = 2
 
const ACTION_ALL_LIMIT = 1000
 
- Data Fields inherited from ilTableGUI
string $title = ""
 
string $icon = ""
 
string $icon_alt = ""
 
string $help_page = ""
 
string $help_icon = ""
 
string $help_icon_alt = ""
 
array $header_names = []
 
array $header_vars = []
 
array $linkbar_vars = []
 
array $data = []
 
int $column_count = 0
 
array $column_width = []
 
int $max_count = 0
 
int $limit = 0
 
bool $max_limit = false
 
int $offset = 0
 
string $order_column = ""
 
string $order_direction = ""
 
string $footer_style = ""
 
string $footer_previous = ""
 
string $footer_next = ""
 
bool $lang_support = true
 
bool $global_tpl = false
 
string $form_name = ""
 
string $select_all_checkbox = ""
 
array $action_buttons = []
 
string $prefix = ""
 
string $base = ""
 
array $enabled
 
array $styles
 

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 TableGUI class for media object usages listing

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilMediaObjectUsagesTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMediaObjectUsagesTableGUI::__construct ( object  $a_parent_obj,
string  $a_parent_cmd,
ilObjMediaObject  $a_media_object,
bool  $a_include_hist = false 
)

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

References $DIC, ilTableGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ilTable2GUI\addColumn(), ILIAS\Repository\ctrl(), getItems(), ILIAS\Repository\lng(), ilTable2GUI\setFormAction(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setTitle(), and ilLanguage\txt().

36  {
37  global $DIC;
38 
39  $this->ctrl = $DIC->ctrl();
40  $this->lng = $DIC->language();
41  $this->access = $DIC->access();
42  $ilCtrl = $DIC->ctrl();
43  $lng = $DIC->language();
44 
45  $this->repo_tree = $DIC->repositoryTree();
46 
47  parent::__construct($a_parent_obj, $a_parent_cmd);
48  $this->media_object = $a_media_object;
49  $this->include_hist = $a_include_hist;
50  $this->addColumn($lng->txt("mob_object"));
51  $this->addColumn($this->lng->txt("type"));
52  $this->addColumn($this->lng->txt("cont_versions"));
53  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
54  $this->setRowTemplate("tpl.mob_usage_row.html", "components/ILIAS/MediaObjects");
55  $this->getItems();
56  $this->setTitle($lng->txt("cont_mob_usages"));
57  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
ilLanguage $lng
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:22
getItems()
Get items of current folder.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillRow()

ilMediaObjectUsagesTableGUI::fillRow ( array  $a_set)
protected

Definition at line 114 of file class.ilMediaObjectUsagesTableGUI.php.

References ilTableGUI\$lng, $ref_id, $version, ilObject\_getAllReferences(), ilLink\_getStaticLink(), ilGlossaryTerm\_lookGlossaryID(), ilGlossaryTerm\_lookGlossaryTerm(), ilNewsItem\_lookupContextObjId(), ilLMObject\_lookupTitle(), ilObject\_lookupTitle(), ilObject\_lookupType(), getFirstWritableRefId(), ilObjMediaObject\getParentObjectIdForUsage(), ilMediaPoolItem\getPoolForItemId(), ilObject\getTitle(), ILIAS\Repository\lng(), ilMediaPoolItem\lookupTitle(), ilWikiPage\lookupTitle(), null, and ilLanguage\txt().

114  : void
115  {
116  $lng = $this->lng;
117  $cont_type = "";
118  $usage = $a_set;
119  $item = [];
120 
121  if (is_int(strpos($usage["type"], ":"))) {
122  $us_arr = explode(":", $usage["type"]);
123  $usage["type"] = $us_arr[1];
124  $cont_type = $us_arr[0];
125  }
126 
127  switch ($usage["type"]) {
128  case "pg":
129  $page_obj = $usage["page"];
130 
131  $item = array();
132 
133  //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
134  switch ($cont_type) {
135  case "lm":
136  if (ilObject::_lookupType($page_obj->getParentId()) == "lm") {
137  $lm_obj = new ilObjLearningModule($page_obj->getParentId(), false);
138  $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
139  $item["obj_title"] = $lm_obj->getTitle();
140  $item["sub_txt"] = $this->lng->txt("pg");
141  $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
142  $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
143  if ($ref_id > 0) {
144  $item["obj_link"] = ilLink::_getStaticLink(null, "pg", "", $page_obj->getId() . "_" . $ref_id);
145  }
146  }
147  break;
148 
149  case "wpg":
150  $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
151  $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
152  $item["sub_txt"] = $this->lng->txt("pg");
153  $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
154  $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
155  if ($ref_id > 0) {
156  $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
157  }
158  break;
159 
160  case "term":
161  $term_id = $page_obj->getId();
162  $glo_id = ilGlossaryTerm::_lookGlossaryID($term_id);
163  $item["obj_type_txt"] = $this->lng->txt("obj_glo");
164  $item["obj_title"] = ilObject::_lookupTitle($glo_id);
165  $item["sub_txt"] = $this->lng->txt("cont_term");
166  $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
167  $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
168  if ($ref_id > 0) {
169  $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
170  }
171  break;
172 
173  case "cont":
174  $otype = ilObject::_lookupType($page_obj->getId());
175  $item["obj_type_txt"] = $this->lng->txt("obj_" . $otype);
176  $item["obj_title"] = ilObject::_lookupTitle($page_obj->getId());
177  $ref_id = $this->getFirstWritableRefId($page_obj->getId());
178  if ($ref_id > 0) {
179  $item["obj_link"] = ilLink::_getStaticLink($ref_id, $otype);
180  }
181  break;
182 
183  case "mep":
184  $item["obj_type_txt"] = $this->lng->txt("mep_page_type_mep");
185  $item["sub_txt"] = $this->lng->txt("mep_page_type_mep");
186  $item["sub_title"] = ilMediaPoolItem::lookupTitle($usage["id"]);
187 
188  $mep_pools = ilMediaPoolItem::getPoolForItemId($usage["id"]);
189  foreach ($mep_pools as $mep_id) {
190  $ref_ids = ilObject::_getAllReferences($mep_id);
191  $item["obj_title"] = ilObject::_lookupTitle($mep_id);
192  foreach ($ref_ids as $rid) {
193  $item["obj_link"] = ilLink::_getStaticLink($rid, "mep");
194  break;
195  }
196  break;
197  }
198  break;
199 
200  default:
202  if ($oid > 0) {
203  $type = ilObject::_lookupType($oid);
204  $item["obj_type_txt"] = $this->lng->txt("obj_" . $type);
205  $item["obj_title"] = ilObject::_lookupTitle($oid);
206  $ref_id = $this->getFirstWritableRefId($oid);
207  if ($ref_id > 0) {
208  $item["obj_link"] = ilLink::_getStaticLink($ref_id, $type);
209  }
210  }
211  break;
212  }
213 
214  if ($usage["trash"]) {
215  $item["obj_title"] .= " (" . $lng->txt("trash") . ")";
216  }
217 
218  break;
219 
220  case "mep":
221  $item["obj_type_txt"] = $this->lng->txt("obj_mep");
222  $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
223  $ref_id = $this->getFirstWritableRefId($usage["id"]);
224  if ($ref_id > 0) {
225  $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
226  }
227  break;
228 
229  case "map":
230  $item["obj_type_txt"] = $this->lng->txt("obj_mob");
231  $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
232  $item["sub_txt"] = $this->lng->txt("cont_link_area");
233  break;
234 
235  case "news":
236  $obj_id = ilNewsItem::_lookupContextObjId($usage["id"]);
237  $obj_type = ilObject::_lookupType($obj_id);
238  $item["obj_type_txt"] = $this->lng->txt("obj_" . $obj_type);
239  $item["obj_title"] = ilObject::_lookupTitle($obj_id);
240  $item["sub_txt"] = $this->lng->txt("news");
241  $ref_id = $this->getFirstWritableRefId($obj_id);
242  if ($ref_id > 0) {
243  $item["obj_link"] = ilLink::_getStaticLink($ref_id, $obj_type);
244  }
245  break;
246  }
247 
248  // show versions
249  if (is_array($usage["versions"]) && is_object($usage["page"] ?? null)) {
250  $ver = $sep = "";
251 
252  if (count($usage["versions"]) > 5) {
253  $ver .= "..., ";
254  $cnt = count($usage["versions"]) - 5;
255  for ($i = 0; $i < $cnt; $i++) {
256  unset($usage["versions"][$i]);
257  }
258  }
259  foreach ($usage["versions"] as $version) {
260  if ($version["hist_nr"] == 0) {
261  $version["hist_nr"] = $this->lng->txt("cont_current_version");
262  }
263  $ver .= $sep . $version["hist_nr"];
264  if ($version["lang"] != "") {
265  $ver .= "/" . $version["lang"];
266  }
267  $sep = ", ";
268  }
269 
270  $this->tpl->setCurrentBlock("versions");
271  $this->tpl->setVariable("VAL_VERSIONS", $ver);
272  } else {
273  $this->tpl->setCurrentBlock("versions");
274  $this->tpl->setVariable("VAL_VERSIONS", " ");
275  }
276  $this->tpl->parseCurrentBlock();
277 
278  if (($item["obj_type_txt"] ?? "") != "") {
279  $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
280  }
281 
282  if (($usage["type"] ?? "") != "clip") {
283  if ($item["obj_link"]) {
284  $this->tpl->setCurrentBlock("linked_item");
285  $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
286  $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
287  $this->tpl->parseCurrentBlock();
288  } else {
289  $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
290  }
291 
292  if (($item["sub_txt"] ?? "") != "") {
293  $this->tpl->setVariable("SEP", ", ");
294  $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
295  if (($item["sub_title"] ?? "") != "") {
296  $this->tpl->setVariable("SEP2", ": ");
297  $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
298  }
299  }
300  } else {
301  $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") .
302  " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
303  }
304  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$version
Definition: plugin.php:24
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getPoolForItemId(int $a_id)
static getParentObjectIdForUsage(array $a_usage, bool $a_include_all_access_obj_ids=false)
Get&#39;s the repository object ID of a parent object, if possible see ilWebAccessChecker.
static _getAllReferences(int $id)
get all reference ids for object ID
static lookupTitle(int $a_page_id, string $lang="-")
static lookupTitle(int $a_id)
ilLanguage $lng
static _lookupTitle(int $a_obj_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
static _lookupTitle(int $obj_id)
static _lookGlossaryTerm(int $term_id)
get glossary term
static _lookupType(int $id, bool $reference=false)
static _lookupContextObjId(int $a_news_id)
Context Object ID.
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:

◆ getFirstWritableRefId()

ilMediaObjectUsagesTableGUI::getFirstWritableRefId ( int  $a_obj_id)

Definition at line 306 of file class.ilMediaObjectUsagesTableGUI.php.

References $access, $ref_id, and ilObject\_getAllReferences().

Referenced by fillRow().

308  : int {
309  $ilAccess = $this->access;
310 
311  $ref_ids = ilObject::_getAllReferences($a_obj_id);
312  foreach ($ref_ids as $ref_id) {
313  if ($ilAccess->checkAccess("write", "", $ref_id)) {
314  return $ref_id;
315  }
316  }
317  return 0;
318  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilMediaObjectUsagesTableGUI::getItems ( )

Get items of current folder.

Definition at line 62 of file class.ilMediaObjectUsagesTableGUI.php.

References $ref_id, $repo_tree, ilObject\_getAllReferences(), ilPageObjectFactory\getInstance(), ilTree\isInTree(), and ilTable2GUI\setData().

Referenced by __construct().

62  : void
63  {
64  $usages = $this->media_object->getUsages($this->include_hist);
65 
66  $clip_cnt = 0;
67  $to_del = array();
68  $agg_usages = array();
69  foreach ($usages as $k => $usage) {
70  $usage["trash"] = false;
71  if (is_int(strpos($usage["type"], ":"))) {
72  $us_arr = explode(":", $usage["type"]);
73 
74  // try to figure out object id of pages
75  if ($us_arr[1] == "pg") {
76  $page_obj = ilPageObjectFactory::getInstance($us_arr[0], $usage["id"]);
77  $usage["page"] = $page_obj;
79  $ref_ids = array_filter(
80  ilObject::_getAllReferences($page_obj->getRepoObjId()),
81  function ($ref_id) use ($repo_tree) {
82  return $repo_tree->isInTree($ref_id);
83  }
84  );
85  $usage["ref_ids"] = $ref_ids;
86  if (count($ref_ids) == 0) {
87  $usage["trash"] = true;
88  }
89  }
90  }
91 
92 
93  if ($usage["type"] == "clip") {
94  $clip_cnt++;
95  } else {
96  if ($this->include_hist || !$usage["trash"]) {
97  if (empty($agg_usages[$usage["type"] . ":" . $usage["id"]])) {
98  $agg_usages[$usage["type"] . ":" . $usage["id"]] = $usage;
99  }
100  $agg_usages[$usage["type"] . ":" . $usage["id"]]["versions"][] =
101  ["hist_nr" => $usage["hist_nr"] ?? 0,
102  "lang" => $usage["lang"] ?? ""];
103  }
104  }
105  }
106 
107  // usages in clipboards
108  if ($clip_cnt > 0) {
109  $agg_usages[] = array("type" => "clip", "cnt" => $clip_cnt);
110  }
111  $this->setData($agg_usages);
112  }
setData(array $a_data)
static _getAllReferences(int $id)
get all reference ids for object ID
isInTree(?int $a_node_id)
get all information of a node.
$ref_id
Definition: ltiauth.php:65
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilMediaObjectUsagesTableGUI::$access
protected

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

Referenced by getFirstWritableRefId().

◆ $include_hist

bool ilMediaObjectUsagesTableGUI::$include_hist
protected

Definition at line 26 of file class.ilMediaObjectUsagesTableGUI.php.

◆ $media_object

ilObjMediaObject ilMediaObjectUsagesTableGUI::$media_object
protected

Definition at line 28 of file class.ilMediaObjectUsagesTableGUI.php.

◆ $repo_tree

ilTree ilMediaObjectUsagesTableGUI::$repo_tree
protected

Definition at line 29 of file class.ilMediaObjectUsagesTableGUI.php.

Referenced by getItems().


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