ILIAS  release_8 Revision v8.24
ilTrSummaryTableGUI Class Reference
+ Inheritance diagram for ilTrSummaryTableGUI:
+ Collaboration diagram for ilTrSummaryTableGUI:

Public Member Functions

 __construct (?object $a_parent_obj, string $a_parent_cmd, int $a_ref_id, bool $a_print_mode=false)
 Constructor. More...
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 initFilter ()
 
 getSelCountryCodes ()
 
 getItems (int $a_object_id, int $a_ref_id)
 Build summary item rows for given object and filter(s. More...
 
 numericOrdering (string $a_field)
 Should this field be sorted numeric? More...
 
 isStatusShown ()
 
- 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 ()
 
 setShowTemplates (bool $a_value)
 
 getShowTemplates ()
 
 restoreTemplate (string $a_name)
 Restore state from template. More...
 
 saveTemplate (string $a_name)
 Save current state as template. More...
 
 deleteTemplate (string $a_name)
 
 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

 getItemsPercentages ( $data=null, int $overall=0, array $value_map=null, $limit=3)
 Render data as needed for summary list (based on grouped values) More...
 
 getItemsPercentagesStatus ( $data=null, int $overall=0, array $value_map=null)
 Render status data as needed for summary list (based on grouped values) More...
 
 parseValue (string $id, ?string $value, string $type)
 
 fillRow (array $a_set)
 Fill table row. More...
 
 renderPercentages (string $id, array $data)
 
 isArrayColumn (string $a_name)
 
 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...
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 CSV Version of Fill Header. 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

ilObjectLP $olp = null
 
bool $is_root
 
bool $is_in_course = false
 
bool $is_in_group = false
 
int $ref_id
 
string $type = null
 
int $obj_id
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
- 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_tmpl_delete
 
string $requested_tmpl_create
 
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_templates = false
 
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

Constructor & Destructor Documentation

◆ __construct()

ilTrSummaryTableGUI::__construct ( ?object  $a_parent_obj,
string  $a_parent_cmd,
int  $a_ref_id,
bool  $a_print_mode = false 
)

Constructor.

Definition at line 42 of file class.ilTrSummaryTableGUI.php.

47 {
48 global $DIC;
49 $this->objDefinition = $DIC['objDefinition'];
50 $this->rbacsystem = $DIC->rbac()->system();
51 $this->access = $DIC->access();
52 $this->ref_id = $a_ref_id;
53 $this->obj_id = ilObject::_lookupObjId($a_ref_id);
54 $this->is_root = ($a_ref_id == ROOT_FOLDER_ID);
55
56 $this->setId("trsmy");
57
58 if (!$this->is_root) {
59 // #17084 - are we multi-object or not?
60 // we cannot parse type filter (too complicated)
61 $type = ilObject::_lookupType($this->obj_id);
62 if (!$this->objDefinition->isContainer($type)) {
63 $this->type = $type;
64 $this->olp = ilObjectLP::getInstance($this->obj_id);
65 }
66 }
67
68 if (
69 !$this->is_root &&
70 $DIC->repositoryTree()->checkForParentType($this->ref_id, 'grp')
71 ) {
72 $this->is_in_group = true;
73 } elseif (
74 !$this->is_root &&
75 $DIC->repositoryTree()->checkForParentType($this->ref_id, 'crs')
76 ) {
77 $this->is_in_course = true;
78 }
79
80 parent::__construct($a_parent_obj, $a_parent_cmd);
81
82 if ($a_print_mode) {
83 $this->setPrintMode(true);
84 }
85
86 $this->parseTitle($this->obj_id, "trac_summary");
87 $this->setLimit(9999);
88 $this->setShowTemplates(true);
89 $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
90
91 $this->addColumn($this->lng->txt("title"), "title");
92 $this->setDefaultOrderField("title");
93
94 $labels = $this->getSelectableColumns();
95 foreach ($this->getSelectedColumns() as $c) {
96 // see bug #35119; these column list percentage lists and are not sortable
97 if (in_array($c, ["status", "mark", "language", "country", "gender", "city", "sel_country"])) {
98 $this->addColumn($labels[$c]["txt"]);
99 } else {
100 $this->addColumn($labels[$c]["txt"], $c);
101 }
102 }
103
104 if ($this->is_root) {
105 $this->addColumn($this->lng->txt("path"));
106 $this->addColumn($this->lng->txt("action"));
107 }
108
109 // $this->setExternalSorting(true);
110 $this->setEnableHeader(true);
111 $this->setFormAction(
112 $this->ctrl->getFormActionByClass(get_class($this))
113 );
114 $this->setRowTemplate("tpl.trac_summary_row.html", "Services/Tracking");
115 $this->initFilter();
116
117 $this->getItems($a_parent_obj->getObjId(), $a_ref_id);
118 }
parseTitle(int $a_obj_id, string $action, int $a_user_id=0)
static getInstance(int $obj_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setExportFormats(array $formats)
Set available export formats.
setShowTemplates(bool $a_value)
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)
setPrintMode(bool $a_value=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
getItems(int $a_object_id, int $a_ref_id)
Build summary item rows for given object and filter(s.
getSelectableColumns()
Get selectable columns.
$c
Definition: cli.php:38
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $c, $DIC, $type, ILIAS\GlobalScreen\Provider\__construct(), ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\access(), ilTable2GUI\addColumn(), ILIAS\Repository\ctrl(), ilObjectLP\getInstance(), getItems(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), initFilter(), ILIAS\Repository\lng(), ilLPTableBaseGUI\parseTitle(), ROOT_FOLDER_ID, ilTable2GUI\setDefaultOrderField(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setExportFormats(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTable2GUI\setLimit(), ilTable2GUI\setPrintMode(), ilTable2GUI\setRowTemplate(), and ilTable2GUI\setShowTemplates().

+ Here is the call graph for this function:

Member Function Documentation

◆ fillHeaderCSV()

ilTrSummaryTableGUI::fillHeaderCSV ( ilCSVWriter  $a_csv)
protected

CSV Version of Fill Header.

Likely to be overwritten by derived class.

Parameters
ilCSVWriter$a_csvcurrent file

Reimplemented from ilTable2GUI.

Definition at line 1130 of file class.ilTrSummaryTableGUI.php.

1130 : void
1131 {
1132 $a_csv->addColumn($this->lng->txt("title"));
1133
1134 $labels = $this->getSelectableColumns();
1135 foreach ($this->getSelectedColumns() as $c) {
1136 $label = $labels[$c]["txt"];
1137 $label = str_replace(
1138 "Ø",
1139 $this->lng->txt("trac_average"),
1140 $label
1141 );
1142 $label = str_replace(
1143 "∑",
1144 $this->lng->txt("trac_sum"),
1145 $label
1146 );
1147
1148 if (!$this->isArrayColumn($c)) {
1149 $a_csv->addColumn($label);
1150 } else {
1151 if ($c != "status") {
1152 $a_csv->addColumn($label . " #1");
1153 $a_csv->addColumn($label . " #1");
1154 $a_csv->addColumn($label . " #1 %");
1155 $a_csv->addColumn($label . " #2");
1156 $a_csv->addColumn($label . " #2");
1157 $a_csv->addColumn($label . " #2 %");
1158 $a_csv->addColumn($label . " #3");
1159 $a_csv->addColumn($label . " #3");
1160 $a_csv->addColumn($label . " #3 %");
1161 $a_csv->addColumn(
1162 $label . " " . $this->lng->txt("trac_others")
1163 );
1164 $a_csv->addColumn(
1165 $label . " " . $this->lng->txt("trac_others")
1166 );
1167 $a_csv->addColumn(
1168 $label . " " . $this->lng->txt("trac_others") . " %"
1169 );
1170 } else {
1171 // build status to image map
1172 $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
1176 );
1177 foreach ($valid_status as $status) {
1179 $status
1180 );
1181 $a_csv->addColumn($text);
1182 $a_csv->addColumn($text . " %");
1183 }
1184 }
1185 }
1186 }
1187
1188 $a_csv->addRow();
1189 }
addColumn(string $a_col)
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.

References $c, ilLearningProgressBaseGUI\_getStatusText(), ilCSVWriter\addColumn(), ilCSVWriter\addRow(), ILIAS\Repository\lng(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

+ Here is the call graph for this function:

◆ fillHeaderExcel()

ilTrSummaryTableGUI::fillHeaderExcel ( ilExcel  $a_excel,
int &  $a_row 
)
protected

Excel Version of Fill Header.

Likely to be overwritten by derived class.

Parameters
ilExcel$a_excelexcel wrapper
int$a_rowrow counter

Reimplemented from ilTable2GUI.

Definition at line 998 of file class.ilTrSummaryTableGUI.php.

998 : void
999 {
1000 $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
1001
1002 $labels = $this->getSelectableColumns();
1003 $cnt = 1;
1004 foreach ($this->getSelectedColumns() as $c) {
1005 $label = $labels[$c]["txt"];
1006 $label = str_replace(
1007 "Ø",
1008 $this->lng->txt("trac_average"),
1009 $label
1010 );
1011 $label = str_replace(
1012 "∑",
1013 $this->lng->txt("trac_sum"),
1014 $label
1015 );
1016
1017 if (!$this->isArrayColumn($c)) {
1018 $a_excel->setCell($a_row, $cnt, $label);
1019 $cnt++;
1020 } else {
1021 if ($c != "status") {
1022 $a_excel->setCell($a_row, $cnt, $label . " #1");
1023 $a_excel->setCell($a_row, ++$cnt, $label . " #1");
1024 $a_excel->setCell($a_row, ++$cnt, $label . " #1 %");
1025 $a_excel->setCell($a_row, ++$cnt, $label . " #2");
1026 $a_excel->setCell($a_row, ++$cnt, $label . " #2");
1027 $a_excel->setCell($a_row, ++$cnt, $label . " #2 %");
1028 $a_excel->setCell($a_row, ++$cnt, $label . " #3");
1029 $a_excel->setCell($a_row, ++$cnt, $label . " #3");
1030 $a_excel->setCell($a_row, ++$cnt, $label . " #3 %");
1031 $a_excel->setCell(
1032 $a_row,
1033 ++$cnt,
1034 $label . " " . $this->lng->txt(
1035 "trac_others"
1036 )
1037 );
1038 $a_excel->setCell(
1039 $a_row,
1040 ++$cnt,
1041 $label . " " . $this->lng->txt(
1042 "trac_others"
1043 )
1044 );
1045 $a_excel->setCell(
1046 $a_row,
1047 ++$cnt,
1048 $label . " " . $this->lng->txt(
1049 "trac_others"
1050 ) . " %"
1051 );
1052 } else {
1053 // build status to image map
1054 $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
1058 );
1059 $cnt--;
1060 foreach ($valid_status as $status) {
1062 $status
1063 );
1064 $a_excel->setCell($a_row, ++$cnt, $text);
1065 $a_excel->setCell($a_row, ++$cnt, $text . " %");
1066 }
1067 }
1068 $cnt++;
1069 }
1070 }
1071
1072 $a_excel->setBold(
1073 "A" . $a_row . ":" . $a_excel->getColumnCoord($cnt) . $a_row
1074 );
1075 }
setBold(string $a_coords)
Set cell(s) to bold.
getColumnCoord(int $a_col)
Get column "name" from number.
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.

References $c, ilLearningProgressBaseGUI\_getStatusText(), ilExcel\getColumnCoord(), ILIAS\Repository\lng(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, ilExcel\setBold(), and ilExcel\setCell().

+ Here is the call graph for this function:

◆ fillRow()

ilTrSummaryTableGUI::fillRow ( array  $a_set)
protected

Fill table row.

Reimplemented from ilTable2GUI.

Definition at line 806 of file class.ilTrSummaryTableGUI.php.

806 : void
807 {
808 $this->tpl->setVariable(
809 "ICON",
811 (int) $a_set["obj_id"],
812 "tiny",
813 $a_set["type"]
814 )
815 );
816 $this->tpl->setVariable("ICON_ALT", $this->lng->txt($a_set["type"]));
817 $this->tpl->setVariable("TITLE", $a_set["title"]);
818
819 if ($a_set["offline"] || ($a_set["privacy_conflict"] ?? null)) {
820 $mess = array();
821 if ($a_set["offline"]) {
822 $mess[] = $this->lng->txt("offline");
823 }
824 if ($a_set["privacy_conflict"] ?? null) {
825 $mess[] = $this->lng->txt("status_no_permission");
826 }
827 $this->tpl->setCurrentBlock("status_bl");
828 $this->tpl->setVariable("TEXT_STATUS", implode(", ", $mess));
829 $this->tpl->parseCurrentBlock();
830 }
831
832 foreach ($this->getSelectedColumns() as $c) {
833 switch ($c) {
834 case "country":
835 case "gender":
836 case "city":
837 case "language":
838 case "status":
839 case "mark":
840 case "sel_country":
841 $this->renderPercentages($c, $a_set[$c]);
842 break;
843
844 case "percentage_avg":
845 if ((int) $a_set[$c] === 0 || !$this->isPercentageAvailable(
846 $a_set["obj_id"]
847 )) {
848 $this->tpl->setVariable(strtoupper($c), "");
849 break;
850 }
851
852 // no break
853 default:
854 $value = $this->parseValue($c, $a_set[$c], $a_set["type"]);
855 $this->tpl->setVariable(strtoupper($c), $value);
856 break;
857 }
858 }
859
860 if ($this->is_root) {
861 $path = $this->buildPath($a_set["ref_ids"]);
862 if ($path) {
863 $this->tpl->setCurrentBlock("item_path");
864 foreach ($path as $ref_id => $path_item) {
865 $this->tpl->setVariable("PATH_ITEM", $path_item);
866
867 if (!$this->anonymized) {
868 $this->ctrl->setParameterByClass(
869 $this->ctrl->getCmdClass(),
870 'details_id',
871 $ref_id
872 );
873 $this->tpl->setVariable(
874 "URL_DETAILS",
875 $this->ctrl->getLinkTargetByClass(
876 $this->ctrl->getCmdClass(),
877 'details'
878 )
879 );
880 $this->ctrl->setParameterByClass(
881 $this->ctrl->getCmdClass(),
882 'details_id',
883 ''
884 );
885 $this->tpl->setVariable(
886 "TXT_DETAILS",
887 $this->lng->txt(
888 'trac_participants'
889 )
890 );
891 } else {
892 $this->tpl->setVariable(
893 "URL_DETAILS",
895 $ref_id,
896 $a_set["type"]
897 )
898 );
899 $this->tpl->setVariable(
900 "TXT_DETAILS",
901 $this->lng->txt('view')
902 );
903 }
904
905 $this->tpl->parseCurrentBlock();
906 }
907 }
908
909 $this->tpl->setCurrentBlock("item_command");
910 $this->ctrl->setParameterByClass(
911 get_class($this),
912 'hide',
913 $a_set["obj_id"]
914 );
915 $this->tpl->setVariable(
916 "HREF_COMMAND",
917 $this->ctrl->getLinkTargetByClass(
918 get_class($this),
919 'hide'
920 )
921 );
922 $this->tpl->setVariable(
923 "TXT_COMMAND",
924 $this->lng->txt('trac_hide')
925 );
926 $this->tpl->parseCurrentBlock();
927
928 $this->tpl->touchBlock("path_action");
929 } elseif ($a_set["ref_ids"]) { // #18446
930 // #16453
931 $path = new ilPathGUI();
932 $path = $path->getPath(
933 $this->ref_id,
934 (int) array_pop($a_set["ref_ids"])
935 );
936 if ($path) {
937 $this->tpl->setVariable(
938 'COLL_PATH',
939 $this->lng->txt('path') . ': ' . $path
940 );
941 }
942 }
943 }
isPercentageAvailable(int $a_obj_id)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
Creates a path for a start and endnode.
renderPercentages(string $id, array $data)
parseValue(string $id, ?string $value, string $type)
$path
Definition: ltiservices.php:32

References $c, $path, $ref_id, ilObject\_getIcon(), ilLink\_getLink(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ fillRowCSV()

ilTrSummaryTableGUI::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 1191 of file class.ilTrSummaryTableGUI.php.

1191 : void
1192 {
1193 $a_csv->addColumn($a_set["title"]);
1194
1195 foreach ($this->getSelectedColumns() as $c) {
1196 if (!$this->isArrayColumn($c)) {
1197 $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
1198 $a_csv->addColumn($val);
1199 } else {
1200 foreach ((array) $a_set[$c] as $idx => $value) {
1201 if ($c != "status") {
1202 $a_csv->addColumn($value["caption"]);
1203 }
1204 $a_csv->addColumn((string) $value["absolute"]);
1205 $a_csv->addColumn($value["percentage"]);
1206 }
1207 if (sizeof($a_set[$c]) < 4 && $c != "status") {
1208 for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
1209 $a_csv->addColumn("");
1210 $a_csv->addColumn("");
1211 $a_csv->addColumn("");
1212 }
1213 }
1214 }
1215 }
1216
1217 $a_csv->addRow();
1218 }

References $c, ilCSVWriter\addColumn(), and ilCSVWriter\addRow().

+ Here is the call graph for this function:

◆ fillRowExcel()

ilTrSummaryTableGUI::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 1077 of file class.ilTrSummaryTableGUI.php.

1081 : void {
1082 $a_excel->setCell($a_row, 0, $a_set["title"]);
1083
1084 $cnt = 1;
1085 foreach ($this->getSelectedColumns() as $c) {
1086 if (!$this->isArrayColumn($c)) {
1087 $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
1088 $a_excel->setCell($a_row, $cnt, $val);
1089 $cnt++;
1090 } else {
1091 foreach ((array) $a_set[$c] as $idx => $value) {
1092 if ($c == "status") {
1093 $a_excel->setCell(
1094 $a_row,
1095 $cnt,
1096 (int) $value["absolute"]
1097 );
1098 $a_excel->setCell(
1099 $a_row,
1100 ++$cnt,
1101 $value["percentage"] . "%"
1102 );
1103 } else {
1104 $a_excel->setCell($a_row, $cnt, $value["caption"]);
1105 $a_excel->setCell(
1106 $a_row,
1107 ++$cnt,
1108 (int) $value["absolute"]
1109 );
1110 $a_excel->setCell(
1111 $a_row,
1112 ++$cnt,
1113 $value["percentage"] . "%"
1114 );
1115 }
1116 $cnt++;
1117 }
1118 if (sizeof($a_set[$c]) < 4 && $c != "status") {
1119 for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
1120 $a_excel->setCell($a_row, $cnt, "");
1121 $a_excel->setCell($a_row, ++$cnt, "");
1122 $a_excel->setCell($a_row, ++$cnt, "");
1123 $cnt++;
1124 }
1125 }
1126 }
1127 }
1128 }

