OEModule\OphCoCvi\components\OphCoCvi_API::patientSummaryRender PHP Method

patientSummaryRender() public method

Render a patient summary widget to display CVI status based on the eCVI event and the core static model.
public patientSummaryRender ( Patient $patient ) : string
$patient Patient
return string
    public function patientSummaryRender(Patient $patient)
    {
        $rows = array();
        $oph_info_editable = false;
        foreach ($this->getEvents($patient) as $event) {
            $rows[] = array('date' => $this->getManager()->getDisplayStatusDateForEvent($event), 'status' => $this->getManager()->getDisplayStatusForEvent($event), 'event_url' => $this->getManager()->getEventViewUri($event));
        }
        $info = $patient->getOphInfo();
        if (!count($rows) || !$info->isNewRecord) {
            $oph_info_editable = true;
            $rows[] = array('date' => $info->cvi_status_date, 'status' => $info->cvi_status->name);
        }
        // slot the info record into the right place
        uasort($rows, function ($a, $b) {
            return $a['date'] < $b['date'] ? -1 : 1;
        });
        $params = array('rows' => $rows, 'oph_info_editable' => $oph_info_editable, 'oph_info' => $info, 'new_event_uri' => $this->yii->createUrl($this->getEventType()->class_name . '/default/create') . '?patient_id=' . $patient->id);
        return $this->renderPartial('OphCoCvi.views.patient.cvi_status', $params);
    }