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

Protected Member Functions

 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)
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 
- Protected Member Functions inherited from ilLPTableBaseGUI
 initItemIdFromPost ()
 
 initUidFromPost ()
 
 findReferencesForObjId (int $a_obj_id)
 
 sendMail (array $a_user_ids, $a_parent_obj, string $a_parent_cmd)
 
 searchObjects (array $filter, string $permission, ?array $preset_obj_ids=null, bool $a_check_lp_activation=true)
 Search objects that match current filters. More...
 
 isForwardingToFormDispatcher ()
 
 initRepositoryFilter (array $filter)
 
 buildPath (array $ref_ids)
 
 getPossibleTypes (bool $a_split_learning_resources=false, bool $a_include_digilib=false, bool $a_allow_undefined_lp=false)
 
 parseValue (string $id, ?string $value, string $type)
 
 isPercentageAvailable (int $a_obj_id)
 
 parseTitle (int $a_obj_id, string $action, int $a_user_id=0)
 
 getExportMeta ()
 Build export meta data. More...
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 
 fillMetaCSV (ilCSVWriter $a_csv)
 
 showTimingsWarning (int $a_ref_id, int $a_user_id)
 
 formatSeconds (int $seconds, bool $a_shorten_zero=false)
 
 anonymizeValue ($a_value, bool $a_force_number=false)
 
 buildValueScale (int $a_max_value, bool $a_anonymize=false, bool $a_format_seconds=false)
 
 getMonthsFilter ($a_short=false)
 
 getMonthsYear ($a_year=null, $a_short=false)
 
 getSelectableUserColumns (int $a_in_course=0, int $a_in_group=0)
 
 addToClipboard ()
 Add selected users to clipboard. More...
 
- Protected Member Functions inherited from ilTable2GUI
 getRequestedValues ()
 
 prepareOutput ()
 Anything that must be done before HTML is generated. More...
 
 isFilterVisible ()
 Check if filter is visible: manually shown (session, db) or default value set. More...
 
 isAdvMDFilter (ilAdvancedMDRecordGUI $a_gui, ilTableFilterItem $a_element)
 Check if filter element is based on adv md. More...
 
 fillRow (array $a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilTableFilterItem $a_item)
 Get current filter value. More...
 
 setFilterValue (ilTableFilterItem $a_item, $a_value)
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel (ilExcel $a_excel, int &$a_row)
 Excel Version of Fill Header. More...
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV (ilCSVWriter $a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 CSV Version of Fill Row. More...
 

Protected Attributes

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

Additional Inherited Members

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

Detailed Description

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.

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().

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", "country", "gender", "city", "sel_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  }
setExportFormats(array $formats)
Set available export formats.
setFormAction(string $a_form_action, bool $a_multipart=false)
const ROOT_FOLDER_ID
Definition: constants.php:32
getItems(int $a_object_id, int $a_ref_id)
Build summary item rows for given object and filter(s.
setPrintMode(bool $a_value=false)
$c
Definition: deliver.php:25
setId(string $a_val)
static _lookupObjId(int $ref_id)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
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)
static _lookupType(int $id, bool $reference=false)
parseTitle(int $a_obj_id, string $action, int $a_user_id=0)
static getInstance(int $obj_id)
setEnableHeader(bool $a_enableheader)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillHeaderCSV()

ilTrSummaryTableGUI::fillHeaderCSV ( ilCSVWriter  $a_csv)
protected

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

References $c, ilLearningProgressBaseGUI\_getStatusText(), ilCSVWriter\addColumn(), ilCSVWriter\addRow(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), isArrayColumn(), 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.

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

◆ fillHeaderExcel()

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

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

References $c, ilLearningProgressBaseGUI\_getStatusText(), ilExcel\getColumnCoord(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), isArrayColumn(), 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().

