Exemplo n.º 1
0
                array_push($milestones, "");
        }
    }
    $legendColor = "DDDDDD";
    $barColor1 = "FFFFFF";
    $barColor2 = "DDDDDDBB";
    $chartUrl = "http://chart.apis.google.com/chart?cht=bvs&chf=bg,s,00000000|b0,lg,90,{$barColor1},0,{$barColor2},1&chs=260x125&chbh=10,1&chxt=x,x,r&chds=0,6000&chxr=2,0,6000";
    $chartUrl .= "&chd=t:" . implode(",", $commits);
    $chartUrl .= "&chxl=0:|" . implode("|", $milestones);
    $chartUrl .= "|1:|" . implode("|", $dates);
    $chartUrl .= "&chxs=0,{$legendColor}|1,{$legendColor}|2,{$legendColor}";
    $thisMonth = round(end($commits));
    $lastMonth = round(prev($commits));
    return array($thisMonth, $lastMonth, $chartUrl);
}
$commitStatsAndImage = getCommitStatsAndImage($commitStatsRequest);
$commitStatsThisMonth = $commitStatsAndImage[0];
$commitStatsLastMonth = $commitStatsAndImage[1];
$commitStatsImageURL = $commitStatsAndImage[2];
# Paste your HTML content between the EOHTML markers!
// derive html file from this script name "full/path/to/<script>.php" -> "_<script>.html"
// (comes handy if testing with index2.php)
$file = explode("/", $_SERVER["SCRIPT_NAME"]);
$file = $file[count($file) - 1];
$file = preg_replace('"\\.php$"', '.html', $file);
$html = file_get_contents('_' . $file);
# build headlines-pipe
// News Pipes Request
$pipesSerialized = file_get_contents($pipesNewsRequest);
$pipesContent = unserialize($pipesSerialized);
$newsHeadlines = "<ul>\n";
Exemplo n.º 2
0
print "#####E\n";
*/
print "3\n";
#$commitStatsRequest = '/home/data/httpd/writable/xtext/commitstats.txt';
$commitStatsRequest = 'commitstats.txt';
function getCommitStatsAndImage()
{
    global $commitStatsRequest;
    $lines = file_get_contents($commitStatsRequest);
    $commits = array();
    $labels = array();
    foreach (array_slice(explode("\n", $lines), -19) as $index => $line) {
        // 200805	modeling	5833
        preg_match('/20(\\d{2})(\\d{2})\\s+modeling\\s+(\\d+)/', $line, $matches);
        #print "$line\n";
        array_push($commits, $matches[3]);
        if ($index % 6 == 0) {
            array_push($labels, $matches[1] . "/" . $matches[2]);
        } else {
            array_push($labels, "");
        }
    }
    $chartUrl = "http://chart.apis.google.com/chart?cht=bvs&chco=DBD7EF&chs=300x125&chbh=10,1&chxt=x,y&chds=0,10000&chxr=1,0,10000";
    $chartUrl .= "&chd=t:" . implode(",", $commits);
    $chartUrl .= "&chxl=0:|" . implode("|", $labels);
    $thisMonth = end($commits);
    $lastMonth = prev($commits);
    return array($thisMonth, $lastMonth, $chartUrl);
}
print var_dump(getCommitStatsAndImage());