References $c, and ilExcel\setCell().

+ Here is the call graph for this function:

◆ getItems()

ilTrSummaryTableGUI::getItems ( int  $a_object_id,
int  $a_ref_id 
)

Build summary item rows for given object and filter(s.

Definition at line 462 of file class.ilTrSummaryTableGUI.php.

462 : void
463 {
464 // show only selected subobjects for lp mode
465 $preselected_obj_ids = $filter = null;
466
468 if (
473 ) {
474 $collection = $olp->getCollectionInstance();
475 $preselected_obj_ids[$a_object_id][] = $a_ref_id;
476 foreach ($collection->getItems() as $item => $item_info) {
477 $tmp_lp = ilObjectLP::getInstance(
478 ilObject::_lookupObjId($item_info)
479 );
480 if ($tmp_lp->isActive()) {
481 $preselected_obj_ids[ilObject::_lookupObjId(
482 $item_info
483 )][] = $item_info;
484 }
485 }
486 $filter = $this->getCurrentFilter();
487 } elseif ($this->is_root) {
488 // using search to get all relevant objects
489 // #8498/#8499: restrict to objects with at least "read_learning_progress" access
490 $preselected_obj_ids = $this->searchObjects(
491 $this->getCurrentFilter(true),
492 "read_learning_progress"
493 );
494 } else {
495 // using summary filters
496 $filter = $this->getCurrentFilter();
497 }
498
500 $a_object_id,
501 $a_ref_id,
506 $filter,
507 $this->getSelectedColumns(),
508 $preselected_obj_ids
509 );
510
511 // build status to image map
512 $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
516 );
517 $status_map = array();
519 foreach ($valid_status as $status) {
520 $status_map[$status] = $status_icons->renderIconForStatus($status);
521 }
522
523 // language map
524 $this->lng->loadLanguageModule("meta");
525 $languages = array();
526 foreach ($this->lng->getInstalledLanguages() as $lang_key) {
527 $languages[$lang_key] = $this->lng->txt("meta_l_" . $lang_key);
528 }
529
530 $rows = array();
531 foreach ($data["set"] as $idx => $result) {
532 // sessions have no title
533 if ($result["title"] == "" && $result["type"] == "sess") {
534 $sess = new ilObjSession($result["obj_id"], false);
535 $data["set"][$idx]["title"] = $sess->getFirstAppointment(
536 )->appointmentToString();
537 }
538
539 $data["set"][$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline(
540 $result["obj_id"],
541 $result["type"]
542 );
543
544 // #13807
545 if ($result["ref_ids"]) {
546 $valid = false;
547 foreach ($result["ref_ids"] as $check_ref_id) {
549 'read_learning_progress',
550 $check_ref_id
551 )) {
552 $valid = true;
553 break;
554 }
555 }
556 if (!$valid) {
557 foreach (array_keys($data["set"][$idx]) as $col_id) {
558 if (!in_array(
559 $col_id,
560 array("type",
561 "title",
562 "obj_id",
563 "ref_id",
564 "offline"
565 )
566 )) {
567 $data["set"][$idx][$col_id] = null;
568 }
569 }
570 $data["set"][$idx]["privacy_conflict"] = true;
571 continue;
572 }
573 }
574
575 // percentages
576 $users_no = $result["user_total"];
577 $data["set"][$idx]["country"] = $this->getItemsPercentages(
578 $result["country"],
579 $users_no
580 );
581 $data["set"][$idx]["gender"] = $this->getItemsPercentages(
582 $result["gender"],
583 $users_no,
584 array(
585 "n" => $this->lng->txt("gender_n"),
586 "m" => $this->lng->txt("gender_m"),
587 "f" => $this->lng->txt("gender_f"),
588 )
589 );
590 $data["set"][$idx]["city"] = $this->getItemsPercentages(
591 $result["city"],
592 $users_no
593 );
594 $data["set"][$idx]["sel_country"] = $this->getItemsPercentages(
595 $result["sel_country"],
596 $users_no,
597 $this->getSelCountryCodes()
598 );
599 $data["set"][$idx]["mark"] = $this->getItemsPercentages(
600 $result["mark"],
601 $users_no
602 );
603 $data["set"][$idx]["language"] = $this->getItemsPercentages(
604 $result["language"],
605 $users_no,
606 $languages
607 );
608
609 // if we encounter any invalid status codes, e.g. null, map them to not attempted instead
610 foreach ($result["status"] as $status_code => $status_counter) {
611 // null is cast to ""
612 if ($status_code === "" || !in_array(
613 $status_code,
614 $valid_status
615 )) {
616 $result['status'][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] =
617 $result['status'][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] ?? 0 + $status_counter;
618 unset($result["status"][$status_code]);
619 }
620 }
621 $data["set"][$idx]["status"] = $this->getItemsPercentagesStatus(
622 $result["status"],
623 $users_no,
624 $status_map
625 );
626
627 if (!$this->isPercentageAvailable($result["obj_id"])) {
628 $data["set"][$idx]["percentage_avg"] = null;
629 }
630 }
631
632 $this->setMaxCount($data["cnt"]);
633 $this->setData($data["set"]);
634 }
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
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.
static checkPermission(string $a_permission, int $a_ref_id, ?int $a_user_id=null)
wrapper for rbac access checks
static isObjectOffline(int $a_obj_id, string $a_type='')
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.
static getObjectsSummaryForObject(int $a_parent_obj_id, int $a_parent_ref_id, string $a_order_field="", string $a_order_dir="", int $a_offset=0, int $a_limit=9999, ?array $a_filters=null, ?array $a_additional_fields=null, ?array $a_preselected_obj_ids=null)
Get all aggregated tracking data for parent object :TODO: sorting, offset, limit, objectives,...
getItemsPercentagesStatus( $data=null, int $overall=0, array $value_map=null)
Render status data as needed for summary list (based on grouped values)
getItemsPercentages( $data=null, int $overall=0, array $value_map=null, $limit=3)
Render data as needed for summary list (based on grouped values)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
$valid
$rows
Definition: xhr_table.php:10

