ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLPObjectStatisticsTableGUI Class Reference

TableGUI class for learning progress. More...

+ Inheritance diagram for ilLPObjectStatisticsTableGUI:
+ Collaboration diagram for ilLPObjectStatisticsTableGUI:

Public Member Functions

 __construct (?object $a_parent_obj, string $a_parent_cmd, ?array $a_preselect=null)
 Constructor. More...
 
 init ()
 
 getSelectableColumns ()
 
 numericOrdering (string $a_field)
 
 initFilter ()
 Init filter. More...
 
 getItems ()
 
 getGraph (array $a_graph_items)
 
- Public Member Functions inherited from ilLPTableBaseGUI
 __construct (?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
 
 executeCommand ()
 
 searchFilterListener (int $a_ref_id, array $a_data)
 Listener for SearchResultFilter Checks wheather the object is hidden and mode is not LP_MODE_DEACTIVATED public. More...
 
 initBaseFilter (bool $a_split_learning_resources=false, bool $a_include_no_status_filter=true)
 Init filter. More...
 
 getCurrentFilter (bool $as_query=false)
 
 getIconVariant ()
 Gets the variant of LP icons that is shown in the table. More...
 
 setIconVariant (int $variant)
 Sets the variant of LP icons that is shown in the table. More...
 
- 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

 isForwardingToFormDispatcher ()
 
 findReferencesForObjId (int $a_obj_id)
 
 fillRow (array $a_set)
 Fill table row. More...
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 
 fillMetaCSV (ilCSVWriter $a_csv)
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 
- Protected Member Functions inherited from ilLPTableBaseGUI
 initItemIdFromPost ()
 
 initUidFromPost ()
 
 findReferencesForObjId (int $a_obj_id)
 
 sendMail (array $a_user_ids, $a_parent_obj, string $a_parent_cmd)
 
 searchObjects (array $filter, string $permission, ?array $preset_obj_ids=null, bool $a_check_lp_activation=true)
 Search objects that match current filters. More...
 
 isForwardingToFormDispatcher ()
 
 initRepositoryFilter (array $filter)
 
 buildPath (array $ref_ids)
 
 getPossibleTypes (bool $a_split_learning_resources=false, bool $a_include_digilib=false, bool $a_allow_undefined_lp=false)
 
 parseValue (string $id, ?string $value, string $type)
 
 isPercentageAvailable (int $a_obj_id)
 
 parseTitle (int $a_obj_id, string $action, int $a_user_id=0)
 
 getExportMeta ()
 Build export meta data. More...
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 
 fillMetaCSV (ilCSVWriter $a_csv)
 
 showTimingsWarning (int $a_ref_id, int $a_user_id)
 
 formatSeconds (int $seconds, bool $a_shorten_zero=false)
 
 anonymizeValue ($a_value, bool $a_force_number=false)
 
 buildValueScale (int $a_max_value, bool $a_anonymize=false, bool $a_format_seconds=false)
 
 getMonthsFilter ($a_short=false)
 
 getMonthsYear ($a_year=null, $a_short=false)
 
 getSelectableUserColumns (int $a_in_course=0, int $a_in_group=0)
 
 addToClipboard ()
 Add selected users to clipboard. More...
 
- 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

array $preselected
 
- Protected Attributes inherited from ilLPTableBaseGUI
RefineryFactory $refinery
 
HttpService $http
 
array $filter = []
 
bool $anonymized = true
 
int $icon_variant = ilLPStatusIcons::ICON_VARIANT_LONG
 
ilSetting $setting
 
ilObjectDataCache $ilObjDataCache
 
ilObjectDefinition $objDefinition
 
ilTree $tree
 
ilGlobalTemplateInterface $main_tpl
 
- 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 ilLPTableBaseGUI
const HIT_LIMIT = 5000
 
- 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

TableGUI class for learning progress.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$ ilLPObjectStatisticsTableGUI: ilFormPropertyDispatchGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilLPObjectStatisticsTableGUI::__construct ( ?object  $a_parent_obj,
string  $a_parent_cmd,
?array  $a_preselect = null 
)

Constructor.

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

References ILIAS\GlobalScreen\Provider\__construct(), and ilTable2GUI\setId().

39  {
40  $this->preselected = $a_preselect;
41 
42  $this->setId("lpobjstattbl");
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44  }
setId(string $a_val)
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillMetaCSV()

ilLPObjectStatisticsTableGUI::fillMetaCSV ( ilCSVWriter  $a_csv)
protected

Definition at line 483 of file class.ilLPObjectStatisticsTableGUI.php.

483  : void
484  {
485  }

◆ fillMetaExcel()

ilLPObjectStatisticsTableGUI::fillMetaExcel ( ilExcel  $a_excel,
int &  $a_row 
)
protected

Definition at line 424 of file class.ilLPObjectStatisticsTableGUI.php.

424  : void
425  {
426  }

◆ fillRow()

ilLPObjectStatisticsTableGUI::fillRow ( array  $a_set)
protected

Fill table row.

Definition at line 296 of file class.ilLPObjectStatisticsTableGUI.php.

References ilObject\_getIcon(), ilObject\_lookupType(), ilLPTableBaseGUI\anonymizeValue(), ILIAS\Repository\filter(), ilLPTableBaseGUI\formatSeconds(), ilLPTableBaseGUI\getMonthsYear(), ILIAS\Repository\int(), ilTable2GUI\isColumnSelected(), ILIAS\Repository\lng(), and ROOT_FOLDER_ID.

296  : void
297  {
298  $type = ilObject::_lookupType($a_set["obj_id"]);
299 
300  $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
301  $this->tpl->setVariable(
302  "ICON_SRC",
303  ilObject::_getIcon(0, "tiny", $type)
304  );
305  $this->tpl->setVariable("ICON_ALT", $this->lng->txt($type));
306  $this->tpl->setVariable("TITLE_TEXT", $a_set["title"]);
307 
308  if ($this->preselected && in_array(
309  $a_set["obj_id"],
310  $this->preselected
311  )) {
312  $this->tpl->setVariable("CHECKBOX_STATE", " checked=\"checked\"");
313  }
314 
315  $sum = 0;
316  if (strpos($this->filter["yearmonth"], "-") === false) {
317  $this->tpl->setCurrentBlock("month");
318  foreach (array_keys(
319  $this->getMonthsYear($this->filter["yearmonth"])
320  ) as $num) {
321  $value = (int) ($a_set["month_" . $num] ?? 0);
322  if (($this->filter["measure"] ?? "") != "spent_seconds") {
323  $value = $this->anonymizeValue($value);
324  } else {
325  $value = $this->formatSeconds($value, true);
326  }
327  $this->tpl->setVariable("MONTH_VALUE", $value);
328  $this->tpl->parseCurrentBlock();
329  }
330  }
331 
332  if (($this->filter["measure"] ?? "") == "spent_seconds") {
333  $sum = $this->formatSeconds((int) ($a_set["total"] ?? 0), true);
334  } else {
335  $sum = $this->anonymizeValue((int) ($a_set["total"] ?? 0));
336  }
337  $this->tpl->setVariable("TOTAL", $sum);
338 
339  // optional columns
340  if ($this->isColumnSelected('obj_id')) {
341  $this->tpl->setVariable('OBJ_ID_COL_VALUE', (string) $a_set['obj_id']);
342  }
343  if ($this->isColumnSelected('reference_ids')) {
344  $this->tpl->setVariable('REF_IDS', (string) implode(', ', $a_set['reference_ids']));
345  }
346  if ($this->isColumnSelected('paths')) {
347  $paths = [];
348  foreach ($a_set['reference_ids'] as $reference_id) {
349  $path_gui = new ilPathGUI();
350  $path_gui->enableTextOnly(false);
351  $path_gui->enableHideLeaf(false);
352  $path_gui->setUseImages(true);
353  $paths[] = $path_gui->getPath(ROOT_FOLDER_ID, $reference_id);
354  }
355  $this->tpl->setVariable('PATHS', implode('<br /> ', $paths));
356  }
357  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
const ROOT_FOLDER_ID
Definition: constants.php:32
getMonthsYear($a_year=null, $a_short=false)
anonymizeValue($a_value, bool $a_force_number=false)
isColumnSelected(string $col)
formatSeconds(int $seconds, bool $a_shorten_zero=false)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ fillRowCSV()

ilLPObjectStatisticsTableGUI::fillRowCSV ( ilCSVWriter  $a_csv,
array  $a_set 
)
protected

Definition at line 487 of file class.ilLPObjectStatisticsTableGUI.php.

References ilObject\_lookupTitle(), ilCSVWriter\addColumn(), ilCSVWriter\addRow(), ilLPTableBaseGUI\anonymizeValue(), ILIAS\Repository\filter(), ilLPTableBaseGUI\getMonthsYear(), ILIAS\Repository\int(), ilTable2GUI\isColumnSelected(), and ROOT_FOLDER_ID.

487  : void
488  {
489  $a_csv->addColumn(ilObject::_lookupTitle($a_set["obj_id"]));
490 
491  // optional columns
492  if ($this->isColumnSelected('obj_id')) {
493  $a_csv->addColumn($a_set["obj_id"]);
494  }
495  if ($this->isColumnSelected('reference_ids')) {
496  $a_csv->addColumn(implode(', ', $a_set['reference_ids']));
497  }
498  if ($this->isColumnSelected('paths')) {
499  $paths = [];
500  foreach ($a_set['reference_ids'] as $reference_id) {
501  $path_gui = new ilPathGUI();
502  $path_gui->enableTextOnly(true);
503  $path_gui->enableHideLeaf(false);
504  $path_gui->setUseImages(false);
505  $paths[] = $path_gui->getPath(ROOT_FOLDER_ID, $reference_id);
506  }
507  /*
508  * The strings returned by the PathGUI have a linebreak at the end,
509  * which has to be removed or it messes up how the paths are displayed in excel.
510  */
511  $a_csv->addColumn(substr(implode(', ', $paths), 0, -1));
512  }
513 
514  if (strpos($this->filter["yearmonth"], "-") === false) {
515  foreach (array_keys(
516  $this->getMonthsYear($this->filter["yearmonth"])
517  ) as $num) {
518  $value = (int) ($a_set["month_" . $num] ?? 0);
519  if ($this->filter["measure"] != "spent_seconds") {
520  $value = $this->anonymizeValue($value);
521  }
522 
523  $a_csv->addColumn($value);
524  }
525  }
526 
527  if ($this->filter["measure"] == "spent_seconds") {
528  // keep seconds
529  // $sum = $this->formatSeconds((int)$a_set["total"]);
530  $sum = (int) ($a_set["total"] ?? 0);
531  } else {
532  $sum = $this->anonymizeValue((int) ($a_set["total"] ?? 0));
533  }
534  $a_csv->addColumn($sum);
535 
536  $a_csv->addRow();
537  }
addColumn(string $a_col)
const ROOT_FOLDER_ID
Definition: constants.php:32
getMonthsYear($a_year=null, $a_short=false)
anonymizeValue($a_value, bool $a_force_number=false)
isColumnSelected(string $col)
static _lookupTitle(int $obj_id)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

◆ fillRowExcel()

ilLPObjectStatisticsTableGUI::fillRowExcel ( ilExcel  $a_excel,
int &  $a_row,
array  $a_set 
)
protected

Definition at line 428 of file class.ilLPObjectStatisticsTableGUI.php.

References ilObject\_lookupTitle(), ilLPTableBaseGUI\anonymizeValue(), ILIAS\Repository\filter(), ilLPTableBaseGUI\getMonthsYear(), ILIAS\Repository\int(), ilTable2GUI\isColumnSelected(), ROOT_FOLDER_ID, and ilExcel\setCell().

432  : void {
433  $a_excel->setCell($a_row, 0, ilObject::_lookupTitle($a_set["obj_id"]));
434 
435  $col = 0;
436 
437  // optional columns
438  if ($this->isColumnSelected('obj_id')) {
439  $a_excel->setCell($a_row, ++$col, (string) $a_set['obj_id']);
440  }
441  if ($this->isColumnSelected('reference_ids')) {
442  $a_excel->setCell($a_row, ++$col, implode(', ', $a_set['reference_ids']));
443  }
444  if ($this->isColumnSelected('paths')) {
445  $paths = [];
446  foreach ($a_set['reference_ids'] as $reference_id) {
447  $path_gui = new ilPathGUI();
448  $path_gui->enableTextOnly(true);
449  $path_gui->enableHideLeaf(false);
450  $path_gui->setUseImages(false);
451  $paths[] = $path_gui->getPath(ROOT_FOLDER_ID, $reference_id);
452  }
453  /*
454  * The strings returned by the PathGUI have a linebreak at the end,
455  * which has to be removed or it messes up how the paths are displayed in excel.
456  */
457  $a_excel->setCell($a_row, ++$col, substr(implode(', ', $paths), 0, -1));
458  }
459 
460  if (strpos($this->filter["yearmonth"], "-") === false) {
461  foreach (array_keys(
462  $this->getMonthsYear($this->filter["yearmonth"])
463  ) as $num) {
464  $value = (int) ($a_set["month_" . $num] ?? 0);
465  if ($this->filter["measure"] != "spent_seconds") {
466  $value = $this->anonymizeValue($value);
467  }
468 
469  $a_excel->setCell($a_row, ++$col, $value);
470  }
471  }
472 
473  if ($this->filter["measure"] == "spent_seconds") {
474  // keep seconds
475  // $sum = $this->formatSeconds((int)$a_set["total"]);
476  $sum = (int) ($a_set["total"] ?? 0);
477  } else {
478  $sum = $this->anonymizeValue((int) ($a_set["total"] ?? 0));
479  }
480  $a_excel->setCell($a_row, ++$col, $sum);
481  }
const ROOT_FOLDER_ID
Definition: constants.php:32
getMonthsYear($a_year=null, $a_short=false)
anonymizeValue($a_value, bool $a_force_number=false)
isColumnSelected(string $col)
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
static _lookupTitle(int $obj_id)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

◆ findReferencesForObjId()

ilLPObjectStatisticsTableGUI::findReferencesForObjId ( int  $a_obj_id)
protected
Returns
int[]

Definition at line 286 of file class.ilLPObjectStatisticsTableGUI.php.

References ilObject\_getAllReferences(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

Referenced by getItems().

286  : array
287  {
288  $ref_ids = array_keys(ilObject::_getAllReferences($a_obj_id));
289  sort($ref_ids, SORT_NUMERIC);
290  return $ref_ids;
291  }
static _getAllReferences(int $id)
get all reference ids for object ID
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGraph()

ilLPObjectStatisticsTableGUI::getGraph ( array  $a_graph_items)

Definition at line 359 of file class.ilLPObjectStatisticsTableGUI.php.

References ilObject\_lookupTitle(), ilLPTableBaseGUI\anonymizeValue(), ilLPTableBaseGUI\buildValueScale(), ilChartGrid\DATA_LINES, ILIAS\Repository\filter(), ilTable2GUI\getData(), ilChart\getInstanceByType(), ilLPTableBaseGUI\getMonthsYear(), ILIAS\Repository\int(), and ilChart\TYPE_GRID.

359  : string
360  {
361  $chart = ilChart::getInstanceByType(ilChart::TYPE_GRID, "objstacc");
362  $chart->setSize("700", "500");
363 
364  $legend = new ilChartLegend();
365  $chart->setLegend($legend);
366 
367  $max_value = 0;
368  foreach ($this->getData() as $object) {
369  if (in_array($object["obj_id"], $a_graph_items)) {
370  $series = $chart->getDataInstance(ilChartGrid::DATA_LINES);
371  $series->setLabel(ilObject::_lookupTitle($object["obj_id"]));
372 
373  if (strpos($this->filter["yearmonth"], "-") === false) {
374  foreach (array_keys(
375  $this->getMonthsYear(
376  $this->filter["yearmonth"]
377  )
378  ) as $idx => $num) {
379  $value = (int) ($object["month_" . $num] ?? 0);
380  $max_value = max($max_value, $value);
381  if ($this->filter["measure"] != "spent_seconds") {
382  $value = $this->anonymizeValue($value, true);
383  }
384  $series->addPoint($idx, $value);
385  }
386  } else {
387  for ($loop = 1; $loop < 32; $loop++) {
388  $value = (int) ($object["day_" . $loop] ?? 0);
389  $max_value = max($max_value, $value);
390  if ($this->filter["measure"] != "spent_seconds") {
391  $value = $this->anonymizeValue($value, true);
392  }
393  $series->addPoint($loop, $value);
394  }
395  }
396 
397  $chart->addData($series);
398  }
399  }
400 
401  $value_ticks = $this->buildValueScale(
402  $max_value,
403  ($this->filter["measure"] != "spent_seconds"),
404  ($this->filter["measure"] == "spent_seconds")
405  );
406 
407  $labels = array();
408  if (strpos($this->filter["yearmonth"], "-") === false) {
409  foreach (array_values(
410  $this->getMonthsYear($this->filter["yearmonth"], true)
411  ) as $idx => $caption) {
412  $labels[$idx] = $caption;
413  }
414  } else {
415  for ($loop = 1; $loop < 32; $loop++) {
416  $labels[$loop] = $loop . ".";
417  }
418  }
419  $chart->setTicks($labels, $value_ticks, true);
420 
421  return $chart->getHTML();
422  }
buildValueScale(int $a_max_value, bool $a_anonymize=false, bool $a_format_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getMonthsYear($a_year=null, $a_short=false)
anonymizeValue($a_value, bool $a_force_number=false)
static _lookupTitle(int $obj_id)
const TYPE_GRID
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static getInstanceByType(int $a_type, string $a_id)
+ Here is the call graph for this function:

◆ getItems()

ilLPObjectStatisticsTableGUI::getItems ( )

Definition at line 203 of file class.ilLPObjectStatisticsTableGUI.php.

References ilTableGUI\$data, ilObject\_lookupTitle(), ILIAS\Repository\filter(), findReferencesForObjId(), ilLPTableBaseGUI\getCurrentFilter(), ilTrQuery\getObjectAccessStatistics(), ilTrQuery\getPortfolios(), ilTrQuery\getWorkspaceBlogs(), ILIAS\Repository\int(), null, ilLPTableBaseGUI\searchObjects(), and ilTable2GUI\setData().

203  : void
204  {
205  $data = array();
206  $objects = [];
207  if ($this->filter["type"] != "prtf") {
208  // JF, 2016-06-06
209  $objects = $this->searchObjects(
210  $this->getCurrentFilter(true),
211  "",
212  null,
213  false
214  );
215 
216  if ($this->filter["type"] == "blog") {
218  $this->filter["query"]
219  ) as $obj_id) {
220  $objects[$obj_id] = array($obj_id);
221  }
222  }
223  } else {
224  // portfolios are not part of repository
225  foreach (ilTrQuery::getPortfolios(
226  $this->filter["query"]
227  ) as $obj_id) {
228  $objects[$obj_id] = array($obj_id);
229  }
230  }
231 
232  if ($objects) {
233  $yearmonth = explode("-", $this->filter["yearmonth"]);
234  if (sizeof($yearmonth) == 1) {
236  $objects,
237  $yearmonth[0]
238  ) as $obj_id => $months) {
239  $data[$obj_id]["obj_id"] = $obj_id;
240  $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id);
241  $data[$obj_id]['reference_ids'] = $this->findReferencesForObjId($obj_id);
242 
243  foreach ($months as $month => $values) {
244  $idx = $yearmonth[0] . "-" . str_pad(
245  $month,
246  2,
247  "0",
248  STR_PAD_LEFT
249  );
250  $data[$obj_id]["month_" . $idx] = (int) ($values[$this->filter["measure"]] ?? 0);
251  $data[$obj_id]["total"] = ($data[$obj_id]["total"] ?? 0) + (int) ($values[$this->filter["measure"]] ?? 0);
252  }
253  }
254  } else {
256  $objects,
257  (string) $yearmonth[0],
258  (string) $yearmonth[1]
259  ) as $obj_id => $days) {
260  $data[$obj_id]["obj_id"] = $obj_id;
261  $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id);
262  $data[$obj_id]['reference_ids'] = $this->findReferencesForObjId($obj_id);
263 
264  foreach ($days as $day => $values) {
265  $data[$obj_id]["day_" . $day] = (int) ($values[$this->filter["measure"]] ?? 0);
266  $data[$obj_id]["total"] = ($data[$obj_id]["total"] ?? 0) + (int) ($values[$this->filter["measure"]] ?? 0);
267  }
268  }
269  }
270 
271  // add objects with no usage data
272  foreach (array_keys($objects) as $obj_id) {
273  if (!isset($data[$obj_id])) {
274  $data[$obj_id]["obj_id"] = $obj_id;
275  $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id);
276  $data[$obj_id]['reference_ids'] = $this->findReferencesForObjId($obj_id);
277  }
278  }
279  }
280  $this->setData($data);
281  }
setData(array $a_data)
getCurrentFilter(bool $as_query=false)
searchObjects(array $filter, string $permission, ?array $preset_obj_ids=null, bool $a_check_lp_activation=true)
Search objects that match current filters.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
static getWorkspaceBlogs(?string $a_title=null)
static getPortfolios(?string $a_title=null)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static getObjectAccessStatistics(array $a_ref_ids, string $a_year, ?string $a_month=null)
+ Here is the call graph for this function:

