ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 ()
 
 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
 
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 int 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->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
89
90 $this->addColumn($this->lng->txt("title"), "title");
91 $this->setDefaultOrderField("title");
92
93 $labels = $this->getSelectableColumns();
94 foreach ($this->getSelectedColumns() as $c) {
95 // see bug #35119; these column list percentage lists and are not sortable
96 if (in_array($c, ["status", "mark", "language", "gender", "city", "country"])) {
97 $this->addColumn($labels[$c]["txt"]);
98 } else {
99 $this->addColumn($labels[$c]["txt"], $c);
100 }
101 }
102
103 if ($this->is_root) {
104 $this->addColumn($this->lng->txt("path"));
105 $this->addColumn($this->lng->txt("action"));
106 }
107
108 // $this->setExternalSorting(true);
109 $this->setEnableHeader(true);
110 $this->setFormAction(
111 $this->ctrl->getFormActionByClass(get_class($this))
112 );
113 $this->setRowTemplate("tpl.trac_summary_row.html", "components/ILIAS/Tracking");
114 $this->initFilter();
115
116 $this->getItems($a_parent_obj->getObjId(), $a_ref_id);
117 }
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.
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.
const ROOT_FOLDER_ID
Definition: constants.php:32
$c
Definition: deliver.php:25
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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(), and ilTable2GUI\setRowTemplate().

+ 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 1116 of file class.ilTrSummaryTableGUI.php.

1116 : void
1117 {
1118 $a_csv->addColumn($this->lng->txt("title"));
1119
1120 $labels = $this->getSelectableColumns();
1121 foreach ($this->getSelectedColumns() as $c) {
1122 $label = $labels[$c]["txt"];
1123 $label = str_replace(
1124 "Ø",
1125 $this->lng->txt("trac_average"),
1126 $label
1127 );
1128 $label = str_replace(
1129 "∑",
1130 $this->lng->txt("trac_sum"),
1131 $label
1132 );
1133
1134 if (!$this->isArrayColumn($c)) {
1135 $a_csv->addColumn($label);
1136 } else {
1137 if ($c != "status") {
1138 $a_csv->addColumn($label . " #1");
1139 $a_csv->addColumn($label . " #1");
1140 $a_csv->addColumn($label . " #1 %");
1141 $a_csv->addColumn($label . " #2");
1142 $a_csv->addColumn($label . " #2");
1143 $a_csv->addColumn($label . " #2 %");
1144 $a_csv->addColumn($label . " #3");
1145 $a_csv->addColumn($label . " #3");
1146 $a_csv->addColumn($label . " #3 %");
1147 $a_csv->addColumn(
1148 $label . " " . $this->lng->txt("trac_others")
1149 );
1150 $a_csv->addColumn(
1151 $label . " " . $this->lng->txt("trac_others")
1152 );
1153 $a_csv->addColumn(
1154 $label . " " . $this->lng->txt("trac_others") . " %"
1155 );
1156 } else {
1157 // build status to image map
1158 $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
1162 );
1163 foreach ($valid_status as $status) {
1165 $status
1166 );
1167 $a_csv->addColumn($text);
1168 $a_csv->addColumn($text . " %");
1169 }
1170 }
1171 }
1172 }
1173
1174 $a_csv->addRow();
1175 }
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.
$text
Definition: xapiexit.php:21

References $c, $text, 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 984 of file class.ilTrSummaryTableGUI.php.

