4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
5 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
30 function __construct($a_parent_obj, $a_parent_cmd,
array $a_preselect = null, $a_load_items =
true, $a_is_chart =
false, $a_is_details =
false)
34 $this->preselected = $a_preselect;
35 $this->is_chart = (bool)$a_is_chart;
36 $this->is_details = (bool)$a_is_details;
38 $this->
setId(
"lpobjstatlptbl");
40 parent::__construct($a_parent_obj, $a_parent_cmd);
42 if(!$this->is_details)
48 $this->
addColumn($lng->txt(
"trac_title"),
"title");
49 $this->
addColumn($lng->txt(
"object_id"),
"obj_id");
55 $this->
addColumn($lng->txt(
"trac_figure"));
60 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
62 foreach($this->
getMonthsYear($this->filter[
"yearmonth"]) as $num => $caption)
64 $this->
addColumn($caption,
"month_".$num);
69 foreach($this->types as $type)
73 $caption =
" ".$this->lng->txt(
"trac_object_stat_lp_".$type);
79 $this->
addColumn($lng->txt(
"trac_members_short").$caption,
"mem_cnt_".$type);
82 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
83 foreach($this->status as
$status)
89 foreach($this->types as $type)
93 $caption =
$icon.$this->lng->txt(
"trac_object_stat_lp_".$type);
97 $caption =
$icon.
" Ø";
99 $this->
addColumn($caption, $status.
"_".$type);
104 if(!$this->is_details)
106 $this->
setTitle($this->lng->txt(
"trac_object_stat_lp"));
109 $this->
addMultiCommand(
"showLearningProgressGraph", $lng->txt(
"trac_show_graph"));
114 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
115 $this->
setRowTemplate(
"tpl.lp_object_statistics_lp_row.html",
"Services/Tracking");
129 if($this->is_details)
143 if($a_field !=
"title")
160 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
175 $this->filter[
"type"] =
"crs";
179 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
180 $ti =
new ilTextInputGUI($lng->txt(
"trac_title_description"),
"query");
184 $ti->readFromSession();
185 $this->filter[
"query"] = $ti->getValue();
191 $si->readFromSession();
196 $this->filter[
"yearmonth"] =
$si->getValue();
198 if(!strpos($this->filter[
"yearmonth"],
"-"))
202 "mem_cnt_max" => $lng->txt(
"members").
" ".$lng->txt(
"trac_object_stat_lp_max"),
203 "mem_cnt_avg" => $lng->txt(
"members").
" Ø",
207 $si->setOptions($options);
209 $si->readFromSession();
212 $si->setValue(
"mem_cnt_max");
214 $this->filter[
"measure"] =
$si->getValue();
217 if($this->is_details)
219 $this->filters =
array();
226 $all_status = array_merge(
array(
"mem_cnt"), $this->status);
236 $objects = array_keys($objects);
238 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
240 $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
241 if(
sizeof($yearmonth) == 1)
245 $obj_id = $item[
"obj_id"];
246 if(!isset(
$data[$obj_id]))
248 $data[$obj_id][
"obj_id"] = $obj_id;
252 $measure_type = substr($this->filter[
"measure"], -3);
253 $measure_field = substr($this->filter[
"measure"], 0, -4);
254 $value = $item[$measure_field.
"_".$measure_type];
255 $idx = $item[
"yyyy"].
"-".str_pad($item[
"mm"], 2,
"0", STR_PAD_LEFT);
256 $data[$obj_id][
"month_".$idx] = $value;
262 foreach(array_keys($this->
getMonthsYear($yearmonth[0])) as $num)
264 $num = (int)array_pop(explode(
"-", $num));
267 $idx = $yearmonth[0].
268 "-".str_pad($num, 2,
"0", STR_PAD_LEFT).
269 "-".str_pad($item[
"dd"], 2,
"0", STR_PAD_LEFT);
270 $this->chart_data[$item[
"obj_id"]][$idx] = $item;
280 $obj_id = $item[
"obj_id"];
281 if(!isset(
$data[$obj_id]))
283 $data[$obj_id][
"obj_id"] = $obj_id;
288 foreach($all_status as
$status)
291 if(is_numeric($status))
293 $field = $this->status_map[
$status];
301 foreach($this->types as $type)
303 $value = $item[$field.
"_".$type];
304 $data[$obj_id][$status.
"_".$type] = $value;
314 $this->chart_data[$item[
"obj_id"]][$item[
"dd"]] = $item;
320 foreach($objects as $obj_id)
322 if(!isset(
$data[$obj_id]))
324 $data[$obj_id][
"obj_id"] = $obj_id;
332 include_once
"./Services/Link/classes/class.ilLink.php";
338 $all_status = array_merge(
array(
"mem_cnt"), $this->status);
340 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
343 $month =
"month_".$item[
"yyyy"].
"-".str_pad($item[
"mm"], 2,
"0", STR_PAD_LEFT);
345 foreach($all_status as
$status)
348 if($status !=
"mem_cnt")
350 $field = $this->status_map[
$status];
357 foreach($this->types as $type)
359 $value = $item[$field.
"_".$type];
360 $idx = $item[
"yyyy"].
"-".str_pad($item[
"mm"], 2,
"0", STR_PAD_LEFT);
361 $data[$status.
"_".$type][
"month_".$idx] = $value;
367 foreach(array_keys(
$data) as $figure)
369 $status = substr($figure, 0, -4);
370 $type = substr($figure, -3);
381 $text = $this->lng->txt(
"members");
385 $caption =
$text.
" ".$this->lng->txt(
"trac_object_stat_lp_".$type);
389 $caption =
$text.
" Ø";
391 $data[$figure][
"figure"] = $caption;
399 foreach($this->types as $type)
401 $a_row[
"mem_cnt_".$type] = null;
403 foreach($this->status as
$status)
405 foreach($this->types as $type)
407 $a_row[$status.
"_".$type] = null;
419 if(!$this->is_details)
424 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
426 $ilCtrl->setParameter($this->parent_obj,
"item_id", $a_set[
"obj_id"]);
427 $url = $ilCtrl->getLinkTarget($this->parent_obj,
"showLearningProgressDetails");
428 $a_set[
"title"] .=
" (<a href=\"#\" onclick=\"ilObjStat.showLPDetails(event, '".$url.
"');\">Details</a>)";
429 $ilCtrl->setParameter($this->parent_obj,
"item_id",
"");
432 $this->tpl->setCurrentBlock(
"checkbox");
433 $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
435 $this->tpl->setVariable(
"ICON_ALT", $this->lng->txt($type));
436 $this->tpl->setVariable(
"TITLE_TEXT", $a_set[
"title"]);
437 if($this->preselected && in_array($a_set[
"obj_id"], $this->preselected))
439 $this->tpl->setVariable(
"CHECKBOX_STATE",
" checked=\"checked\"");
441 $this->tpl->parseCurrentBlock();
445 $this->tpl->setCurrentBlock(
"details");
446 $this->tpl->setVariable(
"TXT_FIGURE", $a_set[
"figure"]);
447 $this->tpl->parseCurrentBlock();
450 $this->tpl->setCurrentBlock(
"item");
452 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
454 foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num)
457 $this->tpl->setVariable(
"ITEM_VALUE", $value);
458 $this->tpl->parseCurrentBlock();
463 foreach($this->types as $type)
465 $this->tpl->setVariable(
"ITEM_VALUE", $this->
anonymizeValue((
int)$a_set[
"mem_cnt_".$type]));
466 $this->tpl->parseCurrentBlock();
468 foreach($this->status as
$status)
470 foreach($this->types as $type)
472 $this->tpl->setVariable(
"ITEM_VALUE", $this->
anonymizeValue((
int)$a_set[$status.
"_".$type]));
473 $this->tpl->parseCurrentBlock();
483 $a_graph_items =
array(array_pop($a_graph_items));
485 include_once
"Services/Chart/classes/class.ilChart.php";
487 $chart->setsize(700, 500);
493 $custom_order =
array(
503 foreach($this->chart_data as $object_id => $days)
505 if(in_array($object_id, $a_graph_items))
508 foreach($custom_order as
$status => $colors)
527 $chart_colors[] = $colors[0];
529 $chart->setColors($chart_colors);
531 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
533 $x_axis = $this->lng->txt(
"month");
536 foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $month)
538 for($loop = 1; $loop<32; $loop++)
540 $item_day = $month.
"-".str_pad($loop, 2,
"0", STR_PAD_LEFT);
541 foreach(array_keys($custom_order) as
$status)
543 if(isset($days[$item_day]))
546 $value = (int)$days[$item_day][$this->status_map[$status].
"_avg"];
552 $max_value = max($max_value, $value);
562 $x_axis = $this->lng->txt(
"day");
563 for($loop = 1; $loop<32; $loop++)
565 foreach(array_keys($custom_order) as
$status)
567 if(isset($days[$loop]))
570 $value = (int)$days[$loop][$this->status_map[$status].
"_avg"];
576 $max_value = max($max_value, $value);
583 foreach(array_keys($custom_order) as
$status)
593 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
596 foreach($this->
getMonthsYear($this->filter[
"yearmonth"],
true) as $caption)
604 for($loop = 1; $loop<32; $loop++)
606 $labels[$loop] = $loop.
".";
609 $chart->setTicks($labels, $value_ticks,
true);
618 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
620 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
623 $tpl->addJavascript(
"./Services/Tracking/js/ilObjStat.js");
const LP_STATUS_COMPLETED_NUM
anonymizeValue($a_value, $a_force_number=false)
static getObjectLPStatistics(array $a_obj_ids, $a_year, $a_month=null, $a_group_by_day=false)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
static _getImagePathForStatus($a_status)
Get image path for status.
setEnableNumInfo($a_val)
Set enable num info.
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
getMonthsYear($a_year=null, $a_short=false)
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
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static _lookupTitle($a_id)
lookup object title
getGraph(array $a_graph_items)
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
__construct($a_parent_obj, $a_parent_cmd, array $a_preselect=null, $a_load_items=true, $a_is_chart=false, $a_is_details=false)
Constructor.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
TableGUI class for learning progress.
if(!is_array($argv)) $options
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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.
numericOrdering($a_field)
setMaxLength($a_maxlength)
Set Max Length.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static initPanel($a_resize=false)
Init yui panel.
fillRow($a_set)
Fill table row.
initLearningProgressDetailsLayer()
const LP_STATUS_NOT_ATTEMPTED_NUM
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
getMonthsFilter($a_short=false)
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getDetailItems($a_obj_id)
static initjQuery($a_tpl=null)
Init jQuery.
setEnableHeader($a_enableheader)
Set Enable Header.
TableGUI class for learning progress.
getCurrentFilter($as_query=false)
setEnableTitle($a_enabletitle)
Set Enable Title.
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.
static getInstanceByType($a_type, $a_id)
Get type instance.
setLimit($a_limit=0, $a_default_limit=0)
const LP_STATUS_FAILED_NUM
setFilterCommand($a_val, $a_caption=null)
Set filter command.