5 include_once
"Modules/Wiki/classes/class.ilWikiStat.php";
43 $this->ctrl = $DIC->ctrl();
44 $this->toolbar = $DIC->toolbar();
45 $this->lng = $DIC->language();
46 $this->tpl = $DIC[
"tpl"];
47 $this->wiki_id = (int) $a_wiki_id;
48 $this->page_id = (int) $a_page_id;
55 $next_class =
$ilCtrl->getNextClass($this);
58 switch ($next_class) {
71 $current_figure = (int)
$_POST[
"fig"];
73 $current_scope = (int)
$_POST[
"scp"];
75 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
80 if ($current_figure) {
81 $view->setValue($current_figure);
82 } elseif ($a_is_initial) {
84 $current_figure = $this->page_id
88 $ilToolbar->addInputItem($view,
true);
91 include_once
"Services/Calendar/classes/class.ilCalendarUtil.php";
92 $lng->loadLanguageModule(
"dateplaner");
94 $parts = explode(
"-", $month);
102 if ($current_time_frame) {
103 $tframe->setValue($current_time_frame);
104 } elseif ($a_is_initial) {
105 $current_time_frame = array_shift(array_keys(
$options));
107 $ilToolbar->addInputItem($tframe,
true);
111 1 =>
"1 " .
$lng->txt(
"month"),
112 2 =>
"2 " .
$lng->txt(
"months"),
113 3 =>
"3 " .
$lng->txt(
"months"),
114 4 =>
"4 " .
$lng->txt(
"months"),
115 5 =>
"5 " .
$lng->txt(
"months"),
116 6 =>
"6 " .
$lng->txt(
"months")
118 if ($current_scope) {
119 $scope->setValue($current_scope);
120 } elseif ($a_is_initial) {
123 $ilToolbar->addInputItem($scope,
true);
125 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this,
"view"));
126 $ilToolbar->addFormButton(
$lng->txt(
"show"),
"view");
128 if ($current_figure && $current_time_frame && $current_scope) {
129 $ilToolbar->addSeparator();
130 $ilToolbar->addFormButton(
$lng->txt(
"export"),
"export");
133 "figure" => $current_figure,
134 "month" => $current_time_frame,
135 "scope" => $current_scope
148 $tfr = explode(
"-", (
string)
$params[
"month"]);
149 $day_from =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]-($params[
"scope"]-1), 1, $tfr[0]));
150 $day_to =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]+1, 0, $tfr[0]));
153 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
164 if ($this->page_id) {
169 include_once
"./Services/Excel/classes/class.ilExcel.php";
171 $excel->addSheet($this->lng->txt(
"statistics"));
174 foreach ($chart_data as $day => $value) {
175 $excel->setCell(
$row, 0, $day);
176 $excel->setCell(
$row++, 1, $value);
182 $ilCtrl->redirect($this,
"view");
190 protected function view($a_is_initial =
false)
199 $tfr = explode(
"-", (
string)
$params[
"month"]);
200 $day_from =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]-($params[
"scope"]-1), 1, $tfr[0]));
201 $day_to =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]+1, 0, $tfr[0]));
204 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
210 $vtpl =
new ilTemplate(
"tpl.wiki_stat_list.html",
true,
true,
"Modules/Wiki");
212 include_once(
"./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
215 $vtpl->setVariable(
"CHART", $this->
renderGraph($params[
"figure"], $chart_data));
217 $vtpl->setCurrentBlock(
"row_bl");
219 foreach ($list_data as $figure => $values) {
220 $day = (int) substr($day, 8);
221 $vtpl->setVariable(
"CSS_ROW", (
$counter++%2) ?
"tblrow1" :
"tblrow2");
222 $vtpl->setVariable(
"FIGURE", $figure);
223 $vtpl->setVariable(
"YESTERDAY_VALUE", $values[
"yesterday"]);
224 $vtpl->setVariable(
"TODAY_VALUE", $values[
"today"]);
225 $vtpl->parseCurrentBlock();
228 $vtpl->setVariable(
"FIGURE_HEAD",
$lng->txt(
"wiki_stat_figure"));
229 $vtpl->setVariable(
"YESTERDAY_HEAD",
$lng->txt(
"yesterday"));
230 $vtpl->setVariable(
"TODAY_HEAD",
$lng->txt(
"today"));
232 $chart_panel->setHeading(
$lng->txt(
"statistics"));
233 $chart_panel->setBody($vtpl->get());
236 $tpl->setContent($chart_panel->getHTML());
244 $raw = $this->page_id
248 $parts = explode(
"-", $a_from);
249 for ($loop = 0; $loop <= ($a_scope*31); $loop++) {
250 $current_day =
date(
"Y-m-d", mktime(0, 0, 1, $parts[1], $parts[2]+$loop, $parts[0]));
251 if ($current_day <= $a_to) {
252 $data[$current_day] = (float) $raw[$current_day];
263 $today =
date(
"Y-m-d");
264 $yesterday =
date(
"Y-m-d", strtotime(
"yesterday"));
266 $all = $this->page_id
269 foreach ($all as $figure =>
$title) {
270 if ($this->page_id) {
276 "yesterday" => (
float) $tmp[$yesterday],
277 "today" => (
float) $tmp[$today]
286 $scope = ceil(
sizeof($a_data)/31);
288 include_once
"Services/Chart/classes/class.ilChartGrid.php";
290 $chart->setSize(
"100%", 400);
297 if (in_array($a_figure,
array(
320 $series->setFill(
true,
"#E0F0FF");
323 $series->setBarOptions(round(10/($scope*2))/10);
329 foreach ($a_data as $date => $value) {
332 $day = (int) substr($date, 8, 2);
337 $labels[
$x] = substr($date, 8, 2);
338 } elseif ($scope == 2) {
341 $labels[
$x] = substr($date, 8, 2) .
"." . substr($date, 5, 2) .
".";
345 if ($day == 1 || $day == 15 ||
$x ==
sizeof($a_data)-1) {
346 $labels[
$x] = substr($date, 8, 2) .
"." . substr($date, 5, 2) .
".";
354 $chart->setTicks($labels, null,
true);
357 if (in_array($a_figure,
array(
382 $chart->setYAxisToInteger(
true);
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
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
const KEY_FIGURE_WIKI_PAGE_READ
const KEY_FIGURE_WIKI_FOOTNOTES_AVG
view($a_is_initial=false)
const KEY_FIGURE_WIKI_PAGE_INTERNAL_LINKS
Wiki statistics GUI class.
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
static getFigureData($a_wiki_id, $a_figure, $a_from, $a_to)
const KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG
static _lookupTitle($a_id)
lookup object title
const KEY_FIGURE_WIKI_PAGE_FOOTNOTES
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
const KEY_FIGURE_WIKI_EXTERNAL_LINKS
renderGraph($a_figure, array $a_data)
static getFigureDataPage($a_wiki_id, $a_page_id, $a_figure, $a_from, $a_to)
static getFigureOptions()
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
special template class to simplify handling of ITX/PEAR
const KEY_FIGURE_WIKI_INTERNAL_LINKS_AVG
const KEY_FIGURE_WIKI_RATING_AVG
viewToolbar($a_is_initial=false)
const KEY_FIGURE_WIKI_CHARS
Create styles array
The data for the language used.
getChartData($a_figure, $a_scope, $a_from, $a_to)
const HEADING_STYLE_SUBHEADING
static getInstance()
Get instance.
static getFigureTitle($a_figure)
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date 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
static getAvailableMonths($a_wiki_id)
const KEY_FIGURE_WIKI_DELETED_PAGES
static getInstanceByType($a_type, $a_id)
Get type instance.
const KEY_FIGURE_WIKI_PAGE_CHANGES
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
__construct($a_wiki_id, $a_page_id=null)