ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLPObjectStatisticsDailyTableGUI Class Reference

TableGUI class for learning progress. More...

+ Inheritance diagram for ilLPObjectStatisticsDailyTableGUI:
+ Collaboration diagram for ilLPObjectStatisticsDailyTableGUI:

Public Member Functions

 __construct (?object $a_parent_obj, string $a_parent_cmd, ?array $a_preselect=null, bool $a_load_items=true)
 Constructor. More...
 
 init ()
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 numericOrdering (string $a_field)
 Should this field be sorted numeric? More...
 
 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 @access 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)
 Set table data. More...
 
 getData ()
 
 dataExists ()
 
 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...
 
 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 ()
 get the name of the parent form More...
 
 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)
 set max. More...
 
- 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 ()
 
 fillRow (array $a_set)
 Fill table row. More...
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 Add meta information to excel export. 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...
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 CSV Version of Fill Row. More...
 
- 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)
 Add meta information to excel export. More...
 
 fillMetaCSV (ilCSVWriter $a_csv)
 Add meta information to csv export. More...
 
 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
 
Profile $profile
 
- 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$ @ilCtrl_Calls ilLPObjectStatisticsDailyTableGUI: ilFormPropertyDispatchGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilLPObjectStatisticsDailyTableGUI::__construct ( ?object  $a_parent_obj,
string  $a_parent_cmd,
?array  $a_preselect = null,
bool  $a_load_items = true 
)

Constructor.

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

40 {
41 $this->preselected = $a_preselect;
42
43 $this->setId("lpobjstatdlytbl");
44 parent::__construct($a_parent_obj, $a_parent_cmd);
45 }
setId(string $a_val)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ fillMetaCSV()

ilLPObjectStatisticsDailyTableGUI::fillMetaCSV ( ilCSVWriter  $a_csv)
protected

Add meta information to csv export.

Likely to be overwritten by derived class.

Parameters
ilCSVWriter$a_csvcurrent file

Reimplemented from ilLPTableBaseGUI.

Definition at line 441 of file class.ilLPObjectStatisticsDailyTableGUI.php.

441 : void
442 {
443 }

◆ fillMetaExcel()

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

Add meta information to excel export.

Likely to be overwritten by derived class.

Parameters
ilExcel$a_excelexcel wrapper
int$a_rowrow counter

Reimplemented from ilLPTableBaseGUI.

Definition at line 386 of file class.ilLPObjectStatisticsDailyTableGUI.php.

386 : void
387 {
388 }

◆ fillRow()

ilLPObjectStatisticsDailyTableGUI::fillRow ( array  $a_set)
protected

Fill table row.

Reimplemented from ilTable2GUI.

Definition at line 283 of file class.ilLPObjectStatisticsDailyTableGUI.php.

283 : void
284 {
285 $type = ilObject::_lookupType($a_set["obj_id"]);
286 $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
287 $this->tpl->setVariable(
288 "ICON_SRC",
289 ilObject::_getIcon(0, "tiny", $type)
290 );
291 $this->tpl->setVariable("ICON_ALT", $this->lng->txt($type));
292 $this->tpl->setVariable("TITLE_TEXT", $a_set["title"]);
293
294 if ($this->preselected && in_array(
295 $a_set["obj_id"],
296 $this->preselected
297 )) {
298 $this->tpl->setVariable("CHECKBOX_STATE", " checked=\"checked\"");
299 }
300
301 $this->tpl->setCurrentBlock("hour");
302 for ($loop = 0; $loop < 24; $loop += 2) {
303 $value = (int) ($a_set["hour" . $loop] ?? 0);
304 if ($this->filter["measure"] != "spent_seconds") {
305 $value = $this->anonymizeValue($value);
306 } else {
307 $value = $this->formatSeconds($value, true);
308 }
309 $this->tpl->setVariable("HOUR_VALUE", $value);
310 $this->tpl->parseCurrentBlock();
311 }
312
313 if ($this->filter["measure"] == "spent_seconds") {
314 $sum = $this->formatSeconds((int) ($a_set["sum"] ?? 0), true);
315 } else {
316 $sum = $this->anonymizeValue((int) ($a_set["sum"] ?? 0));
317 }
318 $this->tpl->setVariable("TOTAL", $sum);
319
320 // optional columns
321 if ($this->isColumnSelected('obj_id')) {
322 $this->tpl->setVariable('OBJ_ID_COL_VALUE', (string) $a_set['obj_id']);
323 }
324 if ($this->isColumnSelected('reference_ids')) {
325 $this->tpl->setVariable('REF_IDS', implode(', ', $a_set['reference_ids']));
326 }
327 if ($this->isColumnSelected('paths')) {
328 $paths = [];
329 foreach ($a_set['reference_ids'] as $reference_id) {
330 $path_gui = new ilPathGUI();
331 $path_gui->enableTextOnly(false);
332 $path_gui->enableHideLeaf(false);
333 $path_gui->setUseImages(true);
334 $paths[] = $path_gui->getPath(ROOT_FOLDER_ID, $reference_id);
335 }
336 $this->tpl->setVariable('PATHS', implode('<br />', $paths));
337 }
338 }
formatSeconds(int $seconds, bool $a_shorten_zero=false)
anonymizeValue($a_value, bool $a_force_number=false)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
isColumnSelected(string $col)
const ROOT_FOLDER_ID
Definition: constants.php:32
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)

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

