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();
92 $this->ctrl->setParameter($this,
"ref_id",$this->ref_id);
94 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
96 $tabs_gui->addTarget(
"settings",
97 $this->ctrl->getLinkTarget($this,
104 $tabs_gui->addTarget(
"learning_progress",
105 $this->ctrl->getLinkTargetByClass(
"illearningprogressgui",
108 "illearningprogressgui");
111 $tabs_gui->addTarget(
"tracking_data",
112 $this->ctrl->getLinkTarget($this,
113 "trackingDataQueryForm"),
114 "trackingDataQueryForm",
118 $tabs_gui->addTarget(
"manage_tracking_data",
119 $this->ctrl->getLinkTarget($this,
124 $tabs_gui->addTarget(
"perm_settings",
125 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
126 array(
"perm",
"info",
"owner"),
139 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
141 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read_track"),
$ilErr->WARNING);
144 $this->tabs_gui->setTabActive(
'settings');
146 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
148 $form->setFormAction($this->ctrl->getFormAction($this));
149 $form->setTitle($this->lng->txt(
'tracking_settings'));
152 $form->addItem($activate);
153 $lp =
new ilCheckboxInputGUI($this->lng->txt(
'trac_learning_progress'),
'learning_progress_tracking');
154 $lp->
setInfo($this->lng->txt(
'trac_learning_progress_settings_info'));
155 $activate->addSubItem($lp);
156 $tracking =
new ilCheckboxInputGUI($this->lng->txt(
'trac_user_activities'),
'user_tracking');
158 $event =
new ilCheckboxInputGUI($this->lng->txt(
'trac_repository_changes'),
'change_event_tracking');
164 $tracking->setChecked(
true);
169 $lp->setChecked(
true);
171 if($this->object->isChangeEventTrackingEnabled())
173 $event->setChecked(
true);
176 $access =
new ilCheckboxInputGUI($this->lng->txt(
'trac_first_and_last_access'),
'lp_access');
181 $lp->addSubItem($access);
188 $lp->addSubItem($read);
195 $lp->addSubItem($spent);
199 $user->
setInfo($this->lng->txt(
'trac_anonymized_info'));
200 $user->setChecked(!$this->object->_enabledUserRelatedData());
201 $form->addItem($user);
207 $valid->setSuffix($this->lng->txt(
'seconds'));
208 $valid->setInfo($this->lng->txt(
'info_valid_request'));
209 $valid->setValue($this->object->getValidTimeSpan());
212 $form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
214 $this->tpl->setContent($form->getHTML());
223 if (
$_POST[
'user_tracking'] ==
'1')
231 $this->
object->setActivationStatus($activation_status);
232 $this->
object->setChangeEventTrackingEnabled(
$_POST[
'change_event_tracking'] ==
'1');
235 if(
$_POST[
'learning_progress_tracking'] ==
'1')
238 if(
$_POST[
'lp_access'] ==
'1')
242 if(
$_POST[
'lp_count'] ==
'1')
246 if(
$_POST[
'lp_spent'] ==
'1')
250 $this->
object->setExtendedData($code);
253 $this->
object->enableUserRelatedData((
int) !
$_POST[
'user_related']);
254 $this->
object->setValidTimeSpan(
$_POST[
'valid_request']);
256 if(!$this->object->validateSettings())
264 $this->
object->updateSettings();
279 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_manage_data.html");
280 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
281 $tpl->setVariable(
"TXT_TRACKING_DATA", $this->lng->txt(
"tracking_data"));
282 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
283 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
284 $tpl->setVariable(
"TXT_DELETE_OLDER", $lng->txt(
"delete"));
285 $overw = $this->
object->getMonthTotalOverview();
286 foreach($overw as $month)
288 $tpl->setCurrentBlock(
"load_row");
289 $rcol = ($rcol !=
"tblrow1") ?
"tblrow1" :
"tblrow2";
290 $tpl->setVariable(
"ROWCOL", $rcol);
291 $tpl->setVariable(
"VAL_MONTH", $month[
"month"]);
292 $tpl->setVariable(
"VAL_NUMBER_OF_ACC", $month[
"cnt"]);
293 $tpl->parseCurrentBlock();
305 if (!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
307 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
310 if (!isset(
$_POST[
"month"]))
312 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
314 $nr = $this->
object->getTotalOlderThanMonth(
$_POST[
"month"]);
315 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_confirm_data_deletion.html");
316 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
317 # "&cmd=gateway&month=".$_POST["month"]);
318 $this->ctrl->setParameter($this,
'month',
$_POST[
'month']);
319 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
321 $tpl->setVariable(
"TXT_CONFIRMATION", $this->lng->txt(
"tracking_data_del_confirm"));
322 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
323 $tpl->setVariable(
"VAL_MONTH",
$_POST[
"month"]);
324 $tpl->setVariable(
"TXT_NUMBER_OF_RECORDS", $lng->txt(
"number_of_records"));
325 $tpl->setVariable(
"VAL_NUMBER_OF_RECORDS", $nr);
326 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
327 $tpl->setVariable(
"TXT_DELETE_DATA", $lng->txt(
"delete_tr_data"));
328 $tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
336 $this->ctrl->redirect($this,
'manageData');
346 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
348 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
351 $this->
object->deleteTrackingDataBeforeMonth(
$_GET[
"month"]);
354 $this->ctrl->redirect($this,
'manageData');
356 #ilUtil::redirect("adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=manageData");
365 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.usr_tracking.html");
366 $tpl->setVariable(
"FORM", $this->
showForm());
372 for ($i = 2004; $i <= date(
"Y"); $i++) $year[] = $i;
373 $month = array(1,2,3,4,5,6,7,8,9,10,11,12);
374 $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);
379 $this->tabs_gui->setTabActive(
'tracking_data');
383 $tpl->setCurrentBlock(
"user_stat");
384 $tpl->setVariable(
"TXT_VIEW_MODE_U", $lng->txt(
"vm_access_of_users"));
387 $tpl->setVariable(
"U_SEL",
"selected");
389 $tpl->parseCurrentBlock();
393 #$tpl->setVariable("SEARCH_ACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
396 $tpl->setVariable(
"SEARCH_ACTION",$this->ctrl->getFormaction($this,
'gateway'));
397 $tpl->setVariable(
"TXT_TRACKING_DATA", $lng->txt(
"tracking_data"));
398 $tpl->setVariable(
"TXT_SEARCH_TERMS", $lng->txt(
"search_terms"));
400 $tpl->setVariable(
"TXT_TIME_SEGMENT", $lng->txt(
"time_segment"));
401 $tpl->setVariable(
"TXT_VIEW_MODE", $lng->txt(
"view_mode"));
402 $tpl->setVariable(
"TXT_VIEW_MODE_H", $lng->txt(
"vm_times_of_day"));
403 $tpl->setVariable(
"TXT_VIEW_MODE_D", $lng->txt(
"vm_days_of_period"));
404 $tpl->setVariable(
"TXT_USER_LANGUAGE",$lng->txt(
"user_language"));
405 $tpl->setVariable(
"TXT_LM",$lng->txt(
"lm"));
406 $tpl->setVariable(
"TXT_HTLM",$lng->txt(
"htlm"));
407 # $tpl->setVariable("TXT_TST",$lng->txt("test"));
408 $tpl->setVariable(
"TXT_SHOW_TR_DATA",$lng->txt(
"query_data"));
409 $tpl->setVariable(
"TXT_TRACKED_OBJECTS",$lng->txt(
"tracked_objects"));
410 $tpl->setVariable(
"TXT_FILTER_AREA",$lng->txt(
"trac_filter_area"));
411 $tpl->setVariable(
"TXT_CHANGE",$lng->txt(
"change"));
413 $languages = $lng->getInstalledLanguages();
462 foreach($year as $key)
464 $tpl->setCurrentBlock(
"fromyear_selection");
465 $tpl->setVariable(
"YEARFR", $key);
466 $tpl->setVariable(
"YEARF", $key);
469 $tpl->setVariable(
"YEARF_SEL",
" selected=\"1\" ");
471 $tpl->parseCurrentBlock();
473 foreach($month as $key)
475 $tpl->setCurrentBlock(
"frommonth_selection");
476 $tpl->setVariable(
"MONTHFR", $key);
477 $tpl->setVariable(
"MONTHF", $key);
478 if (
$_SESSION[
"il_track_monthf"] == $key)
480 $tpl->setVariable(
"MONTHF_SEL",
" selected=\"1\" ");
482 $tpl->parseCurrentBlock();
484 foreach($day as $key)
486 $tpl->setCurrentBlock(
"fromday_selection");
487 $tpl->setVariable(
"DAYFR", $key);
488 $tpl->setVariable(
"DAYF", $key);
491 $tpl->setVariable(
"DAYF_SEL",
" selected=\"1\" ");
493 $tpl->parseCurrentBlock();
495 foreach($day as $key)
497 $tpl->setCurrentBlock(
"today_selection");
498 $tpl->setVariable(
"DAYTO", $key);
499 $tpl->setVariable(
"DAYT", $key);
502 $tpl->setVariable(
"DAYT_SEL",
" selected=\"1\" ");
504 $tpl->parseCurrentBlock();
506 foreach($month as $key)
508 $tpl->setCurrentBlock(
"tomonth_selection");
509 $tpl->setVariable(
"MONTHTO", $key);
510 $tpl->setVariable(
"MONTHT", $key);
511 if (
$_SESSION[
"il_track_montht"] == $key)
513 $tpl->setVariable(
"MONTHT_SEL",
" selected=\"1\" ");
515 $tpl->parseCurrentBlock();
517 foreach($year as $key)
519 $tpl->setCurrentBlock(
"toyear_selection");
520 $tpl->setVariable(
"YEARTO", $key);
521 $tpl->setVariable(
"YEART", $key);
524 $tpl->setVariable(
"YEART_SEL",
" selected=\"1\" ");
526 $tpl->parseCurrentBlock();
529 $tpl->setCurrentBlock(
"language_selection");
530 $tpl->setVariable(
"LANG", $lng->txt(
"any_language"));
531 $tpl->setVariable(
"LANGSHORT",
"0");
532 $tpl->parseCurrentBlock();
533 foreach ($languages as $lang_key)
535 $tpl->setCurrentBlock(
"language_selection");
536 $tpl->setVariable(
"LANG", $lng->txt(
"lang_".$lang_key));
537 $tpl->setVariable(
"LANGSHORT", $lang_key);
538 if (
$_SESSION[
"il_track_language"] == $lang_key)
540 $tpl->setVariable(
"LANG_SEL",
" selected=\"1\" ");
542 $tpl->parseCurrentBlock();
546 if (!in_array(
$_SESSION[
"il_track_stat"], array(
"d",
"h",
"o",
"u")))
$_SESSION[
"il_track_stat"] =
"d";
550 $tpl->setVariable(
"D_SEL",
"selected");
552 elseif (
$_SESSION[
"il_track_stat"] ==
"h")
554 $tpl->setVariable(
"H_SEL",
"selected");
558 $tpl->setVariable(strtoupper(
$_SESSION[
"il_object_type"]).
"_SEL",
"selected");
622 'lm' => $lng->txt(
"lm"),
623 'htlm' => $lng->txt(
"htlm"),
624 'tst' => $lng->txt(
"test")
627 include_once
"./Services/Table/classes/class.ilTableGUI.php";
629 if(!in_array(
$_POST[
"stat"], array(
"d",
"h",
"o",
"u")))
654 $monthf =
$_POST[
"monthf"];
657 $montht=
$_POST[
"montht"];
659 $from = date(
"Y-m-d", mktime(12, 0, 0, $monthf, $dayf, $yearf));
660 $to = date(
"Y-m-d", mktime(12, 0, 0, $montht, $dayt, $yeart));
662 if(($yearf > $yeart)or($yearf==$yeart and $monthf>$montht)or($yearf==$yeart and $monthf==$montht and $dayf>$dayt))
664 $this->ilias->raiseError($lng->txt(
"msg_err_search_time"),
665 $this->ilias->error_obj->MESSAGE);
668 $condition = $this->
getCondition().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
677 $tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_result.html");
678 $tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
680 $tpl->setVariable(
"FORM", $this->
showForm());
682 $objectCondition =
"";
684 if (($max_acc_objects = $this->object->countResults($condition)) == 0)
686 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
687 $this->ilias->error_obj->MESSAGE);
690 $max_hits = $ilias->getSetting(
'search_max_hits', 50);
692 if (
$_POST[
"search_terms"] !=
"")
694 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
695 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
698 $tbl->setTemplate($tplTable);
701 $acc_object = $this->
object->getAccessTotalPerObj($condition,$searchTermsCondition);
703 $max_acc_objects = count($acc_object);
705 if ($max_acc_objects < 1)
707 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
708 $this->ilias->error_obj->MESSAGE);
712 $info = sprintf($lng->txt(
"info_found_objects"), $TYPES[
$_POST[
"object_type"]]);
714 if ($max_hits < $max_acc_objects)
716 $info .=
" ".sprintf($lng->txt(
"found_too_much_objects"), $max_hits);
718 for ($i = 0; $i < count($acc_object) && $i < $max_hits; $i++)
720 $tmp[$i] = $acc_object[$i];
723 $max_acc_objects = $max_hits;
726 $tpl->setVariable(
"INFO", $info);
729 $tbl->setTitle($lng->txt(
"found_objects"),0,0);
730 # if(($_POST["object_type"]=="lm" and $_POST["author"] == "0") or ($_POST["object_type"]=="tst" and $_POST["author1"] == "0"))
732 $title_new = array(
"author",
"subject",
"total_dwell_time",
"count",
"");
733 $tbl->setColumnWidth(array(
"20%",
"30%",
"20%",
"10%",
"*"));
737 # $title_new = array("subject", "count","");
738 # $tbl->setColumnWidth(array("30%", "10%", "*"));
740 foreach ($title_new as $val)
742 $header_names[] = $lng->txt($val);
744 $tbl->disable(
"sort");
745 $tbl->setHeaderNames($header_names);
746 $tbl->setMaxCount($max_acc_objects);
747 # $tbl->setStyle("table", "std");
751 for ($i = 0; $i < count($acc_object); $i++)
753 $max = ($max > $acc_object[$i][
"cnt"]) ? $max : $acc_object[$i][
"cnt"];
754 $ids[$i] = $acc_object[$i][
"id"];
758 $objectCondition =
" AND acc_obj_id IN (".implode(
",", $ids).
") ";
761 for ($i = 0; $i < count($acc_object); $i++)
764 # if(($_POST["object_type"]=="lm" and $_POST["author"]=="0") or ($_POST["object_type"]=="tst" and $_POST["author1"]=="0"))
766 $data[0] = $acc_object[$i][
"author"];
767 $data[1] = $acc_object[$i][
"title"];
769 $data[3] = $acc_object[$i][
"cnt"];
771 ? round(
$data[3] / $max * 100)
773 $data[4] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
774 "width=\"".$width.
"\" height=\"10\"/>";
786 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
787 foreach (
$data as $key => $val)
793 $tplTable->setCurrentBlock(
"text");
794 $tplTable->setVariable(
"TEXT_CONTENT", $val);
795 $tplTable->parseCurrentBlock();
796 $tplTable->setCurrentBlock(
"table_cell");
797 $tplTable->parseCurrentBlock();
799 $tplTable->setCurrentBlock(
"tbl_content");
800 $tplTable->setVariable(
"CSS_ROW", $css_row);
801 $tplTable->parseCurrentBlock();
805 $tpl->setVariable(
"OBJECTS_TABLE", $tplTable->get());
806 $tpl->setVariable(
"TXT_INFO_DWELL_TIME", $lng->txt(
"info_dwell_time"));
812 $tpl->setVariable(
"INFO", sprintf($lng->txt(
"info_all_objects"), $TYPES[
$_POST[
"object_type"]]));
815 if ($max_acc_objects > 0)
818 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
819 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
822 $tbl->setTemplate($tplTable);
827 if(
$_POST[
"mode"] ==
"user")
829 $tpl->setCurrentBlock(
"user_mode");
830 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
832 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
833 if(
$_POST[
"object_type"]==
"lm")
835 $tpl->setVariable(
"AUTHOR",
"author");
836 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
837 $tpl->setVariable(
"OBJECT",
"lm");
838 $tpl->setVariable(
"OBJECTS",
$_POST[
"lm"]);
840 else if(
$_POST[
"object_type"]==
"htlm")
842 $tpl->setVariable(
"AUTHOR",
"author");
843 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
844 $tpl->setVariable(
"OBJECT",
"htlm");
845 $tpl->setVariable(
"OBJECTS",
$_POST[
"htlm"]);
849 $tpl->setVariable(
"AUTHOR",
"author1");
850 $tpl->setVariable(
"AUTHORS",
$_POST[
"author1"]);
851 $tpl->setVariable(
"OBJECT",
"tst");
852 $tpl->setVariable(
"OBJECTS",
$_POST[
"tst"]);
854 $tpl->setVariable(
"YEARF",
$_POST[
"yearf"]);
855 $tpl->setVariable(
"MONTHF",
$_POST[
"monthf"]);
856 $tpl->setVariable(
"DAYF",
$_POST[
"dayf"]);
857 $tpl->setVariable(
"YEART",
$_POST[
"yeart"]);
858 $tpl->setVariable(
"MONTHT",
$_POST[
"montht"]);
859 $tpl->setVariable(
"DAYT",
$_POST[
"dayt"]);
860 $tpl->setVariable(
"LAN",
$_POST[
"language"]);
861 $tpl->setVariable(
"TYPE",
$_POST[
"object_type"]);
863 $tpl->setVariable(
"FROM", $from);
864 $tpl->setVariable(
"TO", $to);
865 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_statistics"));
866 $tpl->parseCurrentBlock();
868 $title_new = array(
"user",
"client_ip",
"language",
"object",
"time");
869 $condition = $this->
getConditions().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
871 $user_acc = $this->
object->getAccessPerUserDetail($condition, $searchTermsCondition, $objectCondition);
872 $this->maxcount = count($user_acc);
873 if ($this->maxcount < 1)
875 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
876 $this->ilias->error_obj->MESSAGE);
879 # $tbl->setTitle($lng->txt("search_result"),0,0);
880 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users").
" [".$lng->txt(
"details").
"]",0,0);
881 unset($header_names);
882 foreach ($title_new as $val)
884 $header_names[] = $lng->txt($val);
886 $tbl->disable(
"sort");
888 $tbl->setHeaderNames($header_names);
889 $tbl->setColumnWidth(array(
"20%",
"15%",
"15%",
"30%",
"*"));
890 $tbl->setMaxCount($this->maxcount);
891 # $tbl->setStyle("table", "std");
896 foreach ($user_acc as $user)
899 $data[0] = $user[
"name"];
900 $data[1] = $user[
"client_ip"];
901 $data[2] = $user[
"language"];
902 $data[3] = $user[
"acc_obj_id"];
903 $data[4] = $user[
"acc_time"];
904 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
905 foreach (
$data as $key => $val)
911 $tplTable->setCurrentBlock(
"text");
912 $tplTable->setVariable(
"TEXT_CONTENT", $val);
913 $tplTable->parseCurrentBlock();
914 $tplTable->setCurrentBlock(
"table_cell");
915 $tplTable->parseCurrentBlock();
917 $tplTable->setCurrentBlock(
"tbl_content");
918 $tplTable->setVariable(
"CSS_ROW", $css_row);
919 $tplTable->parseCurrentBlock();
925 $tpl->setCurrentBlock(
"user_mode");
926 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
928 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
929 if(
$_POST[
"object_type"]==
"lm")
931 $tpl->setVariable(
"AUTHOR",
"author");
932 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
933 $tpl->setVariable(
"OBJECT",
"lm");
934 $tpl->setVariable(
"OBJECTS",
$_POST[
"lm"]);
936 else if(
$_POST[
"object_type"]==
"htlm")
938 $tpl->setVariable(
"AUTHOR",
"author");
939 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
940 $tpl->setVariable(
"OBJECT",
"htlm");
941 $tpl->setVariable(
"OBJECTS",
$_POST[
"htlm"]);
945 $tpl->setVariable(
"AUTHOR",
"author1");
946 $tpl->setVariable(
"AUTHORS",
$_POST[
"author1"]);
947 $tpl->setVariable(
"OBJECT",
"tst");
948 $tpl->setVariable(
"OBJECTS",
$_POST[
"tst"]);
950 $tpl->setVariable(
"YEARF",
$_POST[
"yearf"]);
951 $tpl->setVariable(
"MONTHF",
$_POST[
"monthf"]);
952 $tpl->setVariable(
"DAYF",
$_POST[
"dayf"]);
953 $tpl->setVariable(
"YEART",
$_POST[
"yeart"]);
954 $tpl->setVariable(
"MONTHT",
$_POST[
"montht"]);
955 $tpl->setVariable(
"DAYT",
$_POST[
"dayt"]);
956 $tpl->setVariable(
"USER",
"user");
957 $tpl->setVariable(
"LAN",
$_POST[
"language"]);
958 $tpl->setVariable(
"TYPE",
$_POST[
"object_type"]);
960 $tpl->setVariable(
"FROM", $from);
961 $tpl->setVariable(
"TO", $to);
962 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_detail"));
963 $tpl->parseCurrentBlock();
964 $title_new = array(
"user",
"count",
"");
967 $user_acc = $this->
object->getAccessTotalPerUser($condition, $searchTermsCondition, $objectCondition);
969 $this->maxcount = count($user_acc);
972 if ($this->maxcount < 1)
974 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
975 $this->ilias->error_obj->MESSAGE);
978 # $tbl->setTitle($lng->txt("search_result"),0,0);
979 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users"),0,0);
980 unset($header_names);
981 foreach ($title_new as $val)
983 $header_names[] = $lng->txt($val);
985 $tbl->disable(
"sort");
986 $tbl->setHeaderNames($header_names);
987 $tbl->setColumnWidth(array(
"20%",
"10%",
"*"));
988 $tbl->setMaxCount($this->maxcount);
989 # $tbl->setStyle("table", "std");
992 foreach ($user_acc as $user)
994 $max = ($max > $user[
"cnt"]) ? $max : $user[
"cnt"];
998 foreach ($user_acc as $user)
1001 $data[0] = $user[
"name"];
1002 $data[1] = $user[
"cnt"];
1004 ? round(
$data[1] / $max * 100)
1006 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1007 "width=\"".$width.
"\" height=\"10\"/>";
1009 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1010 foreach (
$data as $key => $val)
1016 $tplTable->setCurrentBlock(
"text");
1017 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1018 $tplTable->parseCurrentBlock();
1019 $tplTable->setCurrentBlock(
"table_cell");
1020 $tplTable->parseCurrentBlock();
1022 $tplTable->setCurrentBlock(
"tbl_content");
1023 $tplTable->setVariable(
"CSS_ROW", $css_row);
1024 $tplTable->parseCurrentBlock();
1032 $title_new = array(
"time",
"count",
"");
1034 # $tbl->setTitle($lng->txt("obj_trac"),0,0);
1035 unset($header_names);
1036 foreach ($title_new as $val)
1038 $header_names[] = $lng->txt($val);
1040 $tbl->disable(
"sort");
1041 $tbl->setHeaderNames($header_names);
1044 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_times_of_day"),0,0);
1045 $tbl->setColumnWidth(array(
"30%",
"10%",
"*"));
1049 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_days_of_period"),0,0);
1050 $tbl->setColumnWidth(array(
"15%",
"10%",
"*"));
1056 $tbl->setMaxCount($num);
1060 $num = $this->
numDay($from,$to);
1061 $from1 = $this->
addDay($from);
1062 $tbl->setMaxCount($num);
1064 # $tbl->setStyle("table", "std");
1072 $time = $this->
selectTime($from,$to,$condition,$searchTermsCondition,$objectCondition);
1074 for($i=0;$i<24;$i++)
1080 for($j=0;$j<count($time);$j++)
1082 $time1 = strtotime($time[$j][0]);
1083 $day = date(
"d",$time1);
1084 $month = date(
"m",$time1);
1085 $year = date(
"Y",$time1);
1086 $hour = date(
"H",$time1);
1087 $min = date(
"i",$time1);
1088 $sec = date(
"s",$time1);
1089 $numb = date(
"H",mktime($hour,$min,$sec,$month,$day,$year));
1090 $numb = intval($numb);
1091 if($numb >=$i and $numb <$k)
1097 $max = ($cou > $max) ? $cou : $max;
1100 for($i=0;$i<24;$i++)
1104 $data[0] = ($i < 10 ?
"0".$i : $i).
":00:00 ~ ".($k < 10 ?
"0".$k : $k).
":00:00";
1105 $data[1] = $count[$i];
1107 ? round($count[$i] / $max * 100)
1109 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1110 "width=\"".$width.
"\" height=\"10\"/>";
1112 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1113 foreach (
$data as $key => $val)
1115 $tplTable->setCurrentBlock(
"text");
1116 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1117 $tplTable->parseCurrentBlock();
1118 $tplTable->setCurrentBlock(
"table_cell");
1119 $tplTable->parseCurrentBlock();
1121 $tplTable->setCurrentBlock(
"tbl_content");
1122 $tplTable->setVariable(
"CSS_ROW", $css_row);
1123 $tplTable->parseCurrentBlock();
1130 for($i=0;$i<$num;$i++)
1133 $cou[$i] = $this->
countNum($from,$from1,$condition,$searchTermsCondition,$objectCondition);
1135 $from1 = $this->
addDay($from);
1136 $max = ($max > $cou[$i]) ? $max : $cou[$i];
1138 for($i=0;$i<$num;$i++)
1141 $data[0] = $fro[$i];
1142 $data[1] = $cou[$i];
1144 ? round($cou[$i] / $max * 100)
1146 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1147 "width=\"".$width.
"\" height=\"10\"/>";
1149 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1150 foreach (
$data as $key => $val)
1152 $tplTable->setCurrentBlock(
"text");
1153 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1154 $tplTable->parseCurrentBlock();
1155 $tplTable->setCurrentBlock(
"table_cell");
1156 $tplTable->parseCurrentBlock();
1158 $tplTable->setCurrentBlock(
"tbl_content");
1159 $tplTable->setVariable(
"CSS_ROW", $css_row);
1160 $tplTable->parseCurrentBlock();
1166 $tpl->setVariable(
"TRACK_TABLE", $tplTable->get());
1228 if ($lang_cond ==
"")
1235 $this->
setConditions($lang_cond.
" AND ".$this->getObjectCondition());
1250 if(
$_POST[
"object_type"]==
"lm")
1252 if(
$_POST[
"author"]==
"0")
1254 return " acc_obj_type = 'lm'";
1260 foreach ($authors as $author)
1262 if($author[
"title"]==
$_POST[
"author"])
1266 foreach ($lms as $lm)
1268 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1274 return " ( 0 ".$condition.
" ) ";
1278 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"lm"],
$type);
1283 else if(
$_POST[
"object_type"]==
"htlm")
1285 if(
$_POST[
"author"]==
"0")
1287 return " acc_obj_type = 'htlm'";
1293 foreach ($authors as $author)
1295 if($author[
"title"]==
$_POST[
"author"])
1299 foreach ($htlms as $htlm)
1301 $condition = $condition.
" or acc_obj_id = ".$htlm[
"obj_id"];
1307 return " ( 0 ".$condition.
" ) ";
1311 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"htlm"],
$type);
1318 if(
$_POST[
"author1"]==
"0")
1320 return " acc_obj_type = 'tst'";
1326 foreach ($authors as $author)
1328 if($author[
"title"]==
$_POST[
"author1"])
1332 foreach ($lms as $lm)
1334 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1340 return " ( 0 ".$condition.
" ) ";
1344 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"tst"],
$type);
1357 if (
$_POST[
"language"] !=
"0")
1359 return "ut_access.language =".$ilDB->quote(
$_POST[
"language"],
"text");
1372 if (trim(
$_POST[
"search_terms"]) !=
"")
1375 $terms = explode(
" ",
$_POST[
"search_terms"]);
1376 for ($i = 0; $i < count($terms); $i++)
1378 if (trim($terms[$i]) !=
"") $sub_ret .=
"oa.title LIKE '%".
ilUtil::addSlashes(trim($terms[$i])).
"%' OR ";
1382 return " INNER JOIN object_data oa ON oa.obj_id = acc_obj_id WHERE (".substr($sub_ret, 0, strlen($sub_ret)-4) .
") AND ";
1391 $this->conditions = $con;
1404 $from = strtotime($from);
1405 $to = strtotime($to);
1407 $dayf = date (
"d",$from);
1408 $dayt = date (
"d",$to);
1409 $yearf = date (
"Y",$from);
1410 $yeart = date (
"Y",$to);
1411 $montht = date (
"m",$to);
1412 $monthf = date (
"m",$from);
1414 # $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
1417 $from = mktime(12,0,0,$monthf,$dayf,$yearf);
1418 $to = mktime(12,0,0,$montht,$dayt,$yeart);
1420 $ret = (round(($to - $from) / 86400) + 1);
1423 # $x0 = gregoriantojd($monthf,$dayf,$yearf);
1424 # $x1 = gregoriantojd($montht,$dayt,$yeart);
1425 # return (($x1 - $x0)+1);
1433 $from = strtotime($from);
1434 $to = strtotime($to);
1435 $dayf = date (
"d",$from);
1436 $dayt = date (
"d",$to);
1437 $yearf = date (
"Y",$from);
1438 $yeart = date (
"Y",$to);
1439 $montht = date (
"m",$to);
1440 $monthf = date (
"m",$from);
1441 $hourt = date (
"h",$to);
1442 $hourf = date (
"h",$from);
1443 $ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
1453 $time = strtotime($time);
1454 $day = date(
"d",$time);
1455 $month = date(
"m",$time);
1456 $year = date(
"Y",$time);
1457 $hour = date(
"H",$time);
1458 $min = date(
"i",$time);
1459 $sec = date(
"s",$time);
1461 $ret = date(
"H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
1470 $time = strtotime($time);
1471 $day = date(
"d",$time);
1472 $month = date(
"m",$time);
1473 $year = date(
"y",$time);
1474 $min = date(
"i",$time);
1475 $hour = date(
"h",$time);
1476 $sec = date(
"s",$time);
1478 $ret = date (
"Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
1485 function selectTime($from,$to,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1489 $q =
"SELECT acc_time from ut_access "
1490 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1491 .
" (acc_time >= ".$ilDB->quote($from.
" 00:00:00",
"timestamp")
1492 .
" AND acc_time <= ".$ilDB->quote($to.
" 23:59:59",
"timestamp").
")"
1495 .
" GROUP BY acc_time";
1496 $res = $this->ilias->db->query($q);
1497 for($i=0;$i<
$res->numRows();$i++)
1499 $result[$i]=
$res->fetchRow();
1507 function countNum($from,$from1,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1511 $q =
"SELECT id FROM ut_access"
1512 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1513 .
" (acc_time >= ".$ilDB->quote($from.
" 00:00:00",
"timestamp")
1514 .
" AND acc_time <= ".$ilDB->quote($from1.
" 00:00:00",
"timestamp").
")"
1518 $res = $this->ilias->db->query($q);
1519 return $res->numRows();