997  : void
998  {
999  $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
1000 
1001  $labels = $this->getSelectableColumns();
1002  $cnt = 1;
1003  foreach ($this->getSelectedColumns() as $c) {
1004  $label = $labels[$c]["txt"];
1005  $label = str_replace(
1006  "Ø",
1007  $this->lng->txt("trac_average"),
1008  $label
1009  );
1010  $label = str_replace(
1011  "∑",
1012  $this->lng->txt("trac_sum"),
1013  $label
1014  );
1015 
1016  if (!$this->isArrayColumn($c)) {
1017  $a_excel->setCell($a_row, $cnt, $label);
1018  $cnt++;
1019  } else {
1020  if ($c != "status") {
1021  $a_excel->setCell($a_row, $cnt, $label . " #1");
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 . " #2");
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 . " #3");
1028  $a_excel->setCell($a_row, ++$cnt, $label . " #3");
1029  $a_excel->setCell($a_row, ++$cnt, $label . " #3 %");
1030  $a_excel->setCell(
1031  $a_row,
1032  ++$cnt,
1033  $label . " " . $this->lng->txt(
1034  "trac_others"
1035  )
1036  );
1037  $a_excel->setCell(
1038  $a_row,
1039  ++$cnt,
1040  $label . " " . $this->lng->txt(
1041  "trac_others"
1042  )
1043  );
1044  $a_excel->setCell(
1045  $a_row,
1046  ++$cnt,
1047  $label . " " . $this->lng->txt(
1048  "trac_others"
1049  ) . " %"
1050  );
1051  } else {
1052  // build status to image map
1053  $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
1057  );
1058  $cnt--;
1059  foreach ($valid_status as $status) {
1061  $status
1062  );
1063  $a_excel->setCell($a_row, ++$cnt, $text);
1064  $a_excel->setCell($a_row, ++$cnt, $text . " %");
1065  }
1066  }
1067  $cnt++;
1068  }
1069  }
1070 
1071  $a_excel->setBold(
1072  "A" . $a_row . ":" . $a_excel->getColumnCoord($cnt) . $a_row
1073  );
1074  }
const LP_STATUS_COMPLETED_NUM
getColumnCoord(int $a_col)
Get column "name" from number.
const LP_STATUS_IN_PROGRESS_NUM
$c
Definition: deliver.php:25
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
setBold(string $a_coords)
Set cell(s) to bold.
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:

◆ fillRow()

ilTrSummaryTableGUI::fillRow ( array  $a_set)
protected

Fill table row.

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

References $c, $path, $ref_id, ilObject\_getIcon(), ilLPTableBaseGUI\buildPath(), ILIAS\Repository\ctrl(), ilTable2GUI\getSelectedColumns(), ilLPTableBaseGUI\isPercentageAvailable(), ILIAS\Repository\lng(), null, parseValue(), and renderPercentages().

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

◆ fillRowCSV()

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

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

References $c, ilCSVWriter\addColumn(), ilCSVWriter\addRow(), ilTable2GUI\getSelectedColumns(), isArrayColumn(), and parseValue().

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

◆ fillRowExcel()

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

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

References $c, ilTable2GUI\getSelectedColumns(), isArrayColumn(), parseValue(), and ilExcel\setCell().

1080  : void {
1081  $a_excel->setCell($a_row, 0, $a_set["title"]);
1082 
1083  $cnt = 1;
1084  foreach ($this->getSelectedColumns() as $c) {
1085  if (!$this->isArrayColumn($c)) {
1086  $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
1087  $a_excel->setCell($a_row, $cnt, $val);
1088  $cnt++;
1089  } else {
1090  foreach ((array) $a_set[$c] as $idx => $value) {
1091  if ($c == "status") {
1092  $a_excel->setCell(
1093  $a_row,
1094  $cnt,
1095  (int) $value["absolute"]
1096  );
1097  $a_excel->setCell(
1098  $a_row,
1099  ++$cnt,
1100  $value["percentage"] . "%"
1101  );
1102  } else {
1103  $a_excel->setCell($a_row, $cnt, $value["caption"]);
1104  $a_excel->setCell(
1105  $a_row,
1106  ++$cnt,
1107  (int) $value["absolute"]
1108  );
1109  $a_excel->setCell(
1110  $a_row,
1111  ++$cnt,
1112  $value["percentage"] . "%"
1113  );
1114  }
1115  $cnt++;
1116  }
1117  if (sizeof($a_set[$c]) < 4 && $c != "status") {
1118  for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
1119  $a_excel->setCell($a_row, $cnt, "");
1120  $a_excel->setCell($a_row, ++$cnt, "");
1121  $a_excel->setCell($a_row, ++$cnt, "");
1122  $cnt++;
1123  }
1124  }
1125  }
1126  }
1127  }
parseValue(string $id, ?string $value, string $type)
$c
Definition: deliver.php:25
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
+ 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 461 of file class.ilTrSummaryTableGUI.php.

References ilTableGUI\$data, ilLPTableBaseGUI\$filter, $valid, ilObject\_lookupObjId(), ilLearningProgressAccess\checkPermission(), ilObjectLP\getCollectionInstance(), ilLPTableBaseGUI\getCurrentFilter(), ilObjectLP\getCurrentMode(), ilLPStatusIcons\getInstance(), ilObjectLP\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, null, ilLPTableBaseGUI\searchObjects(), ilTable2GUI\setData(), ilTableGUI\setMaxCount(), and ilUtil\stripSlashes().

