5 include_once
"Modules/Wiki/classes/class.ilWikiStat.php";
21 $this->wiki_id = (int)$a_wiki_id;
22 $this->page_id = (int)$a_page_id;
29 $next_class = $ilCtrl->getNextClass($this);
30 $cmd = $ilCtrl->getCmd(
"view");
44 $current_figure = (int)
$_POST[
"fig"];
46 $current_scope = (int)
$_POST[
"scp"];
48 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
55 $view->setValue($current_figure);
57 else if($a_is_initial)
60 $current_figure = $this->page_id
64 $ilToolbar->addInputItem($view,
true);
67 include_once
"Services/Calendar/classes/class.ilCalendarUtil.php";
68 $lng->loadLanguageModule(
"dateplaner");
71 $parts = explode(
"-", $month);
79 if($current_time_frame)
81 $tframe->setValue($current_time_frame);
83 else if($a_is_initial)
85 $current_time_frame = array_shift(array_keys(
$options));
87 $ilToolbar->addInputItem($tframe,
true);
91 1 =>
"1 ".$lng->txt(
"month"),
92 2 =>
"2 ".$lng->txt(
"months"),
93 3 =>
"3 ".$lng->txt(
"months"),
94 4 =>
"4 ".$lng->txt(
"months"),
95 5 =>
"5 ".$lng->txt(
"months"),
96 6 =>
"6 ".$lng->txt(
"months")
100 $scope->setValue($current_scope);
102 else if($a_is_initial)
106 $ilToolbar->addInputItem($scope,
true);
108 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"view"));
109 $ilToolbar->addFormButton($lng->txt(
"show"),
"view");
111 if($current_figure && $current_time_frame && $current_scope)
113 $ilToolbar->addSeparator();
114 $ilToolbar->addFormButton($lng->txt(
"export"),
"export");
117 "figure" => $current_figure,
118 "month" => $current_time_frame,
119 "scope" => $current_scope
133 $tfr = explode(
"-", (
string)
$params[
"month"]);
134 $day_from =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]-($params[
"scope"]-1), 1, $tfr[0]));
135 $day_to =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]+1, 0, $tfr[0]));
138 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
150 $filename .=
" - ".ilWikiPage::lookupTitle($this->page_id);
152 $filename .=
" - ".ilWikiStat::getFigureTitle($params[
"figure"]).
" - ".$period;
154 include_once
"./Services/Excel/classes/class.ilExcel.php";
156 $excel->addSheet($this->lng->txt(
"statistics"));
159 foreach($chart_data as $day => $value)
161 $excel->setCell(
$row, 0, $day);
162 $excel->setCell(
$row++, 1, $value);
168 $ilCtrl->redirect($this,
"view");
176 protected function view($a_is_initial =
false)
185 $tfr = explode(
"-", (
string)
$params[
"month"]);
186 $day_from =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]-($params[
"scope"]-1), 1, $tfr[0]));
187 $day_to =
date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]+1, 0, $tfr[0]));
190 $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
196 $vtpl =
new ilTemplate(
"tpl.wiki_stat_list.html",
true,
true,
"Modules/Wiki");
198 include_once(
"./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
201 $vtpl->setVariable(
"CHART", $this->
renderGraph($params[
"figure"], $chart_data));
203 $vtpl->setCurrentBlock(
"row_bl");
205 foreach($list_data as $figure => $values)
207 $day = (int)substr($day, 8);
208 $vtpl->setVariable(
"CSS_ROW", (
$counter++%2) ?
"tblrow1" :
"tblrow2");
209 $vtpl->setVariable(
"FIGURE", $figure);
210 $vtpl->setVariable(
"YESTERDAY_VALUE", $values[
"yesterday"]);
211 $vtpl->setVariable(
"TODAY_VALUE", $values[
"today"]);
212 $vtpl->parseCurrentBlock();
215 $vtpl->setVariable(
"FIGURE_HEAD", $lng->txt(
"wiki_stat_figure"));
216 $vtpl->setVariable(
"YESTERDAY_HEAD", $lng->txt(
"yesterday"));
217 $vtpl->setVariable(
"TODAY_HEAD", $lng->txt(
"today"));
219 $chart_panel->setHeading($lng->txt(
"statistics"));
220 $chart_panel->setBody($vtpl->get());
223 $tpl->setContent($chart_panel->getHTML());
231 $raw = $this->page_id
235 $parts = explode(
"-", $a_from);
236 for($loop = 0; $loop <= ($a_scope*31); $loop++)
238 $current_day =
date(
"Y-m-d", mktime(0, 0, 1, $parts[1], $parts[2]+$loop, $parts[0]));
239 if($current_day <= $a_to)
241 $data[$current_day] = (float)$raw[$current_day];
252 $today =
date(
"Y-m-d");
253 $yesterday =
date(
"Y-m-d", strtotime(
"yesterday"));
255 $all = $this->page_id
258 foreach($all as $figure =>
$title)
269 "yesterday" => (
float)$tmp[$yesterday],
270 "today" => (
float)$tmp[$today]
279 $scope = ceil(
sizeof($a_data)/31);
281 include_once
"Services/Chart/classes/class.ilChartGrid.php";
283 $chart->setSize(
"100%", 400);
290 if(in_array($a_figure,
array(
314 $series->setFill(
true,
"#E0F0FF");
319 $series->setBarOptions(round(10/($scope*2))/10);
325 foreach($a_data as $date => $value)
329 $day = (int)substr($date, 8, 2);
335 $labels[
$x] = substr($date, 8, 2);
342 $labels[
$x] = substr($date, 8, 2).
".".substr($date, 5, 2).
".";
348 if($day == 1 || $day == 15 ||
$x ==
sizeof($a_data)-1)
350 $labels[
$x] = substr($date, 8, 2).
".".substr($date, 5, 2).
".";
358 $chart->setTicks($labels, null,
true);
361 if(in_array($a_figure,
array(
387 $chart->setYAxisToInteger(
true);
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
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
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
Add rich text string
The name of the decorator.
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)
if(!is_array($argv)) $options
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)
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
__construct($a_wiki_id, $a_page_id=null)