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);
69 case 'illpobjectstatisticsgui':
70 $this->tabs_gui->setTabActive(
'statistics');
71 include_once(
"./Services/Tracking/classes/class.ilLPObjectStatisticsGUI.php");
73 $ret =& $this->ctrl->forwardCommand($os_gui);
77 $cmd = $this->ctrl->getCmd();
99 $this->ctrl->setParameter($this,
"ref_id",$this->ref_id);
101 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
103 $tabs_gui->addTarget(
"settings",
104 $this->ctrl->getLinkTarget($this,
111 $tabs_gui->addTarget(
"statistics",
112 $this->ctrl->getLinkTargetByClass(
"illpobjectstatisticsgui",
115 "illpobjectstatisticsgui");
120 $tabs_gui->addTarget(
"learning_progress",
121 $this->ctrl->getLinkTargetByClass(
"illearningprogressgui",
124 "illearningprogressgui");
142 $tabs_gui->addTarget(
"perm_settings",
143 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
144 array(
"perm",
"info",
"owner"),
157 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
159 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read_track"),
$ilErr->WARNING);
162 $this->tabs_gui->setTabActive(
'settings');
164 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
166 $form->setFormAction($this->ctrl->getFormAction($this));
167 $form->setTitle($this->lng->txt(
'tracking_settings'));
170 $form->addItem($activate);
172 $lp =
new ilCheckboxInputGUI($this->lng->txt(
'trac_learning_progress'),
'learning_progress_tracking');
173 $lp->
setInfo($this->lng->txt(
'trac_learning_progress_settings_info'));
174 $activate->addSubItem($lp);
181 $event =
new ilCheckboxInputGUI($this->lng->txt(
'trac_repository_changes'),
'change_event_tracking');
184 $objstat =
new ilCheckboxInputGUI($this->lng->txt(
'trac_object_statistics'),
'object_statistics');
198 $lp->setChecked(
true);
201 if($this->object->isChangeEventTrackingEnabled())
203 $event->setChecked(
true);
206 if($this->object->isObjectStatisticsEnabled())
208 $objstat->setChecked(
true);
211 $access =
new ilCheckboxInputGUI($this->lng->txt(
'trac_first_and_last_access'),
'lp_access');
216 $lp->addSubItem($access);
223 $lp->addSubItem($read);
230 $lp->addSubItem($spent);
234 $user->
setInfo($this->lng->txt(
'trac_anonymized_info'));
235 $user->setChecked(!$this->object->_enabledUserRelatedData());
236 $form->addItem($user);
242 $valid->setSuffix($this->lng->txt(
'seconds'));
243 $valid->setInfo($this->lng->txt(
'info_valid_request'));
244 $valid->setValue($this->object->getValidTimeSpan());
247 $form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
249 $this->tpl->setContent($form->getHTML());
258 if (
$_POST[
'user_tracking'] ==
'1')
266 $this->
object->setActivationStatus($activation_status);
267 $this->
object->setChangeEventTrackingEnabled(
$_POST[
'change_event_tracking'] ==
'1');
270 if(
$_POST[
'learning_progress_tracking'] ==
'1')
273 if(
$_POST[
'lp_access'] ==
'1')
277 if(
$_POST[
'lp_count'] ==
'1')
281 if(
$_POST[
'lp_spent'] ==
'1')
285 $this->
object->setExtendedData($code);
288 $this->
object->setObjectStatisticsEnabled((
bool)
$_POST[
"object_statistics"]);
289 $this->
object->enableUserRelatedData((
int) !$_POST[
'user_related']);
290 $this->
object->setValidTimeSpan($_POST[
'valid_request']);
292 if(!$this->object->validateSettings())
300 $this->
object->updateSettings();
302 $this->ctrl->redirect($this,
"settings");
315 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_manage_data.html");
316 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
317 $tpl->setVariable(
"TXT_TRACKING_DATA", $this->lng->txt(
"tracking_data"));
318 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
319 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
320 $tpl->setVariable(
"TXT_DELETE_OLDER", $lng->txt(
"delete"));
321 $overw = $this->
object->getMonthTotalOverview();
322 foreach($overw as $month)
324 $tpl->setCurrentBlock(
"load_row");
325 $rcol = ($rcol !=
"tblrow1") ?
"tblrow1" :
"tblrow2";
326 $tpl->setVariable(
"ROWCOL", $rcol);
327 $tpl->setVariable(
"VAL_MONTH", $month[
"month"]);
328 $tpl->setVariable(
"VAL_NUMBER_OF_ACC", $month[
"cnt"]);
329 $tpl->parseCurrentBlock();
341 if (!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
343 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
346 if (!isset(
$_POST[
"month"]))
348 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
350 $nr = $this->
object->getTotalOlderThanMonth(
$_POST[
"month"]);
351 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_confirm_data_deletion.html");
352 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
353 # "&cmd=gateway&month=".$_POST["month"]);
354 $this->ctrl->setParameter($this,
'month',
$_POST[
'month']);
355 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
357 $tpl->setVariable(
"TXT_CONFIRMATION", $this->lng->txt(
"tracking_data_del_confirm"));
358 $tpl->setVariable(
"TXT_MONTH", $lng->txt(
"month"));
359 $tpl->setVariable(
"VAL_MONTH",
$_POST[
"month"]);
360 $tpl->setVariable(
"TXT_NUMBER_OF_RECORDS", $lng->txt(
"number_of_records"));
361 $tpl->setVariable(
"VAL_NUMBER_OF_RECORDS", $nr);
362 $tpl->setVariable(
"TXT_NUMBER_OF_ACC", $lng->txt(
"number_of_accesses"));
363 $tpl->setVariable(
"TXT_DELETE_DATA", $lng->txt(
"delete_tr_data"));
364 $tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
372 $this->ctrl->redirect($this,
'manageData');
382 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
384 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
387 $this->
object->deleteTrackingDataBeforeMonth(
$_GET[
"month"]);
390 $this->ctrl->redirect($this,
'manageData');
392 #ilUtil::redirect("adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=manageData");
401 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.usr_tracking.html");
402 $tpl->setVariable(
"FORM", $this->
showForm());
408 for ($i = 2004; $i <= date(
"Y"); $i++) $year[] = $i;
409 $month = array(1,2,3,4,5,6,7,8,9,10,11,12);
410 $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);
415 $this->tabs_gui->setTabActive(
'tracking_data');
419 $tpl->setCurrentBlock(
"user_stat");
420 $tpl->setVariable(
"TXT_VIEW_MODE_U", $lng->txt(
"vm_access_of_users"));
423 $tpl->setVariable(
"U_SEL",
"selected");
425 $tpl->parseCurrentBlock();
429 #$tpl->setVariable("SEARCH_ACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
432 $tpl->setVariable(
"SEARCH_ACTION",$this->ctrl->getFormaction($this,
'gateway'));
433 $tpl->setVariable(
"TXT_TRACKING_DATA", $lng->txt(
"tracking_data"));
434 $tpl->setVariable(
"TXT_SEARCH_TERMS", $lng->txt(
"search_terms"));
436 $tpl->setVariable(
"TXT_TIME_SEGMENT", $lng->txt(
"time_segment"));
437 $tpl->setVariable(
"TXT_VIEW_MODE", $lng->txt(
"view_mode"));
438 $tpl->setVariable(
"TXT_VIEW_MODE_H", $lng->txt(
"vm_times_of_day"));
439 $tpl->setVariable(
"TXT_VIEW_MODE_D", $lng->txt(
"vm_days_of_period"));
440 $tpl->setVariable(
"TXT_USER_LANGUAGE",$lng->txt(
"user_language"));
441 $tpl->setVariable(
"TXT_LM",$lng->txt(
"lm"));
442 $tpl->setVariable(
"TXT_HTLM",$lng->txt(
"htlm"));
443 # $tpl->setVariable("TXT_TST",$lng->txt("test"));
444 $tpl->setVariable(
"TXT_SHOW_TR_DATA",$lng->txt(
"query_data"));
445 $tpl->setVariable(
"TXT_TRACKED_OBJECTS",$lng->txt(
"tracked_objects"));
446 $tpl->setVariable(
"TXT_FILTER_AREA",$lng->txt(
"trac_filter_area"));
447 $tpl->setVariable(
"TXT_CHANGE",$lng->txt(
"change"));
449 $languages = $lng->getInstalledLanguages();
498 foreach($year as $key)
500 $tpl->setCurrentBlock(
"fromyear_selection");
501 $tpl->setVariable(
"YEARFR", $key);
502 $tpl->setVariable(
"YEARF", $key);
505 $tpl->setVariable(
"YEARF_SEL",
" selected=\"1\" ");
507 $tpl->parseCurrentBlock();
509 foreach($month as $key)
511 $tpl->setCurrentBlock(
"frommonth_selection");
512 $tpl->setVariable(
"MONTHFR", $key);
513 $tpl->setVariable(
"MONTHF", $key);
514 if (
$_SESSION[
"il_track_monthf"] == $key)
516 $tpl->setVariable(
"MONTHF_SEL",
" selected=\"1\" ");
518 $tpl->parseCurrentBlock();
520 foreach($day as $key)
522 $tpl->setCurrentBlock(
"fromday_selection");
523 $tpl->setVariable(
"DAYFR", $key);
524 $tpl->setVariable(
"DAYF", $key);
527 $tpl->setVariable(
"DAYF_SEL",
" selected=\"1\" ");
529 $tpl->parseCurrentBlock();
531 foreach($day as $key)
533 $tpl->setCurrentBlock(
"today_selection");
534 $tpl->setVariable(
"DAYTO", $key);
535 $tpl->setVariable(
"DAYT", $key);
538 $tpl->setVariable(
"DAYT_SEL",
" selected=\"1\" ");
540 $tpl->parseCurrentBlock();
542 foreach($month as $key)
544 $tpl->setCurrentBlock(
"tomonth_selection");
545 $tpl->setVariable(
"MONTHTO", $key);
546 $tpl->setVariable(
"MONTHT", $key);
547 if (
$_SESSION[
"il_track_montht"] == $key)
549 $tpl->setVariable(
"MONTHT_SEL",
" selected=\"1\" ");
551 $tpl->parseCurrentBlock();
553 foreach($year as $key)
555 $tpl->setCurrentBlock(
"toyear_selection");
556 $tpl->setVariable(
"YEARTO", $key);
557 $tpl->setVariable(
"YEART", $key);
560 $tpl->setVariable(
"YEART_SEL",
" selected=\"1\" ");
562 $tpl->parseCurrentBlock();
565 $tpl->setCurrentBlock(
"language_selection");
566 $tpl->setVariable(
"LANG", $lng->txt(
"any_language"));
567 $tpl->setVariable(
"LANGSHORT",
"0");
568 $tpl->parseCurrentBlock();
569 foreach ($languages as $lang_key)
571 $tpl->setCurrentBlock(
"language_selection");
572 $tpl->setVariable(
"LANG", $lng->txt(
"lang_".$lang_key));
573 $tpl->setVariable(
"LANGSHORT", $lang_key);
574 if (
$_SESSION[
"il_track_language"] == $lang_key)
576 $tpl->setVariable(
"LANG_SEL",
" selected=\"1\" ");
578 $tpl->parseCurrentBlock();
582 if (!in_array(
$_SESSION[
"il_track_stat"], array(
"d",
"h",
"o",
"u")))
$_SESSION[
"il_track_stat"] =
"d";
586 $tpl->setVariable(
"D_SEL",
"selected");
588 elseif (
$_SESSION[
"il_track_stat"] ==
"h")
590 $tpl->setVariable(
"H_SEL",
"selected");
594 $tpl->setVariable(strtoupper(
$_SESSION[
"il_object_type"]).
"_SEL",
"selected");
658 'lm' => $lng->txt(
"lm"),
659 'htlm' => $lng->txt(
"htlm"),
660 'tst' => $lng->txt(
"test")
663 include_once
"./Services/Table/classes/class.ilTableGUI.php";
665 if(!in_array(
$_POST[
"stat"], array(
"d",
"h",
"o",
"u")))
690 $monthf =
$_POST[
"monthf"];
693 $montht=
$_POST[
"montht"];
695 $from = date(
"Y-m-d", mktime(12, 0, 0, $monthf, $dayf, $yearf));
696 $to = date(
"Y-m-d", mktime(12, 0, 0, $montht, $dayt, $yeart));
698 if(($yearf > $yeart)or($yearf==$yeart and $monthf>$montht)or($yearf==$yeart and $monthf==$montht and $dayf>$dayt))
700 $this->ilias->raiseError($lng->txt(
"msg_err_search_time"),
701 $this->ilias->error_obj->MESSAGE);
704 $condition = $this->
getCondition().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
713 $tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.tracking_result.html");
714 $tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
716 $tpl->setVariable(
"FORM", $this->
showForm());
718 $objectCondition =
"";
720 if (($max_acc_objects = $this->object->countResults($condition)) == 0)
722 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
723 $this->ilias->error_obj->MESSAGE);
726 $max_hits = $ilias->getSetting(
'search_max_hits', 50);
728 if (
$_POST[
"search_terms"] !=
"")
730 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
731 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
734 $tbl->setTemplate($tplTable);
737 $acc_object = $this->
object->getAccessTotalPerObj($condition,$searchTermsCondition);
739 $max_acc_objects = count($acc_object);
741 if ($max_acc_objects < 1)
743 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
744 $this->ilias->error_obj->MESSAGE);
748 $info = sprintf($lng->txt(
"info_found_objects"), $TYPES[
$_POST[
"object_type"]]);
750 if ($max_hits < $max_acc_objects)
752 $info .=
" ".sprintf($lng->txt(
"found_too_much_objects"), $max_hits);
754 for ($i = 0; $i < count($acc_object) && $i < $max_hits; $i++)
756 $tmp[$i] = $acc_object[$i];
759 $max_acc_objects = $max_hits;
762 $tpl->setVariable(
"INFO", $info);
765 $tbl->setTitle($lng->txt(
"found_objects"),0,0);
766 # if(($_POST["object_type"]=="lm" and $_POST["author"] == "0") or ($_POST["object_type"]=="tst" and $_POST["author1"] == "0"))
768 $title_new = array(
"author",
"subject",
"total_dwell_time",
"count",
"");
769 $tbl->setColumnWidth(array(
"20%",
"30%",
"20%",
"10%",
"*"));
773 # $title_new = array("subject", "count","");
774 # $tbl->setColumnWidth(array("30%", "10%", "*"));
776 foreach ($title_new as $val)
778 $header_names[] = $lng->txt($val);
780 $tbl->disable(
"sort");
781 $tbl->setHeaderNames($header_names);
782 $tbl->setMaxCount($max_acc_objects);
783 # $tbl->setStyle("table", "std");
787 for ($i = 0; $i < count($acc_object); $i++)
789 $max = ($max > $acc_object[$i][
"cnt"]) ? $max : $acc_object[$i][
"cnt"];
790 $ids[$i] = $acc_object[$i][
"id"];
794 $objectCondition =
" AND acc_obj_id IN (".implode(
",", $ids).
") ";
797 for ($i = 0; $i < count($acc_object); $i++)
800 # if(($_POST["object_type"]=="lm" and $_POST["author"]=="0") or ($_POST["object_type"]=="tst" and $_POST["author1"]=="0"))
802 $data[0] = $acc_object[$i][
"author"];
803 $data[1] = $acc_object[$i][
"title"];
805 $data[3] = $acc_object[$i][
"cnt"];
807 ? round(
$data[3] / $max * 100)
809 $data[4] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
810 "width=\"".$width.
"\" height=\"10\"/>";
822 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
823 foreach (
$data as $key => $val)
829 $tplTable->setCurrentBlock(
"text");
830 $tplTable->setVariable(
"TEXT_CONTENT", $val);
831 $tplTable->parseCurrentBlock();
832 $tplTable->setCurrentBlock(
"table_cell");
833 $tplTable->parseCurrentBlock();
835 $tplTable->setCurrentBlock(
"tbl_content");
836 $tplTable->setVariable(
"CSS_ROW", $css_row);
837 $tplTable->parseCurrentBlock();
841 $tpl->setVariable(
"OBJECTS_TABLE", $tplTable->get());
842 $tpl->setVariable(
"TXT_INFO_DWELL_TIME", $lng->txt(
"info_dwell_time"));
848 $tpl->setVariable(
"INFO", sprintf($lng->txt(
"info_all_objects"), $TYPES[
$_POST[
"object_type"]]));
851 if ($max_acc_objects > 0)
854 $tplTable =&
new ilTemplate(
"tpl.table.html",
true,
true);
855 $tplTable->addBlockFile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
858 $tbl->setTemplate($tplTable);
863 if(
$_POST[
"mode"] ==
"user")
865 $tpl->setCurrentBlock(
"user_mode");
866 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
868 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
869 if(
$_POST[
"object_type"]==
"lm")
871 $tpl->setVariable(
"AUTHOR",
"author");
872 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
873 $tpl->setVariable(
"OBJECT",
"lm");
874 $tpl->setVariable(
"OBJECTS",
$_POST[
"lm"]);
876 else if(
$_POST[
"object_type"]==
"htlm")
878 $tpl->setVariable(
"AUTHOR",
"author");
879 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
880 $tpl->setVariable(
"OBJECT",
"htlm");
881 $tpl->setVariable(
"OBJECTS",
$_POST[
"htlm"]);
885 $tpl->setVariable(
"AUTHOR",
"author1");
886 $tpl->setVariable(
"AUTHORS",
$_POST[
"author1"]);
887 $tpl->setVariable(
"OBJECT",
"tst");
888 $tpl->setVariable(
"OBJECTS",
$_POST[
"tst"]);
890 $tpl->setVariable(
"YEARF",
$_POST[
"yearf"]);
891 $tpl->setVariable(
"MONTHF",
$_POST[
"monthf"]);
892 $tpl->setVariable(
"DAYF",
$_POST[
"dayf"]);
893 $tpl->setVariable(
"YEART",
$_POST[
"yeart"]);
894 $tpl->setVariable(
"MONTHT",
$_POST[
"montht"]);
895 $tpl->setVariable(
"DAYT",
$_POST[
"dayt"]);
896 $tpl->setVariable(
"LAN",
$_POST[
"language"]);
897 $tpl->setVariable(
"TYPE",
$_POST[
"object_type"]);
899 $tpl->setVariable(
"FROM", $from);
900 $tpl->setVariable(
"TO", $to);
901 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_statistics"));
902 $tpl->parseCurrentBlock();
904 $title_new = array(
"user",
"client_ip",
"language",
"object",
"time");
905 $condition = $this->
getConditions().
" and acc_time >= '".$from.
" 00:00:00' and acc_time <= '".$to.
" 23:59:59'";
907 $user_acc = $this->
object->getAccessPerUserDetail($condition, $searchTermsCondition, $objectCondition);
908 $this->maxcount = count($user_acc);
909 if ($this->maxcount < 1)
911 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
912 $this->ilias->error_obj->MESSAGE);
915 # $tbl->setTitle($lng->txt("search_result"),0,0);
916 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users").
" [".$lng->txt(
"details").
"]",0,0);
917 unset($header_names);
918 foreach ($title_new as $val)
920 $header_names[] = $lng->txt($val);
922 $tbl->disable(
"sort");
924 $tbl->setHeaderNames($header_names);
925 $tbl->setColumnWidth(array(
"20%",
"15%",
"15%",
"30%",
"*"));
926 $tbl->setMaxCount($this->maxcount);
927 # $tbl->setStyle("table", "std");
932 foreach ($user_acc as $user)
935 $data[0] = $user[
"name"];
936 $data[1] = $user[
"client_ip"];
937 $data[2] = $user[
"language"];
938 $data[3] = $user[
"acc_obj_id"];
939 $data[4] = $user[
"acc_time"];
940 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
941 foreach (
$data as $key => $val)
947 $tplTable->setCurrentBlock(
"text");
948 $tplTable->setVariable(
"TEXT_CONTENT", $val);
949 $tplTable->parseCurrentBlock();
950 $tplTable->setCurrentBlock(
"table_cell");
951 $tplTable->parseCurrentBlock();
953 $tplTable->setCurrentBlock(
"tbl_content");
954 $tplTable->setVariable(
"CSS_ROW", $css_row);
955 $tplTable->parseCurrentBlock();
961 $tpl->setCurrentBlock(
"user_mode");
962 #$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
964 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormaction($this,
'gateway'));
965 if(
$_POST[
"object_type"]==
"lm")
967 $tpl->setVariable(
"AUTHOR",
"author");
968 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
969 $tpl->setVariable(
"OBJECT",
"lm");
970 $tpl->setVariable(
"OBJECTS",
$_POST[
"lm"]);
972 else if(
$_POST[
"object_type"]==
"htlm")
974 $tpl->setVariable(
"AUTHOR",
"author");
975 $tpl->setVariable(
"AUTHORS",
$_POST[
"author"]);
976 $tpl->setVariable(
"OBJECT",
"htlm");
977 $tpl->setVariable(
"OBJECTS",
$_POST[
"htlm"]);
981 $tpl->setVariable(
"AUTHOR",
"author1");
982 $tpl->setVariable(
"AUTHORS",
$_POST[
"author1"]);
983 $tpl->setVariable(
"OBJECT",
"tst");
984 $tpl->setVariable(
"OBJECTS",
$_POST[
"tst"]);
986 $tpl->setVariable(
"YEARF",
$_POST[
"yearf"]);
987 $tpl->setVariable(
"MONTHF",
$_POST[
"monthf"]);
988 $tpl->setVariable(
"DAYF",
$_POST[
"dayf"]);
989 $tpl->setVariable(
"YEART",
$_POST[
"yeart"]);
990 $tpl->setVariable(
"MONTHT",
$_POST[
"montht"]);
991 $tpl->setVariable(
"DAYT",
$_POST[
"dayt"]);
992 $tpl->setVariable(
"USER",
"user");
993 $tpl->setVariable(
"LAN",
$_POST[
"language"]);
994 $tpl->setVariable(
"TYPE",
$_POST[
"object_type"]);
996 $tpl->setVariable(
"FROM", $from);
997 $tpl->setVariable(
"TO", $to);
998 $tpl->setVariable(
"TXT_SHOW_USER_DATA", $lng->txt(
"user_detail"));
999 $tpl->parseCurrentBlock();
1000 $title_new = array(
"user",
"count",
"");
1003 $user_acc = $this->
object->getAccessTotalPerUser($condition, $searchTermsCondition, $objectCondition);
1005 $this->maxcount = count($user_acc);
1008 if ($this->maxcount < 1)
1010 $this->ilias->raiseError($lng->txt(
"msg_no_search_result"),
1011 $this->ilias->error_obj->MESSAGE);
1014 # $tbl->setTitle($lng->txt("search_result"),0,0);
1015 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_access_of_users"),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 $tbl->setColumnWidth(array(
"20%",
"10%",
"*"));
1024 $tbl->setMaxCount($this->maxcount);
1025 # $tbl->setStyle("table", "std");
1028 foreach ($user_acc as $user)
1030 $max = ($max > $user[
"cnt"]) ? $max : $user[
"cnt"];
1034 foreach ($user_acc as $user)
1037 $data[0] = $user[
"name"];
1038 $data[1] = $user[
"cnt"];
1040 ? round(
$data[1] / $max * 100)
1042 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1043 "width=\"".$width.
"\" height=\"10\"/>";
1045 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1046 foreach (
$data as $key => $val)
1052 $tplTable->setCurrentBlock(
"text");
1053 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1054 $tplTable->parseCurrentBlock();
1055 $tplTable->setCurrentBlock(
"table_cell");
1056 $tplTable->parseCurrentBlock();
1058 $tplTable->setCurrentBlock(
"tbl_content");
1059 $tplTable->setVariable(
"CSS_ROW", $css_row);
1060 $tplTable->parseCurrentBlock();
1068 $title_new = array(
"time",
"count",
"");
1070 # $tbl->setTitle($lng->txt("obj_trac"),0,0);
1071 unset($header_names);
1072 foreach ($title_new as $val)
1074 $header_names[] = $lng->txt($val);
1076 $tbl->disable(
"sort");
1077 $tbl->setHeaderNames($header_names);
1080 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_times_of_day"),0,0);
1081 $tbl->setColumnWidth(array(
"30%",
"10%",
"*"));
1085 $tbl->setTitle($lng->txt(
"obj_trac").
": ".$lng->txt(
"vm_days_of_period"),0,0);
1086 $tbl->setColumnWidth(array(
"15%",
"10%",
"*"));
1092 $tbl->setMaxCount($num);
1096 $num = $this->
numDay($from,$to);
1097 $from1 = $this->
addDay($from);
1098 $tbl->setMaxCount($num);
1100 # $tbl->setStyle("table", "std");
1108 $time = $this->
selectTime($from,$to,$condition,$searchTermsCondition,$objectCondition);
1110 for($i=0;$i<24;$i++)
1116 for($j=0;$j<count($time);$j++)
1118 $time1 = strtotime($time[$j][0]);
1119 $day = date(
"d",$time1);
1120 $month = date(
"m",$time1);
1121 $year = date(
"Y",$time1);
1122 $hour = date(
"H",$time1);
1123 $min = date(
"i",$time1);
1124 $sec = date(
"s",$time1);
1125 $numb = date(
"H",mktime($hour,$min,$sec,$month,$day,$year));
1126 $numb = intval($numb);
1127 if($numb >=$i and $numb <$k)
1133 $max = ($cou > $max) ? $cou : $max;
1136 for($i=0;$i<24;$i++)
1140 $data[0] = ($i < 10 ?
"0".$i : $i).
":00:00 ~ ".($k < 10 ?
"0".$k : $k).
":00:00";
1141 $data[1] = $count[$i];
1143 ? round($count[$i] / $max * 100)
1145 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1146 "width=\"".$width.
"\" height=\"10\"/>";
1148 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1149 foreach (
$data as $key => $val)
1151 $tplTable->setCurrentBlock(
"text");
1152 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1153 $tplTable->parseCurrentBlock();
1154 $tplTable->setCurrentBlock(
"table_cell");
1155 $tplTable->parseCurrentBlock();
1157 $tplTable->setCurrentBlock(
"tbl_content");
1158 $tplTable->setVariable(
"CSS_ROW", $css_row);
1159 $tplTable->parseCurrentBlock();
1166 for($i=0;$i<$num;$i++)
1169 $cou[$i] = $this->
countNum($from,$from1,$condition,$searchTermsCondition,$objectCondition);
1171 $from1 = $this->
addDay($from);
1172 $max = ($max > $cou[$i]) ? $max : $cou[$i];
1174 for($i=0;$i<$num;$i++)
1177 $data[0] = $fro[$i];
1178 $data[1] = $cou[$i];
1180 ? round($cou[$i] / $max * 100)
1182 $data[2] =
"<img src=\"".ilUtil::getImagePath(
"ray.gif").
"\" border=\"0\" ".
1183 "width=\"".$width.
"\" height=\"10\"/>";
1185 $css_row = $i%2==0?
"tblrow1":
"tblrow2";
1186 foreach (
$data as $key => $val)
1188 $tplTable->setCurrentBlock(
"text");
1189 $tplTable->setVariable(
"TEXT_CONTENT", $val);
1190 $tplTable->parseCurrentBlock();
1191 $tplTable->setCurrentBlock(
"table_cell");
1192 $tplTable->parseCurrentBlock();
1194 $tplTable->setCurrentBlock(
"tbl_content");
1195 $tplTable->setVariable(
"CSS_ROW", $css_row);
1196 $tplTable->parseCurrentBlock();
1202 $tpl->setVariable(
"TRACK_TABLE", $tplTable->get());
1264 if ($lang_cond ==
"")
1271 $this->
setConditions($lang_cond.
" AND ".$this->getObjectCondition());
1284 $type =
$_POST[
"object_type"];
1286 if(
$_POST[
"object_type"]==
"lm")
1288 if(
$_POST[
"author"]==
"0")
1290 return " acc_obj_type = 'lm'";
1296 foreach ($authors as $author)
1298 if($author[
"title"]==
$_POST[
"author"])
1302 foreach ($lms as $lm)
1304 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1310 return " ( 0 ".$condition.
" ) ";
1314 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"lm"],$type);
1319 else if(
$_POST[
"object_type"]==
"htlm")
1321 if(
$_POST[
"author"]==
"0")
1323 return " acc_obj_type = 'htlm'";
1329 foreach ($authors as $author)
1331 if($author[
"title"]==
$_POST[
"author"])
1335 foreach ($htlms as $htlm)
1337 $condition = $condition.
" or acc_obj_id = ".$htlm[
"obj_id"];
1343 return " ( 0 ".$condition.
" ) ";
1347 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"htlm"],$type);
1354 if(
$_POST[
"author1"]==
"0")
1356 return " acc_obj_type = 'tst'";
1362 foreach ($authors as $author)
1364 if($author[
"title"]==
$_POST[
"author1"])
1368 foreach ($lms as $lm)
1370 $condition = $condition.
" or acc_obj_id = ".$lm[
"obj_id"];
1376 return " ( 0 ".$condition.
" ) ";
1380 $condition.=
" acc_obj_id = ".ilObjUserTracking::getObjId(
$_POST[
"tst"],$type);
1393 if (
$_POST[
"language"] !=
"0")
1395 return "ut_access.language =".$ilDB->quote(
$_POST[
"language"],
"text");
1408 if (trim(
$_POST[
"search_terms"]) !=
"")
1411 $terms = explode(
" ",
$_POST[
"search_terms"]);
1412 for ($i = 0; $i < count($terms); $i++)
1414 if (trim($terms[$i]) !=
"") $sub_ret .=
"oa.title LIKE '%".
ilUtil::addSlashes(trim($terms[$i])).
"%' OR ";
1418 return " INNER JOIN object_data oa ON oa.obj_id = acc_obj_id WHERE (".substr($sub_ret, 0, strlen($sub_ret)-4) .
") AND ";
1427 $this->conditions = $con;
1440 $from = strtotime($from);
1441 $to = strtotime($to);
1443 $dayf = date (
"d",$from);
1444 $dayt = date (
"d",$to);
1445 $yearf = date (
"Y",$from);
1446 $yeart = date (
"Y",$to);
1447 $montht = date (
"m",$to);
1448 $monthf = date (
"m",$from);
1450 # $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
1453 $from = mktime(12,0,0,$monthf,$dayf,$yearf);
1454 $to = mktime(12,0,0,$montht,$dayt,$yeart);
1456 $ret = (round(($to - $from) / 86400) + 1);
1459 # $x0 = gregoriantojd($monthf,$dayf,$yearf);
1460 # $x1 = gregoriantojd($montht,$dayt,$yeart);
1461 # return (($x1 - $x0)+1);
1469 $from = strtotime($from);
1470 $to = strtotime($to);
1471 $dayf = date (
"d",$from);
1472 $dayt = date (
"d",$to);
1473 $yearf = date (
"Y",$from);
1474 $yeart = date (
"Y",$to);
1475 $montht = date (
"m",$to);
1476 $monthf = date (
"m",$from);
1477 $hourt = date (
"h",$to);
1478 $hourf = date (
"h",$from);
1479 $ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
1489 $time = strtotime($time);
1490 $day = date(
"d",$time);
1491 $month = date(
"m",$time);
1492 $year = date(
"Y",$time);
1493 $hour = date(
"H",$time);
1494 $min = date(
"i",$time);
1495 $sec = date(
"s",$time);
1497 $ret = date(
"H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
1506 $time = strtotime($time);
1507 $day = date(
"d",$time);
1508 $month = date(
"m",$time);
1509 $year = date(
"y",$time);
1510 $min = date(
"i",$time);
1511 $hour = date(
"h",$time);
1512 $sec = date(
"s",$time);
1514 $ret = date (
"Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
1521 function selectTime($from,$to,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1525 $q =
"SELECT acc_time from ut_access "
1526 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1527 .
" (acc_time >= ".$ilDB->quote($from.
" 00:00:00",
"timestamp")
1528 .
" AND acc_time <= ".$ilDB->quote($to.
" 23:59:59",
"timestamp").
")"
1531 .
" GROUP BY acc_time";
1532 $res = $this->ilias->db->query($q);
1533 for($i=0;$i<
$res->numRows();$i++)
1543 function countNum($from,$from1,$condition,$searchTermsCondition=
"",$objectCondition=
"")
1547 $q =
"SELECT id FROM ut_access"
1548 .($searchTermsCondition !=
"" ? $searchTermsCondition :
" WHERE ")
1549 .
" (acc_time >= ".$ilDB->quote($from.
" 00:00:00",
"timestamp")
1550 .
" AND acc_time <= ".$ilDB->quote($from1.
" 00:00:00",
"timestamp").
")"
1554 $res = $this->ilias->db->query($q);
1555 return $res->numRows();