984 : void
985 {
986 $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
987
988 $labels = $this->getSelectableColumns();
989 $cnt = 1;
990 foreach ($this->getSelectedColumns() as $c) {
991 $label = $labels[$c]["txt"];
992 $label = str_replace(
993 "Ø",
994 $this->lng->txt("trac_average"),
995 $label
996 );
997 $label = str_replace(
998 "∑",
999 $this->lng->txt("trac_sum"),
1000 $label
1001 );
1002
1003 if (!$this->isArrayColumn($c)) {
1004 $a_excel->setCell($a_row, $cnt, $label);
1005 $cnt++;
1006 } else {
1007 if ($c != "status") {
1008 $a_excel->setCell($a_row, $cnt, $label . " #1");
1009 $a_excel->setCell($a_row, ++$cnt, $label . " #1");
1010 $a_excel->setCell($a_row, ++$cnt, $label . " #1 %");
1011 $a_excel->setCell($a_row, ++$cnt, $label . " #2");
1012 $a_excel->setCell($a_row, ++$cnt, $label . " #2");
1013 $a_excel->setCell($a_row, ++$cnt, $label . " #2 %");
1014 $a_excel->setCell($a_row, ++$cnt, $label . " #3");
1015 $a_excel->setCell($a_row, ++$cnt, $label . " #3");
1016 $a_excel->setCell($a_row, ++$cnt, $label . " #3 %");
1017 $a_excel->setCell(
1018 $a_row,
1019 ++$cnt,
1020 $label . " " . $this->lng->txt(
1021 "trac_others"
1022 )
1023 );
1024 $a_excel->setCell(
1025 $a_row,
1026 ++$cnt,
1027 $label . " " . $this->lng->txt(
1028 "trac_others"
1029 )
1030 );
1031 $a_excel->setCell(
1032 $a_row,
1033 ++$cnt,
1034 $label . " " . $this->lng->txt(
1035 "trac_others"
1036 ) . " %"
1037 );
1038 } else {
1039 // build status to image map
1040 $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
1044 );
1045 $cnt--;
1046 foreach ($valid_status as $status) {
1048 $status
1049 );
1050 $a_excel->setCell($a_row, ++$cnt, $text);
1051 $a_excel->setCell($a_row, ++$cnt, $text . " %");
1052 }
1053 }
1054 $cnt++;
1055 }
1056 }
1057
1058 $a_excel->setBold(
1059 "A" . $a_row . ":" . $a_excel->getColumnCoord($cnt) . $a_row
1060 );
1061 }
setBold(string $a_coords)
Set cell(s) to bold.
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
getColumnCoord(int $a_col)
Get column "name" from number.

References $c, $text, 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 793 of file class.ilTrSummaryTableGUI.php.

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

References $c, $path, $ref_id, ilObject\_getIcon(), 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 1177 of file class.ilTrSummaryTableGUI.php.

1177 : void
1178 {
1179 $a_csv->addColumn($a_set["title"]);
1180
1181 foreach ($this->getSelectedColumns() as $c) {
1182 if (!$this->isArrayColumn($c)) {
1183 $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
1184 $a_csv->addColumn($val);
1185 } else {
1186 foreach ((array) $a_set[$c] as $idx => $value) {
1187 if ($c != "status") {
1188 $a_csv->addColumn($value["caption"]);
1189 }
1190 $a_csv->addColumn((string) $value["absolute"]);
1191 $a_csv->addColumn($value["percentage"]);
1192 }
1193 if (sizeof($a_set[$c]) < 4 && $c != "status") {
1194 for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
1195 $a_csv->addColumn("");
1196 $a_csv->addColumn("");
1197 $a_csv->addColumn("");
1198 }
1199 }
1200 }
1201 }
1202
1203 $a_csv->addRow();
1204 }

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

1067 : void {
1068 $a_excel->setCell($a_row, 0, $a_set["title"]);
1069
1070 $cnt = 1;
1071 foreach ($this->getSelectedColumns() as $c) {
1072 if (!$this->isArrayColumn($c)) {
1073 $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
1074 $a_excel->setCell($a_row, $cnt, $val);
1075 $cnt++;
1076 } else {
1077 foreach ((array) $a_set[$c] as $idx => $value) {
1078 if ($c == "status") {
1079 $a_excel->setCell(
1080 $a_row,
1081 $cnt,
1082 (int) $value["absolute"]
1083 );
1084 $a_excel->setCell(
1085 $a_row,
1086 ++$cnt,
1087 $value["percentage"] . "%"
1088 );
1089 } else {
1090 $a_excel->setCell($a_row, $cnt, $value["caption"]);
1091 $a_excel->setCell(
1092 $a_row,
1093 ++$cnt,
1094 (int) $value["absolute"]
1095 );
1096 $a_excel->setCell(
1097 $a_row,
1098 ++$cnt,
1099 $value["percentage"] . "%"
1100 );
1101 }
1102 $cnt++;
1103 }
1104 if (sizeof($a_set[$c]) < 4 && $c != "status") {
1105 for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
1106 $a_excel->setCell($a_row, $cnt, "");
1107 $a_excel->setCell($a_row, ++$cnt, "");
1108 $a_excel->setCell($a_row, ++$cnt, "");
1109 $cnt++;
1110 }
1111 }
1112 }
1113 }
1114 }

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

