5include_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);
 
   44                $current_figure = (int)
$_POST[
"fig"];
 
   45                $current_time_frame = (string)
$_POST[
"tfr"];
 
   46                $current_scope = (int)
$_POST[
"scp"];
 
   48                include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
   50                $view->setOptions($this->page_id 
 
   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);
 
   90                $scope->setOptions(array(
 
   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.
".xls";
 
  154                        include_once 
"./Services/Excel/classes/class.ilExcelUtils.php";
 
  155                        include_once 
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
 
  157                        $workbook = $adapter->getWorkbook();
 
  158                        $worksheet = $workbook->addWorksheet();
 
  167                        foreach($chart_data as $day => $value)
 
  171                                $worksheet->writeString(
$row, 0, $day);
 
  172                                $worksheet->writeNumber(
$row, 1, $value);                                                       
 
  179                $ilCtrl->redirect($this, 
"view");
 
  187        protected function view($a_is_initial = 
false)
 
  192                if(is_array($params))
 
  196                        $tfr = explode(
"-", (
string)$params[
"month"]);
 
  197                        $day_from = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]-($params[
"scope"]-1), 1, $tfr[0]));
 
  198                        $day_to = date(
"Y-m-d", mktime(0, 0, 1, $tfr[1]+1, 0, $tfr[0]));
 
  201                        $chart_data = $this->
getChartData($params[
"figure"], $params[
"scope"], $day_from, $day_to);
 
  207                        $vtpl = 
new ilTemplate(
"tpl.wiki_stat_list.html", 
true, 
true, 
"Modules/Wiki");
 
  209                        include_once(
"./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
 
  212                        $vtpl->setVariable(
"CHART", $this->
renderGraph($params[
"figure"], $chart_data));
 
  214                        $vtpl->setCurrentBlock(
"row_bl");
 
  216                        foreach($list_data as $figure => $values)
 
  218                                $day = (int)substr($day, 8);
 
  219                                $vtpl->setVariable(
"CSS_ROW", ($counter++%2) ? 
"tblrow1" : 
"tblrow2");
 
  220                                $vtpl->setVariable(
"FIGURE", $figure);
 
  221                                $vtpl->setVariable(
"YESTERDAY_VALUE", $values[
"yesterday"]);
 
  222                                $vtpl->setVariable(
"TODAY_VALUE", $values[
"today"]);
 
  223                                $vtpl->parseCurrentBlock();
 
  226                        $vtpl->setVariable(
"FIGURE_HEAD", 
$lng->txt(
"wiki_stat_figure"));
 
  227                        $vtpl->setVariable(
"YESTERDAY_HEAD", 
$lng->txt(
"yesterday"));                                   
 
  228                        $vtpl->setVariable(
"TODAY_HEAD", 
$lng->txt(
"today"));
 
  230                        $chart_panel->setHeading(
$lng->txt(
"statistics"));
 
  231                        $chart_panel->setBody($vtpl->get());
 
  234                        $tpl->setContent($chart_panel->getHTML());
 
  242                $raw = $this->page_id
 
  246                $parts = explode(
"-", $a_from);
 
  247                for($loop = 0; $loop <= ($a_scope*31); $loop++)
 
  249                        $current_day = date(
"Y-m-d", mktime(0, 0, 1, $parts[1], $parts[2]+$loop, $parts[0]));
 
  250                        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)
 
  279                        $data[$title] = array(
 
  280                                "yesterday" => (
float)$tmp[$yesterday], 
 
  281                                "today" => (
float)$tmp[$today]
 
  290                $scope = ceil(
sizeof($a_data)/31);              
 
  292                include_once 
"Services/Chart/classes/class.ilChartGrid.php";
 
  294                $chart->setSize(
"100%", 400);
 
  295                $chart->setColors(array(
"#C0E0FF"));
 
  298                $chart->setLegend($legend);
 
  301                if(in_array($a_figure, array(
 
  324                        $series->setLineSteps(
true);
 
  325                        $series->setFill(
true, 
"#E0F0FF");
 
  330                        $series->setBarOptions(round(10/($scope*2))/10);                                        
 
  336                foreach($a_data as $date => $value)
 
  338                        $series->addPoint($x, $value);          
 
  340                        $day = (int)substr($date, 8, 2);
 
  346                                $labels[$x] = substr($date, 8, 2);                              
 
  353                                        $labels[$x] = substr($date, 8, 2).
".".substr($date, 5, 2).
".";
 
  359                                if($day == 1 || $day == 15 || $x == 
sizeof($a_data)-1)
 
  361                                        $labels[$x] = substr($date, 8, 2).
".".substr($date, 5, 2).
".";
 
  368                $chart->addData($series);
 
  369                $chart->setTicks($labels, 
null, 
true);
 
  372                if(in_array($a_figure, array(
 
  398                        $chart->setYAxisToInteger(
true);
 
  401                return $chart->getHTML();
 
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
static getInstanceByType($a_type, $a_id)
Get type instance.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
Class ilExcelWriterAdapter.
static _lookupTitle($a_id)
lookup object title
const HEADING_STYLE_SUBHEADING
static getInstance()
Get instance.
special template class to simplify handling of ITX/PEAR
Wiki statistics GUI class.
renderGraph($a_figure, array $a_data)
view($a_is_initial=false)
getChartData($a_figure, $a_scope, $a_from, $a_to)
__construct($a_wiki_id, $a_page_id=null)
viewToolbar($a_is_initial=false)
const KEY_FIGURE_WIKI_PAGE_READ
const KEY_FIGURE_WIKI_NUM_RATING
const KEY_FIGURE_WIKI_DELETED_PAGES
const KEY_FIGURE_WIKI_WORDS
const KEY_FIGURE_WIKI_PAGE_EXTERNAL_LINKS
static getFigureDataPage($a_wiki_id, $a_page_id, $a_figure, $a_from, $a_to)
const KEY_FIGURE_WIKI_INTERNAL_LINKS
const KEY_FIGURE_WIKI_PAGE_RATINGS
static getAvailableMonths($a_wiki_id)
const KEY_FIGURE_WIKI_WORDS_AVG
static getFigureData($a_wiki_id, $a_figure, $a_from, $a_to)
const KEY_FIGURE_WIKI_READ_PAGES
const KEY_FIGURE_WIKI_NEW_PAGES
const KEY_FIGURE_WIKI_EDIT_PAGES
static getFigureTitle($a_figure)
const KEY_FIGURE_WIKI_EXTERNAL_LINKS_AVG
const KEY_FIGURE_WIKI_PAGE_CHANGES
const KEY_FIGURE_WIKI_INTERNAL_LINKS_AVG
static getFigureOptionsPage()
const KEY_FIGURE_WIKI_PAGE_INTERNAL_LINKS
const KEY_FIGURE_WIKI_FOOTNOTES
const KEY_FIGURE_WIKI_PAGE_USER_EDIT
static getFigureOptions()
const KEY_FIGURE_WIKI_FOOTNOTES_AVG
const KEY_FIGURE_WIKI_EXTERNAL_LINKS
const KEY_FIGURE_WIKI_PAGE_FOOTNOTES
const KEY_FIGURE_WIKI_CHARS_AVG
const KEY_FIGURE_WIKI_PAGE_CHARS
const KEY_FIGURE_WIKI_USER_EDIT_PAGES
const KEY_FIGURE_WIKI_NUM_PAGES
const KEY_FIGURE_WIKI_CHARS
const KEY_FIGURE_WIKI_PAGE_WORDS
const KEY_FIGURE_WIKI_RATING_AVG
if(!is_array($argv)) $options