Class to represent a content-item object.  
 More...
 | 
|   | __construct (string $type, array|Placement|null $placementAdvices=null, ?string $id=null) | 
|   | Class constructor.  
  | 
|   | 
| void  | setUrl (?string $url) | 
|   | Set a URL value for the content-item.  
  | 
|   | 
| void  | setMediaType (?string $mediaType) | 
|   | Set a media type value for the content-item.  
  | 
|   | 
| void  | setTitle (?string $title) | 
|   | Set a title value for the content-item.  
  | 
|   | 
| void  | setText (?string $text) | 
|   | Set a link text value for the content-item.  
  | 
|   | 
| void  | setHtml (?string $html) | 
|   | Set an HTML embed value for the content-item.  
  | 
|   | 
| bool  | addPlacementAdvice (?Placement $placementAdvice) | 
|   | Add a placement for the content-item.  
  | 
|   | 
| void  | setIcon (?Image $icon) | 
|   | Set an icon image for the content-item.  
  | 
|   | 
| void  | setThumbnail (?Image $thumbnail) | 
|   | Set a thumbnail image for the content-item.  
  | 
|   | 
| void  | setHideOnCreate (?bool $hideOnCreate) | 
|   | Set whether the content-item should be hidden from learners by default.  
  | 
|   | 
 | 
| static string  | toJson (array|Item $items, LtiVersion $ltiVersion=LtiVersion::V1) | 
|   | Wrap the content items to form a complete application/vnd.ims.lti.v1.contentitems+json media type instance.  
  | 
|   | 
| static array  | fromJson (object|array $items) | 
|   | Generate an array of Item objects from their JSON representation.  
  | 
|   | 
| static Item LtiLinkItem FileItem null  | fromJsonItem (object $item) | 
|   | Generate an Item object from its JSON or JSON-LD representation.  
  | 
|   | 
 | 
| const  | TYPE_LINK = 'link' | 
|   | Type for link content-item.  
  | 
|   | 
| const  | TYPE_LTI_LINK = 'ltiResourceLink' | 
|   | Type for LTI link content-item.  
  | 
|   | 
| const  | TYPE_LTI_ASSIGNMENT = 'ltiAssignment' | 
|   | Type for LTI assignment content-item.  
  | 
|   | 
| const  | TYPE_FILE = 'file' | 
|   | Type for file content-item.  
  | 
|   | 
| const  | TYPE_HTML = 'html' | 
|   | Type for HTML content-item.  
  | 
|   | 
| const  | TYPE_IMAGE = 'image' | 
|   | Type for image content-item.  
  | 
|   | 
| const  | LTI_LINK_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltilink' | 
|   | Media type for LTI launch links.  
  | 
|   | 
| const  | LTI_ASSIGNMENT_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltiassignment' | 
|   | Media type for LTI assignment links.  
  | 
|   | 
Class to represent a content-item object. 
- Author
 - Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com 
 
- Copyright
 - SPV Software Products 
 
- Licence: http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3
 
 
◆ __construct()
      
        
          | ceLTIc\LTI\Content\Item::__construct  | 
          ( | 
          string |           $type,  | 
        
        
           | 
           | 
          array|Placement|null |           $placementAdvices = null,  | 
        
        
           | 
           | 
          ?string |           $id = null ) | 
        
      
 
Class constructor. 
- Parameters
 - 
  
    | string | $type | Class type of content-item  | 
    | Placement[] | Placement | null | $placementAdvices | Array of Placement objects (or single placement object) for item (optional)  | 
    | string | null | $id | URL of content-item (optional)  | 
  
   
 
 
◆ addPlacementAdvice()
      
        
          | bool ceLTIc\LTI\Content\Item::addPlacementAdvice  | 
          ( | 
          ?Placement |           $placementAdvice | ) | 
           | 
        
      
 
Add a placement for the content-item. 
- Parameters
 - 
  
    | Placement | null | $placementAdvice | Placement advice object | 
  
   
- Returns
 - bool True if a placement was added 
 
 
 
