4include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
 
   20        function __construct($a_parent_obj, $a_parent_cmd, array $a_preselect = 
null, $a_load_items = 
true)
 
   24                $this->preselected = $a_preselect;
 
   26                $this->
setId(
"lpobjstattbl");
 
   28                parent::__construct($a_parent_obj, $a_parent_cmd);
 
   35                $this->
addColumn($lng->txt(
"trac_title"), 
"title");
 
   36                $this->
addColumn($lng->txt(
"object_id"), 
"obj_id");
 
   37                if(strpos($this->filter[
"yearmonth"], 
"-") === 
false)
 
   39                        foreach($this->
getMonthsYear($this->filter[
"yearmonth"]) as $num => $caption)
 
   41                                $this->
addColumn($caption, 
"month_".$num, 
"", 
false, 
"ilRight");
 
   44                $this->
addColumn($lng->txt(
"total"), 
"total", 
"", 
false, 
"ilRight");
 
   46                $this->
setTitle($this->lng->txt(
"trac_object_stat_access"));
 
   49                $this->
addMultiCommand(
"showAccessGraph", $lng->txt(
"trac_show_graph"));
 
   53                $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
 
   54                $this->
setRowTemplate(
"tpl.lp_object_statistics_row.html", 
"Services/Tracking");
 
   71                if($a_field != 
"title")
 
   88                include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
 
   92                $si->readFromSession();
 
   97                $this->filter[
"type"] = 
$si->getValue();
 
  100                include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
 
  102                $ti->setMaxLength(64);
 
  105                $ti->readFromSession();
 
  106                $this->filter[
"query"] = $ti->getValue();
 
  110                $si->setOptions(array(
"read_count"=>
$lng->txt(
"trac_read_count"),
 
  111                        "spent_seconds"=>
$lng->txt(
"trac_spent_seconds"),
 
  112                        "users"=>
$lng->txt(
"users")));
 
  114                $si->readFromSession();
 
  117                        $si->setValue(
"read_count");
 
  119                $this->filter[
"measure"] = 
$si->getValue();
 
  125                $si->readFromSession();
 
  128                        $si->setValue(date(
"Y-m"));
 
  130                $this->filter[
"yearmonth"] = 
$si->getValue();
 
  140                        include_once 
"Services/Tracking/classes/class.ilTrQuery.php";
 
  142                        $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
 
  143                        if(
sizeof($yearmonth) == 1)
 
  147                                        $data[$obj_id][
"obj_id"] = $obj_id;
 
  150                                        foreach($months as $month => $values)
 
  152                                                $idx = $yearmonth[0].
"-".str_pad($month, 2, 
"0", STR_PAD_LEFT);
 
  153                                                $data[$obj_id][
"month_".$idx] = (int)$values[$this->filter[
"measure"]];
 
  154                                                $data[$obj_id][
"total"] += (int)$values[$this->filter[
"measure"]];
 
  162                                        $data[$obj_id][
"obj_id"] = $obj_id;
 
  165                                        foreach($days as $day => $values)
 
  167                                                $data[$obj_id][
"day_".$day] = (int)$values[$this->filter[
"measure"]];
 
  168                                                $data[$obj_id][
"total"] += (int)$values[$this->filter[
"measure"]];
 
  174                        foreach(array_keys($objects) as $obj_id)
 
  176                                if(!isset(
$data[$obj_id]))
 
  178                                        $data[$obj_id][
"obj_id"] = $obj_id;
 
  196                $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
 
  198                $this->tpl->setVariable(
"ICON_ALT", $this->lng->txt($type));
 
  199                $this->tpl->setVariable(
"TITLE_TEXT", $a_set[
"title"]);
 
  201                if($this->preselected && in_array($a_set[
"obj_id"], $this->preselected))
 
  203                        $this->tpl->setVariable(
"CHECKBOX_STATE", 
" checked=\"checked\"");
 
  207                if(strpos($this->filter[
"yearmonth"], 
"-") === 
false)
 
  209                        $this->tpl->setCurrentBlock(
"month");
 
  210                        foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num)
 
  212                                $value = (int)$a_set[
"month_".$num];
 
  213                                if($this->filter[
"measure"] != 
"spent_seconds")
 
  221                                $this->tpl->setVariable(
"MONTH_VALUE", $value);
 
  222                                $this->tpl->parseCurrentBlock();
 
  226                if($this->filter[
"measure"] == 
"spent_seconds")
 
  234                $this->tpl->setVariable(
"TOTAL", $sum);
 
  241                include_once 