+ Here is the call graph for this function:

◆ fillRowCSV()

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

CSV Version of Fill Row.

Most likely to be overwritten by derived class.

Parameters
ilCSVWriter$a_csvcurrent file
array$a_setdata array

Reimplemented from ilTable2GUI.

Definition at line 445 of file class.ilLPObjectStatisticsDailyTableGUI.php.

445 : void
446 {
447 $a_csv->addColumn(ilObject::_lookupTitle($a_set["obj_id"]));
448
449 // optional columns
450 if ($this->isColumnSelected('obj_id')) {
451 $a_csv->addColumn($a_set["obj_id"]);
452 }
453 if ($this->isColumnSelected('reference_ids')) {
454 $a_csv->addColumn(implode(', ', $a_set['reference_ids']));
455 }
456 if ($this->isColumnSelected('paths')) {
457 $paths = [];
458 foreach ($a_set['reference_ids'] as $reference_id) {
459 $path_gui = new ilPathGUI();
460 $path_gui->enableTextOnly(true);
461 $path_gui->enableHideLeaf(false);
462 $path_gui->setUseImages(false);
463 $paths[] = $path_gui->getPath(ROOT_FOLDER_ID, $reference_id);
464 }
465 /*
466 * The strings returned by the PathGUI have a linebreak at the end,
467 * which has to be removed or it messes up how the paths are displayed in excel.
468 */
469 $a_csv->addColumn(substr(implode(', ', $paths), 0, -1));
470 }
471
472 for ($loop = 0; $loop < 24; $loop += 2) {
473 $value = (int) ($a_set["hour" . $loop] ?? 0);
474 if ($this->filter["measure"] != "spent_seconds") {
475 $value = $this->anonymizeValue($value);
476 }
477
478 $a_csv->addColumn($value);
479 }
480
481 if ($this->filter["measure"] == "spent_seconds") {
482 // keep seconds
483 // $sum = $this->formatSeconds((int)$a_set["sum"]);
484 $sum = (int) ($a_set["sum"] ?? 0);
485 } else {
486 $sum = $this->anonymizeValue((int) ($a_set["sum"] ?? 0));
487 }
488 $a_csv->addColumn($sum);
489
490 $a_csv->addRow();
491 }
addColumn(string $a_col)
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle(), ilCSVWriter\addColumn(), ilCSVWriter\addRow(), ILIAS\Repository\filter(), ILIAS\Repository\int(), and ROOT_FOLDER_ID.

+ Here is the call graph for this function:

◆ fillRowExcel()

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

Excel Version of Fill Row.

Most likely to be overwritten by derived class.

Parameters
ilExcel$a_excelexcel wrapper
int$a_rowrow counter
array$a_setdata array

Reimplemented from ilTable2GUI.

Definition at line 390 of file class.ilLPObjectStatisticsDailyTableGUI.php.

