ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTrSummaryTableGUI Class Reference

name table More...

+ Inheritance diagram for ilTrSummaryTableGUI:
+ Collaboration diagram for ilTrSummaryTableGUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_print_mode=false)
 Constructor. More...
 
 getSelectableColumns ()
 
 initFilter ()
 Init filter. More...
 
 getSelCountryCodes ()
 
 getItems ($a_object_id, $a_ref_id)
 Build summary item rows for given object and filter(s. More...
 
 numericOrdering ($a_field)
 
- Public Member Functions inherited from ilLPTableBaseGUI
 __construct ($a_parent_obj, $a_parent_cmd="", $a_template_context="")
 
 executeCommand ()
 
 searchFilterListener ($a_ref_id, $a_data)
 Listener for SearchResultFilter Checks wheather the object is hidden and mode is not LP_MODE_DEACTIVATED public. More...
 
 initBaseFilter ($a_split_learning_resources=false, $a_include_no_status_filter=true)
 Init filter. More...
 
 getCurrentFilter ($as_query=false)
 
- Public Member Functions inherited from ilTable2GUI
 __construct ($a_parent_obj, $a_parent_cmd="", $a_template_context="")
 ilTable2GUI constructor. More...
 
 setOpenFormTag ($a_val)
 Set open form tag. More...
 
 getOpenFormTag ()
 Get open form tag. More...
 
 setCloseFormTag ($a_val)
 Set close form tag. More...
 
 getCloseFormTag ()
 Get close form tag. More...
 
 determineLimit ()
 Determine the limit. More...
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 determineSelectedColumns ()
 Determine selected columns. More...
 
 isColumnSelected ($a_col)
 Is given column selected? More...
 
 getSelectedColumns ()
 Get selected columns. More...
 
 executeCommand ()
 Execute command. More...
 
 resetOffset ($a_in_determination=false)
 Reset offset. More...
 
 initFilter ()
 Init filter. More...
 
 getParentObject ()
 Get parent object. More...
 
 getParentCmd ()
 Get parent command. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setNoEntriesText ($a_text)
 Set text for an empty table. More...
 
 getNoEntriesText ()
 Get text for an empty table. More...
 
 setIsDataTable ($a_val)
 Set is data table. More...
 
 getIsDataTable ()
 Get is data table. More...
 
 setEnableTitle ($a_enabletitle)
 Set Enable Title. More...
 
 getEnableTitle ()
 Get Enable Title. More...
 
 setEnableHeader ($a_enableheader)
 Set Enable Header. More...
 
 getEnableHeader ()
 Get Enable Header. More...
 
 setEnableNumInfo ($a_val)
 Set enable num info. More...
 
 getEnableNumInfo ()
 Get enable num info. More...
 
 setTitle ($a_title, $a_icon=0, $a_icon_alt=0)
 Set title and title icon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setOrderField ($a_order_field)
 set order column More...
 
 getOrderField ()
 
 setData ($a_data)
 
 getData ()
 
 dataExists ()
 
 setPrefix ($a_prefix)
 
 getPrefix ()
 
 addFilterItem ($a_input_item, $a_optional=false)
 Add filter item. More...
 
 addFilterItemByMetaType ($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
 Add filter by standard type. More...
 
 getFilterItems ($a_optionals=false)
 Get filter items. More...
 
 getFilterItemByPostVar ($a_post_var)
 
 setFilterCols ($a_val)
 Set filter columns. More...
 
 getFilterCols ()
 Get filter columns. More...
 
 setDisableFilterHiding ($a_val=true)
 Set disable filter hiding. More...
 
 getDisableFilterHiding ()
 Get disable filter hiding. More...
 
 isFilterSelected ($a_col)
 Is given filter selected? More...
 
 getSelectedFilters ()
 Get selected filters. More...
 
 determineSelectedFilters ()
 Determine selected filters. More...
 
 setCustomPreviousNext ($a_prev_link, $a_next_link)
 Set custom previous/next links. More...
 
 setFormAction ($a_form_action, $a_multipart=false)
 Set Form action parameter. More...
 
 getFormAction ()
 Get Form action parameter. More...
 
 setFormName ($a_formname="")
 Set Form name. More...
 
 getFormName ()
 Get Form name. More...
 
 setId ($a_val)
 Set id. More...
 
 getId ()
 Get element id. More...
 
 setDisplayAsBlock ($a_val)
 Set display as block. More...
 
 getDisplayAsBlock ()
 Get display as block. More...
 
 getSelectAllCheckbox ()
 Get the name of the checkbox that should be toggled with a select all button. More...
 
 setSelectAllCheckbox ($a_select_all_checkbox, $a_select_all_on_top=false)
 Set the name of the checkbox that should be toggled with a select all button. More...
 
 setExternalSorting ($a_val)
 Set external sorting. More...
 
 getExternalSorting ()
 Get external sorting. More...
 
 setFilterCommand ($a_val, $a_caption=null)
 Set filter command. More...
 
 getFilterCommand ()
 Get filter command. More...
 
 setResetCommand ($a_val, $a_caption=null)
 Set reset filter command. More...
 
 getResetCommand ()
 Get reset filter command. More...
 
 setExternalSegmentation ($a_val)
 Set external segmentation. More...
 
 getExternalSegmentation ()
 Get external segmentation. More...
 
 setRowTemplate ($a_template, $a_template_dir="")
 Set row template. More...
 
 setDefaultOrderField ($a_defaultorderfield)
 Set Default order field. More...
 
 getDefaultOrderField ()
 Get Default order field. More...
 
 setDefaultOrderDirection ($a_defaultorderdirection)
 Set Default order direction. More...
 
 getDefaultOrderDirection ()
 Get Default order direction. More...
 
 setDefaultFilterVisiblity ($a_status)
 Set default filter visiblity. More...
 
 getDefaultFilterVisibility ()
 Get default filter visibility. More...
 
 clearCommandButtons ()
 
 addCommandButton ($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
 Add Command button. More...
 
 addCommandButtonInstance (ilButtonBase $a_button)
 Add Command button instance. More...
 
 addSelectionButton ($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
 Add Selection List + Command button. More...
 
 addMultiItemSelectionButton ($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
 Add Selection List + Command button for selected items. More...
 
 setCloseCommand ($a_link)
 Add command for closing table. More...
 
 addMultiCommand ($a_cmd, $a_text)
 Add Command button. More...
 
 addHiddenInput ($a_name, $a_value)
 Add Hidden Input field. More...
 
 addHeaderCommand ($a_href, $a_text, $a_target="", $a_img="")
 Add Header Command (Link) (Image needed for now) More...
 
 setTopCommands ($a_val)
 Set top commands (display command buttons on top of table, too) More...
 
 getTopCommands ()
 Get top commands (display command buttons on top of table, too) More...
 
 addColumn ( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
 Add a column to the header. More...
 
 getNavParameter ()
 
 setOrderLink ($sort_field, $order_dir)
 
 fillHeader ()
 
 determineOffsetAndOrder ($a_omit_offset=false)
 Determine offset and order. More...
 
 storeNavParameter ()
 
 getHTML ()
 Get HTML. More...
 
 numericOrdering ($a_field)
 Should this field be sorted numeric? More...
 
 render ()
 render table public More...
 
 writeFilterToSession ()
 Write filter values to session. More...
 
 resetFilter ()
 Reset filter. More...
 
 fillFooter ()
 Fill footer row. More...
 
 getLinkbar ($a_num)
 Get previous/next linkbar. More...
 
 fillHiddenRow ()
 
 fillActionRow ()
 Fill Action Row. More...
 
 setHeaderHTML ($html)
 set header html More...
 
 storeProperty ($type, $value)
 Store table property. More...
 
 loadProperty ($type)
 Load table property. More...
 
 getCurrentState ()
 get current settings for order, limit, columns and filter More...
 
 setContext ($id)
 Set context. More...
 
 getContext ()
 Get context. More...
 
 setShowRowsSelector ($a_value)
 Toggle rows-per-page selector. More...
 
 getShowRowsSelector ()
 Get rows-per-page selector state. More...
 
 setShowTemplates ($a_value)
 Toggle templates. More...
 
 getShowTemplates ()
 Get template state. More...
 
 restoreTemplate ($a_name)
 Restore state from template. More...
 
 saveTemplate ($a_name)
 Save current state as template. More...
 
 deleteTemplate ($a_name)
 Delete template. More...
 
 getLimit ()
 Get limit. More...
 
 getOffset ()
 Get offset. More...
 
 setExportFormats (array $formats)
 Set available export formats. More...
 
 setPrintMode ($a_value=false)
 Toogle print mode. More...
 
 getPrintMode ()
 Get print mode. More...
 
 getExportMode ()
 Was export activated? More...
 
 exportData ($format, $send=false)
 Export and optionally send current table data. More...
 
 setEnableAllCommand ($a_value)
 Enable actions for all entries in current result. More...
 
 setRowSelectorLabel ($row_selector_label)
 
 getRowSelectorLabel ()
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 setLimit ($a_limit=0, $a_default_limit=0)
 
- Public Member Functions inherited from ilTableGUI
 __construct ($a_data=0, $a_global_tpl=true)
 Constructor. More...
 
 setTemplate ($a_tpl)
 set template public More...
 
getTemplateObject ()
 
 setData ($a_data)
 set table data public More...
 
 getData ()
 
 setTitle ($a_title, $a_icon=0, $a_icon_alt=0)
 set table title public More...
 
 setHelp ($a_help_page, $a_help_icon, $a_help_icon_alt=0)
 set table help page public More...
 
 setHeaderNames ($a_header_names)
 set table header names public More...
 
 getColumnCount ()
 Returns the column count based on the number of the header row columns public. More...
 
 setHeaderVars ($a_header_vars, $a_header_params=0)
 set table header vars public More...
 
 setColumnWidth ($a_column_width)
 set table column widths public More...
 
 setOneColumnWidth ($a_column_width, $a_column_number)
 set one table column width public More...
 
 setMaxCount ($a_max_count)
 set max. More...
 
 setLimit ($a_limit=0, $a_default_limit=0)
 set max. More...
 
 getLimit ()
 Get limit. More...
 
 setPrefix ($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) public More...
 
 setOffset ($a_offset)
 set dataset offset public More...
 
 getOffset ()
 Get offset. More...
 
 setOrderColumn ($a_order_column=0, $a_default_column=0)
 set order column public More...
 
 getOrderColumn ()
 Get order column. More...
 
 setOrderDirection ($a_order_direction)
 set order direction public More...
 
 getOrderDirection ()
 Get order direction. More...
 
 setFooter ($a_style, $a_previous=0, $a_next=0)
 set order direction public More...
 
 enable ($a_module_name)
 enables particular modules of table More...
 
 disable ($a_module_name)
 diesables particular modules of table More...
 
 sortData ()
 
 render ()
 render table public More...
 
 renderHeader ()
 
 setOrderLink ($key, $order_dir)
 
 setStyle ($a_element, $a_style)
 
 getStyle ($a_element)
 
 setBase ($a_base)
 Set Base script name (deprecated, only use this for workarounds). More...
 
 getBase ()
 Get Base script name (deprecated, only use this for workarounds). More...
 
 getFormName ()
 
 setFormName ($a_name="cmd")
 
 getSelectAllCheckbox ()
 
 setSelectAllCheckbox ($a_select_all_checkbox)
 
 clearActionButtons ()
 
 addActionButton ($btn_name, $btn_value)
 

Protected Member Functions

 getItemsPercentages (array $data=null, $overall, array $value_map=null, $limit=3)
 Render data as needed for summary list (based on grouped values) More...
 
 getItemsPercentagesStatus (array $data=null, $overall, array $value_map=null)
 Render status data as needed for summary list (based on grouped values) More...
 
 parseValue ($id, $value, $type)
 
 fillRow ($a_set)
 Fill table row. More...
 
 renderPercentages ($id, $data)
 
 isArrayColumn ($a_name)
 
 fillHeaderExcel (ilExcel $a_excel, &$a_row)
 
 fillRowExcel (ilExcel $a_excel, &$a_row, $a_set)
 
 fillHeaderCSV ($a_csv)
 
 fillRowCSV ($a_csv, $a_set)
 
- Protected Member Functions inherited from ilLPTableBaseGUI
 sendMail (array $a_user_ids, $a_parent_obj, $a_parent_cmd)
 
 searchObjects (array $filter, $permission, array $preset_obj_ids=null, $a_check_lp_activation=true)
 Search objects that match current filters. More...
 
 buildPath ($ref_ids)
 Build path with deep-link. More...
 
 getPossibleTypes ($a_split_learning_resources=false, $a_include_digilib=false, $a_allow_undefined_lp=false)
 Get possible subtypes. More...
 
 parseValue ($id, $value, $type)
 
 isPercentageAvailable ($a_obj_id)
 
 parseTitle ($a_obj_id, $action, $a_user_id=false)
 
 getExportMeta ()
 Build export meta data. More...
 
 fillMetaExcel (ilExcel $a_excel, &$a_row)
 
 fillMetaCSV ($a_csv)
 
 showTimingsWarning ($a_ref_id, $a_user_id)
 
 formatSeconds ($seconds, $a_shorten_zero=false)
 
 anonymizeValue ($a_value, $a_force_number=false)
 
 buildValueScale ($a_max_value, $a_anonymize=false, $a_format_seconds=false)
 
 getMonthsFilter ($a_short=false)
 
 getMonthsYear ($a_year=null, $a_short=false)
 
 getSelectableUserColumns ($a_in_course=false, $a_in_group=false)
 
 addToClipboard ()
 Add selected users to clipboard. More...
 
- Protected Member Functions inherited from ilTable2GUI
 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, $a_element)
 Check if filter element is based on adv md. More...
 
 fillRow ($a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilFormPropertyGUI $a_item)
 Get current filter value. More...
 
 SetFilterValue (ilFormPropertyGUI $a_item, $a_value)
 Set current filter value. More...
 
 fillMetaExcel (ilExcel $a_excel, &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel (ilExcel $a_excel, &$a_row)
 Excel Version of Fill Header. More...
 
 fillRowExcel (ilExcel $a_excel, &$a_row, $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV ($a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV ($a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV ($a_csv, $a_set)
 CSV Version of Fill Row. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTable2GUI
static getAllCommandLimit ()
 Get maximum number of entries to enable actions for all. More...
 
- 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
 $title
 
 $icon
 
 $icon_alt
 
 $help_page
 
 $help_icon
 
 $help_icon_alt
 
 $header_names
 
 $header_vars
 
 $linkbar_vars
 
 $data
 
 $column_count
 
 $column_width
 
 $max_count
 
 $limit
 
 $max_limit = false
 
 $offset
 
 $order_column
 
 $order_direction
 
 $footer_style
 
 $footer_previous
 
 $footer_next
 
 $lang_support = true
 
 $global_tpl
 
 $form_name
 
 $select_all_checkbox
 
 $action_buttons
 
 $prefix
 
 $base = ""
 
 $enabled
 
 $styles
 
- Protected Attributes inherited from ilLPTableBaseGUI
 $filter
 
 $anonymized
 
- Protected Attributes inherited from ilTable2GUI
 $ctrl
 
 $tpl
 
 $parent_obj
 
 $parent_cmd
 
 $close_command = ""
 
 $top_anchor = "il_table_top"
 
 $filters = array()
 
 $optional_filters = array()
 
 $filter_cmd = 'applyFilter'
 
 $reset_cmd = 'resetFilter'
 
 $filter_cols = 5
 
 $ext_sort = false
 
 $ext_seg = false
 
 $context = ""
 
 $mi_sel_buttons = []
 
 $disable_filter_hiding = false
 
 $selected_filter = false
 
 $top_commands = true
 
 $selectable_columns = array()
 
 $selected_column = array()
 
 $show_templates = false
 
 $show_rows_selector = true
 
 $rows_selector_off = false
 
 $nav_determined = false
 
 $limit_determined = false
 
 $filters_determined = false
 
 $columns_determined = false
 
 $open_form_tag = true
 
 $close_form_tag = true
 
 $export_formats = []
 
 $export_mode
 
 $print_mode
 
 $enable_command_for_all
 
 $restore_filter
 
 $restore_filter_values
 
 $default_filter_visibility = false
 
 $sortable_fields = array()
 
 $prevent_double_submission = true
 
 $row_selector_label
 
 $select_all_on_top = false
 
 $sel_buttons = []
 
- Protected Attributes inherited from ilTableGUI
 $tpl
 
 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTrSummaryTableGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
  $a_ref_id,
  $a_print_mode = false 
)

Constructor.

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

References $c, $DIC, $ilCtrl, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), ilTable2GUI\addColumn(), ilObjectLP\getInstance(), getItems(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), initFilter(), ilLPTableBaseGUI\parseTitle(), ilTable2GUI\setDefaultOrderField(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setExportFormats(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTable2GUI\setLimit(), ilTable2GUI\setPrintMode(), ilTable2GUI\setRowTemplate(), and ilTable2GUI\setShowTemplates().

21  {
22  global $DIC;
23 
24  $ilCtrl = $DIC['ilCtrl'];
25  $objDefinition = $DIC['objDefinition'];
26 
27  $this->setId("trsmy");
28 
29  $this->ref_id = $a_ref_id;
30  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
31  $this->is_root = ($a_ref_id == ROOT_FOLDER_ID);
32 
33  if (!$this->is_root) {
34  // #17084 - are we multi-object or not?
35  // we cannot parse type filter (too complicated)
36  $type = ilObject::_lookupType($this->obj_id);
37  if (!$objDefinition->isContainer($type)) {
38  $this->type = $type;
39  include_once './Services/Object/classes/class.ilObjectLP.php';
40  $this->olp = ilObjectLP::getInstance($this->obj_id);
41  }
42  }
43 
44  parent::__construct($a_parent_obj, $a_parent_cmd);
45 
46  if ($a_print_mode) {
47  $this->setPrintMode(true);
48  }
49 
50  $this->parseTitle($this->obj_id, "trac_summary");
51  $this->setLimit(9999);
52  $this->setShowTemplates(true);
53  $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
54 
55  $this->addColumn($this->lng->txt("title"), "title");
56  $this->setDefaultOrderField("title");
57 
58  $labels = $this->getSelectableColumns();
59  foreach ($this->getSelectedColumns() as $c) {
60  $this->addColumn($labels[$c]["txt"], $c);
61  }
62 
63  if ($this->is_root) {
64  $this->addColumn($this->lng->txt("path"));
65  $this->addColumn($this->lng->txt("action"));
66  }
67 
68 
69  // $this->setExternalSorting(true);
70  $this->setEnableHeader(true);
71  $this->setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
72  $this->setRowTemplate("tpl.trac_summary_row.html", "Services/Tracking");
73  $this->initFilter();
74 
75  $this->getItems($a_parent_obj->getObjId(), $a_ref_id);
76  }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
$type
global $DIC
Definition: saml.php:7
setPrintMode($a_value=false)
Toogle print mode.
setShowTemplates($a_value)
Toggle templates.
parseTitle($a_obj_id, $action, $a_user_id=false)
getItems($a_object_id, $a_ref_id)
Build summary item rows for given object and filter(s.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
getSelectedColumns()
Get selected columns.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
static getInstance($a_obj_id)
setLimit($a_limit=0, $a_default_limit=0)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillHeaderCSV()

ilTrSummaryTableGUI::fillHeaderCSV (   $a_csv)
protected

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

References $c, $text, ilLearningProgressBaseGUI\_getStatusText(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), isArrayColumn(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

837  {
838  $a_csv->addColumn($this->lng->txt("title"));
839 
840  $labels = $this->getSelectableColumns();
841  foreach ($this->getSelectedColumns() as $c) {
842  $label = $labels[$c]["txt"];
843  $label = str_replace("Ø", $this->lng->txt("trac_average"), $label);
844  $label = str_replace("∑", $this->lng->txt("trac_sum"), $label);
845 
846  if (!$this->isArrayColumn($c)) {
847  $a_csv->addColumn($label);
848  } else {
849  if ($c != "status") {
850  $a_csv->addColumn($label . " #1");
851  $a_csv->addColumn($label . " #1");
852  $a_csv->addColumn($label . " #1 %");
853  $a_csv->addColumn($label . " #2");
854  $a_csv->addColumn($label . " #2");
855  $a_csv->addColumn($label . " #2 %");
856  $a_csv->addColumn($label . " #3");
857  $a_csv->addColumn($label . " #3");
858  $a_csv->addColumn($label . " #3 %");
859  $a_csv->addColumn($label . " " . $this->lng->txt("trac_others"));
860  $a_csv->addColumn($label . " " . $this->lng->txt("trac_others"));
861  $a_csv->addColumn($label . " " . $this->lng->txt("trac_others") . " %");
862  } else {
863  // build status to image map
864  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
865  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
866  $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
870  foreach ($valid_status as $status) {
872  $a_csv->addColumn($text);
873  $a_csv->addColumn($text . " %");
874  }
875  }
876  }
877  }
878 
879  $a_csv->addRow();
880  }
const LP_STATUS_COMPLETED_NUM
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
const LP_STATUS_IN_PROGRESS_NUM
$text
Definition: errorreport.php:18
getSelectedColumns()
Get selected columns.
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,
$a_row 
)
protected

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

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

753  {
754  $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
755 
756  $labels = $this->getSelectableColumns();
757  $cnt = 1;
758  foreach ($this->getSelectedColumns() as $c) {
759  $label = $labels[$c]["txt"];
760  $label = str_replace("Ø", $this->lng->txt("trac_average"), $label);
761  $label = str_replace("∑", $this->lng->txt("trac_sum"), $label);
762 
763  if (!$this->isArrayColumn($c)) {
764  $a_excel->setCell($a_row, $cnt, $label);
765  $cnt++;
766  } else {
767  if ($c != "status") {
768  $a_excel->setCell($a_row, $cnt, $label . " #1");
769  $a_excel->setCell($a_row, ++$cnt, $label . " #1");
770  $a_excel->setCell($a_row, ++$cnt, $label . " #1 %");
771  $a_excel->setCell($a_row, ++$cnt, $label . " #2");
772  $a_excel->setCell($a_row, ++$cnt, $label . " #2");
773  $a_excel->setCell($a_row, ++$cnt, $label . " #2 %");
774  $a_excel->setCell($a_row, ++$cnt, $label . " #3");
775  $a_excel->setCell($a_row, ++$cnt, $label . " #3");
776  $a_excel->setCell($a_row, ++$cnt, $label . " #3 %");
777  $a_excel->setCell($a_row, ++$cnt, $label . " " . $this->lng->txt("trac_others"));
778  $a_excel->setCell($a_row, ++$cnt, $label . " " . $this->lng->txt("trac_others"));
779  $a_excel->setCell($a_row, ++$cnt, $label . " " . $this->lng->txt("trac_others") . " %");
780  } else {
781  // build status to image map
782  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
783  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
784  $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
788  $cnt--;
789  foreach ($valid_status as $status) {
791  $a_excel->setCell($a_row, ++$cnt, $text);
792  $a_excel->setCell($a_row, ++$cnt, $text . " %");
793  }
794  }
795  $cnt++;
796  }
797  }
798 
799  $a_excel->setBold("A" . $a_row . ":" . $a_excel->getColumnCoord($cnt) . $a_row);
800  }
const LP_STATUS_COMPLETED_NUM
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
const LP_STATUS_IN_PROGRESS_NUM
getColumnCoord($a_col)
Get column "name" from number.
setBold($a_coords)
Set cell(s) to bold.
$text
Definition: errorreport.php:18
getSelectedColumns()
Get selected columns.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:

◆ fillRow()

ilTrSummaryTableGUI::fillRow (   $a_set)
protected

Fill table row.

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

References $c, $DIC, $ilCtrl, ilTableGUI\$lng, $path, ilLink\_getLink(), ilLPTableBaseGUI\buildPath(), ilTable2GUI\getSelectedColumns(), ilLPTableBaseGUI\isPercentageAvailable(), parseValue(), and renderPercentages().

628  {
629  global $DIC;
630 
631  $lng = $DIC['lng'];
632  $ilCtrl = $DIC['ilCtrl'];
633 
634  $this->tpl->setVariable("ICON", ilObject::_getIcon($a_set["obj_id"], "tiny", $a_set["type"]));
635  $this->tpl->setVariable("ICON_ALT", $lng->txt($a_set["type"]));
636  $this->tpl->setVariable("TITLE", $a_set["title"]);
637 
638  if ($a_set["offline"] || $a_set["privacy_conflict"]) {
639  $mess = array();
640  if ($a_set["offline"]) {
641  $mess[] = $lng->txt("offline");
642  }
643  if ($a_set["privacy_conflict"]) {
644  $mess[] = $lng->txt("status_no_permission");
645  }
646  $this->tpl->setCurrentBlock("status_bl");
647  $this->tpl->setVariable("TEXT_STATUS", implode(", ", $mess));
648  $this->tpl->parseCurrentBlock();
649  }
650 
651  foreach ($this->getSelectedColumns() as $c) {
652  switch ($c) {
653  case "country":
654  case "gender":
655  case "city":
656  case "language":
657  case "status":
658  case "mark":
659  case "sel_country":
660  $this->renderPercentages($c, $a_set[$c]);
661  break;
662 
663  case "percentage_avg":
664  if ((int) $a_set[$c] === 0 || !$this->isPercentageAvailable($a_set["obj_id"])) {
665  $this->tpl->setVariable(strtoupper($c), "");
666  break;
667  }
668 
669  // no break
670  default:
671  $value = $this->parseValue($c, $a_set[$c], $a_set["type"]);
672  $this->tpl->setVariable(strtoupper($c), $value);
673  break;
674  }
675  }
676 
677  if ($this->is_root) {
678  $path = $this->buildPath($a_set["ref_ids"], false, true);
679  if ($path) {
680  $this->tpl->setCurrentBlock("item_path");
681  foreach ($path as $ref_id => $path_item) {
682  $this->tpl->setVariable("PATH_ITEM", $path_item);
683 
684  if (!$this->anonymized) {
685  $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', $ref_id);
686  $this->tpl->setVariable("URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(), 'details'));
687  $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', '');
688  $this->tpl->setVariable("TXT_DETAILS", $lng->txt('trac_participants'));
689  } else {
690  $this->tpl->setVariable("URL_DETAILS", ilLink::_getLink($ref_id, $a_set["type"]));
691  $this->tpl->setVariable("TXT_DETAILS", $lng->txt('view'));
692  }
693 
694  $this->tpl->parseCurrentBlock();
695  }
696  }
697 
698  $this->tpl->setCurrentBlock("item_command");
699  $ilCtrl->setParameterByClass(get_class($this), 'hide', $a_set["obj_id"]);
700  $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this), 'hide'));
701  $this->tpl->setVariable("TXT_COMMAND", $this->lng->txt('trac_hide'));
702  $this->tpl->parseCurrentBlock();
703 
704  $this->tpl->touchBlock("path_action");
705  } elseif ($a_set["ref_ids"]) { // #18446
706  // #16453
707  include_once './Services/Tree/classes/class.ilPathGUI.php';
708  $path = new ilPathGUI();
709  $path = $path->getPath($this->ref_id, array_pop($a_set["ref_ids"]));
710  if ($path) {
711  $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path);
712  }
713  }
714  }
Creates a path for a start and endnode.
buildPath($ref_ids)
Build path with deep-link.
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
parseValue($id, $value, $type)
getSelectedColumns()
Get selected columns.
+ Here is the call graph for this function:

◆ fillRowCSV()

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

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

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

883  {
884  $a_csv->addColumn($a_set["title"]);
885 
886  foreach ($this->getSelectedColumns() as $c) {
887  if (!$this->isArrayColumn($c)) {
888  $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
889  $a_csv->addColumn($val);
890  } else {
891  foreach ((array) $a_set[$c] as $idx => $value) {
892  if ($c != "status") {
893  $a_csv->addColumn($value["caption"]);
894  }
895  $a_csv->addColumn((int) $value["absolute"]);
896  $a_csv->addColumn($value["percentage"]);
897  }
898  if (sizeof($a_set[$c]) < 4 && $c != "status") {
899  for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
900  $a_csv->addColumn("");
901  $a_csv->addColumn("");
902  $a_csv->addColumn("");
903  }
904  }
905  }
906  }
907 
908  $a_csv->addRow();
909  }
parseValue($id, $value, $type)
getSelectedColumns()
Get selected columns.
+ Here is the call graph for this function:

◆ fillRowExcel()

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

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

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

803  {
804  $a_excel->setCell($a_row, 0, $a_set["title"]);
805 
806  $cnt = 1;
807  foreach ($this->getSelectedColumns() as $c) {
808  if (!$this->isArrayColumn($c)) {
809  $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
810  $a_excel->setCell($a_row, $cnt, $val);
811  $cnt++;
812  } else {
813  foreach ((array) $a_set[$c] as $idx => $value) {
814  if ($c == "status") {
815  $a_excel->setCell($a_row, $cnt, (int) $value["absolute"]);
816  $a_excel->setCell($a_row, ++$cnt, $value["percentage"] . "%");
817  } else {
818  $a_excel->setCell($a_row, $cnt, $value["caption"]);
819  $a_excel->setCell($a_row, ++$cnt, (int) $value["absolute"]);
820  $a_excel->setCell($a_row, ++$cnt, $value["percentage"] . "%");
821  }
822  $cnt++;
823  }
824  if (sizeof($a_set[$c]) < 4 && $c != "status") {
825  for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
826  $a_excel->setCell($a_row, $cnt, "");
827  $a_excel->setCell($a_row, ++$cnt, "");
828  $a_excel->setCell($a_row, ++$cnt, "");
829  $cnt++;
830  }
831  }
832  }
833  }
834  }
parseValue($id, $value, $type)
getSelectedColumns()
Get selected columns.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
+ Here is the call graph for this function:

◆ getItems()

ilTrSummaryTableGUI::getItems (   $a_object_id,
  $a_ref_id 
)

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

Parameters
int$a_object_id
int$a_ref_id

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

References ilTableGUI\$data, $DIC, ilLPTableBaseGUI\$filter, $languages, ilTableGUI\$lng, $path, $result, $rows, $sess, $text, $valid, ilLearningProgressBaseGUI\_getImagePathForStatus(), ilLearningProgressBaseGUI\_getStatusText(), ilObject\_lookupObjId(), ilLearningProgressAccess\checkPermission(), ilLPTableBaseGUI\getCurrentFilter(), ilObjectLP\getInstance(), getItemsPercentages(), getItemsPercentagesStatus(), ilTable2GUI\getLimit(), ilTrQuery\getObjectsSummaryForObject(), ilTable2GUI\getOffset(), ilTableGUI\getOrderDirection(), ilTable2GUI\getOrderField(), getSelCountryCodes(), ilTable2GUI\getSelectedColumns(), ilUtil\img(), ilLearningProgressBaseGUI\isObjectOffline(), ilLPTableBaseGUI\isPercentageAvailable(), 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().

333  {
334  global $DIC;
335 
336  $lng = $DIC['lng'];
337  $rbacsystem = $DIC['rbacsystem'];
338 
339  include_once("./Services/Tracking/classes/class.ilTrQuery.php");
340 
341  // show only selected subobjects for lp mode
342  $preselected_obj_ids = $filter = null;
343 
345  if (
346  $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL ||
347  $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION ||
348  $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR
349  ) {
350  $collection = $olp->getCollectionInstance();
351  $preselected_obj_ids[$a_object_id][] = $a_ref_id;
352  foreach ($collection->getItems() as $item => $item_info) {
353  $tmp_lp = ilObjectLP::getInstance(ilObject::_lookupObjId($item_info));
354  if ($tmp_lp->isActive()) {
355  $preselected_obj_ids[ilObject::_lookupObjId($item_info)][] = $item_info;
356  }
357  }
358  $filter = $this->getCurrentFilter();
359  } elseif ($this->is_root) {
360  // using search to get all relevant objects
361  // #8498/#8499: restrict to objects with at least "read_learning_progress" access
362  $preselected_obj_ids = $this->searchObjects($this->getCurrentFilter(true), "read_learning_progress");
363  } else {
364  // using summary filters
365  $filter = $this->getCurrentFilter();
366  }
367 
368 
369 
371  $a_object_id,
372  $a_ref_id,
376  ilUtil::stripSlashes($this->getLimit()),
377  $filter,
378  $this->getSelectedColumns(),
379  $preselected_obj_ids
380  );
381 
382  // build status to image map
383  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
384  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
385  $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
389  $status_map = array();
390  foreach ($valid_status as $status) {
393  $status_map[$status] = ilUtil::img($path, $text);
394  }
395 
396  // language map
397  $lng->loadLanguageModule("meta");
398  $languages = array();
399  foreach ($lng->getInstalledLanguages() as $lang_key) {
400  $languages[$lang_key] = $lng->txt("meta_l_" . $lang_key);
401  }
402 
403  $rows = array();
404  foreach ($data["set"] as $idx => $result) {
405  // sessions have no title
406  if ($result["title"] == "" && $result["type"] == "sess") {
407  include_once "Modules/Session/classes/class.ilObjSession.php";
408  $sess = new ilObjSession($result["obj_id"], false);
409  $data["set"][$idx]["title"] = $sess->getFirstAppointment()->appointmentToString();
410  }
411 
412  $data["set"][$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline($result["obj_id"], $result["type"]);
413 
414  // #13807
415  if ($result["ref_ids"]) {
416  $valid = false;
417  foreach ($result["ref_ids"] as $check_ref_id) {
418  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
419  if (ilLearningProgressAccess::checkPermission('read_learning_progress', $check_ref_id)) {
420  $valid = true;
421  break;
422  }
423  }
424  if (!$valid) {
425  foreach (array_keys($data["set"][$idx]) as $col_id) {
426  if (!in_array($col_id, array("type", "title", "obj_id", "ref_id", "offline"))) {
427  $data["set"][$idx][$col_id] = null;
428  }
429  }
430  $data["set"][$idx]["privacy_conflict"] = true;
431  continue;
432  }
433  }
434 
435  // percentages
436  $users_no = $result["user_total"];
437  $data["set"][$idx]["country"] = $this->getItemsPercentages($result["country"], $users_no);
438  $data["set"][$idx]["gender"] = $this->getItemsPercentages($result["gender"], $users_no, array(
439  "n" => $lng->txt("gender_n"),
440  "m" => $lng->txt("gender_m"),
441  "f" => $lng->txt("gender_f"),
442  ));
443  $data["set"][$idx]["city"] = $this->getItemsPercentages($result["city"], $users_no);
444  $data["set"][$idx]["sel_country"] = $this->getItemsPercentages($result["sel_country"], $users_no, $this->getSelCountryCodes());
445  $data["set"][$idx]["mark"] = $this->getItemsPercentages($result["mark"], $users_no);
446  $data["set"][$idx]["language"] = $this->getItemsPercentages($result["language"], $users_no, $languages);
447 
448  // if we encounter any invalid status codes, e.g. null, map them to not attempted instead
449  foreach ($result["status"] as $status_code => $status_counter) {
450  // null is cast to ""
451  if ($status_code === "" || !in_array($status_code, $valid_status)) {
452  $result["status"][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] += $status_counter;
453  unset($result["status"][$status_code]);
454  }
455  }
456  $data["set"][$idx]["status"] = $this->getItemsPercentagesStatus($result["status"], $users_no, $status_map);
457 
458  if (!$this->isPercentageAvailable($result["obj_id"])) {
459  $data["set"][$idx]["percentage_avg"] = null;
460  }
461  }
462 
463  $this->setMaxCount($data["cnt"]);
464  $this->setData($data["set"]);
465  }
const LP_STATUS_COMPLETED_NUM
$path
Definition: aliased.php:25
$result
static _getImagePathForStatus($a_status)
Get image path for status.
global $DIC
Definition: saml.php:7
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
$valid
getItemsPercentages(array $data=null, $overall, array $value_map=null, $limit=3)
Render data as needed for summary list (based on grouped values)
searchObjects(array $filter, $permission, array $preset_obj_ids=null, $a_check_lp_activation=true)
Search objects that match current filters.
const LP_STATUS_IN_PROGRESS_NUM
getOrderDirection()
Get order direction.
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
getOffset()
Get offset.
static isObjectOffline($a_obj_id, $a_type=null)
static _lookupObjId($a_id)
$text
Definition: errorreport.php:18
getSelectedColumns()
Get selected columns.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getObjectsSummaryForObject( $a_parent_obj_id, $a_parent_ref_id, $a_order_field="", $a_order_dir="", $a_offset=0, $a_limit=9999, array $a_filters=null, array $a_additional_fields=null, $a_preselected_obj_ids=null)
Get all aggregated tracking data for parent object.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$rows
Definition: xhr_table.php:10
const LP_STATUS_NOT_ATTEMPTED_NUM
getLimit()
Get limit.
$languages
Definition: cssgen2.php:34
setMaxCount($a_max_count)
set max.
getCurrentFilter($as_query=false)
static getInstance($a_obj_id)
getItemsPercentagesStatus(array $data=null, $overall, array $value_map=null)
Render status data as needed for summary list (based on grouped values)
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemsPercentages()

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

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

Parameters
array$datarows data
int$overalloverall number of entries
array$value_maplabels for values
int$limitsummarize all entries beyond limit
Returns
array

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

References ilTableGUI\$data, $DIC, $id, ilTableGUI\$limit, ilTableGUI\$lng, and $result.

Referenced by getItems().

477  {
478  global $DIC;
479 
480  $lng = $DIC['lng'];
481 
482  if (!$overall) {
483  return false;
484  }
485 
486  $result = array();
487 
488  if ($data) {
489  // if we have only 1 item more than the limit, "others" makes no sense
490  if (sizeof($data) == $limit + 1) {
491  $limit++;
492  }
493 
494  $counter = $others_counter = $others_sum = 0;
495  foreach ($data as $id => $count) {
496  $counter++;
497  if ($counter <= $limit) {
498  $caption = $id;
499 
500  if ($value_map && isset($value_map[$id])) {
501  $caption = $value_map[$id];
502  }
503 
504  if ($caption == "") {
505  $caption = $lng->txt("none");
506  }
507 
508  $perc = round($count / $overall * 100);
509  $result[] = array(
510  "caption" => $caption,
511  "absolute" => $count, // ." ".($count > 1 ? $lng->txt("users") : $lng->txt("user")),
512  "percentage" => $perc
513  );
514  } else {
515  $others_sum += $count;
516  $others_counter++;
517  }
518  }
519 
520  if ($others_counter) {
521  $perc = round($others_sum / $overall * 100);
522  $result[] = array(
523  "caption" => $others_counter . " " . $lng->txt("trac_others"),
524  "absolute" => $others_sum, // ." ".($others_sum > 1 ? $lng->txt("users") : $lng->txt("user")),
525  "percentage" => $perc
526  );
527  }
528  }
529 
530  return $result;
531  }
$result
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getItemsPercentagesStatus()

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

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

Parameters
array$datarows data
int$overalloverall number of entries
array$value_maplabels for values
Returns
array

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

References ilTableGUI\$data, $DIC, $id, ilTableGUI\$lng, and $result.

Referenced by getItems().

542  {
543  global $DIC;
544 
545  $lng = $DIC['lng'];
546 
547  $result = array();
548  foreach ($value_map as $id => $caption) {
549  $count = 0;
550  if (isset($data[$id])) {
551  $count = $data[$id];
552  }
553  $perc = round($count / $overall * 100);
554 
555  $result[] = array(
556  "caption" => $caption,
557  "absolute" => $count,
558  "percentage" => $perc
559  );
560  }
561 
562  return $result;
563  }
$result
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getSelCountryCodes()

ilTrSummaryTableGUI::getSelCountryCodes ( )

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

References $c, $DIC, ilTableGUI\$lng, PHPMailer\PHPMailer\$options, and ilCountry\getCountryCodes().

Referenced by getItems(), and initFilter().

312  {
313  global $DIC;
314 
315  $lng = $DIC['lng'];
316 
317  include_once("./Services/Utilities/classes/class.ilCountry.php");
318  $options = array();
319  foreach (ilCountry::getCountryCodes() as $c) {
320  $options[$c] = $lng->txt("meta_c_" . $c);
321  }
322  asort($options);
323  return $options;
324  }
global $DIC
Definition: saml.php:7
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 78 of file class.ilTrSummaryTableGUI.php.

References $columns, $default, $DIC, $ilSetting, $l, ilTableGUI\$lng, ilTableGUI\$prefix, $txt, ilObjUserTracking\EXTENDED_DATA_LAST_ACCESS, ilObjUserTracking\EXTENDED_DATA_READ_COUNT, ilObjUserTracking\EXTENDED_DATA_SPENT_SECONDS, ilLPTableBaseGUI\isPercentageAvailable(), ilObjectLP\supportsMark(), and ilObjectLP\supportsSpentSeconds().

Referenced by __construct(), fillHeaderCSV(), and fillHeaderExcel().

79  {
80  global $DIC;
81 
82  $lng = $DIC['lng'];
83  $ilSetting = $DIC['ilSetting'];
84 
85  $lng_map = array("user_total" => "users", "first_access_min" => "trac_first_access",
86  "last_access_max" => "trac_last_access", "mark" => "trac_mark", "status" => "trac_status",
87  'status_changed_max' => 'trac_status_changed',
88  "spent_seconds_avg" => "trac_spent_seconds", "percentage_avg" => "trac_percentage",
89  "read_count_sum" => "trac_read_count", "read_count_avg" => "trac_read_count",
90  "read_count_spent_seconds_avg" => "trac_read_count_spent_seconds"
91  );
92 
93 
94  $all = array("user_total");
95  $default = array();
96 
97  // show only if extended data was activated in lp settings
98  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
99  $tracking = new ilObjUserTracking();
100  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT)) {
101  $all[] = "read_count_sum";
102  $all[] = "read_count_avg";
103  $default[] = "read_count_sum";
104  }
105  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) {
106  if ($this->is_root || !$this->type || ilObjectLP::supportsSpentSeconds($this->type)) {
107  $all[] = "spent_seconds_avg";
108  $default[] = "spent_seconds_avg";
109  }
110  }
111  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT) &&
112  $tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) {
113  if ($this->is_root || !$this->type || ilObjectLP::supportsSpentSeconds($this->type)) {
114  $all[] = "read_count_spent_seconds_avg";
115  // $default[] = "read_count_spent_seconds_avg";
116  }
117  }
118 
119 
120  if ($this->is_root || !$this->type || $this->isPercentageAvailable($this->obj_id)) {
121  $all[] = "percentage_avg";
122  }
123 
124  if ($this->is_root || !$this->olp || $this->olp->isActive()) {
125  $all[] = "status";
126  $all[] = 'status_changed_max';
127  }
128 
129  if ($this->is_root || !$this->type || ilObjectLP::supportsMark($this->type)) {
130  $all[] = "mark";
131  }
132 
133  $privacy = array("gender", "city", "country", "sel_country");
134  foreach ($privacy as $field) {
135  if ($ilSetting->get("usr_settings_course_export_" . $field)) {
136  $all[] = $field;
137  }
138  }
139 
140  $all[] = "language";
141 
142  $default[] = "percentage_avg";
143  $default[] = "status";
144  $default[] = "mark";
145 
146  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) {
147  $all[] = "first_access_min";
148  $all[] = "last_access_max";
149  }
150 
151  $all[] = "create_date_min";
152  $all[] = "create_date_max";
153 
154  $columns = array();
155  foreach ($all as $column) {
156  $l = $column;
157 
158  $prefix = false;
159  if (substr($l, -3) == "avg") {
160  $prefix = "&#216; ";
161  } elseif (substr($l, -3) == "sum" || $l == "user_total") {
162  $prefix = "&#8721; ";
163  }
164 
165  if (isset($lng_map[$l])) {
166  $l = $lng_map[$l];
167  }
168 
169  $txt = $prefix . $lng->txt($l);
170 
171  if (in_array($column, array("read_count_avg", "spent_seconds_avg", "percentage_avg"))) {
172  $txt .= " / " . $lng->txt("user");
173  }
174 
175  $columns[$column] = array(
176  "txt" => $txt,
177  "default" => (in_array($column, $default) ? true :false)
178  );
179  }
180  return $columns;
181  }
global $DIC
Definition: saml.php:7
$txt
Definition: error.php:11
$default
Definition: build.php:20
static supportsMark($a_obj_type)
static supportsSpentSeconds($a_obj_type)
global $l
Definition: afr.php:30
global $ilSetting
Definition: privfeed.php:17
if(! $in) $columns
Definition: Utf8Test.php:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilTrSummaryTableGUI::initFilter ( )