"Services/Chart/classes/class.ilChart.php";
 
  243                $chart->setSize(700, 500);
 
  246                $chart->setLegend($legend);
 
  249                foreach($this->
getData() as $object)
 
  251                        if(in_array($object[
"obj_id"], $a_graph_items))
 
  256                                if(strpos($this->filter[
"yearmonth"], 
"-") === 
false)
 
  258                                        foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $idx => $num)
 
  260                                                $value = (int)$object[
"month_".$num];
 
  261                                                $max_value = max($max_value, $value);
 
  262                                                if($this->filter[
"measure"] != 
"spent_seconds")
 
  266                                                $series->addPoint($idx, $value);
 
  271                                        for($loop = 1; $loop<32; $loop++)
 
  273                                                $value = (int)$object[
"day_".$loop];
 
  274                                                $max_value = max($max_value, $value);
 
  275                                                if($this->filter[
"measure"] != 
"spent_seconds")
 
  279                                                $series->addPoint($loop, $value);
 
  283                                $chart->addData($series);
 
  287                $value_ticks = $this->
buildValueScale($max_value, ($this->filter[
"measure"] != 
"spent_seconds"),
 
  288                        ($this->filter[
"measure"] == 
"spent_seconds"));
 
  291                if(strpos($this->filter[
"yearmonth"], 
"-") === 
false)
 
  293                        foreach(array_values($this->
getMonthsYear($this->filter[
"yearmonth"], 
true)) as $idx => $caption)
 
  295                                $labels[$idx] = $caption;
 
  300                        for($loop = 1; $loop<32; $loop++)
 
  302                                $labels[$loop] = $loop.
".";
 
  305                $chart->setTicks($labels, $value_ticks, 
true);
 
  307                return $chart->getHTML();
 
  318                $a_worksheet->write($a_row, 1, $a_set[
"obj_id"]);
 
  321                if(strpos($this->filter[
"yearmonth"], 
"-") === 
false)
 
  323                        foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num)
 
  325                                $value = (int)$a_set[
"month_".$num];
 
  326                                if($this->filter[
"measure"] != 
"spent_seconds")
 
  332                                $a_worksheet->write($a_row, $col, $value);
 
  336                if($this->filter[
"measure"] == 
"spent_seconds")
 
  340                        $sum = (int)$a_set[
"total"];
 
  347                $a_worksheet->write($a_row, $col, $sum);
 
  358                $a_csv->addColumn($a_set[
"obj_id"]);
 
  360                if(strpos($this->filter[
"yearmonth"], 
"-") === 
false)
 
  362                        foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num)
 
  364                                $value = (int)$a_set[
"month_".$num];
 
  365                                if($this->filter[
"measure"] != 
"spent_seconds")
 
  370                                $a_csv->addColumn($value);
 
  374                if($this->filter[
"measure"] == 
"spent_seconds")
 
  378                        $sum = (int)$a_set[
"total"];
 
  384                $a_csv->addColumn($sum);
 
static getInstanceByType($a_type, $a_id)
Get type instance.
TableGUI class for learning progress.
__construct($a_parent_obj, $a_parent_cmd, array $a_preselect=null, $a_load_items=true)
Constructor.
fillRow($a_set)
Fill table row.
fillRowCSV($a_csv, $a_set)
CSV Version of Fill Row.
numericOrdering($a_field)
Should this field be sorted numeric?
getGraph(array $a_graph_items)
fillRowExcel($a_worksheet, &$a_row, $a_set)
Excel Version of Fill Row.
TableGUI class for learning progress.
searchObjects(array $filter, $permission, array $preset_obj_ids=null)
Search objects that match current filters.
formatSeconds($seconds, $a_shorten_zero=false)
getCurrentFilter($as_query=false)
getMonthsYear($a_year=null, $a_short=false)
buildValueScale($a_max_value, $a_anonymize=false, $a_format_seconds=false)
anonymizeValue($a_value, $a_force_number=false)
getMonthsFilter($a_short=false)
getPossibleTypes($a_split_learning_resources=false, $a_include_digilib=false, $a_allow_undefined_lp=false)
Get possible subtypes.
static _lookupTitle($a_id)
lookup object title
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setExportFormats(array $formats)
Set available export formats.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
setEnableTitle($a_enabletitle)
Set Enable Title.
setEnableNumInfo($a_val)
Set enable num info.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setFilterCommand($a_val, $a_caption=null)
Set filter command.
This class represents a text property in a property form.
static getObjectAccessStatistics(array $a_ref_ids, $a_year, $a_month=null)