References ilTableGUI\$data, ilLPTableBaseGUI\$filter, $olp, $rows, $valid, ilObject\_lookupObjId(), ilLearningProgressAccess\checkPermission(), ilObjectLP\getCollectionInstance(), ilLPTableBaseGUI\getCurrentFilter(), ilObjectLP\getCurrentMode(), ilObjectLP\getInstance(), ilLPStatusIcons\getInstance(), getItemsPercentages(), getItemsPercentagesStatus(), ilTable2GUI\getLimit(), ilTrQuery\getObjectsSummaryForObject(), ilTable2GUI\getOffset(), ilTableGUI\getOrderDirection(), ilTable2GUI\getOrderField(), getSelCountryCodes(), ilTable2GUI\getSelectedColumns(), ilLPStatusIcons\ICON_VARIANT_SHORT, ilLearningProgressBaseGUI\isObjectOffline(), ilLPTableBaseGUI\isPercentageAvailable(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_COLLECTION, ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, ilLPTableBaseGUI\searchObjects(), ilTable2GUI\setData(), ilTableGUI\setMaxCount(), and ilUtil\stripSlashes().

Referenced by __construct().

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

◆ getItemsPercentages()

ilTrSummaryTableGUI::getItemsPercentages (   $data = null,
int  $overall = 0,
array  $value_map = null,
  $limit = 3 
)
protected

Render data as needed for summary list (based on grouped values)

Definition at line 639 of file class.ilTrSummaryTableGUI.php.

644 : array {
645 if (!$overall) {
646 return [];
647 }
648
649 $result = [];
650
651 if ($data) {
652 if (is_array($data) && count($data) < $limit) {
653 $limit = count($data);
654 }
655 if (is_array($data) && (count($data) == $limit + 1)) {
656 ++$limit;
657 }
658 $counter = $others_counter = 0;
659 $others_sum = $overall;
660 $all_sum = 0;
661 foreach ($data as $id => $count) {
662 $counter++;
663 $all_sum += $count;
664 if ($counter <= $limit) {
665 $caption = $id;
666
667 if ($value_map && isset($value_map[$id])) {
668 $caption = $value_map[$id];
669 }
670 if ($caption == "") {
671 $caption = $this->lng->txt("none");
672 }
673 if (
674 $counter == $limit &&
675 $all_sum < $overall
676 ) {
677 ++$others_counter;
678 continue;
679 }
680 $perc = round($count / $overall * 100);
681 $result[] = array(
682 "caption" => $caption,
683 "absolute" => $count,
684 // ." ".($count > 1 ? $lng->txt("users") : $lng->txt("user")),
685 "percentage" => $perc
686 );
687 $others_sum -= $count;
688 } else {
689 $others_counter++;
690 }
691 }
692
693 if ($others_counter) {
694 $perc = round($others_sum / $overall * 100);
695 $result[] = array(
696 "caption" => $others_counter . " " . $this->lng->txt(
697 "trac_others"
698 ),
699 "absolute" => $others_sum,
700 // ." ".($others_sum > 1 ? $lng->txt("users") : $lng->txt("user")),
701 "percentage" => $perc
702 );
703 }
704 }
705
706 return $result;
707 }

Referenced by getItems().

+ Here is the caller graph for this function:

◆ getItemsPercentagesStatus()

ilTrSummaryTableGUI::getItemsPercentagesStatus (   $data = null,
int  $overall = 0,
array  $value_map = null 
)
protected

Render status data as needed for summary list (based on grouped values)

Definition at line 712 of file class.ilTrSummaryTableGUI.php.

716 : array {
717 $result = array();
718 foreach ($value_map as $id => $caption) {
719 $count = 0;
720 if (isset($data[$id])) {
721 $count = $data[$id];
722 }
723 $perc = round($count / $overall * 100);
724
725 $result[] = array(
726 "caption" => $caption,
727 "absolute" => $count,
728 "percentage" => $perc
729 );
730 }
731
732 return $result;
733 }

References $data, and $id.

Referenced by getItems().

+ Here is the caller graph for this function:

◆ getSelCountryCodes()

ilTrSummaryTableGUI::getSelCountryCodes ( )

Definition at line 449 of file class.ilTrSummaryTableGUI.php.

449 : array
450 {
451 $options = array();
452 foreach (ilCountry::getCountryCodes() as $c) {
453 $options[$c] = $this->lng->txt("meta_c_" . $c);
454 }
455 asort($options);
456 return $options;
457 }
static getCountryCodes()
Get country codes (DIN EN 3166-1)

References $c, ilCountry\getCountryCodes(), and ILIAS\Repository\lng().

Referenced by getItems().

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

◆ getSelectableColumns()

ilTrSummaryTableGUI::getSelectableColumns ( )

Get selectable columns.

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

Reimplemented from ilTable2GUI.

Definition at line 120 of file class.ilTrSummaryTableGUI.php.

120 : array
121 {
122 $lng_map = array("user_total" => "users",
123 "first_access_min" => "trac_first_access",
124 "last_access_max" => "trac_last_access",
125 "mark" => "trac_mark",
126 "status" => "trac_status",
127 'status_changed_max' => 'trac_status_changed',
128 "spent_seconds_avg" => "trac_spent_seconds",
129 "percentage_avg" => "trac_percentage",
130 "read_count_sum" => "trac_read_count",
131 "read_count_avg" => "trac_read_count",
132 "read_count_spent_seconds_avg" => "trac_read_count_spent_seconds"
133 );
134
135 $all = array("user_total");
136 $default = array();
137
138 // show only if extended data was activated in lp settings
139 $tracking = new ilObjUserTracking();
140 if ($tracking->hasExtendedData(
142 )) {
143 $all[] = "read_count_sum";
144 $all[] = "read_count_avg";
145 $default[] = "read_count_sum";
146 }
147 if ($tracking->hasExtendedData(
149 )) {
150 if ($this->is_root || !$this->type || ilObjectLP::supportsSpentSeconds(
151 $this->type
152 )) {
153 $all[] = "spent_seconds_avg";
154 $default[] = "spent_seconds_avg";
155 }
156 }
157 if ($tracking->hasExtendedData(
159 ) &&
160 $tracking->hasExtendedData(
162 )) {
163 if ($this->is_root || !$this->type || ilObjectLP::supportsSpentSeconds(
164 $this->type
165 )) {
166 $all[] = "read_count_spent_seconds_avg";
167 // $default[] = "read_count_spent_seconds_avg";
168 }
169 }
170
171 if ($this->is_root || !$this->type || $this->isPercentageAvailable(
172 $this->obj_id
173 )) {
174 $all[] = "percentage_avg";
175 }
176
177 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
178 $all[] = "status";
179 $all[] = 'status_changed_max';
180 }
181
182 if ($this->is_root || !$this->type || ilObjectLP::supportsMark(
183 $this->type
184 )) {
185 $all[] = "mark";
186 }
187
188 $privacy = array("gender", "city", "country", "sel_country");
189 foreach ($privacy as $field) {
190 if (
191 ($this->is_in_course && $this->setting->get("usr_settings_course_export_" . $field)) ||
192 ($this->is_in_group && $this->setting->get("usr_settings_group_export_" . $field))
193 ) {
194 $all[] = $field;
195 }
196 }
197
198 $all[] = "language";
199
200 $default[] = "percentage_avg";
201 $default[] = "status";
202 $default[] = "mark";
203
204 if ($tracking->hasExtendedData(
206 )) {
207 $all[] = "first_access_min";
208 $all[] = "last_access_max";
209 }
210
211 $all[] = "create_date_min";
212 $all[] = "create_date_max";
213
214 $columns = array();
215 foreach ($all as $column) {
216 $l = $column;
217
218 $prefix = false;
219 if (substr($l, -3) == "avg") {
220 $prefix = "&#216; ";
221 } elseif (substr($l, -3) == "sum" || $l == "user_total") {
222 $prefix = "&#8721; ";
223 }
224
225 if (isset($lng_map[$l])) {
226 $l = $lng_map[$l];
227 }
228
229 $txt = $prefix . $this->lng->txt($l);
230
231 if (in_array(
232 $column,
233 array("read_count_avg",
234 "spent_seconds_avg",
235 "percentage_avg"
236 )
237 )) {
238 $txt .= " / " . $this->lng->txt("user");
239 }
240
241 $columns[$column] = array(
242 "txt" => $txt,
243 "default" => (in_array($column, $default) ? true : false)
244 );
245 }
246 return $columns;
247 }
static supportsSpentSeconds(string $obj_type)
static supportsMark(string $obj_type)
$txt
Definition: error.php:13

