Change statsUtils.lib.inc.php into a class

1.10.x
Julio Montoya 10 years ago
parent 277c7fdb37
commit d65a12c42c
  1. 3
      main/exercice/exercise_report.php
  2. 2
      main/exercice/hotpotatoes_exercise_report.php
  3. 4
      main/gradebook/gradebook_result.class.php
  4. 2
      main/inc/lib/exercise.lib.php
  5. 7
      main/inc/lib/statistics.lib.php
  6. 2
      main/inc/lib/stats.lib.inc.php
  7. 641
      main/inc/lib/statsUtils.lib.inc.php
  8. 20
      main/inc/lib/tracking.lib.php
  9. 2
      main/tracking/courseLog.php
  10. 34
      main/tracking/courseLogCSV.php
  11. 25
      main/tracking/course_access_details.php
  12. 2
      main/tracking/course_log_resources.php
  13. 2
      main/tracking/course_log_tools.php
  14. 4
      main/tracking/logins_details.php
  15. 10
      main/tracking/personnalLog.php
  16. 14
      main/tracking/toolaccess_details.php
  17. 4
      main/tracking/userLog.php
  18. 4
      main/tracking/userlogCSV.php
  19. 50
      tests/main/exercice/exercise_result.class.test.php
  20. 37
      tests/main/inc/lib/statsUtils.lib.inc.test.php

@ -28,9 +28,6 @@ api_protect_course_script(true, false, true);
// including additional libraries
require_once 'hotpotatoes.lib.php';
// need functions of statsutils lib to display previous exercices scores
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
$origin = isset($origin) ? $origin : null;

@ -26,8 +26,6 @@ api_protect_course_script(true, false, true);
// including additional libraries
require_once 'hotpotatoes.lib.php';
// need functions of statsutils lib to display previous exercices scores
require_once api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php';
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";

@ -125,8 +125,8 @@ class GradeBookResult
ORDER BY exe_cours_id ASC, exe_date ASC";
}
$results=getManyResultsXCol($sql,8);
$hpresults=getManyResultsXCol($hpsql,7);
$results=StatsUtils::getManyResultsXCol($sql,8);
$hpresults=StatsUtils::getManyResultsXCol($hpsql,7);
$NoTestRes = 0;
$NoHPTestRes = 0;