Init filter.

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

References $DIC, $ilSetting, ilTableGUI\$lng, ilTable2GUI\addFilterItemByMetaType(), ilObjUserTracking\EXTENDED_DATA_LAST_ACCESS, ilObjUserTracking\EXTENDED_DATA_READ_COUNT, ilObjUserTracking\EXTENDED_DATA_SPENT_SECONDS, 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(), 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().

187  {
188  global $DIC;
189 
190  $lng = $DIC['lng'];
191  $ilSetting = $DIC['ilSetting'];
192 
193  if ($this->is_root) {
194  return parent::initBaseFilter(true, false);
195  }
196 
197  // show only if extended data was activated in lp settings
198  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
199  $tracking = new ilObjUserTracking();
200 
201  $item = $this->addFilterItemByMetaType(
202  "user_total",
204  true,
205  "&#8721; " . $lng->txt("users")
206  );
207  $this->filter["user_total"] = $item->getValue();
208 
209  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT)) {
210  $item = $this->addFilterItemByMetaType(
211  "read_count",
213  true,
214  "&#8721; " . $lng->txt("trac_read_count")
215  );
216  $this->filter["read_count"] = $item->getValue();
217  }
218 
219  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) {
220  if ($this->is_root || !$this->type || ilObjectLP::supportsSpentSeconds($this->type)) {
221  $item = $this->addFilterItemByMetaType(
222  "spent_seconds",
224  true,
225  "&#216; " . $lng->txt("trac_spent_seconds") . " / " . $lng->txt("user")
226  );
227  $this->filter["spent_seconds"]["from"] = $item->getCombinationItem("from")->getValueInSeconds();
228  $this->filter["spent_seconds"]["to"] = $item->getCombinationItem("to")->getValueInSeconds();
229  }
230  }
231 
232  if ($this->is_root || !$this->type || $this->isPercentageAvailable($this->obj_id)) {
233  $item = $this->addFilterItemByMetaType(
234  "percentage",
236  true,
237  "&#216; " . $lng->txt("trac_percentage") . " / " . $lng->txt("user")
238  );
239  $this->filter["percentage"] = $item->getValue();
240  }
241 
242  if ($this->is_root || !$this->olp || $this->olp->isActive()) {
243  include_once "Services/Tracking/classes/class.ilLPStatus.php";
244  $item = $this->addFilterItemByMetaType("status", ilTable2GUI::FILTER_SELECT, true);
245  $item->setOptions(array("" => $lng->txt("trac_all"),
250  $this->filter["status"] = $item->getValue();
251  if ($this->filter["status"]) {
252  $this->filter["status"]--;
253  }
254 
255  $item = $this->addFilterItemByMetaType("trac_status_changed", ilTable2GUI::FILTER_DATE_RANGE, true);
256  $this->filter["status_changed"] = $item->getDate();
257  }
258 
259  if ($this->is_root || !$this->type || ilObjectLP::supportsMark($this->type)) {
260  $item = $this->addFilterItemByMetaType(
261  "mark",
263  true,
264  $lng->txt("trac_mark")
265  );
266  $this->filter["mark"] = $item->getValue();
267  }
268 
269  if ($ilSetting->get("usr_settings_course_export_gender")) {
270  $item = $this->addFilterItemByMetaType("gender", ilTable2GUI::FILTER_SELECT, true);
271  $item->setOptions(array(
272  "" => $lng->txt("trac_all"),
273  "n" => $lng->txt("gender_n"),
274  "m" => $lng->txt("gender_m"),
275  "f" => $lng->txt("gender_f"),
276  ));
277  $this->filter["gender"] = $item->getValue();
278  }
279 
280  if ($ilSetting->get("usr_settings_course_export_city")) {
281  $item = $this->addFilterItemByMetaType("city", ilTable2GUI::FILTER_TEXT, true);
282  $this->filter["city"] = $item->getValue();
283  }
284 
285  if ($ilSetting->get("usr_settings_course_export_country")) {
286  $item = $this->addFilterItemByMetaType("country", ilTable2GUI::FILTER_TEXT, true);
287  $this->filter["country"] = $item->getValue();
288  }
289 
290  if ($ilSetting->get("usr_settings_course_export_sel_country")) {
291  $item = $this->addFilterItemByMetaType("sel_country", ilTable2GUI::FILTER_SELECT, true);
292  $item->setOptions(array("" => $lng->txt("trac_all")) + $this->getSelCountryCodes());
293  $this->filter["sel_country"] = $item->getValue();
294  }
295 
296  $item = $this->addFilterItemByMetaType("language", ilTable2GUI::FILTER_LANGUAGE, true);
297  $this->filter["language"] = $item->getValue();
298 
299  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) {
300  $item = $this->addFilterItemByMetaType("trac_first_access", ilTable2GUI::FILTER_DATETIME_RANGE, true);
301  $this->filter["first_access"] = $item->getDate();
302 
303  $item = $this->addFilterItemByMetaType("trac_last_access", ilTable2GUI::FILTER_DATETIME_RANGE, true);
304  $this->filter["last_access"] = $item->getDate();
305  }
306 
307  $item = $this->addFilterItemByMetaType("registration_filter", ilTable2GUI::FILTER_DATE_RANGE, true);
308  $this->filter["registration"] = $item->getDate();
309  }
const LP_STATUS_COMPLETED_NUM
global $DIC
Definition: saml.php:7
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS_NUM
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
const LP_STATUS_IN_PROGRESS
const LP_STATUS_FAILED
const FILTER_DATETIME_RANGE
const FILTER_DURATION_RANGE
static supportsMark($a_obj_type)
const LP_STATUS_NOT_ATTEMPTED_NUM
static supportsSpentSeconds($a_obj_type)
global $ilSetting
Definition: privfeed.php:17
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 (   $a_name)
protected

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

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