394 : void {
395 $a_excel->setCell($a_row, 0, ilObject::_lookupTitle($a_set["obj_id"]));
396
397 $col = 0;
398
399 // optional columns
400 if ($this->isColumnSelected('obj_id')) {
401 $a_excel->setCell($a_row, ++$col, (string) $a_set['obj_id']);
402 }
403 if ($this->isColumnSelected('reference_ids')) {
404 $a_excel->setCell($a_row, ++$col, implode(', ', $a_set['reference_ids']));
405 }
406 if ($this->isColumnSelected('paths')) {
407 $paths = [];
408 foreach ($a_set['reference_ids'] as $reference_id) {
409 $path_gui = new ilPathGUI();
410 $path_gui->enableTextOnly(true);
411 $path_gui->enableHideLeaf(false);
412 $path_gui->setUseImages(false);
413 $paths[] = $path_gui->getPath(ROOT_FOLDER_ID, $reference_id);
414 }
415 /*
416 * The strings returned by the PathGUI have a linebreak at the end,
417 * which has to be removed or it messes up how the paths are displayed in excel.
418 */
419 $a_excel->setCell($a_row, ++$col, substr(implode(', ', $paths), 0, -1));
420 }
421
422 for ($loop = 0; $loop < 24; $loop += 2) {
423 $value = (int) ($a_set["hour" . $loop] ?? 0);
424 if ($this->filter["measure"] != "spent_seconds") {
425 $value = $this->anonymizeValue($value);
426 }
427
428 $a_excel->setCell($a_row, ++$col, $value);
429 }
430
431 if ($this->filter["measure"] == "spent_seconds") {
432 // keep seconds
433 // $sum = $this->formatSeconds((int)$a_set["sum"]);
434 $sum = (int) ($a_set["sum"] ?? 0);
435 } else {
436 $sum = $this->anonymizeValue((int) ($a_set["sum"] ?? 0));
437 }
438 $a_excel->setCell($a_row, ++$col, $sum);
439 }
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.

References ilExcel\setCell().

+ Here is the call graph for this function:

◆ getGraph()

ilLPObjectStatisticsDailyTableGUI::getGraph ( array  $a_graph_items)

Definition at line 340 of file class.ilLPObjectStatisticsDailyTableGUI.php.

340 : string
341 {
342 global $DIC;
343
344 $lng = $DIC['lng'];
345
347 $chart->setSize("700", "500");
348
349 $legend = new ilChartLegend();
350 $chart->setLegend($legend);
351
352 $max_value = 0;
353 foreach ($this->getData() as $object) {
354 if (in_array($object["obj_id"], $a_graph_items)) {
355 $series = $chart->getDataInstance(ilChartGrid::DATA_LINES);
356 $series->setLabel(ilObject::_lookupTitle($object["obj_id"]));
357
358 for ($loop = 0; $loop < 24; $loop++) {
359 $value = (int) ($object["graph"]["hour" . $loop] ?? 0);
360 $max_value = max($max_value, $value);
361 if ($this->filter["measure"] != "spent_seconds") {
362 $value = $this->anonymizeValue($value, true);
363 }
364 $series->addPoint($loop, $value);
365 }
366
367 $chart->addData($series);
368 }
369 }
370
371 $value_ticks = $this->buildValueScale(
372 $max_value,
373 ($this->filter["measure"] != "spent_seconds"),
374 ($this->filter["measure"] == "spent_seconds")
375 );
376
377 $labels = array();
378 for ($loop = 0; $loop < 24; $loop++) {
379 $labels[$loop] = str_pad((string) $loop, 2, "0", STR_PAD_LEFT);
380 }
381 $chart->setTicks($labels, $value_ticks, true);
382
383 return $chart->getHTML();
384 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByType(int $a_type, string $a_id)
const TYPE_GRID
buildValueScale(int $a_max_value, bool $a_anonymize=false, bool $a_format_seconds=false)
ilLanguage $lng
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

◆ getItems()

ilLPObjectStatisticsDailyTableGUI::getItems ( )

Definition at line 205 of file class.ilLPObjectStatisticsDailyTableGUI.php.

205 : void
206 {
207 $data = array();
208
209 $objects = [];
210 if ($this->filter["type"] != "prtf") {
211 // JF, 2016-06-06
212 $objects = $this->searchObjects(
213 $this->getCurrentFilter(true),
214 "",
215 null,
216 false
217 );
218
219 if ($this->filter["type"] == "blog") {
221 $this->filter["query"]
222 ) as $obj_id) {
223 $objects[$obj_id] = array($obj_id);
224 }
225 }
226 } else {
227 // portfolios are not part of repository
229 $this->filter["query"]
230 ) as $obj_id) {
231 $objects[$obj_id] = array($obj_id);
232 }
233 }
234
235 if ($objects) {
236 $yearmonth = explode("-", $this->filter["yearmonth"]);
237 if (sizeof($yearmonth) == 1) {
239 $objects,
240 $yearmonth[0]
241 );
242 } else {
244 $objects,
245 (string) $yearmonth[0],
246 (string) $yearmonth[1]
247 );
248 }
249
250 foreach ($stat_objects as $obj_id => $hours) {
251 $data[$obj_id]["obj_id"] = $obj_id;
252 $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id);
253 $data[$obj_id]['reference_ids'] = $this->findReferencesForObjId($obj_id);
254
255 foreach ($hours as $hour => $values) {
256 // table data
257 $hour_transf = floor($hour / 2) * 2;
258 $data[$obj_id]["hour" . $hour_transf] =
259 ($data[$obj_id]["hour" . $hour_transf] ?? 0) + (int) $values[$this->filter["measure"]];
260 $data[$obj_id]["sum"] =
261 ($data[$obj_id]["sum"] ?? 0) + (int) $values[$this->filter["measure"]];
262
263 // graph data
264 $data[$obj_id]["graph"]["hour" . $hour] = $values[$this->filter["measure"]];
265 }
266 }
267
268 // add objects with no usage data
269 foreach ($objects as $obj_id => $ref_ids) {
270 if (!isset($data[$obj_id])) {
271 $data[$obj_id]["obj_id"] = $obj_id;
272 $data[$obj_id]['reference_ids'] = $this->findReferencesForObjId($obj_id);
273 $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id);
274 }
275 }
276 }
277 $this->setData($data);
278 }
findReferencesForObjId(int $a_obj_id)
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.
setData(array $a_data)
Set table data.
static getWorkspaceBlogs(?string $a_title=null)
static getPortfolios(?string $a_title=null)
static getObjectDailyStatistics(array $a_ref_ids, string $a_year, ?string $a_month=null)

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