References ilTable2GUI\$column, ilTableGUI\$prefix, $txt, ilObjUserTracking\EXTENDED_DATA_LAST_ACCESS, ilObjUserTracking\EXTENDED_DATA_READ_COUNT, ilObjUserTracking\EXTENDED_DATA_SPENT_SECONDS, ilLPTableBaseGUI\isPercentageAvailable(), ILIAS\Repository\lng(), ilObjectLP\supportsMark(), and ilObjectLP\supportsSpentSeconds().

Referenced by __construct().

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

◆ initFilter()

ilTrSummaryTableGUI::initFilter ( )

Reimplemented from ilTable2GUI.

Definition at line 249 of file class.ilTrSummaryTableGUI.php.

249 : void
250 {
251 if ($this->is_root) {
252 parent::initBaseFilter(true, false);
253 return;
254 }
255
256 // show only if extended data was activated in lp settings
257 $tracking = new ilObjUserTracking();
258
259 $item = $this->addFilterItemByMetaType(
260 "user_total",
262 true,
263 "&#8721; " . $this->lng->txt("users")
264 );
265 $this->filter["user_total"] = $item->getValue();
266
267 if ($tracking->hasExtendedData(
269 )) {
270 $item = $this->addFilterItemByMetaType(
271 "read_count_sum",
273 true,
274 "&#8721; " . $this->lng->txt("trac_read_count")
275 );
276 $this->filter["read_count"] = $item->getValue();
277 }
278
279 if ($tracking->hasExtendedData(
281 )) {
282 if ($this->is_root || !$this->type || ilObjectLP::supportsSpentSeconds(
283 $this->type
284 )) {
285 $item = $this->addFilterItemByMetaType(
286 "spent_seconds",
288 true,
289 "&#216; " . $this->lng->txt(
290 "trac_spent_seconds"
291 ) . " / " . $this->lng->txt("user")
292 );
293 $this->filter["spent_seconds"]["from"] = $item->getCombinationItem(
294 "from"
295 )->getValueInSeconds();
296 $this->filter["spent_seconds"]["to"] = $item->getCombinationItem(
297 "to"
298 )->getValueInSeconds();
299 }
300 }
301
302 if ($this->is_root || !$this->type || $this->isPercentageAvailable(
303 $this->obj_id
304 )) {
305 $item = $this->addFilterItemByMetaType(
306 "percentage",
308 true,
309 "&#216; " . $this->lng->txt(
310 "trac_percentage"
311 ) . " / " . $this->lng->txt("user")
312 );
313 $this->filter["percentage"] = $item->getValue();
314 }
315
316 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
317 $item = $this->addFilterItemByMetaType(
318 "status",
320 true
321 );
322 $item->setOptions(
323 array("" => $this->lng->txt("trac_all"),
324 ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM + 1 => $this->lng->txt(
326 ),
327 ilLPStatus::LP_STATUS_IN_PROGRESS_NUM + 1 => $this->lng->txt(
329 ),
330 ilLPStatus::LP_STATUS_COMPLETED_NUM + 1 => $this->lng->txt(
332 ),
333 ilLPStatus::LP_STATUS_FAILED_NUM + 1 => $this->lng->txt(
335 )
336 )
337 );
338 $this->filter["status"] = $item->getValue();
339 if ($this->filter["status"]) {
340 $this->filter["status"]--;
341 }
342
343 $item = $this->addFilterItemByMetaType(
344 "status_changed_max",
346 true,
347 $this->lng->txt("trac_status_changed")
348 );
349 $this->filter["status_changed"] = $item->getDate();
350 }
351
352 if ($this->is_root || !$this->type || ilObjectLP::supportsMark(
353 $this->type
354 )) {
355 $item = $this->addFilterItemByMetaType(
356 "mark",
358 true,
359 $this->lng->txt("trac_mark")
360 );
361 $this->filter["mark"] = $item->getValue();
362 }
363
364 if ($this->setting->get("usr_settings_course_export_gender")) {
365 $item = $this->addFilterItemByMetaType(
366 "gender",
368 true
369 );
370 $item->setOptions(
371 array(
372 "" => $this->lng->txt("trac_all"),
373 "n" => $this->lng->txt("gender_n"),
374 "m" => $this->lng->txt("gender_m"),
375 "f" => $this->lng->txt("gender_f"),
376 )
377 );
378 $this->filter["gender"] = $item->getValue();
379 }
380
381 if ($this->setting->get("usr_settings_course_export_city")) {
382 $item = $this->addFilterItemByMetaType(
383 "city",
385 true
386 );
387 $this->filter["city"] = $item->getValue();
388 }
389
390 if ($this->setting->get("usr_settings_course_export_country")) {
391 $item = $this->addFilterItemByMetaType(
392 "country",
394 true
395 );
396 $this->filter["country"] = $item->getValue();
397 }
398
399 if ($this->setting->get("usr_settings_course_export_sel_country")) {
400 $item = $this->addFilterItemByMetaType(
401 "sel_country",
403 true
404 );
405 $item->setOptions(
406 array("" => $this->lng->txt(
407 "trac_all"
408 )
409 ) + $this->getSelCountryCodes()
410 );
411 $this->filter["sel_country"] = $item->getValue();
412 }
413
414 $item = $this->addFilterItemByMetaType(
415 "language",
417 true
418 );
419 $this->filter["language"] = $item->getValue();
420
421 if ($tracking->hasExtendedData(
423 )) {
424 $item = $this->addFilterItemByMetaType(
425 "first_access_min",
427 true,
428 $this->lng->txt("trac_first_access")
429 );
430 $this->filter["first_access"] = $item->getDate();
431
432 $item = $this->addFilterItemByMetaType(
433 "last_access_max",
435 true,
436 $this->lng->txt("trac_last_access")
437 );
438 $this->filter["last_access"] = $item->getDate();
439 }
440
441 $item = $this->addFilterItemByMetaType(
442 "registration_filter",
444 true
445 );
446 $this->filter["registration"] = $item->getDate();
447 }
const LP_STATUS_COMPLETED
const LP_STATUS_FAILED
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
const FILTER_DURATION_RANGE
const FILTER_NUMBER_RANGE
const FILTER_DATETIME_RANGE

