Interface Inx_Api_DesignTemplate_DesignCollectionManager

Description

The Inx_Api_DesignTemplate_DesignCollectionMananger can be used to access Inx_Api_DesignTemplate_DesignCollections.

The Inx_Api_DesignTemplate_DesignCollectionMananger can be used to access Inx_Api_DesignTemplate_DesignCollections. You can import design collections from itc files into a specific list or all lists (by using the SystemListContext). You can also retrieve the collections available in a specific list or all lists (by ommitting the list parameter). Inx_Api_DesignTemplate_DesignCollections are returned in an Inx_Api_BOResultSet that may be used to access the individual collections. Inx_Api_DesignTemplate_DesignCollections may contain multiple templates with possibly multiple text and HTML styles. These styles can be used to create new mailings based on the chosen template.

The following snippet shows how to generate a mailing based on a newly imported design collection:

 $oListContext = $oSession->getListContextManager()->findByName( "Name of the desired List" );
 $oMailing = $oSession->getMailingManager()->createMailing( $oListContext );
 $oMailing->setContentHandler( "Inx_Api_Mailing_XsltMultiPartContentHandler" );

 $oDesignCollectionManager = $oSession->getDesignCollectionManager();

 $stream = fopen( "test.itc", "rb");

 $oDesignCollection = $oDesignCollectionManager->importDesignCollection( $stream, $oListContext );
 fclose($stream);
 $aTemplates = $oDesignCollection->getTemplates();

 $oContentHandler = $oMailing->getContentHandler();
 $aStyles = $aTemplates[0]->getHTMLStyles();
 $oContentHandler->updateStyle( $aStyles[0] );

 $oMailing->commitUpdate();

The following snippet shows how to list all available HTML styles of all design collections in a certain list:

 $oDesignCollectionManager = $oSession->getDesignCollectionManager();

 $oListContext = $oSession->getListContextManager()->findByName( "Name of the desired List" );

 $oBOResultSet = $oDesignCollectionManager->select($oListContext);

 for( $i = 0; $i<$oBOResultSet->getSize(); $i++)
 {
  $oDesignCollection = $oBOResultSet->get($i);
  echo $oDesignCollection->getVendor();
  echo $oDesignCollection->getVendorURL();
  ...
  $aTemplates = $oDesignCollection->getTemplates();
  for($j = 0; $j<count($aTemplates); $j++)
  {
   $oTemplate = $aTemplates[j];
   echo $oTemplate->getName();
   echo $oTemplate->getId();
   $aHtmlStyles = $oTemplate->getHTMLStyles();
   for ($k = 0; $k<count($aHtmlStyles); $k++)
   {
    echo $aHtmlStyles[k]->getTemplateID();
    echo $aHtmlStyles[k]->getStyleName();
   }
  }
 }

 $oBOResultSet->close();

Note: The usage of Inx_Api_DesignTemplate_DesignCollections requires the api user right: Inx_Api_UserRights::TEMPLATE_FEATURE_USE For more information on design collections, see the Inx_Api_DesignTemplate_DesignCollection documentation.

Located in /Api/DesignTemplate/DesignCollectionManager.php (line 86)

Inx_Api_BOManager
   |
   --Inx_Api_DesignTemplate_DesignCollectionManager
Method Summary
Methods
createPreviewImageStream (line 126)

Returns the preview image, provided by the design collection.

Returns the preview image, provided by the design collection. Can be null, if no image was provided. This method does not return an actual screenshot of a mailing generated with this Inx_Api_DesignTemplate_Style, but an image provided and generated by the design collection author.

  • return: an Inx_Api_InputStream containing the image data.
  • throws: Inx_Api_NullPointerException when the passed style is null.
  • access: public
Inx_Api_InputStream createPreviewImageStream (Inx_Api_DesignTemplate_Style $oStyle)
importDesignCollection (line 104)

Imports the desired itc file into the specified list to be used there.

Imports the desired itc file into the specified list to be used there. Importing an itc into the system list will make the design collection available in all lists. The following snippet retrieves the system list context:

 $oListContextManager = $oSession->getListContextManager();
 $oListContextc = $oListContextManager->findByName( Inx_Api_SystemListContext::NAME );

  • return: the generated Inx_Api_DesignTemplate_DesignCollection.
  • throws: Inx_Api_IOException if the resource cannot be read.
  • throws: Inx_Api_DesignTemplate_ImportException if an error occurred while importing the itc file.
  • throws: Inx_Api_FeatureNotAvailableException if the design template feature is not available in the given list. This exception is thrown since API 1.9.0.
  • access: public
Inx_Api_DesignTemplate_DesignCollection importDesignCollection (resource $rbItcFile, Inx_Api_List_ListContext $oCxt)
  • resource $rbItcFile: the itc file handle from which the itc file will be read.
  • Inx_Api_List_ListContext $oCxt: the list to import the design collection into.
select (line 114)

Returns the Inx_Api_DesignTemplate_DesignCollections available in the specified list.

Returns the Inx_Api_DesignTemplate_DesignCollections available in the specified list. To retrieve all design collections from all lists, pass on a null value.

  • return: an Inx_Api_BOResultSet containing the fetched Inx_Api_DesignTemplate_DesignCollections.
  • access: public

Inherited Methods

Inherited From Inx_Api_BOManager

Inx_Api_BOManager::get()
Inx_Api_BOManager::remove()
Inx_Api_BOManager::selectAll()

Documentation generated on Thu, 17 Sep 2015 14:27:24 +0200 by phpDocumentor 1.3.2