39 include_once
"classes/class.ilObjectGUI.php";
59 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
64 $this->lng->loadLanguageModule(
'trac');
71 $next_class = $this->ctrl->getNextClass();
72 $this->ctrl->setReturn($this,
"show");
77 case 'ilpermissiongui':
78 include_once(
"./classes/class.ilPermissionGUI.php");
80 $ret =& $this->ctrl->forwardCommand($perm_gui);
83 case 'illearningprogressgui':
84 $this->tabs_gui->setTabActive(
'learning_progress');
85 include_once(
"./Services/Tracking/classes/class.ilLearningProgressGUI.php");
87 $ret =& $this->ctrl->forwardCommand($lp_gui);
91 $cmd = $this->ctrl->getCmd();
94 $cmd =
"trackingDataQueryForm";
113 $this->ctrl->setParameter($this,
"ref_id",$this->ref_id);
115 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
117 $tabs_gui->addTarget(
"tracking_data",
118 $this->ctrl->getLinkTarget($this,
119 "trackingDataQueryForm"),
120 "trackingDataQueryForm",
122 $tabs_gui->addTarget(
"settings",
123 $this->ctrl->getLinkTarget($this,
127 $tabs_gui->addTarget(
"manage_tracking_data",
128 $this->ctrl->getLinkTarget($this,
135 $tabs_gui->addTarget(
"learning_progress",
136 $this->ctrl->getLinkTargetByClass(
"illearningprogressgui",
139 "illearningprogressgui");
141 $tabs_gui->addTarget(
"perm_settings",
142 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
143 array(
"perm",
"info",
"owner"),
156 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
158 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read_track"),
$ilErr->WARNING);
161 $this->tabs_gui->setTabActive(
'settings');
164 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.trac_settings.html",
"Services/Tracking");
165 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this));
169 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'tracking_settings'));
170 $this->tpl->setVariable(
"TXT_TRACKING_SETTINGS", $this->lng->txt(
"tracking_settings"));
171 $this->tpl->setVariable(
"TXT_ACTIVATE_TRACKING", $this->lng->txt(
"activate_tracking"));
172 $this->tpl->setVariable(
"TXT_USER_RELATED_DATA", $this->lng->txt(
"trac_anonymized"));
173 $this->tpl->setVariable(
"INFO_USER_RELATED_DATA",$this->lng->txt(
"trac_anonymized_info"));
174 $this->tpl->setVariable(
"TXT_VALID_REQUEST",$this->lng->txt(
'trac_valid_request'));
175 $this->tpl->setVariable(
"INFO_VALID_REQUEST",$this->lng->txt(
'info_valid_request'));
176 $this->tpl->setVariable(
"SECONDS",$this->lng->txt(
'seconds'));
178 #$this->tpl->setVariable("TXT_NUMBER_RECORDS", $this->lng->txt("number_of_records"));
179 #$this->tpl->setVariable("NUMBER_RECORDS", $this->object->getRecordsTotal());
180 $this->tpl->setVariable(
"TXT_SAVE", $this->lng->txt(
"save"));
183 $this->tpl->setVariable(
'TXT_USER_TRACKING', $this->lng->txt(
'trac_user_activities'));
184 $this->tpl->setVariable(
'TXT_LEARNING_PROGRESS_TRACKING', $this->lng->txt(
'trac_learning_progress'));
185 $this->tpl->setVariable(
'TXT_CHANGE_EVENT_TRACKING', $this->lng->txt(
'trac_repository_changes'));
189 $this->tpl->setVariable(
'USER_TRACKING_CHECKED',
' checked="1" ');
194 $this->tpl->setVariable(
'LEARNING_PROGRESS_TRACKING_CHECKED',
' checked="1" ');
196 if($this->object->isChangeEventTrackingEnabled())
198 $this->tpl->setVariable(
'CHANGE_EVENT_TRACKING_CHECKED',
' checked="1" ');
203 if(!$this->object->_enabledUserRelatedData())
205 $this->tpl->setVariable(
"USER_RELATED_CHECKED",
" checked=\"1\" ");
208 $this->tpl->setVariable(
"VALID_REQUEST",$this->object->getValidTimeSpan());
218 if ($_POST[
'user_tracking'] ==
'1')
226 $this->
object->setActivationStatus($activation_status);
227 $this->
object->setChangeEventTrackingEnabled($_POST[
'change_event_tracking'] ==
'1');
230 $this->
object->enableUserRelatedData((
int) !$_POST[
'user_related']);
231 $this->
object->setValidTimeSpan($_POST[
'valid_request']);
233 if(!$this->object->validateSettings())
241 $this->
object->updateSettings();
256 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_manage_data.html");
257 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
258 $tpl->setVariable(
"TXT_TRACKING_DATA", $this->lng->txt(
"tracking_data"));
259 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
260 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
261 $tpl->setVariable(
"TXT_DELETE_OLDER", $lng->txt(
"delete"));
262 $overw = $this->
object->getMonthTotalOverview();
263 foreach($overw as $month)
265 $tpl->setCurrentBlock(
"load_row");
266 $rcol = ($rcol !=
"tblrow1") ?
"tblrow1" :
"tblrow2";
267 $tpl->setVariable(
"ROWCOL", $rcol);
268 $tpl->setVariable(
"VAL_MONTH", $month[
"month"]);
269 $tpl->setVariable(
"VAL_NUMBER_OF_ACC", $month[
"cnt"]);
270 $tpl->parseCurrentBlock();
272 $tpl->parseCurrentBlock();
282 if (!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
284 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
287 if (!isset($_POST[
"month"]))
289 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
291 $nr = $this->
object->getTotalOlderThanMonth($_POST[
"month"]);
292 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_confirm_data_deletion.html");
293 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
294 # "&cmd=gateway&month=".$_POST["month"]);
295 $this->ctrl->setParameter($this,
'month',$_POST[
'month']);
296 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
298 $tpl->setVariable(
"TXT_CONFIRMATION", $this->lng->txt(
"tracking_data_del_confirm"));
299 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
300 $tpl->setVariable(
"VAL_MONTH", $_POST[
"month"]);
301 $tpl->setVariable(
"TXT_NUMBER_OF_RECORDS", $lng->txt(
"number_of_records"));
302 $tpl->setVariable(
"VAL_NUMBER_OF_RECORDS", $nr);
303 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
304 $tpl->setVariable(
"TXT_DELETE_DATA", $lng->txt(
"delete_tr_data"));
305 $tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
315 #ilUtil::redirect("adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=manageData");
317 $this->ctrl->redirect($this,
'manageData');
327 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
329 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
332 $this->
object->deleteTrackingDataBeforeMonth(
$_GET[
"month"]);
335 $this->ctrl->redirect($this,
'manageData');
337 #ilUtil::redirect("adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=manageData");
346 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.usr_tracking.html");
347 $tpl->setVariable(
"FORM", $this->
showForm());
353 for ($i = 2004; $i <= date(
"Y"); $i++) $year[] = $i;
354 $month = array(1,2,3,4,5,6,7,8,9,10,11,12);
355 $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);
360 $this->tabs_gui->setTabActive(
'tracking_data');
364 $tpl->setCurrentBlock(
"user_stat");
365 $tpl->setVariable(
"TXT_VIEW_MODE_U", $lng->txt(
"vm_access_of_users"));
368 $tpl->setVariable(
"U_SEL",
"selected");
370 $tpl->parseCurrentBlock();
374 #$tpl->setVariable("SEARCH_ACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
377 $tpl->setVariable(
"SEARCH_ACTION",$this->ctrl->getFormaction($this,
'gateway'));
378 $tpl->setVariable(
"TXT_TRACKING_DATA", $lng->txt(
"tracking_data"));
379 $tpl->setVariable(
"TXT_SEARCH_TERMS", $lng->txt(
"search_terms"));
381 $tpl->setVariable(
"TXT_TIME_SEGMENT", $lng->txt(
"time_segment"));
382 $tpl->setVariable(
"TXT_VIEW_MODE", $lng->txt(
"view_mode"));
383 $tpl->setVariable(
"TXT_VIEW_MODE_H", $lng->txt(
"vm_times_of_day"));
384 $tpl->setVariable(
"TXT_VIEW_MODE_D", $lng->txt(
"vm_days_of_period"));
385 $tpl->setVariable(
"TXT_USER_LANGUAGE",$lng->txt(
"user_language"));
386 $tpl->setVariable(
"TXT_LM",$lng->txt(
"lm"));
387 $tpl->setVariable(
"TXT_HTLM",$lng->txt(
"htlm"));
388 # $tpl->setVariable("TXT_TST",$lng->txt("test"));
389 $tpl->setVariable(
"TXT_SHOW_TR_DATA",$lng->txt(
"query_data"));
390 $tpl->setVariable(
"TXT_TRACKED_OBJECTS",$lng->txt(
"tracked_objects"));
391 $tpl->setVariable(
"TXT_FILTER_AREA",$lng->txt(
"trac_filter_area"));
392 $tpl->setVariable(
"TXT_CHANGE",$lng->txt(
"change"));
394 $languages = $lng->getInstalledLanguages();
443 foreach($year as $key)
445 $tpl->setCurrentBlock(
"fromyear_selection");
446 $tpl->setVariable(
"YEARFR", $key);
447 $tpl->setVariable(
"YEARF", $key);
450 $tpl->setVariable(
"YEARF_SEL",
" selected=\"1\" ");
452 $tpl->parseCurrentBlock();
454 foreach($month as $key)
456 $tpl->setCurrentBlock(
"frommonth_selection");
457 $tpl->setVariable(
"MONTHFR", $key);
458 $tpl->setVariable(
"MONTHF", $key);
459 if (
$_SESSION[
"il_track_monthf"] == $key)
461 $tpl->setVariable(
"MONTHF_SEL",
" selected=\"1\" ");
463 $tpl->parseCurrentBlock();
465 foreach($day as $key)
467 $tpl->setCurrentBlock(
"fromday_selection");
468 $tpl->setVariable(
"DAYFR", $key);
469 $tpl->setVariable(
"DAYF", $key);
472 $tpl->setVariable(
"DAYF_SEL",
" selected=\"1\" ");
474 $tpl->parseCurrentBlock();
476 foreach($day as $key)
478 $tpl->setCurrentBlock(
"today_selection");
479 $tpl->setVariable(
"DAYTO", $key);
480 $tpl->setVariable(
"DAYT", $key);
483 $tpl->setVariable(
"DAYT_SEL",
" selected=\"1\" ");
485 $tpl->parseCurrentBlock();
487 foreach($month as $key)
489 $tpl->setCurrentBlock(
"tomonth_selection");
490 $tpl->setVariable(
"MONTHTO", $key);
491 $tpl->setVariable(
"MONTHT", $key);
492 if (
$_SESSION[
"il_track_montht"] == $key)
494 $tpl->setVariable(
"MONTHT_SEL",
" selected=\"1\" ");
496 $tpl->parseCurrentBlock();
498 foreach($year as $key)
500 $tpl->setCurrentBlock(
"toyear_selection");
501 $tpl->setVariable(
"YEARTO", $key);
502 $tpl->setVariable(
"YEART", $key);
505 $tpl->setVariable(
"YEART_SEL",
" selected=\"1\" ");
507 $tpl->parseCurrentBlock();
510 $tpl->setCurrentBlock(
"language_selection");
511 $tpl->setVariable(
"LANG", $lng->txt(
"any_language"));
512 $tpl->setVariable(
"LANGSHORT",
"0");
513 $tpl->parseCurrentBlock();
514 foreach ($languages as $lang_key)
516 $tpl->setCurrentBlock(
"language_selection");
517 $tpl->setVariable(
"LANG", $lng->txt(
"lang_".$lang_key));
518 $tpl->setVariable(
"LANGSHORT", $lang_key);
519 if (
$_SESSION[
"il_track_language"] == $lang_key)
521 $tpl->setVariable(
"LANG_SEL",
" selected=\"1\" ");
523 $tpl->parseCurrentBlock();
527 if (!in_array(
$_SESSION[
"il_track_stat"], array(
"d",
"h",
"o",
"u")))
$_SESSION[
"il_track_stat"] =
"d";
531 $tpl->setVariable(
"D_SEL",
"selected");
533 elseif (
$_SESSION[
"il_track_stat"] ==
"h")
535 $tpl->setVariable(
"H_SEL",
"selected");
539 $tpl->setVariable(strtoupper(
$_SESSION[
"il_object_type"]).
"_SEL",
"selected");
603 'lm' => $lng->txt(
"lm"),
604 'htlm' => $lng->txt(
"htlm"),
605 'tst' => $lng->txt(
"test")
608 include_once
"./Services/Table/classes/class.ilTableGUI.php";
610 if(!in_array($_POST[
"stat"], array(
"d",
"h",
"o",
"u")))
612 $_POST[
"stat"] =
"d";
614 if ($_POST[
"author"] ==
"") $_POST[
"author"] =
"0";
615 if ($_POST[
"author1"] ==
"") $_POST[
"author1"] =
"0";
619 $_SESSION[
"il_track_yearf"] = $_POST[
"yearf"];
620 $_SESSION[
"il_track_yeart"] = $_POST[
"yeart"];
621 $_SESSION[
"il_track_monthf"] = $_POST[
"monthf"];
622 $_SESSION[
"il_track_montht"] = $_POST[
"montht"];
623 $_SESSION[
"il_track_dayf"] = $_POST[
"dayf"];
624 $_SESSION[
"il_track_dayt"] = $_POST[
"dayt"];
625 $_SESSION[
"il_track_stat"] = $_POST[
"stat"];
626 $_SESSION[
"il_track_language"] = $_POST[
"language"];
627 $_SESSION[
"il_track_author"] = $_POST[
"author"];
628 $_SESSION[
"il_track_author1"] = $_POST[
"author1"];
630 $_SESSION[
"il_track_htlm"] = $_POST[
"htlm"];
631 $_SESSION[
"il_track_tst"] = $_POST[
"tst"];
632 $_SESSION[
"il_object_type"] = $_POST[
"object_type"];
634 $yearf = $_POST[
"yearf"];
635 $monthf = $_POST[
"monthf"];
636 $dayf = $_POST[
"dayf"];
637 $yeart = $_POST[
"yeart"];
638 $montht= $_POST[
"montht"];
639 $dayt = $_POST[
"dayt"];
640 $from = date(
"Y-m-d", mktime(12, 0, 0, $monthf, $dayf, $yearf));
641 $to = date(
"Y-m-d", mktime(12, 0, 0, $montht, $dayt, $yeart));
643 if(($yearf > $yeart)or($yearf==$yeart and $monthf>$montht)or($yearf==$yeart and $monthf==$montht and $dayf>$dayt))
645 $this->ilias->raiseError($lng->txt(
"msg_err_search_time"),
646 $this->ilias->error_obj->MESSAGE);
649 $condition = $this->
getCondition().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
658 $tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_result.html");
659 $tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
661 $tpl->setVariable(
"FORM", $this->
showForm());
663 $objectCondition =
"";
665 if (($max_acc_objects = $this->object->countResults($condition)) == 0)
667 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
668 $this->ilias->error_obj->MESSAGE);
671 $max_hits = $ilias->getSetting(
'search_max_hits', 50);
673 if ($_POST[
"search_terms"] !=
"")
675 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
676 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
679 $tbl->setTemplate($tplTable);
682 $acc_object = $this->
object->getAccessTotalPerObj($condition,$searchTermsCondition);
684 $max_acc_objects = count($acc_object);
686 if ($max_acc_objects < 1)
688 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
689 $this->ilias->error_obj->MESSAGE);
693 $info = sprintf($lng->txt(
"info_found_objects"), $TYPES[$_POST[
"object_type"]]);
695 if ($max_hits < $max_acc_objects)
697 $info .=
" ".sprintf($lng->txt(
"found_too_much_objects"), $max_hits);
699 for ($i = 0; $i < count($acc_object) && $i < $max_hits; $i++)
701 $tmp[$i] = $acc_object[$i];
704 $max_acc_objects = $max_hits;
707 $tpl->setVariable(
"INFO", $info);
710 $tbl->setTitle($lng->txt(
"found_objects"),0,0);
711 # if(($_POST["object_type"]=="lm" and $_POST["author"] == "0") or ($_POST["object_type"]=="tst" and $_POST["author1"] == "0"))
713 $title_new = array(
"author",
"subject",
"total_dwell_time",
"count",
"");
714 $tbl->setColumnWidth(array(
"20%",
"30%",
"20%",
"10%",
"*"));
718 # $title_new = array("subject", "count","");
719 # $tbl->setColumnWidth(array("30%", "10%", "*"));
721 foreach ($title_new as $val)
723 $header_names[] = $lng->txt($val);
725 $tbl->disable(
"sort");
726 $tbl->setHeaderNames($header_names);
727 $tbl->setMaxCount($max_acc_objects);
728 # $tbl->setStyle("table", "std");
732 for ($i = 0; $i < count($acc_object); $i++)
734 $max = ($max > $acc_object[$i][
"cnt"]) ? $max : $acc_object[$i][
"cnt"];
735 $ids[$i] = $acc_object[$i][
"id"];
739 $objectCondition =
" AND acc_obj_id IN (".implode(
",", $ids).
") ";
742 for ($i = 0; $i < count($acc_object); $i++)
745 # if(($_POST["object_type"]=="lm" and $_POST["author"]=="0") or ($_POST["object_type"]=="tst" and $_POST["author1"]=="0"))
747 $data[0] = $acc_object[$i][
"author"];
748 $data[1] = $acc_object[$i][
"title"];
750 $data[3] = $acc_object[$i][
"cnt"];
752 ? round(
$data[3] / $max * 100)
754 $data[4] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
755 "width=\"".$width.
"\" height=\"10\"/>";
767 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
768 foreach (
$data as $key => $val)
774 $tplTable->setCurrentBlock(
"text");
775 $tplTable->setVariable(
"TEXT_CONTENT", $val);
776 $tplTable->parseCurrentBlock();
777 $tplTable->setCurrentBlock(
"table_cell");
778 $tplTable->parseCurrentBlock();
780 $tplTable->setCurrentBlock(
"tbl_content");
781 $tplTable->setVariable(
"CSS_ROW", $css_row);
782 $tplTable->parseCurrentBlock();
786 $tpl->setVariable(
"OBJECTS_TABLE", $tplTable->get());
787 $tpl->setVariable(
"TXT_INFO_DWELL_TIME", $lng->txt(
"info_dwell_time"));
793 $tpl->setVariable(
"INFO", sprintf($lng->txt(
"info_all_objects"), $TYPES[$_POST[
"object_type"]]));
796 if ($max_acc_objects > 0)
799 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
800 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
803 $tbl->setTemplate($tplTable);
806 if($_POST[
"stat"] ==
"u")
808 if($_POST[
"mode"] ==
"user")
810 $tpl->setCurrentBlock(
"user_mode");
811 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
813 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
814 if($_POST[
"object_type"]==
"lm")
816 $tpl->setVariable(
"AUTHOR",
"author");
817 $tpl->setVariable(
"AUTHORS", $_POST[
"author"]);
818 $tpl->setVariable(
"OBJECT",
"lm");
819 $tpl->setVariable(
"OBJECTS", $_POST[
"lm"]);
821 else if($_POST[
"object_type"]==
"htlm")
823 $tpl->setVariable(
"AUTHOR",
"author");
824 $tpl->setVariable(
"AUTHORS", $_POST[
"author"]);
825 $tpl->setVariable(
"OBJECT",
"htlm");
826 $tpl->setVariable(
"OBJECTS", $_POST[
"htlm"]);
830 $tpl->setVariable(
"AUTHOR",
"author1");
831 $tpl->setVariable(
"AUTHORS", $_POST[
"author1"]);
832 $tpl->setVariable(
"OBJECT",
"tst");
833 $tpl->setVariable(
"OBJECTS", $_POST[
"tst"]);
835 $tpl->setVariable(
"YEARF",$_POST[
"yearf"]);
836 $tpl->setVariable(
"MONTHF",$_POST[
"monthf"]);
837 $tpl->setVariable(
"DAYF",$_POST[
"dayf"]);
838 $tpl->setVariable(
"YEART",$_POST[
"yeart"]);
839 $tpl->setVariable(
"MONTHT",$_POST[
"montht"]);
840 $tpl->setVariable(
"DAYT",$_POST[
"dayt"]);
841 $tpl->setVariable(
"LAN", $_POST[
"language"]);
842 $tpl->setVariable(
"TYPE", $_POST[
"object_type"]);
844 $tpl->setVariable(
"FROM", $from);
845 $tpl->setVariable(
"TO", $to);
846 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_statistics"));
847 $tpl->parseCurrentBlock();
849 $title_new = array(
"user",
"client_ip",
"language",
"object",
"time");
850 $condition = $this->
getConditions().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
852 $user_acc = $this->
object->getAccessPerUserDetail($condition, $searchTermsCondition, $objectCondition);
853 $this->maxcount = count($user_acc);
854 if ($this->maxcount < 1)
856 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
857 $this->ilias->error_obj->MESSAGE);
860 # $tbl->setTitle($lng->txt("search_result"),0,0);
861 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users").
" [".$lng->txt(
"details").
"]",0,0);
862 unset($header_names);
863 foreach ($title_new as $val)
865 $header_names[] = $lng->txt($val);
867 $tbl->disable(
"sort");
869 $tbl->setHeaderNames($header_names);
870 $tbl->setColumnWidth(array(
"20%",
"15%",
"15%",
"30%",
"*"));
871 $tbl->setMaxCount($this->maxcount);
872 # $tbl->setStyle("table", "std");
877 foreach ($user_acc as
$user)
880 $data[0] = $user[
"name"];
881 $data[1] = $user[
"client_ip"];
882 $data[2] = $user[
"language"];
883 $data[3] = $user[
"acc_obj_id"];
884 $data[4] = $user[
"acc_time"];
885 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
886 foreach (
$data as $key => $val)
892 $tplTable->setCurrentBlock(
"text");
893 $tplTable->setVariable(
"TEXT_CONTENT", $val);
894 $tplTable->parseCurrentBlock();
895 $tplTable->setCurrentBlock(
"table_cell");
896 $tplTable->parseCurrentBlock();
898 $tplTable->setCurrentBlock(
"tbl_content");
899 $tplTable->setVariable(
"CSS_ROW", $css_row);
900 $tplTable->parseCurrentBlock();
906 $tpl->setCurrentBlock(
"user_mode");
907 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
909 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
910 if($_POST[
"object_type"]==
"lm")
912 $tpl->setVariable(
"AUTHOR",
"author");
913 $tpl->setVariable(
"AUTHORS", $_POST[
"author"]);
914 $tpl->setVariable(
"OBJECT",
"lm");
915 $tpl->setVariable(
"OBJECTS", $_POST[
"lm"]);
917 else if($_POST[
"object_type"]==
"htlm")
919 $tpl->setVariable(
"AUTHOR",
"author");
920 $tpl->setVariable(
"AUTHORS", $_POST[
"author"]);
921 $tpl->setVariable(
"OBJECT",
"htlm");
922 $tpl->setVariable(
"OBJECTS", $_POST[
"htlm"]);
926 $tpl->setVariable(
"AUTHOR",
"author1");
927 $tpl->setVariable(
"AUTHORS", $_POST[
"author1"]);
928 $tpl->setVariable(
"OBJECT",
"tst");
929 $tpl->setVariable(
"OBJECTS", $_POST[
"tst"]);
931 $tpl->setVariable(
"YEARF",$_POST[
"yearf"]);
932 $tpl->setVariable(
"MONTHF",$_POST[
"monthf"]);
933 $tpl->setVariable(
"DAYF",$_POST[
"dayf"]);
934 $tpl->setVariable(
"YEART",$_POST[
"yeart"]);
935 $tpl->setVariable(
"MONTHT",$_POST[
"montht"]);
936 $tpl->setVariable(
"DAYT",$_POST[
"dayt"]);
937 $tpl->setVariable(
"USER",
"user");
938 $tpl->setVariable(
"LAN", $_POST[
"language"]);
939 $tpl->setVariable(
"TYPE", $_POST[
"object_type"]);
941 $tpl->setVariable(
"FROM", $from);
942 $tpl->setVariable(
"TO", $to);
943 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_detail"));
944 $tpl->parseCurrentBlock();
945 $title_new = array(
"user",
"count",
"");
948 $user_acc = $this->
object->getAccessTotalPerUser($condition, $searchTermsCondition, $objectCondition);
950 $this->maxcount = count($user_acc);
953 if ($this->maxcount < 1)
955 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
956 $this->ilias->error_obj->MESSAGE);
959 # $tbl->setTitle($lng->txt("search_result"),0,0);
960 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users"),0,0);
961 unset($header_names);
962 foreach ($title_new as $val)
964 $header_names[] = $lng->txt($val);
966 $tbl->disable(
"sort");
967 $tbl->setHeaderNames($header_names);
968 $tbl->setColumnWidth(array(
"20%",
"10%",
"*"));
969 $tbl->setMaxCount($this->maxcount);
970 # $tbl->setStyle("table", "std");
973 foreach ($user_acc as
$user)
975 $max = ($max > $user[
"cnt"]) ? $max : $user[
"cnt"];
979 foreach ($user_acc as $user)
982 $data[0] = $user[
"name"];
983 $data[1] = $user[
"cnt"];
985 ? round(
$data[1] / $max * 100)
987 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
988 "width=\"".$width.
"\" height=\"10\"/>";
990 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
991 foreach (
$data as $key => $val)
997 $tplTable->setCurrentBlock(
"text");
998 $tplTable->setVariable(
"TEXT_CONTENT", $val);
999 $tplTable->parseCurrentBlock();
1000 $tplTable->setCurrentBlock(
"table_cell");
1001 $tplTable->parseCurrentBlock();
1003 $tplTable->setCurrentBlock(
"tbl_content");
1004 $tplTable->setVariable(
"CSS_ROW", $css_row);
1005 $tplTable->parseCurrentBlock();
1013 $title_new = array(
"time",
"count",
"");
1015 # $tbl->setTitle($lng->txt("obj_trac"),0,0);
1016 unset($header_names);
1017 foreach ($title_new as $val)
1019 $header_names[] = $lng->txt($val);
1021 $tbl->disable(
"sort");
1022 $tbl->setHeaderNames($header_names);
1023 if($_POST[
"stat"]==
'h')
1025 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_times_of_day"),0,0);
1026 $tbl->setColumnWidth(array(
"30%",
"10%",
"*"));
1030 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_days_of_period"),0,0);
1031 $tbl->setColumnWidth(array(
"15%",
"10%",
"*"));
1034 if($_POST[
"stat"]==
'h')
1037 $tbl->setMaxCount($num);
1041 $num = $this->
numDay($from,$to);
1042 $from1 = $this->
addDay($from);
1043 $tbl->setMaxCount($num);
1045 # $tbl->setStyle("table", "std");
1050 if($_POST[
"stat"]==
'h')
1053 $time = $this->
selectTime($from,$to,$condition,$searchTermsCondition,$objectCondition);
1055 for($i=0;$i<24;$i++)
1061 for($j=0;$j<count($time);$j++)
1063 $time1 = strtotime($time[$j][0]);
1064 $day = date(
"d",$time1);
1065 $month = date(
"m",$time1);
1066 $year = date(
"Y",$time1);
1067 $hour = date(
"H",$time1);
1068 $min = date(
"i",$time1);
1069 $sec = date(
"s",$time1);
1070 $numb = date(
"H",mktime($hour,$min,$sec,$month,$day,$year));
1071 $numb = intval($numb);
1072 if($numb >=$i and $numb <$k)
1078 $max = ($cou > $max) ? $cou : $max;
1081 for($i=0;$i<24;$i++)
1085 $data[0] = ($i < 10 ?
"0".$i : $i).
":00:00 ~ ".($k < 10 ?
"0".$k : $k).
":00:00";
1086 $data[1] = $count[$i];
1088 ? round($count[$i] / $max * 100)
1090 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1091 "width=\"".$width.
"\" height=\"10\"/>";
1093 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1094 foreach (
$data as $key => $val)
1096 $tplTable->setCurrentBlock(
"text");
1097 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1098 $tplTable->parseCurrentBlock();
1099 $tplTable->setCurrentBlock(
"table_cell");
1100 $tplTable->parseCurrentBlock();
1102 $tplTable->setCurrentBlock(
"tbl_content");
1103 $tplTable->setVariable(
"CSS_ROW", $css_row);
1104 $tplTable->parseCurrentBlock();
1111 for($i=0;$i<$num;$i++)
1114 $cou[$i] = $this->
countNum($from,$from1,$condition,$searchTermsCondition,$objectCondition);
1116 $from1 = $this->
addDay($from);
1117 $max = ($max > $cou[$i]) ? $max : $cou[$i];
1119 for($i=0;$i<$num;$i++)
1122 $data[0] = $fro[$i];
1123 $data[1] = $cou[$i];
1125 ? round($cou[$i] / $max * 100)
1127 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1128 "width=\"".$width.
"\" height=\"10\"/>";
1130 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1131 foreach (
$data as $key => $val)
1133 $tplTable->setCurrentBlock(
"text");
1134 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1135 $tplTable->parseCurrentBlock();
1136 $tplTable->setCurrentBlock(
"table_cell");
1137 $tplTable->parseCurrentBlock();
1139 $tplTable->setCurrentBlock(
"tbl_content");
1140 $tplTable->setVariable(
"CSS_ROW", $css_row);
1141 $tplTable->parseCurrentBlock();
1147 $tpl->setVariable(
"TRACK_TABLE", $tplTable->get());
1209 if ($lang_cond ==
"")
1216 $this->
setConditions($lang_cond.
" AND ".$this->getObjectCondition());
1229 $type = $_POST[
"object_type"];
1231 if($_POST[
"object_type"]==
"lm")
1233 if($_POST[
"author"]==
"0")
1235 return " acc_obj_type = 'lm'";
1237 elseif($_POST[
"lm"]==
"0" or $_POST[
"lm"]==
"")
1241 foreach ($authors as $author)
1243 if($author[
"title"]==$_POST[
"author"])
1247 foreach ($lms as $lm)
1249 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1255 return " ( 0 ".$condition.
" ) ";
1259 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId($_POST[
"lm"],$type);
1264 else if($_POST[
"object_type"]==
"htlm")
1266 if($_POST[
"author"]==
"0")
1268 return " acc_obj_type = 'htlm'";
1270 elseif($_POST[
"htlm"]==
"0" or $_POST[
"htlm"]==
"")
1274 foreach ($authors as $author)
1276 if($author[
"title"]==$_POST[
"author"])
1280 foreach ($htlms as $htlm)
1282 $condition = $condition.
" or acc_obj_id = ".$htlm[
"obj_id"];
1288 return " ( 0 ".$condition.
" ) ";
1292 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId($_POST[
"htlm"],$type);
1299 if($_POST[
"author1"]==
"0")
1301 return " acc_obj_type = 'tst'";
1303 elseif($_POST[
"tst"]==
"0" or $_POST[
"tst"]==
"")
1307 foreach ($authors as $author)
1309 if($author[
"title"]==$_POST[
"author1"])
1313 foreach ($lms as $lm)
1315 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1321 return " ( 0 ".$condition.
" ) ";
1325 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId($_POST[
"tst"],$type);
1338 if ($_POST[
"language"] !=
"0")
1340 return "ut_access.language =".$ilDB->quote($_POST[
"language"]);
1353 if (trim($_POST[
"search_terms"]) !=
"")
1356 $terms = explode(
" ", $_POST[
"search_terms"]);
1357 for ($i = 0; $i < count($terms); $i++)
1359 if (trim($terms[$i]) !=
"") $sub_ret .=
"oa.title LIKE '%".
ilUtil::addSlashes(trim($terms[$i])).
"%' OR ";
1363 return " INNER JOIN object_data AS oa ON oa.obj_id = acc_obj_id WHERE (".substr($sub_ret, 0, strlen($sub_ret)-4) .
") AND ";
1372 $this->conditions = $con;
1385 $from = strtotime($from);
1386 $to = strtotime($to);
1388 $dayf = date (
"d",$from);
1389 $dayt = date (
"d",$to);
1390 $yearf = date (
"Y",$from);
1391 $yeart = date (
"Y",$to);
1392 $montht = date (
"m",$to);
1393 $monthf = date (
"m",$from);
1395 # $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
1398 $from = mktime(12,0,0,$monthf,$dayf,$yearf);
1399 $to = mktime(12,0,0,$montht,$dayt,$yeart);
1401 $ret = (round(($to - $from) / 86400) + 1);
1404 # $x0 = gregoriantojd($monthf,$dayf,$yearf);
1405 # $x1 = gregoriantojd($montht,$dayt,$yeart);
1406 # return (($x1 - $x0)+1);
1414 $from = strtotime($from);
1415 $to = strtotime($to);
1416 $dayf = date (
"d",$from);
1417 $dayt = date (
"d",$to);
1418 $yearf = date (
"Y",$from);
1419 $yeart = date (
"Y",$to);
1420 $montht = date (
"m",$to);
1421 $monthf = date (
"m",$from);
1422 $hourt = date (
"h",$to);
1423 $hourf = date (
"h",$from);
1424 $ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
1434 $time = strtotime($time);
1435 $day = date(
"d",$time);
1436 $month = date(
"m",$time);
1437 $year = date(
"Y",$time);
1438 $hour = date(
"H",$time);
1439 $min = date(
"i",$time);
1440 $sec = date(
"s",$time);
1442 $ret = date(
"H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
1451 $time = strtotime($time);
1452 $day = date(
"d",$time);
1453 $month = date(
"m",$time);
1454 $year = date(
"y",$time);
1455 $min = date(
"i",$time);
1456 $hour = date(
"h",$time);
1457 $sec = date(
"s",$time);
1459 $ret = date (
"Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
1466 function selectTime($from,$to,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1468 $q =
"SELECT acc_time from ut_access "
1469 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1470 .
" (acc_time >= '".$from.
" 00:00:00'"
1471 .
" AND acc_time <= '".$to.
" 23:59:59')"
1474 .
" GROUP BY acc_time";
1475 $res = $this->ilias->db->query($q);
1476 for($i=0;$i<
$res->numRows();$i++)
1486 function countNum($from,$from1,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1488 $q =
"SELECT id FROM ut_access"
1489 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1490 .
" (acc_time >= '".$from.
" 00:00:00'"
1491 .
" AND acc_time < '".$from1.
" 00:00:00')"
1495 $res = $this->ilias->db->query($q);
1496 return $res->numRows();