453 : void
454 {
455 // show only selected subobjects for lp mode
456 $preselected_obj_ids = $filter = null;
457
459 if (
464 ) {
465 $collection = $olp->getCollectionInstance();
466 $preselected_obj_ids[$a_object_id][] = $a_ref_id;
467 foreach ($collection->getItems() as $item => $item_info) {
468 $tmp_lp = ilObjectLP::getInstance(
469 ilObject::_lookupObjId($item_info)
470 );
471 if ($tmp_lp->isActive()) {
472 $preselected_obj_ids[ilObject::_lookupObjId(
473 $item_info
474 )][] = $item_info;
475 }
476 }
477 $filter = $this->getCurrentFilter();
478 } elseif ($this->is_root) {
479 // using search to get all relevant objects
480 // #8498/#8499: restrict to objects with at least "read_learning_progress" access
481 $preselected_obj_ids = $this->searchObjects(
482 $this->getCurrentFilter(true),
483 "read_learning_progress"
484 );
485 } else {
486 // using summary filters
487 $filter = $this->getCurrentFilter();
488 }
489
491 $a_object_id,
492 $a_ref_id,
497 $filter,
498 $this->getSelectedColumns(),
499 $preselected_obj_ids
500 );
501
502 // build status to image map
503 $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
507 );
508 $status_map = array();
510 foreach ($valid_status as $status) {
511 $status_map[$status] = $status_icons->renderIconForStatus($status);
512 }
513
514 // language map
515 $this->lng->loadLanguageModule("meta");
516 $languages = array();
517 foreach ($this->lng->getInstalledLanguages() as $lang_key) {
518 $languages[$lang_key] = $this->lng->txt("meta_l_" . $lang_key);
519 }
520
521 $rows = array();
522 foreach ($data["set"] as $idx => $result) {
523 // sessions have no title
524 if ($result["title"] == "" && $result["type"] == "sess") {
525 $sess = new ilObjSession($result["obj_id"], false);
526 $data["set"][$idx]["title"] = $sess->getFirstAppointment(
527 )->appointmentToString();
528 }
529
530 $data["set"][$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline(
531 $result["obj_id"],
532 $result["type"]
533 );
534
535 // #13807
536 if ($result["ref_ids"]) {
537 $valid = false;
538 foreach ($result["ref_ids"] as $check_ref_id) {
540 'read_learning_progress',
541 $check_ref_id
542 )) {
543 $valid = true;
544 break;
545 }
546 }
547 if (!$valid) {
548 foreach (array_keys($data["set"][$idx]) as $col_id) {
549 if (!in_array(
550 $col_id,
551 array("type",
552 "title",
553 "obj_id",
554 "ref_id",
555 "offline"
556 )
557 )) {
558 $data["set"][$idx][$col_id] = null;
559 }
560 }
561 $data["set"][$idx]["privacy_conflict"] = true;
562 continue;
563 }
564 }
565
566 // percentages
567 $users_no = $result["user_total"];
568 $data["set"][$idx]["gender"] = $this->getItemsPercentages(
569 $result["gender"],
570 $users_no,
571 array(
572 "n" => $this->lng->txt("gender_n"),
573 "m" => $this->lng->txt("gender_m"),
574 "f" => $this->lng->txt("gender_f"),
575 )
576 );
577 $data["set"][$idx]["city"] = $this->getItemsPercentages(
578 $result["city"],
579 $users_no
580 );
581 $data["set"][$idx]["country"] = $this->getItemsPercentages(
582 $result["country"],
583 $users_no,
584 $this->getSelCountryCodes()
585 );
586 $data["set"][$idx]["mark"] = $this->getItemsPercentages(
587 $result["mark"],
588 $users_no
589 );
590 $data["set"][$idx]["language"] = $this->getItemsPercentages(
591 $result["language"],
592 $users_no,
593 $languages
594 );
595
596 // if we encounter any invalid status codes, e.g. null, map them to not attempted instead
597 foreach ($result["status"] as $status_code => $status_counter) {
598 // null is cast to ""
599 if ($status_code === "" || !in_array(
600 $status_code,
601 $valid_status
602 )) {
603 $result['status'][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] =
604 $result['status'][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] ?? 0 + $status_counter;
605 unset($result["status"][$status_code]);
606 }
607 }
608 $data["set"][$idx]["status"] = $this->getItemsPercentagesStatus(
609 $result["status"],
610 $users_no,
611 $status_map
612 );
613
614 if (!$this->isPercentageAvailable($result["obj_id"])) {
615 $data["set"][$idx]["percentage_avg"] = null;
616 }
617 }
618
619 $this->setMaxCount($data["cnt"]);
620 $this->setData($data["set"]);
621 }
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,...
getItemsPercentages( $data=null, int $overall=0, ?array $value_map=null, $limit=3)
Render data as needed for summary list (based on grouped values)
getItemsPercentagesStatus( $data=null, int $overall=0, ?array $value_map=null)
Render status data as needed for summary list (based on grouped values)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
$valid

