Your Moodle version

Blocks: Statistics (Graph Stats)

block_graph_stats
Maintained by Picture of Éric Bugnet Éric Bugnet
Little graph with visitors statistics

This block allow you to view a little graph in your Moodle 2.x with visitors statistics.
This is the evolution of the Graph_Stats block.

In first page, it shows visitors (unique and multi), with details of user and course count.

In course, it shows visitor to the course only.

People with the coursereport/log:view capacity can see a simple page wich show who was connected today, and a link for the course reports of the day. 

 

You can define :

  • size
  • colors
  • style
  • number of days to shown
  • engine used (moodle / google)

With help of some of you, some translation are already (partially) complete : thanks !

Screenshots

Screenshot

Contributors

Picture of Jean FRUITET
Jean FRUITET: Helper for Moodle 2 transition
Picture of Éric Bugnet
Éric Bugnet (Lead maintainer): Dev
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Chris Scurrah
    Wed, Nov 14, 2012, 12:28 AM
    Graph Stats is working fine in Moodle 2.3.3
  • Picture of German Valero
    Wed, Nov 21, 2012, 11:11 AM
    Graph Stats gives these errors in Moodle 2.4dev:
    Notice: Undefined property: stdClass::$daysnb in C:\M24dev\server\moodle\blocks\graph_stats\block_graph_stats.php on line 72

    Notice: Undefined property: stdClass::$engine in C:\M24dev\server\moodle\blocks\graph_stats\block_graph_stats.php on line 79
    Capability "coursereport/log:view" was not found! This has to be fixed in code.

    line 377 of \lib\accesslib.php: call to debugging()
    line 97 of \blocks\graph_stats\block_graph_stats.php: call to has_capability()
    line 284 of \blocks\moodleblock.class.php: call to block_graph_stats->get_content()
    line 232 of \blocks\moodleblock.class.php: call to block_base->formatted_contents()
    line 953 of \lib\blocklib.php: call to block_base->get_content_for_output()
    line 1005 of \lib\blocklib.php: call to block_manager->create_block_contents()
    line 353 of \lib\blocklib.php: call to block_manager->ensure_content_created()
    line 6 of \theme\base\layout\general.php: call to block_manager->region_has_content()
    line 793 of \lib\outputrenderers.php: call to include()
    line 740 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
    line 1416 of \lib\blocklib.php: call to core_renderer->header()
    line 1096 of \lib\blocklib.php: call to block_manager->process_url_edit()
    line 1376 of \lib\pagelib.php: call to block_manager->process_url_actions()
    line 829 of \lib\pagelib.php: call to moodle_page->starting_output()
    line 735 of \lib\outputrenderers.php: call to moodle_page->set_state()
    line ? of unknownfile: call to core_renderer->header()
    line 1445 of \lib\setuplib.php: call to call_user_func_array()
    line 98 of \index.php: call to bootstrap_renderer->__call()
    line 98 of \index.php: call to bootstrap_renderer->header()

    The block graph_stats does not define the standard capability block/graph_stats:addinstance

    line 597 of \blocks\moodleblock.class.php: call to debugging()
    line 575 of \blocks\moodleblock.class.php: call to block_base->has_add_block_capability()
    line 1082 of \lib\blocklib.php: call to block_base->user_can_addto()
    line 1043 of \lib\blocklib.php: call to block_manager->user_can_delete_block()
    line 248 of \blocks\moodleblock.class.php: call to block_manager->edit_controls()
    line 953 of \lib\blocklib.php: call to block_base->get_content_for_output()
    line 1005 of \lib\blocklib.php: call to block_manager->create_block_contents()
    line 353 of \lib\blocklib.php: call to block_manager->ensure_content_created()
    line 6 of \theme\base\layout\general.php: call to block_manager->region_has_content()
    line 793 of \lib\outputrenderers.php: call to include()
    line 740 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
    line 1416 of \lib\blocklib.php: call to core_renderer->header()
    line 1096 of \lib\blocklib.php: call to block_manager->process_url_edit()
    line 1376 of \lib\pagelib.php: call to block_manager->process_url_actions()
    line 829 of \lib\pagelib.php: call to moodle_page->starting_output()
    line 735 of \lib\outputrenderers.php: call to moodle_page->set_state()
    line ? of unknownfile: call to core_renderer->header()
    line 1445 of \lib\setuplib.php: call to call_user_func_array()
    line 98 of \index.php: call to bootstrap_renderer->__call()
    line 98 of \index.php: call to bootstrap_renderer->header()
  • Picture of Iván Latorre
    Tue, Dec 18, 2012, 11:12 PM
    I installed the block, but the diagram does not appear. Does someone know why this could be happening? I have Moodle 2.4 version
  • Picture of 棕根 曾
    Tue, Jan 22, 2013, 10:01 AM
    i setup it ok. course number is error (must -1). i fixed it.
    http://61.164.87.150:5483/
  • Picture of Jean FRUITET
    Wed, Jan 23, 2013, 7:11 AM
    Hi everybody, I did the job smile
    block_graph_stats for Moodle 2.4 is downloadable here :
    https://github.com/jfruitet/block_graph_stats_m24

    A zip archive is here :
    http://moodlemoot2009.insa-lyon.fr/mod/resource/view.php?id=902



    And I think you'll find it on Eric Bugnet github soon.

  • Picture of 平 钟
    Tue, Jun 18, 2013, 11:45 PM
    //block_graph_stats.php
    //zh_cn <?PHP
    //Moodle 2.0
    $string['pluginname'] = 'Statistics';

    // Added for V2
    $string['style'] = '类型';
    $string['style_help'] = '图片类型';
    $string['moredetails'] = '更多细节';
    $string['area'] = '区域';
    $string['classic'] = '风格 : 条形 和 线形';
    $string['engine'] = '引擎';
    $string['engine_help'] = '渲染引擎';
    $string['visitors'] = '访问者';
    $string['uniquevisitors'] = '单一访问者';

    // English langage
    $string['blockname'] = '本站统计';
    $string['connectedtoday'] = '今天上线 : ';
    $string['coursesnb'] = '总课程数 : ';
    $string['graphtitle'] = '最后 {$a} 天上线';
    $string['membersnb'] = '总用户数 : ';
    $string['seemsnotconfigured'] = '该版块没有配置,请告知您的管理员.';

    // Settings
    $string['axis_colour'] = '坐标轴';
    $string['color1'] = '图形 1';
    $string['color2'] = '图形 2';
    $string['axis_colour_help'] = '坐标轴颜色';
    $string['color1_help'] = '第一个图形的颜色';
    $string['color2_help'] = '第二个图形的颜色';
    $string['daysnb_help'] = '在图形中显示的天数';
    $string['graphheight_help'] = '图形高度';
    $string['graphwidth_help'] = '图形宽度';
    $string['inner_background_help'] = '图形背景颜色';
    $string['inner_border_help'] = '边框颜色';
    $string['multi_help'] = '在首页显示多个连接';
    $string['outer_background_help'] = '背景颜色';
    $string['daysnb'] = '天数';
    $string['graphheight'] = '高度';
    $string['graphwidth'] = '宽度';
    $string['inner_background'] = '图形背景';
    $string['inner_border'] = '边框';
    $string['multi'] = '多个连接';
    $string['outer_background'] = '背景';

    // Colors
    $string['aqua'] = '浅绿色';
    $string['black'] = '黑色';
    $string['blue'] = '蓝色';
    $string['fuchsia'] = '紫红色';
    $string['gray'] = '灰色';
    $string['green'] = '绿色';
    $string['lime'] = '淡黄绿色';
    $string['maroon'] = '褐紫红色';
    $string['navy'] = '深蓝';
    $string['olive'] = '橄榄色';
    $string['orange'] = '橙色';
    $string['purple'] = '紫色';
    $string['red'] = '红色';
    $string['white'] = '白色';
    $string['yellow'] = '黄色';
    ?>
  • Frankie's the name, Moodle's my game!
    Fri, Aug 2, 2013, 1:54 AM
    How do I change the colors of the graph?
  • Frankie's the name, Moodle's my game!
    Fri, Aug 2, 2013, 2:17 AM
    Oh okay. I got it. But how if I want a colour that's not on the menu? I want the inner background of the graph to be of #DF6382 colour. Where do I change the setting to achieve this?
  • Picture of Jean FRUITET
    Sat, Aug 3, 2013, 3:59 PM
    I think the easier is to edit
    ./blocks/graph_stats/lang/en/block_graph_stats.php
    and change the value of
    $string['white'] = 'White'; (used as backgroud color)
    to what you like...
    Better, set a local block_graph_stats.php to keep your modification after an upgrade.
  • Picture of Ali Rajabpour Sanati
    Thu, Nov 14, 2013, 12:16 AM
    will be any version for moodle 2.5? the current version is not working
  • Picture of Wesley Ellis
    Wed, Apr 16, 2014, 11:00 PM
    This should work in Moodle 2.6+ https://github.com/wezley98/graph_stats
  • Picture of Jean FRUITET
    Thu, Apr 17, 2014, 3:28 AM
    Thanx Wesley, this version should do work with Moodle 2.5 too.
  • Picture of Jean FRUITET
    Thu, Apr 17, 2014, 5:27 AM
    A few corrections needed in detail.php

    Line 44 : change
    $context = get_context_instance(CONTEXT_COURSE, $course_id);
    to
    $context = context_course::instance($course_id);

    Line 53, change
    if (has_capability('coursereport/log:view', $context)) {
    to
    if (has_capability('report/log:view', $context)) {

    Line 55, change
    echo '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?chooselog=1 ...
    to
    echo '<a href="'.$CFG->wwwroot.'/report/log/index.php?chooselog=1 ...

    By the way, the block graph_stats for Moodle 2.6 will work fine for Moodle 2.5
  • Picture of Wesley Ellis
    Thu, Apr 17, 2014, 10:32 PM
    I have updated the git repos with your changes Jean, made things easier. I have also started running the block through the code checker but this will take a while. I am happy to maintain this block is somebody would like to add my repo to the source list.

    https://github.com/wezley98/graph_stats
  • Picture of Wesley Ellis
    Thu, Apr 24, 2014, 11:49 PM
    Updated my repo with a new beta release. Main improvements:

    - Removed Moodle graphing
    - Graph is now 100% width (Responsive)
    - Changed settings for colours to colour pickers (Can now choose hex codes for graph colours)
    - Optimized code + tidy up
    - Corrected code using Moodle Code Checker

    Avaiable here: https://github.com/wezley98/graph_stats
Please login to post comments