ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 isStatusShown ()
 
- 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)
 
 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 ($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...
 

Protected Attributes

 $dic
 
- Protected Attributes inherited from ilLPTableBaseGUI
 $filter
 
 $anonymized
 
 $icon_variant = ilLPStatusIcons::ICON_VARIANT_LONG
 
- 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
 

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

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

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

27  {
28  global $DIC;
29 
30  $ilCtrl = $DIC['ilCtrl'];
31  $objDefinition = $DIC['objDefinition'];
32 
33  $this->setId("trsmy");
34  $this->dic = $DIC;
35  $this->ref_id = $a_ref_id;
36  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
37  $this->is_root = ($a_ref_id == ROOT_FOLDER_ID);
38 
39  if (!$this->is_root) {
40  // #17084 - are we multi-object or not?
41  // we cannot parse type filter (too complicated)
42  $type = ilObject::_lookupType($this->obj_id);
43  if (!$objDefinition->isContainer($type)) {
44  $this->type = $type;
45  include_once './Services/Object/classes/class.ilObjectLP.php';
46  $this->olp = ilObjectLP::getInstance($this->obj_id);
47  }
48  }
49 
50  parent::__construct($a_parent_obj, $a_parent_cmd);
51 
52  if ($a_print_mode) {
53  $this->setPrintMode(true);
54  }
55 
56  $this->parseTitle($this->obj_id, "trac_summary");
57  $this->setLimit(9999);
58  $this->setShowTemplates(true);
59  $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
60 
61  $this->addColumn($this->lng->txt("title"), "title");
62  $this->setDefaultOrderField("title");
63 
64  $labels = $this->getSelectableColumns();
65  foreach ($this->getSelectedColumns() as $c) {
66  $this->addColumn($labels[$c]["txt"], $c);
67  }
68 
69  if ($this->is_root) {
70  $this->addColumn($this->lng->txt("path"));
71  $this->addColumn($this->lng->txt("action"));
72  }
73 
74 
75  // $this->setExternalSorting(true);
76  $this->setEnableHeader(true);
77  $this->setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
78  $this->setRowTemplate("tpl.trac_summary_row.html", "Services/Tracking");
79  $this->initFilter();
80 
81  $this->getItems($a_parent_obj->getObjId(), $a_ref_id);
82  }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
$c
Definition: cli.php:37
$type
setPrintMode($a_value=false)
Toogle print mode.
const ROOT_FOLDER_ID
Definition: constants.php:30
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.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
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.
__construct(Container $dic, ilPlugin $plugin)
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 855 of file class.ilTrSummaryTableGUI.php.

References $c, 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.

856  {
857  $a_csv->addColumn($this->lng->txt("title"));
858 
859  $labels = $this->getSelectableColumns();
860  foreach ($this->getSelectedColumns() as $c) {
861  $label = $labels[$c]["txt"];
862  $label = str_replace("Ø", $this->lng->txt("trac_average"), $label);
863  $label = str_replace("∑", $this->lng->txt("trac_sum"), $label);
864 
865  if (!$this->isArrayColumn($c)) {
866  $a_csv->addColumn($label);
867  } else {
868  if ($c != "status") {
869  $a_csv->addColumn($label . " #1");
870  $a_csv->addColumn($label . " #1");
871  $a_csv->addColumn($label . " #1 %");
872  $a_csv->addColumn($label . " #2");
873  $a_csv->addColumn($label . " #2");
874  $a_csv->addColumn($label . " #2 %");
875  $a_csv->addColumn($label . " #3");
876  $a_csv->addColumn($label . " #3");
877  $a_csv->addColumn($label . " #3 %");
878  $a_csv->addColumn($label . " " . $this->lng->txt("trac_others"));
879  $a_csv->addColumn($label . " " . $this->lng->txt("trac_others"));
880  $a_csv->addColumn($label . " " . $this->lng->txt("trac_others") . " %");
881  } else {
882  // build status to image map
883  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
884  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
885  $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
889  foreach ($valid_status as $status) {
891  $a_csv->addColumn($text);
892  $a_csv->addColumn($text . " %");
893  }
894  }
895  }
896  }
897 
898  $a_csv->addRow();
899  }
const LP_STATUS_COMPLETED_NUM
$c
Definition: cli.php:37
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
const LP_STATUS_IN_PROGRESS_NUM
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 771 of file class.ilTrSummaryTableGUI.php.

References $c, 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().

772  {
773  $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
774 
775  $labels = $this->getSelectableColumns();
776  $cnt = 1;
777  foreach ($this->getSelectedColumns() as $c) {
778  $label = $labels[$c]["txt"];
779  $label = str_replace("Ø", $this->lng->txt("trac_average"), $label);
780  $label = str_replace("∑", $this->lng->txt("trac_sum"), $label);
781 
782  if (!$this->isArrayColumn($c)) {
783  $a_excel->setCell($a_row, $cnt, $label);
784  $cnt++;
785  } else {
786  if ($c != "status") {
787  $a_excel->setCell($a_row, $cnt, $label . " #1");
788  $a_excel->setCell($a_row, ++$cnt, $label . " #1");
789  $a_excel->setCell($a_row, ++$cnt, $label . " #1 %");
790  $a_excel->setCell($a_row, ++$cnt, $label . " #2");
791  $a_excel->setCell($a_row, ++$cnt, $label . " #2");
792  $a_excel->setCell($a_row, ++$cnt, $label . " #2 %");
793  $a_excel->setCell($a_row, ++$cnt, $label . " #3");
794  $a_excel->setCell($a_row, ++$cnt, $label . " #3");
795  $a_excel->setCell($a_row, ++$cnt, $label . " #3 %");
796  $a_excel->setCell($a_row, ++$cnt, $label . " " . $this->lng->txt("trac_others"));
797  $a_excel->setCell($a_row, ++$cnt, $label . " " . $this->lng->txt("trac_others"));
798  $a_excel->setCell($a_row, ++$cnt, $label . " " . $this->lng->txt("trac_others") . " %");
799  } else {
800  // build status to image map
801  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
802  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
803  $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
807  $cnt--;
808  foreach ($valid_status as $status) {
810  $a_excel->setCell($a_row, ++$cnt, $text);
811  $a_excel->setCell($a_row, ++$cnt, $text . " %");
812  }
813  }
814  $cnt++;
815  }
816  }
817 
818  $a_excel->setBold("A" . $a_row . ":" . $a_excel->getColumnCoord($cnt) . $a_row);
819  }
const LP_STATUS_COMPLETED_NUM
$c
Definition: cli.php:37
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.
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 641 of file class.ilTrSummaryTableGUI.php.

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

642  {
643  global $DIC;
644 
645  $lng = $DIC['lng'];
646  $ilCtrl = $DIC['ilCtrl'];
647 
648  $this->tpl->setVariable("ICON", ilObject::_getIcon($a_set["obj_id"], "tiny", $a_set["type"]));
649  $this->tpl->setVariable("ICON_ALT", $lng->txt($a_set["type"]));
650  $this->tpl->setVariable("TITLE", $a_set["title"]);
651 
652  if ($a_set["offline"] || $a_set["privacy_conflict"]) {
653  $mess = array();
654  if ($a_set["offline"]) {
655  $mess[] = $lng->txt("offline");
656  }
657  if ($a_set["privacy_conflict"]) {
658  $mess[] = $lng->txt("status_no_permission");
659  }
660  $this->tpl->setCurrentBlock("status_bl");
661  $this->tpl->setVariable("TEXT_STATUS", implode(", ", $mess));
662  $this->tpl->parseCurrentBlock();
663  }
664 
665  foreach ($this->getSelectedColumns() as $c) {
666  switch ($c) {
667  case "country":
668  case "gender":
669  case "city":
670  case "language":
671  case "status":
672  case "mark":
673  case "sel_country":
674  $this->renderPercentages($c, $a_set[$c]);
675  break;
676 
677  case "percentage_avg":
678  if ((int) $a_set[$c] === 0 || !$this->isPercentageAvailable($a_set["obj_id"])) {
679  $this->tpl->setVariable(strtoupper($c), "");
680  break;
681  }
682 
683  // no break
684  default:
685  $value = $this->parseValue($c, $a_set[$c], $a_set["type"]);
686  $this->tpl->setVariable(strtoupper($c), $value);
687  break;
688  }
689  }
690 
691  if ($this->is_root) {
692  $path = $this->buildPath($a_set["ref_ids"], false, true);
693  if ($path) {
694  $this->tpl->setCurrentBlock("item_path");
695  foreach ($path as $ref_id => $path_item) {
696  $this->tpl->setVariable("PATH_ITEM", $path_item);
697 
698  if (!$this->anonymized) {
699  $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', $ref_id);
700  $this->tpl->setVariable("URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(), 'details'));
701  $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', '');
702  $this->tpl->setVariable("TXT_DETAILS", $lng->txt('trac_participants'));
703  } else {
704  $this->tpl->setVariable("URL_DETAILS", ilLink::_getLink($ref_id, $a_set["type"]));
705  $this->tpl->setVariable("TXT_DETAILS", $lng->txt('view'));
706  }
707 
708  $this->tpl->parseCurrentBlock();
709  }
710  }
711 
712  $this->tpl->setCurrentBlock("item_command");
713  $ilCtrl->setParameterByClass(get_class($this), 'hide', $a_set["obj_id"]);
714  $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this), 'hide'));
715  $this->tpl->setVariable("TXT_COMMAND", $this->lng->txt('trac_hide'));
716  $this->tpl->parseCurrentBlock();
717 
718  $this->tpl->touchBlock("path_action");
719  } elseif ($a_set["ref_ids"]) { // #18446
720  // #16453
721  include_once './Services/Tree/classes/class.ilPathGUI.php';
722  $path = new ilPathGUI();
723  $path = $path->getPath($this->ref_id, array_pop($a_set["ref_ids"]));
724  if ($path) {
725  $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path);
726  }
727  }
728  }
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
Creates a path for a start and endnode.
buildPath($ref_ids)
Build path with deep-link.
$c
Definition: cli.php:37
global $DIC
Definition: goto.php:24
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 901 of file class.ilTrSummaryTableGUI.php.

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