References ilTableGUI\$data, ilLPTableBaseGUI\$filter, $olp, $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 626 of file class.ilTrSummaryTableGUI.php.

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

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

703 : array {
704 $result = array();
705 foreach ($value_map as $id => $caption) {
706 $count = 0;
707 if (isset($data[$id])) {
708 $count = $data[$id];
709 }
710 $perc = round($count / $overall * 100);
711
712 $result[] = array(
713 "caption" => $caption,
714 "absolute" => $count,
715 "percentage" => $perc
716 );
717 }
718
719 return $result;
720 }

References $data, and $id.

Referenced by getItems().

+ Here is the caller graph for this function:

◆ getSelCountryCodes()

ilTrSummaryTableGUI::getSelCountryCodes ( )

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

440 : array
441 {
442 $options = array();
443 foreach (ilCountry::getCountryCodes() as $c) {
444 $options[$c] = $this->lng->txt("meta_c_" . $c);
445 }
446 asort($options);
447 return $options;
448 }
static getCountryCodes()
Get country codes (DIN EN 3166-1)

References $c, ILIAS\UI\Implementation\Component\Input\Field\$options, 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 119 of file class.ilTrSummaryTableGUI.php.

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

References ilTable2GUI\$column, ilTableGUI\$prefix, 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 248 of file class.ilTrSummaryTableGUI.php.

248 : void
249 {
250 if ($this->is_root) {
251 parent::initBaseFilter(true, false);
252 return;
253 }
254
255 // show only if extended data was activated in lp settings
256 $tracking = new ilObjUserTracking();
257
258 $item = $this->addFilterItemByMetaType(
259 "user_total",
261 true,
262 "&#8721; " . $this->lng->txt("users")
263 );
264 $this->filter["user_total"] = $item->getValue();
265
266 if ($tracking->hasExtendedData(
268 )) {
269 $item = $this->addFilterItemByMetaType(
270 "read_count_sum",
272 true,
273 "&#8721; " . $this->lng->txt("trac_read_count")
274 );
275 $this->filter["read_count"] = $item->getValue();
276 }
277
278 if ($tracking->hasExtendedData(
280 )) {
281 if ($this->is_root || !$this->type || ilObjectLP::supportsSpentSeconds(
282 $this->type
283 )) {
284 $item = $this->addFilterItemByMetaType(
285 "spent_seconds",
287 true,
288 "&#216; " . $this->lng->txt(
289 "trac_spent_seconds"
290 ) . " / " . $this->lng->txt("user")
291 );
292 $this->filter["spent_seconds"]["from"] = $item->getCombinationItem(
293 "from"
294 )->getValueInSeconds();
295 $this->filter["spent_seconds"]["to"] = $item->getCombinationItem(
296 "to"
297 )->getValueInSeconds();
298 }
299 }
300
301 if ($this->is_root || !$this->type || $this->isPercentageAvailable(
302 $this->obj_id
303 )) {
304 $item = $this->addFilterItemByMetaType(
305 "percentage",
307 true,
308 "&#216; " . $this->lng->txt(
309 "trac_percentage"
310 ) . " / " . $this->lng->txt("user")
311 );
312 $this->filter["percentage"] = $item->getValue();
313 }
314
315 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
316 $item = $this->addFilterItemByMetaType(
317 "status",
319 true
320 );
321 $item->setOptions(
322 array("" => $this->lng->txt("trac_all"),
323 ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM + 1 => $this->lng->txt(
325 ),
326 ilLPStatus::LP_STATUS_IN_PROGRESS_NUM + 1 => $this->lng->txt(
328 ),
329 ilLPStatus::LP_STATUS_COMPLETED_NUM + 1 => $this->lng->txt(
331 ),
332 ilLPStatus::LP_STATUS_FAILED_NUM + 1 => $this->lng->txt(
334 )
335 )
336 );
337 $this->filter["status"] = $item->getValue();
338 if ($this->filter["status"]) {
339 $this->filter["status"]--;
340 }
341
342 $item = $this->addFilterItemByMetaType(
343 "status_changed_max",
345 true,
346 $this->lng->txt("trac_status_changed")
347 );
348 $this->filter["status_changed"] = $item->getDate();
349 }
350
351 if ($this->is_root || !$this->type || ilObjectLP::supportsMark(
352 $this->type
353 )) {
354 $item = $this->addFilterItemByMetaType(
355 "mark",
357 true,
358 $this->lng->txt("trac_mark")
359 );
360 $this->filter["mark"] = $item->getValue();
361 }
362
363 if ($this->setting->get("usr_settings_course_export_gender")) {
364 $item = $this->addFilterItemByMetaType(
365 "gender",
367 true
368 );
369 $item->setOptions(
370 array(
371 "" => $this->lng->txt("trac_all"),
372 "n" => $this->lng->txt("gender_n"),
373 "m" => $this->lng->txt("gender_m"),
374 "f" => $this->lng->txt("gender_f"),
375 )
376 );
377 $this->filter["gender"] = $item->getValue();
378 }
379
380 if ($this->setting->get("usr_settings_course_export_city")) {
381 $item = $this->addFilterItemByMetaType(
382 "city",
384 true
385 );
386 $this->filter["city"] = $item->getValue();
387 }
388
389
390 if ($this->setting->get("usr_settings_course_export_country")) {
391 $item = $this->addFilterItemByMetaType(
392 "country",
394 true
395 );
396 $item->setOptions(
397 array("" => $this->lng->txt(
398 "trac_all"
399 )
400 ) + $this->getSelCountryCodes()
401 );
402 $this->filter["country"] = $item->getValue();
403 }
404
405 $item = $this->addFilterItemByMetaType(
406 "language",
408 true
409 );
410 $this->filter["language"] = $item->getValue();
411
412 if ($tracking->hasExtendedData(
414 )) {
415 $item = $this->addFilterItemByMetaType(
416 "first_access_min",
418 true,
419 $this->lng->txt("trac_first_access")
420 );
421 $this->filter["first_access"] = $item->getDate();
422
423 $item = $this->addFilterItemByMetaType(
424 "last_access_max",
426 true,
427 $this->lng->txt("trac_last_access")
428 );
429 $this->filter["last_access"] = $item->getDate();
430 }
431
432 $item = $this->addFilterItemByMetaType(
433 "registration_filter",
435 true
436 );
437 $this->filter["registration"] = $item->getDate();
438 }
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
filter(string $filter_id, array $class_path, string $cmd, bool $activated=true, bool $expanded=true)

