4 include_once
"classes/class.ilObjectGUI.php";
38 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
43 $this->lng->loadLanguageModule(
'trac');
50 $next_class = $this->ctrl->getNextClass();
51 $this->ctrl->setReturn($this,
"show");
56 case 'ilpermissiongui':
57 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
59 $ret =& $this->ctrl->forwardCommand($perm_gui);
62 case 'illearningprogressgui':
63 $this->tabs_gui->setTabActive(
'learning_progress');
64 include_once(
"./Services/Tracking/classes/class.ilLearningProgressGUI.php");
66 $ret =& $this->ctrl->forwardCommand($lp_gui);
70 $cmd = $this->ctrl->getCmd();
73 $cmd =
"trackingDataQueryForm";
92 $this->ctrl->setParameter($this,
"ref_id",$this->ref_id);
94 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
96 $tabs_gui->addTarget(
"tracking_data",
97 $this->ctrl->getLinkTarget($this,
98 "trackingDataQueryForm"),
99 "trackingDataQueryForm",
101 $tabs_gui->addTarget(
"settings",
102 $this->ctrl->getLinkTarget($this,
106 $tabs_gui->addTarget(
"manage_tracking_data",
107 $this->ctrl->getLinkTarget($this,
114 $tabs_gui->addTarget(
"learning_progress",
115 $this->ctrl->getLinkTargetByClass(
"illearningprogressgui",
118 "illearningprogressgui");
120 $tabs_gui->addTarget(
"perm_settings",
121 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
122 array(
"perm",
"info",
"owner"),
135 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
137 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read_track"),
$ilErr->WARNING);
140 $this->tabs_gui->setTabActive(
'settings');
143 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.trac_settings.html",
"Services/Tracking");
144 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this));
148 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'tracking_settings'));
149 $this->tpl->setVariable(
"TXT_TRACKING_SETTINGS", $this->lng->txt(
"tracking_settings"));
150 $this->tpl->setVariable(
"TXT_ACTIVATE_TRACKING", $this->lng->txt(
"activate_tracking"));
151 $this->tpl->setVariable(
"TXT_USER_RELATED_DATA", $this->lng->txt(
"trac_anonymized"));
152 $this->tpl->setVariable(
"INFO_USER_RELATED_DATA",$this->lng->txt(
"trac_anonymized_info"));
153 $this->tpl->setVariable(
"TXT_VALID_REQUEST",$this->lng->txt(
'trac_valid_request'));
154 $this->tpl->setVariable(
"INFO_VALID_REQUEST",$this->lng->txt(
'info_valid_request'));
155 $this->tpl->setVariable(
"SECONDS",$this->lng->txt(
'seconds'));
157 #$this->tpl->setVariable("TXT_NUMBER_RECORDS", $this->lng->txt("number_of_records"));
158 #$this->tpl->setVariable("NUMBER_RECORDS", $this->object->getRecordsTotal());
159 $this->tpl->setVariable(
"TXT_SAVE", $this->lng->txt(
"save"));
162 $this->tpl->setVariable(
'TXT_USER_TRACKING', $this->lng->txt(
'trac_user_activities'));
163 $this->tpl->setVariable(
'TXT_LEARNING_PROGRESS_TRACKING', $this->lng->txt(
'trac_learning_progress'));
164 $this->tpl->setVariable(
'TXT_CHANGE_EVENT_TRACKING', $this->lng->txt(
'trac_repository_changes'));
168 $this->tpl->setVariable(
'USER_TRACKING_CHECKED',
' checked="1" ');
173 $this->tpl->setVariable(
'LEARNING_PROGRESS_TRACKING_CHECKED',
' checked="1" ');
175 if($this->object->isChangeEventTrackingEnabled())
177 $this->tpl->setVariable(
'CHANGE_EVENT_TRACKING_CHECKED',
' checked="1" ');
182 if(!$this->object->_enabledUserRelatedData())
184 $this->tpl->setVariable(
"USER_RELATED_CHECKED",
" checked=\"1\" ");
187 $this->tpl->setVariable(
"VALID_REQUEST",$this->object->getValidTimeSpan());
197 if (
$_POST[
'user_tracking'] ==
'1')
205 $this->
object->setActivationStatus($activation_status);
206 $this->
object->setChangeEventTrackingEnabled(
$_POST[
'change_event_tracking'] ==
'1');
209 $this->
object->enableUserRelatedData((
int) !
$_POST[
'user_related']);
210 $this->
object->setValidTimeSpan(
$_POST[
'valid_request']);
212 if(!$this->object->validateSettings())
220 $this->
object->updateSettings();
235 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_manage_data.html");
236 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
237 $tpl->setVariable(
"TXT_TRACKING_DATA", $this->lng->txt(
"tracking_data"));
238 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
239 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
240 $tpl->setVariable(
"TXT_DELETE_OLDER", $lng->txt(
"delete"));
241 $overw = $this->
object->getMonthTotalOverview();
242 foreach($overw as $month)
244 $tpl->setCurrentBlock(
"load_row");
245 $rcol = ($rcol !=
"tblrow1") ?
"tblrow1" :
"tblrow2";
246 $tpl->setVariable(
"ROWCOL", $rcol);
247 $tpl->setVariable(
"VAL_MONTH", $month[
"month"]);
248 $tpl->setVariable(
"VAL_NUMBER_OF_ACC", $month[
"cnt"]);
249 $tpl->parseCurrentBlock();
261 if (!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
263 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
266 if (!isset(
$_POST[
"month"]))
268 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
270 $nr = $this->
object->getTotalOlderThanMonth(
$_POST[
"month"]);
271 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_confirm_data_deletion.html");
272 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
273 # "&cmd=gateway&month=".$_POST["month"]);
274 $this->ctrl->setParameter($this,
'month',
$_POST[
'month']);
275 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
277 $tpl->setVariable(
"TXT_CONFIRMATION", $this->lng->txt(
"tracking_data_del_confirm"));
278 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
279 $tpl->setVariable(
"VAL_MONTH",
$_POST[
"month"]);
280 $tpl->setVariable(
"TXT_NUMBER_OF_RECORDS", $lng->txt(
"number_of_records"));
281 $tpl->setVariable(
"VAL_NUMBER_OF_RECORDS", $nr);
282 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
283 $tpl->setVariable(
"TXT_DELETE_DATA", $lng->txt(
"delete_tr_data"));
284 $tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
292 $this->ctrl->redirect($this,
'manageData');
302 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
304 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
307 $this->
object->deleteTrackingDataBeforeMonth(
$_GET[
"month"]);
310 $this->ctrl->redirect($this,
'manageData');
312 #ilUtil::redirect("adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=manageData");
321 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.usr_tracking.html");
322 $tpl->setVariable(
"FORM", $this->
showForm());
328 for ($i = 2004; $i <= date(
"Y"); $i++) $year[] = $i;
329 $month = array(1,2,3,4,5,6,7,8,9,10,11,12);
330 $day = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
335 $this->tabs_gui->setTabActive(
'tracking_data');
339 $tpl->setCurrentBlock(
"user_stat");
340 $tpl->setVariable(
"TXT_VIEW_MODE_U", $lng->txt(
"vm_access_of_users"));
343 $tpl->setVariable(
"U_SEL",
"selected");
345 $tpl->parseCurrentBlock();
349 #$tpl->setVariable("SEARCH_ACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
352 $tpl->setVariable(
"SEARCH_ACTION",$this->ctrl->getFormaction($this,
'gateway'));
353 $tpl->setVariable(
"TXT_TRACKING_DATA", $lng->txt(
"tracking_data"));
354 $tpl->setVariable(
"TXT_SEARCH_TERMS", $lng->txt(
"search_terms"));
356 $tpl->setVariable(
"TXT_TIME_SEGMENT", $lng->txt(
"time_segment"));
357 $tpl->setVariable(
"TXT_VIEW_MODE", $lng->txt(
"view_mode"));
358 $tpl->setVariable(
"TXT_VIEW_MODE_H", $lng->txt(
"vm_times_of_day"));
359 $tpl->setVariable(
"TXT_VIEW_MODE_D", $lng->txt(
"vm_days_of_period"));
360 $tpl->setVariable(
"TXT_USER_LANGUAGE",$lng->txt(
"user_language"));
361 $tpl->setVariable(
"TXT_LM",$lng->txt(
"lm"));
362 $tpl->setVariable(
"TXT_HTLM",$lng->txt(
"htlm"));
363 # $tpl->setVariable("TXT_TST",$lng->txt("test"));
364 $tpl->setVariable(
"TXT_SHOW_TR_DATA",$lng->txt(
"query_data"));
365 $tpl->setVariable(
"TXT_TRACKED_OBJECTS",$lng->txt(
"tracked_objects"));
366 $tpl->setVariable(
"TXT_FILTER_AREA",$lng->txt(
"trac_filter_area"));
367 $tpl->setVariable(
"TXT_CHANGE",$lng->txt(
"change"));
369 $languages = $lng->getInstalledLanguages();
418 foreach($year as
$key)
420 $tpl->setCurrentBlock(
"fromyear_selection");
421 $tpl->setVariable(
"YEARFR", $key);
422 $tpl->setVariable(
"YEARF", $key);
425 $tpl->setVariable(
"YEARF_SEL",
" selected=\"1\" ");
427 $tpl->parseCurrentBlock();
429 foreach($month as $key)
431 $tpl->setCurrentBlock(
"frommonth_selection");
432 $tpl->setVariable(
"MONTHFR", $key);
433 $tpl->setVariable(
"MONTHF", $key);
434 if (
$_SESSION[
"il_track_monthf"] == $key)
436 $tpl->setVariable(
"MONTHF_SEL",
" selected=\"1\" ");
438 $tpl->parseCurrentBlock();
440 foreach($day as $key)
442 $tpl->setCurrentBlock(
"fromday_selection");
443 $tpl->setVariable(
"DAYFR", $key);
444 $tpl->setVariable(
"DAYF", $key);
447 $tpl->setVariable(
"DAYF_SEL",
" selected=\"1\" ");
449 $tpl->parseCurrentBlock();
451 foreach($day as $key)
453 $tpl->setCurrentBlock(
"today_selection");
454 $tpl->setVariable(
"DAYTO", $key);
455 $tpl->setVariable(
"DAYT", $key);
458 $tpl->setVariable(
"DAYT_SEL",
" selected=\"1\" ");
460 $tpl->parseCurrentBlock();
462 foreach($month as $key)
464 $tpl->setCurrentBlock(
"tomonth_selection");
465 $tpl->setVariable(
"MONTHTO", $key);
466 $tpl->setVariable(
"MONTHT", $key);
467 if (
$_SESSION[
"il_track_montht"] == $key)
469 $tpl->setVariable(
"MONTHT_SEL",
" selected=\"1\" ");
471 $tpl->parseCurrentBlock();
473 foreach($year as $key)
475 $tpl->setCurrentBlock(
"toyear_selection");
476 $tpl->setVariable(
"YEARTO", $key);
477 $tpl->setVariable(
"YEART", $key);
480 $tpl->setVariable(
"YEART_SEL",
" selected=\"1\" ");
482 $tpl->parseCurrentBlock();
485 $tpl->setCurrentBlock(
"language_selection");
486 $tpl->setVariable(
"LANG", $lng->txt(
"any_language"));
487 $tpl->setVariable(
"LANGSHORT",
"0");
488 $tpl->parseCurrentBlock();
489 foreach ($languages as $lang_key)
491 $tpl->setCurrentBlock(
"language_selection");
492 $tpl->setVariable(
"LANG", $lng->txt(
"lang_".$lang_key));
493 $tpl->setVariable(
"LANGSHORT", $lang_key);
494 if (
$_SESSION[
"il_track_language"] == $lang_key)
496 $tpl->setVariable(
"LANG_SEL",
" selected=\"1\" ");
498 $tpl->parseCurrentBlock();
502 if (!in_array(
$_SESSION[
"il_track_stat"], array(
"d",
"h",
"o",
"u")))
$_SESSION[
"il_track_stat"] =
"d";
506 $tpl->setVariable(
"D_SEL",
"selected");
510 $tpl->setVariable(
"H_SEL",
"selected");
514 $tpl->setVariable(strtoupper(
$_SESSION[
"il_object_type"]).
"_SEL",
"selected");
578 'lm' => $lng->txt(
"lm"),
579 'htlm' => $lng->txt(
"htlm"),
580 'tst' => $lng->txt(
"test")
583 include_once
"./Services/Table/classes/class.ilTableGUI.php";
585 if(!in_array(
$_POST[
"stat"], array(
"d",
"h",
"o",
"u")))
610 $monthf =
$_POST[
"monthf"];
613 $montht=
$_POST[
"montht"];
615 $from = date(
"Y-m-d", mktime(12, 0, 0, $monthf, $dayf, $yearf));
616 $to = date(
"Y-m-d", mktime(12, 0, 0, $montht, $dayt, $yeart));
618 if(($yearf > $yeart)or($yearf==$yeart and $monthf>$montht)or($yearf==$yeart and $monthf==$montht and $dayf>$dayt))
620 $this->ilias->raiseError($lng->txt(
"msg_err_search_time"),
621 $this->ilias->error_obj->MESSAGE);
624 $condition = $this->
getCondition().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
633 $tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_result.html");
634 $tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
636 $tpl->setVariable(
"FORM", $this->
showForm());
638 $objectCondition =
"";
640 if (($max_acc_objects = $this->object->countResults($condition)) == 0)
642 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
643 $this->ilias->error_obj->MESSAGE);
646 $max_hits = $ilias->getSetting(
'search_max_hits', 50);
648 if (
$_POST[
"search_terms"] !=
"")
650 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
651 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
654 $tbl->setTemplate($tplTable);
657 $acc_object = $this->
object->getAccessTotalPerObj($condition,$searchTermsCondition);
659 $max_acc_objects = count($acc_object);
661 if ($max_acc_objects < 1)
663 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
664 $this->ilias->error_obj->MESSAGE);
668 $info = sprintf($lng->txt(
"info_found_objects"), $TYPES[
$_POST[
"object_type"]]);
670 if ($max_hits < $max_acc_objects)
672 $info .=
" ".sprintf($lng->txt(
"found_too_much_objects"), $max_hits);
674 for ($i = 0; $i < count($acc_object) && $i < $max_hits; $i++)
676 $tmp[$i] = $acc_object[$i];
679 $max_acc_objects = $max_hits;
682 $tpl->setVariable(
"INFO", $info);
685 $tbl->setTitle($lng->txt(
"found_objects"),0,0);
686 # if(($_POST["object_type"]=="lm" and $_POST["author"] == "0") or ($_POST["object_type"]=="tst" and $_POST["author1"] == "0"))
688 $title_new = array(
"author",
"subject",
"total_dwell_time",
"count",
"");
689 $tbl->setColumnWidth(array(
"20%",
"30%",
"20%",
"10%",
"*"));
693 # $title_new = array("subject", "count","");
694 # $tbl->setColumnWidth(array("30%", "10%", "*"));
696 foreach ($title_new as $val)
698 $header_names[] = $lng->txt($val);
700 $tbl->disable(
"sort");
701 $tbl->setHeaderNames($header_names);
702 $tbl->setMaxCount($max_acc_objects);
703 # $tbl->setStyle("table", "std");
707 for ($i = 0; $i < count($acc_object); $i++)
709 $max = ($max > $acc_object[$i][
"cnt"]) ? $max : $acc_object[$i][
"cnt"];
710 $ids[$i] = $acc_object[$i][
"id"];
714 $objectCondition =
" AND acc_obj_id IN (".implode(
",", $ids).
") ";
717 for ($i = 0; $i < count($acc_object); $i++)
720 # if(($_POST["object_type"]=="lm" and $_POST["author"]=="0") or ($_POST["object_type"]=="tst" and $_POST["author1"]=="0"))
722 $data[0] = $acc_object[$i][
"author"];
723 $data[1] = $acc_object[$i][
"title"];
725 $data[3] = $acc_object[$i][
"cnt"];
727 ? round(
$data[3] / $max * 100)
729 $data[4] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
730 "width=\"".$width.
"\" height=\"10\"/>";
742 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
749 $tplTable->setCurrentBlock(
"text");
750 $tplTable->setVariable(
"TEXT_CONTENT", $val);
751 $tplTable->parseCurrentBlock();
752 $tplTable->setCurrentBlock(
"table_cell");
753 $tplTable->parseCurrentBlock();
755 $tplTable->setCurrentBlock(
"tbl_content");
756 $tplTable->setVariable(
"CSS_ROW", $css_row);
757 $tplTable->parseCurrentBlock();
761 $tpl->setVariable(
"OBJECTS_TABLE", $tplTable->get());
762 $tpl->setVariable(
"TXT_INFO_DWELL_TIME", $lng->txt(
"info_dwell_time"));
768 $tpl->setVariable(
"INFO", sprintf($lng->txt(
"info_all_objects"), $TYPES[
$_POST[
"object_type"]]));
771 if ($max_acc_objects > 0)
774 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
775 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
778 $tbl->setTemplate($tplTable);
783 if(
$_POST[
"mode"] ==
"user")
785 $tpl->setCurrentBlock(
"user_mode");
786 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
788 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
789 if(
$_POST[
"object_type"]==
"lm")
791 $tpl->setVariable(
"AUTHOR",
"author");
792 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
793 $tpl->setVariable(
"OBJECT",
"lm");
794 $tpl->setVariable(
"OBJECTS",
$_POST[
"lm"]);
796 else if(
$_POST[
"object_type"]==
"htlm")
798 $tpl->setVariable(
"AUTHOR",
"author");
799 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
800 $tpl->setVariable(
"OBJECT",
"htlm");
801 $tpl->setVariable(
"OBJECTS",
$_POST[
"htlm"]);
805 $tpl->setVariable(
"AUTHOR",
"author1");
806 $tpl->setVariable(
"AUTHORS",
$_POST[
"author1"]);
807 $tpl->setVariable(
"OBJECT",
"tst");
808 $tpl->setVariable(
"OBJECTS",
$_POST[
"tst"]);
810 $tpl->setVariable(
"YEARF",
$_POST[
"yearf"]);
811 $tpl->setVariable(
"MONTHF",
$_POST[
"monthf"]);
812 $tpl->setVariable(
"DAYF",
$_POST[
"dayf"]);
813 $tpl->setVariable(
"YEART",
$_POST[
"yeart"]);
814 $tpl->setVariable(
"MONTHT",
$_POST[
"montht"]);
815 $tpl->setVariable(
"DAYT",
$_POST[
"dayt"]);
816 $tpl->setVariable(
"LAN",
$_POST[
"language"]);
817 $tpl->setVariable(
"TYPE",
$_POST[
"object_type"]);
819 $tpl->setVariable(
"FROM", $from);
820 $tpl->setVariable(
"TO", $to);
821 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_statistics"));
822 $tpl->parseCurrentBlock();
824 $title_new = array(
"user",
"client_ip",
"language",
"object",
"time");
825 $condition = $this->
getConditions().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
827 $user_acc = $this->
object->getAccessPerUserDetail($condition, $searchTermsCondition, $objectCondition);
828 $this->maxcount = count($user_acc);
829 if ($this->maxcount < 1)
831 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
832 $this->ilias->error_obj->MESSAGE);
835 # $tbl->setTitle($lng->txt("search_result"),0,0);
836 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users").
" [".$lng->txt(
"details").
"]",0,0);
837 unset($header_names);
838 foreach ($title_new as $val)
840 $header_names[] = $lng->txt($val);
842 $tbl->disable(
"sort");
844 $tbl->setHeaderNames($header_names);
845 $tbl->setColumnWidth(array(
"20%",
"15%",
"15%",
"30%",
"*"));
846 $tbl->setMaxCount($this->maxcount);
847 # $tbl->setStyle("table", "std");
852 foreach ($user_acc as
$user)
855 $data[0] = $user[
"name"];
856 $data[1] = $user[
"client_ip"];
857 $data[2] = $user[
"language"];
858 $data[3] = $user[
"acc_obj_id"];
859 $data[4] = $user[
"acc_time"];
860 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
867 $tplTable->setCurrentBlock(
"text");
868 $tplTable->setVariable(
"TEXT_CONTENT", $val);
869 $tplTable->parseCurrentBlock();
870 $tplTable->setCurrentBlock(
"table_cell");
871 $tplTable->parseCurrentBlock();
873 $tplTable->setCurrentBlock(
"tbl_content");
874 $tplTable->setVariable(
"CSS_ROW", $css_row);
875 $tplTable->parseCurrentBlock();
881 $tpl->setCurrentBlock(
"user_mode");
882 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
884 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
885 if(
$_POST[
"object_type"]==
"lm")
887 $tpl->setVariable(
"AUTHOR",
"author");
888 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
889 $tpl->setVariable(
"OBJECT",
"lm");
890 $tpl->setVariable(
"OBJECTS",
$_POST[
"lm"]);
892 else if(
$_POST[
"object_type"]==
"htlm")
894 $tpl->setVariable(
"AUTHOR",
"author");
895 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
896 $tpl->setVariable(
"OBJECT",
"htlm");
897 $tpl->setVariable(
"OBJECTS",
$_POST[
"htlm"]);
901 $tpl->setVariable(
"AUTHOR",
"author1");
902 $tpl->setVariable(
"AUTHORS",
$_POST[
"author1"]);
903 $tpl->setVariable(
"OBJECT",
"tst");
904 $tpl->setVariable(
"OBJECTS",
$_POST[
"tst"]);
906 $tpl->setVariable(
"YEARF",
$_POST[
"yearf"]);
907 $tpl->setVariable(
"MONTHF",
$_POST[
"monthf"]);
908 $tpl->setVariable(
"DAYF",
$_POST[
"dayf"]);
909 $tpl->setVariable(
"YEART",
$_POST[
"yeart"]);
910 $tpl->setVariable(
"MONTHT",
$_POST[
"montht"]);
911 $tpl->setVariable(
"DAYT",
$_POST[
"dayt"]);
912 $tpl->setVariable(
"USER",
"user");
913 $tpl->setVariable(
"LAN",
$_POST[
"language"]);
914 $tpl->setVariable(
"TYPE",
$_POST[
"object_type"]);
916 $tpl->setVariable(
"FROM", $from);
917 $tpl->setVariable(
"TO", $to);
918 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_detail"));
919 $tpl->parseCurrentBlock();
920 $title_new = array(
"user",
"count",
"");
923 $user_acc = $this->
object->getAccessTotalPerUser($condition, $searchTermsCondition, $objectCondition);
925 $this->maxcount = count($user_acc);
928 if ($this->maxcount < 1)
930 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
931 $this->ilias->error_obj->MESSAGE);
934 # $tbl->setTitle($lng->txt("search_result"),0,0);
935 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users"),0,0);
936 unset($header_names);
937 foreach ($title_new as $val)
939 $header_names[] = $lng->txt($val);
941 $tbl->disable(
"sort");
942 $tbl->setHeaderNames($header_names);
943 $tbl->setColumnWidth(array(
"20%",
"10%",
"*"));
944 $tbl->setMaxCount($this->maxcount);
945 # $tbl->setStyle("table", "std");
948 foreach ($user_acc as
$user)
950 $max = ($max > $user[
"cnt"]) ? $max : $user[
"cnt"];
954 foreach ($user_acc as $user)
957 $data[0] = $user[
"name"];
958 $data[1] = $user[
"cnt"];
960 ? round(
$data[1] / $max * 100)
962 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
963 "width=\"".$width.
"\" height=\"10\"/>";
965 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
972 $tplTable->setCurrentBlock(
"text");
973 $tplTable->setVariable(
"TEXT_CONTENT", $val);
974 $tplTable->parseCurrentBlock();
975 $tplTable->setCurrentBlock(
"table_cell");
976 $tplTable->parseCurrentBlock();
978 $tplTable->setCurrentBlock(
"tbl_content");
979 $tplTable->setVariable(
"CSS_ROW", $css_row);
980 $tplTable->parseCurrentBlock();
988 $title_new = array(
"time",
"count",
"");
990 # $tbl->setTitle($lng->txt("obj_trac"),0,0);
991 unset($header_names);
992 foreach ($title_new as $val)
994 $header_names[] = $lng->txt($val);
996 $tbl->disable(
"sort");
997 $tbl->setHeaderNames($header_names);
1000 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_times_of_day"),0,0);
1001 $tbl->setColumnWidth(array(
"30%",
"10%",
"*"));
1005 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_days_of_period"),0,0);
1006 $tbl->setColumnWidth(array(
"15%",
"10%",
"*"));
1012 $tbl->setMaxCount($num);
1016 $num = $this->
numDay($from,$to);
1017 $from1 = $this->
addDay($from);
1018 $tbl->setMaxCount($num);
1020 # $tbl->setStyle("table", "std");
1028 $time = $this->
selectTime($from,$to,$condition,$searchTermsCondition,$objectCondition);
1030 for($i=0;$i<24;$i++)
1036 for($j=0;$j<count($time);$j++)
1038 $time1 = strtotime($time[$j][0]);
1039 $day = date(
"d",$time1);
1040 $month = date(
"m",$time1);
1041 $year = date(
"Y",$time1);
1042 $hour = date(
"H",$time1);
1043 $min = date(
"i",$time1);
1044 $sec = date(
"s",$time1);
1045 $numb = date(
"H",mktime($hour,$min,$sec,$month,$day,$year));
1046 $numb = intval($numb);
1047 if($numb >=$i and $numb <$k)
1053 $max = ($cou > $max) ? $cou : $max;
1056 for($i=0;$i<24;$i++)
1060 $data[0] = ($i < 10 ?
"0".$i : $i).
":00:00 ~ ".($k < 10 ?
"0".$k : $k).
":00:00";
1061 $data[1] = $count[$i];
1063 ? round($count[$i] / $max * 100)
1065 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1066 "width=\"".$width.
"\" height=\"10\"/>";
1068 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1071 $tplTable->setCurrentBlock(
"text");
1072 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1073 $tplTable->parseCurrentBlock();
1074 $tplTable->setCurrentBlock(
"table_cell");
1075 $tplTable->parseCurrentBlock();
1077 $tplTable->setCurrentBlock(
"tbl_content");
1078 $tplTable->setVariable(
"CSS_ROW", $css_row);
1079 $tplTable->parseCurrentBlock();
1086 for($i=0;$i<$num;$i++)
1089 $cou[$i] = $this->
countNum($from,$from1,$condition,$searchTermsCondition,$objectCondition);
1091 $from1 = $this->
addDay($from);
1092 $max = ($max > $cou[$i]) ? $max : $cou[$i];
1094 for($i=0;$i<$num;$i++)
1097 $data[0] = $fro[$i];
1098 $data[1] = $cou[$i];
1100 ? round($cou[$i] / $max * 100)
1102 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1103 "width=\"".$width.
"\" height=\"10\"/>";
1105 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1108 $tplTable->setCurrentBlock(
"text");
1109 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1110 $tplTable->parseCurrentBlock();
1111 $tplTable->setCurrentBlock(
"table_cell");
1112 $tplTable->parseCurrentBlock();
1114 $tplTable->setCurrentBlock(
"tbl_content");
1115 $tplTable->setVariable(
"CSS_ROW", $css_row);
1116 $tplTable->parseCurrentBlock();
1122 $tpl->setVariable(
"TRACK_TABLE", $tplTable->get());
1184 if ($lang_cond ==
"")
1191 $this->
setConditions($lang_cond.
" AND ".$this->getObjectCondition());
1206 if(
$_POST[
"object_type"]==
"lm")
1208 if(
$_POST[
"author"]==
"0")
1210 return " acc_obj_type = 'lm'";
1216 foreach ($authors as $author)
1218 if($author[
"title"]==
$_POST[
"author"])
1222 foreach ($lms as $lm)
1224 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1230 return " ( 0 ".$condition.
" ) ";
1234 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"lm"],
$type);
1239 else if(
$_POST[
"object_type"]==
"htlm")
1241 if(
$_POST[
"author"]==
"0")
1243 return " acc_obj_type = 'htlm'";
1249 foreach ($authors as $author)
1251 if($author[
"title"]==
$_POST[
"author"])
1255 foreach ($htlms as $htlm)
1257 $condition = $condition.
" or acc_obj_id = ".$htlm[
"obj_id"];
1263 return " ( 0 ".$condition.
" ) ";
1267 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"htlm"],
$type);
1274 if(
$_POST[
"author1"]==
"0")
1276 return " acc_obj_type = 'tst'";
1282 foreach ($authors as $author)
1284 if($author[
"title"]==
$_POST[
"author1"])
1288 foreach ($lms as $lm)
1290 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1296 return " ( 0 ".$condition.
" ) ";
1300 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"tst"],
$type);
1313 if (
$_POST[
"language"] !=
"0")
1315 return "ut_access.language =".$ilDB->quote(
$_POST[
"language"],
"text");
1328 if (trim(
$_POST[
"search_terms"]) !=
"")
1331 $terms = explode(
" ",
$_POST[
"search_terms"]);
1332 for ($i = 0; $i < count($terms); $i++)
1334 if (trim($terms[$i]) !=
"") $sub_ret .=
"oa.title LIKE '%".
ilUtil::addSlashes(trim($terms[$i])).
"%' OR ";
1338 return " INNER JOIN object_data oa ON oa.obj_id = acc_obj_id WHERE (".substr($sub_ret, 0, strlen($sub_ret)-4) .
") AND ";
1347 $this->conditions = $con;
1360 $from = strtotime($from);
1361 $to = strtotime($to);
1363 $dayf = date (
"d",$from);
1364 $dayt = date (
"d",$to);
1365 $yearf = date (
"Y",$from);
1366 $yeart = date (
"Y",$to);
1367 $montht = date (
"m",$to);
1368 $monthf = date (
"m",$from);
1370 # $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
1373 $from = mktime(12,0,0,$monthf,$dayf,$yearf);
1374 $to = mktime(12,0,0,$montht,$dayt,$yeart);
1376 $ret = (round(($to - $from) / 86400) + 1);
1379 # $x0 = gregoriantojd($monthf,$dayf,$yearf);
1380 # $x1 = gregoriantojd($montht,$dayt,$yeart);
1381 # return (($x1 - $x0)+1);
1389 $from = strtotime($from);
1390 $to = strtotime($to);
1391 $dayf = date (
"d",$from);
1392 $dayt = date (
"d",$to);
1393 $yearf = date (
"Y",$from);
1394 $yeart = date (
"Y",$to);
1395 $montht = date (
"m",$to);
1396 $monthf = date (
"m",$from);
1397 $hourt = date (
"h",$to);
1398 $hourf = date (
"h",$from);
1399 $ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
1409 $time = strtotime($time);
1410 $day = date(
"d",$time);
1411 $month = date(
"m",$time);
1412 $year = date(
"Y",$time);
1413 $hour = date(
"H",$time);
1414 $min = date(
"i",$time);
1415 $sec = date(
"s",$time);
1417 $ret = date(
"H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
1426 $time = strtotime($time);
1427 $day = date(
"d",$time);
1428 $month = date(
"m",$time);
1429 $year = date(
"y",$time);
1430 $min = date(
"i",$time);
1431 $hour = date(
"h",$time);
1432 $sec = date(
"s",$time);
1434 $ret = date (
"Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
1441 function selectTime($from,$to,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1445 $q =
"SELECT acc_time from ut_access "
1446 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1447 .
" (acc_time >= ".$ilDB->quote($from.
" 00:00:00",
"timestamp")
1448 .
" AND acc_time <= ".$ilDB->quote($to.
" 23:59:59",
"timestamp").
")"
1451 .
" GROUP BY acc_time";
1452 $res = $this->ilias->db->query(
$q);
1453 for($i=0;$i<
$res->numRows();$i++)
1463 function countNum($from,$from1,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1467 $q =
"SELECT id FROM ut_access"
1468 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1469 .
" (acc_time >= ".$ilDB->quote($from.
" 00:00:00",
"timestamp")
1470 .
" AND acc_time <= ".$ilDB->quote($from1.
" 00:00:00",
"timestamp").
")"
1474 $res = $this->ilias->db->query(
$q);
1475 return $res->numRows();