902  {
903  $a_csv->addColumn($a_set["title"]);
904 
905  foreach ($this->getSelectedColumns() as $c) {
906  if (!$this->isArrayColumn($c)) {
907  $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
908  $a_csv->addColumn($val);
909  } else {
910  foreach ((array) $a_set[$c] as $idx => $value) {
911  if ($c != "status") {
912  $a_csv->addColumn($value["caption"]);
913  }
914  $a_csv->addColumn((int) $value["absolute"]);
915  $a_csv->addColumn($value["percentage"]);
916  }
917  if (sizeof($a_set[$c]) < 4 && $c != "status") {
918  for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
919  $a_csv->addColumn("");
920  $a_csv->addColumn("");
921  $a_csv->addColumn("");
922  }
923  }
924  }
925  }
926 
927  $a_csv->addRow();
928  }
$c
Definition: cli.php:37
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 821 of file class.ilTrSummaryTableGUI.php.

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

822  {
823  $a_excel->setCell($a_row, 0, $a_set["title"]);
824 
825  $cnt = 1;
826  foreach ($this->getSelectedColumns() as $c) {
827  if (!$this->isArrayColumn($c)) {
828  $val = $this->parseValue($c, $a_set[$c], $a_set["type"]);
829  $a_excel->setCell($a_row, $cnt, $val);
830  $cnt++;
831  } else {
832  foreach ((array) $a_set[$c] as $idx => $value) {
833  if ($c == "status") {
834  $a_excel->setCell($a_row, $cnt, (int) $value["absolute"]);
835  $a_excel->setCell($a_row, ++$cnt, $value["percentage"] . "%");
836  } else {
837  $a_excel->setCell($a_row, $cnt, $value["caption"]);
838  $a_excel->setCell($a_row, ++$cnt, (int) $value["absolute"]);
839  $a_excel->setCell($a_row, ++$cnt, $value["percentage"] . "%");
840  }
841  $cnt++;
842  }
843  if (sizeof($a_set[$c]) < 4 && $c != "status") {
844  for ($loop = 4; $loop > sizeof($a_set[$c]); $loop--) {
845  $a_excel->setCell($a_row, $cnt, "");
846  $a_excel->setCell($a_row, ++$cnt, "");
847  $a_excel->setCell($a_row, ++$cnt, "");
848  $cnt++;
849  }
850  }
851  }
852  }
853  }
$c
Definition: cli.php:37
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 338 of file class.ilTrSummaryTableGUI.php.

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