References ilTable2GUI\addFilterItemByMetaType(), ilObjUserTracking\EXTENDED_DATA_LAST_ACCESS, ilObjUserTracking\EXTENDED_DATA_READ_COUNT, ilObjUserTracking\EXTENDED_DATA_SPENT_SECONDS, ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ilTable2GUI\FILTER_DATE_RANGE, ilTable2GUI\FILTER_DATETIME_RANGE, ilTable2GUI\FILTER_DURATION_RANGE, ilTable2GUI\FILTER_LANGUAGE, ilTable2GUI\FILTER_NUMBER_RANGE, ilTable2GUI\FILTER_SELECT, ilTable2GUI\FILTER_TEXT, ilLPTableBaseGUI\isPercentageAvailable(), ILIAS\Repository\lng(), ilLPStatus\LP_STATUS_COMPLETED, ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, ilObjectLP\supportsMark(), and ilObjectLP\supportsSpentSeconds().

Referenced by __construct().

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

◆ isArrayColumn()

ilTrSummaryTableGUI::isArrayColumn ( string  $a_name)
protected

Definition at line 960 of file class.ilTrSummaryTableGUI.php.

960 : bool
961 {
962 if (in_array(
963 $a_name,
964 array("country",
965 "gender",
966 "city",
967 "language",
968 "status",
969 "mark",
970 'sel_country'
971 )
972 )) {
973 return true;
974 }
975 return false;
976 }

