src/Util/DeepLinkResponse.php
public function addContentItemExtended($params = array())
    {
        if (empty($params['title']))
            $params['title'] = false;
        if (empty($params['text']))
            $params['text'] = false;
        if (empty($params['icon']))
            $params['icon'] = false;
        if (empty($params['fa_icon']))
            $params['fa_icon'] = false;
        if (empty($params['placementTarget']))
            $params['placementTarget'] = 'iframe';
        if (empty($params['placementWindowTarget']))
            $params['placementWindowTarget'] = '';
        if (empty($params['placementWidth']))
            $params['placementWidth'] = '';
        if (empty($params['placementHeight']))
            $params['placementHeight'] = '';

        $item = '{ "@type" : "ContentItem",
                "@id" : ":item2",
                "title" : "A cool tool hosted in the Tsugi environment.",
                "mediaType" : "text/html",
                "text" : "For more information on how to build and host powerful LTI-based Tools quickly, see www.tsugi.org",
                "url" : "http://www.tsugi.org/",
                "placementAdvice" : {
                        "presentationDocumentTarget" : "iframe"
                },
                "icon" : {
                        "@id" : "https://static.tsugi.org/img/default-icon.png",
                        "fa_icon" : "fa-magic",
                        "width" : 64,
                        "height" : 64
                }
        }';

        $json = json_decode($item);
        $json->url = $params['url'];
        if ( $params['title'] ) $json->{'title'} = $params['title'];
        if ( $params['text'] ) $json->{'text'} = $params['text'];
        if ( $params['icon'] ) $json->{'icon'}->{'@id'} = $params['icon'];
        if ( $params['fa_icon'] ) $json->icon->fa_icon = $params['fa_icon'];

        if ($params['placementTarget'])
            $json->placementAdvice->presentationDocumentTarget = $params['placementTarget'];
        if ($params['placementWindowTarget'])
            $json->placementAdvice->windowTarget = $params['placementWindowTarget'];
        if (! empty($params['placementWidth']))
            $json->placementAdvice->displayWidth = $params['placementWidth'];
        if (! empty($params['placementHeight']))
            $json->placementAdvice->displayHeight = $params['placementHeight'];

        $json->{'@id'} = ':item'.(count($this->json->{'@graph'})+1);

        $this->json->{'@graph'}[] = $json;
    }
public function addContentItemExtended($params = array())
    {
        if (empty($params['title']))
            $params['title'] = false;
        if (empty($params['text']))
            $params['text'] = false;
        if (empty($params['icon']))
            $params['icon'] = false;
        if (empty($params['fa_icon']))
            $params['fa_icon'] = false;
        if (empty($params['placementTarget']))
            $params['placementTarget'] = 'iframe';
        if (empty($params['placementWindowTarget']))
            $params['placementWindowTarget'] = '';
        if (empty($params['placementWidth']))
            $params['placementWidth'] = '';
        if (empty($params['placementHeight']))
            $params['placementHeight'] = '';

        $item = '{ "@type" : "ContentItem",
                "@id" : ":item2",
                "title" : "A cool tool hosted in the Tsugi environment.",
                "mediaType" : "text/html",
                "text" : "For more information on how to build and host powerful LTI-based Tools quickly, see www.tsugi.org",
                "url" : "http://www.tsugi.org/",
                "placementAdvice" : {
                        "presentationDocumentTarget" : "iframe"
                },
                "icon" : {
                        "@id" : "https://static.tsugi.org/img/default-icon.png",
                        "fa_icon" : "fa-magic",
                        "width" : 64,
                        "height" : 64
                }
        }';

        $json = json_decode($item);
        $json->url = $params['url'];
        if ( $params['title'] ) $json->{'title'} = $params['title'];
        if ( $params['text'] ) $json->{'text'} = $params['text'];
        if ( $params['icon'] ) $json->{'icon'}->{'@id'} = $params['icon'];
        if ( $params['fa_icon'] ) $json->icon->fa_icon = $params['fa_icon'];

        if ($params['placementTarget'])
            $json->placementAdvice->presentationDocumentTarget = $params['placementTarget'];
        if ($params['placementWindowTarget'])
            $json->placementAdvice->windowTarget = $params['placementWindowTarget'];
        if (! empty($params['placementWidth']))
            $json->placementAdvice->displayWidth = $params['placementWidth'];
        if (! empty($params['placementHeight']))
            $json->placementAdvice->displayHeight = $params['placementHeight'];

        $json->{'@id'} = ':item'.(count($this->json->{'@graph'})+1);

        $this->json->{'@graph'}[] = $json;
    }
public function addContentItemExtended ( $ params = array ( ) ) { if ( empty ( $ params [ 'title' ] ) ) $ params [ 'title' ] = false ; if ( empty ( $ params [ 'text' ] ) ) $ params [ 'text' ] = false ; if ( empty ( $ params [ 'icon' ] ) ) $ params [ 'icon' ] = false ; if ( empty ( $ params [ 'fa_icon' ] ) ) $ params [ 'fa_icon' ] = false ; if ( empty ( $ params [ 'placementTarget' ] ) ) $ params [ 'placementTarget' ] = 'iframe' ; if ( empty ( $ params [ 'placementWindowTarget' ] ) ) $ params [ 'placementWindowTarget' ] = '' ; if ( empty ( $ params [ 'placementWidth' ] ) ) $ params [ 'placementWidth' ] = '' ; if ( empty ( $ params [ 'placementHeight' ] ) ) $ params [ 'placementHeight' ] = '' ; $ item = '{ "@type" : "ContentItem",
                "@id" : ":item2",
                "title" : "A cool tool hosted in the Tsugi environment.",
                "mediaType" : "text/html",
                "text" : "For more information on how to build and host powerful LTI-based Tools quickly, see www.tsugi.org",
                "url" : "http://www.tsugi.org/",
                "placementAdvice" : {
                        "presentationDocumentTarget" : "iframe"
                },
                "icon" : {
                        "@id" : "https://static.tsugi.org/img/default-icon.png",
                        "fa_icon" : "fa-magic",
                        "width" : 64,
                        "height" : 64
                }
        }' ; $ json = json_decode ( $ item ) ; $ json -> url = $ params [ 'url' ] ; if ( $ params [ 'title' ] ) $ json -> { 'title' } = $ params [ 'title' ] ; if ( $ params [ 'text' ] ) $ json -> { 'text' } = $ params [ 'text' ] ; if ( $ params [ 'icon' ] ) $ json -> { 'icon' } -> { '@id' } = $ params [ 'icon' ] ; if ( $ params [ 'fa_icon' ] ) $ json -> icon -> fa_icon = $ params [ 'fa_icon' ] ; if ( $ params [ 'placementTarget' ] ) $ json -> placementAdvice -> presentationDocumentTarget = $ params [ 'placementTarget' ] ; if ( $ params [ 'placementWindowTarget' ] ) $ json -> placementAdvice -> windowTarget = $ params [ 'placementWindowTarget' ] ; if ( ! empty ( $ params [ 'placementWidth' ] ) ) $ json -> placementAdvice -> displayWidth = $ params [ 'placementWidth' ] ; if ( ! empty ( $ params [ 'placementHeight' ] ) ) $ json -> placementAdvice -> displayHeight = $ params [ 'placementHeight' ] ; $ json -> { '@id' } = ':item' . ( count ( $ this -> json -> { '@graph' } ) + 1 ) ; $ this -> json -> { '@graph' } [ ] = $ json ; }
addContentItemExtended - Add an Content Item

@param $params Key/Value pair of configurable options for content item (see addContentItem)
addContentItemExtended - Add an Content Item