getEm();
/* @var $hitRepo EmotionHero\Models\HitRepository */
$hitRepo = $em->getRepository(\EmotionHero\Models\Hit::class);
/* @var $currentHit \EmotionHero\Models\Hit */
$currentHit = $hitRepo->findOneBy(['hasImage'=>true], ['id'=>'DESC']);
$printEmoBlocks = function($emotion, $feature, $steps = 6) use($em) {
foreach(range(0, 100, 100/($steps-1)) as $i) {
/* @var $hitRepo EmotionHero\Models\HitRepository */
$hitRepo = $em->getRepository(EmotionHero\Models\Hit::class);
$hit = $hitRepo->getClosestHitWithImage($emotion, $i);
$img = $hit->getFeatureImgAsString($feature);
$score = $hit->getEmotions()->getEmotionScore($emotion);
$percentage = sprintf("%.0f %%",$score);
echo <<< EOSNIPPET
$percentage
EOSNIPPET;
}
};
?>
Emotion Hero
";
echo "getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\">";
echo "";
foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) {
echo "- $emotion
- " . sprintf("%.2f %%", $currentHit->getEmotions()->getEmotionScore($emotion)) . "
";
}
echo "
";
echo "";
echo "eye brows
";
foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) {
echo "
$emotion
";
$printEmoBlocks($emotion, 'brows');
echo "
getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getEmotionScore($emotion)}%\">";
echo "
";
}
//
//echo "
joy
";
//$printEmoBlocks('joy','brows');
//echo "
getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getJoy()}%\">";
//echo "
";
//
//echo "
sadness
";
//$printEmoBlocks('sadness','brows');
//echo "
getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getSadness()}%\">";
//echo "
";
//
//echo "
surprise
";
//$printEmoBlocks('surprise','brows');
//echo "
getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getSurprise()}%\">";
//echo "
";
//echo "
"; // .brows
echo "nose
";
foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) {
echo "
$emotion
";
$printEmoBlocks($emotion, 'nose');
echo "
getFeatureImgAsString("nose")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getEmotionScore($emotion)}%\">";
echo "
";
}
echo "
"; // .nose
foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) {
echo "$emotion
";
$printEmoBlocks($emotion, 'mouth_right');
echo "
getFeatureImgAsString("mouth_right")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getEmotionScore($emotion)}%\">";
echo "
";
}
$circles = "";
foreach($currentHit->getPoints()->getNormalisedPoints() as $i => $point) {
$circles .= '';
}
foreach($hitRepo->getBetterHit($currentHit)->getPoints()->getNormalisedPoints() as $i => $point) {
$circles .= '';
}
echo <<< EOSVG
EOSVG;
?>