Example #1
0
/**
 * @param int $color1
 * @param int $color2
 * @param float $factor
 * @return int
 */
function interpolate($color1, $color2, $factor)
{
    $r = (red($color2) - red($color1)) * $factor + red($color1);
    $g = (green($color2) - green($color1)) * $factor + green($color1);
    $b = (blue($color2) - blue($color1)) * $factor + blue($color1);
    return color($r, $g, $b);
}
$s = $_GET['svc'];
$prefix = explode("/", $s);
$file = "extract/test.xml";
$source = "excel/head.xml";
$fh = fopen($file, 'w') or die("can't open file " . $file);
///first read the head////
$fr = fopen($source, 'r') or die("can't open file " . $source);
while (!feof($fr)) {
    $stringData = fgets($fr, 1024);
    fwrite($fh, $stringData);
}
fclose($fr);
///then write the blue banner
$direction = $prefix[0];
$date = $fmonth . " " . $year;
fwrite($fh, blue($direction, $date));
///the write the days
fwrite($fh, $days);
///then write data
$data = getdata($year, $month, $agents);
fwrite($fh, $data);
///then write the rest
fwrite($fh, $therest);
/// finally write the end
$source = "excel/toe.xml";
$fr = fopen($source, 'r') or die("can't open file" . $source);
while (!feof($fr)) {
    $stringData = fgets($fr, 1024);
    fwrite($fh, $stringData);
}
fclose($fr);