//realizamos los calculos
//variables
$total_votes = 0;
$total_evaluators = 0;
$total_sum = 0; //total sum of votes
$total_novice = 0;
$total_amateur = 0;
$total_expert = 0;
$total_novice_votes=0;
$total_amateur_votes=0;
$total_expert_votes = 0;
$total_sum_novice = 0;
$total_sum_amateur = 0;
$total_sum_expert = 0;
for($i=1;$i<16;$i++){
$design_votes[$i]=0;
$design_num_votes[$i]=0;
$composition_votes[$i]=0;
$composition_num_votes[$i]=0;
$fonts_votes[$i]=0;
$fonts_num_votes[$i]=0;
$colors_votes[$i]=0;
$colors_num_votes[$i]=0;
$contrast_votes[$i]=0;
$contrast_num_votes[$i]=0;
$repetition_votes[$i]=0;
$repetition_num_votes[$i]=0;
$proximity_votes[$i]=0;
$proximity_num_votes[$i]=0;
$alignment_votes[$i]=0;
$alignment_num_votes[$i]=0;
$layout_votes[$i]=0;
$layout_num_votes[$i]=0;
}
//recorremos los diseƱos
for($i=1;$i<16;$i++){
if(file_exists("./data/novice_".$i.".data")){
$fp_novice = fopen("./data/novice_".$i.".data", "r");
while(!feof($fp_novice)){
$line = fgets($fp_novice,4096);
$total_sum += $line;
$total_sum_novice += $line;
$total_votes++;
$design_votes[$i] += $line;
$design_num_votes[$i]+=1;
$total_novice++;
$total_evaluators++;
$total_novice_votes++;
}//end while for novice
$total_evaluators-=1;
$total_votes -= 1;
$total_novice -=1;
$total_novice_votes -=1;
$design_num_votes[$i]-=1;
fclose($fp_novice);
}
if(file_exists("./data/amateur_".$i.".data")){
$fp_amateur = fopen("./data/amateur_".$i.".data", "r");
while(!feof($fp_amateur)){
$line = fgets($fp_amateur,4096);
$array = split(";", $line);
$composition = $array[0];
$fonts = $array[1];
$colors = $array[2];
$composition_votes[$i] += $composition;
$fonts_votes[$i] += $fonts;
$colors_votes[$i] += $colors;
$composition_num_votes[$i] += 1;
$fonts_num_votes[$i] += 1;
$colors_num_votes[$i] += 1;
$total_sum += $composition + $fonts + $colors;
$total_sum_amateur += $composition + $fonts + $colors;
$total_votes+=3;
$total_amateur++;
$total_evaluators++;
$total_amateur_votes +=3;
}//end while for novice
$total_votes -= 3;
$total_amateur -=1;
$total_evaluators -=1;
$total_amateur_votes -=3;
$composition_num_votes[$i] -= 1;
$fonts_num_votes[$i] -= 1;
$colors_num_votes[$i] -= 1;
fclose($fp_amateur);
}
if(file_exists("./data/expert_".$i.".data")){
$fp_expert = fopen("./data/expert_".$i.".data", "r");
while(!feof($fp_expert)){
$line = fgets($fp_expert,4096);
$array = split(";", $line);
$contrast = $array[0];
$repetition = $array[1];
$proximity = $array[2];
$alignment = $array[3];
$layout = $array[4];
$contrast_votes[$i] += $contrast;
$repetition_votes[$i] += $repetition;
$proximity_votes[$i] += $proximity;
$alignment_votes[$i] += $alignment;
$layout_votes[$i] += $layout;
$contrast_num_votes[$i] += 1;
$repetition_num_votes[$i] += 1;
$proximity_num_votes[$i] += 1;
$alignment_num_votes[$i] += 1;
$layout_num_votes[$i] += 1;
$total_sum += $contrast + $repetition + $proximity + $alignment + $layout;
$total_sum_expert += $contrast + $repetition + $proximity + $alignment + $layout;
$total_votes+=5;
$total_expert++;
$total_evaluators++;
$total_expert_votes +=5;
}//end while for novice
$total_votes -= 5;
$total_expert -=1;
$total_evaluators -= 1;
$total_expert_votes -=5;
$contrast_num_votes[$i] -= 1;
$repetition_num_votes[$i] -= 1;
$proximity_num_votes[$i] -= 1;
$alignment_num_votes[$i] -= 1;
$layout_num_votes[$i] -= 1;
fclose($fp_expert);
}
}//end for
if($total_votes != 0) $global_average = $total_sum/$total_votes;
if($total_novice_votes != 0)$novice_average = $total_sum_novice/$total_novice_votes;
if($total_amateur_votes != 0) $amateur_average = $total_sum_amateur/$total_amateur_votes;
if($total_expert_votes != 0) $expert_average = $total_sum_expert/$total_expert_votes;
?>
| |
| General Results |
| Number of Evaluations: echo $total_evaluators;?> |
| Average Evaluation | echo getBar(round($global_average,2));?> |
|
| |
| By Expertise Level |
| Expert Level |
| Number of Evaluations: echo $total_expert;?> |
| Average Evaluation | echo getBar(round($expert_average,2));?> |
|
| Amateur Level |
| Number of Evaluations: echo $total_amateur;?> |
| Average Evaluation | echo getBar(round($amateur_average,2));?> |
|
| Novice Level |
| Number of Evaluations: echo $total_novice;?> |
| Average Evaluation | echo getBar(round($novice_average,2));?> |
|
| By Design |
for ($i=1;$i<16;$i++){
?>
|
 |
|
| Novice |
| Design |
if($design_num_votes[$i] != 0)
echo getBar(round($design_votes[$i]/$design_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Amateur |
| Composition |
if($composition_num_votes[$i] != 0)
echo getBar(round($composition_votes[$i]/$composition_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Fonts |
if($fonts_num_votes[$i] != 0)
echo getBar(round($fonts_votes[$i]/$fonts_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Colors |
if($colors_num_votes[$i] != 0)
echo getBar(round($colors_votes[$i]/$colors_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Expert |
| Contrast |
if($contrast_num_votes[$i] != 0)
echo getBar(round($contrast_votes[$i]/$contrast_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Repetition |
if($repetition_num_votes[$i] != 0)
echo getBar(round($repetition_votes[$i]/$repetition_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Proximity |
if($proximity_num_votes[$i] != 0)
echo getBar(round($proximity_votes[$i]/$proximity_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Alignment |
if($alignment_num_votes[$i] != 0)
echo getBar(round($alignment_votes[$i]/$alignment_num_votes[$i],2));
else
echo getBar(0);
?>
|
| Layout |
if($layout_num_votes[$i] != 0)
echo getBar(round($layout_votes[$i]/$layout_num_votes[$i],2));
else
echo getBar(0);
?>
|
|
|
}//fin de for
?>