◆ fromJson()
  
  
      
        
          | static array ceLTIc\LTI\Content\Item::fromJson  | 
          ( | 
          object|array |           $items | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Generate an array of Item objects from their JSON representation. 
- Parameters
 - 
  
    | object | array | $items | A JSON object or array representing Content-Items | 
  
   
- Returns
 - array Array of Item objects 
 
Referenced by setHideOnCreate().
 
 
◆ fromJsonItem()
Generate an Item object from its JSON or JSON-LD representation. 
- Parameters
 - 
  
    | object | $item | A JSON or JSON-LD object representing a content-item | 
  
   
- Returns
 - Item|LtiLinkItem|FileItem|null The content-item object 
 
 
 
◆ fromJsonObject()
  
  
      
        
          | bool ceLTIc\LTI\Content\Item::fromJsonObject  | 
          ( | 
          object |           $item | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ setHideOnCreate()
      
        
          | void ceLTIc\LTI\Content\Item::setHideOnCreate  | 
          ( | 
          ?bool |           $hideOnCreate | ) | 
           | 
        
      
 
Set whether the content-item should be hidden from learners by default. 
- Parameters
 - 
  
    | bool | null | $hideOnCreate | True if the item should be hidden from learners  | 
  
   
References fromJson().
 
 
◆ setHtml()
      
        
          | void ceLTIc\LTI\Content\Item::setHtml  | 
          ( | 
          ?string |           $html | ) | 
           | 
        
      
 
Set an HTML embed value for the content-item. 
- Parameters
 - 
  
    | string | null | $html | HTML text value  | 
  
   
 
 
◆ setIcon()
      
        
          | void ceLTIc\LTI\Content\Item::setIcon  | 
          ( | 
          ?Image |           $icon | ) | 
           | 
        
      
 
Set an icon image for the content-item. 
- Parameters
 - 
  
    | Image | null | $icon | Icon image object  | 
  
   
 
 
◆ setMediaType()
      
        
          | void ceLTIc\LTI\Content\Item::setMediaType  | 
          ( | 
          ?string |           $mediaType | ) | 
           | 
        
      
 
Set a media type value for the content-item. 
- Parameters
 - 
  
    | string | null | $mediaType | Media type value  | 
  
   
 
 
◆ setText()
      
        
          | void ceLTIc\LTI\Content\Item::setText  | 
          ( | 
          ?string |           $text | ) | 
           | 
        
      
 
Set a link text value for the content-item. 
- Parameters
 - 
  
    | string | null | $text | Link text value  | 
  
   
 
 
◆ setThumbnail()
      
        
          | void ceLTIc\LTI\Content\Item::setThumbnail  | 
          ( | 
          ?Image |           $thumbnail | ) | 
           | 
        
      
 
Set a thumbnail image for the content-item. 
- Parameters
 - 
  
    | Image | null | $thumbnail | Thumbnail image object  | 
  
   
 
 
◆ setTitle()
      
        
          | void ceLTIc\LTI\Content\Item::setTitle  | 
          ( | 
          ?string |           $title | ) | 
           | 
        
      
 
Set a title value for the content-item. 
- Parameters
 - 
  
    | string | null | $title | Title value  | 
  
   
 
 
◆ setUrl()
      
        
          | void ceLTIc\LTI\Content\Item::setUrl  | 
          ( | 
          ?string |           $url | ) | 
           | 
        
      
 
Set a URL value for the content-item. 
- Parameters
 - 
  
    | string | null | $url | URL value  | 
  
   
 
 
◆ toJson()
Wrap the content items to form a complete application/vnd.ims.lti.v1.contentitems+json media type instance. 
- Parameters
 - 
  
    | Item[] | Item | $items | An array of content items or a single item  | 
    | LtiVersion | $ltiVersion | LTI version in use | 
  
   
- Returns
 - string 
 
 
 
◆ toJsonldObject()
  
  
      
        
          | object ceLTIc\LTI\Content\Item::toJsonldObject  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ toJsonObject()
  
  
      
        
          | object ceLTIc\LTI\Content\Item::toJsonObject  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ LTI_ASSIGNMENT_MEDIA_TYPE
      
        
          | const ceLTIc\LTI\Content\Item::LTI_ASSIGNMENT_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltiassignment' | 
        
      
 
Media type for LTI assignment links. 
 
 
◆ LTI_LINK_MEDIA_TYPE
      
        
          | const ceLTIc\LTI\Content\Item::LTI_LINK_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltilink' | 
        
      
 
Media type for LTI launch links. 
 
 
◆ TYPE_FILE
      
        
          | const ceLTIc\LTI\Content\Item::TYPE_FILE = 'file' | 
        
      
 
Type for file content-item. 
 
 
◆ TYPE_HTML
      
        
          | const ceLTIc\LTI\Content\Item::TYPE_HTML = 'html' | 
        
      
 
Type for HTML content-item. 
 
 
◆ TYPE_IMAGE
      
        
          | const ceLTIc\LTI\Content\Item::TYPE_IMAGE = 'image' | 
        
      
 
Type for image content-item. 
 
 
◆ TYPE_LINK
      
        
          | const ceLTIc\LTI\Content\Item::TYPE_LINK = 'link' | 
        
      
 
Type for link content-item. 
 
 
◆ TYPE_LTI_ASSIGNMENT
      
        
          | const ceLTIc\LTI\Content\Item::TYPE_LTI_ASSIGNMENT = 'ltiAssignment' | 
        
      
 
Type for LTI assignment content-item. 
 
 
◆ TYPE_LTI_LINK
      
        
          | const ceLTIc\LTI\Content\Item::TYPE_LTI_LINK = 'ltiResourceLink' | 
        
      
 
Type for LTI link content-item.