28 protected \ILIAS\Wiki\InternalGUIService
$gui;
39 ?
int $a_page_id =
null 43 $this->
ctrl = $DIC->ctrl();
44 $this->
toolbar = $DIC->toolbar();
45 $this->
lng = $DIC->language();
46 $this->tpl = $DIC[
"tpl"];
47 $this->wiki_id = $a_wiki_id;
48 $this->page_id = (
int) $a_page_id;
54 $this->gui = $DIC->wiki()->internal()->gui();
62 $cmd = $ilCtrl->getCmd(
"view");
64 switch ($next_class) {
72 bool $a_is_initial =
false 78 $current_figure = $this->request->getStatFig();
79 $current_time_frame = $this->request->getStatTfr();
80 $current_scope = $this->request->getStatScp();
86 if ($current_figure) {
87 $view->setValue($current_figure);
88 } elseif ($a_is_initial) {
90 $current_figure = $this->page_id
94 $ilToolbar->addInputItem($view,
true);
99 $parts = explode(
"-", $month);
107 if ($current_time_frame) {
108 $tframe->setValue($current_time_frame);
109 } elseif ($a_is_initial) {
110 $opt = array_keys($options);
111 $current_time_frame = array_shift($opt);
113 $ilToolbar->addInputItem($tframe,
true);
117 1 =>
"1 " . $lng->
txt(
"month"),
118 2 =>
"2 " . $lng->
txt(
"months"),
119 3 =>
"3 " . $lng->
txt(
"months"),
120 4 =>
"4 " . $lng->
txt(
"months"),
121 5 =>
"5 " . $lng->
txt(
"months"),
122 6 =>
"6 " . $lng->
txt(
"months")
124 if ($current_scope) {
125 $scope->setValue($current_scope);
126 } elseif ($a_is_initial) {
129 $ilToolbar->addInputItem(
$scope,
true);
131 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"view"));
132 $ilToolbar->addFormButton($lng->
txt(
"show"),
"view");
134 if ($current_figure && $current_time_frame && $current_scope) {
135 $ilToolbar->addSeparator();
136 $ilToolbar->addFormButton($lng->
txt(
"export"),
"export");
139 "figure" => $current_figure,
140 "month" => $current_time_frame,
141 "scope" => $current_scope
155 $tfr = explode(
"-", (
string)
$params[
"month"]);
156 $day_from = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] - ($params[
"scope"] - 1), 1, $tfr[0]));
157 $day_to = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] + 1, 0, $tfr[0]));
160 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
171 if ($this->page_id) {
177 $excel->addSheet($this->
lng->txt(
"statistics"));
180 foreach ($chart_data as $day => $value) {
181 $excel->setCell($row, 0, $day);
182 $excel->setCell($row++, 1, $value);
188 $ilCtrl->redirect($this,
"view");
197 bool $a_is_initial =
false 206 $tfr = explode(
"-", (
string)
$params[
"month"]);
207 $day_from = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] - ($params[
"scope"] - 1), 1, $tfr[0]));
208 $day_to = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1] + 1, 0, $tfr[0]));
211 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
217 $vtpl =
new ilTemplate(
"tpl.wiki_stat_list.html",
true,
true,
"components/ILIAS/Wiki");
219 $vtpl->setVariable(
"CHART", $this->
renderGraph($params[
"figure"], $chart_data));
221 $vtpl->setCurrentBlock(
"row_bl");
222 foreach ($list_data as $figure => $values) {
223 $vtpl->setVariable(
"FIGURE", $figure);
224 $vtpl->setVariable(
"YESTERDAY_VALUE", $values[
"yesterday"]);
225 $vtpl->setVariable(
"TODAY_VALUE", $values[
"today"]);
226 $vtpl->parseCurrentBlock();
229 $vtpl->setVariable(
"FIGURE_HEAD", $lng->
txt(
"wiki_stat_figure"));
230 $vtpl->setVariable(
"YESTERDAY_HEAD", $lng->
txt(
"yesterday"));
231 $vtpl->setVariable(
"TODAY_HEAD", $lng->
txt(
"today"));
233 $f = $this->gui->ui()->factory();
234 $r = $this->gui->ui()->renderer();
235 $p =
$f->panel()->standard(
236 $lng->
txt(
"statistics"),
237 $f->legacy()->content($vtpl->get())
251 $raw = $this->page_id
255 $parts = explode(
"-", $a_from);
256 for ($loop = 0; $loop <= ($a_scope * 31); $loop++) {
257 $current_day = date(
"Y-m-d", mktime(0, 0, 1,
$parts[1],
$parts[2] + $loop,
$parts[0]));
258 if ($current_day <= $a_to) {
259 $data[$current_day] = (float) ($raw[$current_day] ?? 0);
270 $today = date(
"Y-m-d");
271 $yesterday = date(
"Y-m-d", strtotime(
"yesterday"));
273 $all = $this->page_id
276 foreach ($all as $figure => $title) {
277 if ($this->page_id) {
282 $data[$title] = array(
283 "yesterday" => (
float) ($tmp[$yesterday] ?? 0),
284 "today" => (
float) ($tmp[$today] ?? 0)
295 $scope = ceil(count($a_data) / 31);
298 $chart->setSize(
"100%",
"400");
299 $chart->setColors(array(
"#C0E0FF"));
302 $chart->setLegend($legend);
305 if (in_array($a_figure, array(
327 $series->setLineSteps(
true);
328 $series->setFill(
true,
"#E0F0FF");
331 $series->setBarOptions(round(10 / (
$scope * 2)) / 10);
337 foreach ($a_data as $date => $value) {
338 $series->addPoint($x, $value);
340 $day = (
int) substr($date, 8, 2);
345 $labels[$x] = substr($date, 8, 2);
349 $labels[$x] = substr($date, 8, 2) .
"." . substr($date, 5, 2) .
".";
351 } elseif ($day === 1 || $day === 15 || $x === count($a_data) - 1) {
353 $labels[$x] = substr($date, 8, 2) .
"." . substr($date, 5, 2) .
".";
359 $chart->addData($series);
360 $chart->setTicks($labels,
null,
true);
363 if (in_array($a_figure, array(
388 $chart->setYAxisToInteger(
true);
391 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...
static _numericMonthToString(int $a_month, bool $a_long=true, ?ilLanguage $lng=null)
numeric month to string
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
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.
static lookupTitle(int $a_page_id, string $lang="-")
const KEY_FIGURE_WIKI_INTERNAL_LINKS
const KEY_FIGURE_WIKI_NUM_PAGES
const KEY_FIGURE_WIKI_PAGE_CHARS
const KEY_FIGURE_WIKI_PAGE_EXTERNAL_LINKS
const KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG
setContent(string $a_html)
Sets content for standard template.
__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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
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
renderGraph(int $a_figure, array $a_data)
ILIAS Wiki InternalGUIService $gui
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
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
const KEY_FIGURE_WIKI_PAGE_CHANGES
static getInstanceByType(int $a_type, string $a_id)