+ Here is the call graph for this function:

◆ getSelectableColumns()

ilLPObjectStatisticsDailyTableGUI::getSelectableColumns ( )

Get selectable columns.

Returns
array key: column id, val: true/false -> default on/off

Reimplemented from ilTable2GUI.

Definition at line 106 of file class.ilLPObjectStatisticsDailyTableGUI.php.

106 : array
107 {
108 $columns = [];
109 $columns['obj_id'] = [
110 'field' => 'obj_id',
111 'txt' => $this->lng->txt('object_id'),
112 'default' => false,
113 'optional' => true,
114 'sortable' => true,
115 'width' => '5%'
116 ];
117 $columns['reference_ids'] = [
118 'field' => 'reference_ids',
119 'txt' => $this->lng->txt('trac_reference_ids_column'),
120 'default' => false,
121 'optional' => true,
122 'sortable' => true,
123 'width' => '5%'
124 ];
125 $columns['paths'] = [
126 'field' => 'paths',
127 'txt' => $this->lng->txt('trac_paths'),
128 'default' => false,
129 'optional' => true,
130 'sortable' => false,
131 'width' => '25%'
132 ];
133 return $columns;
134 }

References ILIAS\Repository\lng().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilLPObjectStatisticsDailyTableGUI::init ( )

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