339  {
340  global $DIC;
341 
342  $lng = $DIC['lng'];
343  $rbacsystem = $DIC['rbacsystem'];
344 
345  include_once("./Services/Tracking/classes/class.ilTrQuery.php");
346 
347  // show only selected subobjects for lp mode
348  $preselected_obj_ids = $filter = null;
349 
351  if (
352  $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL ||
353  $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION ||
354  $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR
355  ) {
356  $collection = $olp->getCollectionInstance();
357  $preselected_obj_ids[$a_object_id][] = $a_ref_id;
358  foreach ($collection->getItems() as $item => $item_info) {
359  $tmp_lp = ilObjectLP::getInstance(ilObject::_lookupObjId($item_info));
360  if ($tmp_lp->isActive()) {
361  $preselected_obj_ids[ilObject::_lookupObjId($item_info)][] = $item_info;
362  }
363  }
364  $filter = $this->getCurrentFilter();
365  } elseif ($this->is_root) {
366  // using search to get all relevant objects
367  // #8498/#8499: restrict to objects with at least "read_learning_progress" access
368  $preselected_obj_ids = $this->searchObjects($this->getCurrentFilter(true), "read_learning_progress");
369  } else {
370  // using summary filters
371  $filter = $this->getCurrentFilter();
372  }
373 
374 
375 
377  $a_object_id,
378  $a_ref_id,
382  ilUtil::stripSlashes($this->getLimit()),
383  $filter,
384  $this->getSelectedColumns(),
385  $preselected_obj_ids
386  );
387 
388  // build status to image map
389  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
390  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
391  $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM,
395  $status_map = array();
397  foreach ($valid_status as $status) {
398  $status_map[$status] = $status_icons->renderIconForStatus($status);
399  }
400 
401  // language map
402  $lng->loadLanguageModule("meta");
403  $languages = array();
404  foreach ($lng->getInstalledLanguages() as $lang_key) {
405  $languages[$lang_key] = $lng->txt("meta_l_" . $lang_key);
406  }
407 
408  $rows = array();
409  foreach ($data["set"] as $idx => $result) {
410  // sessions have no title
411  if ($result["title"] == "" && $result["type"] == "sess") {
412  include_once "Modules/Session/classes/class.ilObjSession.php";
413  $sess = new ilObjSession($result["obj_id"], false);
414  $data["set"][$idx]["title"] = $sess->getFirstAppointment()->appointmentToString();
415  }
416 
417  $data["set"][$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline($result["obj_id"], $result["type"]);
418 
419  // #13807
420  if ($result["ref_ids"]) {
421  $valid = false;
422  foreach ($result["ref_ids"] as $check_ref_id) {
423  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
424  if (ilLearningProgressAccess::checkPermission('read_learning_progress', $check_ref_id)) {
425  $valid = true;
426  break;
427  }
428  }
429  if (!$valid) {
430  foreach (array_keys($data["set"][$idx]) as $col_id) {
431  if (!in_array($col_id, array("type", "title", "obj_id", "ref_id", "offline"))) {
432  $data["set"][$idx][$col_id] = null;
433  }
434  }
435  $data["set"][$idx]["privacy_conflict"] = true;
436  continue;
437  }
438  }
439 
440  // percentages
441  $users_no = $result["user_total"];
442  $data["set"][$idx]["country"] = $this->getItemsPercentages($result["country"], $users_no);
443  $data["set"][$idx]["gender"] = $this->getItemsPercentages($result["gender"], $users_no, array(
444  "n" => $lng->txt("gender_n"),
445  "m" => $lng->txt("gender_m"),
446  "f" => $lng->txt("gender_f"),
447  ));
448  $data["set"][$idx]["city"] = $this->getItemsPercentages($result["city"], $users_no);
449  $data["set"][$idx]["sel_country"] = $this->getItemsPercentages($result["sel_country"], $users_no, $this->getSelCountryCodes());
450  $data["set"][$idx]["mark"] = $this->getItemsPercentages($result["mark"], $users_no);
451  $data["set"][$idx]["language"] = $this->getItemsPercentages($result["language"], $users_no, $languages);
452 
453  // if we encounter any invalid status codes, e.g. null, map them to not attempted instead
454  foreach ($result["status"] as $status_code => $status_counter) {
455  // null is cast to ""
456  if ($status_code === "" || !in_array($status_code, $valid_status)) {
457  $result["status"][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] += $status_counter;
458  unset($result["status"][$status_code]);
459  }
460  }
461  $data["set"][$idx]["status"] = $this->getItemsPercentagesStatus($result["status"], $users_no, $status_map);
462 
463  if (!$this->isPercentageAvailable($result["obj_id"])) {
464  $data["set"][$idx]["percentage_avg"] = null;
465  }
466  }
467 
468  $this->setMaxCount($data["cnt"]);
469  $this->setData($data["set"]);
470  }
const LP_STATUS_COMPLETED_NUM
$result
$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
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
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)
global $DIC
Definition: goto.php:24
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.
$rows
Definition: xhr_table.php:10
const LP_STATUS_NOT_ATTEMPTED_NUM
getLimit()
Get limit.
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 481 of file class.ilTrSummaryTableGUI.php.

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