733  {
734  if (in_array($a_name, array("country", "gender", "city", "language", "status", "mark", 'sel_country'))) {
735  return true;
736  }
737  return false;
738  }
+ Here is the caller graph for this function:

◆ numericOrdering()

ilTrSummaryTableGUI::numericOrdering (   $a_field)

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

741  {
742  $pos = strrpos($a_field, "_");
743  if ($pos !== false) {
744  $function = strtoupper(substr($a_field, $pos + 1));
745  if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT", "TOTAL"))) {
746  return true;
747  }
748  }
749  return false;
750  }

◆ parseValue()

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

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

References $DIC, $id, ilTableGUI\$lng, $type, ilDatePresentation\formatDate(), IL_CAL_DATETIME, IL_CAL_UNIX, ilDatePresentation\secondsToString(), ilObjectLP\supportsMark(), and ilObjectLP\supportsSpentSeconds().

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

566  {
567  global $DIC;
568 
569  $lng = $DIC['lng'];
570 
571  // get rid of aggregation
572  $pos = strrpos($id, "_");
573  if ($pos !== false) {
574  $function = strtoupper(substr($id, $pos + 1));
575  if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT"))) {
576  $id = substr($id, 0, $pos);
577  }
578  }
579 
580  if (trim($value) == "") {
581  if ($id == "title") {
582  return "--" . $lng->txt("none") . "--";
583  }
584  return "";
585  }
586  switch ($id) {
587  case 'status_changed':
588  case "first_access":
589  case "create_date":
591  break;
592 
593  case "last_access":
595  break;
596 
597  case "spent_seconds":
598  case "read_count_spent_seconds":
600  $value = "-";
601  } else {
602  $value = ilDatePresentation::secondsToString($value, ($value < 3600 ? true : false)); // #14858
603  }
604  break;
605 
606  case "percentage":
607  if (false /* $this->isPercentageAvailable() */) {
608  $value = "-";
609  } else {
610  $value = $value . "%";
611  }
612  break;
613 
614  case "mark":
616  $value = "-";
617  }
618  break;
619  }
620 
621  return $value;
622  }
const IL_CAL_DATETIME
$type
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
Date and time handling
static supportsMark($a_obj_type)
static supportsSpentSeconds($a_obj_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderPercentages()

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

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

References ilTableGUI\$data, and $id.

Referenced by fillRow().

717  {
718  if ($data) {
719  foreach ($data as $item) {
720  $this->tpl->setCurrentBlock($id . "_row");
721  $this->tpl->setVariable("CAPTION", $item["caption"]);
722  $this->tpl->setVariable("ABSOLUTE", $item["absolute"]);
723  $this->tpl->setVariable("PERCENTAGE", $item["percentage"]);
724  $this->tpl->parseCurrentBlock();
725  }
726  } else {
727  $this->tpl->touchBlock($id);
728  ;
729  }
730  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

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