Interface Inx_Api_Resource_ResourceManager

Description

The Inx_Api_Resource_ResourceManager manages the file resources.

The Inx_Api_Resource_ResourceManager manages the file resources. An Inx_Api_Resource_Resource can be used as attachment or embedded image in a mailing. Attachments and embedded images used in mailings are "resources". Using the ResourceManager, these resources can be upload to and download from the Inxmail server. Resources can be bound to mailing lists or mailings, which means they are not visible outside these bounds, and will be removed with their mailing list or mailing.

The following snippet shows how to upload a resource (logo.gif) which can be used by all mailings in all lists:

 $oResourceManager = $oSession->getResourceManager();
 $in = fopen("/images/logo.gif", 'rb');
 $oResource = $oResourceManager->upload( null, "logo.gif", $in );
 fclose($in);
Inxmail assigns an unique identifier to the uploaded resource. To attach a resource to a mailing, add the attach tag to the mail body. The following snippet shows how to attach the resource with the id 42 to a mailing:
 $sb = "[%attach(".$oResource->getId(). "); ".$res->getName(). "]" ;
This results in a string like [%attach(42); logo.gif]. To embed an image instead of adding it as attachment, replace 'attach' with 'embedded-image': [%embedded-image(42); logo.gif].

To locate existing resources, use one of the select methods of the ResourceManager. The following snippet shows how to retrieve all Inx_Api_Resource_Resources available for a specific mailing and prints their IDs and names:

 $oMailing = $oSession->getMailingManager()->get( 4711 );

 $oResourceManager = $oSession->getResourceManager();
 $oBOResultSet = $oResourceManager->select( $oMailing, Inx_Api_Resource_Resource::ATTRIBUTE_NAME, Inx_Api_Order::ASC );

 for( $i = 0; $i < $oBOResultSet->size(); $i++ )
 {
 	$oResource = $oBOResultSet->get( $i );
 	echo $oResource->getId().": ".$oResource->getName()."<br>";
 }

For more information on resources, see the Inx_Api_Resource_Resource documentation.

  • version: $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
  • see: Inx_Api_Resource_Resource
  • since: API 1.0

Located in /Api/Resource/ResourceManager.php (line 62)

Inx_Api_BOManager
   |
   --Inx_Api_Resource_ResourceManager
Class Constant Summary
Method Summary
Inx_Api_BOResultSet select (Inx_Api_Mailing_Mailing $oMailing, int $iOrderAttribute, int $iOrderType)
Inx_Api_Resource_Resource upload (Inx_Api_List_ListContext|Inx_Api_Mailing_Mailing $mOwner, string $sFilename, resource $rsInputStream)
Methods
select (line 116)

Returns an Inx_Api_BOResultSet containing all resources available for the given Inx_Api_Mailing_Mailing.

Returns an Inx_Api_BOResultSet containing all resources available for the given Inx_Api_Mailing_Mailing. This includes all non shared resources available for this mailing, list shared resources and system shared resources.

  • return: an BOResultSet object that contains the data produced by the given query.
  • throws: SecurityException if the session user doesn't have the following permission: Inx__Api_UserRights::RESOURCE_FEATURE_USE
  • access: public
Inx_Api_BOResultSet select (Inx_Api_Mailing_Mailing $oMailing, int $iOrderAttribute, int $iOrderType)
  • Inx_Api_Mailing_Mailing $oMailing: the mailing for which the available resources shall be retrieved.
  • int $iOrderAttribute: the order attribute. May be one of:
    • Inx_Api_Resource_Resource::ATTRIBUTE_NAME
    • Inx_Api_Resource_Resource::ATTRIBUTE_SHARING_TYPE
    • Inx_Api_Resource_Resource::ATTRIBUTE_SIZE
    • Inx_Api_Resource_Resource::ATTRIBUTE_CREATION_DATETIME
    • Inx_Api_Resource_Resource::ATTRIBUTE_USER_ID
  • int $iOrderType: the order type Inx_Api_Order::ASC or Inx_Api_Order::DESC).
upload (line 95)

Uploads a file resource to Inxmail.

Uploads a file resource to Inxmail. The sharing type depends on the type of the $mOwner parameter:

  1. If you pass a
    1. null
    value, the resource will be shared with all other mailings in the system (i.e. sharingType is Inx_Api_Resource_Resource::SHARING_TYPE_SYSTEM).
  2. If you pass an instance of Inx_Api_Mailing_Mailing, the resource will not be shared with other mailings (i.e. sharingType is Inx_Api_Resource_Resource::SHARING_TYPE_MAILING).
  3. If you pass an instance of Inx_Api_List_ListContext, The resource will be shared with other mailings in the specified list (i.e. sharingType is Inx_Api_Resource_Resource::SHARING_TYPE_LIST).
  4. Any other non null value will render no effect. The method will not perform the upload.
If a resource with the specified name already exists it will not be overwritten. Instead a second resource with the same name and the new content will be created.

  • return: the new resource, or null if the upload failed.
  • throws: Inx_Api_SecurityException if the session user doesn't have the following permission: Inx_Api_UserRights::RESOURCE_UPLOAD_MAILING_SHARING
  • access: public
Inx_Api_Resource_Resource upload (Inx_Api_List_ListContext|Inx_Api_Mailing_Mailing $mOwner, string $sFilename, resource $rsInputStream)
  • Inx_Api_List_ListContext|Inx_Api_Mailing_Mailing $mOwner: the list or mailing this resource will be restricted to. May be null to share the resource with all mailings in all lists.
  • string $sFilename: the filename of the resource (e.g. logo.gif).
  • resource $rsInputStream: the input stream of the file content.

Inherited Methods

Inherited From Inx_Api_BOManager

Inx_Api_BOManager::get()
Inx_Api_BOManager::remove()
Inx_Api_BOManager::selectAll()
Class Constants
ORDER_ASC = 0 (line 66)
  • deprecated: replaced by Inx_Api_Order::ASC
ORDER_DESC = 1 (line 69)
  • deprecated: replaced by Inx_Api_Order::DESC

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