38 ?
int $a_page_id = null
42 $this->
ctrl = $DIC->ctrl();
43 $this->
toolbar = $DIC->toolbar();
44 $this->
lng = $DIC->language();
45 $this->tpl = $DIC[
"tpl"];
46 $this->wiki_id = $a_wiki_id;
47 $this->page_id = (
int) $a_page_id;
61 $cmd = $ilCtrl->getCmd(
"view");
63 switch ($next_class) {
71 bool $a_is_initial =
false 77 $current_figure = $this->request->getStatFig();
78 $current_time_frame = $this->request->getStatTfr();
79 $current_scope = $this->request->getStatScp();
82 $view->setOptions($this->page_id
85 if ($current_figure) {
86 $view->setValue($current_figure);
87 } elseif ($a_is_initial) {
89 $current_figure = $this->page_id
93 $ilToolbar->addInputItem($view,
true);
98 $parts = explode(
"-", $month);
105 $tframe->setOptions($options);
106 if ($current_time_frame) {
107 $tframe->setValue($current_time_frame);
108 } elseif ($a_is_initial) {
109 $opt = array_keys($options);
110 $current_time_frame = array_shift($opt);
112 $ilToolbar->addInputItem($tframe,
true);
116 1 =>
"1 " . $lng->
txt(
"month"),
117 2 =>
"2 " . $lng->
txt(
"months"),
118 3 =>
"3 " . $lng->
txt(
"months"),
119 4 =>
"4 " . $lng->
txt(
"months"),
120 5 =>
"5 " . $lng->
txt(
"months"),
121 6 =>
"6 " . $lng->
txt(
"months")
123 if ($current_scope) {
124 $scope->setValue($current_scope);
125 } elseif ($a_is_initial) {
128 $ilToolbar->addInputItem(
$scope,
true);
130 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"view"));
131 $ilToolbar->addFormButton($lng->
txt(
"show"),
"view");
133 if ($current_figure && $current_time_frame && $current_scope) {
134 $ilToolbar->addSeparator();
135 $ilToolbar->addFormButton($lng->
txt(
"export"),
"export");
138 "figure" => $current_figure,
139 "month" => $current_time_frame,
140 "scope" => $current_scope
154 $tfr = explode(
"-", (
string)
$params[
"month"]);
155 $day_from = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] - ($params[
"scope"] - 1), 1, $tfr[0]));
156 $day_to = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] + 1, 0, $tfr[0]));
159 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
170 if ($this->page_id) {
176 $excel->addSheet($this->
lng->txt(
"statistics"));
179 foreach ($chart_data as $day => $value) {
180 $excel->setCell($row, 0, $day);
181 $excel->setCell($row++, 1, $value);
187 $ilCtrl->redirect($this,
"view");
196 bool $a_is_initial =
false 205 $tfr = explode(
"-", (
string)
$params[
"month"]);
206 $day_from = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] - ($params[
"scope"] - 1), 1, $tfr[0]));
207 $day_to = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] + 1, 0, $tfr[0]));
210 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
216 $vtpl =
new ilTemplate(
"tpl.wiki_stat_list.html",
true,
true,
"Modules/Wiki");
220 $vtpl->setVariable(
"CHART", $this->
renderGraph($params[
"figure"], $chart_data));
222 $vtpl->setCurrentBlock(
"row_bl");
223 foreach ($list_data as $figure => $values) {
224 $vtpl->setVariable(
"FIGURE", $figure);
225 $vtpl->setVariable(
"YESTERDAY_VALUE", $values[
"yesterday"]);
226 $vtpl->setVariable(
"TODAY_VALUE", $values[
"today"]);
227 $vtpl->parseCurrentBlock();
230 $vtpl->setVariable(
"FIGURE_HEAD", $lng->
txt(
"wiki_stat_figure"));
231 $vtpl->setVariable(
"YESTERDAY_HEAD", $lng->
txt(
"yesterday"));
232 $vtpl->setVariable(
"TODAY_HEAD", $lng->
txt(
"today"));
234 $chart_panel->setHeading($lng->
txt(
"statistics"));
235 $chart_panel->setBody($vtpl->get());
250 $raw = $this->page_id
254 $parts = explode(
"-", $a_from);
255 for ($loop = 0; $loop <= ($a_scope * 31); $loop++) {
256 $current_day = date(
"Y-m-d", mktime(0, 0, 1,
$parts[1],
$parts[2] + $loop,
$parts[0]));
257 if ($current_day <= $a_to) {
258 $data[$current_day] = (float) ($raw[$current_day] ?? 0);
269 $today = date(
"Y-m-d");
270 $yesterday = date(
"Y-m-d", strtotime(
"yesterday"));
272 $all = $this->page_id
275 foreach ($all as $figure => $title) {
276 if ($this->page_id) {
281 $data[$title] = array(
282 "yesterday" => (
float) ($tmp[$yesterday] ?? 0),
283 "today" => (
float) ($tmp[$today] ?? 0)
294 $scope = ceil(count($a_data) / 31);
297 $chart->setSize(
"100%",
"400");
298 $chart->setColors(array(
"#C0E0FF"));
301 $chart->setLegend($legend);
304 if (in_array($a_figure, array(
326 $series->setLineSteps(
true);
327 $series->setFill(
true,
"#E0F0FF");
330 $series->setBarOptions(round(10 / (
$scope * 2)) / 10);
336 foreach ($a_data as $date => $value) {
337 $series->addPoint($x, $value);
339 $day = (
int) substr($date, 8, 2);
344 $labels[$x] = substr($date, 8, 2);
348 $labels[$x] = substr($date, 8, 2) .
"." . substr($date, 5, 2) .
".";
350 } elseif ($day === 1 || $day === 15 || $x === count($a_data) - 1) {
352 $labels[$x] = substr($date, 8, 2) .
"." . substr($date, 5, 2) .
".";
358 $chart->addData($series);
359 $chart->setTicks($labels, null,
true);
362 if (in_array($a_figure, array(
387 $chart->setYAxisToInteger(
true);
390 return $chart->getHTML();
static getFigureTitle(int $a_figure)
const KEY_FIGURE_WIKI_PAGE_USER_EDIT
const KEY_FIGURE_WIKI_NUM_RATING
const KEY_FIGURE_WIKI_WORDS
const KEY_FIGURE_WIKI_FOOTNOTES
const KEY_FIGURE_WIKI_USER_EDIT_PAGES
const KEY_FIGURE_WIKI_PAGE_RATINGS
ilGlobalTemplateInterface $tpl
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const KEY_FIGURE_WIKI_PAGE_READ
const KEY_FIGURE_WIKI_FOOTNOTES_AVG
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
static _numericMonthToString(int $a_month, bool $a_long=true)
numeric month to string
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
const KEY_FIGURE_WIKI_PAGE_INTERNAL_LINKS
Wiki statistics GUI class.
const KEY_FIGURE_WIKI_INTERNAL_LINKS
const KEY_FIGURE_WIKI_NUM_PAGES
EditingGUIRequest $request
const KEY_FIGURE_WIKI_PAGE_CHARS
const KEY_FIGURE_WIKI_PAGE_EXTERNAL_LINKS
const KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG
__construct(int $a_wiki_id, ?int $a_page_id=null)
const KEY_FIGURE_WIKI_PAGE_FOOTNOTES
loadLanguageModule(string $a_module)
Load language module.
viewToolbar(bool $a_is_initial=false)
view(bool $a_is_initial=false)
const KEY_FIGURE_WIKI_EXTERNAL_LINKS
static getFigureDataPage(int $a_wiki_id, int $a_page_id, int $a_figure, string $a_from, string $a_to)
getNextClass($a_gui_class=null)
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
getChartData(int $a_figure, int $a_scope, string $a_from, string $a_to)
static getFigureData(int $a_wiki_id, int $a_figure, string $a_from, string $a_to)
static getFigureOptions()
const KEY_FIGURE_WIKI_INTERNAL_LINKS_AVG
const KEY_FIGURE_WIKI_RATING_AVG
static getAvailableMonths(int $a_wiki_id)
const KEY_FIGURE_WIKI_CHARS
const HEADING_STYLE_SUBHEADING
renderGraph(int $a_figure, array $a_data)
static lookupTitle(int $a_page_id)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
const KEY_FIGURE_WIKI_NEW_PAGES
const KEY_FIGURE_WIKI_EDIT_PAGES
const KEY_FIGURE_WIKI_CHARS_AVG
const KEY_FIGURE_WIKI_PAGE_WORDS
static getFigureOptionsPage()
const KEY_FIGURE_WIKI_READ_PAGES
const KEY_FIGURE_WIKI_WORDS_AVG
const KEY_FIGURE_WIKI_DELETED_PAGES
const KEY_FIGURE_WIKI_PAGE_CHANGES
static getInstanceByType(int $a_type, string $a_id)