Referenced by __construct().

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

References ilTableGUI\$data, ilTable2GUI\$id, ilTableGUI\$limit, and ILIAS\Repository\lng().

Referenced by getItems().

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

References ilTableGUI\$data, and ilTable2GUI\$id.

Referenced by getItems().

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

◆ getSelCountryCodes()

ilTrSummaryTableGUI::getSelCountryCodes ( )

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

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

Referenced by getItems(), and initFilter().

448  : array
449  {
450  $options = array();
451  foreach (ilCountry::getCountryCodes() as $c) {
452  $options[$c] = $this->lng->txt("meta_c_" . $c);
453  }
454  asort($options);
455  return $options;
456  }
$c
Definition: deliver.php:25
static getCountryCodes()
Get country codes (DIN EN 3166-1)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilTrSummaryTableGUI::getSelectableColumns ( )

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

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(), fillHeaderCSV(), and fillHeaderExcel().

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", "sel_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  }
isPercentageAvailable(int $a_obj_id)
$txt
Definition: error.php:31
static supportsSpentSeconds(string $obj_type)
static supportsMark(string $obj_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilTrSummaryTableGUI::initFilter ( )

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

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, getSelCountryCodes(), 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().

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  if ($this->setting->get("usr_settings_course_export_country")) {
390  $item = $this->addFilterItemByMetaType(
391  "country",
393  true
394  );
395  $this->filter["country"] = $item->getValue();
396  }
397 
398  if ($this->setting->get("usr_settings_course_export_sel_country")) {
399  $item = $this->addFilterItemByMetaType(
400  "sel_country",
402  true
403  );
404  $item->setOptions(
405  array("" => $this->lng->txt(
406  "trac_all"
407  )
408  ) + $this->getSelCountryCodes()
409  );
410  $this->filter["sel_country"] = $item->getValue();
411  }
412 
413  $item = $this->addFilterItemByMetaType(
414  "language",
416  true
417  );
418  $this->filter["language"] = $item->getValue();
419 
420  if ($tracking->hasExtendedData(
422  )) {
423  $item = $this->addFilterItemByMetaType(
424  "first_access_min",
426  true,
427  $this->lng->txt("trac_first_access")
428  );
429  $this->filter["first_access"] = $item->getDate();
430 
431  $item = $this->addFilterItemByMetaType(
432  "last_access_max",
434  true,
435  $this->lng->txt("trac_last_access")
436  );
437  $this->filter["last_access"] = $item->getDate();
438  }
439 
440  $item = $this->addFilterItemByMetaType(
441  "registration_filter",
443  true
444  );
445  $this->filter["registration"] = $item->getDate();
446  }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS_NUM
const FILTER_NUMBER_RANGE
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 LP_STATUS_FAILED
const FILTER_DATETIME_RANGE
isPercentageAvailable(int $a_obj_id)
const FILTER_DURATION_RANGE
const LP_STATUS_NOT_ATTEMPTED_NUM
static supportsSpentSeconds(string $obj_type)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static supportsMark(string $obj_type)
const LP_STATUS_COMPLETED
const LP_STATUS_FAILED_NUM
+ 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 959 of file class.ilTrSummaryTableGUI.php.

Referenced by fillHeaderCSV(), fillHeaderExcel(), fillRowCSV(), and fillRowExcel().

959  : bool
960  {
961  if (in_array(
962  $a_name,
963  array("country",
964  "gender",
965  "city",
966  "language",
967  "status",
968  "mark",
969  'sel_country'
970  )
971  )) {
972  return true;
973  }
974  return false;
975  }
+ Here is the caller graph for this function:

◆ isStatusShown()

ilTrSummaryTableGUI::isStatusShown ( )

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

References ilTable2GUI\getSelectedColumns().

992  : bool
993  {
994  return in_array('status', $this->getSelectedColumns());
995  }
+ Here is the call graph for this function:

◆ numericOrdering()

ilTrSummaryTableGUI::numericOrdering ( string  $a_field)

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

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

◆ parseValue()

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

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

References ilDatePresentation\formatDate(), IL_CAL_DATETIME, IL_CAL_UNIX, ILIAS\Repository\lng(), ilDatePresentation\secondsToString(), ilObjectLP\supportsMark(), and ilObjectLP\supportsSpentSeconds().

Referenced by fillRow(), fillRowCSV(), and fillRowExcel().

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

◆ renderPercentages()

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

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

Referenced by fillRow().

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

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.

◆ $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.

Referenced by fillRow().

◆ $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: