Beispiel #1
0
/**
* creates chart link
*/
function create_chart_link($results)
{
    foreach ($results as $r) {
        $number_ar[] = $r['result_percent'];
        $color_ar[] = party2color($r['short_name']);
    }
    foreach (array_reverse($results) as $r) {
        $name_ar[] = urlencode($r['short_name']);
    }
    $height = round(43 + count($results) * 16);
    $url = "http://chart.apis.google.com/chart?cht=bhs&" . 'chd=t:' . implode(',', $number_ar) . '&' . 'chs=400x' . $height . '&' . 'chco=' . implode('|', $color_ar) . '&' . 'chds=-100,100&chf=c,ls,0,FFD0D0,0.2,FFE0E0,0.2,FFFFFF,0.2,E0FFE0,0.2,D0FFD0,0.2&chxt=x,y,t&chg=50,100&chbh=12,4&chxl=0:|-100%25|-60%25|-20%25|20%25|60%25|100%25|' . '1:|' . implode('|', $name_ar) . '|2:||Neshoda||Shoda|';
    return array('url' => $url, 'height' => $height, 'width' => 400);
}
Beispiel #2
0
	  default:
		$partner = array('name'=>'default','swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e');
	} 
} else */
$partner = array('name' => 'default', 'swatch_bar' => 'g', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a');
//calculate match, for selected CC only
//$start = microtime(true);
$results = calc_match($user, $candidates);
//$time_taken = microtime(true) - $start;
//echo $time_taken;die();
//this page
$url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['REQUEST_URI'];
//winner color
$winner_color[0] = party2color($results[0]['party']);
$winner_color[1] = party2color($results[1]['party']);
$winner_color[2] = party2color($results[2]['party']);
$smarty->assign('text', $text);
$smarty->assign('partner', $partner);
$smarty->assign('winner_color', $winner_color);
$smarty->assign('query_string', $_SERVER['QUERY_STRING']);
$smarty->assign('results', $results);
$smarty->assign('url', $url);
$smarty->display('de2013-match.tpl');
//save results
$str = session_id() . "\t" . "germany" . "\t" . date("Y-m-d H:i:s") . "\t" . $_SERVER['QUERY_STRING'] . "\t" . $_SERVER['REMOTE_ADDR'] . "\n";
$file = fopen('../../result.txt', 'a');
fwrite($file, $str);
fclose($file);
/**
* party 2 color
*/