Referenced by getItems().

482  {
483  global $DIC;
484 
485  $lng = $DIC['lng'];
486 
487  if (!$overall) {
488  return false;
489  }
490 
491  $result = [];
492 
493  if ($data) {
494  if (is_array($data) && count($data) < $limit) {
495  $limit = count($data);
496  }
497  if (is_array($data) && (count($data) == $limit + 1)) {
498  ++$limit;
499  }
500  $counter = $others_counter = 0;
501  $others_sum = $overall;
502  $all_sum = 0;
503  foreach ($data as $id => $count) {
504  $counter++;
505  $all_sum += $count;
506  if ($counter <= $limit) {
507  $caption = $id;
508 
509  if ($value_map && isset($value_map[$id])) {
510  $caption = $value_map[$id];
511  }
512  if ($caption == "") {
513  $caption = $lng->txt("none");
514  }
515  if (
516  $counter == $limit &&
517  $all_sum < $overall
518  ) {
519  ++$others_counter;
520  continue;
521  }
522  $perc = round($count / $overall * 100);
523  $result[] = array(
524  "caption" => $caption,
525  "absolute" => $count, // ." ".($count > 1 ? $lng->txt("users") : $lng->txt("user")),
526  "percentage" => $perc
527  );
528  $others_sum -= $count;
529  } else {
530  $others_counter++;
531  }
532  }
533 
534  if ($others_counter) {
535  $perc = round($others_sum / $overall * 100);
536  $result[] = array(
537  "caption" => $others_counter . " " . $lng->txt("trac_others"),
538  "absolute" => $others_sum, // ." ".($others_sum > 1 ? $lng->txt("users") : $lng->txt("user")),
539  "percentage" => $perc
540  );
541  }
542  }
543 
544  return $result;
545  }
$result
global $DIC
Definition: goto.php:24
+ 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 555 of file class.ilTrSummaryTableGUI.php.

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