References ilTable2GUI\addFilterItemByMetaType(), ilObjUserTracking\EXTENDED_DATA_LAST_ACCESS, ilObjUserTracking\EXTENDED_DATA_READ_COUNT, ilObjUserTracking\EXTENDED_DATA_SPENT_SECONDS, ILIAS\Repository\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 946 of file class.ilTrSummaryTableGUI.php.

946 : bool
947 {
948 if (in_array(
949 $a_name,
950 array(
951 "gender",
952 "city",
953 "language",
954 "status",
955 "mark",
956 'country'
957 )
958 )) {
959 return true;
960 }
961 return false;
962 }

◆ isStatusShown()

ilTrSummaryTableGUI::isStatusShown ( )

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

979 : bool
980 {
981 return in_array('status', $this->getSelectedColumns());
982 }

◆ numericOrdering()

ilTrSummaryTableGUI::numericOrdering ( string  $a_field)

Should this field be sorted numeric?

Reimplemented from ilTable2GUI.

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

964 : bool
965 {
966 $pos = strrpos($a_field, "_");
967 if ($pos !== false) {
968 $function = strtoupper(substr($a_field, $pos + 1));
969 if (in_array(
970 $function,
971 array("MIN", "MAX", "SUM", "AVG", "COUNT", "TOTAL")
972 )) {
973 return true;
974 }
975 }
976 return false;
977 }

◆ parseValue()

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

Reimplemented from ilLPTableBaseGUI.

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

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

References $id.

◆ renderPercentages()

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

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

931 : void
932 {
933 if ($data) {
934 foreach ($data as $item) {
935 $this->tpl->setCurrentBlock($id . "_row");
936 $this->tpl->setVariable("CAPTION", $item["caption"]);
937 $this->tpl->setVariable("ABSOLUTE", $item["absolute"]);
938 $this->tpl->setVariable("PERCENTAGE", $item["percentage"]);
939 $this->tpl->parseCurrentBlock();
940 }
941 } else {
942 $this->tpl->touchBlock($id);
943 }
944 }

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: