public function actionArvoPresentation($startDate, $endDate)
{
// this is a fixed report for now, need to be updated
$leftSummary = array('superior' => 0, 'inferior' => 0, 'neutral' => 0);
$rightSummary = array('superior' => 0, 'inferior' => 0, 'neutral' => 0);
$dataValues = Yii::app()->db->createCommand("SELECT left_eyedraw, right_eyedraw\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM et_ophtrintravitinjection_anteriorseg eoa\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN event e ON e.id=eoa.event_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE e.event_date>='" . $startDate . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND e.event_date<='" . $endDate . "'")->queryAll();
foreach ($dataValues as $data) {
$jsonDataLeft = json_decode($data['left_eyedraw']);
$jsonDataRight = json_decode($data['right_eyedraw']);
if (isset($jsonDataLeft) && isset($jsonDataLeft[count($jsonDataLeft) - 1]->rotation)) {
++$leftSummary[$this->getArvo($jsonDataLeft[count($jsonDataLeft) - 1]->rotation)];
}
if (isset($jsonDataRight) && isset($jsonDataRight[count($jsonDataRight) - 1]->rotation)) {
++$rightSummary[$this->getArvo($jsonDataRight[count($jsonDataRight) - 1]->rotation)];
}
}
echo 'Dates: ' . $startDate . ' - ' . $endDate;
echo '<table>';
echo '<tr><th></th><th>Left</th><th>Right</th></tr>';
echo '<tr><td>Inferior:</td><td>' . $leftSummary['inferior'] . '</td><td>' . $rightSummary['inferior'] . '</td></tr>';
echo '<tr><td>Superior:</td><td>' . $leftSummary['superior'] . '</td><td>' . $rightSummary['superior'] . '</td></tr>';
echo '<tr><td>Neutral (90, 270):</td><td>' . $leftSummary['neutral'] . '</td><td>' . $rightSummary['neutral'] . '</td></tr>';
echo '</table>';
}