Referenced by getItems().

556  {
557  global $DIC;
558 
559  $lng = $DIC['lng'];
560 
561  $result = array();
562  foreach ($value_map as $id => $caption) {
563  $count = 0;
564  if (isset($data[$id])) {
565  $count = $data[$id];
566  }
567  $perc = round($count / $overall * 100);
568 
569  $result[] = array(
570  "caption" => $caption,
571  "absolute" => $count,
572  "percentage" => $perc
573  );
574  }
575 
576  return $result;
577  }
$result
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ getSelCountryCodes()

ilTrSummaryTableGUI::getSelCountryCodes ( )

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

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

Referenced by getItems(), and initFilter().

318  {
319  global $DIC;
320 
321  $lng = $DIC['lng'];
322 
323  include_once("./Services/Utilities/classes/class.ilCountry.php");
324  $options = array();
325  foreach (ilCountry::getCountryCodes() as $c) {
326  $options[$c] = $lng->txt("meta_c_" . $c);
327  }
328  asort($options);
329  return $options;
330  }
$c
Definition: cli.php:37
global $DIC
Definition: goto.php:24
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 84 of file class.ilTrSummaryTableGUI.php.

References $columns, $DIC, $ilSetting, 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().

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

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

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

747  {
748  if (in_array($a_name, array("country", "gender", "city", "language", "status", "mark", 'sel_country'))) {
749  return true;
750  }
751  return false;
752  }
+ Here is the caller graph for this function:

