Changeset 326

Show
Ignore:
Timestamp:
06/09/08 18:20:44 (6 months ago)
Author:
beni
Message:

libchart plugin integrated in statistics plugin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • statistics/trunk/README

    r310 r326  
    11ELGG statistics plugin 
    22  
    3 version: 1.0 
     3version: 2.0 
    44author: beni<b.taraghi@tugraz.at> 
    55copyright: Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    1313This plugin allows you to compile statistics in ELGG. 
    14141) The elgg admionistrator (news) can compile statistics over all contents and all users. 
    15 2) Each community owner can compile statistics over all contents posted in to his/her community and all members 
    16 3) Each User can compile statistics over all contents posted by him/her
    17 The ceses 2 and 3 can be turned off in the config file. 
     152) Each community owner can compile statistics over all contents posted in to the community and all members 
     163) Each User can compile statistics over all contents posted by himself
     17The cases 2 and 3 can be turned off in the config file. 
    1818Additionally you can configure the type of contents used for statistics. 
    1919For now weblogs, bookmarks, presentations and files are implemented. 
     
    2121you should have yui plugin installed to be able to use yui calendar. 
    2222 
    23 The statistics plugin uses XML/SWF Charts maani.us:  
     23The statistics plugin uses XML/SWF Charts maani.us as default:  
    2424http://www.maani.us/xml_charts/ 
    2525 
     
    3030    * No technical support, and no product updates by e-mail  
    3131 
     32If you have installed libchart plugin you can use that chart instead. 
     33To do so you must select the chart properly in config file. 
    3234 
    3335Installation: 
  • statistics/trunk/config.php

    r310 r326  
    33 * @package statistics 
    44 * @filesource mod/statistics/config.php 
    5  * @version  
     5 * @version 2.0 
    66 * @author beni<b.taraghi@tugraz.at> 
    77 * @copyright Copyright &copy; 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    1313  
    1414 global $CFG, $USER; 
     15 define('XML_SWF_CHART', "xml_swf_chart"); 
     16 define('LIB_CHART', "lib_chart"); 
    1517  
    16  // set to true if you want that community owners to be able to use statistics for their community 
    17  // other wise set to false 
     18  
     19  
     20 // select the chart you would like to use for statistics by setting it to the folowing variable 
     21 // you can cast a look over the charts at the respective websites: 
     22 // 
     23 // XML_SWF_CHART: http://www.maani.us/xml_charts/ 
     24 // LIB_CHART: http://naku.dohcrew.com/libchart/pages/introduction/ 
     25 // 
     26 // If you decide for LIB_CHART you should have installed the libchart plugin 
     27 $CFG->statistics['chart'] = XML_SWF_CHART;//LIB_CHART; 
     28  
     29  
     30 // set to true if you want that community owners be able to use statistics for their community 
     31 // otherwise set to false 
    1832 $CFG->statistics['community'] = true; 
    1933  
    20  // set to true if you want that individual users to be able to use statistics for their own contents 
     34 // set to true if you want that individual users be able to use statistics for their own contents 
    2135 // other wise set to false 
    2236 $CFG->statistics['person'] = true; 
    2337  
     38 // CONFIGURATIONS FOR XML_SWF_CHART: 
     39  
    2440 // comment out the type of statistics you do not want to be used. 
    2541 // Notice: the ones that are already commented out, are not supported yet. 
    26  $CFG->statistics['type'] = array("line", 
     42 $CFG->statistics[XML_SWF_CHART]['type'] = array("line", 
    2743                                                                  "column",  
    2844                                                                  "stacked column", 
     
    4460                                                                  //"composite", 
    4561                                                                  "joined"); 
     62 
     63  
     64 // CONFIGURATIONS FOR LIB_CHART: 
     65  
     66 // comment out the type of statistics you do not want to be used. 
     67 // Notice: the ones that are already commented out, are not supported yet. 
     68 $CFG->statistics[LIB_CHART]['type'] = array("vertical bar", 
     69                                                                                        "horizontal bar",  
     70                                                                                        "pie", 
     71                                                                                        "line"); 
     72  
    4673  
    4774  
    4875 // comment out the contents, that you do not want to be used in statistics. 
    4976 // the corresponding plug-ins must have been already installed! 
    50  // if one of following plug-ins is not installed on your system, comment it out or delete it easily from the array below. 
     77 // if one of the following plug-ins is not installed on your system, comment it out or delete it easily from the array below. 
    5178 $CFG->statistics['content'] = array("Weblogs", 
    5279                                                                         "Bookmarks", 
    5380                                                                         "Files", 
    54                                                                          "Presentations" 
    55                                                                          ); 
     81                                                                         "Presentations"); 
    5682  
    5783  
  • statistics/trunk/lib.php

    r310 r326  
    33 * @package statistics 
    44 * @filesource mod/statistics/lib.php 
    5  * @version 1.0 
     5 * @version 2.0 
    66 * @author beni<b.taraghi@tugraz.at> 
    77 * @copyright Copyright &copy; 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    1919         
    2020        require_once($CFG->dirroot . "mod/statistics/config.php"); 
     21         
     22        if($CFG->statistics['chart'] == LIB_CHART) { 
     23                if(!plugin_is_loaded('libchart')) { 
     24                        error_log("libchart plugin is not loaded, statistics plugin uses the default charts"); 
     25                        $CFG->statistics['chart'] = XML_SWF_CHART; 
     26                } 
     27        } 
    2128 } 
    2229  
  • statistics/trunk/lib/statistics_fetch.php

    r310 r326  
    1212 */  
    1313  
    14  global $CFG, $messages
     14 global $CFG
    1515 require_once($CFG->dirroot . "mod/statistics/lib/ElggStatisticsClass.php"); 
    1616  
  • statistics/trunk/lib/statistics_input_view.php

    r310 r326  
    139139 
    140140                $c1 = "<li><select name=\"".$input_var."[0]\">\n"; 
    141                 if(empty($type_selected) && count($CFG->statistics['type']))  
    142                         $type_selected = $CFG->statistics['type'][0]; 
    143                 foreach ($CFG->statistics['type'] as $type) { 
     141                if(empty($type_selected) && count($CFG->statistics[$CFG->statistics['chart']]['type']))  
     142                        $type_selected = $CFG->statistics[$CFG->statistics['chart']]['type'][0]; 
     143                foreach ($CFG->statistics[$CFG->statistics['chart']]['type'] as $type) { 
    144144                        $selected = $type == $type_selected ? "SELECTED" : ""; 
    145145                        $c1 .= "<option value=\"$type\" $selected>".$type."</option>\n"; 
  • statistics/trunk/lib/statistics_show.php

    r310 r326  
    33 * @package statistics 
    44 * @filesource mod/statistics/lib/statistics_show.php 
    5  * @version 1.0 
     5 * @version 2.0 
    66 * @author beni<b.taraghi@tugraz.at> 
    77 * @copyright Copyright &copy; 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    1515 */  
    1616 
    17  
     17if($CFG->statistics['chart'] == XML_SWF_CHART) { 
    1818$html =<<<END 
    1919 
     
    6363END; 
    6464 
     65} 
     66elseif($CFG->statistics['chart'] == LIB_CHART) { 
     67        $html =<<<END 
     68        <img alt="statistics" src="sample.php" style="border: 1px solid gray;"/> 
     69END; 
     70} 
     71 
     72 
     73 
     74 
    6575// show the table form too 
    6676$data = $_SESSION['statistics']['output']; 
  • statistics/trunk/plugin.info

    r310 r326  
    11Maintainer: Behnam Taraghi <btaraghi@tugraz.at> 
    22Title: Statisticss 
    3 Version: 1.0 
     3Version: 2.0 
    44Package: Statistics 
    55Source-URL: https://svn.elgg.org/plugins/statistics 
    66Depends: elgg (>= 0.9), PHP>=5.0.x 
    7 Depends: yui  
     7Depends: yui, libchart(optional) 
    88Tags: statistics 
    99Priority: optional 
  • statistics/trunk/sample.php

    r310 r326  
    33 * @package statistics 
    44 * @filesource mod/statistics/sample.php 
    5  * @version 1.0 
     5 * @version 2.0 
    66 * @author beni<b.taraghi@tugraz.at> 
    77 * @copyright Copyright &copy; 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    99 *  
    1010 *  
    11  * reurns xml result needed for flash files 
     11 * returns chart result needed for gui 
    1212 */   
    1313  
    1414require_once(dirname(dirname(dirname((__FILE__))))."/includes.php"); 
    15 require_once(dirname(__FILE__) . "/lib/ElggStatisticsChartsClass.php")
    16    
     15global $CFG
     16 
    1717$input = isset($_SESSION['statistics']['input']) ? $_SESSION['statistics']['input'] : null; 
    1818$data = isset($_SESSION['statistics']['output']) ? $_SESSION['statistics']['output'] : null; 
     19 
    1920$content = optional_param("joined_content", ""); 
    2021if($input && is_array($input)) { 
    2122        $type = $input[0]; 
    2223        if($type == "joined") { 
     24                // for xml swf chart only 
    2325                $joined_use = array("line", "column", "bar", "3d column", "stacked column", "area"); 
    2426                $type = $joined_use[array_rand($joined_use)]; 
     
    2729else $type = "line"; 
    2830 
    29 $my_chart = new ElggStatisticsCharts(); 
    30 $my_chart->setType($type); 
    31 $my_chart->setData($data); 
    32 $my_chart->setContent($content); 
    33 $output = $my_chart->getXMLChart(); 
    3431 
    35 header("Content-Length: " . strlen($output)); 
    36 header("Content-type: text/xml; charset=utf-8"); 
    37 echo $output; 
     32 
     33if($CFG->statistics['chart'] == XML_SWF_CHART) { 
     34        require_once($CFG->dirroot . "mod/statistics/lib/ElggStatisticsXMLSWFChartsClass.php"); 
     35 
     36        $my_chart = new ElggStatisticsCharts(); 
     37        $my_chart->setType($type); 
     38        $my_chart->setData($data); 
     39        $my_chart->setContent($content); 
     40        $output = $my_chart->getChart(); 
     41         
     42        header("Content-Length: " . strlen($output)); 
     43        header("Content-type: text/xml; charset=utf-8"); 
     44        echo $output; 
     45
     46 
     47elseif($CFG->statistics['chart'] == LIB_CHART) { 
     48        require_once ($CFG->dirroot ."mod/libchart/libchart/libchart/classes/libchart.php"); 
     49        require_once($CFG->dirroot . "mod/statistics/lib/ElggStatisticsLibChartsClass.php"); 
     50 
     51        $width = $input[1][0]; 
     52        $height = $input[1][1]; 
     53             
     54        $my_chart = new ElggStatisticsCharts($width, $height); 
     55        $my_chart->setType($type); 
     56        $my_chart->setData($data); 
     57        $my_chart->setContent(isset($input[5]) ? $input[5] : ""); 
     58        $my_chart->getChart(); 
     59
    3860 
    3961?>