47 : void
48 {
49 $this->setShowRowsSelector(true);
50 $this->initFilter();
51
52 $this->addColumn("", "", "1", true);
53 $this->addColumn($this->lng->txt("trac_title"), "title");
54
55 $all_columns = $this->getSelectableColumns();
56 foreach ($this->getSelectedColumns() as $col_name => $col_info) {
57 $column_definition = $all_columns[$col_name];
58 $this->addColumn(
59 $column_definition['txt'],
60 $column_definition['sortable'] ? $column_definition['field'] : '',
61 $column_definition['width']
62 );
63 }
64 for ($loop = 0; $loop < 24; $loop += 2) {
65 $this->addColumn(
66 str_pad((string) $loop, 2, "0", STR_PAD_LEFT) . ":00-<br />" .
67 str_pad((string) ($loop + 2), 2, "0", STR_PAD_LEFT) . ":00 ",
68 "hour" . $loop
69 );
70 }
71 $this->addColumn($this->lng->txt("total"), "sum");
72 $this->setTitle($this->lng->txt("trac_object_stat_daily"));
73
74 // $this->setSelectAllCheckbox("item_id");
75 $this->addMultiCommand(
76 "showDailyGraph",
77 $this->lng->txt("trac_show_graph")
78 );
79 $this->setResetCommand("resetDailyFilter");
80 $this->setFilterCommand("applyDailyFilter");
81
82 $this->setFormAction(
83 $this->ctrl->getFormAction(
84 $this->getParentObject(),
85 $this->getParentCmd()
86 )
87 );
88 $this->setRowTemplate(
89 "tpl.lp_object_statistics_daily_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
98 $this->setExportFormats(array(self::EXPORT_EXCEL, self::EXPORT_CSV));
99 }
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setFilterCommand(string $a_val, string $a_caption="")
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setEnableNumInfo(bool $a_val)
setExportFormats(array $formats)
Set available export formats.
setEnableTitle(bool $a_enabletitle)
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setEnableHeader(bool $a_enableheader)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setResetCommand(string $a_val, string $a_caption="")

References ilTable2GUI\addColumn(), ilTable2GUI\addMultiCommand(), ILIAS\Repository\ctrl(), 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().

+ Here is the call graph for this function:

◆ initFilter()

ilLPObjectStatisticsDailyTableGUI::initFilter ( )

Init filter.

Reimplemented from ilTable2GUI.

Definition at line 151 of file class.ilLPObjectStatisticsDailyTableGUI.php.

151 : void
152 {
153 $this->setDisableFilterHiding(true);
154
155 // object type selection
156 $si = new ilSelectInputGUI($this->lng->txt("obj_type"), "type");
157 $si->setOptions($this->getPossibleTypes(true, false, true));
158 $this->addFilterItem($si);
159 $si->readFromSession();
160 if (!$si->getValue()) {
161 $si->setValue("crs");
162 }
163 $this->filter["type"] = $si->getValue();
164
165 // title/description
166 $ti = new ilTextInputGUI(
167 $this->lng->txt("trac_title_description"),
168 "query"
169 );
170 $ti->setMaxLength(64);
171 $ti->setSize(20);
172 $this->addFilterItem($ti);
173 $ti->readFromSession();
174 $this->filter["query"] = $ti->getValue();
175
176 // read_count/spent_seconds
177 $si = new ilSelectInputGUI($this->lng->txt("trac_figure"), "figure");
178 $si->setOptions(
179 array("read_count" => $this->lng->txt("trac_read_count"),
180 "spent_seconds" => $this->lng->txt("trac_spent_seconds")
181 )
182 );
183 $this->addFilterItem($si);
184 $si->readFromSession();
185 if (!$si->getValue()) {
186 $si->setValue("read_count");
187 }
188 $this->filter["measure"] = $si->getValue();
189
190 // year/month
191 $si = new ilSelectInputGUI(
192 $this->lng->txt("year") . " / " . $this->lng->txt("month"),
193 "yearmonth"
194 );
195 $si->setOptions($this->getMonthsFilter());
196 $this->addFilterItem($si);
197 $si->readFromSession();
198 if (!$si->getValue()) {
199 $si->setValue(date("Y-m"));
200 }
201 $this->filter["yearmonth"] = $si->getValue();
202 $this->filter = $this->initRepositoryFilter($this->filter);
203 }
initRepositoryFilter(array $filter)
getPossibleTypes(bool $a_split_learning_resources=false, bool $a_include_digilib=false, bool $a_allow_undefined_lp=false)
getMonthsFilter($a_short=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)
This class represents a text property in a property form.

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

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isForwardingToFormDispatcher()

ilLPObjectStatisticsDailyTableGUI::isForwardingToFormDispatcher ( )
protected

Reimplemented from ilLPTableBaseGUI.

Definition at line 101 of file class.ilLPObjectStatisticsDailyTableGUI.php.

101 : bool
102 {
103 return true;
104 }

◆ numericOrdering()

ilLPObjectStatisticsDailyTableGUI::numericOrdering ( string  $a_field)

Should this field be sorted numeric?

Reimplemented from ilTable2GUI.

Definition at line 137 of file class.ilLPObjectStatisticsDailyTableGUI.php.

137 : bool
138 {
139 $alphabetic_ordering = [
140 'title'
141 ];
142 if (!in_array($a_field, $alphabetic_ordering)) {
143 return true;
144 }
145 return false;
146 }

Field Documentation

◆ $preselected

array ilLPObjectStatisticsDailyTableGUI::$preselected
protected

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


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