◆ isStatusShown()

ilTrSummaryTableGUI::isStatusShown ( )

Definition at line 993 of file class.ilTrSummaryTableGUI.php.

993 : bool
994 {
995 return in_array('status', $this->getSelectedColumns());
996 }

◆ numericOrdering()

ilTrSummaryTableGUI::numericOrdering ( string  $a_field)

Should this field be sorted numeric?

Reimplemented from ilTable2GUI.

Definition at line 978 of file class.ilTrSummaryTableGUI.php.

978 : bool
979 {
980 $pos = strrpos($a_field, "_");
981 if ($pos !== false) {
982 $function = strtoupper(substr($a_field, $pos + 1));
983 if (in_array(
984 $function,
985 array("MIN", "MAX", "SUM", "AVG", "COUNT", "TOTAL")
986 )) {
987 return true;
988 }
989 }
990 return false;
991 }

◆ parseValue()

ilTrSummaryTableGUI::parseValue ( string  $id,
?string  $value,
string  $type 
)
protected

Reimplemented from ilLPTableBaseGUI.

Definition at line 735 of file class.ilTrSummaryTableGUI.php.

739 : string {
740 // get rid of aggregation
741 $pos = strrpos($id, "_");
742 if ($pos !== false) {
743 $function = strtoupper(substr($id, $pos + 1));
744 if (in_array(
745 $function,
746 array("MIN", "MAX", "SUM", "AVG", "COUNT")
747 )) {
748 $id = substr($id, 0, $pos);
749 }
750 }
751
752 if (trim($value) == "") {
753 if ($id == "title") {
754 return "--" . $this->lng->txt("none") . "--";
755 }
756 return "";
757 }
758 switch ($id) {
759 case 'status_changed':
760 case "first_access":
761 case "create_date":
763 new ilDateTime($value, IL_CAL_DATETIME)
764 );
765 break;
766
767 case "last_access":
769 new ilDateTime($value, IL_CAL_UNIX)
770 );
771 break;
772
773 case "spent_seconds":
774 case "read_count_spent_seconds":
776 $value = "-";
777 } else {
779 (int) $value,
780 $value < 3600
781 ); // #14858
782 }
783 break;
784
785 case "percentage":
786 if (false /* $this->isPercentageAvailable() */) {
787 $value = "-";
788 } else {
789 $value = $value . "%";
790 }
791 break;
792
793 case "mark":
795 $value = "-";
796 }
797 break;
798 }
799
800 return $value;
801 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling

