4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
20 public function __construct($a_parent_obj, $a_parent_cmd, array $a_preselect = null, $a_load_items =
true)
27 $this->preselected = $a_preselect;
29 $this->
setId(
"lpobjstatdlytbl");
31 parent::__construct($a_parent_obj, $a_parent_cmd);
40 for ($loop = 0; $loop < 24; $loop += 2) {
41 $this->
addColumn(str_pad($loop, 2,
"0", STR_PAD_LEFT) .
":00-<br />" .
42 str_pad($loop + 2, 2,
"0", STR_PAD_LEFT) .
":00 ",
"hour" . $loop);
46 $this->
setTitle($this->lng->txt(
"trac_object_stat_daily"));
54 $this->
setRowTemplate(
"tpl.lp_object_statistics_daily_row.html",
"Services/Tracking");
70 if ($a_field !=
"title") {
88 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
92 $si->readFromSession();
93 if (!
$si->getValue()) {
96 $this->filter[
"type"] =
$si->getValue();
99 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
104 $ti->readFromSession();
105 $this->filter[
"query"] = $ti->getValue();
109 $si->setOptions(array(
"read_count" =>
$lng->txt(
"trac_read_count"),
110 "spent_seconds" =>
$lng->txt(
"trac_spent_seconds")));
112 $si->readFromSession();
113 if (!
$si->getValue()) {
114 $si->setValue(
"read_count");
116 $this->filter[
"measure"] =
$si->getValue();
122 $si->readFromSession();
123 if (!
$si->getValue()) {
124 $si->setValue(date(
"Y-m"));
126 $this->filter[
"yearmonth"] =
$si->getValue();
133 if ($this->filter[
"type"] !=
"prtf") {
137 if ($this->filter[
"type"] ==
"blog") {
139 $objects[$obj_id] = array($obj_id);
145 $objects[$obj_id] = array($obj_id);
150 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
152 $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
153 if (
sizeof($yearmonth) == 1) {
159 foreach ($stat_objects as $obj_id => $hours) {
160 $data[$obj_id][
"obj_id"] = $obj_id;
163 foreach ($hours as $hour =>
$values) {
165 $data[$obj_id][
"hour" . floor($hour / 2) * 2] += (int)
$values[$this->filter[
"measure"]];
166 $data[$obj_id][
"sum"] += (int)
$values[$this->filter[
"measure"]];
169 $data[$obj_id][
"graph"][
"hour" . $hour] =
$values[$this->filter[
"measure"]];
174 foreach ($objects as $obj_id => $ref_ids) {
175 if (!isset(
$data[$obj_id])) {
176 $data[$obj_id][
"obj_id"] = $obj_id;
196 $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
197 $this->tpl->setVariable(
"ICON_SRC", ilObject::_getIcon(
"",
"tiny",
$type));
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)) {
202 $this->tpl->setVariable(
"CHECKBOX_STATE",
" checked=\"checked\"");
205 $this->tpl->setCurrentBlock(
"hour");
206 for ($loop = 0; $loop < 24; $loop += 2) {
207 $value = (int) $a_set[
"hour" . $loop];
208 if ($this->filter[
"measure"] !=
"spent_seconds") {
213 $this->tpl->setVariable(
"HOUR_VALUE", $value);
214 $this->tpl->parseCurrentBlock();
217 if ($this->filter[
"measure"] ==
"spent_seconds") {
222 $this->tpl->setVariable(
"TOTAL", $sum);
231 include_once
"Services/Chart/classes/class.ilChart.php";
233 $chart->setsize(700, 500);
239 foreach ($this->
getData() as $object) {
240 if (in_array($object[
"obj_id"], $a_graph_items)) {
244 for ($loop = 0; $loop < 24; $loop++) {
245 $value = (int) $object[
"graph"][
"hour" . $loop];
246 $max_value = max($max_value, $value);
247 if ($this->filter[
"measure"] !=
"spent_seconds") {
250 $series->addPoint($loop, $value);
253 $chart->addData($series);
259 ($this->filter[
"measure"] !=
"spent_seconds"),
260 ($this->filter[
"measure"] ==
"spent_seconds")
264 for ($loop = 0; $loop < 24; $loop++) {
265 $labels[$loop] = str_pad($loop, 2,
"0", STR_PAD_LEFT);
267 $chart->setTicks($labels, $value_ticks,
true);
269 return $chart->getHTML();
279 $a_excel->
setCell($a_row, 1, $a_set[
"obj_id"]);
282 for ($loop = 0; $loop < 24; $loop += 2) {
283 $value = (int) $a_set[
"hour" . $loop];
284 if ($this->filter[
"measure"] !=
"spent_seconds") {
288 $a_excel->
setCell($a_row, ++$col, $value);
291 if ($this->filter[
"measure"] ==
"spent_seconds") {
294 $sum = (int) $a_set[
"sum"];
298 $a_excel->
setCell($a_row, ++$col, $sum);
308 $a_csv->addColumn($a_set[
"obj_id"]);
310 for ($loop = 0; $loop < 24; $loop += 2) {
311 $value = (int) $a_set[
"hour" . $loop];
312 if ($this->filter[
"measure"] !=
"spent_seconds") {
316 $a_csv->addColumn($value);
319 if ($this->filter[
"measure"] ==
"spent_seconds") {
322 $sum = (int) $a_set[
"sum"];
326 $a_csv->addColumn($sum);
anonymizeValue($a_value, $a_force_number=false)
__construct($a_parent_obj, $a_parent_cmd, array $a_preselect=null, $a_load_items=true)
Constructor.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
getGraph(array $a_graph_items)
setExportFormats(array $formats)
Set available export formats.
setEnableNumInfo($a_val)
Set enable num info.
fillRow($a_set)
Fill table row.
searchObjects(array $filter, $permission, array $preset_obj_ids=null, $a_check_lp_activation=true)
Search objects that match current filters.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static _lookupTitle($a_id)
lookup object title
fillMetaExcel(ilExcel $a_excel, &$a_row)
getPossibleTypes($a_split_learning_resources=false, $a_include_digilib=false, $a_allow_undefined_lp=false)
Get possible subtypes.
fillRowCSV($a_csv, $a_set)
numericOrdering($a_field)
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static getObjectDailyStatistics(array $a_ref_ids, $a_year, $a_month=null)
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
TableGUI class for learning progress.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
buildValueScale($a_max_value, $a_anonymize=false, $a_format_seconds=false)
addMultiCommand($a_cmd, $a_text)
Add Command button.
This class represents a text property in a property form.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
setMaxLength($a_maxlength)
Set Max Length.
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.
getMonthsFilter($a_short=false)
formatSeconds($seconds, $a_shorten_zero=false)
static getPortfolios($a_title=null)
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
TableGUI class for learning progress.
setEnableHeader($a_enableheader)
Set Enable Header.
static getWorkspaceBlogs($a_title=null)
getCurrentFilter($as_query=false)
setEnableTitle($a_enabletitle)
Set Enable Title.
static getInstanceByType($a_type, $a_id)
Get type instance.
setFilterCommand($a_val, $a_caption=null)
Set filter command.