view/activities/json.php
protected function _getObjectData(ComActivitiesActivityObjectInterface $object)
    {
        $data = $object->toArray();

        // Make sure we get fully qualified URLs.
        if ($url = $object->getUrl()) {
            $data['url'] = $this->_getUrl($url);
        }

        $attachments = array();

        // Handle attachments recursively.
        foreach ($object->getAttachments() as $attachment) {
            $attachments[] = $this->_getObjectData($attachment);
        }

        $data['attachments'] = $attachments;

        // Convert date objects to date time strings.
        foreach (array('published', 'updated') as $property)
        {
            $method = 'get' . ucfirst($property);

            if ($date = $object->$method()) {
                $data[$property] = $date->format('M d Y H:i:s');
            }
        }

        foreach ($object as $key => $value)
        {
            if ($value instanceof ComActivitiesActivityObjectInterface) {
                $data[$key] = $this->_getObjectData($value);
            }

            if ($value instanceof ComActivitiesActivityMedialinkInterface) {
                $data[$key] = $this->_getMedialinkData($value);
            }
        }

        return $this->_cleanupData($data);
    }
protected function _getObjectData(ComActivitiesActivityObjectInterface $object)
    {
        $data = $object->toArray();

        // Make sure we get fully qualified URLs.
        if ($url = $object->getUrl()) {
            $data['url'] = $this->_getUrl($url);
        }

        $attachments = array();

        // Handle attachments recursively.
        foreach ($object->getAttachments() as $attachment) {
            $attachments[] = $this->_getObjectData($attachment);
        }

        $data['attachments'] = $attachments;

        // Convert date objects to date time strings.
        foreach (array('published', 'updated') as $property)
        {
            $method = 'get' . ucfirst($property);

            if ($date = $object->$method()) {
                $data[$property] = $date->format('M d Y H:i:s');
            }
        }

        foreach ($object as $key => $value)
        {
            if ($value instanceof ComActivitiesActivityObjectInterface) {
                $data[$key] = $this->_getObjectData($value);
            }

            if ($value instanceof ComActivitiesActivityMedialinkInterface) {
                $data[$key] = $this->_getMedialinkData($value);
            }
        }

        return $this->_cleanupData($data);
    }
protected function _getObjectData ( ComActivitiesActivityObjectInterface $ object ) { $ data = $ object -> toArray ( ) ; // Make sure we get fully qualified URLs. if ( $ url = $ object -> getUrl ( ) ) { $ data [ 'url' ] = $ this -> _getUrl ( $ url ) ; } $ attachments = array ( ) ; // Handle attachments recursively. foreach ( $ object -> getAttachments ( ) as $ attachment ) { $ attachments [ ] = $ this -> _getObjectData ( $ attachment ) ; } $ data [ 'attachments' ] = $ attachments ; // Convert date objects to date time strings. foreach ( array ( 'published' , 'updated' ) as $ property ) { $ method = 'get' . ucfirst ( $ property ) ; if ( $ date = $ object -> $ method ( ) ) { $ data [ $ property ] = $ date -> format ( 'M d Y H:i:s' ) ; } } foreach ( $ object as $ key => $ value ) { if ( $ value instanceof ComActivitiesActivityObjectInterface ) { $ data [ $ key ] = $ this -> _getObjectData ( $ value ) ; } if ( $ value instanceof ComActivitiesActivityMedialinkInterface ) { $ data [ $ key ] = $ this -> _getMedialinkData ( $ value ) ; } } return $ this -> _cleanupData ( $ data ) ; }
Activity object data getter.

@param ComActivitiesActivityObjectInterface $object The activity object.
@return array The object data.
Activity object data getter .