References $id.

◆ renderPercentages()

ilTrSummaryTableGUI::renderPercentages ( string  $id,
array  $data 
)
protected

Definition at line 945 of file class.ilTrSummaryTableGUI.php.

945 : void
946 {
947 if ($data) {
948 foreach ($data as $item) {
949 $this->tpl->setCurrentBlock($id . "_row");
950 $this->tpl->setVariable("CAPTION", $item["caption"]);
951 $this->tpl->setVariable("ABSOLUTE", $item["absolute"]);
952 $this->tpl->setVariable("PERCENTAGE", $item["percentage"]);
953 $this->tpl->parseCurrentBlock();
954 }
955 } else {
956 $this->tpl->touchBlock($id);
957 }
958 }

References $data, and $id.

Field Documentation

◆ $access

ilAccessHandler ilTrSummaryTableGUI::$access
protected

Definition at line 36 of file class.ilTrSummaryTableGUI.php.

◆ $is_in_course

bool ilTrSummaryTableGUI::$is_in_course = false
protected

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

◆ $is_in_group

bool ilTrSummaryTableGUI::$is_in_group = false
protected

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

◆ $is_root

bool ilTrSummaryTableGUI::$is_root
protected

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

◆ $obj_id

int ilTrSummaryTableGUI::$obj_id
protected

Definition at line 34 of file class.ilTrSummaryTableGUI.php.

◆ $olp

ilObjectLP ilTrSummaryTableGUI::$olp = null
protected

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

Referenced by getItems().

◆ $rbacsystem

ilRbacSystem ilTrSummaryTableGUI::$rbacsystem
protected

Definition at line 37 of file class.ilTrSummaryTableGUI.php.

◆ $ref_id

int ilTrSummaryTableGUI::$ref_id
protected

Definition at line 32 of file class.ilTrSummaryTableGUI.php.

◆ $type

string ilTrSummaryTableGUI::$type = null
protected

Definition at line 33 of file class.ilTrSummaryTableGUI.php.

Referenced by __construct().


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