◆ getSelectableColumns()

ilLPObjectStatisticsTableGUI::getSelectableColumns ( )

Definition at line 100 of file class.ilLPObjectStatisticsTableGUI.php.

References ILIAS\Repository\lng().

Referenced by init().

100  : array
101  {
102  $columns = [];
103  $columns['obj_id'] = [
104  'field' => 'obj_id',
105  'txt' => $this->lng->txt('object_id'),
106  'default' => false,
107  'optional' => true,
108  'sortable' => true,
109  'width' => '5%'
110  ];
111  $columns['reference_ids'] = [
112  'field' => 'reference_ids',
113  'txt' => $this->lng->txt('trac_reference_ids_column'),
114  'default' => false,
115  'optional' => true,
116  'sortable' => true,
117  'width' => '5%'
118  ];
119  $columns['paths'] = [
120  'field' => 'paths',
121  'txt' => $this->lng->txt('trac_paths'),
122  'default' => false,
123  'optional' => true,
124  'sortable' => false,
125  'width' => '25%'
126  ];
127  return $columns;
128  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilLPObjectStatisticsTableGUI::init ( )

Definition at line 46 of file class.ilLPObjectStatisticsTableGUI.php.

References ilTable2GUI\addColumn(), ilTable2GUI\addMultiCommand(), ILIAS\Repository\ctrl(), ILIAS\Repository\filter(), ilLPTableBaseGUI\getMonthsYear(), ilTable2GUI\getParentCmd(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), initFilter(), ILIAS\Repository\lng(), ilTable2GUI\setDefaultOrderDirection(), ilTable2GUI\setDefaultOrderField(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setEnableNumInfo(), ilTable2GUI\setEnableTitle(), ilTable2GUI\setExportFormats(), ilTable2GUI\setFilterCommand(), ilTable2GUI\setFormAction(), ilTable2GUI\setResetCommand(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setShowRowsSelector(), and ilTable2GUI\setTitle().

46  : void
47  {
48  $this->setShowRowsSelector(true);
49  $this->initFilter();
50 
51  $this->addColumn("", "", "1", true);
52  $this->addColumn($this->lng->txt("trac_title"), "title", '30%');
53 
54  $all_columns = $this->getSelectableColumns();
55  foreach ($this->getSelectedColumns() as $col_name => $col_info) {
56  $column_definition = $all_columns[$col_name];
57  $this->addColumn(
58  $column_definition['txt'],
59  $column_definition['sortable'] ? $column_definition['field'] : '',
60  $column_definition['width']
61  );
62  }
63  if (strpos($this->filter["yearmonth"], "-") === false) {
64  foreach ($this->getMonthsYear(
65  $this->filter["yearmonth"]
66  ) as $num => $caption) {
67  $this->addColumn($caption, "month_" . $num);
68  }
69  }
70  $this->addColumn($this->lng->txt("total"), "total");
71 
72  $this->setTitle($this->lng->txt("trac_object_stat_access"));
73 
74  // $this->setSelectAllCheckbox("item_id");
75  $this->addMultiCommand(
76  "showAccessGraph",
77  $this->lng->txt("trac_show_graph")
78  );
79  $this->setResetCommand("resetAccessFilter");
80  $this->setFilterCommand("applyAccessFilter");
81 
82  $this->setFormAction(
83  $this->ctrl->getFormAction(
84  $this->getParentObject(),
85  $this->getParentCmd()
86  )
87  );
88  $this->setRowTemplate(
89  "tpl.lp_object_statistics_row.html",
90  "components/ILIAS/Tracking"
91  );
92  $this->setEnableHeader(true);
93  $this->setEnableNumInfo(true);
94  $this->setEnableTitle(true);
95  $this->setDefaultOrderField("title");
96  $this->setDefaultOrderDirection("asc");
97  $this->setExportFormats(array(self::EXPORT_EXCEL, self::EXPORT_CSV));
98  }
setExportFormats(array $formats)
Set available export formats.
setFormAction(string $a_form_action, bool $a_multipart=false)
setEnableTitle(bool $a_enabletitle)
setResetCommand(string $a_val, string $a_caption="")
getMonthsYear($a_year=null, $a_short=false)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
setDefaultOrderDirection(string $a_defaultorderdirection)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setEnableNumInfo(bool $a_val)
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)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
addMultiCommand(string $a_cmd, string $a_text)
setEnableHeader(bool $a_enableheader)
+ Here is the call graph for this function:

◆ initFilter()

ilLPObjectStatisticsTableGUI::initFilter ( )

Init filter.

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

References ilTable2GUI\addFilterItem(), ILIAS\Repository\filter(), ilLPTableBaseGUI\getMonthsFilter(), ilLPTableBaseGUI\getPossibleTypes(), ilLPTableBaseGUI\initRepositoryFilter(), ILIAS\Repository\lng(), ilTable2GUI\setDisableFilterHiding(), and ilSelectInputGUI\setOptions().

Referenced by init().

144  : void
145  {
146  $this->setDisableFilterHiding(true);
147  // object type selection
148  $si = new ilSelectInputGUI($this->lng->txt("obj_type"), "type");
149  $si->setOptions($this->getPossibleTypes(true, false, true));
150  $this->addFilterItem($si);
151  $si->readFromSession();
152  if (!$si->getValue()) {
153  $si->setValue("crs");
154  }
155  $this->filter["type"] = $si->getValue();
156 
157  // title/description
158  $ti = new ilTextInputGUI(
159  $this->lng->txt("trac_title_description"),
160  "query"
161  );
162  $ti->setMaxLength(64);
163  $ti->setSize(20);
164  $this->addFilterItem($ti);
165  $ti->readFromSession();
166  $this->filter["query"] = $ti->getValue();
167 
168  // read_count/spent_seconds
169  $si = new ilSelectInputGUI($this->lng->txt("trac_figure"), "figure");
170  $si->setOptions(
171  array("read_count" => $this->lng->txt("trac_read_count"),
172  "spent_seconds" => $this->lng->txt("trac_spent_seconds"),
173  "users" => $this->lng->txt("users")
174  )
175  );
176  $this->addFilterItem($si);
177  $si->readFromSession();
178  if (!$si->getValue()) {
179  $si->setValue("read_count");
180  }
181  $this->filter["measure"] = $si->getValue();
182 
183  // year/month
184  $si = new ilSelectInputGUI(
185  $this->lng->txt("year") . " / " . $this->lng->txt("month"),
186  "yearmonth"
187  );
188  $si->setOptions($this->getMonthsFilter());
189  $this->addFilterItem($si);
190  $si->readFromSession();
191  if (!$si->getValue()) {
192  $si->setValue(date("Y-m"));
193  }
194  $this->filter["yearmonth"] = $si->getValue();
195  $this->filter = $this->initRepositoryFilter($this->filter);
196  }
getPossibleTypes(bool $a_split_learning_resources=false, bool $a_include_digilib=false, bool $a_allow_undefined_lp=false)
This class represents a selection list property in a property form.
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setDisableFilterHiding(bool $a_val=true)
setOptions(array $a_options)
initRepositoryFilter(array $filter)
getMonthsFilter($a_short=false)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isForwardingToFormDispatcher()

ilLPObjectStatisticsTableGUI::isForwardingToFormDispatcher ( )
protected

Definition at line 198 of file class.ilLPObjectStatisticsTableGUI.php.

198  : bool
199  {
200  return true;
201  }

◆ numericOrdering()

ilLPObjectStatisticsTableGUI::numericOrdering ( string  $a_field)

Definition at line 130 of file class.ilLPObjectStatisticsTableGUI.php.

130  : bool
131  {
132  $alphabetic_ordering = [
133  'title'
134  ];
135  if (!in_array($a_field, $alphabetic_ordering)) {
136  return true;
137  }
138  return false;
139  }

Field Documentation

◆ $preselected

array ilLPObjectStatisticsTableGUI::$preselected
protected

Definition at line 30 of file class.ilLPObjectStatisticsTableGUI.php.


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