◆ isStatusShown()

ilTrSummaryTableGUI::isStatusShown ( )

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

References ilTable2GUI\getSelectedColumns().

766  : bool
767  {
768  return in_array('status', $this->getSelectedColumns());
769  }
getSelectedColumns()
Get selected columns.
+ Here is the call graph for this function:

◆ numericOrdering()

ilTrSummaryTableGUI::numericOrdering (   $a_field)

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

755  {
756  $pos = strrpos($a_field, "_");
757  if ($pos !== false) {
758  $function = strtoupper(substr($a_field, $pos + 1));
759  if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT", "TOTAL"))) {
760  return true;
761  }
762  }
763  return false;
764  }

◆ parseValue()

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

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

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

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

580  {
581  global $DIC;
582 
583  $lng = $DIC['lng'];
584 
585  // get rid of aggregation
586  $pos = strrpos($id, "_");
587  if ($pos !== false) {
588  $function = strtoupper(substr($id, $pos + 1));
589  if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT"))) {
590  $id = substr($id, 0, $pos);
591  }
592  }
593 
594  if (trim($value) == "") {
595  if ($id == "title") {
596  return "--" . $lng->txt("none") . "--";
597  }
598  return "";
599  }
600  switch ($id) {
601  case 'status_changed':
602  case "first_access":
603  case "create_date":
605  break;
606 
607  case "last_access":
609  break;
610 
611  case "spent_seconds":
612  case "read_count_spent_seconds":
614  $value = "-";
615  } else {
616  $value = ilDatePresentation::secondsToString($value, ($value < 3600 ? true : false)); // #14858
617  }
618  break;
619 
620  case "percentage":
621  if (false /* $this->isPercentageAvailable() */) {
622  $value = "-";
623  } else {
624  $value = $value . "%";
625  }
626  break;
627 
628  case "mark":
630  $value = "-";
631  }
632  break;
633  }
634 
635  return $value;
636  }
const IL_CAL_DATETIME
$type
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) ...
global $DIC
Definition: goto.php:24
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 730 of file class.ilTrSummaryTableGUI.php.

References ilTableGUI\$data.

Referenced by fillRow().

731  {
732  if ($data) {
733  foreach ($data as $item) {
734  $this->tpl->setCurrentBlock($id . "_row");
735  $this->tpl->setVariable("CAPTION", $item["caption"]);
736  $this->tpl->setVariable("ABSOLUTE", $item["absolute"]);
737  $this->tpl->setVariable("PERCENTAGE", $item["percentage"]);
738  $this->tpl->parseCurrentBlock();
739  }
740  } else {
741  $this->tpl->touchBlock($id);
742  ;
743  }
744  }
+ Here is the caller graph for this function:

Field Documentation

◆ $dic

ilTrSummaryTableGUI::$dic
protected

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


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