@ -1904,7 +1904,7 @@ class ExerciseLib
}
}
} else {
$hpresults = getManyResultsXCol($hpsql, 6);
$hpresults = StatsUtils::getManyResultsXCol($hpsql, 6);
// Print HotPotatoes test results.
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {

@ -608,10 +608,11 @@ class Statistics
$page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1;
$column = isset($_GET['column'])?intval($_GET['column']) : 0;
$date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60;
if (!in_array($_GET['direction'],array(SORT_ASC,SORT_DESC))) {
$direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
if (!in_array($direction,array(SORT_ASC,SORT_DESC))) {
$direction = SORT_ASC;
} else {
$direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
}
$form = new FormValidator('courselastvisit', 'get');
$form->addElement('hidden','report','courselastvisit');

@ -78,7 +78,7 @@ function decodeOpenInfos() {
WHERE open_date <= NOW()
ORDER BY open_id DESC
LIMIT 1";
//$processBegin = getOneResult($sql);
//$processBegin = StatsUtils::getOneResult($sql);
$query = Database::query($sql);
$res = @Database::fetch_array($query);
$processBegin = $res[0];

@ -1,369 +1,392 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This is the statistic utility functions library for Chamilo.
* Include/require it in your code to use its functionality.
* @package chamilo.library
*/
/* FUNCTIONS */
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc return one result from a sql query (1 single result)
*/
function getOneResult($sql) {
$query = Database::query($sql);
if ($query !== false) {
$res = @Database::fetch_array($query, 'NUM');
} else {
$res = array();
class StatsUtils
{
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc return one result from a sql query (1 single result)
*/
public static function getOneResult($sql)
{
$query = Database::query($sql);
if ($query !== false) {
$res = @Database::fetch_array($query, 'NUM');
} else {
$res = array();
}
return $res[0];
}
return $res[0];
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a 1 column tab
*/
function getManyResults1Col($sql) {
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i++] = $resA[0];
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a 1 column tab
*/
public static function getManyResults1Col($sql)
{
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i++] = $resA[0];
}
}
return $resu;
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query
*/
function getManyResults2Col($sql) {
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i][0] = $resA[0];
$resu[$i][1] = $resA[1];
$i++;
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query
*/
public static function getManyResults2Col($sql)
{
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i][0] = $resA[0];
$resu[$i][1] = $resA[1];
$i++;
}
}
return $resu;
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a 3 column tab
in $resu[$i][0], $resu[$i][1],$resu[$i][2]
*/
function getManyResults3Col($sql) {
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i][0] = $resA[0];
$resu[$i][1] = $resA[1];
$resu[$i][2] = $resA[2];
$i++;
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a 3 column tab
* in $resu[$i][0], $resu[$i][1],$resu[$i][2]
*/
public static function getManyResults3Col($sql)
{
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i][0] = $resA[0];
$resu[$i][1] = $resA[1];
$resu[$i][2] = $resA[2];
$i++;
}
}
return $resu;
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a X column tab
in $resu[$i][0], $resu[$i][1],$resu[$i][2],...
this function is more 'standard' but use a little
more ressources
So I encourage to use the dedicated for 1, 2 or 3
columns of results
*/
function getManyResultsXCol($sql, $X) {
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
for ($j = 0; $j < $X ; $j++) {
$resu[$i][$j] = $resA[$j];
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a X column tab
* in $resu[$i][0], $resu[$i][1],$resu[$i][2],...
* this function is more 'standard' but use a little
* more ressources
* So I encourage to use the dedicated for 1, 2 or 3
* columns of results
*/
public static function getManyResultsXCol($sql, $X)
{
$res = Database::query($sql);
if ($res !== false) {
$i = 0;
while ($resA = Database::fetch_array($res, 'NUM')) {
for ($j = 0; $j < $X; $j++) {
$resu[$i][$j] = $resA[$j];
}
$i++;
}
$i++;
}
return $resu;
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @return hours_array
* @desc Return an assoc array. Keys are the hours, values are
the number of time this hours was found.
key 'total' return the sum of all number of time hours
appear
*/
function hoursTab($sql) {
$hours_array = array('total' => 0);
$res = Database::query($sql);
if ($res !== false) {
$last_hours = -1;
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
if ($date_array['hours'] == $last_hours) {
$hours_array[$date_array['hours']]++;
} else {
$hours_array[$date_array['hours']] = 1;
$last_hours = $date_array['hours'];
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @return hours_array
* @desc Return an assoc array. Keys are the hours, values are
* the number of time this hours was found.
* key 'total' return the sum of all number of time hours
* appear
*/
public static function hoursTab($sql)
{
$hours_array = array('total' => 0);
$res = Database::query($sql);
if ($res !== false) {
$last_hours = -1;
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
if ($date_array['hours'] == $last_hours) {
$hours_array[$date_array['hours']]++;
} else {
$hours_array[$date_array['hours']] = 1;
$last_hours = $date_array['hours'];
}
$hours_array['total']++;
}
$hours_array['total']++;
Database::free_result($res);
}
Database::free_result($res);
return $hours_array;
}
return $hours_array;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @return days_array
* @desc Return an assoc array. Keys are the days, values are
the number of time this hours was found.
key "total" return the sum of all number of time days
appear
*/
function daysTab($sql) {
$MonthsShort = api_get_months_short();
$days_array = array('total' => 0);
$res = Database::query($sql);
if ($res !== false) {
$last_day = -1;
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
$display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
if ($date_array['mday'] == $last_day) {
$days_array[$display_date]++;
} else {
$days_array[$display_date] = 1;
$last_day = $display_date;
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @return days_array
* @desc Return an assoc array. Keys are the days, values are
* the number of time this hours was found.
* key "total" return the sum of all number of time days
* appear
*/
public static function daysTab($sql)
{
$MonthsShort = api_get_months_short();
$days_array = array('total' => 0);
$res = Database::query($sql);
if ($res !== false) {
$last_day = -1;
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
$display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year'];
if ($date_array['mday'] == $last_day) {
$days_array[$display_date]++;
} else {
$days_array[$display_date] = 1;
$last_day = $display_date;
}
$days_array['total']++;
}
$days_array['total']++;
Database::free_result($res);
}
Database::free_result($res);
return $days_array;
}
return $days_array;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @return month_array
* @desc Return an assoc array. Keys are the days, values are
the number of time this hours was found.
key "total" return the sum of all number of time days
appear
*/
function monthTab($sql) {
$MonthsLong = api_get_months_long();
$month_array = array('total' => 0);
$res = Database::query($sql);
if ($res !== false) {
// init tab with all months
for($i = 0; $i < 12; $i++) {
$month_array[$MonthsLong[$i]] = 0;
}
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
$month_array[$MonthsLong[$date_array['mon'] - 1]]++;
$month_array['total']++;
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @return month_array
* @desc Return an assoc array. Keys are the days, values are
* the number of time this hours was found.
* key "total" return the sum of all number of time days
* appear
*/
public static function monthTab($sql)
{
$MonthsLong = api_get_months_long();
$month_array = array('total' => 0);
$res = Database::query($sql);
if ($res !== false) {
// init tab with all months
for ($i = 0; $i < 12; $i++) {
$month_array[$MonthsLong[$i]] = 0;
}
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
$month_array[$MonthsLong[$date_array['mon'] - 1]]++;
$month_array['total']++;
}
Database::free_result($res);
}
Database::free_result($res);
return $month_array;
}
return $month_array;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param period_array : an array provided by hoursTab($sql) or daysTab($sql)
* @param periodTitle : title of the first column, type of period
* @param linkOnPeriod :
* @desc Display a 4 column array
Columns are : hour of day, graph, number of hits and %
First line are titles
next are informations
Last is total number of hits
*/
function makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???') {
echo "<table width='100%' cellpadding='0' cellspacing='1' border='0' align=center class='minitext'>";
// titles
echo "<tr bgcolor='#E6E6E6' align='center'>
<td width='15%' >
<b>$periodTitle</b>
</td>
<td width='60%'>
&nbsp;
</td>
<td width='10%'>
<b>".get_lang('Hits')."</b>
</td>
<td width='15%'>
<b>%</b>
</td>
</tr>
";
$factor = 4;
$maxSize = $factor * 100; //pixels
while (list($periodPiece, $cpt) = each($period_array)) {
if ($periodPiece != 'total') {
$pourcent = round(100 * $cpt / $period_array['total']);
$barwidth = $factor * $pourcent ;
echo "<tr>
<td align='center' width='15%'>";
echo $periodPiece;
echo "</td>
<td width='60%' style='padding-top: 3px;' align='center'>"
// display hitbar
."<img src='../img/bar_1.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
if($pourcent != 0)
echo "<img src='../img/bar_1u.gif' width='$barwidth' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param period_array : an array provided by hoursTab($sql) or daysTab($sql)
* @param periodTitle : title of the first column, type of period
* @param linkOnPeriod :
* @desc Display a 4 column array
* Columns are : hour of day, graph, number of hits and %
* First line are titles
* next are informations
* Last is total number of hits
*/
public static function makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???')
{
echo "<table width='100%' cellpadding='0' cellspacing='1' border='0' align=center class='minitext'>";
// titles
echo "<tr bgcolor='#E6E6E6' align='center'>
<td width='15%' >
<b>$periodTitle</b>
</td>
<td width='60%'>
&nbsp;
</td>
<td width='10%'>
<b>" . get_lang('Hits') . "</b>
</td>
<td width='15%'>
<b>%</b>
</td>
</tr>
";
$factor = 4;
$maxSize = $factor * 100; //pixels
while (list($periodPiece, $cpt) = each($period_array)) {
if ($periodPiece != 'total') {
$pourcent = round(100 * $cpt / $period_array['total']);
$barwidth = $factor * $pourcent;
echo "<tr>
<td align='center' width='15%'>";
echo $periodPiece;
echo "</td>
<td width='60%' style='padding-top: 3px;' align='center'>"
// display hitbar
. "<img src='../img/bar_1.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
if ($pourcent != 0) {
echo "<img src='../img/bar_1u.gif' width='$barwidth' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
}
// display 100% bar
if($pourcent != 100 && $pourcent != 0)
echo "<img src='../img/bar_1m.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
if($pourcent != 100)
echo "<img src='../img/bar_1r.gif' width='".($maxSize-$barwidth)."' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
echo "<img src='../img/bar_1.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
if ($pourcent != 100 && $pourcent != 0) {
echo "<img src='../img/bar_1m.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
}
if ($pourcent != 100) {
echo "<img src='../img/bar_1r.gif' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
}
echo "<img src='../img/bar_1.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
</td>
<td align='center' width='10%'>
$cpt
</td>
<td align='center' width='15%'>
$pourcent %
</td>
</tr>
";
}
}
echo "<tr bgcolor='#E6E6E6'>
<td width='15%' align='center'>
" . get_lang('Total') . "
</td>
<td align='right' width='60%'>
&nbsp;
</td>
<td align='center' width='10%'>
$cpt
" . $period_array['total'] . "
</td>
<td align='center' width='15%'>
$pourcent %
<td width='15%'>
&nbsp;
</td>
</tr>
";
}
</tr>
";
echo "</table>";
}
echo "<tr bgcolor='#E6E6E6'>
<td width='15%' align='center'>
".get_lang('Total')."
</td>
<td align='right' width='60%'>
&nbsp;
</td>
<td align='center' width='10%'>
".$period_array['total']."
</td>
<td width='15%'>
&nbsp;
</td>
</tr>
";
echo "</table>";
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param array_of_results : a 2 columns array
* @param title1 : string, title of the first column
* @param title2 : string, title of the ... second column
* @desc display a 2 column tab from an array
titles of columns are title1 and title2
*/
function buildTab2col($array_of_results, $title1, $title2) {
echo "<table cellpadding='2' cellspacing='1' border='1' align='center'>\n";
echo "<tr>
<td bgcolor='#E6E6E6'>
$title1
</td>
<td bgcolor='#E6E6E6'>
$title2
</td>
</tr>\n";
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param array_of_results : a 2 columns array
* @param title1 : string, title of the first column
* @param title2 : string, title of the ... second column
* @desc display a 2 column tab from an array
* @deprecated seem not to be use
* titles of columns are title1 and title2
*/
public static function buildTab2col($array_of_results, $title1, $title2)
{
echo "<table cellpadding='2' cellspacing='1' border='1' align='center'>\n";
echo "<tr>
<td bgcolor='#E6E6E6'>
$title1
</td>
<td bgcolor='#E6E6E6'>
$title2
</td>
</tr>\n";
if (is_array($array_of_results)) {
for ($j = 0 ; $j < count($array_of_results) ; $j++) {
if (is_array($array_of_results)) {
for ($j = 0; $j < count($array_of_results); $j++) {
echo '<tr>';
echo '<td bgcolor="#eeeeee">' . $array_of_results[$j][0] . '</td>';
echo '<td align="right">' . $array_of_results[$j][1] . '</td>';
echo "</tr>\n";
}
} else {
echo '<tr>';
echo '<td bgcolor="#eeeeee">'.$array_of_results[$j][0].'</td>';
echo '<td align="right">'.$array_of_results[$j][1].'</td>';
echo '<td colspan="2" align="center">' . get_lang(
'NoResult'
) . '</td>';
echo "</tr>\n";
}
} else {
echo '<tr>';
echo '<td colspan="2" align="center">'.get_lang('NoResult').'</td>';
echo "</tr>\n";
echo "</table>\n";
}
echo "</table>\n";
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param array_of_results : a 2 columns array
* @desc display a 2 column tab from an array
this tab has no title
*/
function buildTab2ColNoTitle($array_of_results) {
echo "<table cellpadding='3' cellspacing='1' border='0' align='center'>\n";
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param array_of_results : a 2 columns array
* @desc display a 2 column tab from an array
* this tab has no title
* @deprecated seem not to be use
*/
public static function buildTab2ColNoTitle($array_of_results)
{
echo "<table cellpadding='3' cellspacing='1' border='0' align='center'>\n";
if (is_array($array_of_results)) {
for ($j = 0 ; $j < count($array_of_results) ; $j++) {
if (is_array($array_of_results)) {
for ($j = 0; $j < count($array_of_results); $j++) {
echo '<tr>';
echo '<td bgcolor="#eeeeee">' . $array_of_results[$j][0] . '</td>';
echo '<td align="right">&nbsp;&nbsp;' . $array_of_results[$j][1] . '</td>';
echo "</tr>\n";
}
} else {
echo '<tr>';
echo '<td bgcolor="#eeeeee">'.$array_of_results[$j][0].'</td>';
echo '<td align="right">&nbsp;&nbsp;'.$array_of_results[$j][1].'</td>';
echo '<td colspan="2" align="center">' . get_lang(
'NoResult'
) . '</td>';
echo "</tr>\n";
}
} else {
echo '<tr>';
echo '<td colspan="2" align="center">'.get_lang('NoResult').'</td>';
echo "</tr>\n";
echo "</table>\n";
}
echo "</table>\n";
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param array_of_results : a 2 columns array
* @desc this function is used to display
integrity errors in the platform
if array_of_results is not an array there is
no error, else errors are displayed
*/
function buildTabDefcon($array_of_results) {
echo "<table width='60%' cellpadding='2' cellspacing='1' border='0' align=center class='minitext'>\n";
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param array_of_results : a 2 columns array
* @desc this function is used to display
* integrity errors in the platform
* if array_of_results is not an array there is
* no error, else errors are displayed
* @deprecated seem not to be use
*/
public static function buildTabDefcon($array_of_results)
{
echo "<table width='60%' cellpadding='2' cellspacing='1' border='0' align=center class='minitext'>\n";
if (is_array($array_of_results)) {
// there are some strange cases...
echo '<tr>';
echo '<td colspan="2" align="center" bgcolor="#eeeeee"><font color="#ff0000">'.get_lang('Defcon').'</font></td>';
echo "</tr>\n";
if (is_array($array_of_results)) {
// there are some strange cases...
echo '<tr>';
echo '<td colspan="2" align="center" bgcolor="#eeeeee"><font color="#ff0000">' . get_lang(
'Defcon'
) . '</font></td>';
echo "</tr>\n";
for ($j = 0 ; $j < count($array_of_results) ; $j++) {
if($array_of_results[$j][0] == "") {
$key = get_lang('NULLValue');
} else {
$key = $array_of_results[$j][0];
for ($j = 0; $j < count($array_of_results); $j++) {
if ($array_of_results[$j][0] == "") {
$key = get_lang('NULLValue');
} else {
$key = $array_of_results[$j][0];
}
echo '<tr>';
echo '<td width="70%" class="content">' . $key . '</td>';
echo '<td width="30%" align="right">' . $array_of_results[$j][1] . '</td>';
echo "</tr>\n";
}
} else {
// all right
echo '<tr>';
echo '<td width="70%" class="content">'.$key.'</td>';
echo '<td width="30%" align="right">'.$array_of_results[$j][1].'</td>';
echo '<td colspan="2" align="center"><font color="#00ff00">' . get_lang(
'AllRight'
) . '</font></td>';
echo "</tr>\n";
}
} else {
// all right
echo '<tr>';
echo '<td colspan="2" align="center"><font color="#00ff00">'.get_lang('AllRight').'</font></td>';
echo "</tr>\n";
echo "</table>\n";
}
echo "</table>\n";
}

@ -6258,13 +6258,13 @@ class TrackingUserLog
WHERE te.exe_user_id = '".intval($user_id)."' AND te.exe_cours_id = '".Database::escape_string($course_id)."'
ORDER BY te.exe_cours_id ASC, te.exe_date ASC";
$hpresults = getManyResultsXCol($hpsql, 4);
$hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);
$NoTestRes = 0;
$NoHPTestRes = 0;
echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n";
$results = getManyResultsXCol($sql, 4);
$results = StatsUtils::getManyResultsXCol($sql, 4);
echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n";
echo "
<tr bgcolor='#E6E6E6'>
@ -6353,7 +6353,7 @@ class TrackingUserLog
AND u.c_id = '".intval($course_id)."'
ORDER BY u.upload_date DESC";
echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
$results = getManyResultsXCol($sql,4);
$results = StatsUtils::getManyResultsXCol($sql,4);
echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
echo "<tr>
<td class='secLine' width='40%'>
@ -6421,7 +6421,7 @@ class TrackingUserLog
AND sl.links_user_id = '".intval($user_id)."'
GROUP BY cl.title, cl.url";
echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
$results = getManyResults2Col($sql);
$results = StatsUtils::getManyResults2Col($sql);
echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
echo "<tr>
<td class='secLine'>
@ -6488,7 +6488,7 @@ class TrackingUserLog
GROUP BY down_doc_path";
echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
$results = getManyResults1Col($sql);
$results = StatsUtils::getManyResults1Col($sql);
echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>";
echo "<tr>
<td class='secLine'>
@ -6626,12 +6626,12 @@ class TrackingUserLogCSV
WHERE te.exe_user_id = '$user_id' AND te.exe_cours_id = '$course_id'
ORDER BY te.exe_cours_id ASC, te.exe_date ASC";
$hpresults = getManyResultsXCol($hpsql, 4);
$hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);
$NoTestRes = 0;
$NoHPTestRes = 0;
$results = getManyResultsXCol($sql, 4);
$results = StatsUtils::getManyResultsXCol($sql, 4);
$title_line=get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";
if (is_array($results)) {
@ -6688,7 +6688,7 @@ class TrackingUserLogCSV
u.upload_user_id = '$user_id' AND
u.c_id = '$course_id'
ORDER BY u.upload_date DESC";
$results = getManyResultsXCol($sql,4);
$results = StatsUtils::getManyResultsXCol($sql,4);
$title[1]=get_lang('WorksDetails');
$line='';
@ -6725,7 +6725,7 @@ class TrackingUserLogCSV
AND sl.links_cours_id = '$course_id'
AND sl.links_user_id = '$user_id'
GROUP BY cl.title, cl.url";
$results = getManyResults2Col($sql);
$results = StatsUtils::getManyResults2Col($sql);
$title_line= get_lang('LinksTitleLinkColumn')."\n";
if (is_array($results)) {
for ($j = 0 ; $j < count($results) ; $j++) {
@ -6768,7 +6768,7 @@ class TrackingUserLogCSV
AND down_session_id = '$session_id'
GROUP BY down_doc_path";
$results = getManyResults1Col($sql);
$results = StatsUtils::getManyResults1Col($sql);
$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
$line = null;
if (is_array($results)) {

@ -75,8 +75,6 @@ if (api_is_drh()) {
}
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';

@ -27,10 +27,10 @@ require_once '../inc/global.inc.php';
/* Constants and variables */
// regroup table names for maintenance purpose
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS);
$TABLETRACK_DOWNLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$TABLETRACK_ACCESS_2 = Database::get_statistic_table("track_e_access");
$TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TABLETRACK_LINKS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$TABLETRACK_ACCESS_2 = Database::get_main_table("track_e_access");
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
@ -102,11 +102,11 @@ if ($is_allowedToTrack) {
FROM $TABLECOURSUSER, $table_user
WHERE $TABLECOURSUSER.course_code = '" . $_cid . "' AND $TABLECOURSUSER.user_id = $table_user.user_id AND $TABLECOURSUSER.relation_type<>" . COURSE_RELATION_TYPE_RRHH . "
ORDER BY $table_user.lastname";
$results = getManyResults3Col($sql);
$results = StatsUtils::getManyResults3Col($sql);
//BUGFIX: get visual code instead of real course code. Scormpaths use the visual code... (should be fixed in future versions)
$sql = "SELECT visual_code FROM $TABLECOURSE WHERE code = '" . $_cid . "'";
$_course['visual_code'] = getOneResult($sql);
$_course['visual_code'] = StatsUtils::getOneResult($sql);
if (is_array($results)) {
$line = '';
@ -122,7 +122,7 @@ if ($is_allowedToTrack) {
v.c_id = $course_id AND
iv.c_id = $course_id AND
v.user_id = " . $results[$j][0];
$total_lpath_items = getOneResult($sql);
$total_lpath_items = StatsUtils::getOneResult($sql);
// sum of all completed items (= multiple learningpaths + SCORM imported paths)
$sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) " .
@ -133,7 +133,7 @@ if ($is_allowedToTrack) {
iv.c_id = $course_id AND
v.user_id = " . $results[$j][0] . " " .
"AND (status = 'completed' OR status='passed')";
$total_lpath_items_completed = getOneResult($sql);
$total_lpath_items_completed = StatsUtils::getOneResult($sql);
// calculation & bgcolor setting
$lpath_pct_completed = empty($total_lpath_items) ? "-" : round(($total_lpath_items_completed / $total_lpath_items) * 100);
@ -144,12 +144,12 @@ if ($is_allowedToTrack) {
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS_2
WHERE access_user_id = '" . $results[$j][0] . "' AND c_id = '" . $courseId . "' AND access_tool = 'learnpath' AND access_session_id = '" . api_get_session_id() . "'
ORDER BY access_id ASC LIMIT 1";
$first_access = getOneResult($sql);
$first_access = StatsUtils::getOneResult($sql);
$first_access = empty($first_access) ? "-" : date('d.m.y', strtotime($first_access));
// last access
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = '" . $results[$j][0] . "' AND c_id = '" . $courseId . "' AND access_tool = 'learnpath'";
$last_access = getOneResult($sql);
$last_access = StatsUtils::getOneResult($sql);
$last_access = empty($last_access) ? "-" : date('d.m.y', strtotime($last_access));
// END first/last access
// BEGIN presentation of data
@ -171,7 +171,7 @@ if ($is_allowedToTrack) {
$sql = "SELECT count(*)
FROM $TABLECOURSUSER
WHERE course_code = '" . $_cid . "' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . "";
$count = getOneResult($sql);
$count = StatsUtils::getOneResult($sql);
$title_line = get_lang('CountUsers') . " ; " . $count . "\n";
}
@ -188,7 +188,7 @@ if ($is_allowedToTrack) {
FROM $TABLETRACK_ACCESS
WHERE c_id = '" . $courseId . "'
AND access_tool IS NULL";
$count = getOneResult($sql);
$count = StatsUtils::getOneResult($sql);
$line .= get_lang('CountToolAccess') . " ; " . $count . "\n";
@ -198,7 +198,7 @@ if ($is_allowedToTrack) {
WHERE c_id = '$courseId'
AND (access_date > DATE_ADD(CURDATE(), INTERVAL -31 DAY))
AND access_tool IS NULL";
$count = getOneResult($sql);
$count = StatsUtils::getOneResult($sql);
$line .= get_lang('Last31days') . " ; " . $count . "\n";
@ -208,7 +208,7 @@ if ($is_allowedToTrack) {
WHERE c_id = '$courseId'
AND (access_date > DATE_ADD(CURDATE(), INTERVAL -7 DAY))
AND access_tool IS NULL";
$count = getOneResult($sql);
$count = StatsUtils::getOneResult($sql);
$line .= get_lang('Last7days') . " ; " . $count . "\n";
@ -218,12 +218,10 @@ if ($is_allowedToTrack) {
WHERE c_id = '$courseId'
AND ( access_date > CURDATE() )
AND access_tool IS NULL";
$count = getOneResult($sql);
$count = StatsUtils::getOneResult($sql);
$line .= get_lang('Thisday') . " ; " . $count . "\n";
}
/* Tools */
$tempView = $view;
if ($view[2] == '1') {
@ -268,7 +266,7 @@ if ($is_allowedToTrack) {
sl.links_cours_id = '$_cid'
GROUP BY cl.title, cl.url";
$results = getManyResultsXCol($sql, 4);
$results = StatsUtils::getManyResultsXCol($sql, 4);
$title[1] = $nameTools;
$line = '';

@ -41,7 +41,6 @@ td {border-bottom: thin dashed gray;}
//@todo use Database library
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
Display::display_header($nameTools,"Tracking");
require_once api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php";
// the variables for the days and the months
// Defining the shorts for the days
@ -154,17 +153,17 @@ $is_allowedToTrack = $is_courseAdmin;
AND access_tool IS NULL ";
if ($displayType == "month") {
$sql .= "ORDER BY UNIX_TIMESTAMP( access_date)";
$month_array = monthTab($sql);
makeHitsTable($month_array,get_lang('PeriodMonth'));
$month_array = StatsUtils::monthTab($sql);
StatsUtils::makeHitsTable($month_array,get_lang('PeriodMonth'));
} elseif($displayType == "day") {
$sql .= "ORDER BY DAYOFYEAR( access_date)";
$days_array = daysTab($sql);
makeHitsTable($days_array,get_lang('PeriodDay'));
$days_array = StatsUtils::daysTab($sql);
StatsUtils::makeHitsTable($days_array,get_lang('PeriodDay'));
} else {
// by hours by default
$sql .= "ORDER BY HOUR( access_date)";
$hours_array = hoursTab($sql);
makeHitsTable($hours_array,get_lang('PeriodHour'));
$hours_array = StatsUtils::hoursTab($sql);
StatsUtils::makeHitsTable($hours_array,get_lang('PeriodHour'));
}
break;
// all days
@ -178,14 +177,14 @@ $is_allowedToTrack = $is_courseAdmin;
if($displayType == "day")
{
$sql .= "ORDER BY DAYOFYEAR( access_date)";
$days_array = daysTab($sql);
makeHitsTable($days_array,get_lang('PeriodDay'));
$days_array = StatsUtils::daysTab($sql);
StatsUtils::makeHitsTable($days_array,get_lang('PeriodDay'));
}
else // by hours by default
{
$sql .= "ORDER BY HOUR( access_date)";
$hours_array = hoursTab($sql);
makeHitsTable($hours_array,get_lang('PeriodHour'));
$hours_array = StatsUtils::hoursTab($sql);
StatsUtils:: makeHitsTable($hours_array,get_lang('PeriodHour'));
}
break;
// all hours
@ -198,8 +197,8 @@ $is_allowedToTrack = $is_courseAdmin;
AND c_id = '$courseId'
AND access_tool IS NULL
ORDER BY HOUR( access_date )";
$hours_array = hoursTab($sql,$reqdate);
makeHitsTable($hours_array,get_lang('PeriodHour'));
$hours_array = StatsUtils::hoursTab($sql,$reqdate);
StatsUtils::makeHitsTable($hours_array,get_lang('PeriodHour'));
break;
}
}

@ -35,8 +35,6 @@ if (!$is_allowedToTrack) {
}
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';

@ -37,8 +37,6 @@ if (!$is_allowedToTrack) {
}
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';

@ -169,7 +169,7 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
break;
}
echo "<tr><td>";
$results = getManyResults1Col($sql);
$results = StatsUtils::getManyResults1Col($sql);
/* * * display of the displayed period ** */
echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' align=center>";
echo "<td bgcolor='#E6E6E6'>" . $displayedDate . "</td>";
@ -195,7 +195,7 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
AND c_id = '" . $courseId . "'
GROUP BY access_tool
ORDER BY access_tool ASC";
$results2 = getManyResults2Col($sql);
$results2 = StatsUtils::getManyResults2Col($sql);
if (is_array($results2)) {
echo "<tr><td colspan='2'>\n";

@ -55,7 +55,6 @@ $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERC
$limitOfDisplayedLogins = 25; // number of logins to display
include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");
Display::display_header($nameTools,"Tracking");
api_display_tool_title($nameTools);
@ -100,7 +99,7 @@ api_display_tool_title($nameTools);
ORDER BY login_date DESC
LIMIT ".$limitOfDisplayedLogins."";
echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsExplaination')."<br/>";
$results = getManyResults1Col($sql);
$results = StatsUtils::getManyResults1Col($sql);
echo "
<table width='100%' cellpadding='2' cellspacing='1' border='0' align='center'>";
if (is_array($results))
@ -116,10 +115,9 @@ api_display_tool_title($nameTools);
</td>
</tr>";
if(!isset($previousDate))
{
if(!isset($previousDate)) {
$sql = "SELECT NOW()";
$previousDate = getOneResult($sql);
$previousDate = StatsUtils::getOneResult($sql);
}
$sql = "SELECT access_tool, count(access_tool), c_id
@ -131,7 +129,7 @@ api_display_tool_title($nameTools);
GROUP BY access_tool, c_id
ORDER BY c_id ASC";
$results2 = getManyResults3Col($sql);
$results2 = StatsUtils::getManyResults3Col($sql);
if (is_array($results2)) {
echo "

@ -99,7 +99,7 @@ $reqdate=$_REQUEST['reqdate'];
</tr>
";
$results = getManyResults2Col($sql);
$results = StatsUtils::getManyResults2Col($sql);
echo "<table cellpadding='0' cellspacing='0' border='0' align=center>";
echo "<tr bgcolor='#E6E6E6'>
<td width='70%'>
@ -228,8 +228,8 @@ $reqdate=$_REQUEST['reqdate'];
AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
ORDER BY access_date ASC";
$days_array = daysTab($sql);
makeHitsTable($days_array,$langDay);
$days_array = StatsUtils::daysTab($sql);
StatsUtils::makeHitsTable($days_array,$langDay);
break;
// all days
case "week" :
@ -241,8 +241,8 @@ $reqdate=$_REQUEST['reqdate'];
AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
ORDER BY access_date ASC";
$days_array = daysTab($sql);
makeHitsTable($days_array,$langDay);
$days_array = StatsUtils::daysTab($sql);
StatsUtils::makeHitsTable($days_array,$langDay);
break;
// all hours
case "day" :
@ -254,8 +254,8 @@ $reqdate=$_REQUEST['reqdate'];
AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
ORDER BY access_date ASC";
$hours_array = hoursTab($sql,$reqdate);
makeHitsTable($hours_array,$langHour);
$hours_array = StatsUtils::hoursTab($sql,$reqdate);
StatsUtils::makeHitsTable($hours_array,$langHour);
break;
}
}

@ -29,8 +29,6 @@ $courseId = api_get_course_int_id();
$is_allowed = true;
/* Libraries */
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php';
@ -138,7 +136,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
FROM $TABLECOURSE_GROUPSUSER
WHERE group_id = '".intval($_gid)."'";
}
$userGroupNb = getOneResult($sql);
$userGroupNb = StatsUtils::getOneResult($sql);
$step = 25; // number of student per page
if ($userGroupNb > $step) {
if(!isset($offset)) {

@ -37,8 +37,6 @@ RolesRights::protect_location($role_id, $location_id);
$is_allowed = true;
/* Libraries */
require_once api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'resourcelinker/resourcelinker.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'exercice/hotpotatoes.lib.php';
@ -136,7 +134,7 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
FROM $TABLECOURSE_GROUPSUSER
WHERE group_id = '$_gid'";
}
$userGroupNb = getOneResult($sql);
$userGroupNb = StatsUtils::getOneResult($sql);
$step = 25; // number of student per page
if ($userGroupNb > $step) {
if (!isset($offset)) {

@ -1,29 +1,27 @@
<?php
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
class TestExerciseResult extends UnitTestCase
{
public $eExerciseResult;
class TestExerciseResult extends UnitTestCase {
public $eExerciseResult;
public function TestExerciseResult() {
$this->UnitTestCase('');
}
public function setUp() {
$this->eExerciseResult = new ExerciseResult();
$this->eExerciseResult = new ExerciseResult();
}
public function tearDown() {
public function tearDown() {
$this->eExerciseResult = null;
}
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
*/
function test_getExercisesReporting() {
global $user_id;
$document_path = api_get_path(SYS_COURSE_PATH).'document/';
@ -33,7 +31,7 @@ class TestExerciseResult extends UnitTestCase {
}
//var_dump($res);
}
/**
* Exports the complete report as a CSV file
* @param string Document path inside the document tool
@ -41,7 +39,7 @@ class TestExerciseResult extends UnitTestCase {
* @param boolean Whether to include user fields or not
* @return boolean False on error
*/
function testexportCompleteReportCSV() {
global $user_id;
$document_path = api_get_path(SYS_COURSE_PATH).'document/';
@ -53,12 +51,12 @@ class TestExerciseResult extends UnitTestCase {
}
//var_dump($res);
}
/**
* Exports the complete report as an XLS file
* @return boolean False on error
*/
function testexportCompleteReportXLS() {
global $user_id;
$document_path = api_get_path(SYS_COURSE_PATH).'document/';
@ -70,16 +68,16 @@ class TestExerciseResult extends UnitTestCase {
}
//var_dump($res);
}
}
?>

@ -1,10 +1,9 @@
<?php
require_once(api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php');
class TestStatsUtils extends UnitTestCase {
public function __construct() {
class TestStatsUtils extends UnitTestCase
{
public function __construct()
{
$this->UnitTestCase('Stats utilities library - main/inc/lib/statsUtil.lib.inc.test.php');
}
@ -13,7 +12,7 @@ class TestStatsUtils extends UnitTestCase {
$title1='';
$title2='';
ob_start();
$res=buildTab2col($array_of_results, $title1, $title2);
$res=StatsUtils::buildTab2col($array_of_results, $title1, $title2);
$this->assertTrue(is_null($res));
ob_end_clean();
//var_dump($res);
@ -21,7 +20,7 @@ class TestStatsUtils extends UnitTestCase {
function testbuildTab2ColNoTitle() {
$array_of_results=array();
ob_start();
$res=buildTab2ColNoTitle($array_of_results);
$res=StatsUtils::buildTab2ColNoTitle($array_of_results);
ob_end_clean();
$this->assertTrue(is_array($array_of_results));
//var_dump($array_of_results);
@ -30,7 +29,7 @@ class TestStatsUtils extends UnitTestCase {
function testbuildTabDefcon() {
$array_of_results=array();
ob_start();
$res=buildTabDefcon($array_of_results);
$res=StatsUtils::buildTabDefcon($array_of_results);
$this->assertTrue(is_array($array_of_results));
ob_end_clean();
//var_dump($array_of_results);
@ -40,7 +39,7 @@ class TestStatsUtils extends UnitTestCase {
$sql='';
ob_start();
$days_array = array('total' => 0);
$res=daysTab($sql);
$res=StatsUtils::daysTab($sql);
ob_end_clean();
$this->assertTrue(is_array($days_array));
//var_dump($sql);
@ -49,7 +48,7 @@ class TestStatsUtils extends UnitTestCase {
function testgetManyResults1Col() {
$sql='';
ob_start();
$res=getManyResults1Col($sql);
$res=StatsUtils::getManyResults1Col($sql);
ob_end_clean();
$this->assertTrue(is_string($sql));
//var_dump($sql);
@ -58,7 +57,7 @@ class TestStatsUtils extends UnitTestCase {
function testgetManyResults2Col() {
$sql='';
ob_start();
$res=getManyResults2Col($sql);
$res=StatsUtils::getManyResults2Col($sql);
ob_end_clean();
$this->assertTrue(is_string($sql));
//var_dump($sql);
@ -67,7 +66,7 @@ class TestStatsUtils extends UnitTestCase {
function testgetManyResults3Col() {
$sql='';
ob_start();
$res=getManyResults3Col($sql);
$res=StatsUtils::getManyResults3Col($sql);
ob_end_clean();
$this->assertTrue(is_string($sql));
//var_dump($sql);
@ -77,7 +76,7 @@ class TestStatsUtils extends UnitTestCase {
$sql='';
$X='';
ob_start();
$res=getManyResultsXCol($sql,$X);
$res=StatsUtils::getManyResultsXCol($sql,$X);
ob_end_clean();
$this->assertTrue(is_string($sql));
//var_dump($sql);
@ -86,7 +85,7 @@ class TestStatsUtils extends UnitTestCase {
function testgetOneResult() {
$sql='';
ob_start();
$res=getOneResult($sql);
$res=StatsUtils::getOneResult($sql);
ob_end_clean();
$this->assertTrue(is_string($sql));
//var_dump($sql);
@ -95,7 +94,7 @@ class TestStatsUtils extends UnitTestCase {
function testhoursTab() {
$sql='';
ob_start();
$res=hoursTab($sql);
$res=StatsUtils::hoursTab($sql);
ob_end_clean();
$this->assertTrue(is_string($sql));
//var_dump($sql);
@ -105,7 +104,7 @@ class TestStatsUtils extends UnitTestCase {
$period_array=array();
$periodTitle='';
ob_start();
$res=makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???');
$res=StatsUtils::makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???');
$this->assertTrue(is_null($res));
ob_end_clean();
//var_dump($res);
@ -114,13 +113,9 @@ class TestStatsUtils extends UnitTestCase {
function testmonthTab() {
$sql='';
ob_start();
$res=monthTab($sql);
$res=StatsUtils::monthTab($sql);
ob_end_clean();
$this->assertTrue(is_array($res));
//var_dump($res);
}
}
?>

Loading…
Cancel
Save