141 $a_user_id = $ilUser->getId();
143 if(!$a_user_id || $a_user_id == ANONYMOUS_USER_ID)
148 switch((
int)$a_event)
150 case self::EVENT_PAGE_CREATED:
151 self::handlePageCreated($a_page_obj, $a_user_id);
154 case self::EVENT_PAGE_UPDATED:
155 self::handlePageUpdated($a_page_obj, $a_user_id, $a_additional_data);
158 case self::EVENT_PAGE_READ:
159 self::handlePageRead($a_page_obj, $a_user_id);
162 case self::EVENT_PAGE_DELETED:
163 self::handlePageDeletion($a_page_obj, $a_user_id);
166 case self::EVENT_PAGE_RATING:
167 self::handlePageRating($a_page_obj, $a_user_id);
182 return date(
"Y-m-d H:00:00");
199 $tstamp = self::getTimestamp();
200 $a_primary[
"ts"] =
array(
"timestamp", $tstamp);
202 $ilAtomQuery = $ilDB->buildAtomQuery();
203 $ilAtomQuery->addTableLock($a_table);
205 $ilAtomQuery->addQueryCallable(
206 function(
ilDBInterface $ilDB) use($a_table, $a_primary, $a_values, $tstamp, &$is_update){
209 foreach($a_primary as
$column => $value)
211 $primary[] =
$column.
" = ".$ilDB->
quote($value[1], $value[0]);
213 $primary = implode(
" AND ", $primary);
215 $set = $ilDB->
query(
"SELECT ts FROM ".$a_table.
218 $is_update = (bool)$ilDB->
numRows($set);
224 foreach($a_values as
$column => $value)
226 if($value[0] ==
"increment")
230 else if($value[0] ==
"decrement")
236 $values[] =
$column.
" = ".$ilDB->
quote($value[1], $value[0]);
239 $values = implode(
", ", $values);
241 $sql =
"UPDATE ".$a_table.
248 $a_values = array_merge($a_primary, $a_values);
249 $a_values[
"ts_day"] =
array(
"text", substr($tstamp, 0, 10));
250 $a_values[
"ts_hour"] =
array(
"integer", (
int)substr($tstamp, 11, 2));
253 foreach($a_values as
$column => $value)
256 if($value[0] ==
"increment")
258 $value[0] =
"integer";
260 else if($value[0] ==
"decrement")
262 $value[0] =
"integer";
265 $values[] = $ilDB->
quote($value[1], $value[0]);
267 $values = implode(
", ", $values);
270 $sql =
"INSERT INTO ".$a_table.
272 " VALUES (".$values.
")";
287 protected static function writeStat($a_wiki_id, $a_values)
290 "wiki_id" =>
array(
"integer", $a_wiki_id)
292 self::writeData(
"wiki_stat", $primary, $a_values);
305 "wiki_id" =>
array(
"integer", $a_wiki_id),
306 "page_id" =>
array(
"integer", $a_page_id),
308 self::writeData(
"wiki_stat_page", $primary, $a_values);
322 "wiki_id" =>
array(
"integer", $a_wiki_id),
323 "page_id" =>
array(
"integer", $a_page_id),
324 "user_id" =>
array(
"integer", $a_user_id)
326 self::writeData(
"wiki_stat_page_user", $primary, $a_values);
339 "wiki_id" =>
array(
"integer", $a_wiki_id),
340 "user_id" =>
array(
"integer", $a_user_id)
342 self::writeData(
"wiki_stat_user", $primary, $a_values);
365 include_once
"Services/Rating/classes/class.ilRating.php";
392 self::writeStat($a_page_obj->
getWikiId(),
394 "num_pages" =>
array(
"integer", self::countPages($a_page_obj->
getWikiId())),
395 "del_pages" =>
array(
"integer", 0),
396 "avg_rating" =>
array(
"integer", 0)
400 self::writeStatUser($a_page_obj->
getWikiId(), $a_user_id,
402 "new_pages" =>
array(
"increment", 1)
416 self::writeStatPageUser($a_page_obj->
getWikiId(), $a_page_obj->
getId(), $a_user_id,
418 "changes" =>
array(
"increment", 1)
423 "int_links" =>
array(
"integer", $a_page_data[
"int_links"]),
424 "ext_links" =>
array(
"integer", $a_page_data[
"ext_links"]),
425 "footnotes" =>
array(
"integer", $a_page_data[
"footnotes"]),
426 "num_words" =>
array(
"integer", $a_page_data[
"num_words"]),
427 "num_chars" =>
array(
"integer", $a_page_data[
"num_chars"]),
428 "num_ratings" =>
array(
"integer", 0),
429 "avg_rating" =>
array(
"integer", 0)
431 self::writeStatPage($a_page_obj->
getWikiId(), $a_page_obj->
getId(), $values);
443 self::writeStatPageUser($a_page_obj->
getWikiId(), $a_page_obj->
getId(), $a_user_id,
445 "read_events" =>
array(
"increment", 1)
461 " FROM wiki_stat_page".
462 " WHERE wiki_id = ".$ilDB->quote($a_page_obj->
getWikiId(),
"integer").
463 " AND page_id = ".$ilDB->quote($a_page_obj->
getId(),
"integer") .
466 $set = $ilDB->query($sql);
469 if($ilDB->numRows($set))
471 $data = $ilDB->fetchAssoc($set);
475 "int_links" =>
array(
"integer",
$data[
"int_links"]),
476 "ext_links" =>
array(
"integer",
$data[
"ext_links"]),
477 "footnotes" =>
array(
"integer",
$data[
"footnotes"]),
478 "num_words" =>
array(
"integer",
$data[
"num_words"]),
479 "num_chars" =>
array(
"integer",
$data[
"num_chars"]),
480 "num_ratings" =>
array(
"integer",
$data[
"num_ratings"]),
481 "avg_rating" =>
array(
"integer",
$data[
"avg_rating"]),
483 self::writeStatPage((
int) $a_page_obj->
getWikiId(), $a_page_obj->
getId(), $values);
487 $ilDB->manipulate(
"UPDATE wiki_stat_page".
488 " SET deleted = ".$ilDB->quote(1,
"integer").
489 " WHERE page_id = ".$ilDB->quote($a_page_obj->
getId(),
"integer").
490 " AND wiki_id = ".$ilDB->quote($a_page_obj->
getWikiId(),
"integer"));
493 $rating = self::getAverageRating($a_page_obj->
getWikiId());
494 self::writeStat($a_page_obj->
getWikiId(),
496 "del_pages" =>
array(
"increment", 1),
497 "num_pages" =>
array(
"integer", self::countPages($a_page_obj->
getWikiId())),
498 "avg_rating" =>
array(
"integer", $rating[
"avg"]*100)
511 $rating = self::getAverageRating($a_page_obj->
getWikiId(), $a_page_obj->
getId());
514 self::writeStatPage($a_page_obj->
getWikiId(), $a_page_obj->
getId(),
516 "num_ratings" =>
array(
"integer", $rating[
"cnt"]),
517 "avg_rating" =>
array(
"integer", $rating[
"avg"]*100),
520 $rating = self::getAverageRating($a_page_obj->
getWikiId());
523 $is_update = self::writeStat($a_page_obj->
getWikiId(),
525 "avg_rating" =>
array(
"integer", $rating[
"avg"]*100)
531 self::writeStat($a_page_obj->
getWikiId(),
533 "num_pages" =>
array(
"integer", self::countPages($a_page_obj->
getWikiId()))
543 protected static function getWikiAggr($a_wiki_id, $a_day_from, $a_day_to, $a_table, $a_field, $a_aggr_value, $a_sub_field = null, $a_sub_id = null, $a_build_full_period =
false)
550 $sql =
"SELECT ts_day, ".sprintf($a_aggr_value, $a_field).
" ".$a_field;
551 if($a_table ==
"wiki_stat_page" && $a_sub_field)
553 $sql .=
", MAX(deleted) deleted";
555 $sql .=
" FROM ".$a_table.
556 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
557 " AND ts_day >= ".$ilDB->quote($a_day_from,
"text").
558 " AND ts_day <= ".$ilDB->quote($a_day_to,
"text");
559 if(!$a_build_full_period)
562 $sql .=
" AND ".$a_field.
" > ".$ilDB->quote(0,
"integer").
563 " AND ".$a_field.
" IS NOT NULL";
567 $sql .=
" AND ".$a_sub_field.
" = ".$ilDB->quote($a_sub_id,
"integer");
569 $sql .=
" GROUP BY ts_day".
571 $set = $ilDB->query($sql);
572 while(
$row = $ilDB->fetchAssoc($set))
574 $res[
$row[
"ts_day"]] = $row[$a_field];
576 $deleted = max($row[
"deleted"], $deleted);
579 if($a_build_full_period)
581 $period_first = $a_day_from;
582 $period_last = $a_day_to;
585 if($a_table ==
"wiki_stat_page" && $a_sub_field && $deleted)
587 $sql =
"SELECT MAX(ts_day) last_day, MIN(ts_day) first_day".
589 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
590 " AND ".$a_sub_field.
" = ".$ilDB->quote($a_sub_id,
"integer");
591 $set = $ilDB->query($sql);
592 $row = $ilDB->fetchAssoc($set);
593 $last_day =
$row[
"last_day"];
594 if($last_day < $period_last)
596 $period_last = $last_day;
598 $first_day =
$row[
"first_day"];
599 if($first_day > $period_first)
601 $period_first = $first_day;
605 $last_before_period = null;
606 if(!
$res[$a_day_from])
608 $last_before_period = self::getWikiLast($a_wiki_id, $a_day_from, $a_table, $a_field, $a_sub_field, $a_sub_id);
612 self::buildFullPeriodData(
$res, $period_first, $period_last, $last_before_period);
618 protected static function getWikiLast($a_wiki_id, $a_day_from, $a_table, $a_field, $a_sub_field = null, $a_sub_id = null)
623 $sql =
"SELECT MAX(".$a_field.
") latest".
625 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
626 " AND ts_day < ".$ilDB->quote($a_day_from,
"text");
629 $sql .=
" AND ".$a_sub_field.
" = ".$ilDB->quote($a_sub_id,
"integer");
631 $sql .=
" GROUP BY ts_day".
632 " ORDER BY ts_day DESC";
634 $set = $ilDB->query($sql);
635 $last_before_period = $ilDB->fetchAssoc($set);
636 return $last_before_period[
"latest"];
639 protected static function getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to, $a_table, $a_field, $a_aggr_by, $a_aggr_value, $a_aggr_sub, $a_sub_field = null, $a_sub_id = null, $a_build_full_period =
false)
645 if(!$a_build_full_period)
647 $sql =
"SELECT ts_day, ".sprintf($a_aggr_value, $a_field).
" ".$a_field.
650 " SELECT ts_day, ".sprintf($a_aggr_sub, $a_field).
" ".$a_field.
652 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
653 " AND ts_day >= ".$ilDB->quote($a_day_from,
"text").
654 " AND ts_day <= ".$ilDB->quote($a_day_to,
"text").
655 " AND ".$a_field.
" > ".$ilDB->quote(0,
"integer").
656 " AND ".$a_field.
" IS NOT NULL";
659 $sql .=
" AND ".$a_sub_field.
" = ".$ilDB->quote($a_sub_id,
"integer");
661 $sql .=
" GROUP BY ts_day, ".$a_aggr_by.
665 $set = $ilDB->query($sql);
666 while(
$row = $ilDB->fetchAssoc($set))
668 $res[
$row[
"ts_day"]] = $row[$a_field];
673 $tmp = $all_aggr_ids = $deleted_in_period = $first_day_in_period =
array();
675 if($a_table !=
"wiki_stat_page")
677 echo "can only build full period averages for wiki_stat_page";
684 " SELECT ".$a_aggr_by.
", MAX(deleted) deleted, MAX(ts_day) last_day, MIN(ts_day) first_day".
686 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
687 " GROUP BY ".$a_aggr_by.
689 " WHERE first_day <= ".$ilDB->quote($a_day_to,
"text").
690 " AND (last_day >= ".$ilDB->quote($a_day_from,
"text").
691 " OR deleted = ".$ilDB->quote(0,
"integer").
")";
692 $set = $ilDB->query($sql);
693 while(
$row = $ilDB->fetchAssoc($set))
695 $all_aggr_ids[] =
$row[$a_aggr_by];
698 if(
$row[
"deleted"] &&
$row[
"last_day"] < $a_day_to)
700 $deleted_in_period[
$row[$a_aggr_by]] = $row[
"last_day"];
703 if(
$row[
"first_day"] > $a_day_from)
705 $first_day_in_period[
$row[$a_aggr_by]] = $row[
"first_day"];
710 $sql =
" SELECT ts_day, ".$a_aggr_by.
", ".sprintf($a_aggr_sub, $a_field).
" ".$a_field.
712 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
713 " AND ts_day >= ".$ilDB->quote($a_day_from,
"text").
714 " AND ts_day <= ".$ilDB->quote($a_day_to,
"text");
715 $sql .=
" GROUP BY ts_day, ".$a_aggr_by;
716 $set = $ilDB->query($sql);
717 while(
$row = $ilDB->fetchAssoc($set))
719 if(!in_array(
$row[$a_aggr_by], $all_aggr_ids))
721 var_dump(
"unexpected wiki_stat_page_entry",
$row);
723 $tmp[
$row[$a_aggr_by]][
$row[
"ts_day"]] = $row[$a_field];
727 foreach($all_aggr_ids as $aggr_by_id)
730 if(!is_array($tmp[$aggr_by_id]))
732 $tmp[$aggr_by_id] =
array();
736 $last_before_period = null;
737 if(!$tmp[$aggr_by_id][$a_day_from])
739 $last_before_period = self::getWikiLast($a_wiki_id, $a_day_from, $a_table, $a_field, $a_aggr_by, $aggr_by_id);
743 $first_period_day = isset($first_day_in_period[$aggr_by_id])
744 ? $first_day_in_period[$aggr_by_id]
748 $last_period_day = isset($deleted_in_period[$aggr_by_id])
749 ? $deleted_in_period[$aggr_by_id]
753 self::buildFullPeriodData($tmp[$aggr_by_id], $first_period_day, $last_period_day, $last_before_period,
true);
756 foreach($tmp[$aggr_by_id] as $day => $value)
758 $res[$day][$aggr_by_id] = $value;
763 foreach(
$res as $day => $values)
765 switch($a_aggr_value)
768 $res[$day] = array_sum($values)/
sizeof($values);
772 $res[$day] = array_sum($values);
776 var_dump(
"unsupport aggr ".$a_aggr_value);
790 $today =
date(
"Y-m-d");
791 $current = explode(
"-", $a_day_from);
792 $current =
date(
"Y-m-d", mktime(0, 0, 1, $current[1], $current[2], $current[0]));
793 while($current <= $a_day_to &&
796 if(!isset($a_res[$current]))
798 if($current <= $today)
803 $a_res[$current] = $last;
806 else if($a_last_before_period || $a_allow_zero)
808 $a_res[$current] = $a_last_before_period;
814 $last = $a_res[$current];
817 $current = explode(
"-", $current);
818 $current =
date(
"Y-m-d", mktime(0, 0, 1, $current[1], $current[2]+1, $current[0]));
829 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat",
"num_pages",
"MAX(%s)", null, null,
true);
834 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_user",
"new_pages",
"SUM(%s)");
839 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_user",
"new_pages",
"user_id",
"AVG(%s)",
"SUM(%s)");
844 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat",
"del_pages",
"SUM(%s)");
849 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page_user",
"read_events",
"SUM(%s)");
858 $sql =
"SELECT ts_day, COUNT(DISTINCT(page_id)) num_changed_pages".
859 " FROM wiki_stat_page_user".
860 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
861 " AND ts_day >= ".$ilDB->quote($a_day_from,
"text").
862 " AND ts_day <= ".$ilDB->quote($a_day_to,
"text").
863 " AND changes > ".$ilDB->quote(0,
"integer").
864 " AND changes IS NOT NULL".
867 $set = $ilDB->query($sql);
868 while(
$row = $ilDB->fetchAssoc($set))
870 $res[
$row[
"ts_day"]] = $row[
"num_changed_pages"];
882 $sql =
"SELECT ts_day, AVG(num_changed_pages) num_changed_pages".
885 " SELECT ts_day, COUNT(DISTINCT(page_id)) num_changed_pages".
886 " FROM wiki_stat_page_user".
887 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
888 " AND ts_day >= ".$ilDB->quote($a_day_from,
"text").
889 " AND ts_day <= ".$ilDB->quote($a_day_to,
"text").
890 " AND changes > ".$ilDB->quote(0,
"integer").
891 " AND changes IS NOT NULL".
892 " GROUP BY ts_day, user_id".
896 $set = $ilDB->query($sql);
897 while(
$row = $ilDB->fetchAssoc($set))
899 $res[
$row[
"ts_day"]] = $row[
"num_changed_pages"];
905 protected static function getWikiUserEditPages($a_wiki_id, $a_day_from, $a_day_to, $a_sub_field = null, $a_sub_id = null)
911 $sql =
"SELECT ts_day, COUNT(DISTINCT(user_id)) num_changed_users".
912 " FROM wiki_stat_page_user".
913 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
914 " AND ts_day >= ".$ilDB->quote($a_day_from,
"text").
915 " AND ts_day <= ".$ilDB->quote($a_day_to,
"text").
916 " AND changes > ".$ilDB->quote(0,
"integer").
917 " AND changes IS NOT NULL";
920 $sql .=
" AND ".$a_sub_field.
" = ".$ilDB->quote($a_sub_id,
"integer");
922 $sql .=
" GROUP BY ts_day".
924 $set = $ilDB->query($sql);
925 while(
$row = $ilDB->fetchAssoc($set))
927 $res[
$row[
"ts_day"]] = $row[
"num_changed_users"];
939 $sql =
"SELECT ts_day, AVG(num_changed_users) num_changed_users".
942 " SELECT ts_day, COUNT(DISTINCT(user_id)) num_changed_users".
943 " FROM wiki_stat_page_user".
944 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
945 " AND ts_day >= ".$ilDB->quote($a_day_from,
"text").
946 " AND ts_day <= ".$ilDB->quote($a_day_to,
"text").
947 " AND changes > ".$ilDB->quote(0,
"integer").
948 " AND changes IS NOT NULL".
949 " GROUP BY ts_day, page_id".
953 $set = $ilDB->query($sql);
954 while(
$row = $ilDB->fetchAssoc($set))
956 $res[
$row[
"ts_day"]] = $row[
"num_changed_users"];
964 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_ratings",
"SUM(%s)");
969 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_ratings",
"page_id",
"AVG(%s)",
"SUM(%s)");
974 $res = self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat",
"avg_rating",
"AVG(%s)");
976 foreach(array_keys(
$res) as $day)
987 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"int_links",
"page_id",
"SUM(%s)",
"MAX(%s)", null, null,
true);
992 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"int_links",
"page_id",
"AVG(%s)",
"MAX(%s)", null, null,
true);
997 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"ext_links",
"page_id",
"SUM(%s)",
"MAX(%s)", null, null,
true);
1002 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"ext_links",
"page_id",
"AVG(%s)",
"MAX(%s)", null, null,
true);
1007 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_words",
"page_id",
"SUM(%s)",
"MAX(%s)", null, null,
true);
1012 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_words",
"page_id",
"AVG(%s)",
"MAX(%s)", null, null,
true);
1017 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_chars",
"page_id",
"SUM(%s)",
"MAX(%s)", null, null,
true);
1022 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_chars",
"page_id",
"AVG(%s)",
"MAX(%s)", null, null,
true);
1027 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"footnotes",
"page_id",
"SUM(%s)",
"MAX(%s)", null, null,
true);
1032 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"footnotes",
"page_id",
"AVG(%s)",
"MAX(%s)", null, null,
true);
1042 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page_user",
"changes",
"SUM(%s)",
"page_id", $a_page_id);
1047 return self::getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page_user",
"changes",
"user_id",
"AVG(%s)",
"SUM(%s)",
"page_id", $a_page_id);
1052 return self::getWikiUserEditPages($a_wiki_id, $a_day_from, $a_day_to,
"page_id", $a_page_id);
1057 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page_user",
"read_events",
"SUM(%s)",
"page_id", $a_page_id);
1062 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"int_links",
"MAX(%s)",
"page_id", $a_page_id,
true);
1067 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"ext_links",
"MAX(%s)",
"page_id", $a_page_id,
true);
1072 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_words",
"MAX(%s)",
"page_id", $a_page_id,
true);
1077 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_chars",
"MAX(%s)",
"page_id", $a_page_id,
true);
1082 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"footnotes",
"MAX(%s)",
"page_id", $a_page_id,
true);
1087 return self::getWikiAggr($a_wiki_id, $a_day_from, $a_day_to,
"wiki_stat_page",
"num_ratings",
"SUM(%s)",
"page_id", $a_page_id);
1102 $set = $ilDB->query(
"SELECT DISTINCT(SUBSTR(ts_day, 1, 7)) ".$ilDB->quoteIdentifier(
"month").
1103 " FROM wiki_stat_page_user".
1104 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
1105 " AND ts_day IS NOT NULL");
1106 while(
$row = $ilDB->fetchAssoc($set))
1117 self::KEY_FIGURE_WIKI_NUM_PAGES
1118 ,self::KEY_FIGURE_WIKI_NEW_PAGES
1119 ,self::KEY_FIGURE_WIKI_NEW_PAGES_AVG
1120 ,self::KEY_FIGURE_WIKI_EDIT_PAGES
1121 ,self::KEY_FIGURE_WIKI_EDIT_PAGES_AVG
1122 ,self::KEY_FIGURE_WIKI_DELETED_PAGES
1123 ,self::KEY_FIGURE_WIKI_READ_PAGES
1124 ,self::KEY_FIGURE_WIKI_USER_EDIT_PAGES
1125 ,self::KEY_FIGURE_WIKI_USER_EDIT_PAGES_AVG
1126 ,self::KEY_FIGURE_WIKI_NUM_RATING
1127 ,self::KEY_FIGURE_WIKI_NUM_RATING_AVG
1128 ,self::KEY_FIGURE_WIKI_RATING_AVG
1129 ,self::KEY_FIGURE_WIKI_INTERNAL_LINKS
1130 ,self::KEY_FIGURE_WIKI_INTERNAL_LINKS_AVG
1131 ,self::KEY_FIGURE_WIKI_EXTERNAL_LINKS
1132 ,self::KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG
1133 ,self::KEY_FIGURE_WIKI_WORDS
1134 ,self::KEY_FIGURE_WIKI_WORDS_AVG
1135 ,self::KEY_FIGURE_WIKI_CHARS
1136 ,self::KEY_FIGURE_WIKI_CHARS_AVG
1137 ,self::KEY_FIGURE_WIKI_FOOTNOTES
1138 ,self::KEY_FIGURE_WIKI_FOOTNOTES_AVG
1145 self::KEY_FIGURE_WIKI_PAGE_CHANGES
1146 ,self::KEY_FIGURE_WIKI_PAGE_CHANGES_AVG
1147 ,self::KEY_FIGURE_WIKI_PAGE_USER_EDIT
1148 ,self::KEY_FIGURE_WIKI_PAGE_READ
1149 ,self::KEY_FIGURE_WIKI_PAGE_INTERNAL_LINKS
1150 ,self::KEY_FIGURE_WIKI_PAGE_EXTERNAL_LINKS
1151 ,self::KEY_FIGURE_WIKI_PAGE_WORDS
1152 ,self::KEY_FIGURE_WIKI_PAGE_CHARS
1153 ,self::KEY_FIGURE_WIKI_PAGE_FOOTNOTES
1154 ,self::KEY_FIGURE_WIKI_PAGE_RATINGS
1164 self::KEY_FIGURE_WIKI_NUM_PAGES => $lng->txt(
"wiki_stat_num_pages")
1165 ,self::KEY_FIGURE_WIKI_NEW_PAGES => $lng->txt(
"wiki_stat_new_pages")
1166 ,self::KEY_FIGURE_WIKI_NEW_PAGES_AVG => $lng->txt(
"wiki_stat_new_pages_avg")
1167 ,self::KEY_FIGURE_WIKI_EDIT_PAGES => $lng->txt(
"wiki_stat_edit_pages")
1168 ,self::KEY_FIGURE_WIKI_EDIT_PAGES_AVG => $lng->txt(
"wiki_stat_edit_pages_avg")
1169 ,self::KEY_FIGURE_WIKI_DELETED_PAGES => $lng->txt(
"wiki_stat_deleted_pages")
1170 ,self::KEY_FIGURE_WIKI_READ_PAGES => $lng->txt(
"wiki_stat_read_pages")
1171 ,self::KEY_FIGURE_WIKI_USER_EDIT_PAGES => $lng->txt(
"wiki_stat_user_edit_pages")
1172 ,self::KEY_FIGURE_WIKI_USER_EDIT_PAGES_AVG => $lng->txt(
"wiki_stat_user_edit_pages_avg")
1173 ,self::KEY_FIGURE_WIKI_NUM_RATING => $lng->txt(
"wiki_stat_num_rating")
1174 ,self::KEY_FIGURE_WIKI_NUM_RATING_AVG => $lng->txt(
"wiki_stat_num_rating_avg")
1175 ,self::KEY_FIGURE_WIKI_RATING_AVG => $lng->txt(
"wiki_stat_rating_avg")
1176 ,self::KEY_FIGURE_WIKI_INTERNAL_LINKS => $lng->txt(
"wiki_stat_internal_links")
1177 ,self::KEY_FIGURE_WIKI_INTERNAL_LINKS_AVG => $lng->txt(
"wiki_stat_internal_links_avg")
1178 ,self::KEY_FIGURE_WIKI_EXTERNAL_LINKS => $lng->txt(
"wiki_stat_external_links")
1179 ,self::KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG => $lng->txt(
"wiki_stat_external_links_avg")
1180 ,self::KEY_FIGURE_WIKI_WORDS => $lng->txt(
"wiki_stat_words")
1181 ,self::KEY_FIGURE_WIKI_WORDS_AVG => $lng->txt(
"wiki_stat_words_avg")
1182 ,self::KEY_FIGURE_WIKI_CHARS => $lng->txt(
"wiki_stat_chars")
1183 ,self::KEY_FIGURE_WIKI_CHARS_AVG => $lng->txt(
"wiki_stat_chars_avg")
1184 ,self::KEY_FIGURE_WIKI_FOOTNOTES => $lng->txt(
"wiki_stat_footnotes")
1185 ,self::KEY_FIGURE_WIKI_FOOTNOTES_AVG => $lng->txt(
"wiki_stat_footnotes_avg")
1187 ,self::KEY_FIGURE_WIKI_PAGE_CHANGES => $lng->txt(
"wiki_stat_page_changes")
1188 ,self::KEY_FIGURE_WIKI_PAGE_CHANGES_AVG => $lng->txt(
"wiki_stat_page_changes_avg")
1189 ,self::KEY_FIGURE_WIKI_PAGE_USER_EDIT => $lng->txt(
"wiki_stat_page_user_edit")
1190 ,self::KEY_FIGURE_WIKI_PAGE_READ => $lng->txt(
"wiki_stat_page_read")
1191 ,self::KEY_FIGURE_WIKI_PAGE_INTERNAL_LINKS => $lng->txt(
"wiki_stat_page_internal_links")
1192 ,self::KEY_FIGURE_WIKI_PAGE_EXTERNAL_LINKS => $lng->txt(
"wiki_stat_page_external_links")
1193 ,self::KEY_FIGURE_WIKI_PAGE_WORDS => $lng->txt(
"wiki_stat_page_words")
1194 ,self::KEY_FIGURE_WIKI_PAGE_CHARS => $lng->txt(
"wiki_stat_page_characters")
1195 ,self::KEY_FIGURE_WIKI_PAGE_FOOTNOTES => $lng->txt(
"wiki_stat_page_footnotes")
1196 ,self::KEY_FIGURE_WIKI_PAGE_RATINGS => $lng->txt(
"wiki_stat_page_ratings")
1199 return $map[$a_figure];
1206 case self::KEY_FIGURE_WIKI_NUM_PAGES:
1207 return self::getWikiNumPages($a_wiki_id, $a_from, $a_to);
1209 case self::KEY_FIGURE_WIKI_NEW_PAGES:
1210 return self::getWikiNewPagesSum($a_wiki_id, $a_from, $a_to);
1212 case self::KEY_FIGURE_WIKI_NEW_PAGES_AVG:
1213 return self::getWikiNewPagesAvg($a_wiki_id, $a_from, $a_to);
1215 case self::KEY_FIGURE_WIKI_EDIT_PAGES:
1216 return self::getWikiEditPagesSum($a_wiki_id, $a_from, $a_to);
1218 case self::KEY_FIGURE_WIKI_EDIT_PAGES_AVG:
1219 return self::getWikiEditPagesAvg($a_wiki_id, $a_from, $a_to);
1221 case self::KEY_FIGURE_WIKI_DELETED_PAGES:
1222 return self::getWikiDeletedPages($a_wiki_id, $a_from, $a_to);
1224 case self::KEY_FIGURE_WIKI_READ_PAGES:
1225 return self::getWikiReadPages($a_wiki_id, $a_from, $a_to);
1227 case self::KEY_FIGURE_WIKI_USER_EDIT_PAGES:
1228 return self::getWikiUserEditPages($a_wiki_id, $a_from, $a_to);
1230 case self::KEY_FIGURE_WIKI_USER_EDIT_PAGES_AVG:
1231 return self::getWikiUserEditPages($a_wiki_id, $a_from, $a_to);
1233 case self::KEY_FIGURE_WIKI_NUM_RATING:
1234 return self::getWikiNumRating($a_wiki_id, $a_from, $a_to);
1236 case self::KEY_FIGURE_WIKI_NUM_RATING_AVG:
1237 return self::getWikiNumRatingAvg($a_wiki_id, $a_from, $a_to);
1239 case self::KEY_FIGURE_WIKI_RATING_AVG:
1240 return self::getWikiRatingAvg($a_wiki_id, $a_from, $a_to);
1242 case self::KEY_FIGURE_WIKI_INTERNAL_LINKS:
1243 return self::getWikiInternalLinks($a_wiki_id, $a_from, $a_to);
1245 case self::KEY_FIGURE_WIKI_INTERNAL_LINKS_AVG:
1246 return self::getWikiInternalLinksAvg($a_wiki_id, $a_from, $a_to);
1248 case self::KEY_FIGURE_WIKI_EXTERNAL_LINKS:
1249 return self::getWikiExternalLinks($a_wiki_id, $a_from, $a_to);
1251 case self::KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG:
1252 return self::getWikiExternalLinksAvg($a_wiki_id, $a_from, $a_to);
1254 case self::KEY_FIGURE_WIKI_WORDS:
1255 return self::getWikiWords($a_wiki_id, $a_from, $a_to);
1257 case self::KEY_FIGURE_WIKI_WORDS_AVG:
1258 return self::getWikiWordsAvg($a_wiki_id, $a_from, $a_to);
1260 case self::KEY_FIGURE_WIKI_CHARS:
1261 return self::getWikiCharacters($a_wiki_id, $a_from, $a_to);
1263 case self::KEY_FIGURE_WIKI_CHARS_AVG:
1264 return self::getWikiCharactersAvg($a_wiki_id, $a_from, $a_to);
1266 case self::KEY_FIGURE_WIKI_FOOTNOTES:
1267 return self::getWikiFootnotes($a_wiki_id, $a_from, $a_to);
1269 case self::KEY_FIGURE_WIKI_FOOTNOTES_AVG:
1270 return self::getWikiFootnotesAvg($a_wiki_id, $a_from, $a_to);
1278 case self::KEY_FIGURE_WIKI_PAGE_CHANGES:
1279 return self::getWikiPageChanges($a_wiki_id, $a_page_id, $a_from, $a_to);
1281 case self::KEY_FIGURE_WIKI_PAGE_CHANGES_AVG:
1282 return self::getWikiPageChangesAvg($a_wiki_id, $a_page_id, $a_from, $a_to);
1284 case self::KEY_FIGURE_WIKI_PAGE_USER_EDIT:
1285 return self::getWikiPageUserEdit($a_wiki_id, $a_page_id, $a_from, $a_to);
1287 case self::KEY_FIGURE_WIKI_PAGE_READ:
1288 return self::getWikiPageRead($a_wiki_id, $a_page_id, $a_from, $a_to);
1290 case self::KEY_FIGURE_WIKI_PAGE_INTERNAL_LINKS:
1291 return self::getWikiPageInternalLinks($a_wiki_id, $a_page_id, $a_from, $a_to);
1293 case self::KEY_FIGURE_WIKI_PAGE_EXTERNAL_LINKS:
1294 return self::getWikiPageExternalLinks($a_wiki_id, $a_page_id, $a_from, $a_to);
1296 case self::KEY_FIGURE_WIKI_PAGE_FOOTNOTES:
1297 return self::getWikiPageFootnotes($a_wiki_id, $a_page_id, $a_from, $a_to);
1299 case self::KEY_FIGURE_WIKI_PAGE_WORDS:
1300 return self::getWikiPageWords($a_wiki_id, $a_page_id, $a_from, $a_to);
1302 case self::KEY_FIGURE_WIKI_PAGE_CHARS:
1303 return self::getWikiPageCharacters($a_wiki_id, $a_page_id, $a_from, $a_to);
1305 case self::KEY_FIGURE_WIKI_PAGE_RATINGS:
1306 return self::getWikiPageRatings($a_wiki_id, $a_page_id, $a_from, $a_to);
1314 foreach(self::getFigures() as $figure)
1316 $res[$figure] = self::getFigureTitle($figure);
1326 foreach(self::getFiguresPage() as $figure)
1328 $res[$figure] = self::getFigureTitle($figure);
const KEY_FIGURE_WIKI_PAGE_USER_EDIT
static getWikiInternalLinksAvg($a_wiki_id, $a_day_from, $a_day_to)
static getWikiWords($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_NUM_RATING
const KEY_FIGURE_WIKI_WORDS
static writeStat($a_wiki_id, $a_values)
Write data to wiki_stat.
const KEY_FIGURE_WIKI_FOOTNOTES
const KEY_FIGURE_WIKI_USER_EDIT_PAGES
static getWikiPageChanges($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_PAGE_RATINGS
getWikiId()
Get Wiki Object Id.
const KEY_FIGURE_WIKI_USER_EDIT_PAGES_AVG
const KEY_FIGURE_WIKI_PAGE_READ
static getWikiFootnotesAvg($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_FOOTNOTES_AVG
static getWikiPageWords($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
static getWikiEditPagesAvg($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_NEW_PAGES_AVG
const KEY_FIGURE_WIKI_PAGE_INTERNAL_LINKS
static getWikiExternalLinksAvg($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_INTERNAL_LINKS
static getWikiCharacters($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_NUM_RATING_AVG
const KEY_FIGURE_WIKI_NUM_PAGES
static writeStatPageUser($a_wiki_id, $a_page_id, $a_user_id, $a_values)
Write data to wiki_stat_page_user.
static buildFullPeriodData(array &$a_res, $a_day_from, $a_day_to, $a_last_before_period, $a_allow_zero=false)
const KEY_FIGURE_WIKI_PAGE_CHARS
const KEY_FIGURE_WIKI_PAGE_EXTERNAL_LINKS
static getWikiPageRead($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
static getWikiLast($a_wiki_id, $a_day_from, $a_table, $a_field, $a_sub_field=null, $a_sub_id=null)
static getFigureData($a_wiki_id, $a_figure, $a_from, $a_to)
static getWikiPageRatings($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG
static getWikiUserEditPagesAvg($a_wiki_id, $a_day_from, $a_day_to)
static getWikiAggr($a_wiki_id, $a_day_from, $a_day_to, $a_table, $a_field, $a_aggr_value, $a_sub_field=null, $a_sub_id=null, $a_build_full_period=false)
const KEY_FIGURE_WIKI_PAGE_FOOTNOTES
static getWikiDeletedPages($a_wiki_id, $a_day_from, $a_day_to)
static getWikiNewPagesAvg($a_wiki_id, $a_day_from, $a_day_to)
static getWikiRatingAvg($a_wiki_id, $a_day_from, $a_day_to)
static handlePageRead(ilWikiPage $a_page_obj, $a_user_id)
Handle wiki page read.
static getWikiPageFootnotes($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
static getWikiPageUserEdit($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
static getWikiExternalLinks($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_EXTERNAL_LINKS
static handlePageRating(ilWikiPage $a_page_obj, $a_user_id)
Handle wiki page rating.
static getWikiEditPagesSum($a_wiki_id, $a_day_from, $a_day_to)
static getTimestamp()
Get current time frame (hourly)
static getAverageRating($a_wiki_id, $a_page_id=null)
Get average rating for wiki or wiki page.
static getWikiNumRating($a_wiki_id, $a_day_from, $a_day_to)
static getWikiNewPagesSum($a_wiki_id, $a_day_from, $a_day_to)
static getWikiNumRatingAvg($a_wiki_id, $a_day_from, $a_day_to)
static getWikiPageExternalLinks($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
static countPages($a_wiki_id)
Count pages in wiki.
static getFigureDataPage($a_wiki_id, $a_page_id, $a_figure, $a_from, $a_to)
static getFigureOptions()
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static writeData($a_table, array $a_primary, array $a_values)
Write data to DB.
static handlePageCreated(ilWikiPage $a_page_obj, $a_user_id)
Handle wiki page creation.
const KEY_FIGURE_WIKI_INTERNAL_LINKS_AVG
static getOverallRatingForObject($a_obj_id, $a_obj_type, $a_sub_obj_id=null, $a_sub_obj_type=null, $a_category_id=null)
Get overall rating for an object.
const KEY_FIGURE_WIKI_RATING_AVG
const KEY_FIGURE_WIKI_EDIT_PAGES_AVG
static handleEvent($a_event, ilWikiPage $a_page_obj, $a_user_id=null, array $a_additional_data=null)
Handle wiki page event.
static getWikiPageChangesAvg($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_CHARS
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
Create styles array
The data for the language used.
static writeStatUser($a_wiki_id, $a_user_id, $a_values)
Write to wiki_stat_user.
static getWikiPageInternalLinks($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
static getWikiNumPages($a_wiki_id, $a_day_from, $a_day_to)
static getFigureTitle($a_figure)
static getWikiReadPages($a_wiki_id, $a_day_from, $a_day_to)
static handlePageDeletion(ilWikiPage $a_page_obj, $a_user_id)
Handle wiki page deletion.
const KEY_FIGURE_WIKI_NEW_PAGES
static handlePageUpdated(ilWikiPage $a_page_obj, $a_user_id, array $a_page_data=null)
Handle wiki page update.
const KEY_FIGURE_WIKI_EDIT_PAGES
const KEY_FIGURE_WIKI_CHARS_AVG
static getWikiInternalLinks($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_PAGE_WORDS
static writeStatPage($a_wiki_id, $a_page_id, $a_values)
Write data to wiki_stat_page.
static getFigureOptionsPage()
static getWikiCharactersAvg($a_wiki_id, $a_day_from, $a_day_to)
static getWikiUserEditPages($a_wiki_id, $a_day_from, $a_day_to, $a_sub_field=null, $a_sub_id=null)
static getWikiWordsAvg($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_READ_PAGES
const KEY_FIGURE_WIKI_WORDS_AVG
static getWikiPageCharacters($a_wiki_id, $a_page_id, $a_day_from, $a_day_to)
static getAvailableMonths($a_wiki_id)
static getWikiFootnotes($a_wiki_id, $a_day_from, $a_day_to)
const KEY_FIGURE_WIKI_DELETED_PAGES
const KEY_FIGURE_WIKI_PAGE_CHANGES
static getWikiAggrSub($a_wiki_id, $a_day_from, $a_day_to, $a_table, $a_field, $a_aggr_by, $a_aggr_value, $a_aggr_sub, $a_sub_field=null, $a_sub_id=null, $a_build_full_period=false)
const KEY_FIGURE_WIKI_PAGE_CHANGES_AVG