OEModule\OphCiExamination\components\OphCiExamination_API::getElementsForLatestEventInEpisode PHP Method

getElementsForLatestEventInEpisode() public method

returns all the elements from the most recent examination of the patient in the given episode.
public getElementsForLatestEventInEpisode ( Patient $patient, Episode $episode ) : ElementType[]
$patient Patient
$episode Episode
return ElementType[] - array of various different element type objects
    public function getElementsForLatestEventInEpisode($patient, $episode)
    {
        $element_types = array();
        $event_type = $this->getEventType();
        if ($event_type && ($event = $this->getMostRecentEventInEpisode($episode->id, $event_type->id))) {
            $criteria = new \CDbCriteria();
            $criteria->compare('event_type_id', $event_type->id);
            $criteria->order = 'display_order';
            foreach (\ElementType::model()->findAll($criteria) as $element_type) {
                $class = $element_type->class_name;
                if ($element = $class::model()->find('event_id=?', array($event->id))) {
                    if (method_exists($element, 'getLetter_string')) {
                        $element_types[] = $element_type;
                    }
                }
            }
        }
        return $element_types;
    }
OphCiExamination_API