DndInxmail_Subscriber - Version 3.1.0.0

Version Notes

First release

Download this release

Release Info

Developer Mattheo Geoffray
Extension DndInxmail_Subscriber
Version 3.1.0.0
Comparing to
See all releases


Version 3.1.0.0

Files changed (218) hide show
  1. app/code/community/DndInxmail/.DS_Store +0 -0
  2. app/code/community/DndInxmail/Subscriber/.DS_Store +0 -0
  3. app/code/community/DndInxmail/Subscriber/Block/Adminhtml/Newsletter/Subscriber/Grid.php +125 -0
  4. app/code/community/DndInxmail/Subscriber/Block/Adminhtml/System/Config/Date.php +38 -0
  5. app/code/community/DndInxmail/Subscriber/Block/Adminhtml/System/Config/Form/Button/Groups.php +64 -0
  6. app/code/community/DndInxmail/Subscriber/Block/Adminhtml/System/Config/Form/Button/Subscribers.php +66 -0
  7. app/code/community/DndInxmail/Subscriber/Block/Synchronization/Groups.php +40 -0
  8. app/code/community/DndInxmail/Subscriber/Block/Synchronization/Subscribers.php +48 -0
  9. app/code/community/DndInxmail/Subscriber/Helper/Abstract.php +58 -0
  10. app/code/community/DndInxmail/Subscriber/Helper/Data.php +70 -0
  11. app/code/community/DndInxmail/Subscriber/Helper/Error.php +43 -0
  12. app/code/community/DndInxmail/Subscriber/Helper/Group.php +254 -0
  13. app/code/community/DndInxmail/Subscriber/Helper/Log.php +97 -0
  14. app/code/community/DndInxmail/Subscriber/Helper/Mapping.php +111 -0
  15. app/code/community/DndInxmail/Subscriber/Helper/Synchronize.php +966 -0
  16. app/code/community/DndInxmail/Subscriber/Helper/Synchronize/Groups.php +98 -0
  17. app/code/community/DndInxmail/Subscriber/Helper/Synchronize/Subscribers.php +75 -0
  18. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Backend/Cron.php +86 -0
  19. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Backend/Customer/Group.php +60 -0
  20. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Backend/Date.php +35 -0
  21. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Attributes.php +46 -0
  22. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Cron/Frequency.php +66 -0
  23. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Group.php +48 -0
  24. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Group/Specific.php +72 -0
  25. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns.php +58 -0
  26. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Dateonly.php +43 -0
  27. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Float.php +43 -0
  28. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Int.php +43 -0
  29. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Text.php +43 -0
  30. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Yesno.php +43 -0
  31. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Lists.php +57 -0
  32. app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Orders.php +43 -0
  33. app/code/community/DndInxmail/Subscriber/Model/Observer.php +151 -0
  34. app/code/community/DndInxmail/Subscriber/Model/Xml.php +104 -0
  35. app/code/community/DndInxmail/Subscriber/controllers/Adminhtml/InxmailcolumnsController.php +137 -0
  36. app/code/community/DndInxmail/Subscriber/controllers/Adminhtml/SynchronizeController.php +84 -0
  37. app/code/community/DndInxmail/Subscriber/controllers/LogController.php +94 -0
  38. app/code/community/DndInxmail/Subscriber/controllers/MessagesController.php +26 -0
  39. app/code/community/DndInxmail/Subscriber/controllers/SourceController.php +252 -0
  40. app/code/community/DndInxmail/Subscriber/controllers/SynchronizeController.php +249 -0
  41. app/code/community/DndInxmail/Subscriber/etc/adminhtml.xml +90 -0
  42. app/code/community/DndInxmail/Subscriber/etc/config.xml +192 -0
  43. app/code/community/DndInxmail/Subscriber/etc/system.xml +841 -0
  44. app/code/community/DndInxmail/Subscriber/sql/dndinxmail_subscriber_setup/mysql4-install-1.0.0.0.php +13 -0
  45. app/code/community/DndInxmail/Subscriber/sql/dndinxmail_subscriber_setup/mysql4-upgrade-1.0.0.0-3.1.0.0.php +19 -0
  46. app/design/adminhtml/default/default/layout/dndinxmail.xml +8 -0
  47. app/design/adminhtml/default/default/template/dndinxmail/subscriber/system/config/form/button/groups.phtml +10 -0
  48. app/design/adminhtml/default/default/template/dndinxmail/subscriber/system/config/form/button/subscribers.phtml +10 -0
  49. app/design/adminhtml/default/default/template/dndinxmail/subscriber/system/inxmail/columns.phtml +64 -0
  50. app/design/frontend/base/default/layout/dndinxmail.xml +40 -0
  51. app/design/frontend/base/default/template/dndinxmail/page/messages.phtml +22 -0
  52. app/design/frontend/base/default/template/dndinxmail/page/synchronize.phtml +23 -0
  53. app/design/frontend/base/default/template/dndinxmail/synchronization/groups.phtml +18 -0
  54. app/design/frontend/base/default/template/dndinxmail/synchronization/subscribers.phtml +16 -0
  55. app/etc/modules/DndInxmail_Subscriber.xml +23 -0
  56. app/locale/de_DE/DndInxmail_Subscriber.csv +111 -0
  57. app/locale/en_US/DndInxmail_Subscriber.csv +110 -0
  58. app/locale/fr_FR/DndInxmail_Subscriber.csv +111 -0
  59. js/dndinxmail/synchronize.js +223 -0
  60. lib/Inx/Api/APIException.php +40 -0
  61. lib/Inx/Api/Action/Action.php +180 -0
  62. lib/Inx/Api/Action/ActionManager.php +97 -0
  63. lib/Inx/Api/Action/Command.php +32 -0
  64. lib/Inx/Api/Action/CommandFactory.php +202 -0
  65. lib/Inx/Api/Action/DeleteRecipientCommand.php +18 -0
  66. lib/Inx/Api/Action/SendActionMailCommand.php +43 -0
  67. lib/Inx/Api/Action/SendMailCommand.php +56 -0
  68. lib/Inx/Api/Action/SetValueCommand.php +72 -0
  69. lib/Inx/Api/Action/SubUnsubscriptionCommand.php +62 -0
  70. lib/Inx/Api/Action/SubscriptionCommand.php +49 -0
  71. lib/Inx/Api/Action/UnsubscriptionCommand.php +57 -0
  72. lib/Inx/Api/Approval/Approver.php +100 -0
  73. lib/Inx/Api/Approval/ApproverManager.php +46 -0
  74. lib/Inx/Api/BOManager.php +43 -0
  75. lib/Inx/Api/BOResultSet.php +56 -0
  76. lib/Inx/Api/Blacklist/BlacklistEntry.php +102 -0
  77. lib/Inx/Api/Blacklist/BlacklistManager.php +109 -0
  78. lib/Inx/Api/Bounce/Bounce.php +257 -0
  79. lib/Inx/Api/Bounce/BounceManager.php +143 -0
  80. lib/Inx/Api/BusinessObject.php +44 -0
  81. lib/Inx/Api/ConnectException.php +19 -0
  82. lib/Inx/Api/DataAccess/ClickData.php +390 -0
  83. lib/Inx/Api/DataAccess/ClickDataRowSet.php +209 -0
  84. lib/Inx/Api/DataAccess/DataAccess.php +93 -0
  85. lib/Inx/Api/DataAccess/DataRowSet.php +100 -0
  86. lib/Inx/Api/DataAccess/LinkData.php +78 -0
  87. lib/Inx/Api/DataAccess/LinkDataRowSet.php +220 -0
  88. lib/Inx/Api/DataException.php +19 -0
  89. lib/Inx/Api/DesignTemplate/DesignCollection.php +86 -0
  90. lib/Inx/Api/DesignTemplate/DesignCollectionManager.php +127 -0
  91. lib/Inx/Api/DesignTemplate/ImportException.php +111 -0
  92. lib/Inx/Api/DesignTemplate/Style.php +32 -0
  93. lib/Inx/Api/DesignTemplate/Template.php +50 -0
  94. lib/Inx/Api/FeatureNotAvailableException.php +22 -0
  95. lib/Inx/Api/Features.php +136 -0
  96. lib/Inx/Api/Filter/Filter.php +165 -0
  97. lib/Inx/Api/Filter/FilterManager.php +96 -0
  98. lib/Inx/Api/FilterStmtException.php +18 -0
  99. lib/Inx/Api/IOException.php +13 -0
  100. lib/Inx/Api/IllegalArgumentException.php +17 -0
  101. lib/Inx/Api/IllegalStateException.php +19 -0
  102. lib/Inx/Api/Inbox/InboxManager.php +99 -0
  103. lib/Inx/Api/Inbox/InboxMessage.php +268 -0
  104. lib/Inx/Api/IndexOutOfBoundsException.php +29 -0
  105. lib/Inx/Api/IndexSelection.php +100 -0
  106. lib/Inx/Api/InputStream.php +16 -0
  107. lib/Inx/Api/List/AdminListContext.php +25 -0
  108. lib/Inx/Api/List/FilterListContext.php +59 -0
  109. lib/Inx/Api/List/ListContext.php +166 -0
  110. lib/Inx/Api/List/ListContextManager.php +77 -0
  111. lib/Inx/Api/List/ListSize.php +29 -0
  112. lib/Inx/Api/List/StandardListContext.php +27 -0
  113. lib/Inx/Api/List/SystemListContext.php +27 -0
  114. lib/Inx/Api/LockException.php +43 -0
  115. lib/Inx/Api/LockTicket.php +105 -0
  116. lib/Inx/Api/LoginException.php +56 -0
  117. lib/Inx/Api/Mail/Attachment.php +57 -0
  118. lib/Inx/Api/Mail/BuildException.php +63 -0
  119. lib/Inx/Api/Mail/HeaderField.php +75 -0
  120. lib/Inx/Api/Mail/MailContent.php +161 -0
  121. lib/Inx/Api/Mail/MailingRenderer.php +134 -0
  122. lib/Inx/Api/Mail/ParseException.php +57 -0
  123. lib/Inx/Api/Mail/RenderError.php +142 -0
  124. lib/Inx/Api/Mailing/ContentHandler.php +23 -0
  125. lib/Inx/Api/Mailing/HtmlTextContentHandler.php +19 -0
  126. lib/Inx/Api/Mailing/Mailing.php +689 -0
  127. lib/Inx/Api/Mailing/MailingConstants.php +64 -0
  128. lib/Inx/Api/Mailing/MailingManager.php +238 -0
  129. lib/Inx/Api/Mailing/MailingStateException.php +61 -0
  130. lib/Inx/Api/Mailing/MultiPartContentHandler.php +47 -0
  131. lib/Inx/Api/Mailing/PlainTextContentHandler.php +17 -0
  132. lib/Inx/Api/Mailing/SendException.php +17 -0
  133. lib/Inx/Api/Mailing/SendingInfo.php +56 -0
  134. lib/Inx/Api/Mailing/SinglePartContentHandler.php +33 -0
  135. lib/Inx/Api/Mailing/XsltContentHandler.php +48 -0
  136. lib/Inx/Api/Mailing/XsltHtmlTextContentHandler.php +35 -0
  137. lib/Inx/Api/Mailing/XsltMultiPartContentHandler.php +45 -0
  138. lib/Inx/Api/Mailing/XsltPlainTextContentHandler.php +34 -0
  139. lib/Inx/Api/MailingTemplate/MailingTemplate.php +130 -0
  140. lib/Inx/Api/MailingTemplate/MailingTemplateManager.php +96 -0
  141. lib/Inx/Api/NameException.php +20 -0
  142. lib/Inx/Api/NullPointerException.php +12 -0
  143. lib/Inx/Api/Order.php +19 -0
  144. lib/Inx/Api/Plugin/PluginStore.php +99 -0
  145. lib/Inx/Api/PluginStatusService.php +110 -0
  146. lib/Inx/Api/Property/ApprovalPropertyValue.php +141 -0
  147. lib/Inx/Api/Property/FormatChoicePropertyFormatter.php +467 -0
  148. lib/Inx/Api/Property/Property.php +126 -0
  149. lib/Inx/Api/Property/PropertyFormatter.php +77 -0
  150. lib/Inx/Api/Property/PropertyNames.php +240 -0
  151. lib/Inx/Api/Recipient/Attribute.php +266 -0
  152. lib/Inx/Api/Recipient/AttributeManager.php +159 -0
  153. lib/Inx/Api/Recipient/AttributeNotFoundException.php +17 -0
  154. lib/Inx/Api/Recipient/BatchChannel.php +267 -0
  155. lib/Inx/Api/Recipient/BlackListException.php +17 -0
  156. lib/Inx/Api/Recipient/DuplicateKeyException.php +18 -0
  157. lib/Inx/Api/Recipient/IllegalValueException.php +20 -0
  158. lib/Inx/Api/Recipient/RecipientContext.php +365 -0
  159. lib/Inx/Api/Recipient/RecipientMetaData.php +120 -0
  160. lib/Inx/Api/Recipient/RecipientRowSet.php +487 -0
  161. lib/Inx/Api/Recipient/SelectException.php +20 -0
  162. lib/Inx/Api/Recipient/UnsubscriptionRecipientRowSet.php +303 -0
  163. lib/Inx/Api/RemoteException.php +31 -0
  164. lib/Inx/Api/Reporting/ConfigDescriptor.php +106 -0
  165. lib/Inx/Api/Reporting/Control.php +129 -0
  166. lib/Inx/Api/Reporting/ControlUnit.php +50 -0
  167. lib/Inx/Api/Reporting/DownloadableResult.php +108 -0
  168. lib/Inx/Api/Reporting/ReportEngine.php +129 -0
  169. lib/Inx/Api/Reporting/ReportException.php +19 -0
  170. lib/Inx/Api/Reporting/ReportRequest.php +237 -0
  171. lib/Inx/Api/Reporting/ReportTicket.php +91 -0
  172. lib/Inx/Api/Resource/Resource.php +196 -0
  173. lib/Inx/Api/Resource/ResourceManager.php +118 -0
  174. lib/Inx/Api/SecurityException.php +11 -0
  175. lib/Inx/Api/ServerTime.php +47 -0
  176. lib/Inx/Api/Session.php +480 -0
  177. lib/Inx/Api/Subscription/SubscriptionLogEntryRowSet.php +547 -0
  178. lib/Inx/Api/Subscription/SubscriptionManager.php +349 -0
  179. lib/Inx/Api/Testprofiles/TestRecipientContext.php +146 -0
  180. lib/Inx/Api/Testprofiles/TestRecipientRowSet.php +524 -0
  181. lib/Inx/Api/TextModule/TextModule.php +156 -0
  182. lib/Inx/Api/TextModule/TextModuleManager.php +89 -0
  183. lib/Inx/Api/TriggerMail/Attachment.php +55 -0
  184. lib/Inx/Api/TriggerMail/BuildException.php +61 -0
  185. lib/Inx/Api/TriggerMail/BuildMode.php +136 -0
  186. lib/Inx/Api/TriggerMail/ParseException.php +57 -0
  187. lib/Inx/Api/TriggerMail/RenderError.php +144 -0
  188. lib/Inx/Api/TriggerMail/TriggerMailContent.php +138 -0
  189. lib/Inx/Api/TriggerMail/TriggerMailingConstants.php +25 -0
  190. lib/Inx/Api/TriggerMail/TriggerMailingContentType.php +168 -0
  191. lib/Inx/Api/TriggerMail/TriggerMailingExceptionType.php +140 -0
  192. lib/Inx/Api/TriggerMail/TriggerMailingRenderer.php +285 -0
  193. lib/Inx/Api/TriggerMailing/Descriptor/ActionTriggerDescriptorBuilder.php +23 -0
  194. lib/Inx/Api/TriggerMailing/Descriptor/AnniversaryTriggerDescriptorBuilder.php +100 -0
  195. lib/Inx/Api/TriggerMailing/Descriptor/AttributeTriggerDescriptorBuilder.php +109 -0
  196. lib/Inx/Api/TriggerMailing/Descriptor/DailyTriggerIntervalBuilder.php +26 -0
  197. lib/Inx/Api/TriggerMailing/Descriptor/HourlyTriggerIntervalBuilder.php +26 -0
  198. lib/Inx/Api/TriggerMailing/Descriptor/IntervalTriggerDescriptorBuilder.php +86 -0
  199. lib/Inx/Api/TriggerMailing/Descriptor/MonthlyTriggerIntervalBuilder.php +86 -0
  200. lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerDescriptorBuilder.php +92 -0
  201. lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerDispatchInterval.php +284 -0
  202. lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerOffset.php +133 -0
  203. lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerOffsetType.php +119 -0
  204. lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerUnit.php +199 -0
  205. lib/Inx/Api/TriggerMailing/Descriptor/TriggerDescriptor.php +137 -0
  206. lib/Inx/Api/TriggerMailing/Descriptor/TriggerDescriptorBuilder.php +41 -0
  207. lib/Inx/Api/TriggerMailing/Descriptor/TriggerDescriptorBuilderFactory.php +71 -0
  208. lib/Inx/Api/TriggerMailing/Descriptor/TriggerInterval.php +83 -0
  209. lib/Inx/Api/TriggerMailing/Descriptor/TriggerIntervalBuilder.php +49 -0
  210. lib/Inx/Api/TriggerMailing/Descriptor/TriggerIntervalBuilderFactory.php +53 -0
  211. lib/Inx/Api/TriggerMailing/Descriptor/TriggerType.php +253 -0
  212. lib/Inx/Api/TriggerMailing/Descriptor/WeeklyTriggerIntervalBuilder.php +68 -0
  213. lib/Inx/Api/TriggerMailing/FilterConcatenationType.php +148 -0
  214. lib/Inx/Api/TriggerMailing/SendException.php +16 -0
  215. lib/Inx/Api/TriggerMailing/StateFilter.php +79 -0
  216. lib/Inx/Api/TriggerMailing/TriggerMailing.php +623 -0
  217. lib/Inx/Api/TriggerMailing/TriggerMailingAttribute.php +476 -0
  218. lib/Inx/Api/TriggerMailing/TriggerMailingManager.php +259 -0
app/code/community/DndInxmail/.DS_Store ADDED
Binary file
app/code/community/DndInxmail/Subscriber/.DS_Store ADDED
Binary file
app/code/community/DndInxmail/Subscriber/Block/Adminhtml/Newsletter/Subscriber/Grid.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Block
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Block_Adminhtml_Newsletter_Subscriber_Grid extends Mage_Adminhtml_Block_Newsletter_Subscriber_Grid
13
+ {
14
+
15
+ /**
16
+ * @return $this
17
+ */
18
+ protected function _prepareColumns()
19
+ {
20
+ $this->addColumn('subscriber_id', array(
21
+ 'header' => Mage::helper('newsletter')->__('ID'),
22
+ 'index' => 'subscriber_id'
23
+ ));
24
+
25
+ $this->addColumn('email', array(
26
+ 'header' => Mage::helper('newsletter')->__('Email'),
27
+ 'index' => 'subscriber_email'
28
+ ));
29
+
30
+ $this->addColumn('email_bounced', array(
31
+ 'header' => Mage::helper('newsletter')->__('Email Bounced'),
32
+ 'index' => 'email_bounced',
33
+ 'type' => 'options',
34
+ 'options' => array(
35
+ 0 => Mage::helper('dndinxmail_subscriber')->__('No'),
36
+ 1 => Mage::helper('dndinxmail_subscriber')->__('Yes')
37
+ ),
38
+ 'frame_callback' => array(
39
+ $this,
40
+ 'decorateEmailBounced'
41
+ )
42
+ ));
43
+
44
+ $this->addColumn('type', array(
45
+ 'header' => Mage::helper('newsletter')->__('Type'),
46
+ 'index' => 'type',
47
+ 'type' => 'options',
48
+ 'options' => array(
49
+ 1 => Mage::helper('newsletter')->__('Guest'),
50
+ 2 => Mage::helper('newsletter')->__('Customer')
51
+ )
52
+ ));
53
+
54
+ $this->addColumn('firstname', array(
55
+ 'header' => Mage::helper('newsletter')->__('Customer First Name'),
56
+ 'index' => 'customer_firstname',
57
+ 'default' => '----'
58
+ ));
59
+
60
+ $this->addColumn('lastname', array(
61
+ 'header' => Mage::helper('newsletter')->__('Customer Last Name'),
62
+ 'index' => 'customer_lastname',
63
+ 'default' => '----'
64
+ ));
65
+
66
+ $this->addColumn('status', array(
67
+ 'header' => Mage::helper('newsletter')->__('Status'),
68
+ 'index' => 'subscriber_status',
69
+ 'type' => 'options',
70
+ 'options' => array(
71
+ Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE => Mage::helper('newsletter')->__('Not Activated'),
72
+ Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED => Mage::helper('newsletter')->__('Subscribed'),
73
+ Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED => Mage::helper('newsletter')->__('Unsubscribed'),
74
+ Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED => Mage::helper('newsletter')->__('Unconfirmed'),
75
+ )
76
+ ));
77
+
78
+ $this->addColumn('website', array(
79
+ 'header' => Mage::helper('newsletter')->__('Website'),
80
+ 'index' => 'website_id',
81
+ 'type' => 'options',
82
+ 'options' => $this->_getWebsiteOptions()
83
+ ));
84
+
85
+ $this->addColumn('group', array(
86
+ 'header' => Mage::helper('newsletter')->__('Store'),
87
+ 'index' => 'group_id',
88
+ 'type' => 'options',
89
+ 'options' => $this->_getStoreGroupOptions()
90
+ ));
91
+
92
+ $this->addColumn('store', array(
93
+ 'header' => Mage::helper('newsletter')->__('Store View'),
94
+ 'index' => 'store_id',
95
+ 'type' => 'options',
96
+ 'options' => $this->_getStoreOptions()
97
+ ));
98
+
99
+ $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
100
+ $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
101
+
102
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
103
+ }
104
+
105
+ /**
106
+ * @param $value
107
+ * @param $row
108
+ * @param $column
109
+ * @param $isExport
110
+ *
111
+ * @return string
112
+ */
113
+ public function decorateEmailBounced($value, $row, $column, $isExport)
114
+ {
115
+ if($row->getEmailBounced()) {
116
+ $cell = '<span class="grid-severity-notice"><span>' . Mage::helper('dndinxmail_subscriber')->__('Yes') . '</span></span>';
117
+ }
118
+ else {
119
+ $cell = '<span class="grid-severity-minor"><span>' . Mage::helper('dndinxmail_subscriber')->__('No') . '</span></span>';
120
+ }
121
+
122
+ return $cell;
123
+ }
124
+
125
+ }
app/code/community/DndInxmail/Subscriber/Block/Adminhtml/System/Config/Date.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Block
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
13
+ {
14
+
15
+ /**
16
+ * @param Varien_Data_Form_Element_Abstract $element
17
+ *
18
+ * @return string
19
+ */
20
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
21
+ {
22
+ $date = new Varien_Data_Form_Element_Date;
23
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
24
+
25
+ $data = array(
26
+ 'name' => $element->getName(),
27
+ 'html_id' => $element->getId(),
28
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
29
+ );
30
+ $date->setData($data);
31
+ $date->setValue($element->getValue(), $format);
32
+ $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
33
+ $date->setForm($element->getForm());
34
+
35
+ return $date->getElementHtml();
36
+ }
37
+
38
+ }
app/code/community/DndInxmail/Subscriber/Block/Adminhtml/System/Config/Form/Button/Groups.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Block
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 18/02/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Block_Adminhtml_System_Config_Form_Button_Groups extends Mage_Adminhtml_Block_System_Config_Form_Field
13
+ {
14
+
15
+ /**
16
+ * Set template
17
+ *
18
+ * @return void
19
+ */
20
+ protected function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->setTemplate('dndinxmail/subscriber/system/config/form/button/groups.phtml');
24
+ }
25
+
26
+ /**
27
+ * Return element html
28
+ *
29
+ * @param Varien_Data_Form_Element_Abstract $element
30
+ *
31
+ * @return string
32
+ */
33
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
34
+ {
35
+ return $this->_toHtml();
36
+ }
37
+
38
+ /**
39
+ * Return ajax url for button
40
+ *
41
+ * @return string
42
+ */
43
+ public function getCheckUrl()
44
+ {
45
+ return Mage::helper('adminhtml')->getUrl('adminhtml/synchronize/groups');
46
+ }
47
+
48
+ /**
49
+ * Generate button html
50
+ *
51
+ * @return string
52
+ */
53
+ public function getButtonHtml()
54
+ {
55
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
56
+ 'id' => 'dndinxmail_subscriber_button',
57
+ 'label' => $this->helper('adminhtml')->__('Synchronize now'),
58
+ 'onclick' => 'javascript:DndInxmailSynchronizeGroups(); return false;'
59
+ ));
60
+
61
+ return $button->toHtml();
62
+ }
63
+
64
+ }
app/code/community/DndInxmail/Subscriber/Block/Adminhtml/System/Config/Form/Button/Subscribers.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Block
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 18/02/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Block_Adminhtml_System_Config_Form_Button_Subscribers extends Mage_Adminhtml_Block_System_Config_Form_Field
13
+ {
14
+
15
+ /**
16
+ * Set template
17
+ *
18
+ * @return void
19
+ */
20
+ protected function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->setTemplate('dndinxmail/subscriber/system/config/form/button/subscribers.phtml');
24
+ }
25
+
26
+ /**
27
+ * Return element html
28
+ *
29
+ * @param Varien_Data_Form_Element_Abstract $element
30
+ *
31
+ * @return string
32
+ */
33
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
34
+ {
35
+ return $this->_toHtml();
36
+ }
37
+
38
+ /**
39
+ * Return ajax url for button
40
+ *
41
+ * @return string
42
+ */
43
+ public function getCheckUrl()
44
+ {
45
+ $store = Mage::app()->getRequest()->getParam('store');
46
+
47
+ return Mage::helper('adminhtml')->getUrl('adminhtml/synchronize/subscribers', array('store' => $store));
48
+ }
49
+
50
+ /**
51
+ * Generate button html
52
+ *
53
+ * @return string
54
+ */
55
+ public function getButtonHtml()
56
+ {
57
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
58
+ 'id' => 'dndinxmail_subscriber_button',
59
+ 'label' => $this->helper('adminhtml')->__('Synchronize now'),
60
+ 'onclick' => 'javascript:DndInxmailSynchronizeSubscribers(); return false;'
61
+ ));
62
+
63
+ return $button->toHtml();
64
+ }
65
+
66
+ }
app/code/community/DndInxmail/Subscriber/Block/Synchronization/Groups.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Block_Synchronization_Groups extends Mage_Core_Block_Template
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ public function __construct()
19
+ {
20
+ parent::__construct();
21
+ $this->setTemplate('dndinxmail/synchronization/groups.phtml');
22
+ }
23
+
24
+ /**
25
+ * @return Mage_Core_Block_Abstract
26
+ */
27
+ protected function _prepareLayout()
28
+ {
29
+ return parent::_prepareLayout();
30
+ }
31
+
32
+ /**
33
+ * @return mixed
34
+ */
35
+ public function getAllPass()
36
+ {
37
+ return $this->getPass();
38
+ }
39
+
40
+ }
app/code/community/DndInxmail/Subscriber/Block/Synchronization/Subscribers.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Block_Synchronization_Subscribers extends Mage_Core_Block_Template
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ public function __construct()
19
+ {
20
+ parent::__construct();
21
+ $this->setTemplate('dndinxmail/synchronization/subscribers.phtml');
22
+ }
23
+
24
+ /**
25
+ * @return Mage_Core_Block_Abstract
26
+ */
27
+ protected function _prepareLayout()
28
+ {
29
+ return parent::_prepareLayout();
30
+ }
31
+
32
+ /**
33
+ * @return mixed
34
+ */
35
+ public function getAllPass()
36
+ {
37
+ return $this->getPass();
38
+ }
39
+
40
+ /**
41
+ * @return mixed
42
+ */
43
+ public function getStoreToSynchronize()
44
+ {
45
+ return $this->getStoreSynchronize();
46
+ }
47
+
48
+ }
app/code/community/DndInxmail/Subscriber/Helper/Abstract.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Abstract extends Mage_Core_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ * Get Magento store configuration
17
+ *
18
+ * @param string $path XML configuration path
19
+ * @param string $store Store ID of configuration. If not set then current store ID
20
+ *
21
+ * @return string Magento configuration
22
+ */
23
+ public function getConfig($path, $store = null)
24
+ {
25
+ $store = ($store == null) ? Mage::app()->getStore()->getId() : $store;
26
+
27
+ return Mage::getStoreConfig($path, $store);
28
+ }
29
+
30
+ /**
31
+ * Create directory if not exist
32
+ *
33
+ * @param string $dir Directory path
34
+ *
35
+ * @return boolean
36
+ */
37
+ public function createDirIfNotExists($dir)
38
+ {
39
+ if(file_exists($dir)) {
40
+ if(!is_dir($dir)) {
41
+ return false;
42
+ }
43
+ if(!is_dir_writeable($dir)) {
44
+ return false;
45
+ }
46
+ }
47
+ else {
48
+ $oldUmask = umask(0);
49
+ if(!@mkdir($dir, 0777, true)) {
50
+ return false;
51
+ }
52
+ umask($oldUmask);
53
+ }
54
+
55
+ return true;
56
+ }
57
+
58
+ }
app/code/community/DndInxmail/Subscriber/Helper/Data.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Data extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ * Check if DndInxmail_Subscriber is enabled
17
+ *
18
+ * @return boolean
19
+ */
20
+ public function isDndInxmailEnabled()
21
+ {
22
+ if($this->getConfig('dndinxmail_subscriber_general/general/active') == 0) {
23
+ return false;
24
+ }
25
+ else {
26
+
27
+ $valid = true;
28
+
29
+ if($this->getConfig(DndInxmail_Subscriber_Helper_Synchronize::DNDINXMAIL_API_URL) == '') {
30
+ Mage::getSingleton('adminhtml/session')->addError('Inxmail Configuration Error: URL field is empty');
31
+ $valid = false;
32
+ }
33
+
34
+ if($this->getConfig(DndInxmail_Subscriber_Helper_Synchronize::DNDINXMAIL_API_USER) == '') {
35
+ Mage::getSingleton('adminhtml/session')->addError('Inxmail Configuration Error: API User field is empty');
36
+ $valid = false;
37
+ }
38
+
39
+ if($this->getConfig(DndInxmail_Subscriber_Helper_Synchronize::DNDINXMAIL_API_PASSWORD) == '') {
40
+ Mage::getSingleton('adminhtml/session')->addError('Inxmail Configuration Error: API Password field is empty');
41
+ $valid = false;
42
+ }
43
+
44
+ return $valid;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Get Magento encryption key
50
+ *
51
+ * @return string
52
+ */
53
+ public function getHashKey()
54
+ {
55
+ return (string)Mage::getConfig()->getNode('global/crypt/key');
56
+ }
57
+
58
+ /**
59
+ * Check if data is Magento encryption key
60
+ *
61
+ * @param string $hashKey Data to check
62
+ *
63
+ * @return boolean
64
+ */
65
+ public function isHashKeyAllowed($hashKey)
66
+ {
67
+ return ($hashKey == $this->getHashKey()) ? true : false;
68
+ }
69
+
70
+ }
app/code/community/DndInxmail/Subscriber/Helper/Error.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Error extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const DNDINXMAIL_IS_SILENT_ERROR_KEY = 'isSilentError'; // Register key for silent errors
19
+
20
+ /**
21
+ * Set if is silent error or not
22
+ *
23
+ * @param string $error True if silent error false if not
24
+ *
25
+ * @return void
26
+ */
27
+ public function setIsSilentError($error = false)
28
+ {
29
+ $value = ($error == true) ? true : false;
30
+ Mage::register(self::DNDINXMAIL_IS_SILENT_ERROR_KEY, $value, true);
31
+ }
32
+
33
+ /**
34
+ * Blocks the error message in the backoffice when trying to connect the Inxmail API
35
+ *
36
+ * @return boolean
37
+ */
38
+ public function getIsSilentError()
39
+ {
40
+ return (Mage::registry(self::DNDINXMAIL_IS_SILENT_ERROR_KEY) != null && Mage::registry(self::DNDINXMAIL_IS_SILENT_ERROR_KEY) == true) ? true : false;
41
+ }
42
+
43
+ }
app/code/community/DndInxmail/Subscriber/Helper/Group.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Group extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const DNDINXMAIL_INXMAIL_LIST_CUTOMER_GROUP_PREFIX = "Magento Customer Group "; // Inxamil list prefix
19
+ /**
20
+ *
21
+ */
22
+ const DNDINXMAIL_INXMAIL_LIST_CUTOMER_SEGMENT_PREFIX = "Magento Customer Segment "; // Inxamil list prefix Magento EE Version Only
23
+ /**
24
+ *
25
+ */
26
+ const DNDINXMAIL_INXMAIL_LIST_CUTOMER_GROUP_SPECIFIC_LIIT = 10; // Default limit
27
+
28
+ /**
29
+ * Get customer group to synchronize
30
+ *
31
+ * @return string ID separated by commas
32
+ */
33
+ public function getCustomerGroupsConfig()
34
+ {
35
+ $groups = Mage::getStoreConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_group');
36
+
37
+ return $this->formatCustomerGroups($groups);
38
+ }
39
+
40
+ /**
41
+ * Get array of groups
42
+ *
43
+ * @param string $groups
44
+ *
45
+ * @return array
46
+ */
47
+ public function formatCustomerGroups($groups)
48
+ {
49
+ return array_filter(explode(',', $groups));
50
+ }
51
+
52
+ /**
53
+ * Get Magento customer group name
54
+ *
55
+ * @param int $groupId Magento group ID
56
+ *
57
+ * @return string
58
+ */
59
+ public function getGroupName($groupId)
60
+ {
61
+ $resource = Mage::getSingleton('core/resource');
62
+ $read = $resource->getConnection('core_read');
63
+ $customerGroup = $resource->getTableName('customer/customer_group');
64
+ $query = "SELECT `$customerGroup`.`customer_group_code` as `group_name` FROM `$customerGroup` WHERE `$customerGroup`.`customer_group_id` = $groupId";
65
+
66
+ try {
67
+ if(!$result = $read->query($query)) return false;
68
+ if(!$groupName = $result->fetch()) return false;
69
+
70
+ return (isset($groupName['group_name'])) ? $groupName['group_name'] : false;;
71
+ }
72
+ catch(Exception $e) {
73
+ return false;
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Format Magento Group ID to Inxmail list name
79
+ *
80
+ * @param int $groupId Magento group ID
81
+ *
82
+ * @return string Inxmail list name
83
+ */
84
+ public function formatInxmailListName($groupId)
85
+ {
86
+ $name = $this->getGroupName($groupId);
87
+
88
+ return ($name) ? self::DNDINXMAIL_INXMAIL_LIST_CUTOMER_GROUP_PREFIX . $name : self::DNDINXMAIL_INXMAIL_LIST_CUTOMER_GROUP_PREFIX . $groupId;
89
+ }
90
+
91
+ /**
92
+ * Check if Date Of Birth is enabled in Magento configuration
93
+ *
94
+ * @return boolean
95
+ */
96
+ public function isDobEnabled()
97
+ {
98
+ return (bool)Mage::getSingleton('eav/config')->getAttribute('customer', 'dob')->getIsVisible();
99
+ }
100
+
101
+ /**
102
+ * @param null $day
103
+ *
104
+ * @return array
105
+ */
106
+ public function getDayRangeFromToday($day = null)
107
+ {
108
+ $day = ($day == null || $day <= 0 || $day == '') ? 30 : $day;
109
+ $from = new Zend_Date();
110
+ $to = new Zend_Date();
111
+ $to = $to->add(1, Zend_Date::DAY)->get("YYYY-MM-dd");
112
+ $from = $from->sub($day, Zend_Date::DAY)->get("YYYY-MM-dd");
113
+
114
+ return array(
115
+ 'from' => $from,
116
+ 'to' => $to
117
+ );
118
+ }
119
+
120
+ /**
121
+ * @param $from
122
+ * @param $to
123
+ *
124
+ * @return array
125
+ */
126
+ public function getDayRange($from, $to)
127
+ {
128
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
129
+ $locale = Mage::app()->getLocale()->getLocale();
130
+ $from = new Zend_Date($from, $format, $locale);
131
+ $to = new Zend_Date($to, $format, $locale);
132
+ $to = $to->get("YYYY-MM-dd");
133
+ $from = $from->get("YYYY-MM-dd");
134
+
135
+ return array(
136
+ 'from' => $from,
137
+ 'to' => $to
138
+ );
139
+ }
140
+
141
+ /**
142
+ * Get customer from Magento group
143
+ *
144
+ * @param int $groupId Magento group ID
145
+ *
146
+ * @return array Array with customer email
147
+ */
148
+ public function getCustomersFromGroup($groupId)
149
+ {
150
+ $resource = Mage::getSingleton('core/resource');
151
+ $read = $resource->getConnection('core_read');
152
+ $configLimit = Mage::getStoreConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_limit_specific_groups');
153
+ $limit = ($configLimit != '' && $configLimit != null) ? $configLimit : self::DNDINXMAIL_INXMAIL_LIST_CUTOMER_GROUP_SPECIFIC_LIIT;
154
+ $query = false;
155
+ $isDynamicQuery = false;
156
+ $customers = array();
157
+
158
+ switch($groupId) {
159
+
160
+ case DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group_Specific::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_LAST:
161
+ $config = $this->getConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_config_last_customers');
162
+ $range = $this->getDayRangeFromToday($config);
163
+ if(!isset($range['from']) || !isset($range['to'])) return false;
164
+ $from = $range['from'];
165
+ $to = $range['to'];
166
+ $customerTable = $resource->getTableName('customer/entity');
167
+ $query = "SELECT `$customerTable`.`email` FROM `$customerTable` WHERE (created_at >= '$from' AND created_at <= '$to') ORDER BY `$customerTable`.`created_at`";
168
+ break;
169
+
170
+ case DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group_Specific::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_BEST:
171
+ $config = $this->getConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_config_best_customers');
172
+ $limitAmount = ($config == null || $config <= 0 || $config == '') ? 1000 : $config;
173
+ $orderTable = $resource->getTableName('sales/order');
174
+ $customerTable = $resource->getTableName('customer/entity');
175
+ $query = "SELECT `customer_table`.`email`, SUM((main_table.base_subtotal -
176
+ IFNULL(main_table.base_subtotal_refunded, 0) - IFNULL(main_table.base_subtotal_canceled, 0) - ABS(main_table.base_discount_amount) -
177
+ IFNULL(main_table.base_discount_canceled, 0)) * main_table.base_to_global_rate) AS `orders_sum_amount` FROM `$orderTable` AS `main_table`
178
+ LEFT JOIN `$customerTable` AS `customer_table` ON main_table.customer_id = customer_table.entity_id
179
+ WHERE (main_table.customer_id IS NOT NULL) AND (state != 'canceled')
180
+ GROUP BY `main_table`.`customer_id`
181
+ HAVING `orders_sum_amount` >= $limitAmount
182
+ ORDER BY `orders_sum_amount` DESC";
183
+ break;
184
+
185
+ case DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group_Specific::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_BIRTHDAY:
186
+ $isDynamicQuery = true;
187
+ $customers = Mage::getModel('customer/customer')->getCollection()->addAttributeToFilter('dob', array('like' => '%-' . date('m-d') . ' %'))->load();
188
+ break;
189
+
190
+ case DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group_Specific::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ABANDONNED_CARTS:
191
+ $config = $this->getConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_config_abandonned_carts');
192
+ $range = $this->getDayRangeFromToday($config);
193
+ if(!isset($range['from']) || !isset($range['to'])) return false;
194
+ $from = $range['from'];
195
+ $to = $range['to'];
196
+ $isDynamicQuery = true;
197
+ $customers = Mage::getResourceModel('reports/quote_collection')->addFieldToFilter('items_count', array('neq' => '0'))->addFieldToFilter('main_table.is_active', '1')->addFieldToFilter('main_table.created_at', array(
198
+ 'from' => $from,
199
+ 'to' => $to
200
+ ))->addCustomerData()->setOrder('updated_at');
201
+ break;
202
+
203
+ case DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group_Specific::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ORDERS:
204
+
205
+ $type = $this->getConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_config_orders_options');
206
+
207
+ if($type == DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Orders::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ORDERS_SINGLE_DATE) {
208
+ $config = $this->getConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_config_orders_options_single_date');
209
+ $range = $this->getDayRangeFromToday($config);
210
+ if(!isset($range['from']) || !isset($range['to'])) return false;
211
+ $from = $range['from'];
212
+ $to = $range['to'];
213
+ }
214
+ else {
215
+ $configFrom = $this->getConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_config_orders_options_date_range_from');
216
+ $configTo = $this->getConfig('dndinxmail_subscriber_mapping/mapping_groups/customer_config_orders_options_date_range_to');
217
+ $range = $this->getDayRange($configFrom, $configTo);
218
+ if(!isset($range['from']) || !isset($range['to'])) return false;
219
+ $from = $range['from'];
220
+ $to = $range['to'];
221
+ }
222
+
223
+ $orderTable = $resource->getTableName('sales/order');
224
+ $query = "SELECT `main_table`.`customer_email` as `email` FROM `$orderTable` AS `main_table` WHERE (created_at >= '$from' AND created_at <= '$to')";
225
+ break;
226
+
227
+ default:
228
+ $customerTable = $resource->getTableName('customer/entity');
229
+ $query = "SELECT `$customerTable`.`email` FROM `$customerTable` WHERE `group_id` = $groupId";
230
+ break;
231
+
232
+ }
233
+
234
+ if(!$isDynamicQuery) {
235
+ if(!$query) return false;
236
+ if(!$result = $read->query($query)) return false;
237
+ if(!$customers = $result->fetchAll()) return false;
238
+ }
239
+ else {
240
+ if(count($customers) <= 0) return false;
241
+ }
242
+
243
+ $emails = array();
244
+
245
+ foreach($customers as $customer) {
246
+ $email = (isset($customer['email'])) ? $customer['email'] : false;
247
+ if(!$email) continue;
248
+ $emails[] = $email;
249
+ }
250
+
251
+ return (count($emails) > 0) ? $emails : false;
252
+ }
253
+
254
+ }
app/code/community/DndInxmail/Subscriber/Helper/Log.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Log extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const DNDINXMAIL_LOG_FOLDER = 'dndinxmail'; // DndInxmail log folder name
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ protected $_logFilename = 'dndinxmail.log'; // DndInxmail log file name
24
+ /**
25
+ * @var string
26
+ */
27
+ protected $_logExceptionFilename = 'dndinxmail_exception.log'; // DndInxmail log file name
28
+
29
+ /**
30
+ * Log data from Inxmail
31
+ *
32
+ * @param string $message Message to log
33
+ * @param string $methodName
34
+ *
35
+ * @return void
36
+ */
37
+ public function logData($message, $methodName = null)
38
+ {
39
+ $this->_checkLogDir();
40
+ $file = ($methodName == null) ? $this->_logFilename : $methodName . '.log';
41
+ Mage::log($message, null, self::DNDINXMAIL_LOG_FOLDER . DS . $file);
42
+ }
43
+
44
+ /**
45
+ * Log exception data from Inxmail
46
+ *
47
+ * @param string $message Message to log
48
+ * @param string $methodName
49
+ *
50
+ * @return void
51
+ */
52
+ public function logExceptionData($exception, $methodName = null)
53
+ {
54
+ $this->_checkLogDir();
55
+ $exceptionNumber = $this->_getRandomExceptionNumber();
56
+
57
+ $file = ($methodName == null) ? $this->_logFilename : strtolower($methodName) . '.log';
58
+ $fileException = ($methodName == null) ? $this->_logExceptionFilename : strtolower($methodName) . '_exception.log';
59
+
60
+ Mage::log('## EXCEPTION ' . $exceptionNumber . ' ##', null, self::DNDINXMAIL_LOG_FOLDER . DS . $file);
61
+ Mage::log('## EXCEPTION ' . $exceptionNumber . ' ##', null, self::DNDINXMAIL_LOG_FOLDER . DS . $fileException);
62
+ Mage::log($exception, null, self::DNDINXMAIL_LOG_FOLDER . DS . $fileException);
63
+ Mage::log('## / EXCEPTION ' . $exceptionNumber . ' ##', null, self::DNDINXMAIL_LOG_FOLDER . DS . $fileException);
64
+ }
65
+
66
+ /**
67
+ * Get a random number for exception
68
+ *
69
+ * @return int Random number
70
+ */
71
+ private function _getRandomExceptionNumber()
72
+ {
73
+ return substr(number_format(time() * rand(), 0, '', ''), 0, 10);
74
+ }
75
+
76
+ /**
77
+ * Check if the log folder exist then create it
78
+ *
79
+ * @return void
80
+ */
81
+ protected function _checkLogDir()
82
+ {
83
+ $path = $this->_getLogFolderPath();
84
+ $this->createDirIfNotExists($path);
85
+ }
86
+
87
+ /**
88
+ * Get the Inxmail log folder path
89
+ *
90
+ * @return string Return Inxmail log folder path
91
+ */
92
+ protected function _getLogFolderPath()
93
+ {
94
+ return Mage::getBaseDir('log') . DS . self::DNDINXMAIL_LOG_FOLDER . DS;
95
+ }
96
+
97
+ }
app/code/community/DndInxmail/Subscriber/Helper/Mapping.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Mapping extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ * @var null
17
+ */
18
+ protected $_mapping = null; // Mapping object
19
+
20
+ // Fields for customer attributes
21
+ /**
22
+ * @var array
23
+ */
24
+ protected $_customerAttributes = array(
25
+ 'entity_id',
26
+ 'website_id',
27
+ 'group_id',
28
+ 'store_id',
29
+ 'created_at',
30
+ 'updated_at',
31
+ 'is_active',
32
+ 'prefix',
33
+ 'firstname',
34
+ 'lastname'
35
+ );
36
+
37
+ // Fields for dynamics attributes
38
+ /**
39
+ * @var array
40
+ */
41
+ protected $_dynamicAttributes = array(
42
+ 'first_order',
43
+ 'last_order',
44
+ 'total_orders',
45
+ 'avg_orders',
46
+ 'last_connection'
47
+ );
48
+
49
+ /**
50
+ * Get the mapping fields
51
+ *
52
+ * @return array Mapping fields with Magento attributeq in key and Inxmail attribute in value
53
+ */
54
+ public function getMappingFields()
55
+ {
56
+ if($this->_mapping == null) {
57
+
58
+ $mapping = array();
59
+ foreach($this->_customerAttributes as $cAttribute) {
60
+ $cValue = $this->getCustomerAttributeConfig($cAttribute);
61
+ if($cValue != '' && $cValue != null) $mapping[$cAttribute] = $cValue;
62
+ }
63
+ foreach($this->_dynamicAttributes as $dAttribute) {
64
+ $dValue = $this->getDynamicAttributeConfig($dAttribute);
65
+ if($dValue != '' && $dValue != null) $mapping[$dAttribute] = $dValue;
66
+ }
67
+
68
+ $this->_mapping = $mapping;
69
+
70
+ }
71
+
72
+ return $this->_mapping;
73
+ }
74
+
75
+ /**
76
+ * Check if attribute from mapping is dynamic
77
+ *
78
+ * @param string $attribute Attribute code
79
+ *
80
+ * @return boolean
81
+ */
82
+ public function isDynamicAttribute($attribute)
83
+ {
84
+ return (in_array($attribute, $this->_dynamicAttributes)) ? true : false;
85
+ }
86
+
87
+ /**
88
+ * Get customer attribute's Inxmail column from Magento configuration
89
+ *
90
+ * @param string $attribute Attribute key
91
+ *
92
+ * @return mixed Attribute value
93
+ */
94
+ public function getCustomerAttributeConfig($attribute)
95
+ {
96
+ return Mage::getStoreConfig('dndinxmail_subscriber_mapping/mapping_customer/' . $attribute);
97
+ }
98
+
99
+ /**
100
+ * Get dynamic attribute's Inxmail column from Magento configuration
101
+ *
102
+ * @param string $attribute Attribute key
103
+ *
104
+ * @return mixed Attribute value
105
+ */
106
+ public function getDynamicAttributeConfig($attribute)
107
+ {
108
+ return Mage::getStoreConfig('dndinxmail_subscriber_mapping/mapping_dynamics/' . $attribute);
109
+ }
110
+
111
+ }
app/code/community/DndInxmail/Subscriber/Helper/Synchronize.php ADDED
@@ -0,0 +1,966 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Synchronize extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+
16
+ /**
17
+ *
18
+ */
19
+ const DNDINXMAIL_API_URL = 'dndinxmail_subscriber_general/api/url'; // Inxmail API Url
20
+ /**
21
+ *
22
+ */
23
+ const DNDINXMAIL_API_USER = 'dndinxmail_subscriber_general/api/user'; // Inxmail API User
24
+ /**
25
+ *
26
+ */
27
+ const DNDINXMAIL_API_PASSWORD = 'dndinxmail_subscriber_general/api/password'; // Inxmail API Password
28
+
29
+ /**
30
+ *
31
+ */
32
+ const DNDINXMAIL_INXMAIL_LIST_ID = 'dndinxmail_subscriber_general/general/inxmail_list'; // Inxmail list ID
33
+
34
+ /**
35
+ *
36
+ */
37
+ const DNDINXMAIL_CUSTOMER_MAPPING_STATUS_CREATED = 'created'; // Customer mapping created status
38
+ /**
39
+ *
40
+ */
41
+ const DNDINXMAIL_CUSTOMER_MAPPING_STATUS_DELETED = 'deleted'; // Customer mapping deleted status
42
+
43
+ /**
44
+ * @var null
45
+ */
46
+ protected $_inxmailSession = null; // Inxmail session
47
+ /**
48
+ * @var null
49
+ */
50
+ protected $_listContextManager = null; // Inxmail ListContextManager
51
+ /**
52
+ * @var null
53
+ */
54
+ protected $_recipientContext = null; // Inxmail RecipientContext
55
+
56
+ /**
57
+ * @var array
58
+ */
59
+ protected $_dynamicAttributes = array(); // Mapping dynamic attributes
60
+
61
+ /**
62
+ * @var null
63
+ */
64
+ protected $_customerCollection = null; // Customer collection for dynamic attributes
65
+
66
+ /**
67
+ * Open an Inxmail session
68
+ *
69
+ * @return mixed Inxmail session or false
70
+ */
71
+ public function openInxmailSession()
72
+ {
73
+ if(!$this->isInxmailSession()) {
74
+
75
+ $url = $this->getConfig(self::DNDINXMAIL_API_URL);
76
+ $user = $this->getConfig(self::DNDINXMAIL_API_USER);
77
+ $pass = $this->getConfig(self::DNDINXMAIL_API_PASSWORD);
78
+
79
+ try {
80
+ Inx_Apiimpl_Loader::registerAutoload();
81
+
82
+ $this->_inxmailSession = Inx_Api_Session::createRemoteSession($url, $user, $pass);
83
+ }
84
+ catch(Inx_Api_LoginException $e) {
85
+ if(!Mage::helper('dndinxmail_subscriber/error')->getIsSilentError()) {
86
+ $message = Mage::helper('dndinxmail_subscriber/log')->__('Inxmail API Error: %s', $e->getMessage());
87
+ Mage::getSingleton('adminhtml/session')->addError($message);
88
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getTraceAsString(), __FUNCTION__);
89
+ Mage::helper('dndinxmail_subscriber/log')->logData('## URL: ' . $url . ' || USER: ' . $user . ' || PASS: ' . $pass, __FUNCTION__);
90
+ }
91
+
92
+ return false;
93
+ }
94
+ catch(Exception $e) {
95
+ if(!Mage::helper('dndinxmail_subscriber/error')->getIsSilentError()) {
96
+ $message = Mage::helper('dndinxmail_subscriber/log')->__('Inxmail API Error: %s', $e->getMessage());
97
+ Mage::getSingleton('adminhtml/session')->addError($message);
98
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
99
+ Mage::helper('dndinxmail_subscriber/log')->logData('## URL: ' . $url . ' || USER: ' . $user . ' || PASS: ' . $pass, __FUNCTION__);
100
+ }
101
+
102
+ return false;
103
+ }
104
+
105
+ }
106
+
107
+ return $this->_inxmailSession;
108
+ }
109
+
110
+ /**
111
+ * Close the Inxmail session if exist
112
+ *
113
+ * @return boolean true
114
+ */
115
+ public function closeInxmailSession()
116
+ {
117
+ if($this->isInxmailSession()) {
118
+ $this->_inxmailSession->close();
119
+ $this->_inxmailSession = null;
120
+ $this->_listContextManager = null;
121
+ $this->_recipientContext = null;
122
+ }
123
+
124
+ return true;
125
+ }
126
+
127
+ /**
128
+ * Get the current Inxmail session
129
+ *
130
+ * @param string $param
131
+ *
132
+ * @return mixed Inxmail session or false
133
+ */
134
+ public function getInxmailSession()
135
+ {
136
+ return ($this->isInxmailSession()) ? $this->_inxmailSession : false;
137
+ }
138
+
139
+ /**
140
+ * Check if there is a current opened Inxmail session
141
+ *
142
+ * @param string $param
143
+ *
144
+ * @return boolean
145
+ */
146
+ public function isInxmailSession()
147
+ {
148
+ return ($this->_inxmailSession == null) ? false : true;
149
+ }
150
+
151
+ /**
152
+ * Get the ListContextManager. If not set, get it from the current Inxmail session
153
+ *
154
+ * @return mixed ListContextManager object or false
155
+ */
156
+ public function getListContextManager()
157
+ {
158
+ if($this->isInxmailSession()) {
159
+ if($this->_listContextManager == null) {
160
+ $this->_listContextManager = $this->getInxmailSession()->getListContextManager();
161
+ }
162
+
163
+ return $this->_listContextManager;
164
+ }
165
+
166
+ return false;
167
+ }
168
+
169
+ /**
170
+ * Get the RecipientContext. If not set, get it from the current Inxmail session
171
+ *
172
+ * @return mixed RecipientContext object or false
173
+ */
174
+ public function getRecipientContext()
175
+ {
176
+ if($this->isInxmailSession()) {
177
+ if($this->_recipientContext == null) {
178
+ $this->_recipientContext = $this->getInxmailSession()->createRecipientContext();
179
+ }
180
+
181
+ return $this->_recipientContext;
182
+ }
183
+
184
+ return false;
185
+ }
186
+
187
+ /**
188
+ * Subscribe email address to Inxmail
189
+ * If email is linked to customer send additionnal data else send email as guest
190
+ *
191
+ * @param string $email Email address
192
+ * @param boolean $trigger Trigger message in Inxmail
193
+ * @param object $inxmailList Inxmail list
194
+ *
195
+ * @return boolean
196
+ */
197
+ public function subscribeCustomer($email, $trigger = true, $inxmailList)
198
+ {
199
+ if(!$session = $this->openInxmailSession()) {
200
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
201
+
202
+ return false;
203
+ }
204
+
205
+ $mappingHelper = Mage::helper('dndinxmail_subscriber/mapping');
206
+ $customer = $this->getCustomerByEmail($email);
207
+ $vars = array();
208
+
209
+ if($customer != false) {
210
+ $fields = $mappingHelper->getMappingFields();
211
+ foreach($fields as $magentoField => $inxmailField) {
212
+ if($mappingHelper->isDynamicAttribute($magentoField)) {
213
+ $dynamicData = $this->getDynamicData($magentoField, $email);
214
+ if($dynamicData !== false) {
215
+ $vars[$inxmailField] = $dynamicData;
216
+ }
217
+ }
218
+ $value = $customer->getData($magentoField);
219
+ if($value != null) {
220
+ $vars[$inxmailField] = $value;
221
+ }
222
+ }
223
+ }
224
+
225
+ $this->_customerCollection = null;
226
+
227
+ $recipientContext = $this->getRecipientContext();
228
+ $subscriptionManager = $session->getSubscriptionManager();
229
+ $recipientMetaData = $recipientContext->getMetaData();
230
+ $subscriptionAttribute = $recipientMetaData->getSubscriptionAttribute($inxmailList);
231
+
232
+ $batchChannel = $recipientContext->createBatchChannel();
233
+ $recipientRowSet = $recipientContext->select($inxmailList, null, "email LIKE \"" . $email . "\"", null, Inx_Api_Order::ASC);
234
+ $isSubscribed = ($recipientRowSet->next()) ? true : false;
235
+
236
+ if(!$isSubscribed && $trigger == true) {
237
+ $subscriptionManager->processSubscription("Magento", null, $inxmailList, $email);
238
+ }
239
+
240
+ if(!$isSubscribed && $trigger == false) {
241
+ $batchChannel->createRecipient($email, true);
242
+ }
243
+
244
+ $batchChannel->selectRecipient($email, true);
245
+
246
+ if($customer != false) {
247
+ foreach($vars as $attributeName => $attributeValue) {
248
+ try {
249
+ $recipientMetaData->getUserAttribute($attributeName);
250
+ $batchChannel->write($recipientMetaData->getUserAttribute($attributeName), $attributeValue);
251
+ }
252
+ catch(Inx_Api_Recipient_AttributeNotFoundException $e) {
253
+ continue;
254
+ }
255
+ }
256
+ }
257
+
258
+ if(!$isSubscribed) {
259
+ $batchChannel->write($subscriptionAttribute, date("c"));
260
+ }
261
+
262
+ $batchChannel->executeBatch();
263
+
264
+ return true;
265
+ }
266
+
267
+
268
+ /**
269
+ * Set unsubscribe status to email address in Inxmail list
270
+ *
271
+ * @param string $email Email address
272
+ * @param boolean $trigger Trigger message in Inxmail
273
+ * @param object $inxmailList Inxmail list
274
+ *
275
+ * @return boolean
276
+ */
277
+ public function unsubscribeCustomer($email, $trigger = true, $inxmailList)
278
+ {
279
+ if(!$session = $this->openInxmailSession()) {
280
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
281
+
282
+ return false;
283
+ }
284
+
285
+ if(!$trigger) {
286
+ $this->subscribeCustomer($email, $trigger, $inxmailList);
287
+ }
288
+
289
+ $recipientContext = $this->getRecipientContext();
290
+ $subscriptionManager = $session->getSubscriptionManager();
291
+
292
+ $batchChannel = $recipientContext->createBatchChannel();
293
+
294
+ if($trigger) {
295
+ $subscriptionManager->processUnsubscription("Magento", null, $inxmailList, $email);
296
+ }
297
+ else {
298
+ $batchChannel->selectRecipient($email);
299
+ $batchChannel->unsubscribe($inxmailList);
300
+ }
301
+
302
+ $batchChannel->executeBatch();
303
+
304
+ return true;
305
+ }
306
+
307
+
308
+ /**
309
+ * Remove email address from Inxmail list
310
+ *
311
+ * @param string $email Email address
312
+ * @param object $inxmailList Inxmail list
313
+ *
314
+ * @return boolean
315
+ */
316
+ public function removeCustomer($email, $inxmailList)
317
+ {
318
+ if(!$session = $this->openInxmailSession()) {
319
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
320
+
321
+ return false;
322
+ }
323
+
324
+ $recipientContext = $this->getRecipientContext();
325
+ $recipientMetaData = $recipientContext->getMetaData();
326
+
327
+ $batchChannel = $recipientContext->createBatchChannel();
328
+
329
+ $recipientRowSet = $recipientContext->select($inxmailList, null, "email LIKE \"" . $email . "\"", null, Inx_Api_Order::ASC);
330
+ if($recipientRowSet->next()) {
331
+ $recipientRowSet->updateDatetime($recipientMetaData->getSubscriptionAttribute($inxmailList), null);
332
+ $recipientRowSet->commitRowUpdate();
333
+ }
334
+
335
+ $recipientRowSetUns = $recipientContext->selectUnsubscriber($inxmailList, null, "email LIKE \"" . $email . "\"", null, Inx_Api_Order::ASC);
336
+ if($recipientRowSetUns->next()) {
337
+ $recipientRowSetUns->resubscribe(null);
338
+ $recipientRowSetUns->commitRowUpdate();
339
+ $recipientRowSetUns->updateDatetime($recipientMetaData->getSubscriptionAttribute($inxmailList), null);
340
+ $recipientRowSetUns->commitRowUpdate();
341
+ }
342
+
343
+ $batchChannel->executeBatch();
344
+
345
+ return true;
346
+ }
347
+
348
+ /**
349
+ * Get the customer by email address
350
+ *
351
+ * @param string $email Email address
352
+ *
353
+ * @return mixed Customer obejct form email address or false
354
+ */
355
+ public function getCustomerByEmail($email)
356
+ {
357
+ $websites = Mage::app()->getWebsites();
358
+ $website = reset($websites);
359
+ $website = (count($website) > 0) ? $website->getId() : Mage::app()->getWebsite()->getId();
360
+
361
+ $customer = Mage::getModel('customer/customer')->setWebsiteId($website)->loadByEmail($email);
362
+
363
+ return ($customer->getId() !== null) ? $customer : false;
364
+ }
365
+
366
+ /**
367
+ * Delete all subscribers from Inxmail list
368
+ *
369
+ * @throws Exception
370
+ *
371
+ * @return mixed true or Exception
372
+ */
373
+ public function truncateInxmailList()
374
+ {
375
+ if(!$session = $this->openInxmailSession()) {
376
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
377
+ throw new Exception('Inxmail session does not exist');
378
+ }
379
+
380
+ if(!$listid = (int)$this->getSynchronizeListId()) {
381
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## No list defined in configuration', __FUNCTION__);
382
+ throw new Exception('No list defined in configuration');
383
+ }
384
+
385
+ $listContextManager = $session->getListContextManager();
386
+ $inxmailList = $listContextManager->get($listid);
387
+ $recipientContext = $this->getRecipientContext();
388
+ $recipientMetaData = $recipientContext->getMetaData();
389
+ $emailAttribute = $recipientMetaData->getEmailAttribute();
390
+ $subscriptionAttribute = $recipientMetaData->getSubscriptionAttribute($inxmailList);
391
+
392
+ $batchChannel = $recipientContext->createBatchChannel();
393
+
394
+ $recipientRowSetUns = $recipientContext->selectUnsubscriber($inxmailList, null, null, $emailAttribute, Inx_Api_Order::ASC);
395
+ while($recipientRowSetUns->next()) {
396
+ $recipientRowSetUns->resubscribe(null);
397
+ $recipientRowSetUns->commitRowUpdate();
398
+ }
399
+
400
+ $recipientRowSet = $recipientContext->select($inxmailList, null, null, $emailAttribute, Inx_Api_Order::ASC);
401
+ while($recipientRowSet->next()) {
402
+ $batchChannel->selectRecipient($recipientRowSet->getString($emailAttribute));
403
+ $batchChannel->write($subscriptionAttribute, null);
404
+ }
405
+
406
+ $batchChannel->executeBatch();
407
+
408
+ $recipientRowSet->close();
409
+ $recipientContext->close();
410
+ $this->closeInxmailSession();
411
+
412
+ return true;
413
+ }
414
+
415
+ /**
416
+ * Delete all subscribers from Specific Inxmail list
417
+ *
418
+ * @throws Exception
419
+ *
420
+ * @return mixed true or Exception
421
+ */
422
+ public function truncateSpecificInxmailList($inxmailList)
423
+ {
424
+ if(!$session = $this->openInxmailSession()) {
425
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
426
+ throw new Exception('Inxmail session does not exist');
427
+ }
428
+
429
+ $recipientContext = $this->getRecipientContext();
430
+ $recipientMetaData = $recipientContext->getMetaData();
431
+ $emailAttribute = $recipientMetaData->getEmailAttribute();
432
+ $subscriptionAttribute = $recipientMetaData->getSubscriptionAttribute($inxmailList);
433
+
434
+ $batchChannel = $recipientContext->createBatchChannel();
435
+
436
+ $recipientRowSetUns = $recipientContext->selectUnsubscriber($inxmailList, null, null, $emailAttribute, Inx_Api_Order::ASC);
437
+ while($recipientRowSetUns->next()) {
438
+ $recipientRowSetUns->resubscribe(null);
439
+ $recipientRowSetUns->commitRowUpdate();
440
+ }
441
+
442
+ $recipientRowSet = $recipientContext->select($inxmailList, null, null, $emailAttribute, Inx_Api_Order::ASC);
443
+ while($recipientRowSet->next()) {
444
+ $batchChannel->selectRecipient($recipientRowSet->getString($emailAttribute));
445
+ $batchChannel->write($subscriptionAttribute, null);
446
+ }
447
+
448
+ $batchChannel->executeBatch();
449
+
450
+ return true;
451
+ }
452
+
453
+ /**
454
+ * Synchronize Magento newsletter subscribers to Inxmail list
455
+ *
456
+ * @throws Exception
457
+ *
458
+ * @return mixed true or Exception
459
+ */
460
+ public function synchronizeSubscribers()
461
+ {
462
+ if(!$this->truncateInxmailList()) {
463
+ Mage::helper('dndinxmail_subscriber/log')->logData('## Error truncating Inxmail list ', __FUNCTION__);
464
+ throw new Exception('Error truncating Inxmail list');
465
+ }
466
+
467
+ if(!$session = $this->openInxmailSession()) {
468
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
469
+ throw new Exception('Inxmail session does not exist');
470
+ }
471
+
472
+ if(!$listid = (int)$this->getSynchronizeListId()) {
473
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## No list defined in configuration', __FUNCTION__);
474
+ throw new Exception('No list defined in configuration');
475
+ }
476
+
477
+ $listContextManager = $session->getListContextManager();
478
+ $inxmailList = $listContextManager->get($listid);
479
+ $subscribers = Mage::getResourceModel('newsletter/subscriber_collection');
480
+
481
+ foreach($subscribers as $subscriber) {
482
+ $email = $subscriber->getSubscriberEmail();
483
+ $status = $subscriber->getStatus();
484
+ $this->switchActionToSubscriberStatus($status, $email, false, $inxmailList);
485
+ }
486
+
487
+ $this->closeInxmailSession();
488
+
489
+ return true;
490
+ }
491
+
492
+ /**
493
+ * Get unsubscribed customer from inxmail
494
+ *
495
+ * @return mixed Unsubscribed emails or false
496
+ */
497
+ public function getUnsubscribedCustomers($storeId)
498
+ {
499
+ if(!$session = $this->openInxmailSession()) {
500
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
501
+
502
+ return array();
503
+ }
504
+
505
+ if(!$listid = (int)$this->getSynchronizeListId($storeId)) {
506
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## No list defined in configuration', __FUNCTION__);
507
+
508
+ return array();
509
+ }
510
+
511
+ try {
512
+ $unsubscribed = array();
513
+ $listContextManager = $session->getListContextManager();
514
+ $inxmailList = $listContextManager->get($listid);
515
+ $recipientContext = $this->getRecipientContext();
516
+ $recipientMetaData = $recipientContext->getMetaData();
517
+ $emailAttribute = $recipientMetaData->getEmailAttribute();
518
+
519
+ $batchChannel = $recipientContext->createBatchChannel();
520
+
521
+ $recipientRowSet = $recipientContext->selectUnsubscriber($inxmailList, null, null, $emailAttribute, Inx_Api_Order::ASC);
522
+
523
+ while($recipientRowSet->next()) {
524
+ $unsubscribed[] = $recipientRowSet->getString($emailAttribute);
525
+ }
526
+
527
+ $batchChannel->executeBatch();
528
+ $recipientContext->close();
529
+ }
530
+ catch(Exception $e) {
531
+
532
+ }
533
+
534
+ $this->closeInxmailSession();
535
+
536
+ return $unsubscribed;
537
+ }
538
+
539
+ /**
540
+ * @return array|bool
541
+ */
542
+ public function unsubscribeCustomersFromGroups()
543
+ {
544
+ $groupHelper = Mage::helper('dndinxmail_subscriber/group');
545
+
546
+ $groupsConfig = $groupHelper->getCustomerGroupsConfig();
547
+ if(count($groupsConfig) <= 0) return array();
548
+
549
+ if(!$session = $this->openInxmailSession()) {
550
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
551
+
552
+ return false;
553
+ }
554
+
555
+ try {
556
+
557
+ $contextListManager = $this->getListContextManager();
558
+ $recipientContext = $this->getRecipientContext();
559
+ $recipientMetaData = $recipientContext->getMetaData();
560
+ $emailAttribute = $recipientMetaData->getEmailAttribute();
561
+ $batchChannel = $recipientContext->createBatchChannel();
562
+ $unsubscribed = array();
563
+
564
+ foreach($groupsConfig as $groupId) {
565
+
566
+ $listName = $groupHelper->formatInxmailListName($groupId);
567
+
568
+ if($inxmailList = $contextListManager->findByName($listName)) {
569
+ $recipientRowSet = $recipientContext->selectUnsubscriber($inxmailList, null, null, $emailAttribute, Inx_Api_Order::ASC);
570
+ while($recipientRowSet->next()) {
571
+ $unsubscribed[] = $recipientRowSet->getString($emailAttribute);
572
+ }
573
+ }
574
+
575
+ }
576
+
577
+ $batchChannel->executeBatch();
578
+ $recipientContext->close();
579
+
580
+ }
581
+ catch(Exception $e) {
582
+ return false;
583
+ }
584
+
585
+ $this->closeInxmailSession();
586
+
587
+ $this->unsubscribeCustomersFromInxmail($unsubscribed);
588
+
589
+ return true;
590
+ }
591
+
592
+ /**
593
+ * Unsubscribe Inxmail email in Magento
594
+ *
595
+ * @param array $unsubscribed Unsubscribed emails
596
+ *
597
+ * @return boolean
598
+ */
599
+ public function unsubscribeCustomersFromInxmail($unsubscribed = array())
600
+ {
601
+ if(count($unsubscribed) <= 0) return false;
602
+
603
+ foreach($unsubscribed as $email) {
604
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
605
+ if(!$subscriber instanceof Varien_Object || !$subscriber->getId()) continue;
606
+
607
+ if($subscriber->isSubscribed()) {
608
+ $subscriber->unsubscribe();
609
+ }
610
+ }
611
+
612
+ return true;
613
+ }
614
+
615
+ /**
616
+ * Get Inxmail columns
617
+ *
618
+ * @return array Inxmail columns name
619
+ */
620
+ public function getInxmailColumns()
621
+ {
622
+ if(!$session = $this->openInxmailSession()) {
623
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
624
+
625
+ return array(
626
+ array(
627
+ 'name' => $this->__('No column available'),
628
+ 'id' => ''
629
+ )
630
+ );
631
+ }
632
+
633
+ $recipientContext = $this->getRecipientContext();
634
+ $recipientMetaData = $recipientContext->getMetaData();
635
+
636
+ $batchChannel = $recipientContext->createBatchChannel();
637
+
638
+ $attrIterator = $recipientMetaData->getAttributeIterator();
639
+
640
+ $columns[] = array(
641
+ 'id' => '',
642
+ 'name' => Mage::helper('dndinxmail_subscriber')->__('Disabled'),
643
+ 'type' => ''
644
+ );
645
+ while($attrIterator->hasNext()) {
646
+ $attr = $attrIterator->current();
647
+ if($attr->getName() != '' && $attr->getName() != null && $attr->getType() == Inx_Api_Recipient_Attribute::USER_ATTRIBUTE_TYPE) {
648
+ $columns[] = array(
649
+ 'id' => htmlspecialchars($attr->getName()),
650
+ 'name' => $attr->getName(),
651
+ 'type' => $attr->getDataType()
652
+ );
653
+ }
654
+ $attrIterator->next();
655
+ }
656
+
657
+ $batchChannel->executeBatch();
658
+ $recipientContext->close();
659
+ $this->closeInxmailSession();
660
+
661
+ return $columns;
662
+ }
663
+
664
+ /**
665
+ * Get all Inxmail lists
666
+ *
667
+ * @return array Inxmail lists
668
+ */
669
+ public function getInxmailLists()
670
+ {
671
+ if(!$session = $this->openInxmailSession()) {
672
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
673
+
674
+ return array(
675
+ array(
676
+ 'name' => $this->__('No list available'),
677
+ 'id' => ''
678
+ )
679
+ );
680
+ }
681
+
682
+ $contextListManager = $this->getListContextManager();
683
+ $inxmailLists = $contextListManager->selectAll();
684
+
685
+ $lists = array();
686
+
687
+ $lists[] = array(
688
+ 'id' => '',
689
+ 'name' => Mage::helper('dndinxmail_subscriber')->__('No list selected')
690
+ );
691
+ for($i = 0; $i < $inxmailLists->size(); $i++) {
692
+
693
+ $list = $inxmailLists->get($i);
694
+ $listId = $list->getId();
695
+ $listName = $list->getName();
696
+ $specificGroup = DndInxmail_Subscriber_Helper_Group::DNDINXMAIL_INXMAIL_LIST_CUTOMER_GROUP_PREFIX;
697
+ $specificSegment = DndInxmail_Subscriber_Helper_Group::DNDINXMAIL_INXMAIL_LIST_CUTOMER_SEGMENT_PREFIX;
698
+ $specific = (preg_match("/($specificGroup|$specificSegment)/", $listName)) ? true : false;
699
+
700
+ if($listName != Inx_Api_List_SystemListContext::NAME && !$specific) {
701
+ $lists[] = array(
702
+ 'id' => $listId,
703
+ 'name' => $listName
704
+ );
705
+ }
706
+
707
+ }
708
+
709
+ $inxmailLists->close();
710
+ $this->closeInxmailSession();
711
+
712
+ return $lists;
713
+ }
714
+
715
+ /**
716
+ * Get data for dynamic attributes
717
+ *
718
+ * @param string $attribute Attribute code
719
+ * @param string $email Email address
720
+ *
721
+ * @return mixed Value of attribute or false
722
+ */
723
+ public function getDynamicData($attribute, $email)
724
+ {
725
+ $collection = ($this->_customerCollection == null) ? Mage::getResourceModel('customer/customer_collection')->addAttributeToFilter('email', array('eq' => $email)) : $this->_customerCollection;
726
+
727
+ $entityType = Mage::getModel('eav/entity_type')->loadByCode('order');
728
+ $entityTable = $collection->getTable($entityType->getEntityTable());
729
+
730
+ switch($attribute) {
731
+
732
+ case 'first_order':
733
+ $collection->getSelect()->joinLeft($entityTable, '`e`.entity_id = `' . $entityTable . '`.customer_id', array($attribute => 'MIN(' . $entityTable . '.created_at)'));
734
+ break;
735
+
736
+ case 'last_order':
737
+ $collection->getSelect()->joinLeft($entityTable, '`e`.entity_id = `' . $entityTable . '`.customer_id', array($attribute => 'MAX(' . $entityTable . '.created_at)'));
738
+ break;
739
+
740
+ case 'total_orders':
741
+ $collection->getSelect()->joinLeft($entityTable, '`e`.entity_id = `' . $entityTable . '`.customer_id', array($attribute => 'COUNT(' . $entityTable . '.base_grand_total)'));
742
+ break;
743
+
744
+ case 'avg_orders':
745
+ $collection->getSelect()->joinLeft($entityTable, '`e`.entity_id = `' . $entityTable . '`.customer_id', array($attribute => 'AVG(' . $entityTable . '.base_subtotal)'));
746
+ break;
747
+
748
+ case 'last_connection':
749
+ if($customer = $this->getCustomerByEmail($email)) {
750
+ $logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer);
751
+
752
+ return $logCustomer->getLastVisitAt();
753
+ }
754
+
755
+ return false;
756
+ break;
757
+
758
+ }
759
+
760
+ $collection->groupByAttribute('entity_id');
761
+
762
+ $customer = $collection->getFirstItem()->toArray();
763
+
764
+ return (isset($customer[$attribute])) ? $customer[$attribute] : false;
765
+ }
766
+
767
+ /**
768
+ * Synchronize Magento customer group to Inxmail lists
769
+ *
770
+ * @param array $customerGroups Array with Magento customer group
771
+ *
772
+ * @return boolean
773
+ */
774
+ public function synchronizeCustomerGroups($customerGroups)
775
+ {
776
+ $groupHelper = Mage::helper('dndinxmail_subscriber/group');
777
+
778
+ foreach($customerGroups as $status => $groups) {
779
+
780
+ switch($status) {
781
+
782
+ case self::DNDINXMAIL_CUSTOMER_MAPPING_STATUS_CREATED:
783
+ foreach($groups as $group) {
784
+ $listName = $groupHelper->formatInxmailListName($group);
785
+ $description = $groupHelper->getGroupName($group);
786
+ $description = ($description != false) ? $description : null;
787
+ $this->createInxmailList($listName, $description);
788
+ }
789
+ break;
790
+
791
+ case self::DNDINXMAIL_CUSTOMER_MAPPING_STATUS_DELETED:
792
+ foreach($groups as $group) {
793
+ $listName = $groupHelper->formatInxmailListName($group);
794
+ $this->deleteInxmailList($listName);
795
+ }
796
+ break;
797
+
798
+ }
799
+
800
+ }
801
+
802
+ return true;
803
+ }
804
+
805
+ /**
806
+ * Create an Inxmail list
807
+ *
808
+ * @param string $listName List name
809
+ * @param string $description List description
810
+ *
811
+ * @return boolean
812
+ */
813
+ public function createInxmailList($listName, $description = null)
814
+ {
815
+ if(!$session = $this->openInxmailSession()) {
816
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
817
+
818
+ return false;
819
+ }
820
+
821
+ $contextListManager = $this->getListContextManager();
822
+
823
+ if(!$contextListManager->findByName($listName)) {
824
+ $list = $contextListManager->createStandardList();
825
+ $list->updateName($listName);
826
+ if($description) $list->updateDescription($description);
827
+ $list->commitUpdate();
828
+ }
829
+
830
+ $this->closeInxmailSession();
831
+
832
+ return true;
833
+ }
834
+
835
+ /**
836
+ * Delete an Inxmail list
837
+ *
838
+ * @param string $listName List name
839
+ *
840
+ * @return boolean
841
+ */
842
+ public function deleteInxmailList($listName)
843
+ {
844
+ if(!$session = $this->openInxmailSession()) {
845
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
846
+
847
+ return false;
848
+ }
849
+
850
+ $contextListManager = $this->getListContextManager();
851
+
852
+ if($list = $contextListManager->findByName($listName)) {
853
+ try {
854
+ $contextListManager->remove($list->getId());
855
+
856
+ return true;
857
+ }
858
+ catch(Exception $e) {
859
+ return false;
860
+ }
861
+ }
862
+
863
+ $this->closeInxmailSession();
864
+
865
+ return false;
866
+ }
867
+
868
+ /**
869
+ * Synchronize Magento customers to Inxmail
870
+ *
871
+ * @return boolean
872
+ */
873
+ public function synchronizeCustomerGroupToInxmail()
874
+ {
875
+ $groupHelper = Mage::helper('dndinxmail_subscriber/group');
876
+
877
+ $groupsConfig = $groupHelper->getCustomerGroupsConfig();
878
+ if(count($groupsConfig) <= 0) return false;
879
+
880
+ if(!$session = $this->openInxmailSession()) {
881
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData('## Inxmail session does not exist', __FUNCTION__);
882
+
883
+ return false;
884
+ }
885
+
886
+ $contextListManager = $this->getListContextManager();
887
+
888
+ foreach($groupsConfig as $groupId) {
889
+
890
+ $listName = $groupHelper->formatInxmailListName($groupId);
891
+ $emails = $groupHelper->getCustomersFromGroup($groupId);
892
+
893
+ if(!$list = $contextListManager->findByName($listName)) {
894
+ $list = $contextListManager->createStandardList();
895
+ $list->updateName($listName);
896
+ $description = $groupHelper->getGroupName($groupId);
897
+ $list->updateDescription($description);
898
+ $list->commitUpdate();
899
+ }
900
+ else {
901
+ $this->truncateSpecificInxmailList($list);
902
+ }
903
+
904
+ if(!$emails) continue;
905
+
906
+ $inxmailList = $contextListManager->get($list->getId());
907
+ foreach($emails as $email) {
908
+
909
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
910
+ if(!$subscriber instanceof Varien_Object || !$subscriber->getSubscriberId()) {
911
+ continue;
912
+ }
913
+ if(!$subscriber->isSubscribed()) continue;
914
+
915
+ $this->subscribeCustomer($email, false, $inxmailList);
916
+ }
917
+
918
+ }
919
+
920
+ $this->closeInxmailSession();
921
+
922
+ return true;
923
+ }
924
+
925
+ /**
926
+ * Initiate an action based on the subscriber status
927
+ *
928
+ * @param string $status Subscriber status
929
+ * @param string $email Email address
930
+ * @param string $trigger Trigger message in Inxmail
931
+ * @param object $inxmailList Inxmail list
932
+ *
933
+ * @return boolean true
934
+ */
935
+ public function switchActionToSubscriberStatus($status, $email, $trigger = true, $inxmailList)
936
+ {
937
+ switch($status) {
938
+
939
+ case Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED:
940
+ $this->subscribeCustomer($email, $trigger, $inxmailList);
941
+ break;
942
+
943
+ case Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED:
944
+ $this->unsubscribeCustomer($email, $trigger, $inxmailList);
945
+ break;
946
+
947
+ case Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE:
948
+ case Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED:
949
+ break;
950
+
951
+ }
952
+
953
+ return true;
954
+ }
955
+
956
+ /**
957
+ * Get the Inxmail list to work with
958
+ *
959
+ * @return int List ID
960
+ */
961
+ public function getSynchronizeListId($storeId = null)
962
+ {
963
+ return ($this->getConfig(self::DNDINXMAIL_INXMAIL_LIST_ID, $storeId) == '' || $this->getConfig(self::DNDINXMAIL_INXMAIL_LIST_ID, $storeId) == null) ? false : $this->getConfig(self::DNDINXMAIL_INXMAIL_LIST_ID, $storeId);
964
+ }
965
+
966
+ }
app/code/community/DndInxmail/Subscriber/Helper/Synchronize/Groups.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Synchronize_Groups extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const CUSTOMERS_PER_PASS = 'dndinxmail_subscriber_crons/crons_synchronize_groups/customers_per_pass';
19
+
20
+ /**
21
+ * Format emails for synchronization
22
+ *
23
+ * @return array
24
+ */
25
+ public function initSynchronization()
26
+ {
27
+ $pass = array();
28
+ $customersPerPass = $this->getCustomersPerPass();
29
+ $groupHelper = Mage::helper('dndinxmail_subscriber/group');
30
+ $groupsConfig = $groupHelper->getCustomerGroupsConfig();
31
+ if(count($groupsConfig) <= 0) return array();
32
+ $group = 0;
33
+
34
+ $isSession = (!$session = Mage::helper('dndinxmail_subscriber/synchronize')->openInxmailSession()) ? false : true;
35
+
36
+ foreach($groupsConfig as $groupId) {
37
+
38
+ $listName = $groupHelper->formatInxmailListName($groupId);
39
+ $emails = $groupHelper->getCustomersFromGroup($groupId);
40
+
41
+ if($isSession) {
42
+ try {
43
+ if($list = $session->getListContextManager()->findByName($listName)) {
44
+ Mage::helper('dndinxmail_subscriber/synchronize')->truncateSpecificInxmailList($list);
45
+ }
46
+ }
47
+ catch(Exception $e) {
48
+
49
+ }
50
+ }
51
+
52
+ if(!$emails) continue;
53
+
54
+ $currentPass = 0;
55
+ $i = 0;
56
+ foreach($emails as $email) {
57
+
58
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
59
+ if(!$subscriber instanceof Varien_Object || !$subscriber->getSubscriberId()) {
60
+ continue;
61
+ }
62
+ if(!$subscriber->isSubscribed()) continue;
63
+
64
+ $pass[$group][$currentPass][] = $email;
65
+
66
+ if($i % $customersPerPass == $customersPerPass - 1) $currentPass++;
67
+
68
+ $i++;
69
+ }
70
+
71
+ if($i == 0) continue;
72
+
73
+ $pass[$group]['total'] = count($pass[$group]);
74
+ $pass[$group]['name'] = $listName;
75
+
76
+ $group++;
77
+ }
78
+
79
+ $pass['total'] = count($pass);
80
+
81
+ Mage::helper('dndinxmail_subscriber/synchronize')->closeInxmailSession();
82
+
83
+ return $pass;
84
+ }
85
+
86
+ /**
87
+ * Get customer per pass
88
+ *
89
+ * @return int
90
+ */
91
+ public function getCustomersPerPass()
92
+ {
93
+ $config = Mage::getStoreConfig(self::CUSTOMERS_PER_PASS);
94
+
95
+ return ($config != '' && $config != null) ? $config : 50;
96
+ }
97
+
98
+ }
app/code/community/DndInxmail/Subscriber/Helper/Synchronize/Subscribers.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Helper
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Helper_Synchronize_Subscribers extends DndInxmail_Subscriber_Helper_Abstract
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const SUBSCRIBER_PER_PASS = 'dndinxmail_subscriber_general/syncrhonize_subscribers/subscribers_per_pass';
19
+
20
+ /**
21
+ * Format emails for synchronization
22
+ *
23
+ * @return array
24
+ */
25
+ public function initSynchronization($storeId)
26
+ {
27
+ $pass = array();
28
+ $subscribersPerPass = $this->getSubscribersPerPass($storeId);
29
+ $currentPass = 0;
30
+ $i = 0;
31
+
32
+ $resource = Mage::getSingleton('core/resource');
33
+ $read = $resource->getConnection('core_read');
34
+ $subscriberTable = $resource->getTableName('newsletter/subscriber');
35
+ $query = "SELECT `$subscriberTable`.`subscriber_status` as `status`, `$subscriberTable`.`subscriber_email` as `email` FROM `$subscriberTable` WHERE `$subscriberTable`.`store_id` = $storeId";
36
+
37
+ try {
38
+ if(!$result = $read->query($query)) return array();
39
+ if(!$subscribers = $result->fetchAll()) return array();
40
+
41
+ foreach($subscribers as $subscriber) {
42
+
43
+ $pass[$currentPass][] = array(
44
+ 'email' => $subscriber['email'],
45
+ 'status' => $subscriber['status']
46
+ );
47
+
48
+ if($i % $subscribersPerPass == $subscribersPerPass - 1) $currentPass++;
49
+
50
+ $i++;
51
+ }
52
+
53
+ $pass['total'] = count($pass);
54
+
55
+ return $pass;
56
+
57
+ }
58
+ catch(Exception $e) {
59
+ return array();
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Get subscriber per pass
65
+ *
66
+ * @return int
67
+ */
68
+ public function getSubscribersPerPass($storeId)
69
+ {
70
+ $config = Mage::getStoreConfig(self::SUBSCRIBER_PER_PASS, $storeId);
71
+
72
+ return ($config != '' && $config != null) ? $config : 50;
73
+ }
74
+
75
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Backend/Cron.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 18/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Backend_Cron extends Mage_Core_Model_Config_Data
13
+ {
14
+
15
+ /**
16
+ * @var array
17
+ */
18
+ protected $_crons = array(
19
+ array(
20
+ 'string_path' => 'crontab/jobs/dndinxmail_subscriber_synchronize_unsubscribed/schedule/cron_expr',
21
+ 'model_path' => 'crontab/jobs/dndinxmail_subscriber_synchronize_unsubscribed/run/model',
22
+ 'enabled' => 'groups/crons_synchronize_unsubscribed/fields/enabled/value',
23
+ 'time' => 'groups/crons_synchronize_unsubscribed/fields/time/value',
24
+ 'frequency' => 'groups/crons_synchronize_unsubscribed/fields/frequency/value',
25
+ ),
26
+ array(
27
+ 'string_path' => 'crontab/jobs/dndinxmail_subscriber_synchronize_customer_group/schedule/cron_expr',
28
+ 'model_path' => 'crontab/jobs/dndinxmail_subscriber_synchronize_customer_group/run/model',
29
+ 'enabled' => 'groups/crons_synchronize_groups/fields/enabled/value',
30
+ 'time' => 'groups/crons_synchronize_groups/fields/time/value',
31
+ 'frequency' => 'groups/crons_synchronize_groups/fields/frequency/value',
32
+ )
33
+ );
34
+
35
+ /**
36
+ * Cron settings after save
37
+ *
38
+ * @return boolean
39
+ */
40
+ protected function _afterSave()
41
+ {
42
+ if(!Mage::helper('dndinxmail_subscriber')->isDndInxmailEnabled()) return false;
43
+
44
+ $frequencyHourly = DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Cron_Frequency::CRON_HOURLY;
45
+ $frequencyDaily = DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Cron_Frequency::CRON_DAILY;
46
+ $frequencyWeekly = DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
47
+ $frequencyMonthly = DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
48
+
49
+ foreach($this->_crons as $cronConfig) {
50
+
51
+ $enabled = $this->getData($cronConfig['enabled']);
52
+ $time = $this->getData($cronConfig['time']);
53
+ $frequency = $this->getData($cronConfig['frequency']);
54
+
55
+ if($enabled) {
56
+ $cronDayOfWeek = date('N');
57
+
58
+ $cronExprArray = array(
59
+ intval($time[1]),
60
+ ($frequency == $frequencyHourly) ? '*' : intval($time[0]),
61
+ ($frequency == $frequencyMonthly) ? '1' : '*',
62
+ '*',
63
+ ($frequency == $frequencyWeekly) ? '1' : '*'
64
+ );
65
+
66
+ $cronExprString = join(' ', $cronExprArray);
67
+ }
68
+ else {
69
+ $cronExprString = '';
70
+ }
71
+
72
+ try {
73
+ Mage::getModel('core/config_data')->load($cronConfig['string_path'], 'path')->setValue($cronExprString)->setPath($cronConfig['string_path'])->save();
74
+
75
+ Mage::getModel('core/config_data')->load($cronConfig['model_path'], 'path')->setValue((string)Mage::getConfig()->getNode($cronConfig['model_path']))->setPath($cronConfig['model_path'])->save();
76
+ }
77
+ catch(Exception $e) {
78
+ Mage::getSingleton('adminhtml/session')->addError('Unable to save the cron expression : ' . $e->getMessage());
79
+ }
80
+
81
+ }
82
+
83
+ return true;
84
+ }
85
+
86
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Backend/Customer/Group.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Backend_Customer_Group extends Mage_Core_Model_Config_Data
13
+ {
14
+
15
+ /**
16
+ * Format attributes to synchronize in Inxmail after saving in admin
17
+ *
18
+ * @return boolean
19
+ */
20
+ protected function _afterSave()
21
+ {
22
+ if(!Mage::helper('dndinxmail_subscriber')->isDndInxmailEnabled()) return false;
23
+
24
+ $value = $this->getValue();
25
+ $session = Mage::getSingleton('adminhtml/session');
26
+
27
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
28
+ $groupHelper = Mage::helper('dndinxmail_subscriber/group');
29
+
30
+ $newGroups = $groupHelper->formatCustomerGroups($value);
31
+ $oldGroups = $groupHelper->getCustomerGroupsConfig();
32
+
33
+ if(in_array(DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group_Specific::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_BIRTHDAY, $newGroups) && !$groupHelper->isDobEnabled()) {
34
+ $message = Mage::helper('dndinxmail_subscriber')->__('You have selected the Birthday group even though the date of birth is not enabled on your shop');
35
+ $session->addNotice($message);
36
+ }
37
+
38
+ $created = array_filter(array_diff($newGroups, $oldGroups));
39
+
40
+ $deleted = array_filter(array_diff($oldGroups, $newGroups));
41
+
42
+ $groups = array(
43
+ DndInxmail_Subscriber_Helper_Synchronize::DNDINXMAIL_CUSTOMER_MAPPING_STATUS_CREATED => $created,
44
+ );
45
+
46
+ if(count($created) == 0 && count($deleted) == 0) return false;
47
+
48
+ try {
49
+ $synchronize->synchronizeCustomerGroups($groups);
50
+ }
51
+ catch(Exception $e) {
52
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
53
+
54
+ return false;
55
+ }
56
+
57
+ return true;
58
+ }
59
+
60
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Backend/Date.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 18/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Backend_Date extends Mage_Core_Model_Config_Data
13
+ {
14
+
15
+ /**
16
+ * Cron settings after save
17
+ *
18
+ * @return boolean
19
+ */
20
+ protected function _beforeSave()
21
+ {
22
+ if(!Mage::helper('dndinxmail_subscriber')->isDndInxmailEnabled()) return false;
23
+
24
+ $value = $this->getValue();
25
+
26
+ if($value == '' || $value == null) {
27
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
28
+ $date = Mage::app()->getLocale()->date(time(), Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
29
+ $this->setValue($date);
30
+ }
31
+
32
+ return true;
33
+ }
34
+
35
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Attributes.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Source Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Barracuda
7
+ * @last_modified 13/03/2012
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Attributes
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get product attributes
22
+ *
23
+ * @return array Product attributes
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+
29
+ $attribute = Mage::getResourceModel('eav/entity_attribute_collection');
30
+
31
+ foreach($attribute as $option) {
32
+ if($option->getIsUserDefined() && $option->getFrontendLabel()) {
33
+ $this->_options[] = array(
34
+ 'value' => $option->getAttributeCode(),
35
+ 'label' => $option->getAttributeCode()
36
+ );
37
+ }
38
+ }
39
+ }
40
+
41
+ return $this->_options;
42
+ }
43
+
44
+ }
45
+
46
+
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Cron/Frequency.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Cron_Frequency
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected static $_options;
19
+
20
+ /**
21
+ *
22
+ */
23
+ const CRON_HOURLY = 'H';
24
+ /**
25
+ *
26
+ */
27
+ const CRON_DAILY = 'D';
28
+ /**
29
+ *
30
+ */
31
+ const CRON_WEEKLY = 'W';
32
+ /**
33
+ *
34
+ */
35
+ const CRON_MONTHLY = 'M';
36
+
37
+ /**
38
+ * @return array
39
+ */
40
+ public function toOptionArray()
41
+ {
42
+ if(!self::$_options) {
43
+ self::$_options = array(
44
+ array(
45
+ 'label' => Mage::helper('cron')->__('Hourly'),
46
+ 'value' => self::CRON_HOURLY,
47
+ ),
48
+ array(
49
+ 'label' => Mage::helper('cron')->__('Daily'),
50
+ 'value' => self::CRON_DAILY,
51
+ ),
52
+ array(
53
+ 'label' => Mage::helper('cron')->__('Weekly'),
54
+ 'value' => self::CRON_WEEKLY,
55
+ ),
56
+ array(
57
+ 'label' => Mage::helper('cron')->__('Monthly'),
58
+ 'value' => self::CRON_MONTHLY,
59
+ ),
60
+ );
61
+ }
62
+
63
+ return self::$_options;
64
+ }
65
+
66
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Group.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get Magento customer groups
22
+ *
23
+ * @return array Magento customer groups
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+
28
+ $groups = Mage::getResourceModel('customer/group_collection')->load();
29
+
30
+ if(!$this->_options) {
31
+ $this->_options[] = array(
32
+ 'value' => '',
33
+ 'label' => ''
34
+ );
35
+ foreach($groups as $group) {
36
+ $this->_options[] = array(
37
+ 'value' => $group->getId(),
38
+ 'label' => $group->getCode() . ' (' . $group->getId() . ')'
39
+ );
40
+ }
41
+ $specificGroups = Mage::getModel('dndinxmail_subscriber/adminhtml_system_config_source_group_specific')->getSpecificGroups();
42
+ $this->_options = array_merge($this->_options, $specificGroups);
43
+ }
44
+
45
+ return $this->_options;
46
+ }
47
+
48
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Group/Specific.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Group_Specific
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_LAST = 'Last customers';
19
+ /**
20
+ *
21
+ */
22
+ const DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_BEST = 'Best customers';
23
+ /**
24
+ *
25
+ */
26
+ const DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_BIRTHDAY = 'Birthday';
27
+ /**
28
+ *
29
+ */
30
+ const DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ABANDONNED_CARTS = 'Abandonned Carts';
31
+ /**
32
+ *
33
+ */
34
+ const DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ORDERS = 'Orders';
35
+
36
+ /**
37
+ * @var
38
+ */
39
+ protected $_options;
40
+
41
+ /**
42
+ * Get specific group to synchronize
43
+ *
44
+ * @return array Specific groups
45
+ */
46
+ public function getSpecificGroups()
47
+ {
48
+ return array(
49
+ array(
50
+ 'label' => Mage::helper('dndinxmail_subscriber')->__('Last customers (specific)'),
51
+ 'value' => 'Last customers'
52
+ ),
53
+ array(
54
+ 'label' => Mage::helper('dndinxmail_subscriber')->__('Best customers (specific)'),
55
+ 'value' => 'Best customers'
56
+ ),
57
+ array(
58
+ 'label' => Mage::helper('dndinxmail_subscriber')->__('Customers birthday (specific)'),
59
+ 'value' => 'Birthday'
60
+ ),
61
+ array(
62
+ 'label' => Mage::helper('dndinxmail_subscriber')->__('Abandonned carts (specific)'),
63
+ 'value' => 'Abandonned Carts'
64
+ ),
65
+ array(
66
+ 'label' => Mage::helper('dndinxmail_subscriber')->__('Orders (specific)'),
67
+ 'value' => 'Orders'
68
+ )
69
+ );
70
+ }
71
+
72
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get all Inxmail Columns
22
+ *
23
+ * @return array Inxmail lists
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+
29
+ Mage::helper('dndinxmail_subscriber/error')->setIsSilentError(true);
30
+ try {
31
+ $columns = Mage::helper('dndinxmail_subscriber/synchronize')->getInxmailColumns();
32
+ }
33
+ catch(Exception $e) {
34
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
35
+
36
+ return array(
37
+ array(
38
+ 'value' => '',
39
+ 'label' => ''
40
+ )
41
+ );
42
+ }
43
+ Mage::helper('dndinxmail_subscriber/error')->setIsSilentError(false);
44
+
45
+ foreach($columns as $column):
46
+ $this->_options[] = array(
47
+ 'value' => $column['id'],
48
+ 'label' => $column['name'],
49
+ 'type' => $column['type']
50
+ );
51
+ endforeach;
52
+
53
+ }
54
+
55
+ return $this->_options;
56
+ }
57
+
58
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Dateonly.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns_Type_Dateonly extends DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get all Inxmail Columns
22
+ *
23
+ * @return array Inxmail lists
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+ $options = parent::toOptionArray();
29
+ foreach($options as $i => $option) {
30
+ if($option['type'] != Inx_Api_Recipient_Attribute::DATA_TYPE_DATE && $option['value'] != '') {
31
+ if(isset($options[$i])) unset($options[$i]);
32
+ }
33
+ }
34
+ if(count($options) == 1 && isset($options[0])) {
35
+ $options[0]['label'] = Mage::helper('dndinxmail_subscriber')->__('No column available');
36
+ }
37
+ $this->_options = $options;
38
+ }
39
+
40
+ return $this->_options;
41
+ }
42
+
43
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Float.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns_Type_Float extends DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get all Inxmail Columns
22
+ *
23
+ * @return array Inxmail lists
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+ $options = parent::toOptionArray();
29
+ foreach($options as $i => $option) {
30
+ if($option['type'] != Inx_Api_Recipient_Attribute::DATA_TYPE_DOUBLE && $option['value'] != '') {
31
+ if(isset($options[$i])) unset($options[$i]);
32
+ }
33
+ }
34
+ if(count($options) == 1 && isset($options[0])) {
35
+ $options[0]['label'] = Mage::helper('dndinxmail_subscriber')->__('No column available');
36
+ }
37
+ $this->_options = $options;
38
+ }
39
+
40
+ return $this->_options;
41
+ }
42
+
43
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Int.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns_Type_Int extends DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get all Inxmail Columns
22
+ *
23
+ * @return array Inxmail lists
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+ $options = parent::toOptionArray();
29
+ foreach($options as $i => $option) {
30
+ if($option['type'] != Inx_Api_Recipient_Attribute::DATA_TYPE_INTEGER && $option['value'] != '') {
31
+ if(isset($options[$i])) unset($options[$i]);
32
+ }
33
+ }
34
+ if(count($options) == 1 && isset($options[0])) {
35
+ $options[0]['label'] = Mage::helper('dndinxmail_subscriber')->__('No column available');
36
+ }
37
+ $this->_options = $options;
38
+ }
39
+
40
+ return $this->_options;
41
+ }
42
+
43
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Text.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns_Type_Text extends DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get all Inxmail Columns
22
+ *
23
+ * @return array Inxmail lists
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+ $options = parent::toOptionArray();
29
+ foreach($options as $i => $option) {
30
+ if($option['type'] != Inx_Api_Recipient_Attribute::DATA_TYPE_STRING && $option['value'] != '') {
31
+ if(isset($options[$i])) unset($options[$i]);
32
+ }
33
+ }
34
+ if(count($options) == 1 && isset($options[0])) {
35
+ $options[0]['label'] = Mage::helper('dndinxmail_subscriber')->__('No column available');
36
+ }
37
+ $this->_options = $options;
38
+ }
39
+
40
+ return $this->_options;
41
+ }
42
+
43
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Columns/Type/Yesno.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns_Type_Yesno extends DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Columns
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get all Inxmail Columns
22
+ *
23
+ * @return array Inxmail lists
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+ $options = parent::toOptionArray();
29
+ foreach($options as $i => $option) {
30
+ if($option['type'] != Inx_Api_Recipient_Attribute::DATA_TYPE_BOOLEAN && $option['value'] != '') {
31
+ if(isset($options[$i])) unset($options[$i]);
32
+ }
33
+ }
34
+ if(count($options) == 1 && isset($options[0])) {
35
+ $options[0]['label'] = Mage::helper('dndinxmail_subscriber')->__('No column available');
36
+ }
37
+ $this->_options = $options;
38
+ }
39
+
40
+ return $this->_options;
41
+ }
42
+
43
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Inxmail/Lists.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Inxmail_Lists
13
+ {
14
+
15
+ /**
16
+ * @var
17
+ */
18
+ protected $_options;
19
+
20
+ /**
21
+ * Get all Inxmail lists
22
+ *
23
+ * @return array Inxmail lists
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ if(!$this->_options) {
28
+
29
+ Mage::helper('dndinxmail_subscriber/error')->setIsSilentError(true);
30
+ try {
31
+ $lists = Mage::helper('dndinxmail_subscriber/synchronize')->getInxmailLists();
32
+ }
33
+ catch(Exception $e) {
34
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
35
+
36
+ return array(
37
+ array(
38
+ 'value' => '',
39
+ 'label' => ''
40
+ )
41
+ );
42
+ }
43
+ Mage::helper('dndinxmail_subscriber/error')->setIsSilentError(false);
44
+
45
+ foreach($lists as $list):
46
+ $this->_options[] = array(
47
+ 'value' => $list['id'],
48
+ 'label' => $list['name']
49
+ );
50
+ endforeach;
51
+
52
+ }
53
+
54
+ return $this->_options;
55
+ }
56
+
57
+ }
app/code/community/DndInxmail/Subscriber/Model/Adminhtml/System/Config/Source/Orders.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Adminhtml_System_Config_Source_Orders
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ORDERS_SINGLE_DATE = 'single_date';
19
+ /**
20
+ *
21
+ */
22
+ const DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ORDERS_RANGE_DATE = 'range_date';
23
+
24
+ /**
25
+ * Get specific group to synchronize
26
+ *
27
+ * @return array Specific groups
28
+ */
29
+ public function toOptionArray()
30
+ {
31
+ return array(
32
+ array(
33
+ 'label' => Mage::helper('dndinxmail_subscriber')->__('Last X Days'),
34
+ 'value' => self::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ORDERS_SINGLE_DATE
35
+ ),
36
+ array(
37
+ 'label' => Mage::helper('dndinxmail_subscriber')->__('Date Range'),
38
+ 'value' => self::DNDINXMAIL_MAPPING_CUSTOMER_GROUP_SPECIFIC_ORDERS_RANGE_DATE
39
+ )
40
+ );
41
+ }
42
+
43
+ }
app/code/community/DndInxmail/Subscriber/Model/Observer.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Observer
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Observer
13
+ {
14
+
15
+ /**
16
+ * Observe action when a new subscriber is created and subscribe/unsubscribe his address
17
+ *
18
+ * @param object $observer
19
+ *
20
+ * @return boolean
21
+ */
22
+ public function observeSubscriber($observer)
23
+ {
24
+ try {
25
+ if(!Mage::helper('dndinxmail_subscriber')->isDndInxmailEnabled()) return false;
26
+
27
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
28
+
29
+ $event = $observer->getEvent();
30
+ $subscriber = $event->getDataObject();
31
+ $email = $subscriber->getSubscriberEmail();
32
+ $status = $subscriber->getStatus();
33
+ $storeId = $subscriber->getStoreId();
34
+
35
+ if(!$session = $synchronize->openInxmailSession()) return false;
36
+
37
+ if(!$listid = (int)$synchronize->getSynchronizeListId($storeId)) return false;
38
+
39
+ $listContextManager = $session->getListContextManager();
40
+ $inxmailList = $listContextManager->get($listid);
41
+
42
+ Mage::helper('dndinxmail_subscriber/synchronize')->switchActionToSubscriberStatus($status, $email, true, $inxmailList);
43
+
44
+ $synchronize->closeInxmailSession();
45
+
46
+ return true;
47
+ }
48
+ catch(Exception $e) {
49
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
50
+
51
+ return false;
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Observe when a subscriber is deleted
57
+ *
58
+ * @param object $observer
59
+ *
60
+ * @return boolean
61
+ */
62
+ public function deleteSubscriber($observer)
63
+ {
64
+ try {
65
+ if(!Mage::helper('dndinxmail_subscriber')->isDndInxmailEnabled()) return false;
66
+
67
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
68
+
69
+ $event = $observer->getEvent();
70
+ $subscriber = $event->getDataObject();
71
+ $email = $subscriber->getSubscriberEmail();
72
+ $storeId = $subscriber->getStoreId();
73
+
74
+ if(!$session = $synchronize->openInxmailSession()) return false;
75
+
76
+ if(!$listid = (int)$synchronize->getSynchronizeListId($storeId)) return false;
77
+
78
+ $listContextManager = $session->getListContextManager();
79
+ $inxmailList = $listContextManager->get($listid);
80
+
81
+ Mage::helper('dndinxmail_subscriber/synchronize')->removeCustomer($email, $inxmailList);
82
+
83
+ $synchronize->closeInxmailSession();
84
+
85
+ return true;
86
+ }
87
+ catch(Exception $e) {
88
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
89
+
90
+ return false;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Synchronize unsubscribed from Inxmail to Magento
96
+ *
97
+ * @return boolean
98
+ */
99
+ public function synchronizeUnsubscribed()
100
+ {
101
+ try {
102
+ if(!Mage::helper('dndinxmail_subscriber')->isDndInxmailEnabled()) return false;
103
+
104
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
105
+ $unsubscribed = array();
106
+
107
+ foreach(Mage::app()->getWebsites() as $website) {
108
+ foreach($website->getGroups() as $group) {
109
+ $stores = $group->getStores();
110
+ foreach($stores as $store) {
111
+ $unsubscribedStore = $synchronize->getUnsubscribedCustomers($store->getStoreId());
112
+ $unsubscribed = array_merge($unsubscribedStore, $unsubscribed);
113
+ }
114
+ }
115
+ }
116
+
117
+ $synchronize->unsubscribeCustomersFromInxmail($unsubscribed);
118
+
119
+ $synchronize->unsubscribeCustomersFromGroups();
120
+
121
+ return true;
122
+ }
123
+ catch(Exception $e) {
124
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
125
+
126
+ return false;
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Synchronize customer group to Inxmail
132
+ *
133
+ * @return boolean
134
+ */
135
+ public function synchronizeCustomerGroup()
136
+ {
137
+ try {
138
+ if(!Mage::helper('dndinxmail_subscriber')->isDndInxmailEnabled()) return false;
139
+
140
+ Mage::helper('dndinxmail_subscriber/synchronize')->synchronizeCustomerGroupToInxmail();
141
+
142
+ return true;
143
+ }
144
+ catch(Exception $e) {
145
+ Mage::helper('dndinxmail_subscriber/log')->logExceptionData($e->getMessage(), __FUNCTION__);
146
+
147
+ return false;
148
+ }
149
+ }
150
+
151
+ }
app/code/community/DndInxmail/Subscriber/Model/Xml.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Model
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Barracuda
7
+ * @last_modified 13/03/2012
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Model_Xml extends Mage_Core_Model_Abstract
13
+ {
14
+
15
+ /**
16
+ * Get XML product for one product
17
+ *
18
+ * @param object $product
19
+ * @param string $type
20
+ *
21
+ * @return string $xml
22
+ */
23
+ public function getProductXml($product, $type)
24
+ {
25
+ $xml = $this->getStructureProductXml();
26
+ $iw = Mage::getStoreConfig("dndinxmail_subscriber_datasource/feed_$type/img_width");
27
+ $ih = Mage::getStoreConfig("dndinxmail_subscriber_datasource/feed_$type/img_height");
28
+
29
+ $categoryIds = $product->getCategoryIds();
30
+ $category = Mage::getModel("catalog/category")->load($categoryIds[0]);
31
+
32
+ $xml = str_replace('{{product_category}}', htmlspecialchars($category->getName()), $xml);
33
+ $xml = str_replace('{{product_id}}', htmlspecialchars($product->getId()), $xml);
34
+ $xml = str_replace('{{product_name}}', htmlspecialchars($product->getName()), $xml);
35
+ $xml = str_replace('{{product_brand}}', htmlspecialchars($product->getManufacturer()), $xml);
36
+ $xml = str_replace('{{product_description}}', htmlspecialchars($product->getShortDescription()), $xml);
37
+ $xml = str_replace('{{product_url}}', htmlspecialchars($product->getProductUrl()), $xml);
38
+ $xml = str_replace('{{product_sku}}', htmlspecialchars($product->getSku()), $xml);
39
+ $xml = str_replace('{{product_image}}', htmlspecialchars(Mage::helper('catalog/image')->init($product, 'image')->resize($iw, $ih)->__toString()), $xml);
40
+ $xml = str_replace('{{product_price}}', htmlspecialchars(Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true)), $xml);
41
+ $xml = str_replace('{{product_currency}}', htmlspecialchars(Mage::getStoreConfig('currency/options/default')), $xml);
42
+
43
+ $attributes = array_filter(explode(",", Mage::getStoreConfig("dndinxmail_subscriber_datasource/feed_$type/attributes")));
44
+
45
+ $xmlAttr = "";
46
+
47
+ if(count($attributes) != 0) {
48
+ foreach($attributes as $attribute) {
49
+ $xmlAttr .= "<" . ucfirst($attribute) . ">" . htmlspecialchars($product->getAttributeText($attribute)) . "</" . ucfirst($attribute) . ">";
50
+ }
51
+ }
52
+
53
+ $xml = str_replace('{{specificAttribute}}', $xmlAttr, $xml);
54
+
55
+ return $xml;
56
+ }
57
+
58
+ /**
59
+ * Get XML product for a list of products
60
+ *
61
+ * @param object $products
62
+ *
63
+ * @return string $xml
64
+ */
65
+ public function getListProductsXml($products, $type)
66
+ {
67
+ $xml = '<Offers>';
68
+
69
+ foreach($products as $product) {
70
+ $product = Mage::getModel("catalog/product")->load($product->getId());
71
+ $xml .= $this->getProductXml($product, $type);
72
+ }
73
+
74
+ $xml .= '</Offers>';
75
+
76
+ return $xml;
77
+ }
78
+
79
+
80
+ /**
81
+ * Get the XML structure
82
+ *
83
+ * @return string $xml
84
+ */
85
+ public function getStructureProductXml()
86
+ {
87
+ $xml = '<Offer>
88
+ <MerchantCategory>{{product_category}}</MerchantCategory>
89
+ <OfferID>{{product_id}}</OfferID>
90
+ <Name>{{product_name}}</Name>
91
+ <Brand>{{product_brand}}</Brand>
92
+ <Description>{{product_description}}</Description>
93
+ <DeepLink>{{product_url}}</DeepLink>
94
+ <ProductID>{{product_sku}}</ProductID>
95
+ <ImageUrl>{{product_image}}</ImageUrl>
96
+ <Prices>{{product_price}}</Prices>
97
+ <Currency>{{product_currency}}</Currency>
98
+ {{specificAttribute}}
99
+ </Offer>';
100
+
101
+ return $xml;
102
+ }
103
+
104
+ }
app/code/community/DndInxmail/Subscriber/controllers/Adminhtml/InxmailcolumnsController.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Controller
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Adminhtml_InxmailcolumnsController extends Mage_Adminhtml_Controller_Action
13
+ {
14
+
15
+ /**
16
+ * @return $this
17
+ */
18
+ protected function _initAction()
19
+ {
20
+ $this->loadLayout()->_addBreadcrumb(Mage::helper('adminhtml')->__('Create Inxmail columns'), Mage::helper('adminhtml')->__('Create Inxmail columns'));
21
+
22
+ return $this;
23
+ }
24
+
25
+ /**
26
+ *
27
+ */
28
+ public function indexAction()
29
+ {
30
+ $this->_forward('new');
31
+ }
32
+
33
+ /**
34
+ *
35
+ */
36
+ public function newAction()
37
+ {
38
+ $this->_initAction()->renderLayout();
39
+ }
40
+
41
+ /**
42
+ * Create a new column in Inxmail
43
+ *
44
+ * @return boolean
45
+ */
46
+ public function createAction()
47
+ {
48
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
49
+
50
+ if(!$session = $synchronize->openInxmailSession()) {
51
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dndinxmail_subscriber')->__('Inxmail session does not exist'));
52
+ $this->_redirect('*/*/new');
53
+
54
+ return false;
55
+ }
56
+
57
+ $post = $this->getRequest()->getPost();
58
+
59
+ if(!$post) {
60
+ $synchronize->closeInxmailSession();
61
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dndinxmail_subscriber')->__('No post data'));
62
+ $this->_redirect('*/*/new');
63
+
64
+ return false;
65
+ }
66
+
67
+ $namePostData = $post['column_name'];
68
+ $textLengthPostData = $post['column_length'];
69
+ $typePostData = $post['column_type'];
70
+
71
+ $name = ($namePostData != '' && $namePostData != null) ? $namePostData : 'Default';
72
+ $length = ($textLengthPostData != '' && $textLengthPostData != null) ? $textLengthPostData : 80;
73
+ $type = ($typePostData != '' && $typePostData != null) ? $typePostData : 'col_text';
74
+
75
+ switch($type) {
76
+
77
+ case 'col_text':
78
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_STRING;
79
+ break;
80
+
81
+ case 'col_date_time':
82
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_DATETIME;
83
+ break;
84
+
85
+ case 'col_date':
86
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_DATE;
87
+ break;
88
+
89
+ case 'col_time':
90
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_TIME;
91
+ break;
92
+
93
+ case 'col_int':
94
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_INTEGER;
95
+ break;
96
+
97
+ case 'col_float':
98
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_DOUBLE;
99
+ break;
100
+
101
+ case 'col_yesno':
102
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_BOOLEAN;
103
+ break;
104
+
105
+ default:
106
+ $inxmailType = Inx_Api_Recipient_Attribute::DATA_TYPE_STRING;
107
+ break;
108
+
109
+ }
110
+
111
+ try {
112
+
113
+ $result = $session->getAttributeManager()->create($name, $inxmailType, (int)$length);
114
+
115
+ if($result <= 0) {
116
+ $message = Mage::helper('dndinxmail_subscriber')->__('Column %s already exist in Inxmail', $name);
117
+ throw new Exception($message);
118
+ }
119
+
120
+ $message = Mage::helper('dndinxmail_subscriber')->__('Column %s successfully created in Inxmail', $name);
121
+ Mage::getSingleton('adminhtml/session')->addSuccess($message);
122
+ $synchronize->closeInxmailSession();
123
+ $this->_redirect('*/*/new');
124
+
125
+ return true;
126
+
127
+ }
128
+ catch(Exception $e) {
129
+ $synchronize->closeInxmailSession();
130
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
131
+ $this->_redirect('*/*/new');
132
+
133
+ return false;
134
+ }
135
+ }
136
+
137
+ }
app/code/community/DndInxmail/Subscriber/controllers/Adminhtml/SynchronizeController.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Controller
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_Adminhtml_SynchronizeController extends Mage_Adminhtml_Controller_Action
13
+ {
14
+
15
+ /**
16
+ * Synchronize all customers to Inxmail
17
+ *
18
+ * @return void
19
+ */
20
+ public function subscribersAction()
21
+ {
22
+ $hash = Mage::helper('dndinxmail_subscriber')->getHashKey();
23
+
24
+ $store = Mage::getModel('core/store')->load($this->getRequest()->getParam('store'), 'code');
25
+ if(!($store instanceof Varien_Object) || !$store->getStoreId()) {
26
+ $message = Mage::helper('dndinxmail_subscriber')->__('No store set');
27
+ Mage::getSingleton('adminhtml/session')->addError($message);
28
+ $this->_redirect('adminhtml/system_config/edit/', array('section' => 'dndinxmail_subscriber_general'));
29
+ }
30
+
31
+ if($id = $this->_setDefaultStoreBeforeRedirect()) {
32
+ Mage::app()->setCurrentStore($store->getStoreId());
33
+ $this->_redirect('dndinxmail_subscriber_front/synchronize/subscribers/', array(
34
+ 'hash' => $hash,
35
+ 'key' => '',
36
+ 'store' => $store->getStoreId()
37
+ ));
38
+ }
39
+ else {
40
+ $message = Mage::helper('dndinxmail_subscriber')->__('No default store set');
41
+ Mage::getSingleton('adminhtml/session')->addError($message);
42
+ $this->_redirect('adminhtml/system_config/edit/', array('section' => 'dndinxmail_subscriber_general'));
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Synchronize all groups to Inxmail
48
+ *
49
+ * @return void
50
+ */
51
+ public function groupsAction()
52
+ {
53
+ $hash = Mage::helper('dndinxmail_subscriber')->getHashKey();
54
+
55
+ if($id = $this->_setDefaultStoreBeforeRedirect()) {
56
+ Mage::app()->setCurrentStore($id);
57
+ $this->_redirect('dndinxmail_subscriber_front/synchronize/groups/', array(
58
+ 'hash' => $hash,
59
+ 'key' => ''
60
+ ));
61
+ }
62
+ else {
63
+ $message = Mage::helper('dndinxmail_subscriber')->__('No default store set');
64
+ Mage::getSingleton('adminhtml/session')->addError($message);
65
+ $this->_redirect('adminhtml/system_config/edit/', array('section' => 'dndinxmail_subscriber_general'));
66
+ }
67
+ }
68
+
69
+ /**
70
+ * @return bool
71
+ */
72
+ private function _setDefaultStoreBeforeRedirect()
73
+ {
74
+ $websites = Mage::app()->getWebsites(true);
75
+ foreach($websites as $website) {
76
+ if($website->getIsDefault()) {
77
+ return $website->getDefaultGroupId();
78
+ }
79
+ }
80
+
81
+ return false;
82
+ }
83
+
84
+ }
app/code/community/DndInxmail/Subscriber/controllers/LogController.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Controller
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_LogController extends Mage_Core_Controller_Front_Action
13
+ {
14
+
15
+ /**
16
+ *
17
+ */
18
+ const SYNCHRONISATION_LOG_FILE_PATTERN = '{name}_synchronisation';
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ protected $_logFile = '';
24
+
25
+ /**
26
+ * @param $name
27
+ */
28
+ private function _initLog($name)
29
+ {
30
+ $this->_logFile = str_replace('{name}', $name, self::SYNCHRONISATION_LOG_FILE_PATTERN);
31
+ }
32
+
33
+ /**
34
+ *
35
+ */
36
+ public function startAction()
37
+ {
38
+ $type = $this->getRequest()->getParam('type');
39
+ $this->_initLog($type);
40
+ $this->_log()->logData('## START ' . ucfirst($type) . ' synchronisation > ' . $this->_getNow() . ' ##', $this->_logFile);
41
+ }
42
+
43
+ /**
44
+ *
45
+ */
46
+ public function tryToCloseAction()
47
+ {
48
+ $type = $this->getRequest()->getParam('type');
49
+ $this->_initLog($type);
50
+ $this->_log()->logData('## Try to close ' . ucfirst($type) . ' synchronisation > ' . $this->_getNow(), $this->_logFile);
51
+ }
52
+
53
+ /**
54
+ *
55
+ */
56
+ public function endAction()
57
+ {
58
+ $type = $this->getRequest()->getParam('type');
59
+ $this->_initLog($type);
60
+ $this->_log()->logData('## END ' . ucfirst($type) . ' synchronisation > ' . $this->_getNow() . ' ##', $this->_logFile);
61
+ }
62
+
63
+ /**
64
+ * @return DndInxmail_Subscriber_Helper_Log
65
+ */
66
+ private function _log()
67
+ {
68
+ return Mage::helper('dndinxmail_subscriber/log');
69
+ }
70
+
71
+ /**
72
+ * @return string|Zend_Date
73
+ */
74
+ private function _getNow()
75
+ {
76
+ return $this->_formatLocaleTime(date('Y-m-d H:i:s'));
77
+ }
78
+
79
+ /**
80
+ * @param $date
81
+ *
82
+ * @return string|Zend_Date
83
+ */
84
+ private function _formatLocaleTime($date)
85
+ {
86
+ $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
87
+ $date = Mage::app()->getLocale()->date($date, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
88
+ $date = new Zend_Date($date);
89
+ $date = $date->get("YYYY-MM-dd HH:mm:ss");
90
+
91
+ return $date;
92
+ }
93
+
94
+ }
app/code/community/DndInxmail/Subscriber/controllers/MessagesController.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Controller
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_MessagesController extends Mage_Core_Controller_Front_Action
13
+ {
14
+
15
+ /**
16
+ * Launch ajax Subscribers synchronization
17
+ *
18
+ * @return void
19
+ */
20
+ public function errorAction()
21
+ {
22
+ $this->loadLayout('messages');
23
+ $this->renderLayout();
24
+ }
25
+
26
+ }
app/code/community/DndInxmail/Subscriber/controllers/SourceController.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Controller
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Barracuda
7
+ * @last_modified 13/03/2012
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_SourceController extends Mage_Core_Controller_Front_Action
13
+ {
14
+
15
+ /**
16
+ * Get XML for one product with the ID in the URL
17
+ *
18
+ * @return boolean
19
+ */
20
+ public function productAction()
21
+ {
22
+ $productId = $this->getRequest()->getParam("id");
23
+ $productSku = $this->getRequest()->getParam("sku");
24
+
25
+ if($productId || $productSku) {
26
+ $product = ($productId) ? Mage::getModel("catalog/product")->load($productId) : Mage::getModel("catalog/product")->loadByAttribute('sku', $productSku);
27
+ }
28
+ else {
29
+ echo $this->__('Product ID or SKU not found in the URL');
30
+
31
+ return false;
32
+ }
33
+
34
+ if(!$product || !$product->getId()) {
35
+ echo $this->__('No Product found');
36
+
37
+ return false;
38
+ }
39
+
40
+ $width = Mage::getStoreConfig("dndinxmail_subscriber_datasource/feed_oneproduct/img_width");
41
+ $height = Mage::getStoreConfig("dndinxmail_subscriber_datasource/feed_oneproduct/img_height");
42
+
43
+ if(!is_numeric($height) || !is_numeric($width)) {
44
+ echo $this->__('Image width and height must be integers');
45
+
46
+ return false;
47
+ }
48
+
49
+ $this->loadLayout(false);
50
+ Mage::app()->getResponse()->setHeader('Content-Type', 'text/xml', true);
51
+ $result = Mage::getModel('dndinxmail_subscriber/xml')->getProductXml($product, 'oneproduct');
52
+ Mage::app()->getResponse()->setBody($result);
53
+ $this->renderLayout();
54
+
55
+ return true;
56
+ }
57
+
58
+ /**
59
+ * Get XML for a list of 3 products. Product was filtered by a type choosen in the URL.
60
+ *
61
+ * @return boolean
62
+ */
63
+ public function listAction()
64
+ {
65
+ $type = $this->getRequest()->getParam("type");
66
+ $nbParam = $this->getRequest()->getParam("nb");
67
+ $storeId = Mage::app()->getStore()->getId();
68
+ $typeAvailable = array(
69
+ 'random',
70
+ 'new',
71
+ 'bestsell',
72
+ 'attribute',
73
+ 'category'
74
+ );
75
+ $nb = ($nbParam) ? $nbParam : Mage::getStoreConfig("dndinxmail_subscriber_datasource/feed_$type/nb");
76
+
77
+ if(!$type) {
78
+ echo $this->__('Type was not found in the URL');
79
+
80
+ return false;
81
+ }
82
+
83
+ if(!in_array($type, $typeAvailable)) {
84
+ echo $this->__('Type is not valid');
85
+
86
+ return false;
87
+ }
88
+
89
+ if(!is_numeric($nb)) {
90
+ echo $this->__('Number parameter must be an integer');
91
+
92
+ return false;
93
+ }
94
+
95
+ $products = Mage::getResourceModel('catalog/product_collection')->addStoreFilter($storeId)->addAttributeToFilter('status', 1)->addAttributeToFilter('visibility', array('in' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH));
96
+
97
+ switch($type) {
98
+
99
+ case 'random':
100
+ $products = $products->setPageSize($nb);
101
+ $products->getSelect()->order(new Zend_Db_Expr('RAND()'));
102
+ break;
103
+
104
+ case 'new':
105
+ $products->addAttributeToSort('created_at', 'desc')->setPageSize($nb);
106
+ break;
107
+
108
+ case 'bestsell':
109
+ $products = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->addOrderedQty()->setStoreId($storeId)->addStoreFilter($storeId)->addAttributeToSort('ordered_qty', 'desc')->setPageSize($nb);
110
+ $products->load();
111
+ break;
112
+
113
+ case 'attribute':
114
+ $attribute = $this->getRequest()->getParam("code");
115
+ $value = $this->getRequest()->getParam("value");
116
+ $products->addAttributeToFilter("$attribute", "$value")->setPageSize($nb);
117
+ break;
118
+
119
+ case 'category':
120
+ $categoryID = $this->getRequest()->getParam("id");
121
+ $category = Mage::getModel("catalog/category")->load($categoryID);
122
+ $products->addCategoryFilter($category)->setPageSize($nb);
123
+ break;
124
+
125
+ }
126
+
127
+ if(count($products) < $nb) {
128
+ echo $this->__('Not enough products');
129
+
130
+ return false;
131
+ }
132
+
133
+ $this->loadLayout(false);
134
+ Mage::app()->getResponse()->setHeader('Content-Type', 'text/xml', true);
135
+ $result = Mage::getModel('dndinxmail_subscriber/xml')->getListProductsXml($products, $type);
136
+ Mage::app()->getResponse()->setBody($result);
137
+ $this->renderLayout();
138
+
139
+ return true;
140
+ }
141
+
142
+ /**
143
+ * Get last bought products for specific customer
144
+ *
145
+ * @author Merlin
146
+ *
147
+ * @return boolean
148
+ */
149
+ public function lastBoughtProductsAction()
150
+ {
151
+ $type = 'lastbought';
152
+ $customerId = $this->getRequest()->getParam("id");
153
+ $nb = Mage::getStoreConfig("dndinxmail_subscriber_datasource/feed_$type/nb");
154
+
155
+ if(!$customerId) {
156
+ echo $this->__('Customer ID not found in the URL');
157
+
158
+ return false;
159
+ }
160
+
161
+ $customer = Mage::getModel('customer/customer')->load($customerId);
162
+
163
+ if(!$customer instanceof Varien_Object || !$customer->getId()) {
164
+ echo $this->__('The customer with ID %s does not exist.', $customerId);
165
+
166
+ return false;
167
+ }
168
+
169
+ $order = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('customer_id', $customerId)->addAttributeToSort('created_at', 'DESC')->setPageSize($nb);
170
+
171
+ if(!$order->getId()) {
172
+ echo $this->__('Customer with ID %s does not have order yet', $customerId);
173
+
174
+ return false;
175
+ }
176
+
177
+ $items = $order->getAllItems();
178
+
179
+ if(count($items) <= 0) {
180
+ echo $this->__('Order with ID %s does not have item', $order->getId());
181
+
182
+ return false;
183
+ }
184
+
185
+ $products = array();
186
+ foreach($items as $item) {
187
+ $productId = $item->getProductId();
188
+ $product = Mage::getModel('catalog/product')->load($productId);
189
+ if(!$product instanceof Varien_Object || !$product->getId()) continue;
190
+ $products[] = $product;
191
+ }
192
+
193
+ $this->loadLayout(false);
194
+ Mage::app()->getResponse()->setHeader('Content-Type', 'text/xml', true);
195
+ $result = Mage::getModel('dndinxmail_subscriber/xml')->getListProductsXml($products, $type);
196
+ Mage::app()->getResponse()->setBody($result);
197
+ $this->renderLayout();
198
+
199
+ return true;
200
+ }
201
+
202
+ /**
203
+ * Get related products
204
+ *
205
+ * @return boolean
206
+ */
207
+ public function relatedAction()
208
+ {
209
+ $productId = $this->getRequest()->getParam("id");
210
+ $productSku = $this->getRequest()->getParam("sku");
211
+ $type = 'related';
212
+
213
+ if(!$productId && !$productSku) {
214
+ echo $this->__('Product ID or SKU not found in the URL');
215
+
216
+ return false;
217
+ }
218
+
219
+ $product = ($productId) ? Mage::getModel("catalog/product")->load($productId) : Mage::getModel("catalog/product")->loadByAttribute('sku', $productSku);
220
+
221
+ if(!$product instanceof Varien_Object || !$product->getId()) {
222
+ echo $this->__('The product with ID %s does not exist.', $productId);
223
+
224
+ return false;
225
+ }
226
+
227
+ $collection = $product->getRelatedProductCollection()->addAttributeToSelect('required_options')->setPositionOrder()->addStoreFilter();
228
+
229
+ if(Mage::helper('catalog')->isModuleEnabled('Mage_Checkout')) {
230
+ $collection->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addUrlRewrite();
231
+ }
232
+
233
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
234
+
235
+ $collection->load();
236
+
237
+ $products = array();
238
+ foreach($collection as $product) {
239
+ $product->setDoNotUseCategoryId(true);
240
+ $products[] = $product;
241
+ }
242
+
243
+ $this->loadLayout(false);
244
+ Mage::app()->getResponse()->setHeader('Content-Type', 'text/xml', true);
245
+ $result = Mage::getModel('dndinxmail_subscriber/xml')->getListProductsXml($products, $type);
246
+ Mage::app()->getResponse()->setBody($result);
247
+ $this->renderLayout();
248
+
249
+ return true;
250
+ }
251
+
252
+ }
app/code/community/DndInxmail/Subscriber/controllers/SynchronizeController.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module Controller
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class DndInxmail_Subscriber_SynchronizeController extends Mage_Core_Controller_Front_Action
13
+ {
14
+
15
+ /**
16
+ * Launch ajax Subscribers synchronization
17
+ *
18
+ * @return void
19
+ */
20
+ public function subscribersAction()
21
+ {
22
+ $hashKey = $this->getRequest()->getParam('hash');
23
+ $isAllowed = Mage::helper('dndinxmail_subscriber')->isHashKeyAllowed($hashKey);
24
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
25
+ $subscribersHelper = Mage::helper('dndinxmail_subscriber/synchronize_subscribers');
26
+
27
+ if(!$isAllowed) {
28
+ $message = Mage::helper('dndinxmail_subscriber')->__('You are not allowed on this page.');
29
+ Mage::getSingleton('core/session')->addError($message);
30
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
31
+ }
32
+
33
+ $store = Mage::getModel('core/store')->load($this->getRequest()->getParam('store'));
34
+ if(!($store instanceof Varien_Object) || !$store->getStoreId()) {
35
+ $message = Mage::helper('dndinxmail_subscriber')->__('No store set');
36
+ Mage::getSingleton('core/session')->addError($message);
37
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
38
+ }
39
+
40
+ try {
41
+ $unsubscribedStore = $synchronize->getUnsubscribedCustomers($store->getStoreId());
42
+ $synchronize->unsubscribeCustomersFromInxmail($unsubscribedStore);
43
+ $synchronize->unsubscribeCustomersFromGroups();
44
+ }
45
+ catch(Exception $e) {
46
+ $message = Mage::helper('dndinxmail_subscriber')->__('Error synchronizing unsubscribed customers from Inxmail');
47
+ Mage::getSingleton('core/session')->addError($message);
48
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
49
+ }
50
+
51
+ $pass = $subscribersHelper->initSynchronization($store->getStoreId());
52
+
53
+ if(!isset($pass['total']) || (isset($pass['total']) && $pass['total'] == 0)) {
54
+ $message = Mage::helper('dndinxmail_subscriber')->__('No subscriber to synchronize.');
55
+ Mage::getSingleton('core/session')->addError($message);
56
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
57
+ }
58
+
59
+ try {
60
+ Mage::app()->setCurrentStore($store->getStoreId()); // Set current store for list
61
+ if(!$synchronize->truncateInxmailList()) {
62
+ $message = Mage::helper('dndinxmail_subscriber')->__('Error truncating Inxmail list.');
63
+ Mage::getSingleton('core/session')->addError($message);
64
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
65
+ }
66
+ }
67
+ catch(Exception $e) {
68
+ $message = Mage::helper('dndinxmail_subscriber')->__($e->getMessage());
69
+ Mage::getSingleton('core/session')->addError($message);
70
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
71
+ }
72
+
73
+ $pass = Zend_Json::encode($pass);
74
+
75
+ $this->loadLayout('synchronize');
76
+
77
+ $block = $this->getLayout()->createBlock('dndinxmail_subscriber/synchronization_subscribers')->setStoreSynchronize($store->getStoreId())->setPass($pass);
78
+
79
+ $this->getLayout()->getBlock('content')->append($block);
80
+ $this->renderLayout();
81
+ }
82
+
83
+ /**
84
+ *
85
+ */
86
+ public function passSubscribersAction()
87
+ {
88
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
89
+
90
+ $data = array();
91
+ $data['failed'] = 'false';
92
+ $data['msg'] = 'Success';
93
+
94
+ $store = Mage::getModel('core/store')->load($this->getRequest()->getParam('store'));
95
+ if(!($store instanceof Varien_Object) || !$store->getStoreId()) {
96
+ $data['failed'] = 'true';
97
+ $data['msg'] = "No store set";
98
+ }
99
+
100
+ if(!$session = $synchronize->openInxmailSession()) {
101
+ $data['failed'] = 'true';
102
+ $data['msg'] = "Inxmail session does not exist";
103
+ }
104
+
105
+ if(!$listid = (int)$synchronize->getSynchronizeListId($store->getStoreId())) {
106
+ $data['failed'] = 'true';
107
+ $data['msg'] = "No list defined in configuration";
108
+ }
109
+
110
+ $listContextManager = $session->getListContextManager();
111
+ $inxmailList = $listContextManager->get($listid);
112
+
113
+ $pass = $this->getRequest()->getParam('pass');
114
+ $pass = Zend_Json::decode($pass);
115
+
116
+ if($data['failed'] == 'false') {
117
+
118
+ try {
119
+
120
+ foreach($pass as $subscriber) {
121
+ $email = $subscriber['email'];
122
+ $status = $subscriber['status'];
123
+ $synchronize->switchActionToSubscriberStatus($status, $email, false, $inxmailList);
124
+ }
125
+
126
+ }
127
+ catch(Exception $e) {
128
+ $data['failed'] = 'true';
129
+ $data['msg'] = $e->getMessage();
130
+ }
131
+
132
+ }
133
+
134
+ $synchronize->closeInxmailSession();
135
+
136
+ $this->getResponse()->setBody(Zend_Json::encode($data));
137
+ }
138
+
139
+ /**
140
+ * Launch ajax groups synchronization
141
+ *
142
+ * @return void
143
+ */
144
+ public function groupsAction()
145
+ {
146
+ $hashKey = $this->getRequest()->getParam('hash');
147
+ $isAllowed = Mage::helper('dndinxmail_subscriber')->isHashKeyAllowed($hashKey);
148
+ $groupsHelper = Mage::helper('dndinxmail_subscriber/synchronize_groups');
149
+
150
+ if(!$isAllowed) {
151
+ $message = Mage::helper('dndinxmail_subscriber')->__('You are not allowed on this page.');
152
+ Mage::getSingleton('core/session')->addError($message);
153
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
154
+ }
155
+
156
+ try {
157
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
158
+ $unsubscribed = array();
159
+
160
+ foreach(Mage::app()->getWebsites() as $website) {
161
+ foreach($website->getGroups() as $group) {
162
+ $stores = $group->getStores();
163
+ foreach($stores as $store) {
164
+ $unsubscribedStore = $synchronize->getUnsubscribedCustomers($store->getStoreId());
165
+ $unsubscribed = array_merge($unsubscribedStore, $unsubscribed);
166
+ }
167
+ }
168
+ }
169
+
170
+ $synchronize->unsubscribeCustomersFromInxmail($unsubscribed);
171
+ $synchronize->unsubscribeCustomersFromGroups();
172
+
173
+ }
174
+ catch(Exception $e) {
175
+ $message = Mage::helper('dndinxmail_subscriber')->__('Error synchronizing unsubscribed customers from Inxmail');
176
+ Mage::getSingleton('core/session')->addError($message);
177
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
178
+ }
179
+
180
+ $pass = $groupsHelper->initSynchronization();
181
+
182
+ if(!isset($pass['total']) || (isset($pass['total']) && $pass['total'] == 0)) {
183
+ $message = Mage::helper('dndinxmail_subscriber')->__('No customer to synchronize.');
184
+ Mage::getSingleton('core/session')->addError($message);
185
+ $this->_redirect('dndinxmail_subscriber_front/messages/error/');
186
+ }
187
+
188
+ $pass = Zend_Json::encode($pass);
189
+
190
+ $this->loadLayout('synchronize');
191
+
192
+ $block = $this->getLayout()->createBlock('dndinxmail_subscriber/synchronization_groups')->setPass($pass);
193
+
194
+ $this->getLayout()->getBlock('content')->append($block);
195
+ $this->renderLayout();
196
+ }
197
+
198
+ /**
199
+ *
200
+ */
201
+ public function passGroupsAction()
202
+ {
203
+ $synchronize = Mage::helper('dndinxmail_subscriber/synchronize');
204
+ $data = array();
205
+ $data['failed'] = 'false';
206
+ $data['msg'] = 'Success';
207
+
208
+ if(!$session = $synchronize->openInxmailSession()) {
209
+ $data['failed'] = 'true';
210
+ $data['msg'] = "Inxmail session does not exist";
211
+ }
212
+
213
+ $firstPass = $this->getRequest()->getParam('first');
214
+ $pass = $this->getRequest()->getParam('pass');
215
+ $pass = Zend_Json::decode($pass);
216
+
217
+ if($data['failed'] == 'false') {
218
+
219
+ try {
220
+
221
+ $contextListManager = $session->getListContextManager();
222
+ $listName = $this->getRequest()->getParam('list');
223
+ if(!$list = $contextListManager->findByName($listName)) {
224
+ $list = $contextListManager->createStandardList();
225
+ $list->updateName($listName);
226
+ $list->commitUpdate();
227
+ }
228
+ else {
229
+ if($firstPass == 'true') $synchronize->truncateSpecificInxmailList($list);
230
+ }
231
+
232
+ foreach($pass as $email) {
233
+ $synchronize->subscribeCustomer($email, false, $list);
234
+ }
235
+
236
+ }
237
+ catch(Exception $e) {
238
+ $data['failed'] = 'true';
239
+ $data['msg'] = $e->getMessage();
240
+ }
241
+
242
+ }
243
+
244
+ $synchronize->closeInxmailSession();
245
+
246
+ $this->getResponse()->setBody(Zend_Json::encode($data));
247
+ }
248
+
249
+ }
app/code/community/DndInxmail/Subscriber/etc/adminhtml.xml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Module Configuration
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+
14
+ <config>
15
+ <acl>
16
+ <resources>
17
+ <all>
18
+ <title>Allow Everything</title>
19
+ </all>
20
+ <admin>
21
+ <children>
22
+ <system>
23
+ <children>
24
+ <config>
25
+ <children>
26
+ <dndinxmail translate="title" module="dndinxmail_subscriber">
27
+ <title>DndInxmail Section</title>
28
+ </dndinxmail>
29
+ </children>
30
+ <children>
31
+ <dndinxmail_subscriber_general>
32
+ <title>DndInxmail Subscriber - General</title>
33
+ </dndinxmail_subscriber_general>
34
+ <dndinxmail_subscriber_mapping>
35
+ <title>DndInxmail Subscriber - Mapping</title>
36
+ </dndinxmail_subscriber_mapping>
37
+ <dndinxmail_subscriber_datasource>
38
+ <title>DndInxmail Subscriber - Datasource</title>
39
+ </dndinxmail_subscriber_datasource>
40
+ <dndinxmail_subscriber_crons>
41
+ <title>DndInxmail Subscriber - Crons</title>
42
+ </dndinxmail_subscriber_crons>
43
+ </children>
44
+ </config>
45
+ </children>
46
+ </system>
47
+ </children>
48
+ </admin>
49
+ </resources>
50
+ </acl>
51
+ <menu>
52
+ <dndinxmail module="dndinxmail_subscriber" translate="title">
53
+ <title>Inxmail</title>
54
+ <sort_order>70</sort_order>
55
+ <children>
56
+ <dndinxmail_subscriber_configuration>
57
+ <title>Configuration</title>
58
+ <sort_order>10</sort_order>
59
+ <children>
60
+ <dndinxmail_subscriber_general>
61
+ <title>General</title>
62
+ <sort_order>10</sort_order>
63
+ <action>adminhtml/system_config/edit/section/dndinxmail_subscriber_general/</action>
64
+ </dndinxmail_subscriber_general>
65
+ <dndinxmail_subscriber_mapping>
66
+ <title>Mapping</title>
67
+ <sort_order>20</sort_order>
68
+ <action>adminhtml/system_config/edit/section/dndinxmail_subscriber_mapping/</action>
69
+ </dndinxmail_subscriber_mapping>
70
+ <dndinxmail_subscriber_datasource>
71
+ <title>Datasource</title>
72
+ <sort_order>30</sort_order>
73
+ <action>adminhtml/system_config/edit/section/dndinxmail_subscriber_datasource/</action>
74
+ </dndinxmail_subscriber_datasource>
75
+ <dndinxmail_subscriber_crons>
76
+ <title>Crons</title>
77
+ <sort_order>40</sort_order>
78
+ <action>adminhtml/system_config/edit/section/dndinxmail_subscriber_crons/</action>
79
+ </dndinxmail_subscriber_crons>
80
+ </children>
81
+ </dndinxmail_subscriber_configuration>
82
+ <dndinxmail_subscriber_columns>
83
+ <title>Create Inxmail column</title>
84
+ <sort_order>20</sort_order>
85
+ <action>adminhtml/inxmailcolumns/new/</action>
86
+ </dndinxmail_subscriber_columns>
87
+ </children>
88
+ </dndinxmail>
89
+ </menu>
90
+ </config>
app/code/community/DndInxmail/Subscriber/etc/config.xml ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Module Configuration
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+
14
+ <config>
15
+ <modules>
16
+ <DndInxmail_Subscriber>
17
+ <version>3.1.0.0</version>
18
+ </DndInxmail_Subscriber>
19
+ </modules>
20
+ <global>
21
+ <models>
22
+ <dndinxmail_subscriber>
23
+ <class>DndInxmail_Subscriber_Model</class>
24
+ </dndinxmail_subscriber>
25
+ </models>
26
+ <blocks>
27
+ <dndinxmail_subscriber>
28
+ <class>DndInxmail_Subscriber_Block</class>
29
+ </dndinxmail_subscriber>
30
+ </blocks>
31
+ <helpers>
32
+ <dndinxmail_subscriber>
33
+ <class>DndInxmail_Subscriber_Helper</class>
34
+ </dndinxmail_subscriber>
35
+ </helpers>
36
+ <events>
37
+ <newsletter_subscriber_delete_before>
38
+ <observers>
39
+ <dndinxmail_subscriber_synchronize_subscriber>
40
+ <class>dndinxmail_subscriber/observer</class>
41
+ <method>deleteSubscriber</method>
42
+ </dndinxmail_subscriber_synchronize_subscriber>
43
+ </observers>
44
+ </newsletter_subscriber_delete_before>
45
+ <newsletter_subscriber_save_commit_after>
46
+ <observers>
47
+ <dndinxmail_subscriber_synchronize_subscriber>
48
+ <class>dndinxmail_subscriber/observer</class>
49
+ <method>observeSubscriber</method>
50
+ </dndinxmail_subscriber_synchronize_subscriber>
51
+ </observers>
52
+ </newsletter_subscriber_save_commit_after>
53
+ </events>
54
+ </global>
55
+ <frontend>
56
+ <routers>
57
+ <dndinxmail_subscriber>
58
+ <use>standard</use>
59
+ <args>
60
+ <module>DndInxmail_Subscriber</module>
61
+ <frontName>inxmail_datasource</frontName>
62
+ </args>
63
+ </dndinxmail_subscriber>
64
+ <dndinxmail_subscriber_front>
65
+ <use>standard</use>
66
+ <args>
67
+ <module>DndInxmail_Subscriber</module>
68
+ <frontName>dndinxmail_subscriber</frontName>
69
+ </args>
70
+ </dndinxmail_subscriber_front>
71
+ </routers>
72
+ <layout>
73
+ <updates>
74
+ <dndinxmail_subscriber>
75
+ <file>dndinxmail.xml</file>
76
+ </dndinxmail_subscriber>
77
+ </updates>
78
+ </layout>
79
+ </frontend>
80
+ <adminhtml>
81
+ <translate>
82
+ <modules>
83
+ <DndInxmail_Subscriber>
84
+ <files>
85
+ <default>DndInxmail_Subscriber.csv</default>
86
+ </files>
87
+ </DndInxmail_Subscriber>
88
+ </modules>
89
+ </translate>
90
+ <layout>
91
+ <updates>
92
+ <dndinxmail_subscriber>
93
+ <file>dndinxmail.xml</file>
94
+ </dndinxmail_subscriber>
95
+ </updates>
96
+ </layout>
97
+ </adminhtml>
98
+ <admin>
99
+ <routers>
100
+ <adminhtml>
101
+ <args>
102
+ <modules>
103
+ <DndInxmail_Subscriber_Adminhtml before="Mage_Adminhtml">DndInxmail_Subscriber_Adminhtml</DndInxmail_Subscriber_Adminhtml>
104
+ </modules>
105
+ </args>
106
+ </adminhtml>
107
+ </routers>
108
+ </admin>
109
+ <default>
110
+ <dndinxmail_subscriber_general>
111
+ <syncrhonize_subscribers>
112
+ <subscribers_per_pass>50</subscribers_per_pass>
113
+ </syncrhonize_subscribers>
114
+ </dndinxmail_subscriber_general>
115
+ <dndinxmail_subscriber_crons>
116
+ <crons_synchronize_groups>
117
+ <customers_per_pass>50</customers_per_pass>
118
+ </crons_synchronize_groups>
119
+ </dndinxmail_subscriber_crons>
120
+ <dndinxmail_subscriber_datasource>
121
+ <feed_oneproduct>
122
+ <img_width>100</img_width>
123
+ <img_height>100</img_height>
124
+ </feed_oneproduct>
125
+ <feed_new>
126
+ <img_width>100</img_width>
127
+ <img_height>100</img_height>
128
+ <nb>3</nb>
129
+ </feed_new>
130
+ <feed_random>
131
+ <img_width>100</img_width>
132
+ <img_height>100</img_height>
133
+ <nb>3</nb>
134
+ </feed_random>
135
+ <feed_bestsell>
136
+ <img_width>100</img_width>
137
+ <img_height>100</img_height>
138
+ <nb>3</nb>
139
+ </feed_bestsell>
140
+ <feed_attribute>
141
+ <img_width>100</img_width>
142
+ <img_height>100</img_height>
143
+ <nb>3</nb>
144
+ </feed_attribute>
145
+ <feed_category>
146
+ <img_width>100</img_width>
147
+ <img_height>100</img_height>
148
+ <nb>3</nb>
149
+ </feed_category>
150
+ <feed_lastbought>
151
+ <img_width>100</img_width>
152
+ <img_height>100</img_height>
153
+ <nb>3</nb>
154
+ </feed_lastbought>
155
+ <feed_related>
156
+ <img_width>100</img_width>
157
+ <img_height>100</img_height>
158
+ <nb>3</nb>
159
+ </feed_related>
160
+ </dndinxmail_subscriber_datasource>
161
+ <dndinxmail_subscriber_mapping>
162
+ <mapping_groups>
163
+ <customer_limit_specific_groups>10</customer_limit_specific_groups>
164
+ <customer_config_last_customers>30</customer_config_last_customers>
165
+ <customer_config_best_customers>1000</customer_config_best_customers>
166
+ <customer_config_abandonned_carts>30</customer_config_abandonned_carts>
167
+ <customer_config_orders_options>single_date</customer_config_orders_options>
168
+ <customer_config_orders_options_single_date>30</customer_config_orders_options_single_date>
169
+ </mapping_groups>
170
+ </dndinxmail_subscriber_mapping>
171
+ </default>
172
+ <crontab>
173
+ <jobs>
174
+ <dndinxmail_subscriber_synchronize_unsubscribed>
175
+ <schedule>
176
+ <cron_expr>0 * * * *</cron_expr>
177
+ </schedule>
178
+ <run>
179
+ <model>dndinxmail_subscriber/observer::synchronizeUnsubscribed</model>
180
+ </run>
181
+ </dndinxmail_subscriber_synchronize_unsubscribed>
182
+ <dndinxmail_subscriber_synchronize_customer_group>
183
+ <schedule>
184
+ <cron_expr>0 1 * * *</cron_expr>
185
+ </schedule>
186
+ <run>
187
+ <model>dndinxmail_subscriber/observer::synchronizeCustomerGroup</model>
188
+ </run>
189
+ </dndinxmail_subscriber_synchronize_customer_group>
190
+ </jobs>
191
+ </crontab>
192
+ </config>
app/code/community/DndInxmail/Subscriber/etc/system.xml ADDED
@@ -0,0 +1,841 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Module System Config
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+
14
+ <config>
15
+ <tabs>
16
+ <dndinxmail translate="label" module="dndinxmail_subscriber">
17
+ <label>Inxmail Subscriber</label>
18
+ <sort_order>100</sort_order>
19
+ </dndinxmail>
20
+ </tabs>
21
+ <sections>
22
+ <dndinxmail_subscriber_general module="dndinxmail_subscriber">
23
+ <label>General</label>
24
+ <tab>dndinxmail</tab>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>10</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <groups>
31
+ <api translate="label">
32
+ <label>API</label>
33
+ <sort_order>10</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>0</show_in_store>
37
+ <fields>
38
+ <url translate="label">
39
+ <label>API Url</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </url>
46
+ <user translate="label">
47
+ <label>API User</label>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>20</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </user>
54
+ <password translate="label">
55
+ <label>API Password</label>
56
+ <frontend_type>password</frontend_type>
57
+ <sort_order>30</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </password>
62
+ </fields>
63
+ </api>
64
+ <general translate="label">
65
+ <label>General</label>
66
+ <sort_order>20</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <fields>
71
+ <active>
72
+ <label>Enabled</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>adminhtml/system_config_source_yesno</source_model>
75
+ <sort_order>10</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>0</show_in_store>
79
+ </active>
80
+ <inxmail_list translate="label comment">
81
+ <label>Inxmail List</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_lists</source_model>
84
+ <comment>Select your Inxmail list</comment>
85
+ <sort_order>20</sort_order>
86
+ <show_in_default>0</show_in_default>
87
+ <show_in_website>0</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </inxmail_list>
90
+ </fields>
91
+ </general>
92
+ <syncrhonize_subscribers translate="label">
93
+ <label>Subscribers synchronization</label>
94
+ <sort_order>30</sort_order>
95
+ <show_in_default>0</show_in_default>
96
+ <show_in_website>0</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ <comment>Subscribers synchronization is only available on the store view configuration of your website.</comment>
99
+ <fields>
100
+ <synchronize_all translate="label comment">
101
+ <label>Synchronize All Subscribers</label>
102
+ <frontend_type>button</frontend_type>
103
+ <frontend_model>dndinxmail_subscriber/adminhtml_system_config_form_button_subscribers</frontend_model>
104
+ <comment>Synchronize all Magento subscribers to Inxmail</comment>
105
+ <sort_order>10</sort_order>
106
+ <show_in_default>0</show_in_default>
107
+ <show_in_website>0</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </synchronize_all>
110
+ <subscribers_per_pass translate="label comment">
111
+ <label>Subscribers per pass</label>
112
+ <frontend_type>text</frontend_type>
113
+ <sort_order>20</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </subscribers_per_pass>
118
+ </fields>
119
+ </syncrhonize_subscribers>
120
+ </groups>
121
+ </dndinxmail_subscriber_general>
122
+ <dndinxmail_subscriber_mapping module="dndinxmail_subscriber">
123
+ <label>Mapping</label>
124
+ <tab>dndinxmail</tab>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>20</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ <groups>
131
+ <mapping_customer>
132
+ <label>Mapping Customer Fields</label>
133
+ <sort_order>30</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>0</show_in_store>
137
+ <fields>
138
+ <entity_id>
139
+ <label>Customer ID</label>
140
+ <frontend_type>select</frontend_type>
141
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_int</source_model>
142
+ <sort_order>10</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ <comment>Type Integer</comment>
147
+ </entity_id>
148
+ <prefix>
149
+ <label>Prefix</label>
150
+ <frontend_type>select</frontend_type>
151
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_text</source_model>
152
+ <sort_order>15</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ <comment>Type Text</comment>
157
+ </prefix>
158
+ <firstname>
159
+ <label>Firstname</label>
160
+ <frontend_type>select</frontend_type>
161
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_text</source_model>
162
+ <sort_order>20</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ <comment>Type Text</comment>
167
+ </firstname>
168
+ <lastname>
169
+ <label>Lastname</label>
170
+ <frontend_type>select</frontend_type>
171
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_text</source_model>
172
+ <sort_order>30</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>1</show_in_store>
176
+ <comment>Type Text</comment>
177
+ </lastname>
178
+ <group_id>
179
+ <label>Group ID</label>
180
+ <frontend_type>select</frontend_type>
181
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_int</source_model>
182
+ <sort_order>40</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ <comment>Type Integer</comment>
187
+ </group_id>
188
+ <website_id>
189
+ <label>Website ID</label>
190
+ <frontend_type>select</frontend_type>
191
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_int</source_model>
192
+ <sort_order>50</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ <show_in_store>1</show_in_store>
196
+ <comment>Type Integer</comment>
197
+ </website_id>
198
+ <store_id>
199
+ <label>Store ID</label>
200
+ <frontend_type>select</frontend_type>
201
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_int</source_model>
202
+ <sort_order>60</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>1</show_in_store>
206
+ <comment>Type Integer</comment>
207
+ </store_id>
208
+ <created_at>
209
+ <label>Creation Date</label>
210
+ <frontend_type>select</frontend_type>
211
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_dateonly</source_model>
212
+ <sort_order>70</sort_order>
213
+ <show_in_default>1</show_in_default>
214
+ <show_in_website>1</show_in_website>
215
+ <show_in_store>1</show_in_store>
216
+ <comment>Type Date only</comment>
217
+ </created_at>
218
+ <updated_at>
219
+ <label>Update Date</label>
220
+ <frontend_type>select</frontend_type>
221
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_dateonly</source_model>
222
+ <sort_order>80</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>1</show_in_store>
226
+ <comment>Type Date only</comment>
227
+ </updated_at>
228
+ <is_active>
229
+ <label>Customer is active</label>
230
+ <frontend_type>select</frontend_type>
231
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_yesno</source_model>
232
+ <sort_order>90</sort_order>
233
+ <show_in_default>1</show_in_default>
234
+ <show_in_website>1</show_in_website>
235
+ <show_in_store>1</show_in_store>
236
+ <comment>Type Yes/No</comment>
237
+ </is_active>
238
+ </fields>
239
+ </mapping_customer>
240
+ <mapping_dynamics>
241
+ <label>Mapping Dynamic Fields</label>
242
+ <sort_order>40</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>1</show_in_website>
245
+ <show_in_store>0</show_in_store>
246
+ <fields>
247
+ <first_order>
248
+ <label>First Order</label>
249
+ <frontend_type>select</frontend_type>
250
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_dateonly</source_model>
251
+ <sort_order>10</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ <comment>Type Date only</comment>
256
+ </first_order>
257
+ <last_order>
258
+ <label>Last Order</label>
259
+ <frontend_type>select</frontend_type>
260
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_dateonly</source_model>
261
+ <sort_order>20</sort_order>
262
+ <show_in_default>1</show_in_default>
263
+ <show_in_website>1</show_in_website>
264
+ <show_in_store>1</show_in_store>
265
+ <comment>Type Date only</comment>
266
+ </last_order>
267
+ <total_orders>
268
+ <label>Total Orders</label>
269
+ <frontend_type>select</frontend_type>
270
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_int</source_model>
271
+ <sort_order>30</sort_order>
272
+ <show_in_default>1</show_in_default>
273
+ <show_in_website>1</show_in_website>
274
+ <show_in_store>1</show_in_store>
275
+ <comment>Type Integer</comment>
276
+ </total_orders>
277
+ <avg_orders>
278
+ <label>AVG Orders</label>
279
+ <frontend_type>select</frontend_type>
280
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_float</source_model>
281
+ <sort_order>40</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ <comment>Type Float</comment>
286
+ </avg_orders>
287
+ <last_connection>
288
+ <label>Last Connection</label>
289
+ <frontend_type>select</frontend_type>
290
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_inxmail_columns_type_dateonly</source_model>
291
+ <sort_order>50</sort_order>
292
+ <show_in_default>1</show_in_default>
293
+ <show_in_website>1</show_in_website>
294
+ <show_in_store>1</show_in_store>
295
+ <comment>Type Date only</comment>
296
+ </last_connection>
297
+ </fields>
298
+ </mapping_dynamics>
299
+ <mapping_groups>
300
+ <label>Mapping Customer Group</label>
301
+ <sort_order>50</sort_order>
302
+ <show_in_default>1</show_in_default>
303
+ <show_in_website>1</show_in_website>
304
+ <show_in_store>0</show_in_store>
305
+ <fields>
306
+ <customer_group>
307
+ <label>Customer Group</label>
308
+ <frontend_type>multiselect</frontend_type>
309
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_group</source_model>
310
+ <backend_model>dndinxmail_subscriber/adminhtml_system_config_backend_customer_group</backend_model>
311
+ <sort_order>10</sort_order>
312
+ <show_in_default>1</show_in_default>
313
+ <show_in_website>1</show_in_website>
314
+ <show_in_store>1</show_in_store>
315
+ </customer_group>
316
+ <customer_limit_specific_groups>
317
+ <label>Specific groups customer limit</label>
318
+ <frontend_type>text</frontend_type>
319
+ <sort_order>20</sort_order>
320
+ <show_in_default>1</show_in_default>
321
+ <show_in_website>1</show_in_website>
322
+ <show_in_store>1</show_in_store>
323
+ </customer_limit_specific_groups>
324
+
325
+ <customer_config_last_customers>
326
+ <label>Last customers</label>
327
+ <frontend_type>text</frontend_type>
328
+ <comment>Get last customers since X days</comment>
329
+ <sort_order>30</sort_order>
330
+ <show_in_default>1</show_in_default>
331
+ <show_in_website>1</show_in_website>
332
+ <show_in_store>1</show_in_store>
333
+ </customer_config_last_customers>
334
+ <customer_config_best_customers>
335
+ <label>Best customers</label>
336
+ <frontend_type>text</frontend_type>
337
+ <comment>Get customers whose sum of all orders is superior to X</comment>
338
+ <sort_order>40</sort_order>
339
+ <show_in_default>1</show_in_default>
340
+ <show_in_website>1</show_in_website>
341
+ <show_in_store>1</show_in_store>
342
+ </customer_config_best_customers>
343
+ <customer_config_abandonned_carts>
344
+ <label>Abandonned carts</label>
345
+ <frontend_type>text</frontend_type>
346
+ <comment>Get abandonned carts' customer since X days</comment>
347
+ <sort_order>50</sort_order>
348
+ <show_in_default>1</show_in_default>
349
+ <show_in_website>1</show_in_website>
350
+ <show_in_store>1</show_in_store>
351
+ </customer_config_abandonned_carts>
352
+
353
+ <customer_config_orders_options>
354
+ <label>Orders configuration</label>
355
+ <frontend_type>select</frontend_type>
356
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_orders</source_model>
357
+ <comment>Configuration to get orders</comment>
358
+ <sort_order>60</sort_order>
359
+ <show_in_default>1</show_in_default>
360
+ <show_in_website>1</show_in_website>
361
+ <show_in_store>1</show_in_store>
362
+ </customer_config_orders_options>
363
+
364
+ <customer_config_orders_options_single_date>
365
+ <label>Orders configuration: Last X Days</label>
366
+ <frontend_type>text</frontend_type>
367
+ <comment>Get orders since X days</comment>
368
+ <sort_order>70</sort_order>
369
+ <show_in_default>1</show_in_default>
370
+ <show_in_website>1</show_in_website>
371
+ <show_in_store>1</show_in_store>
372
+ </customer_config_orders_options_single_date>
373
+ <customer_config_orders_options_date_range_from>
374
+ <label>Orders configuration: Date range From</label>
375
+ <frontend_type>text</frontend_type>
376
+ <frontend_model>dndinxmail_subscriber/adminhtml_system_config_date</frontend_model>
377
+ <backend_model>dndinxmail_subscriber/adminhtml_system_config_backend_date</backend_model>
378
+ <comment>Get orders of specific date range (from)</comment>
379
+ <sort_order>80</sort_order>
380
+ <show_in_default>1</show_in_default>
381
+ <show_in_website>1</show_in_website>
382
+ <show_in_store>1</show_in_store>
383
+ </customer_config_orders_options_date_range_from>
384
+ <customer_config_orders_options_date_range_to>
385
+ <label>Orders configuration: Date range to</label>
386
+ <frontend_type>text</frontend_type>
387
+ <frontend_model>dndinxmail_subscriber/adminhtml_system_config_date</frontend_model>
388
+ <backend_model>dndinxmail_subscriber/adminhtml_system_config_backend_date</backend_model>
389
+ <comment>Get orders of specific date range (to)</comment>
390
+ <sort_order>90</sort_order>
391
+ <show_in_default>1</show_in_default>
392
+ <show_in_website>1</show_in_website>
393
+ <show_in_store>1</show_in_store>
394
+ </customer_config_orders_options_date_range_to>
395
+
396
+ </fields>
397
+ </mapping_groups>
398
+ </groups>
399
+ </dndinxmail_subscriber_mapping>
400
+ <dndinxmail_subscriber_datasource module="dndinxmail_subscriber">
401
+ <label>Datasource</label>
402
+ <tab>dndinxmail</tab>
403
+ <frontend_type>text</frontend_type>
404
+ <sort_order>30</sort_order>
405
+ <show_in_default>1</show_in_default>
406
+ <show_in_website>1</show_in_website>
407
+ <show_in_store>1</show_in_store>
408
+ <groups>
409
+ <feed_oneproduct translate="label">
410
+ <label>Feed One Product</label>
411
+ <sort_order>10</sort_order>
412
+ <show_in_default>1</show_in_default>
413
+ <show_in_website>1</show_in_website>
414
+ <show_in_store>1</show_in_store>
415
+ <fields>
416
+ <img_width translate="label">
417
+ <label>Image Width</label>
418
+ <frontend_type>text</frontend_type>
419
+ <sort_order>0</sort_order>
420
+ <show_in_default>1</show_in_default>
421
+ <show_in_website>1</show_in_website>
422
+ <show_in_store>1</show_in_store>
423
+ </img_width>
424
+ <img_height translate="label">
425
+ <label>Image Height</label>
426
+ <frontend_type>text</frontend_type>
427
+ <sort_order>1</sort_order>
428
+ <show_in_default>1</show_in_default>
429
+ <show_in_website>1</show_in_website>
430
+ <show_in_store>1</show_in_store>
431
+ </img_height>
432
+ <attributes translate="label">
433
+ <label>Add Specific Attributes</label>
434
+ <frontend_type>multiselect</frontend_type>
435
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
436
+ <sort_order>2</sort_order>
437
+ <show_in_default>1</show_in_default>
438
+ <show_in_website>1</show_in_website>
439
+ <show_in_store>1</show_in_store>
440
+ </attributes>
441
+ </fields>
442
+ </feed_oneproduct>
443
+ <feed_new translate="label">
444
+ <label>Feed New Products</label>
445
+ <sort_order>20</sort_order>
446
+ <show_in_default>1</show_in_default>
447
+ <show_in_website>1</show_in_website>
448
+ <show_in_store>1</show_in_store>
449
+ <fields>
450
+ <img_width translate="label">
451
+ <label>Image Width</label>
452
+ <frontend_type>text</frontend_type>
453
+ <sort_order>0</sort_order>
454
+ <show_in_default>1</show_in_default>
455
+ <show_in_website>1</show_in_website>
456
+ <show_in_store>1</show_in_store>
457
+ </img_width>
458
+ <img_height translate="label">
459
+ <label>Image Height</label>
460
+ <frontend_type>text</frontend_type>
461
+ <sort_order>1</sort_order>
462
+ <show_in_default>1</show_in_default>
463
+ <show_in_website>1</show_in_website>
464
+ <show_in_store>1</show_in_store>
465
+ </img_height>
466
+ <attributes translate="label">
467
+ <label>Add Specific Attributes</label>
468
+ <frontend_type>multiselect</frontend_type>
469
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
470
+ <sort_order>2</sort_order>
471
+ <show_in_default>1</show_in_default>
472
+ <show_in_website>1</show_in_website>
473
+ <show_in_store>1</show_in_store>
474
+ </attributes>
475
+ <nb translate="label">
476
+ <label>Number Of Products In The Feed</label>
477
+ <frontend_type>text</frontend_type>
478
+ <sort_order>3</sort_order>
479
+ <show_in_default>1</show_in_default>
480
+ <show_in_website>1</show_in_website>
481
+ <show_in_store>1</show_in_store>
482
+ </nb>
483
+ </fields>
484
+ </feed_new>
485
+ <feed_random translate="label">
486
+ <label>Feed Random Products</label>
487
+ <sort_order>30</sort_order>
488
+ <show_in_default>1</show_in_default>
489
+ <show_in_website>1</show_in_website>
490
+ <show_in_store>1</show_in_store>
491
+ <fields>
492
+ <img_width translate="label">
493
+ <label>Image Width</label>
494
+ <frontend_type>text</frontend_type>
495
+ <sort_order>0</sort_order>
496
+ <show_in_default>1</show_in_default>
497
+ <show_in_website>1</show_in_website>
498
+ <show_in_store>1</show_in_store>
499
+ </img_width>
500
+ <img_height translate="label">
501
+ <label>Image Height</label>
502
+ <frontend_type>text</frontend_type>
503
+ <sort_order>1</sort_order>
504
+ <show_in_default>1</show_in_default>
505
+ <show_in_website>1</show_in_website>
506
+ <show_in_store>1</show_in_store>
507
+ </img_height>
508
+ <attributes translate="label">
509
+ <label>Add Specific Attributes</label>
510
+ <frontend_type>multiselect</frontend_type>
511
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
512
+ <sort_order>2</sort_order>
513
+ <show_in_default>1</show_in_default>
514
+ <show_in_website>1</show_in_website>
515
+ <show_in_store>1</show_in_store>
516
+ </attributes>
517
+ <nb translate="label">
518
+ <label>Number Of Products In The Feed</label>
519
+ <frontend_type>text</frontend_type>
520
+ <sort_order>3</sort_order>
521
+ <show_in_default>1</show_in_default>
522
+ <show_in_website>1</show_in_website>
523
+ <show_in_store>1</show_in_store>
524
+ </nb>
525
+ </fields>
526
+ </feed_random>
527
+ <feed_bestsell translate="label">
528
+ <label>Feed BestSell Products</label>
529
+ <sort_order>40</sort_order>
530
+ <show_in_default>1</show_in_default>
531
+ <show_in_website>1</show_in_website>
532
+ <show_in_store>1</show_in_store>
533
+ <fields>
534
+ <img_width translate="label">
535
+ <label>Image Width</label>
536
+ <frontend_type>text</frontend_type>
537
+ <sort_order>0</sort_order>
538
+ <show_in_default>1</show_in_default>
539
+ <show_in_website>1</show_in_website>
540
+ <show_in_store>1</show_in_store>
541
+ </img_width>
542
+ <img_height translate="label">
543
+ <label>Image Height</label>
544
+ <frontend_type>text</frontend_type>
545
+ <sort_order>1</sort_order>
546
+ <show_in_default>1</show_in_default>
547
+ <show_in_website>1</show_in_website>
548
+ <show_in_store>1</show_in_store>
549
+ </img_height>
550
+ <attributes translate="label">
551
+ <label>Add Specific Attributes</label>
552
+ <frontend_type>multiselect</frontend_type>
553
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
554
+ <sort_order>2</sort_order>
555
+ <show_in_default>1</show_in_default>
556
+ <show_in_website>1</show_in_website>
557
+ <show_in_store>1</show_in_store>
558
+ </attributes>
559
+ <nb translate="label">
560
+ <label>Number Of Products In The Feed</label>
561
+ <frontend_type>text</frontend_type>
562
+ <sort_order>3</sort_order>
563
+ <show_in_default>1</show_in_default>
564
+ <show_in_website>1</show_in_website>
565
+ <show_in_store>1</show_in_store>
566
+ </nb>
567
+ </fields>
568
+ </feed_bestsell>
569
+ <feed_attribute translate="label">
570
+ <label>Feed Products By Attribute</label>
571
+ <sort_order>50</sort_order>
572
+ <show_in_default>1</show_in_default>
573
+ <show_in_website>1</show_in_website>
574
+ <show_in_store>1</show_in_store>
575
+ <fields>
576
+ <img_width translate="label">
577
+ <label>Image Width</label>
578
+ <frontend_type>text</frontend_type>
579
+ <sort_order>0</sort_order>
580
+ <show_in_default>1</show_in_default>
581
+ <show_in_website>1</show_in_website>
582
+ <show_in_store>1</show_in_store>
583
+ </img_width>
584
+ <img_height translate="label">
585
+ <label>Image Height</label>
586
+ <frontend_type>text</frontend_type>
587
+ <sort_order>1</sort_order>
588
+ <show_in_default>1</show_in_default>
589
+ <show_in_website>1</show_in_website>
590
+ <show_in_store>1</show_in_store>
591
+ </img_height>
592
+ <attributes translate="label">
593
+ <label>Add Specific Attributes</label>
594
+ <frontend_type>multiselect</frontend_type>
595
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
596
+ <sort_order>2</sort_order>
597
+ <show_in_default>1</show_in_default>
598
+ <show_in_website>1</show_in_website>
599
+ <show_in_store>1</show_in_store>
600
+ </attributes>
601
+ <nb translate="label">
602
+ <label>Number Of Products In The Feed</label>
603
+ <frontend_type>text</frontend_type>
604
+ <sort_order>3</sort_order>
605
+ <show_in_default>1</show_in_default>
606
+ <show_in_website>1</show_in_website>
607
+ <show_in_store>1</show_in_store>
608
+ </nb>
609
+ </fields>
610
+ </feed_attribute>
611
+ <feed_category translate="label">
612
+ <label>Feed Products By Category</label>
613
+ <sort_order>60</sort_order>
614
+ <show_in_default>1</show_in_default>
615
+ <show_in_website>1</show_in_website>
616
+ <show_in_store>1</show_in_store>
617
+ <fields>
618
+ <img_width translate="label">
619
+ <label>Image Width</label>
620
+ <frontend_type>text</frontend_type>
621
+ <sort_order>0</sort_order>
622
+ <show_in_default>1</show_in_default>
623
+ <show_in_website>1</show_in_website>
624
+ <show_in_store>1</show_in_store>
625
+ </img_width>
626
+ <img_height translate="label">
627
+ <label>Image Height</label>
628
+ <frontend_type>text</frontend_type>
629
+ <sort_order>1</sort_order>
630
+ <show_in_default>1</show_in_default>
631
+ <show_in_website>1</show_in_website>
632
+ <show_in_store>1</show_in_store>
633
+ </img_height>
634
+ <attributes translate="label">
635
+ <label>Add Specific Attributes</label>
636
+ <frontend_type>multiselect</frontend_type>
637
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
638
+ <sort_order>2</sort_order>
639
+ <show_in_default>1</show_in_default>
640
+ <show_in_website>1</show_in_website>
641
+ <show_in_store>1</show_in_store>
642
+ </attributes>
643
+ <nb translate="label">
644
+ <label>Number Of Products In The Feed</label>
645
+ <frontend_type>text</frontend_type>
646
+ <sort_order>3</sort_order>
647
+ <show_in_default>1</show_in_default>
648
+ <show_in_website>1</show_in_website>
649
+ <show_in_store>1</show_in_store>
650
+ </nb>
651
+ </fields>
652
+ </feed_category>
653
+ <feed_lastbought translate="label">
654
+ <label>Feed Last Bought Products</label>
655
+ <sort_order>70</sort_order>
656
+ <show_in_default>1</show_in_default>
657
+ <show_in_website>1</show_in_website>
658
+ <show_in_store>1</show_in_store>
659
+ <fields>
660
+ <img_width translate="label">
661
+ <label>Image Width</label>
662
+ <frontend_type>text</frontend_type>
663
+ <sort_order>0</sort_order>
664
+ <show_in_default>1</show_in_default>
665
+ <show_in_website>1</show_in_website>
666
+ <show_in_store>1</show_in_store>
667
+ </img_width>
668
+ <img_height translate="label">
669
+ <label>Image Height</label>
670
+ <frontend_type>text</frontend_type>
671
+ <sort_order>1</sort_order>
672
+ <show_in_default>1</show_in_default>
673
+ <show_in_website>1</show_in_website>
674
+ <show_in_store>1</show_in_store>
675
+ </img_height>
676
+ <attributes translate="label">
677
+ <label>Add Specific Attributes</label>
678
+ <frontend_type>multiselect</frontend_type>
679
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
680
+ <sort_order>2</sort_order>
681
+ <show_in_default>1</show_in_default>
682
+ <show_in_website>1</show_in_website>
683
+ <show_in_store>1</show_in_store>
684
+ </attributes>
685
+ <nb translate="label">
686
+ <label>Number Of Products In The Feed</label>
687
+ <frontend_type>text</frontend_type>
688
+ <sort_order>3</sort_order>
689
+ <show_in_default>1</show_in_default>
690
+ <show_in_website>1</show_in_website>
691
+ <show_in_store>1</show_in_store>
692
+ </nb>
693
+ </fields>
694
+ </feed_lastbought>
695
+ <feed_related translate="label">
696
+ <label>Feed Related Products</label>
697
+ <sort_order>80</sort_order>
698
+ <show_in_default>1</show_in_default>
699
+ <show_in_website>1</show_in_website>
700
+ <show_in_store>1</show_in_store>
701
+ <fields>
702
+ <img_width translate="label">
703
+ <label>Image Width</label>
704
+ <frontend_type>text</frontend_type>
705
+ <sort_order>0</sort_order>
706
+ <show_in_default>1</show_in_default>
707
+ <show_in_website>1</show_in_website>
708
+ <show_in_store>1</show_in_store>
709
+ </img_width>
710
+ <img_height translate="label">
711
+ <label>Image Height</label>
712
+ <frontend_type>text</frontend_type>
713
+ <sort_order>1</sort_order>
714
+ <show_in_default>1</show_in_default>
715
+ <show_in_website>1</show_in_website>
716
+ <show_in_store>1</show_in_store>
717
+ </img_height>
718
+ <attributes translate="label">
719
+ <label>Add Specific Attributes</label>
720
+ <frontend_type>multiselect</frontend_type>
721
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_attributes</source_model>
722
+ <sort_order>2</sort_order>
723
+ <show_in_default>1</show_in_default>
724
+ <show_in_website>1</show_in_website>
725
+ <show_in_store>1</show_in_store>
726
+ </attributes>
727
+ <nb translate="label">
728
+ <label>Number Of Products In The Feed</label>
729
+ <frontend_type>text</frontend_type>
730
+ <sort_order>3</sort_order>
731
+ <show_in_default>1</show_in_default>
732
+ <show_in_website>1</show_in_website>
733
+ <show_in_store>1</show_in_store>
734
+ </nb>
735
+ </fields>
736
+ </feed_related>
737
+ </groups>
738
+ </dndinxmail_subscriber_datasource>
739
+ <dndinxmail_subscriber_crons module="dndinxmail_subscriber">
740
+ <label>Crons</label>
741
+ <tab>dndinxmail</tab>
742
+ <frontend_type>text</frontend_type>
743
+ <sort_order>40</sort_order>
744
+ <show_in_default>1</show_in_default>
745
+ <show_in_website>1</show_in_website>
746
+ <show_in_store>1</show_in_store>
747
+ <groups>
748
+ <crons_synchronize_unsubscribed>
749
+ <label>Unsubscribed synchronization</label>
750
+ <sort_order>10</sort_order>
751
+ <show_in_default>1</show_in_default>
752
+ <show_in_website>1</show_in_website>
753
+ <show_in_store>0</show_in_store>
754
+ <fields>
755
+ <enabled translate="label">
756
+ <label>Enabled</label>
757
+ <frontend_type>select</frontend_type>
758
+ <source_model>adminhtml/system_config_source_yesno</source_model>
759
+ <sort_order>2</sort_order>
760
+ <show_in_default>1</show_in_default>
761
+ <show_in_website>1</show_in_website>
762
+ <show_in_store>0</show_in_store>
763
+ </enabled>
764
+ <time translate="label">
765
+ <label>Start Time</label>
766
+ <frontend_type>time</frontend_type>
767
+ <sort_order>3</sort_order>
768
+ <show_in_default>1</show_in_default>
769
+ <show_in_website>1</show_in_website>
770
+ <show_in_store>0</show_in_store>
771
+ </time>
772
+ <frequency translate="label">
773
+ <label>Frequency</label>
774
+ <frontend_type>select</frontend_type>
775
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_cron_frequency</source_model>
776
+ <backend_model>dndinxmail_subscriber/adminhtml_system_config_backend_cron</backend_model>
777
+ <sort_order>4</sort_order>
778
+ <show_in_default>1</show_in_default>
779
+ <show_in_website>1</show_in_website>
780
+ <show_in_store>0</show_in_store>
781
+ </frequency>
782
+ </fields>
783
+ </crons_synchronize_unsubscribed>
784
+ <crons_synchronize_groups>
785
+ <label>Customer groups synchronization</label>
786
+ <sort_order>20</sort_order>
787
+ <show_in_default>1</show_in_default>
788
+ <show_in_website>1</show_in_website>
789
+ <show_in_store>0</show_in_store>
790
+ <fields>
791
+ <enabled translate="label">
792
+ <label>Enabled</label>
793
+ <frontend_type>select</frontend_type>
794
+ <source_model>adminhtml/system_config_source_yesno</source_model>
795
+ <sort_order>2</sort_order>
796
+ <show_in_default>1</show_in_default>
797
+ <show_in_website>1</show_in_website>
798
+ <show_in_store>0</show_in_store>
799
+ </enabled>
800
+ <time translate="label">
801
+ <label>Start Time</label>
802
+ <frontend_type>time</frontend_type>
803
+ <sort_order>3</sort_order>
804
+ <show_in_default>1</show_in_default>
805
+ <show_in_website>1</show_in_website>
806
+ <show_in_store>0</show_in_store>
807
+ </time>
808
+ <frequency translate="label">
809
+ <label>Frequency</label>
810
+ <frontend_type>select</frontend_type>
811
+ <source_model>dndinxmail_subscriber/adminhtml_system_config_source_cron_frequency</source_model>
812
+ <backend_model>dndinxmail_subscriber/adminhtml_system_config_backend_cron</backend_model>
813
+ <sort_order>4</sort_order>
814
+ <show_in_default>1</show_in_default>
815
+ <show_in_website>1</show_in_website>
816
+ <show_in_store>0</show_in_store>
817
+ </frequency>
818
+ <synchronize_groups_manually translate="label comment">
819
+ <label>Synchronize All Groups</label>
820
+ <frontend_type>button</frontend_type>
821
+ <frontend_model>dndinxmail_subscriber/adminhtml_system_config_form_button_groups</frontend_model>
822
+ <comment>Launch manually</comment>
823
+ <sort_order>10</sort_order>
824
+ <show_in_default>1</show_in_default>
825
+ <show_in_website>1</show_in_website>
826
+ <show_in_store>0</show_in_store>
827
+ </synchronize_groups_manually>
828
+ <customers_per_pass translate="label comment">
829
+ <label>Customers per pass</label>
830
+ <frontend_type>text</frontend_type>
831
+ <sort_order>20</sort_order>
832
+ <show_in_default>1</show_in_default>
833
+ <show_in_website>1</show_in_website>
834
+ <show_in_store>0</show_in_store>
835
+ </customers_per_pass>
836
+ </fields>
837
+ </crons_synchronize_groups>
838
+ </groups>
839
+ </dndinxmail_subscriber_crons>
840
+ </sections>
841
+ </config>
app/code/community/DndInxmail/Subscriber/sql/dndinxmail_subscriber_setup/mysql4-install-1.0.0.0.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module SQL setup
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ $installer = $this;
app/code/community/DndInxmail/Subscriber/sql/dndinxmail_subscriber_setup/mysql4-upgrade-1.0.0.0-3.1.0.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Module SQL setup
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 13/03/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ $installer = $this;
14
+
15
+ $installer->startSetup();
16
+
17
+ $installer->getConnection()->addColumn($installer->getTable('newsletter/subscriber'), "email_bounced", "SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '0'");
18
+
19
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/dndinxmail.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_inxmailcolumns_new>
4
+ <reference name="content">
5
+ <block type="adminhtml/template" name="dndinxmail_form" template="dndinxmail/subscriber/system/inxmail/columns.phtml"/>
6
+ </reference>
7
+ </adminhtml_inxmailcolumns_new>
8
+ </layout>
app/design/adminhtml/default/default/template/dndinxmail/subscriber/system/config/form/button/groups.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function DndInxmailSynchronizeGroups() {
4
+ window.open("<?php echo $this->getCheckUrl() ?>");
5
+ return false;
6
+ }
7
+ //]]>
8
+ </script>
9
+
10
+ <?php echo $this->getButtonHtml() ?>
app/design/adminhtml/default/default/template/dndinxmail/subscriber/system/config/form/button/subscribers.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function DndInxmailSynchronizeSubscribers() {
4
+ window.open("<?php echo $this->getCheckUrl() ?>");
5
+ return false;
6
+ }
7
+ //]]>
8
+ </script>
9
+
10
+ <?php echo $this->getButtonHtml() ?>
app/design/adminhtml/default/default/template/dndinxmail/subscriber/system/inxmail/columns.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0" class="grid-header">
3
+ <tr>
4
+ <td><h3><?php echo Mage::helper('dndinxmail_subscriber')->__('Create Inxmail column') ?></h3></td>
5
+ <td class="a-right">
6
+ <button onclick="editForm.submit()" class="scalable save" type="button">
7
+ <span><?php echo Mage::helper('dndinxmail_subscriber')->__('Create') ?></span></button>
8
+ </td>
9
+ </tr>
10
+ </table>
11
+ </div>
12
+ <div class="entry-edit">
13
+ <form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/create') ?>">
14
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"/>
15
+ <fieldset id="my-fieldset">
16
+ <table cellspacing="0" class="form-list">
17
+
18
+ <tr>
19
+ <td class="label">
20
+ <label for="fromdate"><?php echo Mage::helper('dndinxmail_subscriber')->__('Column name') ?>
21
+ <span class="required">*</span></label>
22
+ </td>
23
+ <td class="value">
24
+ <input class="input-text required-entry" name="column_name" id="column_name" value="" type="text">
25
+ </td>
26
+ </tr>
27
+
28
+ <tr>
29
+ <td class="label">
30
+ <label for="fromdate"><?php echo Mage::helper('dndinxmail_subscriber')->__('Column length') ?></label>
31
+ </td>
32
+ <td class="value">
33
+ <input class="input-text validate-number" name="column_length" id="column_length" value="80" type="text">
34
+ </td>
35
+ </tr>
36
+
37
+ <tr>
38
+ <td class="label">
39
+ <label><?php echo Mage::helper('dndinxmail_subscriber')->__('Column type') ?></label>
40
+ </td>
41
+ <td class="value">
42
+ <input name="column_type" value="col_text" type="radio" checked="checked"> <?php echo Mage::helper('dndinxmail_subscriber')->__('Text'); ?>
43
+ <br/>
44
+ <input name="column_type" value="col_date_time" type="radio"> <?php echo Mage::helper('dndinxmail_subscriber')->__('Date and time'); ?>
45
+ <br/>
46
+ <input name="column_type" value="col_date" type="radio"> <?php echo Mage::helper('dndinxmail_subscriber')->__('Date only'); ?>
47
+ <br/>
48
+ <input name="column_type" value="col_time" type="radio"> <?php echo Mage::helper('dndinxmail_subscriber')->__('Time only'); ?>
49
+ <br/>
50
+ <input name="column_type" value="col_int" type="radio"> <?php echo Mage::helper('dndinxmail_subscriber')->__('Integer'); ?>
51
+ <br/>
52
+ <input name="column_type" value="col_float" type="radio"> <?php echo Mage::helper('dndinxmail_subscriber')->__('Float'); ?>
53
+ <br/>
54
+ <input name="column_type" value="col_yesno" type="radio"> <?php echo Mage::helper('dndinxmail_subscriber')->__('Yes / No'); ?>
55
+ </td>
56
+ </tr>
57
+
58
+ </table>
59
+ </fieldset>
60
+ </form>
61
+ </div>
62
+ <script type="text/javascript">
63
+ var editForm = new varienForm('edit_form');
64
+ </script>
app/design/frontend/base/default/layout/dndinxmail.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout>
4
+
5
+ <synchronize>
6
+ <block type="page/html" name="root" output="toHtml" template="dndinxmail/page/synchronize.phtml">
7
+
8
+ <block type="page/html_head" name="head" as="head">
9
+ <action method="addJs"><script>prototype/prototype.js</script></action>
10
+ <action method="addJs"><name>dndinxmail/synchronize.js</name></action>
11
+ <action method="addJs"><script>mage/translate.js</script></action>
12
+ <action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
13
+ <action method="addCss"><stylesheet>dndinxmail/inxmail-synchronization.css</stylesheet></action>
14
+ </block>
15
+
16
+ <block type="core/text_list" name="content" as="content" translate="label">
17
+ <label>Main Content Area</label>
18
+ </block>
19
+
20
+ </block>
21
+
22
+ </synchronize>
23
+
24
+ <messages>
25
+ <block type="page/html" name="root" output="toHtml" template="dndinxmail/page/messages.phtml">
26
+
27
+ <block type="page/html_head" name="head" as="head">
28
+ <action method="addJs"><script>mage/translate.js</script></action>
29
+ <action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
30
+ <action method="addCss"><stylesheet>dndinxmail/inxmail-synchronization.css</stylesheet></action>
31
+ </block>
32
+
33
+ <block type="core/messages" name="global_messages" as="global_messages"/>
34
+ <block type="core/messages" name="messages" as="messages"/>
35
+
36
+ </block>
37
+
38
+ </messages>
39
+
40
+ </layout>
app/design/frontend/base/default/template/dndinxmail/page/messages.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
3
+ <head>
4
+ <script type="text/javascript">
5
+ //<![CDATA[
6
+ var BASE_URL = "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>";
7
+ var BASE_URL_STORE = "<?php echo Mage::getBaseUrl(); ?>";
8
+ //]]>
9
+ </script>
10
+ <?php echo $this->getChildHtml('head') ?>
11
+ </head>
12
+ <body class="page-popup<?php echo $this->getBodyClass() ? $this->getBodyClass() : '' ?>">
13
+ <div class="synchronize-block-content">
14
+ <div class="logo-inxmail"></div>
15
+ <h1 class="title">MESSAGES</h1>
16
+
17
+ <div class="data-block">
18
+ <?php echo $this->getChildHtml('global_messages') ?>
19
+ </div>
20
+ </div>
21
+ </body>
22
+ </html>
app/design/frontend/base/default/template/dndinxmail/page/synchronize.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
3
+ <head>
4
+ <script type="text/javascript">
5
+ //<![CDATA[
6
+ var BASE_URL = "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>";
7
+ var BASE_URL_STORE = "<?php echo Mage::getBaseUrl(); ?>";
8
+ //]]>
9
+ </script>
10
+ <?php echo $this->getChildHtml('head') ?>
11
+ </head>
12
+ <body class="page-popup<?php echo $this->getBodyClass() ? $this->getBodyClass() : '' ?>">
13
+ <div class="synchronize-block-content">
14
+ <div class="logo-inxmail"></div>
15
+ <h1 class="title">DATA SYNCHRONIZATION</h1>
16
+
17
+ <div class="data-block">
18
+ <?php echo $this->getChildHtml('content') ?>
19
+ <span id="loader-sync"></span>
20
+ </div>
21
+ </div>
22
+ </body>
23
+ </html>
app/design/frontend/base/default/template/dndinxmail/synchronization/groups.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ var result = '<?php echo $this->getAllPass(); ?>';
4
+ var groups = typeof JSON !='undefined' ? JSON.parse(result) : eval('('+result+')');
5
+
6
+ window.onload = function() {
7
+ var DndInxmailSynchronize = new DndInxmail.Synchronize();
8
+ DndInxmailSynchronize.launchGroups(groups);
9
+ };
10
+ //]]>
11
+ </script>
12
+
13
+ <span id="current-group"></span>
14
+ <ul id="results">
15
+ <li id="percent"></li>
16
+ <li id="pass"></li>
17
+ </ul>
18
+ <ul id="errors"></ul>
app/design/frontend/base/default/template/dndinxmail/synchronization/subscribers.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ var result = '<?php echo $this->getAllPass(); ?>';
4
+ var subscribers = typeof JSON !='undefined' ? JSON.parse(result) : eval('('+result+')');
5
+
6
+ window.onload = function() {
7
+ var DndInxmailSynchronize = new DndInxmail.Synchronize();
8
+ DndInxmailSynchronize.launchSubscribers(subscribers, <?php echo $this->getStoreToSynchronize(); ?>);
9
+ };
10
+ //]]>
11
+ </script>
12
+ <ul id="results">
13
+ <li id="percent"></li>
14
+ <li id="pass"></li>
15
+ </ul>
16
+ <ul id="errors"></ul>
app/etc/modules/DndInxmail_Subscriber.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Module Declaration
5
+ * @package DndInxmail_Subscriber
6
+ * @dev Merlin
7
+ * @last_modified 27/02/2013
8
+ * @copyright Copyright (c) 2012 Agence Dn'D
9
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+ <config>
14
+ <modules>
15
+ <DndInxmail_Subscriber>
16
+ <active>true</active>
17
+ <codePool>community</codePool>
18
+ <depends>
19
+ <Mage_Newsletter/>
20
+ </depends>
21
+ </DndInxmail_Subscriber>
22
+ </modules>
23
+ </config>
app/locale/de_DE/DndInxmail_Subscriber.csv ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Enabled,""Aktiviert"""
2
+ "API Url,""API Url"""
3
+ "API User,""API Benutzer"""
4
+ "API Password,""API Passwort"""
5
+ "General,""Allgemein"""
6
+ "Guest,""Gast"""
7
+ "Magento subscribers are successfully synchronized to Inxmail.,""Die Newsletter-Abonnenten aus Magento wurden erfolgreich nach Inxmail synchronisiert."""
8
+ "Synchronize All Subscribers,""Alle Abonnenten synchronisieren"""
9
+ "Inxmail List,""Inxmail Mailingliste"""
10
+ "Fields to synchronize,""Felder synchronisieren"""
11
+ "Synchronize all Magento subscribers to Inxmail,""Alle Newsletter-Abonnenten nach Inxmail synchronisieren."""
12
+ "Select your Inxmail list,""Wählen Sie die Inxmail Mailingliste"""
13
+ "Mapping <strong>{customer_attribute}:{inxmail_attribute}</strong><br/><span class=notice"">If the {inxmail_attribute} is not defined, the value of {customer_attribute} will be taken</span>"",""Zuordnung <strong>{attribut_client}:{attribut_inxmail}</strong><br/><span class=""notice"">Wenn {attribut_inxmail} nicht definiert ist, wird der {attribut_client} Wert verwendet</span>"""
14
+ "Synchronize now,""Jetzt synchronisieren"""
15
+ "Disabled,""Deaktiviert"""
16
+ "No list selected,""Keine Mailingliste ausgewählt"""
17
+ "No list defined in configuration,""Keine Mailingliste in der Konfiguration definiert"""
18
+ "No column available,""Keine Spalte verfügbar"""
19
+ "No list available,""Keine Mailingliste verfügbar"""
20
+ "Inxmail session does not exist,""Inxmail-Sitzung nicht aktiv"""
21
+ "Yes,""Ja"""
22
+ "No,""Nein"""
23
+ "Inxmail API Error: %s,""Inxmail API Fehler: %s"""
24
+ "Mapping Customer Fields,""Zuordnung Kundenfelder"""
25
+ "Mapping Dynamic Fields,""Zuordnung Dynamische Felder"""
26
+ "Customer ID,""Kunden ID"""
27
+ "Website ID,""Website ID"""
28
+ "Group ID,""Gruppe ID"""
29
+ "Store ID,""Store ID"""
30
+ "Creation Date,""Erstellungsdatum"""
31
+ "Update Date,""Updatedatum"""
32
+ "Customer is active,""Kunde ist aktiv"""
33
+ "Firstname,""Vorname"""
34
+ "Lastname,""Nachname"""
35
+ "First Order,""Erste Bestellung"""
36
+ "Last Order,""Letzte Bestellung"""
37
+ "Total Orders,""Anzahl Bestellungen"""
38
+ "AVG Orders,""Durchschnittswert Bestellungen"""
39
+ "Last Connection,""Letzte Verbindung"""
40
+ "Error truncating Inxmail list,""Fehler während des Leerens der Inxmail Mailingliste"""
41
+ "Mapping Customer Group,""Zuordnung Kundengruppe"""
42
+ "Customer Group,""Kundengruppe"""
43
+ "Specific groups customer limit,""Limit Anzahl Kunden spezifische Kundengruppen"""
44
+ "Last customers (specific),""Letzter Kunde(spezifisch)"""
45
+ "Best customers (specific),""Beste Kunden(spezifisch)"""
46
+ "Customers birthday (specific),""Kunden mit Geburtstag(spezifisch)"""
47
+ "Abandonned carts (specific),""Abgebrochene Warenkörbe(spezifisch)"""
48
+ "Today orders (specific),""Heutige Bestellungen(spezifisch)"""
49
+ "You have selected the Birthday group even though the date of birth is not enabled on your shop,""Sie haben die Geburtstagsgruppe ausgewählt, obwohl das Geburtstagsdatum im Shop nicht aktiviert ist"""
50
+ "You have selected the Birthday group even though the date of birth is not enabled on your shop,""You have selected the Birthday group even though the date of birth is not enabled on your shop"""
51
+ "Image Width,""Bildbreite"""
52
+ "Image Height,""Bildhöhe"""
53
+ "Add Specific Attributes,""Spezielle Attribute hinzufügen"""
54
+ "Number Of Products In The Feed,""Anzahl der Produkte im Product Feed"""
55
+ "Unsubscribed customer synchronization,""Abgemeldete Kunden synchronisieren"""
56
+ "Customer groups synchronization,""Kundengruppen synchronisieren"""
57
+ "Frequency,""Intervall"""
58
+ "Start Time,""Startzeit"""
59
+ "Daily,""Täglich"""
60
+ "Weekly,""Wöchentlich"""
61
+ "Monthly,""Monatlich"""
62
+ "Mapping,""Zuordnung"""
63
+ "Launch manually,""Manuell starten"""
64
+ "Synchronize All Groups,""Alle Gruppen synchronisieren"""
65
+ "Customers per pass,""Kunden pro Transfer"""
66
+ "Subscribers per pass,""Abonnenten pro Transfer"""
67
+ "Subscribers synchronization,""Abonnenten-Synchronisation"""
68
+ "Create Inxmail column,""Inxmail-Spalte erstellen"""
69
+ "Create,""Erstellen"""
70
+ "Column name,""Spaltenname"""
71
+ "Column length,""Spaltenlänge"""
72
+ "Column type,""Spaltentyp"""
73
+ "Text,""Text"""
74
+ "Date and time,""Datum und Uhrzzeit"""
75
+ "Date only,""nur Datum"""
76
+ "Time only,""nur Uhrzeit"""
77
+ "Integer,""Ganzzahl"""
78
+ "Float,""Gleitkommazahl"""
79
+ "Yes / No,""Ja / Nein"""
80
+ "Subscribers synchronization is only available on the store view configuration of your website.,""Die Synchronisation der Newsletter-Abonnenten ist nur in der Konfigurationsansicht des Stores verfügbar."""
81
+ "Column %s successfully created in Inxmail,""Die Spalte %s wurde erfolgreich in Inxmail erstellt"""
82
+ "Column %s already exist in Inxmail,""Die Spalte %s ist in Inxmail bereits vorhanden"""
83
+ "No post data,""Keine Post Daten"""
84
+ "No store set,""Kein Store ausgewählt"""
85
+ "No default store set,""Kein Default Store ausgewählt"""
86
+ "You are not allowed on this page.,""Sie haben für diese Seite keine Erlaubnis."""
87
+ "No subscriber to synchronize.,""Kein Abonnent zu synchronisieren."""
88
+ "Error synchronizing unsubscribed customers from Inxmail,""Fehler beim Synchronisieren abgemeldeter Kunden von Inxmail"""
89
+ "No customer to synchronize.,""Kein Kunde zu synchronisieren."""
90
+ "Type Date only,""Typ nur Datum"""
91
+ "Type Yes/No,""Typ Ja/Nein"""
92
+ "Type Integer,""Typ Ganzzahl"""
93
+ "Type Float,""Typ Gleitkommazahl"""
94
+ "Type Text,""Typ Text"""
95
+ "Last customers,""Letzte Kunden"""
96
+ "Best customers,""Beste Kunden"""
97
+ "Abandonned carts,""Abgebrochene Warenkörbe"""
98
+ "Orders configuration,""Konfiguration Bestellungen"""
99
+ "Orders configuration: Last X Days,""Konfiguration Bestellungen: die letzten X Tage"""
100
+ "Orders configuration: Date range From,""Konfiguration Bestellungen: Anfangsdatum Bestellzeitraum"""
101
+ "Orders configuration: Date range to,""Konfiguration Bestellungen: Enddatum Bestellzeitraum"""
102
+ "Get last customers since X days,""Die letzten Kunden der letzten X Tage"""
103
+ "Get customers whose sum of all orders is superior to X,""Kunden, deren Bestellsumme höher als X ist"""
104
+ "Get abandonned carts' customer since X days,""Abgebrochene Warenkörbe von Kunden der letzten X Tage"""
105
+ "Configuration to get orders,""Konfiguration, um Bestellungen zu erhalten"""
106
+ "Get orders since X days,""Bestellungen der letzten X Tage"""
107
+ "Get orders of specific date range (from),""Bestellungen ab einem bestimmten Startdatum"""
108
+ "Get orders of specific date range (to),""Bestellungen bis zu einem bestimmten Enddatum"""
109
+ "Last X Days,""Die letzten X Tage"""
110
+ "Date Range,""Zeitraum"""
111
+ "Orders (specific),""Bestellungen (spezifisch)"""
app/locale/en_US/DndInxmail_Subscriber.csv ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Enabled","Enabled"
2
+ "API Url","API Url"
3
+ "API User","API User"
4
+ "API Password","API Password"
5
+ "General","General"
6
+ "Guest","Guest"
7
+ "Magento subscribers are successfully synchronized to Inxmail.","Magento subscribers are successfully synchronized to Inxmail"
8
+ "Synchronize All Subscribers","Synchronize All Subscribers"
9
+ "Inxmail List","Inxmail List"
10
+ "Fields to synchronize","Fields to synchronize"
11
+ "Synchronize all Magento subscribers to Inxmail","Synchronize all Magento subscribers to Inxmail"
12
+ "Select your Inxmail list","Select your Inxmail list"
13
+ "Mapping <strong>{customer_attribute}:{inxmail_attribute}</strong><br/><span class="notice">If the {inxmail_attribute} is not defined, the value of {customer_attribute} will be taken</span>","Mapping <strong>{customer_attribute}:{inxmail_attribute}</strong><br/><span class="notice">If the {inxmail_attribute} is not defined, the value of {customer_attribute} will be taken</span>"
14
+ "Synchronize now","Synchronize now"
15
+ "Disabled","Disabled"
16
+ "No list selected","No list selected"
17
+ "No list defined in configuration","No list defined in configuration"
18
+ "No column available","No column available"
19
+ "No list available","No list available"
20
+ "Inxmail session does not exist","Inxmail session does not exist"
21
+ "Yes","Yes"
22
+ "No","No"
23
+ "Inxmail API Error: %s","Inxmail API Error: %s"
24
+ "Mapping Customer Fields","Mapping Customer Fields"
25
+ "Mapping Dynamic Fields","Mapping Dynamic Fields"
26
+ "Customer ID","Customer ID"
27
+ "Website ID","Website ID"
28
+ "Group ID","Group ID"
29
+ "Store ID","Store ID"
30
+ "Creation Date","Creation Date"
31
+ "Update Date","Update Date"
32
+ "Customer is active","Customer is active"
33
+ "Firstname","Firstname"
34
+ "Lastname","Lastname"
35
+ "First Order","First Order"
36
+ "Last Order","Last Order"
37
+ "Total Orders","Total Orders"
38
+ "AVG Orders","AVG Orders"
39
+ "Last Connection","Last Connection"
40
+ `Error truncating Inxmail list","Error truncating Inxmail list"
41
+ "Customer Group","Customer Group"
42
+ "Mapping Customer Group","Mapping Customer Group"
43
+ "Specific groups customer limit","Specific groups customer limit"
44
+ "Last customers (specific)","Last customers (specific)"
45
+ "Best customers (specific)","Best customers (specific)"
46
+ "Customers birthday (specific)","Customers birthday (specific)"
47
+ "Abandonned carts (specific)","Abandonned carts (specific)"
48
+ "Today orders (specific)","Today orders (specific)"
49
+ "You have selected the Birthday group even though the date of birth is not enabled on your shop","You have selected the Birthday group even though the date of birth is not enabled on your shop"
50
+ "Image Width","Image Width"
51
+ "Image Height","Image Height"
52
+ "Add Specific Attributes","Add Specific Attributes"
53
+ "Number Of Products In The Feed","Number Of Products In The Feed"
54
+ "Unsubscribed customer synchronization","Unsubscribed customer synchronization"
55
+ "Customer groups synchronization","Customer groups synchronization"
56
+ "Frequency","Frequency"
57
+ "Start Time","Start Time"
58
+ "Daily","Daily"
59
+ "Weekly","Weekly"
60
+ "Monthly","Monthly"
61
+ "Mapping","Mapping"
62
+ "Launch manually","Launch manually"
63
+ "Synchronize All Groups","Synchronize All Groups"
64
+ "Customers per pass","Customers per pass"
65
+ "Subscribers per pass","Subscribers per pass"
66
+ "Subscribers synchronization","Subscribers synchronization"
67
+ "Create Inxmail column","Create Inxmail column"
68
+ "Create","Create"
69
+ "Column name","Column name"
70
+ "Column length","Column length"
71
+ "Column type","Column type"
72
+ "Text","Text"
73
+ "Date and time","Date and time"
74
+ "Date only","Date only"
75
+ "Time only","Time only"
76
+ "Integer","Integer"
77
+ "Float","Float"
78
+ "Yes / No","Yes / No"
79
+ "Subscribers synchronization is only available on the store view configuration of your website.","Subscribers synchronization is only available on the store view configuration of your website."
80
+ "Column %s successfully created in Inxmail","Column %s successfully created in Inxmail"
81
+ "Column %s already exist in Inxmail","Column %s already exist in Inxmail"
82
+ "No post data","No post data"
83
+ "No store set","No store set"
84
+ "No default store set","No default store set"
85
+ "You are not allowed on this page.","You are not allowed on this page."
86
+ "No subscriber to synchronize.","No subscriber to synchronize."
87
+ "Error synchronizing unsubscribed customers from Inxmail","Error synchronizing unsubscribed customers from Inxmail"
88
+ "No customer to synchronize.","No customer to synchronize."
89
+ "Type Date only","Type Date only"
90
+ "Type Yes/No","Type Yes/No"
91
+ "Type Integer","Type Integer"
92
+ "Type Float","Type Float"
93
+ "Type Text","Type Text"
94
+ "Last customers","Last customers"
95
+ "Best customers","Best customers"
96
+ "Abandonned carts","Abandonned carts"
97
+ "Orders configuration","Orders configuration"
98
+ "Orders configuration: Last X Days","Orders configuration: Last X Days"
99
+ "Orders configuration: Date range From","Orders configuration: Date range From"
100
+ "Orders configuration: Date range to","Orders configuration: Date range to"
101
+ "Get last customers since X days","Get last customers since X days"
102
+ "Get customers whose sum of all orders is superior to X","Get customers whose sum of all orders is superior to X"
103
+ "Get abandonned carts' customer since X days","Get abandonned carts' customer since X days"
104
+ "Configuration to get orders","Configuration to get orders"
105
+ "Get orders since X days","Get orders since X days"
106
+ "Get orders of specific date range (from)","Get orders of specific date range (from)"
107
+ "Get orders of specific date range (to)","Get orders of specific date range (to)"
108
+ "Last X Days","Last X Days"
109
+ "Date Range","Date Range"
110
+ "Orders (specific)","Orders (specific)"
app/locale/fr_FR/DndInxmail_Subscriber.csv ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Enabled","Activé"
2
+ "API Url","Url API"
3
+ "API User","Utilisateur API"
4
+ "API Password","Mot de passe API"
5
+ "General","Général"
6
+ "Guest","Invité"
7
+ "Magento subscribers are successfully synchronized to Inxmail.","Les inscrits à la newsletter de votre site ont été correctement synchronisés vers Inxmail"
8
+ "Synchronize All Subscribers","Synchroniser tous les inscrits"
9
+ "Inxmail List","Liste Inxmail"
10
+ "Fields to synchronize","Champs à synchroniser"
11
+ "Synchronize all Magento subscribers to Inxmail","Synchroniser tous vos inscrits à la newsletter vers Inxmail"
12
+ "Select your Inxmail list","Sélectionnez votre liste Inxmail"
13
+ "Mapping <strong>{customer_attribute}:{inxmail_attribute}</strong><br/><span class="notice">If the {inxmail_attribute} is not defined, the value of {customer_attribute} will be taken</span>","Mappage <strong>{attribut_client}:{attribut_inxmail}</strong><br/><span class="notice">Si {attribut_inxmail} n'est pas renseigné, la valeur de {attribut_client} sera pris par défaut</span>"
14
+ "Synchronize now","Synchroniser maintenant"
15
+ "Disabled","Désactivé"
16
+ "No list selected","Aucune liste séléctionnée"
17
+ "No list defined in configuration","Aucune liste configurée"
18
+ "No column available","Aucune colonne disponible"
19
+ "No list available","Aucune liste disponible"
20
+ "Inxmail session does not exist","Session Inxmail inexistante"
21
+ "Yes","Oui"
22
+ "No","Non"
23
+ "Inxmail API Error: %s","Erreur API Inxmail: %s"
24
+ "Mapping Customer Fields","Mappage champs clients"
25
+ "Mapping Dynamic Fields","Mappage champs dynamiques"
26
+ "Customer ID","ID client"
27
+ "Website ID","ID magasin"
28
+ "Group ID","ID groupe client"
29
+ "Store ID","ID boutique"
30
+ "Creation Date","Date de création"
31
+ "Update Date","Date de mise à jour"
32
+ "Customer is active","Client activé"
33
+ "Firstname","Prénom"
34
+ "Lastname","Nom"
35
+ "First Order","Première commande"
36
+ "Last Order","Dernière commande"
37
+ "Total Orders","Nombre total de commandes"
38
+ "AVG Orders","Montant moyen des commandes"
39
+ "Last Connection","Dernière connexion"
40
+ "Error truncating Inxmail list","Erreur pendant la purge de la liste"
41
+ "Mapping Customer Group","Mappage groupes client"
42
+ "Customer Group","Groupes client"
43
+ "Specific groups customer limit","Nombre de clients par groupes spécifiques"
44
+ "Last customers (specific)","Derniers clients (spécifique)"
45
+ "Best customers (specific)","Meilleurs clients (spécifique)"
46
+ "Customers birthday (specific)","Anniversaires clients (spécifique)"
47
+ "Abandonned carts (specific)","Paniers abandonnés (spécifique)"
48
+ "Today orders (specific)","Commandes du jour (spécifique)"
49
+ "You have selected the Birthday group even though the date of birth is not enabled on your shop","Vous avez sélectionné le groupe Anniversaire alors que la date de naissance n\'est pas activée sur votre boutique"
50
+ "You have selected the Birthday group even though the date of birth is not enabled on your shop","You have selected the Birthday group even though the date of birth is not enabled on your shop"
51
+ "Image Width","Largeur image"
52
+ "Image Height","Hauteur image"
53
+ "Add Specific Attributes","Attributs spécifiques"
54
+ "Number Of Products In The Feed","Nombre de produits dans le flux"
55
+ "Unsubscribed customer synchronization","Synchronisation des clients désinscrits"
56
+ "Customer groups synchronization","Synchronisation des groupes client"
57
+ "Frequency","Fréquence"
58
+ "Start Time","Heure de lancement"
59
+ "Daily","Quotidien"
60
+ "Weekly","Hebdomadaire"
61
+ "Monthly","Mensuel"
62
+ "Mapping","Mappage"
63
+ "Launch manually","Lancer manuellement"
64
+ "Synchronize All Groups","Synchroniser les groupes"
65
+ "Customers per pass","Clients par passe"
66
+ "Subscribers per pass","Inscrits par passe"
67
+ "Subscribers synchronization","Synchronisation des inscrits"
68
+ "Create Inxmail column","Créer colonne Inxmail"
69
+ "Create","Créer"
70
+ "Column name","Nom colonne"
71
+ "Column length","Longueur colonne"
72
+ "Column type","Type colonne"
73
+ "Text","Texte"
74
+ "Date and time","Date et heure"
75
+ "Date only","Date seulement"
76
+ "Time only","Heure seulement"
77
+ "Integer","Nombre entier"
78
+ "Float","Nombre à virgule flottante"
79
+ "Yes / No","Oui / Non"
80
+ "Subscribers synchronization is only available on the store view configuration of your website.","La synchronisation des inscrits à la newsletter est disponible uniquement sur la configuration des vues de votre boutique."
81
+ "Column %s successfully created in Inxmail","Colonne %s créée avec succès dans Inxmail"
82
+ "Column %s already exist in Inxmail","Colonne %s existe déjà dans Inxmail"
83
+ "No post data","Aucune donnée en POST"
84
+ "No store set","Aucun store renseigné"
85
+ "No default store set","Aucun store par défaut renseigné"
86
+ "You are not allowed on this page.","Vous n'êtes pas autorisé sur cette page."
87
+ "No subscriber to synchronize.","Aucun inscrit à synchroniser."
88
+ "Error synchronizing unsubscribed customers from Inxmail","Erreur pendant la synchronisaton des clients désinscrits à partir d'Inxmail"
89
+ "No customer to synchronize.","Aucun client à synchroniser."
90
+ "Type Date only","Type Date uniquement"
91
+ "Type Yes/No","Type Oui/Non"
92
+ "Type Integer","Type Nombre entier"
93
+ "Type Float","Type Nombre à virgule flottante"
94
+ "Type Text","Type Texte"
95
+ "Last customers","Derniers clients"
96
+ "Best customers","Meilleurs clients"
97
+ "Abandonned carts","Paniers abandonnés"
98
+ "Orders configuration","Configuration des commandes"
99
+ "Orders configuration: Last X Days","Configuration des commandes: X derniers jours"
100
+ "Orders configuration: Date range From","Configuration des commandes: Plage de dates Début"
101
+ "Orders configuration: Date range to","Configuration des commandes: Plage de dates Fin"
102
+ "Get last customers since X days","Récupérer les derniers clients depuis X jours"
103
+ "Get customers whose sum of all orders is superior to X","Récupérer les clients dont la somme des commandes est supérieure à X"
104
+ "Get abandonned carts' customer since X days","Récupérer les paniers abandonnés des clients depuis X jours"
105
+ "Configuration to get orders","Configuration de récupération des commandes"
106
+ "Get orders since X days","Récupérer les commandes depuis X jours"
107
+ "Get orders of specific date range (from)","Récupérer les commandes spécifiques à la plage de dates (début)"
108
+ "Get orders of specific date range (to)","Récupérer les commandes spécifiques à la plage de dates (fin)"
109
+ "Last X Days","X derniers jours"
110
+ "Date Range","Plage de dates"
111
+ "Orders (specific)","Commandes (spécifique)"
js/dndinxmail/synchronize.js ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @category Module JS
3
+ * @package DndInxmail_Subscriber
4
+ * @dev Merlin
5
+ * @last_modified 13/03/2013
6
+ * @copyright Copyright (c) 2012 Agence Dn'D
7
+ * @author Agence Dn'D - Conseil en creation de site e-Commerce Magento : http://www.dnd.fr/
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ if(typeof DndInxmail == 'undefined') {
12
+ var DndInxmail = {};
13
+ }
14
+
15
+ DndInxmail.Synchronize = Class.create();
16
+ DndInxmail.Synchronize.prototype = {
17
+
18
+ passes: null,
19
+ total: 0,
20
+ totalGroups: 0,
21
+ currentPass: 0,
22
+ currentGroup: 0,
23
+ listName: null,
24
+ groups: null,
25
+ storeId: null,
26
+ scriptType: 'default',
27
+
28
+ /*
29
+ * Initialize Prototype Class
30
+ */
31
+ initialize: function() {
32
+ this.passSubscribersAction = BASE_URL_STORE + 'dndinxmail_subscriber/synchronize/passSubscribers';
33
+ this.passGroupsAction = BASE_URL_STORE + 'dndinxmail_subscriber/synchronize/passGroups';
34
+
35
+ this.logStartAction = BASE_URL_STORE + 'dndinxmail_subscriber/log/start';
36
+ this.logTryToCloseAction = BASE_URL_STORE + 'dndinxmail_subscriber/log/tryToClose';
37
+ this.logEndAction = BASE_URL_STORE + 'dndinxmail_subscriber/log/end';
38
+
39
+
40
+ this.initPreventScriptExit();
41
+ },
42
+
43
+ initPreventScriptExit: function() {
44
+
45
+ var _self = this;
46
+
47
+ window.onbeforeunload = function(e) {
48
+ e = e || window.event;
49
+ _self.tryToCloseLog();
50
+ // For IE and Firefox prior to version 4
51
+ if(e) {
52
+ e.returnValue = 'Closing this page will stop the script. Are you sure you want to leave the page?';
53
+ }
54
+ // For Safari
55
+ return 'Closing this page will stop the script. Are you sure you want to leave the page?';
56
+ };
57
+
58
+ },
59
+
60
+ startLog: function(type) {
61
+ this.scriptType = type;
62
+ var passUrl = this.logStartAction + '/type/' + this.scriptType;
63
+ new Ajax.Request(passUrl);
64
+ },
65
+
66
+ tryToCloseLog: function() {
67
+ var passUrl = this.logTryToCloseAction + '/type/' + this.scriptType;
68
+ new Ajax.Request(passUrl);
69
+ },
70
+
71
+ endLog: function() {
72
+ var passUrl = this.logEndAction + '/type/' + this.scriptType;
73
+ new Ajax.Request(passUrl);
74
+ },
75
+
76
+ launchSubscribers: function(request, store) {
77
+ this.passes = request;
78
+ this.total = request['total'];
79
+ this.storeId = store;
80
+ this.startLog('subscribers');
81
+ this.synchronizePassSubscribers(request[0]);
82
+ },
83
+
84
+ synchronizePassSubscribers: function(pass) {
85
+
86
+ if(typeof pass != 'undefined') {
87
+
88
+ var current = Object.toJSON(pass);
89
+ var passUrl = this.passSubscribersAction + '/store/' + this.storeId;
90
+ var _self = this;
91
+
92
+ new Ajax.Request(passUrl, {
93
+ method: 'post',
94
+ parameters: {pass: current},
95
+ onLoading: function(transport) {
96
+ _self.outputSucces(_self.currentPass + 1, _self.total);
97
+ },
98
+ onSuccess: function(transport) {
99
+ if(transport.responseText) {
100
+ var result = transport.responseText;
101
+ var response = typeof JSON != 'undefined' ? JSON.parse(result) : eval('(' + result + ')');
102
+ if(response.failed != 'false') {
103
+ _self.outputError('Skip pass ' + (_self.currentPass + 1) + ' : ' + response.msg);
104
+ }
105
+
106
+ _self.currentPass++;
107
+
108
+ if(typeof _self.passes[_self.currentPass] != 'undefined') {
109
+ _self.synchronizePassSubscribers(_self.passes[_self.currentPass]);
110
+ return;
111
+ }
112
+
113
+ _self.outputSucces(0, 0, true);
114
+
115
+ }
116
+ }
117
+ });
118
+
119
+ }
120
+ },
121
+
122
+ launchGroups: function(request) {
123
+ this.passes = request;
124
+ this.totalGroups = request['total'];
125
+ this.startLog('groups');
126
+ this.synchronizeGroups(this.passes[0]);
127
+ },
128
+
129
+ synchronizeGroups: function(group) {
130
+ this.listName = group['name'];
131
+ this.total = group['total'];
132
+ delete group['name'];
133
+ delete group['total'];
134
+ this.outputGroup(this.listName);
135
+ this.synchronizePassGroups(group[this.currentPass]);
136
+ },
137
+
138
+ synchronizePassGroups: function(pass) {
139
+
140
+ if(typeof pass != 'undefined') {
141
+
142
+ var current = Object.toJSON(pass);
143
+ var passUrl = this.passGroupsAction;
144
+ var _self = this;
145
+ var firstPass = (this.currentPass == 0) ? 'true' : 'false';
146
+
147
+
148
+ new Ajax.Request(passUrl, {
149
+ method: 'post',
150
+ parameters: {
151
+ list: _self.listName,
152
+ pass: current,
153
+ first: firstPass
154
+ },
155
+ onLoading: function(transport) {
156
+ _self.outputSucces(_self.currentPass + 1, _self.total);
157
+ },
158
+ onSuccess: function(transport) {
159
+ if(transport.responseText) {
160
+ var result = transport.responseText;
161
+ var response = typeof JSON != 'undefined' ? JSON.parse(result) : eval('(' + result + ')');
162
+ if(response.failed != 'false') {
163
+ _self.outputError('Skip pass ' + (_self.currentPass + 1) + ' for "' + _self.listName + '" : ' + response.msg);
164
+ }
165
+
166
+ _self.currentPass++;
167
+
168
+ if(typeof _self.passes[_self.currentGroup][_self.currentPass] != 'undefined') {
169
+ _self.synchronizePassGroups(_self.passes[_self.currentGroup][_self.currentPass]);
170
+ return;
171
+ }
172
+
173
+ _self.currentGroup++
174
+
175
+ if(typeof _self.passes[_self.currentGroup] != 'undefined') {
176
+ _self.currentPass = 0;
177
+ _self.synchronizeGroups(_self.passes[_self.currentGroup]);
178
+ return;
179
+ }
180
+
181
+ _self.outputSucces(0, 0, true);
182
+
183
+ }
184
+ }
185
+ });
186
+
187
+ }
188
+ },
189
+
190
+ outputError: function(error) {
191
+ var parent = document.getElementById('errors');
192
+ var list = document.createElement("li");
193
+ list.innerHTML = error;
194
+ parent.appendChild(list);
195
+ },
196
+
197
+ outputSucces: function(current, total, finish) {
198
+
199
+ var list = document.getElementById('pass');
200
+ var percentElement = document.getElementById('percent');
201
+
202
+ if(typeof finish == 'undefined') {
203
+ percent = Math.round(current * 100 / total);
204
+ percentElement.innerHTML = percent + ' %';
205
+ list.innerHTML = current + ' / ' + total + ' pass';
206
+ }
207
+ else {
208
+ document.getElementById('loader-sync').style.display = 'none';
209
+ percentElement.innerHTML = '100 %';
210
+ list.innerHTML = 'Finish';
211
+ window.onbeforeunload = null;
212
+ this.endLog();
213
+ }
214
+
215
+ },
216
+
217
+ outputGroup: function(name) {
218
+ var spanElement = document.getElementById('current-group');
219
+ var percent = Math.round((this.currentGroup + 1) * 100 / this.totalGroups);
220
+ spanElement.innerHTML = 'Group ' + (this.currentGroup + 1) + ' / ' + this.totalGroups + ' (' + percent + ' %) : ' + name;
221
+ }
222
+
223
+ }
lib/Inx/Api/APIException.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * <i>Inx_Api_APIException</i> is the runtime exception that can be thrown during the normal operation of the API.
7
+ *
8
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
9
+ * @package Inxmail
10
+ */
11
+ class Inx_Api_APIException extends Exception
12
+ {
13
+ /**
14
+ * @var Exception the original exception that was thrown.
15
+ */
16
+ public $oCause = null;
17
+
18
+ /**
19
+ * Constructs a new api runtime exception with the specified detail message.
20
+ *
21
+ * @param string $sMsg the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
22
+ * @param Exception $oCause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt>
23
+ * value is permitted, and indicates that the cause is nonexistent or unknown.)
24
+ */
25
+ function __construct($sMsg, Exception $oCause = null) {
26
+ parent::__construct($sMsg);
27
+ $this->oCause = $oCause;
28
+ }
29
+
30
+ /**
31
+ * Returns the original exception.
32
+ *
33
+ * @return Exception the original exception.
34
+ */
35
+ public function getCause()
36
+ {
37
+ return $this->oCause;
38
+ }
39
+
40
+ }
lib/Inx/Api/Action/Action.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Action_Action</i> is a powerful tool which can manipulate or send a mail to a recipient for which
8
+ * an event has occurred. To do so, an <i>Inx_Api_Action_Action</i> has a list of commands that will be executed
9
+ * when the event occurs. Using this pattern, complex actions may be created. An <i>Inx_Api_Action_Action</i> could,
10
+ * for example, be configured to respond automatically to flame mails.
11
+ * <p>
12
+ * <i>Inx_Api_Action_Action</i>s can be accessed using the <i>Inx_Api_Action_ActionManager</i>.
13
+ * <p>
14
+ * The different types of commands are:
15
+ * <ul>
16
+ * <li><i>Inx_Api_Action_DeleteRecipientCommand</i> - Permanently remove the recipient.
17
+ * <li><i>Inx_Api_Action_SendMailCommand</i> - Send a mailing to the recipient.
18
+ * <li><i>Inx_Api_Action_SendActionMailCommand</i> - Send an action mailing to the recipient.
19
+ * <li><i>Inx_Api_Action_SetValueCommand</i> - Set an attribute value of the recipient.
20
+ * <li><i>Inx_Api_Action_SubscriptionCommand</i> - Subscribe the recipient.
21
+ * <li><i>Inx_Api_Action_UnsubscriptionCommand</i> - Unsubscribe the recipient.
22
+ * </ul>
23
+ * These commands are created by the <i>Inx_Api_Action_CommandFactory</i> which can be obtained from the
24
+ * <i>Inx_Api_Action_ActionManager</i>.
25
+ * <p>
26
+ * There are different event types which are triggered by inxmail.
27
+ * <p>
28
+ * System-wide events (the owner is the SystemListContext):
29
+ * <ul>
30
+ * <li>EVENT_TYPE_CLICK - A link in an email is clicked.
31
+ * <li>EVENT_TYPE_HARD_BOUNCE - A hard bounce mail is received.
32
+ * <li>EVENT_TYPE_SOFT_BOUNCE - A soft bounce mail is received.
33
+ * <li>EVENT_TYPE_UNKNOWN_BOUNCE - An unknown mail is detected through the bounce mailbox.
34
+ * <li>EVENT_TYPE_AUTO_RESPONDER_BOUNCE - An auto-responder mail is received through the bounce mailbox.
35
+ * <li>EVENT_TYPE_AUTO_RESPONDER_REPLY - An auto-responder mail is received through the normal mailbox.
36
+ * <li>EVENT_TYPE_FLAME_REPLY - A flame mail is received through the normal mailbox.
37
+ * <li>EVENT_TYPE_UNKNOWN_REPLY - An unknown mail is detected through the normal mailbox.
38
+ * </ul>
39
+ * <p>
40
+ * ListContext-specific events (the owner is a StandardListContext or a FilterListContext):
41
+ * <ul>
42
+ * <li>EVENT_TYPE_NEWSLETTER_SENT - A newsletter was sent.
43
+ * <li>EVENT_TYPE_SINGLE_MAIL_SENT - A single mail was sent.
44
+ * <li>EVENT_TYPE_SUBSCRIBE - A recipient was successfully subscribed.
45
+ * <li>EVENT_TYPE_UNSUBSCRIBE - A recipient was successfully unsubscribed.
46
+ * </ul>
47
+ * <p>
48
+ * Note: The usage of <i>Inx_Api_Action_Action</i>s requires the api user right: <i>Inx_Api_UserRights::ACTION_FEATURE_USE</i>
49
+ * <p>
50
+ * For an example on how to use actions, see the <i>Inx_Api_Action_ActionManager</i> documentation.
51
+ *
52
+ * @see Inx_Api_Action_Command
53
+ * @see Inx_Api_Action_ActionManager
54
+ * @since API 1.2.0
55
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
56
+ * @package Inxmail
57
+ * @subpackage Action
58
+ */
59
+ interface Inx_Api_Action_Action extends Inx_Api_BusinessObject
60
+ {
61
+ /**
62
+ * Constant for the name attribute.
63
+ * Used by the <code>UpdateException</code> to indicate the error source.
64
+ */
65
+ const ATTRIBUTE_NAME = 0;
66
+
67
+ /**
68
+ * Constant for the event type attribute.
69
+ * Used by the <code>UpdateException</code> to indicate the error source.
70
+ */
71
+ const ATTRIBUTE_EVENT_TYPE = 1;
72
+
73
+ /**
74
+ * Constant for the list context attribute.
75
+ * Used by the <code>UpdateException</code> to indicate the error source.
76
+ */
77
+ const ATTRIBUTE_LIST_CONTEXT_ID = 2;
78
+
79
+ /**
80
+ * Constant for the commands attribute.
81
+ * Used by the <code>UpdateException</code> to indicate the error source.
82
+ */
83
+ const ATTRIBUTE_COMMANDS = 3;
84
+
85
+
86
+ /** Constant for event type: CLICK - A link in an email is clicked. */
87
+ const EVENT_TYPE_CLICK = 1;
88
+
89
+ /** Constant for event type: NEWSLETTER_SENT - A newsletter was sent. */
90
+ const EVENT_TYPE_NEWSLETTER_SENT = 10;
91
+
92
+ /** Constant for event type: SINGLE_MAIL_SENT - A single mail was sent. */
93
+ const EVENT_TYPE_SINGLE_MAIL_SENT = 11;
94
+
95
+ /** Constant for event type: HARD_BOUNCE - A hard bounce mail is received. */
96
+ const EVENT_TYPE_HARD_BOUNCE = 20;
97
+
98
+ /** Constant for event type: SOFT_BOUNCE - A soft bounce mail is received. */
99
+ const EVENT_TYPE_SOFT_BOUNCE = 21;
100
+
101
+ /** Constant for event type: UNKNOWN_BOUNCE - An unknown mail is detected through the bounce mailbox. */
102
+ const EVENT_TYPE_UNKNOWN_BOUNCE = 22;
103
+
104
+ /** Constant for event type: AUTO_RESPONDER_BOUNCE - An auto-responder mail is received through the bounce mailbox. */
105
+ const EVENT_TYPE_AUTO_RESPONDER_BOUNCE = 23;
106
+
107
+ /** Constant for event type: AUTO_RESPONDER_REPLY - An auto-responder mail is received through the normal mailbox. */
108
+ const EVENT_TYPE_AUTO_RESPONDER_REPLY = 30;
109
+
110
+ /** Constant for event type: FLAME_REPLY - A flame mail is received through the normal mailbox. */
111
+ const EVENT_TYPE_FLAME_REPLY = 31;
112
+
113
+ /** Constant for event type: UNKNOWN_REPLY - An unknown mail is detected through the normal mailbox. */
114
+ const EVENT_TYPE_UNKNOWN_REPLY = 32;
115
+
116
+ /** Constant for event type: SUBSCRIBE - A recipient was successfully subscribed. */
117
+ const EVENT_TYPE_SUBSCRIBE = 40;
118
+
119
+ /** Constant for event type: UNSUBSCRIBE - A recipient was successfully unsubscribed. */
120
+ const EVENT_TYPE_UNSUBSCRIBE = 41;
121
+
122
+
123
+ /**
124
+ * Returns the unique name of this action.
125
+ *
126
+ * @return string the unique name of this action.
127
+ */
128
+ public function getName();
129
+
130
+
131
+ /**
132
+ * Sets the name of this action.
133
+ *
134
+ * @param string $sName the unique name of this action.
135
+ */
136
+ public function updateName( $sName );
137
+
138
+
139
+ /**
140
+ * Returns the id of the list context which this action belongs to.
141
+ *
142
+ * @return int the id of the list context which this action belongs to.
143
+ */
144
+ public function getListContextId();
145
+
146
+
147
+ /**
148
+ * Returns the event type of this action.
149
+ * Can be one of the event type constants defined in the <code>Action</code> interface.
150
+ *
151
+ * @return int the event type.
152
+ */
153
+ public function getEventType();
154
+
155
+
156
+ /**
157
+ * Sets the event type of this action.
158
+ * Can be one of the event type constants defined in the <code>Action</code> interface.
159
+ *
160
+ * @param int $iEventType the event type.
161
+ */
162
+ public function updateEventType( $iEventType );
163
+
164
+
165
+ /**
166
+ * Returns the commands this action will execute on the specified event.
167
+ *
168
+ * @return array the commands.
169
+ */
170
+ public function getCommands();
171
+
172
+
173
+ /**
174
+ * Sets the commands this action will execute on the specified event.
175
+ *
176
+ * @param array $aCmds the commands.
177
+ */
178
+ public function updateCommands( $aCmds );
179
+
180
+ }
lib/Inx/Api/Action/ActionManager.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Action_ActionManager</i> manages all actions.
8
+ * The following snippet creates a new <i>Action</i> that sets the lastClick recipient attribute
9
+ * (last time the recipient clicked a link) to the current date and increments the clickCount
10
+ * recipient attribute (the number of clicks by the recipient):
11
+ *
12
+ * <PRE>
13
+ * $oListContextManager = $oSession->getListContextManager();
14
+ * $oListContext = $oListContextManager->findByName( Inx_Api_List_SystemListContext::NAME );
15
+ *
16
+ * $oRecipientMetaData = $session->createRecipientContext()->getMetaData();
17
+ * $iLastClick = $oRecipientMetaData->getUserAttribute( &quot;lastClick&quot; )->getId();
18
+ * $iClickCount = $oRecipientMetaData->getUserAttribute( &quot;clickCount&quot; )->getId();
19
+ *
20
+ * $oActionMgr = $oSession->getActionManager();
21
+ *
22
+ * $oAction = $oActionMgr->createAction( $oListContext );
23
+ * $oAction->updateEventType( Inx_Api_Action_Action::EVENT_TYPE_CLICK );
24
+ * $oAction->updateName( "Click-Registry" );
25
+ *
26
+ * $oCommandFactory = $oActionMgr->getCommandFactory();
27
+ *
28
+ * $aCmds = array();
29
+ * $aCmds[] = $oCommandFactory->createSetValueCmd( $iLastClick, "=Date()" );
30
+ * $aCmds[] = $oCommandFactory->createSetRelativeValueCmd( $iClickCount, 1 );
31
+ *
32
+ * $oAction->updateCommands( $aCmds );
33
+ * $oAction->commitUpdate();
34
+ * </PRE>
35
+ *
36
+ * <p>
37
+ * Note: The recipient attributes referenced in the snippet are not standard attributes and must be created using the
38
+ * <i>Inx_Api_Recipient_AttributeManager</i> before they may be used in the shown way.
39
+ * <p>
40
+ * Note: The usage of <i>Inx_Api_Action_Action</i>s requires the api user right: <i>Inx_Api_UserRights::ACTION_FEATURE_USE</i>
41
+ * <p>
42
+ * For more information on actions (including event types), see the <i>Inx_Api_Action_Action</i> documentation.
43
+ *
44
+ * @see Inx_Api_Action_Action
45
+ * @since API 1.2.0
46
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
47
+ * @package Inxmail
48
+ * @subpackage Action
49
+ */
50
+ interface Inx_Api_Action_ActionManager extends Inx_Api_BOManager
51
+ {
52
+
53
+ /**
54
+ * Creates a new, empty action with the specified owning list. If the action is not list specific, the
55
+ * system list context must be used. The following snippet retrieves the system list context:
56
+ *
57
+ * <PRE>
58
+ * $oListContextManager = $oSession->getListContextManager();
59
+ * $oListContext = $oListContextManager->findByName( Inx_Api_List_SystemListContext::NAME );
60
+ * </PRE>
61
+ *
62
+ *
63
+ * @param Inx_Api_List_ListContext $oListContext the list owning the action.
64
+ * @return Inx_Api_Action_Action a new action.
65
+ *
66
+ */
67
+ public function createAction( Inx_Api_List_ListContext $oListContext );
68
+
69
+
70
+ /**
71
+ * Selects all actions owned by the specified list context. To retrieve actions which are not list
72
+ * specific, use the system list context. The following snippet retrieves the system list context:
73
+ *
74
+ * <PRE>
75
+ * $oListContextManager = $oSession->getListContextManager();
76
+ * $oListContext = $oListContextManager->findByName( Inx_Api_List_SystemListContext::NAME );
77
+ * </PRE>
78
+ *
79
+ *
80
+ * @paramInx_Api_List_ListContext|int $mListContext the list context (or list id) which owns the actions to retrieve.
81
+ * @return Inx_Api_BOResultSet an <i>Inx_Api_BOResultSet</i> object that contains the actions owned by the specified list.
82
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
83
+ * <i>Inx_Api_UserRights::ACTION_FEATURE_USE</i>
84
+ */
85
+ public function select( $mListContext );
86
+
87
+
88
+ /**
89
+ * Returns the factory used to create new commands.
90
+ * <i>Inx_Api_Action_Command</i>s are executed by an <i>Inx_Api_Action</i> if the event associated with that
91
+ * action is triggered.
92
+ *
93
+ * @return Inx_Api_Action_CommandFactory the command factory.
94
+ */
95
+ public function getCommandFactory();
96
+
97
+ }
lib/Inx/Api/Action/Command.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Action_Command</i> interface identifies commands which are executed by an <i>Inx_Api_Action_Action</i>
8
+ * when the event associated with the action is triggered.
9
+ * <i>Inx_Api_Action_Command</i>s can be used to manipulate a recipient or to send a single mailing to that recipient.
10
+ * <p>
11
+ * The different types of commands are:
12
+ * <ul>
13
+ * <li><i>Inx_Api_Action_DeleteRecipientCommand</i> - Permanently remove the recipient.
14
+ * <li><i>Inx_Api_Action_SendMailCommand</i> - Send a mailing to the recipient.
15
+ * <li><i>Inx_Api_Action_SetValueCommand</i> - Set an attribute value of the recipient.
16
+ * <li><i>Inx_Api_Action_SubscriptionCommand</i> - Subscribe the recipient.
17
+ * <li><i>Inx_Api_Action_UnsubscriptionCommand</i> - Unsubscribe the recipient.
18
+ * </ul>
19
+ * <p>
20
+ * For an example on how to use commands and actions, see the <i>Inx_Api_Action_ActionManager</i> documentation.
21
+ *
22
+ * @see Inx_Api_Action_Action
23
+ * @see Inx_Api_Action_ActionManager
24
+ * @since API 1.2.0
25
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
26
+ * @package Inxmail
27
+ * @subpackage Action
28
+ */
29
+ interface Inx_Api_Action_Command
30
+ {
31
+
32
+ }
lib/Inx/Api/Action/CommandFactory.php ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Action_CommandFactory</i> is a factory for creating <i>Inx_Api_Action_Command</i>s.
8
+ * <p>
9
+ * For an example on how to use commands and actions, see the <i>Inx_Api_Action_ActionManager</i>
10
+ * documentation.
11
+ *
12
+ * @see Inx_Api_Action_Command
13
+ * @see Inx_Api_Action_ActionManager
14
+ * @since API 1.2.0
15
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
16
+ * @package Inxmail
17
+ * @subpackage Action
18
+ */
19
+ interface Inx_Api_Action_CommandFactory
20
+ {
21
+
22
+ /**
23
+ * Creates a new <i>Inx_Api_Action_DeleteRecipientCommand</i> that will delete the recipient permanently
24
+ * from the system.
25
+ *
26
+ * @return Inx_Api_Action_DeleteRecipientCommand a new <i>Inx_Api_Action_DeleteRecipientCommand</i>.
27
+ */
28
+ public function createDeleteRecipientCmd();
29
+
30
+
31
+ /**
32
+ * Creates an <i>Inx_Api_Action_SetValueCommand</i> which sets a value based on an expression.
33
+ * The expression must begin with an equal sign. The data type of the expression must be the same as the
34
+ * data type of the specified attribute.
35
+ * <p>
36
+ * See the Inxmail client documentation for a detailed description.
37
+ *
38
+ * <PRE>
39
+ * $oFactory->createSetValueCmd( $oDatetimeAttr->getId(), "=Date()" );
40
+ * </PRE>
41
+ *
42
+ * @param int $iAttributeId the id of the user attribute.
43
+ * @param string $sExpression an expression that sets the value of the attribute.
44
+ * @return Inx_Api_Action_SetValueCommand a new <i>Inx_Api_Action_SetValueCommand</i>.
45
+ * @see Inx_Api_Recipient_Attribute
46
+ */
47
+ public function createSetValueCmd( $iAttributeId, $sExpression );
48
+
49
+
50
+ /**
51
+ * Creates an <i>Inx_Api_Action_SetValueCommand</i> which sets an absolute value.
52
+ * Some examples for allowed values, dependent on the data type: <br>
53
+ * <ul>
54
+ * <li>DataType.TEXT - "Text", null
55
+ * <li>DataType.INTEGER - "12", "-3", null
56
+ * <li>DataType.DOUBLE - "3.4", "-1.25", null
57
+ * <li>DataType.BOOLEAN - "TRUE", "FALSE"
58
+ * <li>DataType.DATETIME - "31.12.2006 23:45:00"; (dd.MM.yyyy HH:mm:ss or dd.MM.yyyy HH:mm), null
59
+ * <li>DataType.DATE - "31.12.2006"; (dd.MM.yyyy), null
60
+ * <li>DataType.TIME - "23:45:00"; (HH:mm:ss or HH:mm), null
61
+ * </ul>
62
+ *
63
+ * @param int $iAttributeId the id of the user attribute.
64
+ * @param string $sAbsoluteValue an absolute value for the attribute.
65
+ * @return Inx_Api_Action_SetValue_Command a new <i>Inx_Api_Action_SetValueCommand</i>.
66
+ * @see Inx_Api_Recipient_Attribute
67
+ */
68
+ public function createSetAbsoluteValueCmd( $iAttributeId, $sAbsoluteValue );
69
+
70
+
71
+ /**
72
+ * Creates an <i>Inx_Api_Action_SetValueCommand</i> which sets a relative value.
73
+ * Examples for allowed values, dependent on the data type: <br>
74
+ * <ul>
75
+ * <li>DataType.TEXT - "3", "-10"
76
+ * <li>DataType.INTEGER - "12", "-3"
77
+ * <li>DataType.DOUBLE - "3.4", "-1.25"
78
+ * </ul>
79
+ * <p>
80
+ * You might wonder why text attributes can be incremented/decremented. This is a convenience for attributes that
81
+ * are numbers by nature but have the type text. DO NOT use this method for changing real text attributes, as this
82
+ * will overwrite the value.
83
+ *
84
+ * @param int $iAttributeId the id of the user attribute.
85
+ * @param string $sRelativeValue a relative value for the attribute that can be positive (increment) or negative
86
+ * (decrement).
87
+ * @return Inx_Api_Action_SetValueCommand a new <i>Inx_Api_Action_SetValueCommand</i>.
88
+ * @see Inx_Api_Recipient_Attribute
89
+ */
90
+ public function createSetRelativeValueCmd( $iAttributeId, $sRelativeValue );
91
+
92
+
93
+ /**
94
+ * Creates an <i>Inx_Api_Action_SubUnsubscriptionCommand</i> which subscribes the recipient to the specified
95
+ * standard list.
96
+ *
97
+ * @param int $iListContextId the id of the standard list context to which to subscribe to.
98
+ * @param bool $blSubscriptionProcessingEnabled true if subscription processing is enabled, false if direct (forced)
99
+ * subscription is used. If processing and double opt in (DOI) are enabled, this will send a verification
100
+ * email to the recipient.
101
+ * @return Inx_Api_Action_SubUnsubscriptionCommand a new <i>Inx_Api_Action_SubUnsubscriptionCommand</i>.
102
+ * @deprecated use createSubscriptionCmd2(int, bool) instead.
103
+ */
104
+ public function createSubscriptionCmd( $iListContextId, $blSubscriptionProcessingEnabled );
105
+
106
+
107
+ /**
108
+ * Creates an <i>Inx_Api_Action_SubUnsubscriptionCommand</i> which unsubscribes the recipient from the
109
+ * specified standard list.
110
+ *
111
+ * @param int $iListContextId the id of the standard list context from which to unsubscribe from.
112
+ * @param bool $blSnsubscriptionProcessingEnabled true if unsubscription processing is enabled, false if direct
113
+ * (forced) unsubscription is used. If processing and double opt out (DOO) are enabled, this will send
114
+ * a verification email to the recipient.
115
+ * @return Inx_Api_Action_SubUnsubscriptionCommand a new <i>Inx_Api_Action_SubUnsubscriptionCommand</i>.
116
+ * @deprecated use createUnsubscriptionCmd2(int, bool) instead.
117
+ */
118
+ public function createUnsubscriptionCmd( $iListContextId, $blSnsubscriptionProcessingEnabled );
119
+
120
+
121
+ /**
122
+ * Creates an <i>Inx_Api_Action_SubUnsubscriptionCommand</i> which unsubscribes the recipient from all standard
123
+ * lists.
124
+ *
125
+ * @return Inx_Api_Action_SubUnsubscriptionCommand a new <i>Inx_Api_Action_SubUnsubscriptionCommand</i>.
126
+ * @deprecated use createUnsubscribeAllCmd2() instead.
127
+ */
128
+ public function createUnsubscribeAllCmd();
129
+
130
+
131
+ /**
132
+ * Creates an <i>Inx_Api_Action_SubscriptionCommand</i> which subscribes the recipient to the specified
133
+ * standard list.
134
+ *
135
+ * @param int $iListContextId the id of the standard list context to which to subscribe to.
136
+ * @param bool $blSubscriptionProcessingEnabled true if subscription processing is enabled, false if direct
137
+ * (forced) subscription is used. If processing and double opt in (DOI) are enabled, this will send
138
+ * a verification email to the recipient.
139
+ * @return Inx_Api_Action_SubscriptionCommand a new <i>Inx_Api_Action_SubscriptionCommand</i>.
140
+ * @since API 1.6.0
141
+ */
142
+ public function createSubscriptionCmd2( $iListContextId,
143
+ $blSubscriptionProcessingEnabled );
144
+
145
+
146
+ /**
147
+ * Creates an <i>Inx_Api_Action_UnsubscriptionCommand</i> which unsubscribes the recipient from the
148
+ * specified standard list.
149
+ *
150
+ * @param int $iListContextId the id of the standard list context from which to unsubscribe from.
151
+ * @param bool $blSnsubscriptionProcessingEnabled true if unsubscription processing is enabled, false if
152
+ * direct (forced) unsubscription is used. If processing and double opt out (DOO) are enabled,
153
+ * this will send a verification email to the recipient.
154
+ * @return Inx_Api_Action_UnsubscriptionCommand a new <i>Inx_Api_Action_UnsubscriptionCommand</i>.
155
+ * @since API 1.6.0
156
+ */
157
+ public function createUnsubscriptionCmd2( $iListContextId,
158
+ $blSnsubscriptionProcessingEnabled );
159
+
160
+
161
+ /**
162
+ * Creates an <i>Inx_Api_Action_UnsubscriptionCommand</i> which unsubscribes the recipient from all
163
+ * standard lists.
164
+ *
165
+ * @return Inx_Api_Action_UnsubscriptionCommand a new <i>Inx_Api_Action_UnsubscriptionCommand</i>.
166
+ * @since API 1.6.0
167
+ */
168
+ public function createUnsubscribeAllCmd2();
169
+
170
+
171
+
172
+ /**
173
+ * Creates an <i>Inx_Api_Action_SendMailCommand</i> which sends the last newsletter from the
174
+ * specified list context to the recipient.
175
+ *
176
+ * @param int $iListContextId the id of the standard or filter list context.
177
+ * @return Inx_Api_Action_SendMailCommand a new <i>Inx_Api_Action_SendMailCommand</i>.
178
+ */
179
+ public function createSendLastNewsletterCmd( $iListContextId );
180
+
181
+
182
+ /**
183
+ * Creates an <i>Inx_Api_Action_SendMailCommand</i> which sends the specified mailing from the
184
+ * corresponding list context to the recipient.
185
+ *
186
+ * @param int $iListContextId the id of the standard or filter list context containing the mailing.
187
+ * @param int $iMailingId the id of the mailing to send.
188
+ * @return Inx_Api_Action_SendMailCommand a new <i>Inx_Api_Action_SendMailCommand</i>.
189
+ */
190
+ public function createSendMailCmd( $iListContextId, $iMailingId );
191
+
192
+ /**
193
+ * Creates an <i>Inx_Api_Action_SendActionMailCommand</i> which sends the specified action mailing
194
+ * from the corresponding list context to the recipient.
195
+ *
196
+ * @param int $iListContextId id of the standard or filter list context containing the action mailing.
197
+ * @param int $iActionMailingId the id of the action mailing to send.
198
+ * @return Inx_Api_Action_SendActionMailCommand a new <i>Inx_Api_Action_SendActionMailCommand</i>.
199
+ * @since API 1.10.0
200
+ */
201
+ public function createSendActionMailCmd( $iListContextId, $iActionMailingId );
202
+ }
lib/Inx/Api/Action/DeleteRecipientCommand.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * Use the <i>Inx_Api_Action_DeleteRecipientCommand</i> to permanently delete a recipient from the system.
8
+ *
9
+ * @see Inx_Api_Action_CommandFactory
10
+ * @since API 1.2.0
11
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
12
+ * @package Inxmail
13
+ * @subpackage Action
14
+ */
15
+ interface Inx_Api_Action_DeleteRecipientCommand extends Inx_Api_Action_Command
16
+ {
17
+
18
+ }
lib/Inx/Api/Action/SendActionMailCommand.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2006 Inxmail GmbH. All Rights Reserved. This code is part of the Inxmail API documentation. It is
4
+ * distributed in the hope that it will be useful, but a warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS,
5
+ * REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
6
+ * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. INXMAIL GMBH ("INXMAIL") AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
7
+ * DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO
8
+ * EVENT WILL INXMAIL OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
9
+ * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT
10
+ * OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF INXMAIL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
11
+ * You acknowledge that this software is not designed, licensed or intended for use in the design, construction,
12
+ * operation or maintenance of any nuclear facility.
13
+ */
14
+
15
+ /**
16
+ * @package Inxmail
17
+ * @subpackage Action
18
+ */
19
+ /**
20
+ * Use the <i>Inx_Api_Action_SendActionMailCommand</i> to send an action mailing to a recipient. The action
21
+ * mailing must be approved in order to be used.
22
+ *
23
+ * @see Inx_Api_Action_CommandFactory
24
+ * @since API 1.10.0
25
+ */
26
+ interface Inx_Api_Action_SendActionMailCommand extends Inx_Api_Action_Command
27
+ {
28
+ /**
29
+ * Returns the id of the standard or filter list context associated with this command.
30
+ *
31
+ * @return int the id of the list context.
32
+ */
33
+ public function getListContextId();
34
+
35
+
36
+ /**
37
+ * Returns the id of the action mailing associated with this command.
38
+ *
39
+ * @return int the id of the action mailing.
40
+ */
41
+ public function getMailingId();
42
+
43
+ }
lib/Inx/Api/Action/SendMailCommand.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * Use the <i>Inx_Api_Action_SendMailCommand</i> to send a mailing to a recipient.
8
+ * This command can be configured to either send a specific mailing or to send the last mailing
9
+ * (newsletter) in the recipients list.
10
+ *
11
+ * @see Inx_Api_Action_CommandFactory
12
+ * @since API 1.2.0
13
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
14
+ * @package Inxmail
15
+ * @subpackage Action
16
+ */
17
+ interface Inx_Api_Action_SendMailCommand extends Inx_Api_Action_Command
18
+ {
19
+
20
+ /**
21
+ * Command type: Send a specific mailing.
22
+ */
23
+ const CMD_TYPE_SPECIFIC_MAILING = 0;
24
+
25
+ /**
26
+ * Command type: Send the last newsletter.
27
+ */
28
+ const CMD_TYPE_LAST_MAILING = 1;
29
+
30
+
31
+ /**
32
+ * Returns the command type: Inx_Api_Action_SendMailCommand::CMD_TYPE_SPECIFIC_MAILING or
33
+ * Inx_Api_Action_SendMailCommand::CMD_TYPE_LAST_MAILING.
34
+ *
35
+ * @return int the command type.
36
+ */
37
+ public function getCmdType();
38
+
39
+
40
+ /**
41
+ * Returns the id of the standard or filter list context associated with this command.
42
+ *
43
+ * @return int the id of the list context
44
+ */
45
+ public function getListContextId();
46
+
47
+
48
+ /**
49
+ * Returns the id of the mailing associated with this command. Only specified if the command type is
50
+ * Inx_Api_Action_SendMailCommand::CMD_TYPE_SPECIFIC_MAILING.
51
+ *
52
+ * @return int the id of the mailing.
53
+ */
54
+ public function getMailingId();
55
+
56
+ }
lib/Inx/Api/Action/SetValueCommand.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * Use the <i>Inx_Api_Action_SetValueCommand</i> to set an attribute value. There are three ways to set the attribute value:
8
+ * <ul>
9
+ * <li>CMD_TYPE_ABSOLUTE: Absolute value (e.g. 5 or 1)
10
+ * <li>CMD_TYPE_RELATIVE: Relative value (e.g. 2 to increment the value by 2)
11
+ * <li>CMD_TYPE_FREE_EXPRESSION: Free expression (e.g. "=Date()" to set a date attribute to the current date)
12
+ * </ul>
13
+ * Note: The data type of a value must be the same as the data type of the specified attribute. Relative values can only
14
+ * be set for the following data types:
15
+ * <ul>
16
+ * <li>DataType.Integer
17
+ * <li>DataType.Double
18
+ * <li>DataType.Text
19
+ * </ul>
20
+ *
21
+ * @see Inx_Api_Action_CommandFactory
22
+ * @see Inx_Api_Recipient_Attribute
23
+ * @since API 1.2.0
24
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
25
+ * @package Inxmail
26
+ * @subpackage Action
27
+ */
28
+ interface Inx_Api_Action_SetValueCommand extends Inx_Api_Action_Command
29
+ {
30
+ /**
31
+ * Command type: Sets an absolute value.
32
+ */
33
+ const CMD_TYPE_ABSOLUTE = 0;
34
+
35
+ /**
36
+ * Command type: Sets a relative value.
37
+ */
38
+ const CMD_TYPE_RELATIVE = 1;
39
+
40
+ /**
41
+ * Command type: Sets a value from a free expression.
42
+ */
43
+ const CMD_TYPE_FREE_EXPRESSION = 2;
44
+
45
+
46
+ /**
47
+ * Returns the id of the affected user attribute.
48
+ *
49
+ * @return int the id of the affected user attribute.
50
+ */
51
+ public function getAttributeId();
52
+
53
+
54
+ /**
55
+ * Returns the command type:
56
+ * Inx_Api_Action_SetValueCommand::CMD_TYPE_ABSOLUTE,
57
+ * Inx_Api_Action_SetValueCommand::CMD_TYPE_RELATIVE or
58
+ * Inx_Api_Action_SetValueCommand::CMD_TYPE_FREE_EXPRESSION
59
+ *
60
+ * @return int the command type.
61
+ */
62
+ public function getCmdType();
63
+
64
+
65
+ /**
66
+ * Returns the expression/value to set for the attribute.
67
+ *
68
+ * @return string the expression/value.
69
+ */
70
+ public function getExpression();
71
+
72
+ }
lib/Inx/Api/Action/SubUnsubscriptionCommand.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * Use the <i>Inx_Api_Action_SubUnsubscriptionCommand</i> to subscribe/unsubscribe a recipient to/from the specified standard
8
+ * list (CMD_TYPE_SUBSCRIBE and CMD_TYPE_UNSUBSCRIBE) or unsubscribe a recipient from all standard lists (MD_TYPE_UNSUBSCRIBE_ALL).
9
+ *
10
+ * @see Inx_Api_Action_CommandFactory
11
+ * @since API 1.2.0
12
+ * @version $Revision$ $Date$ $Author$
13
+ * @deprecated Use <i>Inx_Api_Action_SubscriptionCommand</i> and <i>Inx_Api_Action_UnsubscriptionCommand</i> instead.
14
+ */
15
+ interface Inx_Api_Action_SubUnsubscriptionCommand extends Inx_Api_Action_Command
16
+ {
17
+ /**
18
+ * Command type: Subscribe to a standard list.
19
+ */
20
+ const CMD_TYPE_SUBSCRIBE = 0;
21
+
22
+ /**
23
+ * Command type: Unsubscribe from a standard list.
24
+ */
25
+ const CMD_TYPE_UNSUBSCRIBE = 1;
26
+
27
+ /**
28
+ * Command type: Unsubscribe from all standard lists.
29
+ */
30
+ const CMD_TYPE_UNSUBSCRIBE_ALL = 2;
31
+
32
+
33
+ /**
34
+ * Returns the id of the list context. Only specified if the command type
35
+ * is CMD_TYPE_SUBSCRIBE or CMD_TYPE_UNSUBSCRIBE.
36
+ *
37
+ * @return int the id of the list context.
38
+ */
39
+ public function getListContextId();
40
+
41
+
42
+ /**
43
+ * Returns the command type:
44
+ * Inx_Api_Action_SubUnsubscriptionCommand::CMD_TYPE_SUBSCRIBE,
45
+ * Inx_Api_Action_SubUnsubscriptionCommand::CMD_TYPE_UNSUBSCRIBE or
46
+ * Inx_Api_Action_SubUnsubscriptionCommand::CMD_TYPE_UNSUBSCRIBE_ALL
47
+ *
48
+ * @return int the command type.
49
+ */
50
+ public function getCmdType();
51
+
52
+
53
+ /**
54
+ * Specifies if the subscription/unsubscription processing is enabled or the recipient will be
55
+ * subscribed/unsubscribed directly. If processing and double opt in (DOI) / double opt out (DOO) are enabled, this
56
+ * will send a verification email to the recipient.
57
+ *
58
+ * @return bool true if the subscription/unsubscription processing is enabled, false otherwise.
59
+ */
60
+ public function isProcessingEnabled();
61
+
62
+ }
lib/Inx/Api/Action/SubscriptionCommand.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * Use the <i>Inx_Api_Action_SubscriptionCommand</i> to subscribe the recipient to the specified standard list.
8
+ *
9
+ * @see Inx_Api_Action_CommandFactory
10
+ * @since API 1.2.0
11
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
12
+ * @package Inxmail
13
+ * @subpackage Action
14
+ */
15
+ interface Inx_Api_Action_SubscriptionCommand extends Inx_Api_Action_Command
16
+ {
17
+ /**
18
+ * Command type: Subscribe to a standard list.
19
+ */
20
+ const CMD_TYPE_SUBSCRIBE = 5;
21
+
22
+
23
+
24
+ /**
25
+ * Returns the id of the list context. Only specified if the command type is CMD_TYPE_SUBSCRIBE.
26
+ *
27
+ * @return int the id of the list context.
28
+ */
29
+ public function getListContextId();
30
+
31
+
32
+ /**
33
+ * Returns the command type:
34
+ * Inx_Api_Action_SubUnsubscriptionCommand::CMD_TYPE_SUBSCRIBE,
35
+ *
36
+ * @return int the command type.
37
+ */
38
+ public function getCmdType();
39
+
40
+
41
+ /**
42
+ * Specifies if the subscription processing is enabled or the recipient will be subscribed directly. If processing
43
+ * and double opt in (DOI) are enabled, this will send a verification email to the recipient.
44
+ *
45
+ * @return bool true if the subscription processing is enabled, false otherwise.
46
+ */
47
+ public function isProcessingEnabled();
48
+
49
+ }
lib/Inx/Api/Action/UnsubscriptionCommand.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Action
5
+ */
6
+ /**
7
+ * Use the <i>Inx_Api_Action_UnsubscriptionCommand</i> to unsubscribe the recipient from the specified standard list or
8
+ * unsubscribe the recipient from all standard lists.
9
+ *
10
+ * @see Inx_Api_Action_CommandFactory
11
+ * @since API 1.2.0
12
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
13
+ * @package Inxmail
14
+ * @subpackage Action
15
+ */
16
+ interface Inx_Api_Action_UnsubscriptionCommand extends Inx_Api_Action_Command
17
+ {
18
+
19
+ /**
20
+ * Command type: Unsubscribe from a standard list.
21
+ */
22
+ const CMD_TYPE_UNSUBSCRIBE = 6;
23
+
24
+ /**
25
+ * Command type: Unsubscribe from all standard lists.
26
+ */
27
+ const CMD_TYPE_UNSUBSCRIBE_ALL = 2;
28
+
29
+
30
+ /**
31
+ * Returns the id of the list context. Only specified if the command type
32
+ * is CMD_TYPE_UNSUBSCRIBE.
33
+ *
34
+ * @return int the id of the list context.
35
+ */
36
+ public function getListContextId();
37
+
38
+
39
+ /**
40
+ * Returns the command type:
41
+ * Inx_Api_Action_SubUnsubscriptionCommand::CMD_TYPE_UNSUBSCRIBE or
42
+ * Inx_Api_Action_SubUnsubscriptionCommand::CMD_TYPE_UNSUBSCRIBE_ALL
43
+ *
44
+ * @return int the command type.
45
+ */
46
+ public function getCmdType();
47
+
48
+
49
+ /**
50
+ * Specifies if the unsubscription processing is enabled or the recipient will be unsubscribed directly. If
51
+ * processing and double opt out (DOO) are enabled, this will send a verification email to the recipient.
52
+ *
53
+ * @return bool true if the unsubscription processing is enabled, false otherwise.
54
+ */
55
+ public function isProcessingEnabled();
56
+
57
+ }
lib/Inx/Api/Approval/Approver.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Approval
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Approval_Approver</i> represents a person that has to approve a mailing before it can be sent.
8
+ * <P>
9
+ * Note: The system wide approvers are only assigned to the system list. Therefore, the system list id is the only id in
10
+ * the array returned by <i>getLists()</i>.
11
+ * <p>
12
+ * Note: In order to commit changes, all attributes enlisted in this class must be assigned a non null value.
13
+ * <p>
14
+ * Note: The usage of <i>Inx_Api_Approval_Approver</i>s requires the api user right: <i>Inx_Api_UserRights::PROPERTY_SYSTEM_USE</i>
15
+ * <p>
16
+ * For an example on how to use approvers, see the Inx_Api_Approval_ApproverManager documentation.
17
+ *
18
+ * @see Inx_Api_Approval_ApproverManager
19
+ * @since API 1.6.0
20
+ * @version $Revision: 10520 $ $Date: 2008-09-12 14:40:48 +0200 (Fr, 12 Sep 2008) $ $Author: sbn $
21
+ * @package Inxmail
22
+ * @subpackage Approval
23
+ */
24
+ interface Inx_Api_Approval_Approver extends Inx_Api_BusinessObject
25
+ {
26
+
27
+ /**
28
+ * Returns the name of the approver.
29
+ *
30
+ * @return string the name of the approver.
31
+ */
32
+ public function getName();
33
+
34
+
35
+ /**
36
+ * Sets a new for the approver.
37
+ *
38
+ * @param string $sName the new name of the approver.
39
+ */
40
+ public function updateName( $sName );
41
+
42
+
43
+ /**
44
+ * Returns the email address of the approver.
45
+ *
46
+ * @return string the email address of the approver.
47
+ */
48
+ public function getEmail();
49
+
50
+
51
+ /**
52
+ * Sets a new email address for the approver.
53
+ *
54
+ * @param string $sEmail the new email address of the approver.
55
+ */
56
+ public function updateEmail( $sEmail );
57
+
58
+
59
+ /**
60
+ * Returns the comment of the approver.
61
+ *
62
+ * @return string the comment of the approver.
63
+ */
64
+ public function getComment();
65
+
66
+
67
+ /**
68
+ * Sets a new comment for the approver.
69
+ *
70
+ * @param string $sComment the new comment of the approver.
71
+ */
72
+ public function updateComment( $sComment );
73
+
74
+
75
+ /**
76
+ * Returns an id list of all lists the approver is assigned to.
77
+ * <P>
78
+ * Note: System wide approvers return only the system list id.
79
+ *
80
+ * @return array an id list of all lists the approver is assigned to, or the system list id if the approver is assigned to
81
+ * all lists.
82
+ */
83
+ public function getLists();
84
+
85
+
86
+ /**
87
+ * Sets the lists this approver is assigned to.
88
+ * <P>
89
+ * Note: Use the id of the system list as the only id in the array if the approver should be assigned to all lists.
90
+ * The following snippet retrieves the system list id:
91
+ * <pre>
92
+ * $oListContextManager = $oSession->getListContextManager();
93
+ * $oListContext = $oListContextManager->findByName( Inx_Api_List_SystemListContext::NAME );
94
+ * </pre>
95
+ *
96
+ * @param array $lists array of list ids.
97
+ */
98
+ public function updateLists( $lists );
99
+
100
+ }
lib/Inx/Api/Approval/ApproverManager.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Approval
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Approval_ApproverManager</i> is used for the retrieval and creation of approvers.
8
+ * The following code snippet creates a new approver responsible for the list with the id 12:
9
+ *
10
+ * <pre>
11
+ * $approverMgr = $session->getApproverManager();
12
+ * $approver = approverMgr->createApprover();
13
+ * $approver->updateName( &quot;Max Mustermann&quot; );
14
+ * $approver->updateComment( &quot;Approver for List 12&quot; );
15
+ * $approver->updateLists( array( 12 ) );
16
+ * $approver->commitUpdate();
17
+ * </pre>
18
+ * Note: The usage of <i>Inx_Api_Approval_Approver</i>s requires the api user right: <i>Inx_Api_UserRights::PROPERTY_SYSTEM_USE</i>
19
+ * <p>
20
+ * For more information on approvers, see the <i>Inx_Api_Approval_Approver</i> documentation.
21
+ *
22
+ * @since API 1.6.0
23
+ * @version $Revision: 10520 $ $Date: 2008-09-12 14:40:48 +0200 (Fr, 12 Sep 2008) $ $Author: sbn $
24
+ * @package Inxmail
25
+ * @subpackage Approval
26
+ */
27
+ interface Inx_Api_Approval_ApproverManager extends Inx_Api_BOManager
28
+ {
29
+
30
+ /**
31
+ * Selects all approvers assigned to the given list and all system wide approvers.
32
+ *
33
+ * @param Inx_Api_List_ListContext $olistContext all approvers assigned to this list will be retrieved.
34
+ * @return Inx_Api_BOResultSet a result set containing the approvers.
35
+ */
36
+ public function select( $olistContext );
37
+
38
+
39
+ /**
40
+ * Creates a new approver.
41
+ *
42
+ * @return Inx_Api_Aprroval_Approver the new approver.
43
+ */
44
+ public function createApprover();
45
+
46
+ }
lib/Inx/Api/BOManager.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * The <i>Inx_Api_BOManager</i> interface defines the basic requirements of a business object manager, including retrieval
7
+ * and removal of the managed objects.
8
+ * @package Inxmail
9
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
10
+ */
11
+ interface Inx_Api_BOManager
12
+ {
13
+
14
+ /**
15
+ * Returns the <i>Inx_Api_BusinessObject</i> with the specified id.
16
+ *
17
+ * @param int $iId the id of the <i>Inx_Api_BusinessObject</i> to retrieve.
18
+ * @return Inx_Api_BusinessObject the <i>Inx_Api_BusinessObject</i>.
19
+ * @throws Inx_Api_DataException if no <i>Inx_Api_BusinessObject</i> could be found (e.g. the object was deleted).
20
+ */
21
+ public function get( $iId );
22
+
23
+
24
+ /**
25
+ * Removes the <i>Inx_Api_BusinessObject</i> with the specified id.
26
+ *
27
+ * @param int $iId the id of the <i>Inx_Api_BusinessObject</i> to be removed.
28
+ * @return boolean true, if and only if the removing succeeded; false otherwise (e.g. the object was already deleted).
29
+ */
30
+ public function remove( $iId );
31
+
32
+
33
+ /**
34
+ * Returns an <i>Inx_Api_BOResultSet</i> containing all managed <i>Inx_Api_BusinessObject</i>s.
35
+ * For Inx_Api_Blacklist_BlacklistManager and Inx_Api_Resource_ResourceManager two params can be specified:
36
+ * 1. int $iOrderAttribute the order attribute id.
37
+ * 2. the order type (<i>Inx_Api_Order::ASC</i> or <i>Inx_Api_Order::DESC</i>).
38
+ *
39
+ * @return Inx_Api_BOResultSet an <i>Inx_Api_BOResultSet</i> containing all managed <i>Inx_Api_BusinessObject</i>s.
40
+ */
41
+ public function selectAll();
42
+
43
+ }
lib/Inx/Api/BOResultSet.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_BOResultSet</i> is a list of <i>Inx_Api_BusinessObject</i>s.
7
+ * The result set can be used to browse through this list, and to remove elements of the list.
8
+ * <p>
9
+ * <strong>Note:</strong> An <i>Inx_Api_BOResultSet</i> object <strong>must</strong> be closed once it is not needed
10
+ * anymore to prevent memory leaks and other potentially harmful side effects.
11
+ *
12
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
13
+ * @package Inxmail
14
+ */
15
+ interface Inx_Api_BOResultSet
16
+ {
17
+
18
+ /**
19
+ * Returns the <i>Inx_Api_BusinessObject</i> with the specified index.
20
+ *
21
+ * @param int $iIndex the index of the <i>Inx_Api_BusinessObject</i> to retrieve in this result set.
22
+ * @return Inx_Api_BusinessObject the <i>Inx_Api_BusinessObject</i> with the specified index.
23
+ * @throws Inx_Api_DataException if no <i>Inx_Api_BusinessObject</i> could be found (e.g. the object was deleted).
24
+ */
25
+ public function get( $iIndex );
26
+
27
+
28
+ /**
29
+ * Returns the number of business objects in this result set.
30
+ *
31
+ * @return int the number of business objects.
32
+ */
33
+ public function size();
34
+
35
+
36
+ /**
37
+ * Removes all business objects that are selected. The method returns true if and only if all selected elements
38
+ * have been removed. In some case it is possible that some elements cannot be removed (e.g.
39
+ * Inx_Api_List_SystemListContext, Properties, ... ).
40
+ *
41
+ * @param Inx_Api_IndexSelection $oSelection the selection of business objects to be removed.
42
+ *
43
+ * @return boolean true, if and only if the removing succeeded; false otherwise.
44
+ *
45
+ */
46
+ public function remove( Inx_Api_IndexSelection $oSelection );
47
+
48
+
49
+ /**
50
+ * Closes this result set and releases any resources associated with the result set.
51
+ * An <i>Inx_Api_BOResultSet</i> object <strong>must</strong> be closed once it is not needed anymore to prevent
52
+ * memory leaks and other potentially harmful side effects.
53
+ */
54
+ public function close();
55
+
56
+ }
lib/Inx/Api/Blacklist/BlacklistEntry.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Blacklist
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Blacklist_BlacklistEntry</i> can block individual addresses or complete address ranges so
8
+ * they can not be added to the Inxmail recipient list, neither by import nor by subscription or in any other ways.
9
+ * A few examples:
10
+ * <ul>
11
+ * <LI>name@firm.com - The address 'name@firm.com' is blocked.
12
+ * <LI>*@firm.com - All personnel of this firm is blocked.
13
+ * <LI>*.tv - No addresses from Tuvalu.
14
+ * <LI>spam* - All addresses beginning with 'spam' are blocked.
15
+ * <LI>martin@* - All Martins are blocked.
16
+ * </ul>
17
+ * Note: The usage of the blacklist requires the api user right: <i>Inx_Api_UserRights::BLACKLIST_FEATURE_USE</i>
18
+ * <p>
19
+ * For an example on how to use the blacklist, see the <i>Inx_Api_Blacklist_BlacklistManager</i> documentation.
20
+ *
21
+ * @see Inx_Api_Blacklist_BlacklistManager
22
+ * @since API 1.1.0
23
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
24
+ * @package Inxmail
25
+ * @subpackage Blacklist
26
+ */
27
+ interface Inx_Api_Blacklist_BlacklistEntry extends Inx_Api_BusinessObject
28
+ {
29
+
30
+ /**
31
+ * Constant of pattern attribute. Used to indicate a change of this attribute and to define the order in which
32
+ * <i>Inx_Api_Blacklist_BlacklistEntry</i> objects are fetched.
33
+ *
34
+ * @see Inx_Api_Blacklist_BlacklistManager::selectAll(int, int)
35
+ */
36
+ const ATTRIBUTE_PATTERN = 0;
37
+
38
+ /**
39
+ * Constant of descriptionn attribute. Used to indicate a change of this attribute and to define the order in which
40
+ * <i>Inx_Api_Blacklist_BlacklistEntry</i> objects are fetched.
41
+ *
42
+ * @see Inx_Api_Blacklist_BlacklistManager::selectAll(int, int)
43
+ */
44
+ const ATTRIBUTE_DESCRIPTION = 1;
45
+
46
+ /**
47
+ * Constant of hit count attribute. Used to indicate a change of this attribute and to define the order in which
48
+ * <i>Inx_Api_Blacklist_BlacklistEntry</i> objects are fetched.
49
+ *
50
+ * @see Inx_Api_Blacklist_BlacklistManager::selectAll(int, int)
51
+ */
52
+ const ATTRIBUTE_HIT_COUNT = 2;
53
+
54
+
55
+ /**
56
+ * Returns the email address pattern.
57
+ *
58
+ * @return string the email address pattern
59
+ */
60
+ public function getPattern();
61
+
62
+
63
+ /**
64
+ * Changes the email address pattern.
65
+ * A few examples:
66
+ * <ul>
67
+ * <LI>name@firm.com - The address 'name@firm.com' is blocked.
68
+ * <LI>*@firm.com - All personnel of this firm is blocked.
69
+ * <LI>*.tv - No addresses from Tuvalu.
70
+ * <LI>spam* - All addresses beginning with 'spam' are blocked.
71
+ * <LI>martin@* - All Martins are blocked.
72
+ * </ul>
73
+ *
74
+ * @param string $sPattern the new email address pattern
75
+ */
76
+ public function updatePattern( $sPattern );
77
+
78
+
79
+ /**
80
+ * Returns the entry description.
81
+ *
82
+ * @return string the entry description.
83
+ */
84
+ public function getDescription();
85
+
86
+
87
+ /**
88
+ * Changes the entry description.
89
+ *
90
+ * @param string $sDescription the new entry description.
91
+ */
92
+ public function updateDescription( $sDescription );
93
+
94
+
95
+ /**
96
+ * Returns the number of addresses which were blocked by this entry.
97
+ *
98
+ * @return int the number of addresses which were blocked by this entry.
99
+ */
100
+ public function getHitCount();
101
+
102
+ }
lib/Inx/Api/Blacklist/BlacklistManager.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Blacklist
5
+ */
6
+ /**
7
+ * Sometimes you might want to exclude particular e-mail addresses or whole address ranges from Inxmail.
8
+ * For this purpose, there is a 'blacklist' of addresses, which can not be added to the Inxmail recipient list, neither
9
+ * by import nor by subscription or in any other ways.
10
+ * <p>
11
+ * You can activate the blacklist feature from the <code>SystemListContext</code>. The following snippet shows how this
12
+ * can be achieved:
13
+ * <pre>
14
+ * $oListContextManager = $oSession->getListContextManager();
15
+ * $oSystemListContext = $oListContextManager->findByName( Inx_Api_List_SystemListContext::NAME );
16
+ *
17
+ * $oSystemListContext->enableFeature( Inx_Api_Features::BLACKLIST_FEATURE_ID );
18
+ * </pre>
19
+ * Using an <i>Inx_Api_Blacklist_BlacklistEntry</i>, you can block individual addresses or complete address ranges.
20
+ * A few examples:
21
+ * <ul>
22
+ * <LI>name@firm.com - The address 'name@firm.com' is blocked.
23
+ * <LI>*@firm.com - All personnel of this firm is blocked.
24
+ * <LI>*.tv - No addresses from Tuvalu.
25
+ * <LI>spam* - All addresses beginning with 'spam' are blocked.
26
+ * <LI>martin@* - All Martins are blocked.
27
+ * </ul>
28
+ * The following snippet shows how to create a blacklist entry that blocks all addresses ending on 'test.com':
29
+ *
30
+ * <pre>
31
+ * $oBlacklistManager = $oSession->getBlacklistManager();
32
+ *
33
+ * $oBlacklistEntry = $oBlacklistManager->createBlacklistEntry();
34
+ * $oBlacklistEntry->updateDescription( &quot;All *test.com users&quot; );
35
+ * $oBlacklistEntry->updatePattern( &quot;*test.com&quot; );
36
+ * $oBlacklistEntry->commitUpdate();
37
+ * </pre>
38
+ * Note: The selectAfter, selectBefore and selectBetween methods expect an ISO 8601 formatted date string.
39
+ * This date string can be created as in the following snippet:
40
+ * <pre>
41
+ * $dateString = date('c');
42
+ * </pre>
43
+ * Note: The usage of the blacklist requires the api user right: <i>Inx_Api_UserRights::BLACKLIST_FEATURE_USE</i>
44
+ * <p>
45
+ * For more information on blacklist entries, see the <i>Inx_Api_Blacklist_BlacklistEntry</i> documentation.
46
+ *
47
+ * @see Inx_Api_Blacklist_BlacklistEntry
48
+ * @since API 1.1.0
49
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
50
+ * @package Inxmail
51
+ * @subpackage Blacklist
52
+ */
53
+ interface Inx_Api_Blacklist_BlacklistManager extends Inx_Api_BOManager
54
+ {
55
+
56
+ /**
57
+ * Creates a new <i>Inx_Api_Blacklist_BlacklistEntry</i>.
58
+ *
59
+ * @return Inx_Api_Blacklist_BlacklistEntry the new <i>Inx_Api_Blacklist_BlacklistEntry</i>.
60
+ */
61
+ public function createBlacklistEntry();
62
+
63
+
64
+ /**
65
+ * Returns the <i>Inx_Api_Blacklist_BlacklistEntry</i> with the specified pattern.
66
+ * The pattern is case insensitive.
67
+ *
68
+ * @param string $sPattern the pattern to find
69
+ * @return Inx_Api_Blacklist_BlacklistEntry the entry, or null if no entry was found.
70
+ */
71
+ public function findByPattern( $sPattern );
72
+
73
+
74
+ /**
75
+ * Returns a result set containing all blacklist entries in the system which were created or changed after the
76
+ * specified date.
77
+ *
78
+ * @param string $searchDate all entries after this date will be selected. The date has to be formatted as ISO 8601.
79
+ * @return an <i>Inx_Api_BOResultSet</i> containing all blacklist entries matching the condition.
80
+ * @throws SecurityException if the session user doesn't have the following permission:
81
+ * <i>Inx_Api_UserRights::BLACKLIST_FEATURE_USE</i>
82
+ */
83
+ public function selectAfter( $searchDate );
84
+
85
+
86
+ /**
87
+ * Returns a result set containing all blacklist entries in the system which were created or changed before the
88
+ * specified date.
89
+ *
90
+ * @param string $searchDate all entries before this date will be selected. The date has to be formatted as ISO 8601.
91
+ * @return an <i>Inx_Api_BOResultSet</i> containing all blacklist entries matching the condition.
92
+ * @throws SecurityException if the session user doesn't have the following permission:
93
+ * <i>Inx_Api_UserRights::BLACKLIST_FEATURE_USE</i>
94
+ */
95
+ public function selectBefore( $searchDate );
96
+
97
+
98
+ /**
99
+ * Returns a result set containing all blacklist entries in the system which were created or changed between the
100
+ * specified dates.
101
+ *
102
+ * @param startDate the start date for the search. The date has to be formatted as ISO 8601.
103
+ * @param stopDate the end date for the search. The date has to be formatted as ISO 8601.
104
+ * @return an <i>Inx_Api_BOResultSet</i> containing all blacklist entries matching the condition.
105
+ * @throws SecurityException if the session user doesn't have the following permission:
106
+ * <i>Inx_Api_UserRights::BLACKLIST_FEATURE_USE</i>
107
+ */
108
+ public function selectBetween( $startDate, $stopDate );
109
+ }
lib/Inx/Api/Bounce/Bounce.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Bounce
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Bounce_Bounce</i> object contains information related to a bounce.
8
+ * With this object you can access data of the bounced mail as well as the bounce message itself.
9
+ * For example you can retrieve the id of the recipient, the mailing id or the content of the bounce message.
10
+ * <p>
11
+ * A bounce message or notification is an error message automatically generated by a destination mail server when a mail
12
+ * cannot be delivered. There are two categories of bounces: hard bounces and soft bounces. A hard bounce indicates a
13
+ * permanent delivery problem (e.g. an unknown email address). A soft bounce indicates a temporary delivery problem
14
+ * (e.g. the recipient inbox disk quota is exceeded).
15
+ * <p>
16
+ * Note: The usage of bounces requires the api user right:
17
+ * <i>Inx_Api_UserRights::ERRORMAIL_FEATURE_USE</i>
18
+ * <p>
19
+ * For an example on how to use bounces, see the <i>Inx_Api_Bounce_BounceManager</i> documentation.
20
+ *
21
+ * @see Inx_Api_Bounce_BounceManager
22
+ * @since API 1.4.3
23
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
24
+ * @package Inxmail
25
+ * @subpackage Bounce
26
+ */
27
+ interface Inx_Api_Bounce_Bounce extends Inx_Api_BusinessObject
28
+ {
29
+ /** This category represents a hard bounce. A common reason for a hard bounce is an invalid email address. */
30
+ const CATEGORY_HARD_BOUNCE = 0;
31
+
32
+ /**
33
+ * This category represents a soft bounce. Soft bounces may occur due to temporary problems like exceeded recipient
34
+ * inbox disk quota.
35
+ */
36
+ const CATEGORY_SOFT_BOUNCE = 1;
37
+
38
+ /** This category represents a bounce of unknown type. */
39
+ const CATEGORY_UNKNOWN_BOUNCE = 2;
40
+
41
+ /**
42
+ * State for missing recipient information. This state will be used when no <code>RecipientContext</code> and/or no
43
+ * attributes are specified in the query or in case of an unknown recipient.
44
+ */
45
+ const RECIPIENT_STATE_UNKNOWN = 0;
46
+
47
+ /** State for existent recipient. */
48
+ const RECIPIENT_STATE_EXISTENT = 1;
49
+
50
+ /** State for non existing (deleted) recipient. */
51
+ const RECIPIENT_STATE_DELETED = 2;
52
+
53
+
54
+
55
+ /**
56
+ * Returns the category of this bounce. May be one of:
57
+ * <ul>
58
+ * <li>CATEGORY_HARD_BOUNCE
59
+ * <li>CATEGORY_SOFT_BOUNCE
60
+ * <li>CATEGORY_UNKNOWN_BOUNCE
61
+ * </ul>
62
+ *
63
+ * @return int the category of this bounce.
64
+ */
65
+ public function getCategory();
66
+
67
+
68
+ /**
69
+ * Returns the date when the bounce occurred as ISO 8601 formatted date string.
70
+ *
71
+ * @return string the date of the bounce message as ISO 8601 formatted date string.
72
+ */
73
+ public function getReceptionDate();
74
+
75
+
76
+ /**
77
+ * Returns the sender address.
78
+ *
79
+ * @return string the sender address as string.
80
+ */
81
+ public function getSender();
82
+
83
+
84
+ /**
85
+ * Returns the subject of the bounce message.
86
+ *
87
+ * @return string the subject of the bounce message as string.
88
+ */
89
+ public function getSubject();
90
+
91
+
92
+ /**
93
+ * Returns the bounce message content as text.
94
+ *
95
+ * @return string the bounce message content as string.
96
+ */
97
+ public function getTextContent();
98
+
99
+
100
+ /**
101
+ * Returns the recipient id for which the bounce occurred.
102
+ *
103
+ * @return int the recipient id.
104
+ */
105
+ public function getRecipientId();
106
+
107
+
108
+ /**
109
+ * Returns the list id of the list in which the bounce occurred.
110
+ *
111
+ * @return int the list id.
112
+ */
113
+ public function getListId();
114
+
115
+
116
+ /**
117
+ * Returns the id of the bounced mailing.
118
+ *
119
+ * @return int the mailing id.
120
+ */
121
+ public function getMailingId();
122
+
123
+
124
+ /**
125
+ * Returns the header of the bounce message as string.
126
+ *
127
+ * @return string the header of the bounce message as string.
128
+ */
129
+ public function getHeaders();
130
+
131
+
132
+ /**
133
+ * Returns the complete bounce message as mime message stream.
134
+ *
135
+ * @return Inx_Api_InputStream the mime message as input stream.
136
+ */
137
+ public function getMIMEMessageAsStream();
138
+
139
+ /**
140
+ * Returns the matched e-mail address (i.e. the e-mail address of the recipient).
141
+ *
142
+ * @return string the e-mail address.
143
+ * @since API 1.6.1
144
+ */
145
+ public function getMatchedEmailAddress();
146
+
147
+ /**
148
+ * Returns the state of the recipient for the current bounce.<br>
149
+ * The possible recipient states are:
150
+ * <ul>
151
+ * <li>RECIPIENT_STATE_UNKNOWN - no attributes are queried or recipient is unknown.
152
+ * <li>RECIPIENT_STATE_EXISTENT - recipient exists.
153
+ * <li>RECIPIENT_STATE_DELETED - recipient is deleted.
154
+ * </ul>
155
+ *
156
+ * @return int the recipient state.
157
+ * @since API 1.6.1
158
+ */
159
+ public function getRecipientState();
160
+
161
+
162
+ /**
163
+ * Returns the integer value for the given recipient Attribute.
164
+ *
165
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
166
+ * @return int the integer value.
167
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
168
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>int</i>.
169
+ * @since API 1.6.1
170
+ */
171
+ public function getInteger( $attr );
172
+
173
+
174
+ /**
175
+ * Returns the string value for the given recipient Attribute.
176
+ *
177
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
178
+ * @return string the string value.
179
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
180
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>string</i>.
181
+ * @since API 1.6.1
182
+ */
183
+ public function getString( $attr );
184
+
185
+
186
+ /**
187
+ * Returns the datetime value for the given recipient Attribute.
188
+ *
189
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
190
+ * @return string the datetime value as ISO 8601 formatted datetime string.
191
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
192
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>datetime</i>.
193
+ * @since API 1.6.1
194
+ */
195
+ public function getDatetime( $attr );
196
+
197
+
198
+ /**
199
+ * Returns the date value for the given recipient Attribute.
200
+ *
201
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
202
+ * @return string the date value as ISO 8601 formatted date string.
203
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
204
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>date</i>.
205
+ * @since API 1.6.1
206
+ */
207
+ public function getDate( $attr );
208
+
209
+
210
+ /**
211
+ * Returns the time value for the given recipient Attribute.
212
+ *
213
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
214
+ * @return string the time value as ISO 8601 formatted time string.
215
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
216
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>time</i>.
217
+ * @since API 1.6.1
218
+ */
219
+ public function getTime( $attr );
220
+
221
+
222
+ /**
223
+ * Returns the Double value for the given recipient Attribute.
224
+ *
225
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
226
+ * @return double the Double value.
227
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
228
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>double</i>.
229
+ * @since API 1.6.1
230
+ */
231
+ public function getDouble( $attr );
232
+
233
+
234
+ /**
235
+ * Returns the Boolean value for the given recipient Attribute.
236
+ *
237
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
238
+ * @return bool the Boolean value.
239
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
240
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>bool</i>.
241
+ * @since API 1.6.1
242
+ */
243
+ public function getBoolean( $attr );
244
+
245
+
246
+ /**
247
+ * Returns the Object value for the given recipient Attribute.
248
+ *
249
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
250
+ * @return mixed the value.
251
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
252
+ * @since API 1.6.1
253
+ */
254
+ public function getObject( $attr );
255
+
256
+
257
+ }
lib/Inx/Api/Bounce/BounceManager.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Bounce
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Bounce_BounceManager</i> can be used to retrieve bounces.
8
+ * There are different methods for the retrieval of bounces, for example you can retrieve bounces by date.
9
+ * The following example returns an <i>Inx_Api_BOResultSet</i> containing all bounces in the system:
10
+ *
11
+ * <PRE>
12
+ * $oBounceManager = $oSession->getBounceManager();
13
+ * $oBOResultSet = $oBounceManager->selectAll();
14
+ *
15
+ * for( $i = 0; $i &lt; $oBOResultSet->size(); $i++ )
16
+ * {
17
+ * $oBounce = $oBOResultSet->get( $i );
18
+ * echo $oBounce->getSubject()."&#60;br&#62;";
19
+ * }
20
+ *
21
+ * $oBOResultSet->close();
22
+ * </PRE>
23
+ *
24
+ * Note: The <i>select*()</i> methods retrieve no recipient information but the id. If you wish to retrieve the
25
+ * recipient state or some of the recipients attributes, use the
26
+ * <i>select*(..., Inx_Api_Recipient_RecipientContext, Inx_Api_Recipient_Attribute[])</i> methods instead.
27
+ * <p>
28
+ * Note: The usage of bounces requires the api user right:
29
+ * <i>Inx_Api_UserRights::ERRORMAIL_FEATURE_USE</i>
30
+ * <p>
31
+ * For more information on bounces, see the <i>Inx_Api_Bounce_Bounce</i> documentation.
32
+ *
33
+ * @see Inx_Api_Bounce_Bounce
34
+ * @since API 1.4.3
35
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
36
+ * @package Inxmail
37
+ * @subpackage Bounce
38
+ */
39
+ interface Inx_Api_Bounce_BounceManager extends Inx_Api_BOManager
40
+ {
41
+ /**
42
+ * Returns a result set containing all bounces which occurred before the specified date.
43
+ * If the <i>Inx_Api_Recipient_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i> array
44
+ * contains at least one element, the retrieved bounces will contain information about the recipient state and the
45
+ * specified recipient attributes.
46
+ *
47
+ * @param string $searchDate all bounces before this date will be selected. The date has to be formatted as ISO 8601.
48
+ * @param Inx_Api_Recipient_RecipientContext $oRc the <i>Inx_Api_Recipient_RecipientContext</i>.
49
+ * See <i>Inx_Api_Session->createRecipientContext()</i>.
50
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
51
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
52
+ * @return an <i>Inx_Api_BOResultSet</i> containing all bounces matching the condition.
53
+ * @since API 1.6.1
54
+ */
55
+ public function selectBefore( $searchDate, Inx_Api_Recipient_RecipientContext $oRc = null,array $aAttrs = null );
56
+
57
+
58
+ /**
59
+ * Returns a result set containing all bounces which occurred after the specified date.
60
+ * If the <i>Inx_Api_Recipient_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i> array
61
+ * contains at least one element, the retrieved bounces will contain information about the recipient state and the
62
+ * specified recipient attributes.
63
+ *
64
+ * @param string $searchDate all bounces after this date will be selected. The date has to be formatted as ISO 8601.
65
+ * @param Inx_Api_Recipient_RecipientContext $oRc the <i>Inx_Api_Recipient_RecipientContext</i>.
66
+ * See <i>Inx_Api_Session->createRecipientContext()</i>.
67
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
68
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
69
+ * @return an <i>Inx_Api_BOResultSet</i> containing all bounces matching the condition.
70
+ * @since API 1.6.1
71
+ */
72
+ public function selectAfter( $searchDate, Inx_Api_Recipient_RecipientContext $oRc = null,array $aAttrs = null );
73
+
74
+
75
+ /**
76
+ * Returns a result set containing all bounces which occurred between the specified dates.
77
+ * If the <i>Inx_Api_Recipient_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i> array
78
+ * contains at least one element, the retrieved bounces will contain information about the recipient state and the
79
+ * specified recipient attributes.
80
+ *
81
+ * @param string $startDate the start date. The date has to be formatted as ISO 8601.
82
+ * @param string $stopDate the stop date. The date has to be formatted as ISO 8601.
83
+ * @param Inx_Api_Recipient_RecipientContext $oRc the <i>Inx_Api_Recipient_RecipientContext</i>.
84
+ * See <i>Inx_Api_Session->createRecipientContext()</i>.
85
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
86
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
87
+ * @return an <i>Inx_Api_BOResultSet</i> containing all bounces matching the condition.
88
+ * @since API 1.6.1
89
+ */
90
+ public function selectBetween( $startDate, $stopDate, Inx_Api_Recipient_RecipientContext $oRc = null,array $aAttrs = null );
91
+
92
+ /**
93
+ * Returns a result set containing all bounces regarding the specified mailing.
94
+ * If there are no bounces, an empty result set will be returned.
95
+ * If the <i>Inx_Api_Recipient_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i> array
96
+ * contains at least one element, the retrieved bounces will contain information about the recipient state and the
97
+ * specified recipient attributes.
98
+ *
99
+ * @param int $mailingId the id of the mailing.
100
+ * @param Inx_Api_Recipient_RecipientContext $oRc the <i>Inx_Api_Recipient_RecipientContext</i>.
101
+ * See <i>Inx_Api_Session->createRecipientContext()</i>.
102
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
103
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
104
+ * @return an <i>Inx_Api_BOResultSet</i> containing all bounces matching the condition.
105
+ * @since API 1.6.1
106
+ */
107
+ public function selectByMailingId( $mailingId, Inx_Api_Recipient_RecipientContext $oRc = null,array $aAttrs = null );
108
+
109
+
110
+ /**
111
+ * Returns a result set containing all bounces regarding the specified list.
112
+ * If there are no bounces, an empty result set will be returned.
113
+ * If the <i>Inx_Api_Recipient_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i> array
114
+ * contains at least one element, the retrieved bounces will contain information about the recipient state and the
115
+ * specified recipient attributes.
116
+ *
117
+ * @param int $listId the id of the list.
118
+ * @param Inx_Api_Recipient_RecipientContext $oRc the <i>Inx_Api_Recipient_RecipientContext</i>.
119
+ * See <i>Inx_Api_Session->createRecipientContext()</i>.
120
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
121
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
122
+ * @return an <i>Inx_Api_BOResultSet</i> containing all bounces matching the condition.
123
+ * @since API 1.6.1
124
+ */
125
+ public function selectByListId( $listId, Inx_Api_Recipient_RecipientContext $oRc = null,array $aAttrs = null );
126
+
127
+ /**
128
+ * Returns a result set containing all bounces.
129
+ * If there are no bounces, an empty result set will be returned.
130
+ * If the <i>Inx_Api_Recipient_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i> array
131
+ * contains at least one element, the retrieved bounces will contain information about the recipient state and the
132
+ * specified recipient attributes.
133
+ *
134
+ * @param Inx_Api_Recipient_RecipientContext $oRc the <i>Inx_Api_Recipient_RecipientContext</i>.
135
+ * See <i>Inx_Api_Session->createRecipientContext()</i>.
136
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
137
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
138
+ * @return an <i>Inx_Api_BOResultSet</i> containing all bounces matching the condition.
139
+ * @since API 1.6.1
140
+ */
141
+ public function selectAllBounces(Inx_Api_Recipient_RecipientContext $oRc = null,array $aAttrs = null);
142
+
143
+ }
lib/Inx/Api/BusinessObject.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * The API gives access to objects of Inxmail, which are called "BusinessObjects".
7
+ * For example, a mailing lists in Inxmail is such a Business Object.
8
+ *
9
+ * Values <i>of Inx_Api_BusinessObject</i>s can be changed with the "update" methods
10
+ * (like <i>updateName()</i>). By calling <i>commitUpdate()</i> on such an object,
11
+ * changes will be passed to the server. Rollback is done by the <i>reload()</i>
12
+ * method, which reloads the object and discards all uncomitted changes.
13
+ *
14
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
15
+ * @package Inxmail
16
+ */
17
+ interface Inx_Api_BusinessObject
18
+ {
19
+
20
+ /**
21
+ * Returns the unique identifier of this <i>Inx_Api_BusinessObject</i>.
22
+ *
23
+ * @return int the unique identifier.
24
+ */
25
+ public function getId();
26
+
27
+
28
+ /**
29
+ * Passes all changes made since the last commit to the server.
30
+ *
31
+ * @throws Inx_Api_UpdateException if the update failed (e.g. one of the attributes is illegal).
32
+ * @throws Inx_Api_DataException if this business object could not be found on the server (e.g. the object was deleted).
33
+ */
34
+ public function commitUpdate();
35
+
36
+
37
+ /**
38
+ * Reloads this business object from the server. All changes uncomitted changes are lost.
39
+ *
40
+ * @throws Inx_Api_DataException if this business object could not be found on the server (e.g. the object was deleted).
41
+ */
42
+ public function reload();
43
+
44
+ }
lib/Inx/Api/ConnectException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_ConnectException</i> is thrown when a connection to the server cannot be established
7
+ * via the static methods provided by <i>Session</i>.
8
+ * Possible reasons for this exception include:
9
+ * <ul>
10
+ * <li>An invalid application URL was provided
11
+ * <li>The server is not reachable
12
+ * </ul>
13
+ *
14
+ * @package Inxmail
15
+ */
16
+ class Inx_Api_ConnectException extends Exception
17
+ {
18
+
19
+ }
lib/Inx/Api/DataAccess/ClickData.php ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DataAccess
5
+ */
6
+
7
+
8
+ /**
9
+ * An <i>Inx_Api_DataAccess_ClickData</i> object can be used to retrieve information about a specific click
10
+ * accessible through an <i>Inx_Api_DataAccess_ClickDataRowSet</i>.
11
+ * A row set can be obtained using various filters:
12
+ * <ul>
13
+ * <li>mailing: <i>selectByMailing(int, RecipientContext, Attribute[])</i>
14
+ * <li>link: <i>selectByLink(int, RecipientContext, Attribute[])</i>
15
+ * <li>recipient: <i>selectByRecipient(int, RecipientContext, Attribute[])</i>
16
+ * <li>recipient and mailing: <i>selectByRecipientAndMailing(int, int, RecipientContext, Attribute[])</i>
17
+ * </ul>
18
+ * <p>
19
+ * All of these methods offer variants to filter the result by date. You can search for click data before or after a
20
+ * specific date or between two specific dates.
21
+ * <p>
22
+ * The following example returns a result set containing click data for the specified mailing and fetches the email
23
+ * address of the recipients:
24
+ *
25
+ * <pre>
26
+ * $oDataAccess = $oSession->getDataAccess();
27
+ * $oClickData = $oDataAccess->getClickData();
28
+ * $oRecipientContext = $oSession->createRecipientContext();
29
+ * $oEmail = $oRecipientContext->getMetaData()->getEmailAttribute();
30
+ * ...
31
+ * $oClickDataRowSet = $oClickData->selectByMailing( $iMailingId, $oRecipientContext, array($oEmail) );
32
+ * </pre>
33
+ *
34
+ * For more information on the data available for clicks, see the <i>Inx_Api_DataAccess_ClickDataRowSet</i> documentation.
35
+ *
36
+ * @see Inx_Api_DataAccess_DataAccess
37
+ * @see Inx_Api_DataAccess_ClickDataRowSet
38
+ * @since API 1.4.0
39
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
40
+ * @package Inxmail
41
+ * @subpackage DataAccess
42
+ */
43
+ interface Inx_Api_DataAccess_ClickData
44
+ {
45
+
46
+ /**
47
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
48
+ * regarding the specified mailing.
49
+ * If there is no click data, an empty row set will be returned.
50
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
51
+ * array contains at least one element, the retrieved click data will contain information about the recipient
52
+ * state and the specified recipient attributes.
53
+ *
54
+ * @param int $iMailingId the id of the mailing.
55
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
56
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
57
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
58
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
59
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
60
+ * the data produced by the given query.
61
+ */
62
+ public function selectByMailing( $iMailingId, Inx_Api_Recipient_RecipientContext $oRc,array $aAttrs = null);
63
+
64
+
65
+ /**
66
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
67
+ * regarding the specified mailing which occurred before the specified date.
68
+ * If there is no click data, an empty row set will be returned.
69
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
70
+ * array contains at least one element, the retrieved click data will contain information about the recipient
71
+ * state and the specified recipient attributes.
72
+ *
73
+ * @param int $iMailingId the id of the mailing.
74
+ * @param string $dtSearchDate all clicks before this date will be selected.
75
+ * The date has to be formatted as ISO 8601 date string.
76
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
77
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
78
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
79
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
80
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
81
+ * the data produced by the given query.
82
+ * @since API 1.6.2
83
+ */
84
+ public function selectByMailingBefore( $iMailingId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc,array $aAttrs = null);
85
+
86
+ /**
87
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
88
+ * regarding the specified mailing which occurred after the specified date.
89
+ * If there is no click data, an empty row set will be returned.
90
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
91
+ * array contains at least one element, the retrieved click data will contain information about the recipient
92
+ * state and the specified recipient attributes.
93
+ *
94
+ * @param int $iMailingId the id of the mailing.
95
+ * @param string $dtSearchDate all clicks after this date will be selected.
96
+ * The date has to be formatted as ISO 8601 date string.
97
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
98
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
99
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
100
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
101
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
102
+ * the data produced by the given query.
103
+ * @since API 1.6.2
104
+ */
105
+ public function selectByMailingAfter( $iMailingId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc,array $aAttrs = null);
106
+
107
+
108
+ /**
109
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
110
+ * regarding the specified mailing which occurred between the specified dates.
111
+ * If there is no click data, an empty row set will be returned.
112
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
113
+ * array contains at least one element, the retrieved click data will contain information about the recipient
114
+ * state and the specified recipient attributes.
115
+ *
116
+ * @param int $iMailingId the id of the mailing.
117
+ * @param string $dtStartDate the start date for the search.
118
+ * The date has to be formatted as ISO 8601 date string.
119
+ * @param string $dtEndDate the end date for the search.
120
+ * The date has to be formatted as ISO 8601 date string.
121
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
122
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
123
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
124
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
125
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
126
+ * the data produced by the given query.
127
+ * @since API 1.6.2
128
+ */
129
+ public function selectByMailingBetween( $iMailingId, $dtStartDate, $dtEndDate, Inx_Api_Recipient_RecipientContext $oRc,array $aAttrs = null);
130
+
131
+
132
+
133
+ /**
134
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
135
+ * regarding the specified link.
136
+ * If there is no click data, an empty row set will be returned.
137
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
138
+ * array contains at least one element, the retrieved click data will contain information about the recipient
139
+ * state and the specified recipient attributes.
140
+ *
141
+ * @param int $iLinkId the id of the link.
142
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
143
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
144
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
145
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
146
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
147
+ * the data produced by the given query.
148
+ */
149
+ public function selectByLink( $iLinkId,Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
150
+
151
+
152
+ /**
153
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
154
+ * regarding the specified link which occurred before the specified date.
155
+ * If there is no click data, an empty row set will be returned.
156
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
157
+ * array contains at least one element, the retrieved click data will contain information about the recipient
158
+ * state and the specified recipient attributes.
159
+ *
160
+ * @param int $iLinkId the id of the link.
161
+ * @param string $dtSearchDate all clicks before this date will be selected.
162
+ * The date has to be formatted as ISO 8601 date string.
163
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
164
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
165
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
166
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
167
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
168
+ * the data produced by the given query.
169
+ * @since API 1.6.2
170
+ */
171
+ public function selectByLinkBefore( $iLinkId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
172
+
173
+ /**
174
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
175
+ * regarding the specified link which occurred after the specified date.
176
+ * If there is no click data, an empty row set will be returned.
177
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
178
+ * array contains at least one element, the retrieved click data will contain information about the recipient
179
+ * state and the specified recipient attributes.
180
+ *
181
+ * @param int $iLinkId the id of the link.
182
+ * @param string $dtSearchDate all clicks after this date will be selected.
183
+ * The date has to be formatted as ISO 8601 date string.
184
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
185
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
186
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
187
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
188
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
189
+ * the data produced by the given query.
190
+ * @since API 1.6.2
191
+ */
192
+ public function selectByLinkAfter( $iLinkId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
193
+
194
+ /**
195
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
196
+ * regarding the specified link which occurred between the specified dates.
197
+ * If there is no click data, an empty row set will be returned.
198
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
199
+ * array contains at least one element, the retrieved click data will contain information about the recipient
200
+ * state and the specified recipient attributes.
201
+ *
202
+ * @param int $iLinkId the id of the link.
203
+ * @param string $dtStartDate the start date for the search.
204
+ * The date has to be formatted as ISO 8601 date string.
205
+ * @param string $dtEndDate the end date for the search.
206
+ * The date has to be formatted as ISO 8601 date string.
207
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
208
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
209
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
210
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
211
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
212
+ * the data produced by the given query.
213
+ * @since API 1.6.2
214
+ */
215
+ public function selectByLinkBetween( $iLinkId, $dtStartDate, $dtEndDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
216
+
217
+ /**
218
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
219
+ * regarding the specified recipient.
220
+ * If there is no click data, an empty row set will be returned.
221
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
222
+ * array contains at least one element, the retrieved click data will contain information about the recipient
223
+ * state and the specified recipient attributes.
224
+ *
225
+ * @param int $iRecipientId the id of the recipient.
226
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
227
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
228
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
229
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
230
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
231
+ * the data produced by the given query.
232
+ */
233
+ public function selectByRecipient( $iRecipientId, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
234
+
235
+ /**
236
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
237
+ * regarding the specified recipient which occurred before the specified date.
238
+ * If there is no click data, an empty row set will be returned.
239
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
240
+ * array contains at least one element, the retrieved click data will contain information about the recipient
241
+ * state and the specified recipient attributes.
242
+ *
243
+ * @param int $iRecipientId the id of the recipient.
244
+ * @param string $dtSearchDate all clicks before this date will be selected.
245
+ * The date has to be formatted as ISO 8601 date string.
246
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
247
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
248
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
249
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
250
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
251
+ * the data produced by the given query.
252
+ * @since API 1.6.2
253
+ */
254
+ public function selectByRecipientBefore( $iRecipientId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
255
+
256
+
257
+ /**
258
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
259
+ * regarding the specified recipient which occurred after the specified date.
260
+ * If there is no click data, an empty row set will be returned.
261
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
262
+ * array contains at least one element, the retrieved click data will contain information about the recipient
263
+ * state and the specified recipient attributes.
264
+ *
265
+ * @param int $iRecipientId the id of the recipient.
266
+ * @param string $dtSearchDate all clicks after this date will be selected.
267
+ * The date has to be formatted as ISO 8601 date string.
268
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
269
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
270
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
271
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
272
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
273
+ * the data produced by the given query.
274
+ * @since API 1.6.2
275
+ */
276
+ public function selectByRecipientAfter( $iRecipientId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
277
+
278
+ /**
279
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
280
+ * regarding the specified recipient which occurred between the specified dates.
281
+ * If there is no click data, an empty row set will be returned.
282
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
283
+ * array contains at least one element, the retrieved click data will contain information about the recipient
284
+ * state and the specified recipient attributes.
285
+ *
286
+ * @param int $iRecipientId the id of the recipient.
287
+ * @param string $dtStartDate the start date for the search.
288
+ * The date has to be formatted as ISO 8601 date string.
289
+ * @param string $dtEndDate the end date for the search.
290
+ * The date has to be formatted as ISO 8601 date string.
291
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
292
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
293
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
294
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
295
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
296
+ * the data produced by the given query.
297
+ * @since API 1.6.2
298
+ */
299
+ public function selectByRecipientBetween( $iRecipientId, $dtStartDate, $dtEndDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null );
300
+
301
+
302
+ /**
303
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
304
+ * regarding the specified recipient and mailing.
305
+ * If there is no click data, an empty row set will be returned.
306
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
307
+ * array contains at least one element, the retrieved click data will contain information about the recipient
308
+ * state and the specified recipient attributes.
309
+ *
310
+ * @param int $iRecipientId the id of the recipient.
311
+ * @param int $iMailingId the id of the mailing.
312
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
313
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
314
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
315
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
316
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
317
+ * the data produced by the given query.
318
+ */
319
+ public function selectByRecipientAndMailing( $iRecipientId, $iMailingId, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null);
320
+
321
+ /**
322
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
323
+ * regarding the specified recipient and mailing which occurred before the specified date.
324
+ * If there is no click data, an empty row set will be returned.
325
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
326
+ * array contains at least one element, the retrieved click data will contain information about the recipient
327
+ * state and the specified recipient attributes.
328
+ *
329
+ * @param int $iRecipientId the id of the recipient.
330
+ * @param int $iMailingId the id of the mailing.
331
+ * @param string $dtSearchDate all clicks before this date will be selected.
332
+ * The date has to be formatted as ISO 8601 date string.
333
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
334
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
335
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
336
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
337
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
338
+ * the data produced by the given query.
339
+ * @since API 1.6.2
340
+ */
341
+ public function selectByRecipientAndMailingBefore( $iRecipientId, $iMailingId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null);
342
+
343
+ /**
344
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
345
+ * regarding the specified recipient and mailing which occurred after the specified date.
346
+ * If there is no click data, an empty row set will be returned.
347
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
348
+ * array contains at least one element, the retrieved click data will contain information about the recipient
349
+ * state and the specified recipient attributes.
350
+ *
351
+ * @param int $iRecipientId the id of the recipient.
352
+ * @param int $iMailingId the id of the mailing.
353
+ * @param string $dtSearchDate all clicks after this date will be selected.
354
+ * The date has to be formatted as ISO 8601 date string.
355
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
356
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
357
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
358
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
359
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
360
+ * the data produced by the given query.
361
+ * @since API 1.6.2
362
+ */
363
+ public function selectByRecipientAndMailingAfter( $iRecipientId, $iMailingId, $dtSearchDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null);
364
+
365
+ /**
366
+ * This method returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing information about all clicks
367
+ * regarding the specified recipient and mailing which occurred between the specified dates.
368
+ * If there is no click data, an empty row set will be returned.
369
+ * If the <i>Inx_Api_Recipielt_RecipientContext</i> is not null and the <i>Inx_Api_Recipient_Attribute</i>
370
+ * array contains at least one element, the retrieved click data will contain information about the recipient
371
+ * state and the specified recipient attributes.
372
+ *
373
+ * @param int $iRecipientId the id of the recipient.
374
+ * @param int $iMailingId the id of the mailing.
375
+ * @param string $dtStartDate the start date for the search.
376
+ * The date has to be formatted as ISO 8601 date string.
377
+ * @param string $dtEndDate the end date for the search.
378
+ * The date has to be formatted as ISO 8601 date string.
379
+ * @param Inx_Api_Recipient_RecipientContext $oRc the recipient context.
380
+ * See <i>Inx_Api_Session->createRecipientContext()</i>
381
+ * @param array $aAttrs an array of <i>Inx_Api_Recipient_Attribute</i>s that will be fetched for later retrieval.
382
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>
383
+ * @return Inx_Api_DataAccess_ClickDataRowSet an <i>Inx_Api_DataAccess_ClickDataRowSet</i> object that contains
384
+ * the data produced by the given query.
385
+ * @since API 1.6.2
386
+ */
387
+ public function selectByRecipientAndMailingBetween( $iRecipientId, $iMailingId, $dtStartDate, $dtEndDate, Inx_Api_Recipient_RecipientContext $oRc, array $aAttrs = null);
388
+
389
+
390
+ }
lib/Inx/Api/DataAccess/ClickDataRowSet.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DataAccess
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_DataAccess_ClickDataRowSet</i> is used to access rows of click data resulting from a query.
8
+ * <p>
9
+ * The following data can be retrieved:
10
+ * <ul>
11
+ * <li><i>Click id</i>: the unique identifier of the click.
12
+ * <li><i>Link id</i>: which link was clicked?
13
+ * <li><i>Recipient id</i>: which recipient clicked the link?
14
+ * <li><i>Click date</i>: when did the click occur?
15
+ * <li><i>User agent</i>: which user agent was used by the recipient?
16
+ * <li><i>Remote host</i>: the recipients host address.
17
+ * <li><i>Recipient data</i>: various data about the recipient (like state or attributes).
18
+ * </ul>
19
+ * The recipient state can be one of the following:
20
+ * <ul>
21
+ * <li>RECIPIENT_STATE_UNKNOWN - if the click is anonymous or no attributes are queried.
22
+ * <li>RECIPIENT_STATE_EXISTENT - if the recipient exists.
23
+ * <li>RECIPIENT_STATE_DELETED - if the recipient was deleted.
24
+ * </ul>
25
+ * For information on how to navigate through an <i>Inx_Api_DataAccess_ClickDataRowSet</i>, see the
26
+ * <i>Inx_Api_DataAccess_DataRowSet</i> documentation.
27
+ * <p>
28
+ * For an example on how to query click data, see the <i>Inx_Api_DataAccess_ClickData</i> documentation.
29
+ * <p>
30
+ *
31
+ * @see Inx_Api_DataAccess_ClickData
32
+ * @see Inx_Api_DataAccess_DataRowSet
33
+ * @since API 1.4.0
34
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
35
+ * @package Inxmail
36
+ * @subpackage DataAccess
37
+ */
38
+ interface Inx_Api_DataAccess_ClickDataRowSet extends Inx_Api_DataAccess_DataRowSet
39
+ {
40
+ /**
41
+ * State for missing recipient information. This state will be used when no <i>Inx_Api_Recipient_RecipientContext</i>
42
+ * and/or no attributes are specified in the query or in case of an unknown recipient.
43
+ */
44
+ const RECIPIENT_STATE_UNKNOWN = 0;
45
+
46
+ /** State for existent recipient. */
47
+ const RECIPIENT_STATE_EXISTENT = 1;
48
+
49
+ /** State for non existing (deleted) recipient. */
50
+ const RECIPIENT_STATE_DELETED = 2;
51
+
52
+
53
+ /**
54
+ * Returns the unique identifier for the current click.
55
+ *
56
+ * @return int the id of the current click.
57
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
58
+ */
59
+ public function getClickId();
60
+
61
+
62
+ /**
63
+ * Returns the timestamp (date) when the current click occurred.
64
+ *
65
+ * @return string the timestamp (date) of the current click. The date will be returned as ISO 8601 formatted date string.
66
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
67
+ */
68
+ public function getClickTimestamp();
69
+
70
+
71
+ /**
72
+ * Returns the remote host which triggered the current click.
73
+ *
74
+ * @return string the remote host of the current click.
75
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
76
+ */
77
+ public function getRemoteHost();
78
+
79
+ /**
80
+ * Returns the user agent which was used for the current click.
81
+ *
82
+ * @return string the user agent of the current click.
83
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
84
+ */
85
+ public function getUserAgent();
86
+
87
+
88
+ /**
89
+ * Returns the id of the link which was clicked.
90
+ *
91
+ * @return int the link id of the current click.
92
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
93
+ */
94
+ public function getLinkId();
95
+
96
+ /**
97
+ * Returns the id of the recipient who performed the current click.
98
+ *
99
+ * @return int the recipient id of the current click.
100
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
101
+ */
102
+ public function getRecipientId();
103
+
104
+ /**
105
+ * Returns the state of the recipient who performed the current click.
106
+ * The possible recipient states are:
107
+ * <ul>
108
+ * <li>RECIPIENT_STATE_UNKNOWN - if the click is anonymous or no attributes are queried.
109
+ * <li>RECIPIENT_STATE_EXISTENT - if the recipient exists.
110
+ * <li>RECIPIENT_STATE_DELETED - if the recipient was deleted.
111
+ * </ul>
112
+ *
113
+ * @return int the recipient state.
114
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
115
+ */
116
+ public function getRecipientState();
117
+
118
+
119
+ /**
120
+ * Returns the integer value for the given recipient Attribute.
121
+ *
122
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
123
+ * @return int the integer value.
124
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
125
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>int</i>.
126
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
127
+ */
128
+ public function getInteger(Inx_Api_Recipient_Attribute $oAttr );
129
+
130
+
131
+ /**
132
+ * Returns the string value for the given recipient Attribute.
133
+ *
134
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
135
+ * @return string the string value.
136
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
137
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>string</i>.
138
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
139
+ */
140
+ public function getString(Inx_Api_Recipient_Attribute $oAttr );
141
+
142
+
143
+ /**
144
+ * Returns the datetime value for the given recipient Attribute.
145
+ *
146
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
147
+ * @return string the datetime value as ISO 8601 formatted datetime string.
148
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
149
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>datetime</i>.
150
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
151
+ */
152
+ public function getDatetime(Inx_Api_Recipient_Attribute $oAttr );
153
+
154
+ /**
155
+ * Returns the date value for the given recipient Attribute.
156
+ *
157
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
158
+ * @return string the datetime value as ISO 8601 formatted date string.
159
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
160
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>date</i>.
161
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
162
+ */
163
+ public function getDate(Inx_Api_Recipient_Attribute $oAttr );
164
+
165
+
166
+ /**
167
+ * Returns the time value for the given recipient Attribute.
168
+ *
169
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
170
+ * @return string the time value as ISO 8601 formatted time string.
171
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
172
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>time</i>.
173
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
174
+ */
175
+ public function getTime(Inx_Api_Recipient_Attribute $oAttr );
176
+
177
+ /**
178
+ * Returns the double value for the given recipient Attribute.
179
+ *
180
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
181
+ * @return double the double value.
182
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
183
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>double</i>.
184
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
185
+ */
186
+ public function getDouble(Inx_Api_Recipient_Attribute $oAttr );
187
+
188
+ /**
189
+ * Returns the bool value for the given recipient Attribute.
190
+ *
191
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
192
+ * @return bool the bool value.
193
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
194
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>bool</i>.
195
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
196
+ */
197
+ public function getBoolean(Inx_Api_Recipient_Attribute $oAttr );
198
+
199
+ /**
200
+ * Returns the value for the given recipient Attribute.
201
+ *
202
+ * @param Inx_Api_Recipient_Attribute $oAttr the recipient attribute to be retrieved.
203
+ * @return mixed the value.
204
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
205
+ * @throws DataException if no row is selected (e.g. you forgot to call next()).
206
+ */
207
+ public function getObject(Inx_Api_Recipient_Attribute $oAttr);
208
+
209
+ }
lib/Inx/Api/DataAccess/DataAccess.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DataAccess
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_DataAccess_DataAccess</i> object can be used to retrieve data regarding links and clicks.
8
+ * Link data can be retrieved using an <i>Inx_Api_DataAccess_LinkData</i> object, click data by using an
9
+ * <i>Inx_Api_DataAccess_ClickData</i> object. Both can be obtained via this class.
10
+ * <p>
11
+ * An <i>Inx_Api_DataAccess_LinkData</i> object can retrieve link data with the following filters:
12
+ * <ul>
13
+ * <li><i>Link id</i>: fetches a link by its unique identifier.
14
+ * <li><i>Link name</i>: fetches a link by its name.
15
+ * <li><i>Mailing id</i>: fetches all links used in the specified mailing.
16
+ * <li><i>Recipient id</i>: fetches all links the specified user has clicked.
17
+ * </ul>
18
+ * <p>
19
+ * An <i>Inx_Api_DataAccess_ClickData</i> object can retrieve click data with the following filters:
20
+ * <ul>
21
+ * <li><i>Mailing id</i>: fetches all clicks of links of the specified mailing.
22
+ * <li><i>Recipient id</i>: fetches all clicks performed by the specified recipient.
23
+ * <li><i>Mailing + Recipient id</i>: combination of the two above filters.
24
+ * <li><i>Link id</i>: fetches all clicks of the specified link.
25
+ * </ul>
26
+ * All of the click data filters can be combined with a date filter: before, after or between.
27
+ * <p>
28
+ * <i>Inx_Api_DataAccess_LinkData</i> and <i>Inx_Api_DataAccess_ClickData</i> retrieve the information as result set:
29
+ * <i>Inx_Api_DataAccess_LinkDataRowSet</i> for link data and <i>Inx_Api_DataAccess_ClickDataRowSet</i> for click data.
30
+ * Using these result sets it is easy to navigate through the data retrieved by the various methods.
31
+ * <p>
32
+ * The following snippet returns an <i>Inx_Api_DataAccess_LinkDataRowSet</i> containing all link data for the given
33
+ * recipient id:
34
+ * <pre>
35
+ * DataAccess da = s.getDataAccess();
36
+ * LinkData ld = da.getLinkDataWithNewLinkType();
37
+ * ...
38
+ * LinkDataRowSet rowSet = ld.selectByRecipient( id );
39
+ * </pre>
40
+ * <p>
41
+ * The following snippet returns an <i>Inx_Api_DataAccess_ClickDataRowSet</i> containing all click data for the given
42
+ * recipient id:
43
+ * <pre>
44
+ * DataAccess da = s.getDataAccess();
45
+ * ClickData cd = da.getClickData();
46
+ * RecipientContext rc = s.createRecipientContext();
47
+ * Attribute email = rc.getMetaData().getEmailAttribute();
48
+ * ...
49
+ * ClickDataRowSet rowSet = cd.selectByRecipient( id, rc, new Attribute[]{email} );
50
+ * </pre>
51
+ * <p>
52
+ * Note: All data provided by <i>Inx_Api_DataAccess_DataAccess</i> is read only!
53
+ * <p>
54
+ * For more information about link and click data, see the <i>Inx_Api_DataAccess_LinkData</i> and
55
+ * <i>Inx_Api_DataAccess_ClickData</i> documentation.
56
+ *
57
+ * @see Inx_Api_DataAccess_LinkData
58
+ * @see Inx_Api_DataAccess_ClickData
59
+ * @since API 1.4.0
60
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
61
+ * @package Inxmail
62
+ * @subpackage DataAccess
63
+ */
64
+ interface Inx_Api_DataAccess_DataAccess
65
+ {
66
+ /**
67
+ * Returns the link data object which can used to access the link data.
68
+ *
69
+ * @deprecated old behavior is, that uniquely counted image links are counted as unique links. The new method
70
+ * <i>getLinkDataWithNewLinkType()</i> returns them separated in unique-count and opening-count links.
71
+ * @return Inx_Api_DataAccess_LinkData the link data object.
72
+ */
73
+ public function getLinkData();
74
+
75
+
76
+ /**
77
+ * Returns the link data object which can used to access the link data.<br>
78
+ * In this method unique counted image links are not counted as unique links. These links have the new type
79
+ * opening-count.
80
+ *
81
+ * @return Inx_Api_DataAccess_LinkData the link data object.
82
+ */
83
+ public function getLinkDataWithNewLinkType();
84
+
85
+
86
+ /**
87
+ * Returns the click data object which can be used to access the click data.<br>
88
+ *
89
+ * @return Inx_Api_DataAccess_ClickData the click data object.
90
+ */
91
+ public function getClickData();
92
+
93
+ }
lib/Inx/Api/DataAccess/DataRowSet.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DataAccess
5
+ */
6
+ /**
7
+ * <i>Inx_Api_DataAccess_DataRowSet</i> provides a common interface for row set navigation.
8
+ * The most important methods of <i>Inx_Api_DataAccess_DataRowSet</i> are <i>next()</i> and <i>close()</i>.
9
+ * The <i>next()</i> method can be used to iterate over the rows of the row set.
10
+ * The following snippet shows how to iterate over an <i>Inx_Api_DataAccess_DataRowSet</i>:
11
+ *
12
+ * <pre>
13
+ * $oDataRowSet = ... //get an Inx_Api_DataAccess_DataRowSet implementation
14
+ *
15
+ * while($oDataRowSet.next())
16
+ * {
17
+ * //retrieve some information from the row set.
18
+ * }
19
+ *
20
+ * $oDataRowSet.close();
21
+ * </pre>
22
+ *
23
+ * Be sure to call <i>next()</i> before the first retrieval statement on the row set. Initially the cursor is
24
+ * before the first row, thus no data can be retrieved from the row set before calling <i>next()</i>. Doing so
25
+ * will trigger an Inx_Api_DataException.
26
+ * <p>
27
+ * <strong>Note:</strong> An <i>Inx_Api_DataAccess_DataRowSet</i> object <strong>must</strong> be closed once it is not
28
+ * needed anymore to prevent memory leaks and other potentially harmful side effects.
29
+ *
30
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
31
+ * @package Inxmail
32
+ * @subpackage DataAccess
33
+ */
34
+ interface Inx_Api_DataAccess_DataRowSet
35
+ {
36
+
37
+ /**
38
+ * Moves the cursor to the front of
39
+ * this <i>Inx_Api_DataAccess_DataRowSet</i> object, just before the
40
+ * first row. This method has no effect if the result set contains no rows.
41
+ */
42
+ public function beforeFirstRow();
43
+
44
+ /**
45
+ * Moves the cursor to the end of
46
+ * this <i>Inx_Api_DataAccess_DataRowSet</i> object, just after the
47
+ * last row. This method has no effect if the result set contains no rows.
48
+ */
49
+ public function afterLastRow();
50
+
51
+ /**
52
+ * Moves the cursor to the given row number in
53
+ * this <i>Inx_Api_DataAccess_DataRowSet</i> object.
54
+ * The first row is row 0, the second is row 1, and so on.
55
+ *
56
+ * @param int $iRow the number of the row to which the cursor should move.
57
+ */
58
+ public function setRow( $iRow );
59
+
60
+ /**
61
+ * Retrieves the current row number.
62
+ * The first row is number 0, the second number 1, and so on.
63
+ *
64
+ * @return int the current row number.
65
+ */
66
+ public function getRow();
67
+
68
+ /**
69
+ * Moves the cursor down one row from its current position.
70
+ * An <i>Inx_Api_DataAccess_DataRowSet</i> cursor is initially positioned before the first row;
71
+ * the first call to the method <i>next()</i> makes the first row the current row;
72
+ * the second call makes the second row the current row, and so on.
73
+ *
74
+ * @return bool <i>true</i> if the new current row is valid, <i>false</i> if there are no more rows.
75
+ */
76
+ public function next();
77
+
78
+ /**
79
+ * Moves the cursor to the previous row in this <i>Inx_Api_DataAccess_DataRowSet</i> object.
80
+ *
81
+ * @return bool <i>true</i> if the new current row is valid, <i>false</i> if it is off the result set.
82
+ */
83
+ public function previous();
84
+
85
+ /**
86
+ * Returns the number of rows in this <i>Inx_Api_DataAccess_DataRowSet</i> object.
87
+ *
88
+ * @return int the number of rows.
89
+ */
90
+ public function getRowCount();
91
+
92
+ /**
93
+ * Releases the resources associated with this <i>Inx_Api_DataAccess_DataRowSet</i> object on the server immediately.
94
+ * <p>
95
+ * An <i>Inx_Api_DataAccess_DataRowSet</i> object <strong>must</strong> be closed once it is not
96
+ * needed anymore to prevent memory leaks and other potentially harmful side effects.
97
+ */
98
+ public function close();
99
+
100
+ }
lib/Inx/Api/DataAccess/LinkData.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DataAccess
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_DataAccess_LinkData</i> object can be used to retrieve information about a specific link
8
+ * accessible through an <i>Inx_Api_DataAccess_LinkDataRowSet</i>. A row set can be obtained using various filters:
9
+ * <ul>
10
+ * <li>Link id: <i>selectByLink(int)</i>
11
+ * <li>Link name: <i>selectByLinkName(String)</i>
12
+ * <li>Mailing id: <i>selectByMailing(int)</i>
13
+ * <li>Recipient id: <i>selectByRecipient(int)</i>
14
+ * </ul>
15
+ * <p>
16
+ * The following example returns a result set containing link data for the specified mailing:
17
+ * <pre>
18
+ * $oDataAccess = $oSession->getDataAccess();
19
+ * $oLinkData = $oDataAccess->getLinkDataWithNewLinkType();
20
+ * ...
21
+ * $oLinkDataRowSet = $oLinkData->selectByMailing( $iMailingId );
22
+ * </pre>
23
+ * For more information on the data available for links, see the <i>Inx_Api_DataAccess_LinkDataRowSet</i> documentation.
24
+ *
25
+ * @see Inx_Api_DataAccess_DataAccess
26
+ * @see Inx_Api_DataAccess_LinkDataRowSet
27
+ * @since API 1.4.0
28
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
29
+ * @package Inxmail
30
+ * @subpackage DataAccess
31
+ */
32
+ interface Inx_Api_DataAccess_LinkData
33
+ {
34
+
35
+ /**
36
+ * This method returns a row set containing information about all links in the specified mailing. If there is no
37
+ * link data, an empty row set will be returned.
38
+ *
39
+ * @param $iMailingId the id of the mailing.
40
+ * @return Inx_Api_DataAccess_LinkDataRowSet an <i>Inx_Api_DataAccess_LinkDataRowSet</i> object that contains the
41
+ * data produced by the given query.
42
+ */
43
+ public function selectByMailing( $iMailingId );
44
+
45
+
46
+ /**
47
+ * This method returns a row set containing information about the specified link. If there is no link data, an empty
48
+ * row set will be returned.
49
+ *
50
+ * @param in $iLinkId the id of the link.
51
+ * @return Inx_Api_DataAccess_LinkDataRowSet an <i>Inx_Api_DataAccess_LinkDataRowSet</i> object that contains the
52
+ * data produced by the given query.
53
+ */
54
+ public function selectByLink( $iLinkId );
55
+
56
+
57
+ /**
58
+ * This method returns a row set containing information about all links that were clicked by the given recipient. If
59
+ * there is no link data, an empty row set will be returned.
60
+ *
61
+ * @param int $iRecipient the id of the recipient.
62
+ * @return Inx_Api_DataAccess_LinkDataRowSet an <i>Inx_Api_DataAccess_LinkDataRowSet</i> object that contains the
63
+ * data produced by the given query.
64
+ */
65
+ public function selectByRecipient( $iRecipient );
66
+
67
+
68
+ /**
69
+ * This method returns a row set containing information about all links with the given name. If there is no link
70
+ * data, an empty row set will be returned.
71
+ *
72
+ * @param string $linkName the name of the link.
73
+ * @return Inx_Api_DataAccess_LinkDataRowSet an <i>Inx_Api_DataAccess_LinkDataRowSet</i> object that contains the
74
+ * data produced by the given query.
75
+ */
76
+ public function selectByLinkName( $linkName );
77
+
78
+ }
lib/Inx/Api/DataAccess/LinkDataRowSet.php ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DataAccess
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_DataAccess_LinkDataRowSet</i> is used to access rows of link data resulting from a query.
8
+ * Only tracked links - which can be used for opening analysis - will be fetched.
9
+ * <p>
10
+ * The following data can be retrieved:
11
+ * <ul>
12
+ * <li><i>Link id</i>: the unique identifier of the link.
13
+ * <li><i>Link name</i>: the name of the link (alias).
14
+ * <li><i>Link type</i>: the type of the link (see constants below).
15
+ * <lI><i>Link URL</i>: the Uniform resource locator (URL) of the link.
16
+ * <li><i>Action id</i>: the id of the action associated to this link, if any.
17
+ * <li><i>Mailing id</i>: the id of the mailing which contains the link.
18
+ * </ul>
19
+ * The link type can be one of the following:
20
+ * <ul>
21
+ * <li>LINK_TYPE_REDIRECT - can be used to perform actions before redirecting to the target URL.
22
+ * <li>LINK_TYPE_UNSUBSCRIBE - unsubscribes the current recipient without verification (deprecated).
23
+ * <li>LINK_TYPE_COUNT - tracking link that counts each click.
24
+ * <li>LINK_TYPE_UNIQUE_COUNT - tracking link that counts each click and the <i>first</i> click of every
25
+ * recipient.
26
+ * <li>LINK_TYPE_VERIFY_SUBSCRIPTION - verifies the subscription of the current recipient.
27
+ * <li>LINK_TYPE_VERIFY_UNSUBSCRIPTION - verifies the unsubscription of the current recipient.
28
+ * <li>LINK_TYPE_OPENING_COUNT - trackable image that counts each loading.
29
+ * <li>LINK_TYPE_CONTENT - tracking link embedded in external content (unique count).
30
+ * <li>LINK_TYPE_OPENING_CONTENT - trackable image embedded in external content (unique count).
31
+ * <li>LINK_TYPE_UNSUBSCRIBE_LINK - unsubscribes the current recipient without verification.
32
+ * <li>LINK_TYPE_HEADER_UNSUBSCRIBE - unsubscribes the current recipient using the header unsubscription.
33
+ * Clients which support this feature (like Google mail) will show an unsubscription button at the head of the mailing.
34
+ * <li>LINK_TYPE_JSP_UNSUBSCRIBE - unsubscribes the current recipient using a JSP landing page.
35
+ * <li>LINK_TYPE_PAGE_UNSUBSCRIBE - unsubscribes the current recipient using a HTML landing page.
36
+ * <li>LINK_TYPE_UNKNOWN - unknown link type used for legacy APIs (server version > API version).
37
+ * </ul>
38
+ * For information on how to navigate through an <i>Inx_Api_DataAccess_LinkDataRowSet</i>, see the
39
+ * <i>Inx_Api_DataAccess_DataRowSet</i> documentation.
40
+ * <p>
41
+ * For an example on how to query link data, see the <i>Inx_Api_DataAccess_LinkData</i> documentation.
42
+ * <p>
43
+ *
44
+ * @see Inx_Api_DataAccess_LinkData
45
+ * @see Inx_Api_DataAccess_DataRowSet
46
+ * @since API 1.4.0
47
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
48
+ * @package Inxmail
49
+ * @subpackage DataAccess
50
+ */
51
+ interface Inx_Api_DataAccess_LinkDataRowSet extends Inx_Api_DataAccess_DataRowSet
52
+ {
53
+
54
+ /** The 'redirect' link type can be used to perform actions before redirecting to the target URL. */
55
+ const LINK_TYPE_REDIRECT = 0;
56
+
57
+ /**
58
+ * The deprecated 'unsubscribe' link type unsubscribes the current recipient without verification.
59
+ *
60
+ * @deprecated the new unsubscription link types are:
61
+ * <ul>
62
+ * <li>LINK_TYPE_UNSUBSCRIBE_LINK
63
+ * <li>LINK_TYPE_HEADER_UNSUBSCRIBE
64
+ * <li>LINK_TYPE_JSP_UNSUBSCRIBE
65
+ * <li>LINK_TYPE_PAGE_UNSUBSCRIBE
66
+ * </ul>
67
+ */
68
+ const LINK_TYPE_UNSUBSCRIBE = 1;
69
+
70
+ /** The 'count' link type counts each click of a particular link. */
71
+ const LINK_TYPE_COUNT = 2;
72
+
73
+ /**
74
+ * The 'unique count' link type counts each click of a particular link and the <i>first</i> click of a recipient
75
+ * (tracks the number of recipients that clicked the link). Both values can be used for reporting and analysis.
76
+ */
77
+ const LINK_TYPE_UNIQUE_COUNT = 3;
78
+
79
+ /** The 'verify subscription' link type verifies the subscription of the current recipient. */
80
+ const LINK_TYPE_VERIFY_SUBSCRIPTION = 5;
81
+
82
+ /** The 'verify unsubscription' link type verifies the unsubscription of the current recipient. */
83
+ const LINK_TYPE_VERIFY_UNSUBSCRIPTION = 6;
84
+
85
+ /**
86
+ * The 'opening count' link type is used to count the <i>first</i> loading of a particular image by a recipient.
87
+ *
88
+ * @see LINK_TYPE_UNIQUE_COUNT
89
+ */
90
+ const LINK_TYPE_OPENING_COUNT = 7;
91
+
92
+ /**
93
+ * The 'content' link type counts the number of recipients that click a link embedded in external content.
94
+ *
95
+ * @see LINK_TYPE_UNIQUE_COUNT
96
+ * @since API 1.8.0
97
+ */
98
+ const LINK_TYPE_CONTENT = 8;
99
+
100
+
101
+ /**
102
+ * The 'opening content' link type counts the number of recipients that load an image embedded in external content.
103
+ *
104
+ * @see LINK_TYPE_UNIQUE_COUNT
105
+ * @since API 1.8.0
106
+ */
107
+ const LINK_TYPE_OPENING_CONTENT = 9;
108
+
109
+
110
+ /**
111
+ * The 'unsubscribe link' link type unsubscribes the current recipient without verification.
112
+ *
113
+ * @since API 1.8.0
114
+ */
115
+ const LINK_TYPE_UNSUBSCRIBE_LINK = 10;
116
+
117
+
118
+ /**
119
+ * The 'header unsubscribe' link type unsubscribes the current recipient using the header unsubscription. Clients
120
+ * which support this feature (like Google mail) will show an unsubscription button at the head of the mailing.
121
+ *
122
+ * @since API 1.8.0
123
+ */
124
+ const LINK_TYPE_HEADER_UNSUBSCRIBE = 11;
125
+
126
+
127
+ /**
128
+ * The 'JSP unsubscribe' link type unsubscribes the current recipient using a JSP landing page.
129
+ *
130
+ * @since API 1.8.0
131
+ */
132
+ const LINK_TYPE_JSP_UNSUBSCRIBE = 12;
133
+
134
+
135
+ /**
136
+ * The 'page unsubscribe' link type unsubscribes the current recipient using a HTML landing page.
137
+ *
138
+ * @since API 1.8.0
139
+ */
140
+ const LINK_TYPE_PAGE_UNSUBSCRIBE = 13;
141
+
142
+
143
+ /**
144
+ * The 'unknown' link type is used for legacy APIs (server version > API version). This type will be used if the
145
+ * link type is not supported by the API.
146
+ *
147
+ * @since API 1.8.0
148
+ */
149
+ const LINK_TYPE_UNKNOWN = -1;
150
+
151
+
152
+ /**
153
+ * Returns the unique identifier of the current link.
154
+ *
155
+ * @return int the id of the current link.
156
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
157
+ */
158
+ public function getLinkId();
159
+
160
+ /**
161
+ * Returns the name of the current link.
162
+ *
163
+ * @return string the name of the current link.
164
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
165
+ */
166
+ public function getLinkName();
167
+
168
+
169
+ /**
170
+ * Returns the uniform resource locator (URL) of the current link.
171
+ *
172
+ * @return string the URL of the current link.
173
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
174
+ */
175
+ public function getLinkUrl();
176
+
177
+ /**
178
+ * Returns the type of the current link. The possible types are:<br>
179
+ * <ul>
180
+ * <li>LINK_TYPE_REDIRECT - can be used to perform actions before redirecting to the target URL.
181
+ * <li>LINK_TYPE_UNSUBSCRIBE - unsubscribes the current recipient without verification (deprecated).
182
+ * <li>LINK_TYPE_COUNT - tracking link that counts each click.
183
+ * <li>LINK_TYPE_UNIQUE_COUNT - tracking link that counts each click and the <i>first</i> click of every
184
+ * recipient.
185
+ * <li>LINK_TYPE_VERIFY_SUBSCRIPTION - verifies the subscription of the current recipient.
186
+ * <li>LINK_TYPE_VERIFY_UNSUBSCRIPTION - verifies the unsubscription of the current recipient.
187
+ * <li>LINK_TYPE_OPENING_COUNT - trackable image that counts each loading.
188
+ * <li>LINK_TYPE_CONTENT - tracking link embedded in external content (unique count).
189
+ * <li>LINK_TYPE_OPENING_CONTENT - trackable image embedded in external content (unique count).
190
+ * <li>LINK_TYPE_UNSUBSCRIBE_LINK - unsubscribes the current recipient without verification.
191
+ * <li>LINK_TYPE_HEADER_UNSUBSCRIBE - unsubscribes the current recipient using the header unsubscription.
192
+ * Clients which support this feature (like Google mail) will show an unsubscription button at the head of the
193
+ * mailing.
194
+ * <li>LINK_TYPE_JSP_UNSUBSCRIBE - unsubscribes the current recipient using a JSP landing page.
195
+ * <li>LINK_TYPE_PAGE_UNSUBSCRIBE - unsubscribes the current recipient using a HTML landing page.
196
+ * <li>LINK_TYPE_UNKNOWN - unknown link type used for legacy APIs (server version > API version).
197
+ * </ul>
198
+ *
199
+ * @return int the type of the current link.
200
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
201
+ */
202
+ public function getLinkType();
203
+
204
+ /**
205
+ * Returns the id of the action associated to this link, or 0 if no action is associated to this link.
206
+ *
207
+ * @return int the id of the associated action, or 0.
208
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
209
+ */
210
+ public function getActionId();
211
+
212
+ /**
213
+ * Returns the id of the mailing which contains the current link.
214
+ *
215
+ * @return int the id of the mailing which contains the current link.
216
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
217
+ */
218
+ public function getMailingId();
219
+
220
+ }
lib/Inx/Api/DataException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_DataException</i> is thrown when a <i>BusinessObject</i> cannot be found on the server.
7
+ * Example: Calling <code>commitUpdate()</code> on a <code>BusinessObject</code> that was deleted will result in a
8
+ * <code>DataException</code>.
9
+ *
10
+ * @see Inx_Api_BusinessObject#commitUpdate()
11
+ * @see Inx_Api_BusinessObject#reload()
12
+ * @see Inx_Api_BOResultSet#get(int)
13
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
14
+ * @package Inxmail
15
+ */
16
+ class Inx_Api_DataException extends Exception
17
+ {
18
+
19
+ }
lib/Inx/Api/DesignTemplate/DesignCollection.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DesignTemplate
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_DesignTemplate_DesignCollection</i> represents a set of templates which are stored in an itc file.
8
+ * Templates can be used to create complex multipart mailings which are based on a common structure defined by the template.
9
+ * Templates simplify the creation of such mailings by using a specialized editor which aids in the structuring of the mailing.
10
+ * <p>
11
+ * The following design collection data can be retrieved:
12
+ * <ul>
13
+ * <li><i>Collection name</i>: the technical name of the design collection.
14
+ * <li><i>Display name</i>: the display name of the design collection.
15
+ * <li><i>Collection vendor</i>: the name of the design collection vendor.
16
+ * <li><i>Vendor URL</i>: the uniform resource locator (URL) of the vendor (i.e. the vendors web site).
17
+ * <li><i>Collection version</i>: the version of the design collection.
18
+ * <li><i>Last modification date</i>: the date when the design collection was imported (the last time).
19
+ * <li><i>Contained templates</i>: the templates contained by the design collection.
20
+ * </ul>
21
+ * <p>
22
+ * Note: All data provided by <i>Inx_Api_DesignTemplate_DesignCollection</i> is read only!
23
+ * <p>
24
+ * For an example on how to import and use design collections, see the <i>Inx_Api_DesignTemplate_DesignCollectionManager</i>
25
+ * documentation.
26
+ *
27
+ * @see Inx_Api_DesignTemplate_DesignCollectionManager
28
+ * @see Inx_Api_DesignTemplate_Template
29
+ * @since API 1.4.0
30
+ * @version $Revision: 9553 $Date: 2007-01-25 15:00:09 $ $Author: nds$
31
+ * @package Inxmail
32
+ * @subpackage DesignTemplate
33
+ */
34
+ interface Inx_Api_DesignTemplate_DesignCollection extends Inx_Api_BusinessObject
35
+ {
36
+ /**
37
+ * Returns the technical name of the design collection.
38
+ *
39
+ * @return string the technical name of the design collection.
40
+ */
41
+ public function getName();
42
+
43
+ /**
44
+ * Returns the display name of the design collection.
45
+ *
46
+ * @return string the display name of the design collection.
47
+ * @since API 1.9.0
48
+ */
49
+ public function getDisplayName();
50
+
51
+ /**
52
+ * Returns the name of the design collection vendor.
53
+ *
54
+ * @return string the name of the design collection vendor.
55
+ */
56
+ public function getVendor();
57
+
58
+ /**
59
+ * Returns the uniform resource locator (URL) of the vendor (i.e. the vendors web site).
60
+ *
61
+ * @return string the URL of the design collection vendor.
62
+ */
63
+ public function getVendorURL();
64
+
65
+ /**
66
+ * Returns the version of the design collection.
67
+ *
68
+ * @return string the version of the design collection.
69
+ */
70
+ public function getVersion();
71
+
72
+ /**
73
+ * Returns the date when the design collection was imported (the last time).
74
+ *
75
+ * @return string the date of the last modification of the design collection.
76
+ * The date will be returned as ISO 8601 formatted datetime string.
77
+ */
78
+ public function getLastModificationDate();
79
+
80
+ /**
81
+ * Returns all templates contained by this design collection.
82
+ *
83
+ * @return an array of all <i>Inx_Api_DesignTemplate_Template</i>s contained by this design collection.
84
+ */
85
+ public function getTemplates();
86
+ }
lib/Inx/Api/DesignTemplate/DesignCollectionManager.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DesignTemplate
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_DesignTemplate_DesignCollectionMananger</i> can be used to access <i>Inx_Api_DesignTemplate_DesignCollection</i>s.
8
+ * You can import design collections from itc files into a specific list or all lists (by using the <i>SystemListContext</i>).
9
+ * You can also retrieve the collections available in a specific list or all lists (by ommitting the list parameter).
10
+ * <p>
11
+ * <i>Inx_Api_DesignTemplate_DesignCollection</i>s are returned in an <i>Inx_Api_BOResultSet</i> that may be used to access
12
+ * the individual collections.
13
+ * <i>Inx_Api_DesignTemplate_DesignCollection</i>s may contain multiple templates with possibly multiple text and HTML styles.
14
+ * These styles can be used to create new mailings based on the chosen template.
15
+ * <p>
16
+ * The following snippet shows how to generate a mailing based on a newly imported design collection:
17
+ *
18
+ * <pre>
19
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Name of the desired List&quot; );
20
+ * $oMailing = $oSession->getMailingManager()->createMailing( $oListContext );
21
+ * $oMailing->setContentHandler( &quot;Inx_Api_Mailing_XsltMultiPartContentHandler&quot; );
22
+ *
23
+ * $oDesignCollectionManager = $oSession->getDesignCollectionManager();
24
+ *
25
+ * $stream = fopen( &quot;test.itc&quot;, &quot;rb&quot;);
26
+ *
27
+ * $oDesignCollection = $oDesignCollectionManager->importDesignCollection( $stream, $oListContext );
28
+ * fclose($stream);
29
+ * $aTemplates = $oDesignCollection->getTemplates();
30
+ *
31
+ * $oContentHandler = $oMailing->getContentHandler();
32
+ * $aStyles = $aTemplates[0]->getHTMLStyles();
33
+ * $oContentHandler->updateStyle( $aStyles[0] );
34
+ *
35
+ * $oMailing->commitUpdate();
36
+ * </pre>
37
+ *
38
+ * </p>
39
+ * <p>
40
+ * The following snippet shows how to list all available HTML styles of all design collections in a certain list:
41
+ *
42
+ * <pre>
43
+ * $oDesignCollectionManager = $oSession->getDesignCollectionManager();
44
+ *
45
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Name of the desired List&quot; );
46
+ *
47
+ * $oBOResultSet = $oDesignCollectionManager->select($oListContext);
48
+ *
49
+ * for( $i = 0; $i&lt;$oBOResultSet->getSize(); $i++)
50
+ * {
51
+ * $oDesignCollection = $oBOResultSet->get($i);
52
+ * echo $oDesignCollection->getVendor();
53
+ * echo $oDesignCollection->getVendorURL();
54
+ * ...
55
+ * $aTemplates = $oDesignCollection->getTemplates();
56
+ * for($j = 0; $j&lt;count($aTemplates); $j++)
57
+ * {
58
+ * $oTemplate = $aTemplates[j];
59
+ * echo $oTemplate->getName();
60
+ * echo $oTemplate->getId();
61
+ * $aHtmlStyles = $oTemplate->getHTMLStyles();
62
+ * for ($k = 0; $k&lt;count($aHtmlStyles); $k++)
63
+ * {
64
+ * echo $aHtmlStyles[k]->getTemplateID();
65
+ * echo $aHtmlStyles[k]->getStyleName();
66
+ * }
67
+ * }
68
+ * }
69
+ *
70
+ * $oBOResultSet->close();
71
+ * </pre>
72
+ *
73
+ * </p>
74
+ * Note: The usage of <i>Inx_Api_DesignTemplate_DesignCollection</i>s requires the api user right:
75
+ * <i>Inx_Api_UserRights::TEMPLATE_FEATURE_USE</i>
76
+ * <p>
77
+ * For more information on design collections, see the <i>Inx_Api_DesignTemplate_DesignCollection</i> documentation.
78
+ *
79
+ * @see Inx_Api_DesignTemplate_DesignCollection
80
+ * @since API 1.4.0
81
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
82
+ * @package Inxmail
83
+ * @subpackage DesignTemplate
84
+ */
85
+
86
+ interface Inx_Api_DesignTemplate_DesignCollectionManager extends Inx_Api_BOManager
87
+ {
88
+ /**
89
+ * Imports the desired itc file into the specified list to be used there. Importing an itc into the system list will
90
+ * make the design collection available in all lists. The following snippet retrieves the system list context:
91
+ * <PRE>
92
+ * $oListContextManager = $oSession->getListContextManager();
93
+ * $oListContextc = $oListContextManager->findByName( Inx_Api_SystemListContext::NAME );
94
+ * </PRE>
95
+ *
96
+ * @param resource $rbItcFile the itc file handle from which the itc file will be read.
97
+ * @param Inx_Api_List_ListContext $oCxt the list to import the design collection into.
98
+ * @return Inx_Api_DesignTemplate_DesignCollection the generated <i>Inx_Api_DesignTemplate_DesignCollection</i>.
99
+ * @throws Inx_Api_IOException if the resource cannot be read.
100
+ * @throws Inx_Api_DesignTemplate_ImportException if an error occurred while importing the itc file.
101
+ * @throws Inx_Api_FeatureNotAvailableException if the design template feature is not available in the given list.
102
+ * This exception is thrown since API 1.9.0.
103
+ */
104
+ public function importDesignCollection( $rbItcFile, Inx_Api_List_ListContext $oCxt );
105
+
106
+ /**
107
+ * Returns the <i>Inx_Api_DesignTemplate_DesignCollection</i>s available in the specified list.
108
+ * To retrieve all design collections from all lists, pass on a <i>null</i> value.
109
+ *
110
+ * @param Inx_Api_List_ListContext $oListContext all design collections available in this list will be returned.
111
+ * @return Inx_Api_BOResultSet an <i>Inx_Api_BOResultSet</i> containing the fetched
112
+ * <i>Inx_Api_DesignTemplate_DesignCollection</i>s.
113
+ */
114
+ public function select( Inx_Api_List_ListContext $oListContext );
115
+
116
+
117
+
118
+ /**
119
+ * Returns the preview image, provided by the design collection. Can be null, if no image was provided.
120
+ * This method does not return an actual screenshot of a mailing generated with this
121
+ * <i>Inx_Api_DesignTemplate_Style</i>, but an image provided and generated by the design collection author.
122
+ *
123
+ * @return Inx_Api_InputStream an <i>Inx_Api_InputStream</i> containing the image data.
124
+ * @throws Inx_Api_NullPointerException when the passed style is <i>null</i>.
125
+ */
126
+ public function createPreviewImageStream( Inx_Api_DesignTemplate_Style $oStyle );
127
+ }
lib/Inx/Api/DesignTemplate/ImportException.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DesignTemplate
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_DesignTemplate_ImportException</i> is thrown, when an error occurs while importing an itc file.
9
+ * <p>
10
+ * There are several types of this exception:
11
+ * <ul>
12
+ * <li>NO_ITC_FILE: the provided file is no valid itc file.
13
+ * <li>IMPORT_ERROR: the import failed due to a non specific error.
14
+ * <li>XML_ERROR: the XML data of the itc file is not valid.
15
+ * <li>SYSTEM_ERROR: a major system error occurred.
16
+ * </ul>
17
+ * For further insight on the cause of the error, check the warnings, errors and fatals of this exception, using
18
+ * the corresponding method.
19
+ *
20
+ * @see Inx_Api_DesignTemplate_DesignCollectionManager::importDesignCollection($resource, $oListContext)
21
+ * @since API 1.4.0
22
+ * @version $Revision: 9497 $Date: 2007-01-25 15:00:09 $ $Author: nds$
23
+ * @package Inxmail
24
+ * @subpackage DesignTemplate
25
+ */
26
+ class Inx_Api_DesignTemplate_ImportException extends Exception
27
+ {
28
+ /**
29
+ * The provided import file is no valid itc file.
30
+ */
31
+ const NO_ITC_FILE = -1;
32
+
33
+ /**
34
+ * A non specific error occurred during the import.
35
+ * For further insight on the cause of the error, check the warnings, errors and fatals of this exception.
36
+ */
37
+ const IMPORT_ERROR = -2;
38
+
39
+ /**
40
+ * A major system error occurred during the import. Please check what happened exactly to prevent further failures.
41
+ * Tips for error analysis:
42
+ * <ul>
43
+ * <li>Check the warnings, errors and fatals of this exception
44
+ * <li>Check the customer log of your inxmail server (if possible)
45
+ * <li>Check the tomcat log of your inxmail server (if possible)
46
+ * </ul>
47
+ */
48
+ const SYSTEM_ERROR = -5;
49
+
50
+ /**
51
+ * The XML data of the itc file is not valid and cannot be parsed.
52
+ */
53
+ const XML_ERROR = -6;
54
+
55
+ private $aWarnings;
56
+
57
+ private $aErrors;
58
+
59
+ private $aFatals;
60
+
61
+ /**
62
+ * Creates an <i>Inx_Api_DesignTemplate_ImportException</i> with the given type, detail message, warnings,
63
+ * errors and fatals.
64
+ *
65
+ * @param int $iCode the type of the exception. Can be one of the constants defined by this exception.
66
+ * @param string $sMessage the detail message of the exception.
67
+ * @param array $aWarnings the warning messages (string) of the exception.
68
+ * @param array $aErrors the error messages (string) of the exception.
69
+ * @param array $aFatals the fatal messages (string) of the exception.
70
+ */
71
+ public function __construct( $sMessage, $iCode, $aWarnings, $aErrors,
72
+ $aFatals )
73
+ {
74
+ parent::__construct( $sMessage, $iCode );
75
+
76
+ $this->aWarnings = $aWarnings;
77
+ $this->aErrors = $aErrors;
78
+ $this->aFatals = $aFatals;
79
+ }
80
+
81
+ /**
82
+ * Returns the error level messages produced by exceptions during the import.
83
+ *
84
+ * @return array the error level messages (string).
85
+ */
86
+ public function getErrors()
87
+ {
88
+ return $this->aErrors;
89
+ }
90
+
91
+ /**
92
+ * Returns the fatal level messages produced by exceptions during the import.
93
+ *
94
+ * @return array the fatal level messages (string).
95
+ */
96
+ public function getFatals()
97
+ {
98
+ return $this->aFatals;
99
+ }
100
+
101
+ /**
102
+ * Returns the warning level messages produced by exceptions during the import.
103
+ *
104
+ * @return array the warning level messages (string).
105
+ */
106
+ public function getWarnings()
107
+ {
108
+ return $this->aWarnings;
109
+ }
110
+
111
+ }
lib/Inx/Api/DesignTemplate/Style.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DesignTemplate
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_DesignTemplate_Style</i> defines the visual representation of a particular template or mailing.
9
+ * The style will be used to render the mailing.
10
+ * <p>
11
+ * For more information on templates, see the <i>Inx_Api_DesignTemplate_Template</i> documentation.
12
+ *
13
+ * @see Inx_Api_DesignTemplate_Template
14
+ * @since API 1.4.0
15
+ * @version $Revision: 9497 $Date: 2007-01-25 15:00:09 $ $Author: nds$
16
+ * @package Inxmail
17
+ * @subpackage DesignTemplate
18
+ */
19
+ interface Inx_Api_DesignTemplate_Style
20
+ {
21
+ /**
22
+ * Returns the id of the template, which contains this style.
23
+ * @return int the id of the template, which contains this style.
24
+ */
25
+ public function getTemplateId();
26
+
27
+ /**
28
+ * Returns the name of this style.
29
+ * @return string the name of this style.
30
+ */
31
+ public function getStyleName();
32
+ }
lib/Inx/Api/DesignTemplate/Template.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage DesignTemplate
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_DesignTemplate_Template</i> provides a common structure for complex multipart mailings.
8
+ * A template may contain multiple (but at least one) text and HTML style which is used to render the mailing.
9
+ * Multiple <i>Inx_Api_DesignTemplate_Template</i>s can be stored in an <i>Inx_Api_DesignTemplate_DesignCollection</i>.
10
+ *
11
+ * @see Inx_Api_DesignTemplate_Style
12
+ * @see Inx_Api_DesignTemplate_DesignCollection
13
+ * @since API 1.4.0
14
+ * @version $Revision: 9497 $Date: 2007-01-25 15:00:09 $ $Author: nds$
15
+ * @package Inxmail
16
+ * @subpackage DesignTemplate
17
+ */
18
+ interface Inx_Api_DesignTemplate_Template
19
+ {
20
+ /**
21
+ * Returns the name of the template.
22
+ *
23
+ * @return string the name of the template.
24
+ */
25
+ public function getName();
26
+
27
+ /**
28
+ * Returns the id of the template.
29
+ *
30
+ * @return int the id of the template.
31
+ */
32
+ public function getId();
33
+
34
+ /**
35
+ * Returns all text <code>Style</code>s in this template. The default text style, which should be used for a
36
+ * multipart mailing, if there is no appropriate text style for the chosen HTML style, is the first in the array.
37
+ *
38
+ * @return array all text <i>Inx_Api_DesignTemplate_Style</i>s of this template.
39
+ * The default text style is the first in the array.
40
+ */
41
+ public function getTextStyles();
42
+
43
+ /**
44
+ * Returns all HTML <i>Inx_Api_DesignTemplate_Style</i>s in this template.
45
+ * Note, that to generate a multipart mailing, the HTML style should be passed on to the <i>Inx_Api_Mailing_XsltContentHandler</i>.
46
+ *
47
+ * @return array all HTML styles of this template.
48
+ */
49
+ public function getHTMLStyles();
50
+ }
lib/Inx/Api/FeatureNotAvailableException.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_FeatureNotAvailableException</i> is thrown when a feature is not available or not enabled in a list.
7
+ * <p>
8
+ * Example: Calling <i>Inx_Api__List_ListContext->enableFeature(Features::SUBSCRIPTION_FEATURE_ID)</i> on a dynamic
9
+ * list will raise a <i>FeatureNotAvailableException</i>. The same is true wehn calling
10
+ * <i>Inx_Api_Subscription_SubscriptionManager->processSubscription()</i> for a list with disabled subscription feature.
11
+ *
12
+ * @see Inx_Api_List_ListContext#enableFeature(int)
13
+ * @see Inx_Api_List_ListContext#disableFeature(int)
14
+ * @see Inx_Api_Subscription_SubscriptionManager#processSubscription(Inx_Api_List_StandardListContext, String)
15
+ * @see Inx_Api_Subscription_SubscriptionManager#processUnsubscription(Inx_Api_List_StandardListContext, String)
16
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
17
+ * @package Inxmail
18
+ */
19
+ class Inx_Api_FeatureNotAvailableException extends Inx_Api_APIException
20
+ {
21
+
22
+ }
lib/Inx/Api/Features.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * Agents, like "Mailing", "Subscription" or "Resource" are called "Features"
7
+ * in the API language. Which features are available can be obtained
8
+ * from the <i>Inx_Api_Features</i> interface.
9
+ *
10
+ * Features are enabled and disabled from the Inx_Api_List_ListContext, as following example
11
+ * demonstrates, which enables the "Subscription" agent in the choosen mailing list:
12
+ *
13
+ * <PRE>
14
+ * $oListContext = $oListManager->findByName( $sListName );
15
+ * $oListContext->enableFeature( Inx_Api_Features::SUBSCRIPTION_FEATURE_ID );
16
+ * </PRE>
17
+ *
18
+ *
19
+ * Not every feature is accessible for every type of list. For example, subscription
20
+ * feature is available in standard lists, only. The mailing feature can be used in
21
+ * standard and filter lists.
22
+ *
23
+ * @see Inx_Api_List_ListContext#isFeatureEnabled(int)
24
+ * @see Inx_Api_List_ListContext#enableFeature(int)
25
+ * @see Inx_Api_List_ListContext#disableFeature(int)
26
+ * @since API 1.0
27
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
28
+ * @package Inxmail
29
+ */
30
+ interface Inx_Api_Features
31
+ {
32
+
33
+ /**
34
+ * The subscription feature is available in:
35
+ * <ul>
36
+ * <li> standard lists </li>
37
+ * </ul>
38
+ * @since API 1.0
39
+ */
40
+ const SUBSCRIPTION_FEATURE_ID = 10000;
41
+
42
+ /**
43
+ * The mailing feature is available in:
44
+ * <ul>
45
+ * <li> standard lists
46
+ * <li> and filter lists
47
+ * </ul>
48
+ * @since API 1.0
49
+ */
50
+ const MAILING_FEATURE_ID = 10001;
51
+
52
+ /**
53
+ * The resource feature is available in:
54
+ * <ul>
55
+ * <li> system list
56
+ * </ul>
57
+ * @since API 1.0
58
+ */
59
+ const RESOURCE_FEATURE_ID = 10002;
60
+
61
+ /**
62
+ * The blacklist feature is available in:
63
+ * <ul>
64
+ * <li> system list
65
+ * </ul>
66
+ * @since API 1.1.0
67
+ */
68
+ const BLACKLIST_FEATURE_ID = 10003;
69
+
70
+ /**
71
+ * The filter feature is available in:
72
+ * <ul>
73
+ * <li> system list
74
+ * </ul>
75
+ * @since API 1.1.0
76
+ */
77
+ const FILTER_FEATURE_ID = 10004;
78
+
79
+ /**
80
+ * The report feature is available in:
81
+ * <ul>
82
+ * <li> standard lists
83
+ * <li> filter lists
84
+ * <li> and system list
85
+ * </ul>
86
+ * @since API 1.1.0
87
+ */
88
+ const REPORT_FEATURE_ID = 10005;
89
+
90
+ /**
91
+ * The action feature is available in:
92
+ * <ul>
93
+ * <li> system list
94
+ * </ul>
95
+ *
96
+ * @since API 1.1.2
97
+ */
98
+ const ACTION_FEATURE_ID = 10006;
99
+
100
+ /**
101
+ * The textmodule, mailing template and design template feature is available in:
102
+ * <ul>
103
+ * <li> standard lists
104
+ * <li> filter lists
105
+ * <li> and system list
106
+ * </ul>
107
+ *
108
+ * @since API 1.4.0
109
+ */
110
+ const TEXTMODULE_FEATURE_ID = 10007;
111
+
112
+
113
+ /**
114
+ * The testprofiles feature is available in:
115
+ * <ul>
116
+ * <li> standard lists
117
+ * <li> filter lists
118
+ * <li> and system list
119
+ * </ul>
120
+ *
121
+ * @since API 1.6.0
122
+ */
123
+ const TESTPROFILES_FEATURE_ID = 10008;
124
+
125
+ /**
126
+ * The template feature is available in:
127
+ * <ul>
128
+ * <li>standard lists
129
+ * <li>filter lists
130
+ * <li>and system list
131
+ *
132
+ * @since API 1.7.0
133
+ */
134
+ const TEMPLATE_FEATURE_ID = 10009;
135
+
136
+ }
lib/Inx/Api/Filter/Filter.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Filter
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Filter_Filter</i> is used to define target groups of recipients that share common properties.
8
+ * For example: All recipients born after 1970. To accomplish this, a <code>Filter</code> uses a statement.
9
+ * The statement syntax is described in the documentation for {@link #updateStatement(String)}.
10
+ * <p>
11
+ * For an example on how to create filters, see the <i>Inx_Api_Filter_FilterManager</i> documentation.
12
+ *
13
+ * @see Inx_Api_Filter_FilterManager
14
+ * @since API 1.1.0
15
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
16
+ * @package Inxmail
17
+ * @subpackage Filter
18
+ */
19
+ interface Inx_Api_Filter_Filter extends Inx_Api_BusinessObject
20
+ {
21
+ /**
22
+ * Constant for the name attribute. Used as order attribute in <i>select</i> statements.
23
+ *
24
+ * @see Inx_Api_Filter_FilterManager::select($oListContext, $iOrderAttribute, $iOrderType)
25
+ */
26
+ const ATTRIBUTE_NAME = 0;
27
+
28
+ /**
29
+ * Constant for the statement attribute.
30
+ */
31
+ const ATTRIBUTE_STATEMENT = 1;
32
+
33
+ /**
34
+ * Constant for the creation datetime attribute. Used as order attribute in <i>select</i> statements.
35
+ *
36
+ * @see Inx_Api_Filter_FilterManager::select($oListContext, $iOrderAttribute, $iOrderType)
37
+ */
38
+ const ATTRIBUTE_CREATION_DATETIME = 2;
39
+
40
+ /**
41
+ * Constant for the list context attribute.
42
+ */
43
+ const ATTRIBUTE_LIST_CONTEXT_ID = 3;
44
+
45
+
46
+ /**
47
+ * Returns the unique name of this filter.
48
+ *
49
+ * @return string the unique name of this filter.
50
+ */
51
+ public function getName();
52
+
53
+
54
+ /**
55
+ * Sets the unique name of this filter.
56
+ *
57
+ * @param string $sName the unique name of this filter.
58
+ */
59
+ public function updateName( $sName );
60
+
61
+
62
+ /**
63
+ * Returns the statment of this filter. The statement defines the target group of recipients.
64
+ *
65
+ * @return string the statment of this filter.
66
+ */
67
+ public function getStatement();
68
+
69
+
70
+ /**
71
+ * Sets the filter statement. The statement defines the target group of recipients.
72
+ * <p>
73
+ * A filter statement consists of at least one condition that recipients must match. Multiple conditions may be
74
+ * composed to a filter using the AND/OR operators. There are four possible condition types which may be used:
75
+ * <ul>
76
+ * <li><i>Column condition</i>: Compares the value of a column.
77
+ * <li><i>Recipient reaction condition</i>: Checks if a recipient opened a mailing or clicked a link.
78
+ * <li><i>Filter membership condition</i>: Checks if a recipient is member of a filter.
79
+ * <li><i>Free expression</i>: Special checks and comparisons.
80
+ * </ul>
81
+ * <p>
82
+ * The following operators may be used to compare columns to a given value or check their content:
83
+ * <ul>
84
+ * <li>column = value - checks for equality
85
+ * <li>column <> value - checks for inequality
86
+ * <li>column < value - checks if column value is less than given value
87
+ * <li>column <= value - checks if column value is less than or equal to given value
88
+ * <li>column > value - checks if column value is greater than given value
89
+ * <li>column >= value - checks if column value is greater than or equal to given value
90
+ * <li>column IS_EMPTY - checks if column value is empty
91
+ * <li>column NOT_IS_EMPTY - checks if column value is not empty
92
+ * </ul>
93
+ * The check values have to be specified in the same data type as the column value. The different date types must be
94
+ * specified as follows:
95
+ * <ul>
96
+ * <li><i>Text</i>: "Text" (be sure to escape the double quotes or use single quotes for the filter)
97
+ * <li><i>Datetime</i>: #01.01.1970 13:37:42# (be sure to put a single whitespace between date and time)
98
+ * <li><i>Date</i>: #01.01.1970#
99
+ * <li><i>Time</i>: #13:37:42#
100
+ * <li><i>Integer</i>: 42
101
+ * <li><i>Floating point</i>: 47.11
102
+ * <li><i>Boolean</i>: TRUE or FALSE (attention: case sensitive!)
103
+ * </ul>
104
+ * To specify the column which shall be compared it is best to use the Column("columnName") operator.
105
+ * <p>
106
+ * Using free expressions you can create more powerful statements. The operators which can be used in free
107
+ * expressions are:
108
+ * <ul>
109
+ * <li>column LIKE value: checks for equality (case insensitive)
110
+ * <li>column NOT_LIKE value: checks for inequality (case insensitive)
111
+ * <li>column STARTS_WITH value: checks if column value starts with given value
112
+ * <li>column NOT_STARTS_WITH value: checks if column value does not start with given value
113
+ * <li>column ENDS_WITH value: checks if column value ends with given value
114
+ * <li>column NOT_ENDS_WITH value: checks if column value does not end with given value
115
+ * <li>column CONTAINS value: checks if column value contains given value
116
+ * <li>column NOT_CONTAINS value: checks if column value does not contain given value
117
+ * </ul>
118
+ * All of these operators may be used along with text columns. The check values of free expressions may contain
119
+ * wildcards to match a specific pattern.<br>
120
+ * <strong>Note:</strong> The wilcard character used in free expressions is NOT the asterisk (*) but the percentage
121
+ * sign (%).
122
+ * <p>
123
+ * Recipient reaction conditions may be used to select recipients who reacted on a specific mailing or link. The
124
+ * operators used for recipient reaction conditions are:
125
+ * <ul>
126
+ * <li><i>HasOpened(mailingId)</i>: checks if the recipient opened the specified mailing
127
+ * <li><i>HasClickedAnyLink(mailingId)</i>: checks if the recipient clicked any link in the specified mailing
128
+ * <li><i>HasClicked(linkId)</i>: checks if the recipient clicked the specified link
129
+ * </ul>
130
+ * <p>
131
+ * Filter membership conditions may be used to select recipients who are (or aren't) member of another filter. The
132
+ * operators used for these checks are:
133
+ * <ul>
134
+ * <li><i>BelongsToGroup(filterName)</i>: checks if the recipient is a member of the specified filter.
135
+ * <li><i>BelongsNotToGroup(filterName)</i>: checks if the recipient is not a member of the specified filter.
136
+ * </ul>
137
+ * <p>
138
+ * Please note that date values for the filter have to be specified in german 24-hour date format. To accomplish this,
139
+ * the date() function with the following date pattern can be used:
140
+ * <pre>
141
+ * $filterDate = date("d.m.Y H:i:s");
142
+ * </pre>
143
+ *
144
+ * @param string $sStmt the filter statment.
145
+ */
146
+ public function updateStatement( $sStmt );
147
+
148
+
149
+ /**
150
+ * Returns the id of the list which this filter belongs to.
151
+ *
152
+ * @return int the id of the list which this filter belongs to.
153
+ */
154
+ public function getListContextId();
155
+
156
+
157
+ /**
158
+ * Returns the creation datetime of this filter.
159
+ *
160
+ * @return string the creation datetime of this filter. The creation datetime will be returned as ISO 8601
161
+ * formatted datetime string.
162
+ */
163
+ public function getCreationDatetime();
164
+
165
+ }
lib/Inx/Api/Filter/FilterManager.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Filter
5
+ */
6
+ /**
7
+ * Often, mailings are to be sent not to the whole recipient list but only to a certain subgroup of recipients.
8
+ * Examples for such target groups are 'All recipients who read HTML format', 'Women', 'Men', 'People interested in
9
+ * product X', 'Recipients born after 1970', and so on.
10
+ * <p>
11
+ * The <i>Inx_Api_Filter_FilterManager</i> can be used to create and retrieve <code>Filter</code>s (target groups).
12
+ * The following snippet creates a global <i>Inx_Api_Filter_Filter</i>:
13
+ *
14
+ * <pre>
15
+ * $oSystemListContext = $oSession->getListContextManager()->findByName( Inx_Api_List_SystemListContext::NAME );
16
+ * $oFilterManager = $oSession->getFilterManager();
17
+ * $oFilter = $oFilterManager->createFilter( $oSystemListContext );
18
+ *
19
+ * $oFilter->updateName( "New Yorker" );
20
+ * $oFilter->updateStatement( "city LIKE \"New York\"" );
21
+ * $oFilter->commitUpdate();
22
+ * </pre>
23
+ * <p>
24
+ * An <i>Inx_Api_Filter_Filter</i> can be assigned to an individual <i>Inx_Api_Mailing_Mailing</i>, as demonstrated
25
+ * in the following snippet:
26
+ *
27
+ * <pre>
28
+ * $oMailing = ...
29
+ *
30
+ * $oMailing->updateFilterId( $oFilter->getId() );
31
+ * $oMailing->commitUpdate();
32
+ * </pre>
33
+ * <p>
34
+ * The retrieval of <i>Inx_Api_Filter_Filter</i>s can be accomplished using the <i>selectAll()</i> method to retrieve all
35
+ * filters, or one of the methods that expect an <i>Inx_Api_List_ListContext</i> to retrieve only the filters assigned to a
36
+ * specific list.
37
+ * The following snippet shows how to retrieve all filters belonging to the specified list, ordered by their creation date:
38
+ *
39
+ * <pre>
40
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
41
+ * $oFilterManager = $oSession->getFilterManager();
42
+ *
43
+ * $oBOResultSet = $oFilterManager->select( $oListContext,
44
+ * Inx_Api_Filter_Filter::ATTRIBUTE_CREATION_DATETIME, Inx_Api_Order::ASC );
45
+ *
46
+ * for( $i = 0; $i &lt; $oBOResultSet->size(); $i++ )
47
+ * {
48
+ * $oFilter = $oBOResultSet->get( $i );
49
+ * echo $oFilter->getName()."&#60;br&#62;";
50
+ * }
51
+ *
52
+ * $oBOResultSet->close();
53
+ * </pre>
54
+ * <p>
55
+ * Note: The usage of <i>Inx_Api_Filter_Filter</i>s requires the api user right: <i>Inx_Api_UserRights::FILTER_FEATURE_USE</i>
56
+ * <p>
57
+ * For more information on filters and the filter statement syntax, see the <i>Inx_Api_Filter_Filter</i> documentation.
58
+ *
59
+ * @see Inx_Api_Filter_Filter
60
+ * @since API 1.1.0
61
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
62
+ * @package Inxmail
63
+ * @subpackage Filter
64
+ */
65
+ interface Inx_Api_Filter_FilterManager extends Inx_Api_BOManager
66
+ {
67
+
68
+ /**
69
+ * Creates a new filter that belongs to the specified list.
70
+ * To create a global filter, use the system list.
71
+ * The following snippet shows how to retrieve the <i>Inx_Api_List_SystemListContext</i>:
72
+ * <pre>
73
+ * $oSystemListContext = $oSession->getListContextManager()->findByName( Inx_Api_List_SystemListContext::NAME );
74
+ * </pre>
75
+ *
76
+ * @param Inx_Api_List_ListContext $oListContext the owning list of the filter.
77
+ * @return Inx_Api_Filter_Filter a new filter.
78
+ */
79
+ public function createFilter( Inx_Api_List_ListContext $oListContext );
80
+
81
+ /**
82
+ * Returns an <i>Inx_Api_BOResultSet</i> containing all filters which belong to the specified list ordered
83
+ * by the specified order attribute and type. To retrieve the global filters, use the system list.
84
+ *
85
+ * @param Inx_Api_List_ListContext $oListContext all filters belonging to this list will be retrieved.
86
+ * @param int $iOrderAttribute the order attribute (<i>Inx_Api_Filter_Filter::ATTRIBUTE_NAME</i> or
87
+ * <i>Inx_Api_Filter_Filter::ATTRIBUTE_CREATION_DATETIME</i>). May be ommitted.
88
+ * @param int $orderType the order type (<i>Inx_Api_Order::ASC</i>
89
+ * or <i>Inx_Api_Order::DESC</i>). May be ommitted.
90
+ * @return an <i>Inx_Api_BOResultSet</i> that contains the data produced by the given query.
91
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
92
+ * <i>Inx_Api_UserRights::FILTER_FEATURE_USE</i>
93
+ */
94
+ public function select( Inx_Api_List_ListContext $oListContext, $iOrderAttribute = null, $orderType = null);
95
+
96
+ }
lib/Inx/Api/FilterStmtException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+
6
+ /**
7
+ * he <i>Inx_Api_FilterStmtException</i> is thrown when a filter statement is invalid. The main reasons for this
8
+ * exception are syntax errors.
9
+ *
10
+ * @see Inx_Api_Mailing_MailingManager#select(Inx_Api_List_ListContext, int, String, int, int)
11
+ * @since API 1.2
12
+ * @version $Revision: 9345 $ $Date: 2007-12-07 16:49:34 +0200 (Pn, 07 Grd 2007) $ $Author: aurimas $
13
+ * @package Inxmail
14
+ */
15
+ class Inx_Api_FilterStmtException extends Exception
16
+ {
17
+
18
+ }
lib/Inx/Api/IOException.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * Signals that an I/O exception of some sort has occurred.
7
+ *
8
+ * @package Inxmail
9
+ */
10
+ class Inx_Api_IOException extends Exception
11
+ {
12
+
13
+ }
lib/Inx/Api/IllegalArgumentException.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_IllegalArgumentException</i> is thrown when wrong arguments are supplied.
7
+ * A common reason for this exception are data type issues.
8
+ * <p>
9
+ * Example: Calling <i>Mailing->sendSingleMail("sample@invalid.inv")</i> will raise this exception, because
10
+ * <i>sendSingleMail()</i> expects a recipient id of type integer, not an email address string.
11
+ * @version $Revision: 9348 $ $Date: 2007-12-10 09:33:56 +0200 (Pr, 10 Grd 2007) $ $Author: aurimas $
12
+ * @package Inxmail
13
+ */
14
+ class Inx_Api_IllegalArgumentException extends Exception
15
+ {
16
+
17
+ }
lib/Inx/Api/IllegalStateException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_IllegalStateException</i> is thrown when a method cannot operate as expected,
7
+ * because the application is in the wrong state.
8
+ * This exception is often thrown by attribute getters when methods are invoked which are illegal
9
+ * for the given attribute getter.
10
+ * <p>
11
+ * Example: A Bounce attribute getter is incapable to retrieve any datetime attributes, although
12
+ * a method for doing so is provided. However, invokig this method will raise an illegal state
13
+ * exception, as this method may not be called for the given getter.
14
+ *
15
+ * @package Inxmail
16
+ */
17
+ class Inx_Api_IllegalStateException extends Exception {
18
+
19
+ }
lib/Inx/Api/Inbox/InboxManager.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The <i>Inx_Api_Inbox_InboxManager</i> can be used to retrieve inbox messages.
4
+ * There are different methods for the retrieval of inbox messages, for example you can retrieve messages by date.
5
+ * The following example returns an <i>Inx_Api_BOResultSet</i> containing all inbox messages in the system:
6
+ *
7
+ * <PRE>
8
+ * $oInboxManager = $oSession->getInboxManager();
9
+ * $oBOResultSet = $oInboxManager->selectAll();
10
+ *
11
+ * for( $i = 0; $i &lt; $oBOResultSet->size(); $i++ )
12
+ * {
13
+ * $oInboxMessage = $oBOResultSet->get( $i );
14
+ * echo $oInboxMessage->getSubject() . '&lt;br&gt;';
15
+ * }
16
+ *
17
+ * $oBOResultSet->close();
18
+ * </PRE>
19
+ *
20
+ * Note: The <i>selectAll()</i> method retrieves no recipient information but the id.
21
+ * If you wish to retrieve the recipient state or some of the recipients attributes, use the
22
+ * <i>selectAll($oRecipientContext, $aAttributes)</i> method instead.
23
+ * <p>
24
+ * Note: The usage of the <i>Inbox</i> requires the api user right: <i>Inx_Api_UserRights::ERRORMAIL_FEATURE_USE</i>
25
+ * <p>
26
+ * For more information on inbox messages, see the <i>Inx_Api_Inbox_InboxMessage</i> documentation.
27
+ *
28
+ * @see Inx_Api_Inbox_InboxMessage
29
+ * @since API 1.9.0
30
+ * @version $Revision:$ $Date:$ $Author:$
31
+ * @package Inxmail
32
+ * @subpackage Inbox
33
+ */
34
+ interface Inx_Api_Inbox_InboxManager extends Inx_Api_BOManager
35
+ {
36
+ /**
37
+ * Returns a result set containing all inbox messages received before the specified date.
38
+ * The date has to be passed as ISO 8601 formatted datetime string.
39
+ * If the <i>RecipientContext</i> is not null and the <i>Attribute</i> array contains at least one element, the
40
+ * retrieved messages will contain information about the recipient state and the specified recipient attributes.
41
+ *
42
+ * @param string $sSearchDate all inbox messages before this date will be selected.
43
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i>.
44
+ * See <i>Inx_Api_Session::createRecipientContext()</i>.
45
+ * @param array $aAttributes an array of recipient attributes that will be fetched for later retrieval.
46
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
47
+ * @return Inx_Api_BOResultSet a <i>BOResultSet</i> containing all inbox messages matching the condition.
48
+ */
49
+ public function selectBefore( $sSearchDate, Inx_Api_Recipient_RecipientContext $rc, $aAttributes );
50
+
51
+
52
+ /**
53
+ * Returns a result set containing all inbox messages received after the specified date.
54
+ * The date has to be passed as ISO 8601 formatted datetime string.
55
+ * If the <i>RecipientContext</i> is not null and the <i>Attribute</i> array contains at least one element, the
56
+ * retrieved messages will contain information about the recipient state and the specified recipient attributes.
57
+ *
58
+ * @param string $sSearchDate all inbox messages after this date will be selected.
59
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i>.
60
+ * See <i>Inx_Api_Session::createRecipientContext()</i>.
61
+ * @param array $aAttributes an array of recipient attributes that will be fetched for later retrieval.
62
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
63
+ * @return Inx_Api_BOResultSet a <i>BOResultSet</i> containing all inbox messages matching the condition.
64
+ */
65
+ public function selectAfter( $sSearchDate, Inx_Api_Recipient_RecipientContext $rc, $aAttributes );
66
+
67
+
68
+ /**
69
+ * Returns a result set containing all inbox messages received between the specified date.
70
+ * The dates have to be passed as ISO 8601 formatted datetime string.
71
+ * If the <i>RecipientContext</i> is not null and the <i>Attribute</i> array contains at least one element, the
72
+ * retrieved messages will contain information about the recipient state and the specified recipient attributes.
73
+ *
74
+ * @param string $sStartDate the start date of the search.
75
+ * @param string $sStopDate the end date of the search.
76
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i>.
77
+ * See <i>Inx_Api_Session::createRecipientContext()</i>.
78
+ * @param array $aAttributes an array of recipient attributes that will be fetched for later retrieval.
79
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
80
+ * @return Inx_Api_BOResultSet a <i>BOResultSet</i> containing all inbox messages matching the condition.
81
+ */
82
+ public function selectBetween( $sStartDate, $sStopDate, Inx_Api_Recipient_RecipientContext $rc, $aAttributes );
83
+
84
+
85
+ /**
86
+ * Returns a result set containing all inbox messages.
87
+ * If there are no messages, an empty result set will be returned.
88
+ * If the <i>RecipientContext</i> is not null and the <i>Attribute</i> array contains at least one element, the
89
+ * retrieved messages will contain information about the recipient state and the specified recipient attributes.
90
+ *
91
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i>.
92
+ * See <i>Inx_Api_Session::createRecipientContext()</i>.
93
+ * @param array $aAttributes an array of recipient attributes that will be fetched for later retrieval.
94
+ * See <i>Inx_Api_Recipient_RecipientMetaData</i>.
95
+ * @return Inx_Api_BOResultSet a <i>BOResultSet</i> containing all inbox messages matching the condition.
96
+ */
97
+ public function selectAllInboxMessages( Inx_Api_Recipient_RecipientContext $rc = null, $aAttributes = null );
98
+
99
+ }
lib/Inx/Api/Inbox/InboxMessage.php ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * An <i>Inx_Api_Inbox_InboxMessage</i> object contains information related to a message received through the inbox.
5
+ * With this object you can access data of a received reply, auto responder message, flame message or spam message.
6
+ * For example you can retrieve the id of the recipient or the content of the received message.
7
+ * <p>
8
+ * For an example on how to retrieve <i>InboxMessage</i>s, see the <i>Inx_Api_Inbox_InboxManager</i> documentation.
9
+ *
10
+ * @see Inx_Api_Inbox_InboxManager
11
+ * @since API 1.9.0
12
+ * @version $Revision:$ $Date:$ $Author:$
13
+ * @package Inxmail
14
+ * @subpackage Inbox
15
+ */
16
+ interface Inx_Api_Inbox_InboxMessage extends Inx_Api_BusinessObject
17
+ {
18
+ /**
19
+ * This category represents an auto responder message.
20
+ *
21
+ * @var int
22
+ */
23
+ const CATEGORY_AUTO_RESPONDER = 0;
24
+
25
+ /**
26
+ * This category represents a flame message. A flame message is a message with aggressive content and/or strong
27
+ * language.
28
+ *
29
+ * @var int
30
+ */
31
+ const CATEGORY_FLAME = 1;
32
+
33
+ /**
34
+ * This category represents a mail categorized as undesirable by spam/virus checking software
35
+ *
36
+ * @var int
37
+ */
38
+ const CATEGORY_SPAM = 2;
39
+
40
+ /**
41
+ * This category represents an ordinary mail which does not match a specific category.
42
+ *
43
+ * @var int
44
+ */
45
+ const CATEGORY_UNCATEGORIZED = 3;
46
+
47
+ /**
48
+ * This category represents a mail of unknown type.
49
+ *
50
+ * @var int
51
+ */
52
+ const CATEGORY_UNKNOWN = 4;
53
+
54
+ /**
55
+ * State for missing recipient information. This state will be used when no <i>RecipientContext</i> and/or no
56
+ * attributes are specified in the query or in case of an unknown recipient.
57
+ *
58
+ * @var int
59
+ */
60
+ const RECIPIENT_STATE_UNKNOWN = 0;
61
+
62
+ /**
63
+ * State for existent recipient.
64
+ *
65
+ * @var int
66
+ */
67
+ const RECIPIENT_STATE_EXISTENT = 1;
68
+
69
+ /**
70
+ * State for non existing (deleted) recipient.
71
+ *
72
+ * @var int
73
+ */
74
+ const RECIPIENT_STATE_DELETED = 2;
75
+
76
+
77
+ /**
78
+ * Returns the category of this inbox message. May be one of:
79
+ * <ul>
80
+ * <li><i>CATEGORY_AUTO_RESPONDER</i>
81
+ * <li><i>CATEGORY_FLAME</i>
82
+ * <li><i>CATEGORY_SPAM</i>
83
+ * <li><i>CATEGORY_UNCATEGORIZED</i>
84
+ * <li><i>CATEGORY_UNKNOWN</i>
85
+ * </ul>
86
+ *
87
+ * @return int the category of this inbox message.
88
+ */
89
+ public function getCategory();
90
+
91
+
92
+ /**
93
+ * Returns the date when the message was received.
94
+ * The date will be returned as ISO 8601 formatted datetime string.
95
+ *
96
+ * @return string the date of the message reception.
97
+ */
98
+ public function getReceptionDate();
99
+
100
+
101
+ /**
102
+ * Returns the sender address.
103
+ *
104
+ * @return string the sender address as string.
105
+ */
106
+ public function getSender();
107
+
108
+
109
+ /**
110
+ * Returns the subject of the received message.
111
+ *
112
+ * @return string the subject of the received message as string.
113
+ */
114
+ public function getSubject();
115
+
116
+
117
+ /**
118
+ * Returns the message content as text.
119
+ *
120
+ * @return string the message as string.
121
+ */
122
+ public function getTextContent();
123
+
124
+
125
+ /**
126
+ * Returns the id of the recipient who sent the message.
127
+ *
128
+ * @return int the recipient id.
129
+ */
130
+ public function getRecipientId();
131
+
132
+
133
+ /**
134
+ * Returns the header of the message as string.
135
+ *
136
+ * @return string the header of the message as string.
137
+ */
138
+ public function getHeaders();
139
+
140
+
141
+ /**
142
+ * Returns the complete message as mime message stream.
143
+ *
144
+ * @return Inx_Api_InputStream the mime message as input stream.
145
+ */
146
+ public function getMIMEMessageAsStream();
147
+
148
+
149
+ /**
150
+ * Returns the matched e-mail address (i.e. the e-mail address of the recipient).
151
+ *
152
+ * @return string the e-mail address.
153
+ */
154
+ public function getMatchedEmailAddress();
155
+
156
+
157
+ /**
158
+ * Returns the state of the recipient for the message.<br>
159
+ * RecipientState values:
160
+ * <ul>
161
+ * <li><i>RECIPIENT_STATE_UNKNOWN</i> - no attributes are queried or recipient is unknown.
162
+ * <li><i>RECIPIENT_STATE_EXISTENT</i> - recipient exists.
163
+ * <li><i>RECIPIENT_STATE_DELETED</i> - recipient is deleted.
164
+ * </ul>
165
+ *
166
+ * @return int the recipient state.
167
+ */
168
+ public function getRecipientState();
169
+
170
+
171
+ /**
172
+ * Returns the integer value for the given recipient Attribute.<br>
173
+ *
174
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
175
+ * @return int the integer value.
176
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
177
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>int</i>.
178
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
179
+ */
180
+ public function getInteger( Inx_Api_Recipient_Attribute $oAttribute );
181
+
182
+
183
+ /**
184
+ * Returns the string value for the given recipient Attribute.<br>
185
+ *
186
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
187
+ * @return string the string value.
188
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
189
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>string</i>.
190
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
191
+ */
192
+ public function getString( Inx_Api_Recipient_Attribute $oAttribute );
193
+
194
+
195
+ /**
196
+ * Returns the datetime value for the given recipient Attribute.
197
+ * The datetime will be returned as ISO 8601 formatted datetime string.
198
+ *
199
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
200
+ * @return string the datetime value.
201
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
202
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>datetime</i>.
203
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
204
+ */
205
+ public function getDatetime( Inx_Api_Recipient_Attribute $oAttribute );
206
+
207
+
208
+ /**
209
+ * Returns the date value for the given recipient Attribute.
210
+ * The date will be returned as ISO 8601 formatted date string.
211
+ *
212
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
213
+ * @return string the date value.
214
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
215
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>date</i>.
216
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
217
+ */
218
+ public function getDate( Inx_Api_Recipient_Attribute $oAttribute );
219
+
220
+
221
+ /**
222
+ * Returns the time value for the given recipient Attribute.
223
+ * The time will be returned as ISO 8601 formatted time string
224
+ *
225
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
226
+ * @return string the time value.
227
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
228
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>time</i>.
229
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
230
+ */
231
+ public function getTime( Inx_Api_Recipient_Attribute $oAttribute );
232
+
233
+
234
+ /**
235
+ * Returns the float value for the given recipient Attribute.<br>
236
+ *
237
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
238
+ * @return float the float value.
239
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
240
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>float</i>.
241
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
242
+ */
243
+ public function getDouble( Inx_Api_Recipient_Attribute $oAttribute );
244
+
245
+
246
+ /**
247
+ * Returns the bool value for the given recipient Attribute.<br>
248
+ *
249
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
250
+ * @return bool the bool value.
251
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
252
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>bool</i>.
253
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
254
+ */
255
+ public function getBoolean( Inx_Api_Recipient_Attribute $oAttribute );
256
+
257
+
258
+ /**
259
+ * Returns the value for the given recipient Attribute.<br>
260
+ *
261
+ * @param Inx_Api_Recipient_Attribute $oAttribute the recipient attribute to be retrieved.
262
+ * @return mixed the value.
263
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
264
+ * @throws Inx_Api_UnknownRecipientException if the recipient state is unknown.
265
+ */
266
+ public function getObject( Inx_Api_Recipient_Attribute $oAttribute );
267
+
268
+ }
lib/Inx/Api/IndexOutOfBoundsException.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_IndexOutOfBoundsException</i> is thrown when trying to access an invalid index of an
7
+ * indexed object. This applies mainly to the various RowSets and ResultSets used in the API.
8
+ * <p>
9
+ * Example:
10
+ * <pre>
11
+ * $rset = Inx_Api_Mailing_MailingManager->selectAll();
12
+ *
13
+ * for($i = -1; $i <= rest->size(); $i++)
14
+ * {
15
+ * echo $rset->get($i)->getName();
16
+ * }
17
+ * </pre>
18
+ * This code snippet contains two errors: The first index retrieved is -1 and the last index retrieved is
19
+ * rset->size(). -1 is no valid index as the first element of a ResultSet has the index 0. As the first
20
+ * valid index is 0, the last valid index is rset->size() - 1. Therefore, these errors will raise an
21
+ * <i>Inx_Api_IndexOutOfBoundsException</i>.
22
+ * @package Inxmail
23
+ */
24
+ class Inx_Api_IndexOutOfBoundsException extends Exception
25
+ {
26
+
27
+ }
28
+
29
+ ?>
lib/Inx/Api/IndexSelection.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * This class represents the current state of a selection. It encapsulates a single selection interval.
7
+ *
8
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
9
+ * @package Inxmail
10
+ */
11
+ class Inx_Api_IndexSelection
12
+ {
13
+ private $iBeginIndex;
14
+
15
+ private $iEndIndex;
16
+
17
+ /**
18
+ * Creates a selection.
19
+ * If $iBeginIndex and $iEndIndex are omitted, this will create an empty selection.
20
+ * If only $iEndIndex is omitted, the selection will contain only $iEndIndex.
21
+ * If both parameters are set, the selection will contain the set of indices between $iBeginIndex
22
+ * and $iEndIndex inclusive.
23
+ *
24
+ * @param int $iBeginIndex one end of the interval, may be omitted.
25
+ * @param int $iEndIndex other ent of the interval (inclusive), may be omitted.
26
+ */
27
+ public function __construct($iBeginIndex = null, $iEndIndex = null)
28
+ {
29
+ if ($iBeginIndex===null && $iEndIndex===null) {
30
+ $this->iBeginIndex = -1;
31
+ $this->iEndIndex = -1;
32
+ } elseif($iBeginIndex!==null && $iEndIndex===null){
33
+ $this->setSelectionInterval( $iBeginIndex );
34
+ } elseif($iBeginIndex!==null && $iEndIndex!==null){
35
+ $this->setSelectionInterval( $iBeginIndex, $iEndIndex );
36
+ }
37
+ }
38
+
39
+
40
+ /**
41
+ * Change the selection to be the set of indices between $iBeginIndex and $iEndIndex inclusive.
42
+ * $iEndIndex may be omitted, thus changing the selection to only contain $iBeginIndex.
43
+ *
44
+ * @param int $iBeginIndex one end of the interval.
45
+ * @param int $iEndIndex other end of the interval (inclusive), may be omitted.
46
+ */
47
+ public function setSelectionInterval( $iBeginIndex = null, $iEndIndex = null )
48
+ {
49
+ if( $iBeginIndex < 0 || $iEndIndex < 0 ) {
50
+ throw new Exception( "Indices must be positive" );
51
+ }
52
+ if($iEndIndex===null) {
53
+ $iEndIndex = $iBeginIndex;
54
+ }
55
+ if( $iBeginIndex > $iEndIndex) {
56
+ $this->iBeginIndex = $iEndIndex;
57
+ $this->iEndIndex = $iBeginIndex;
58
+ } else {
59
+ $this->iBeginIndex = $iBeginIndex;
60
+ $this->iEndIndex = $iEndIndex;
61
+ }
62
+ }
63
+
64
+
65
+ /**
66
+ * Returns the number of selected elements.
67
+ *
68
+ * @return int the number of selected elements
69
+ */
70
+ public function getSelectionCount()
71
+ {
72
+ if( $this->iBeginIndex == -1 )
73
+ return 0;
74
+
75
+ return $this->iEndIndex - $this->iBeginIndex + 1;
76
+ }
77
+
78
+
79
+ /**
80
+ * Returns the first selected index or -1 if the selection is empty.
81
+ *
82
+ * @return int the first selected index
83
+ */
84
+ public function getFirstIndex()
85
+ {
86
+ return $this->iBeginIndex;
87
+ }
88
+
89
+
90
+ /**
91
+ * Returns the last selected index or -1 if the selection is empty.
92
+ *
93
+ * @return int the last selected index
94
+ */
95
+ public function getLastIndex()
96
+ {
97
+ return $this->iEndIndex;
98
+ }
99
+
100
+ }
lib/Inx/Api/InputStream.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * This abstract class is the superclass of all classes representing an input stream of bytes.
7
+ * Subclasses of InputStream must always provide a method that returns the next byte of input as well as a method
8
+ * used to close the stream.
9
+ *
10
+ * @package Inxmail
11
+ */
12
+ abstract class Inx_Api_InputStream
13
+ {
14
+ abstract public function read();
15
+ abstract public function close();
16
+ }
lib/Inx/Api/List/AdminListContext.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage List
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_List_AdminListContext</i> does not represent a usual mailing list.
8
+ * Mail server and user credentials, along with other administrative properties, can be defined in the administration list.
9
+ * <p>
10
+ * <b>At the moment the <i>Inx_Api_List_AdminListContext</i> has no functionality.</b>
11
+ *
12
+ * @since API 1.0
13
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
14
+ * @package Inxmail
15
+ * @subpackage List
16
+ */
17
+ interface Inx_Api_List_AdminListContext extends Inx_Api_List_ListContext
18
+ {
19
+
20
+ /**
21
+ * The predefined, immutable name of the administration list.
22
+ */
23
+ const NAME = "administration";
24
+
25
+ }
lib/Inx/Api/List/FilterListContext.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage List
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_List_FilterListContext</i> represents a mailing list with no permanent recipients.
8
+ * The recipients of a filter list are computed based on a filter.
9
+ * All recipients that match that filter are recipients of the filter list.
10
+ * The recipients are computed each time a mailing is sent.
11
+ * <p>
12
+ * For a detailed description of the filter statement syntax, see the documentation of
13
+ * <i>Inx_Api_Filter_Filter->updateStatement(String)</i>;
14
+ *
15
+ * @see Inx_Api_Filter_Filter::updateStatement(String)
16
+ * @since API 1.0
17
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
18
+ * @package Inxmail
19
+ * @subpackage List
20
+ */
21
+ interface Inx_Api_List_FilterListContext extends Inx_Api_List_ListContext
22
+ {
23
+ /**
24
+ * Constant for the filter statement attribute.
25
+ * Used by the <i>Inx_Api_UpdateException</i> to indicate the error source.
26
+ *
27
+ * @see Inx_Api_UpdateException::getErrorSource()
28
+ */
29
+ const ATTRIBUTE_FILTER_STMT = 4;
30
+
31
+
32
+ /**
33
+ * Changes the list name.
34
+ * The list will not be updated on the server until <i>commitUpdate()</i> has been called.
35
+ *
36
+ * @param string $sName the new list name.
37
+ */
38
+ public function updateName( $sName );
39
+
40
+
41
+ /**
42
+ * Returns the filter statement.
43
+ *
44
+ * @return string the filter statement.
45
+ */
46
+ public function getFilterStmt();
47
+
48
+
49
+ /**
50
+ * Changes the filter statement. The list will not be updated on server until <i>commitUpdate()</i> has been called.
51
+ * For a detailed description of the filter statement syntax, see the documentation of
52
+ * <i>Inx_Api_Filter_Filter->updateStatement(String)</i>
53
+ *
54
+ * @param string $sFilterStmt the new filter statement.
55
+ * @see Inx_Api_Filter_Filter::updateStatement(String)
56
+ */
57
+ public function updateFilterStmt( $sFilterStmt );
58
+
59
+ }
lib/Inx/Api/List/ListContext.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage List
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_List_ListContext</i> corresponds to a list in Inxmail, like a mailing list or the system list.
8
+ * The <i>Inx_Api_List_ListContextManager</i> is used to access and manipulate these lists.
9
+ * <p>
10
+ * A list is, in simple terms, a set of recipients for which mailings can be created.
11
+ * A list may offer various features (corresponding to agents in inxmail) which can be used to perform tasks like
12
+ * subscription management, creating text modules, generating reports, etc.
13
+ * <p>
14
+ * The available features can be determined from the <i>Inx_Api_Features<i> interface.
15
+ * Using the constants defined in that interface, you can enable or disable features.
16
+ * The following snippet enables the subscription feature, if it is not already enabled:
17
+ *
18
+ * <pre>
19
+ * $oListContext = ...
20
+ *
21
+ * if(!$oListContext->isFeatureEnabled(Inx_Api_Features::SUBSCRIPTION_FEATURE_ID))
22
+ * {
23
+ * $oListContext->enableFeature(Inx_Api_Features::SUBSCRIPTION_FEATURE_ID);
24
+ * }
25
+ * </pre>
26
+ *
27
+ * Be aware that not all features can be enabled for all lists.
28
+ * Which features can be enabled for which lists is also documented in the <i>Inx_Api_Features</i> interface.
29
+ * <p>
30
+ * An <i>Inx_Api_List_ListContext</i> can also be used to retrieve the list properties using the
31
+ * <i>findProperty($sPropertyName)</i> and <i>selectProperties()</i> methods.
32
+ * These properties define the behaviour of the list.
33
+ * For more information on properties, see the <i>Inx_Api_Property_Property</i> documentation.
34
+ * <p>
35
+ * For an example on how to create and retrieve lists, see the <i>Inx_Api_List_ListContextManager</i> documentation.
36
+ *
37
+ * @see Inx_Api_List_ListContextManager
38
+ * @see Inx_Api_Features
39
+ * @see Inx_Api_Property_Property
40
+ * @since API 1.0
41
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
42
+ * @package Inxmail
43
+ * @subpackage List
44
+ */
45
+ interface Inx_Api_List_ListContext extends Inx_Api_BusinessObject
46
+ {
47
+
48
+ /**
49
+ * Constant for the name attribute. Used by the <i>Inx_Api_UpdateException</i> to indicate the error source.
50
+ *
51
+ * @see Inx_Api_UpdateException::getErrorSource()
52
+ */
53
+ const ATTRIBUTE_NAME = 1;
54
+
55
+ /**
56
+ * Constant for the description attribute. Used by the <i>Inx_Api_UpdateException</i> to indicate the error source.
57
+ *
58
+ * @see Inx_Api_UpdateException::getErrorSource()
59
+ */
60
+ const ATTRIBUTE_DESCRIPTION = 2;
61
+
62
+
63
+ /**
64
+ * Returns the list name. The list names are unique, while the characters are case insensitive. <br>
65
+ * The names of the system and administration lists are predefined and immutable.
66
+ *
67
+ * @see Inx_Api_List_SystemListContext::NAME
68
+ * @see Inx_Api_List_AdminListContext::NAME
69
+ * @return string the list name
70
+ */
71
+ public function getName();
72
+
73
+
74
+ /**
75
+ * Returns the list description.
76
+ *
77
+ * @return string the list description
78
+ */
79
+ public function getDescription();
80
+
81
+
82
+ /**
83
+ * Returns the creation datetime.
84
+ *
85
+ * @return string the creation datetime. The creation datetime is returned as ISO 8601 formatted datetime string.
86
+ */
87
+ public function getCreationDatetime();
88
+
89
+
90
+ /**
91
+ * Changes the list description.
92
+ *
93
+ * @param string $sDesc the new list description.
94
+ */
95
+ public function updateDescription( $sDesc );
96
+
97
+
98
+ /**
99
+ * Returns the property identified by the specified name.
100
+ *
101
+ * @param string $sPropertyName the name of the property to be retrieved.
102
+ * @return Inx_Api_Property_Property the property identified by the specified name.
103
+ * @throws Inx_Api_IllegalArgumentException if the property name is unknown.
104
+ * @see Inx_Api_Property_PropertyNames
105
+ */
106
+ public function findProperty( $sPropertyName );
107
+
108
+
109
+ /**
110
+ * Returns an <i>Inx_Api_BOResultSet</i> containing all properties of this list.
111
+ *
112
+ * @return Inx_Api_BOResultSet an <i>Inx_Api_BOResultSet</i> containing all properties of this list
113
+ * @see Inx_Api_Property_Property
114
+ */
115
+ public function selectProperties();
116
+
117
+
118
+ /**
119
+ * Checks if the specified feature is enabled.
120
+ *
121
+ * @param int $iFeatureId the id of the feature to check.
122
+ * @return bool <i>true</i>, if the feature is enabled, <i>false</i> otherwise.
123
+ * @throws Inx_Api_FeatureNotAvailableException if the feature is not available for this list.
124
+ * @see Inx_Api_Features
125
+ */
126
+ public function isFeatureEnabled( $iFeatureId );
127
+
128
+
129
+ /**
130
+ * Enables the feature with the given id. Not every feature is accessible for every type of list.
131
+ * For example, the "Subscription" feature is available in standard lists, only.
132
+ * The "Mailing" feature can be used in standard and filter lists.
133
+ *
134
+ * @param int $iFeatureId the id of the feature to enable.
135
+ * @return bool <i>true</i>, if the feature has been enabled, <i>false</i>, if the feature was already enabled.
136
+ * @throws Inx_Api_FeatureNotAvailableException if the feature is not available for this list.
137
+ * @see Inx_Api_Features
138
+ */
139
+ public function enableFeature( $iFeatureId );
140
+
141
+
142
+ /**
143
+ * Disables the feature with the given id.
144
+ *
145
+ * @param int $iFeatureId the id of the feature to disable.
146
+ * @return bool <i>true</i>, if the feature has been disabled, <i>false</i>, if the feature was already disabled.
147
+ * @throws Inx_Api_FeatureNotAvailableException if the feature is not available for this list.
148
+ * @see Inx_Api_Features
149
+ */
150
+ public function disableFeature( $iFeatureId );
151
+
152
+
153
+ /**
154
+ * Returns the number of recipients that are subscribed to the list. This method can return the actual list size if
155
+ * the parameter is true. Note: Refreshing the list size can produce a high load on the Inxmail Server. USE THIS
156
+ * METHOD WITH CAUTION!
157
+ *
158
+ * @param bool $computeNow <code>true</code> if the number of recipients shall be recomputed, <code>false</code>
159
+ * otherwise. May be ommitted (defaults to <i>false</i>).
160
+ * @return Inx_Api_List_ListSize the list size object.
161
+ * @throws Inx_Api_DataException if the list is deleted.
162
+ */
163
+ public function getListSize( $computeNow=false );
164
+
165
+ }
166
+
lib/Inx/Api/List/ListContextManager.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage List
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_List_ListContext</i> corresponds to a list in Inxmail, like a mailing list or the system list.
8
+ * The <i>Inx_Api_List_ListContextManager</i> is used to access and manipulate these lists.
9
+ * <p>
10
+ * There are four different types of lists:
11
+ * <ul>
12
+ * <li>Standard lists: <i>Inx_Api_List_StandardListContext</i>
13
+ * <li>Filter lists: <i>Inx_Api_List_FilterListContext</i>
14
+ * <li>The system list: <i>Inx_Api_List_SystemListContext</i>
15
+ * <li>The administration list: <i>Inx_Api_List_AdminListContext</i>
16
+ * </ul>
17
+ * New mailing lists are created using <i>createStandardList()</i> or <i>createFilterList()</i>.
18
+ * <p>
19
+ * The following snippet creates a new standard mailing list:
20
+ *
21
+ * <PRE>
22
+ * $oListContextManager = $session->getListContextManager();
23
+ * $oStandardListContext = $oListContextManager->createStandardList();
24
+ * $oStandardListContext->updateName( "New List" );
25
+ * $oStandardListContext->commitUpdate();
26
+ * </PRE>
27
+ *
28
+ * Special lists, like the system or administration list, can be retrieved using the <i>findByName($sName)</i> method.
29
+ * Both, <i>Inx_Api_List_SystemListContext</i> and <i>Inx_Api_List_AdminListContext</i> provide a constant with their predefined,
30
+ * immutable name which can be used to retrieve the list context.
31
+ * The following snippet illustrates this:
32
+ *
33
+ * <PRE>
34
+ * $oListContextManager = $oSession->getListContextManager();
35
+ * $systemListContext = $oListContextManager->findByName( Inx_Api_List_SystemListContext::NAME );
36
+ * $adminListContext = $oListContextManager->findByName( Inx_Api_List_AdminListContext::NAME );
37
+ * </PRE>
38
+ * <p>
39
+ * For more information on lists, see the <i>Inx_Api_List_ListContext</i> documentation.
40
+ *
41
+ * @see Inx_Api_List_ListContext
42
+ * @since API 1.0
43
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
44
+ * @package Inxmail
45
+ * @subpackage List
46
+ */
47
+ interface Inx_Api_List_ListContextManager extends Inx_Api_BOManager
48
+ {
49
+
50
+ /**
51
+ * Returns the <i>Inx_Api_List_ListContext</i> with the specified list name.
52
+ * The list name is case insensitive.
53
+ *
54
+ * @param string $sListName the name of the list to find.
55
+ * @return Inx_Api_List_ListContext the list context, or null if no list can be found.
56
+ */
57
+ public function findByName( $sListName );
58
+
59
+
60
+ /**
61
+ * Creates an <i>Inx_Api_List_StandardListContext</i> object.
62
+ * The list will not be created on the server until <i>commitUpdate()</i> has been called.
63
+ *
64
+ * @return Inx_Api_List_StandardListContext an <i>Inx_Api_List_StandardListContext</i> object.
65
+ */
66
+ public function createStandardList();
67
+
68
+
69
+ /**
70
+ * Creates an <i>Inx_Api_List_FilterListContext</i> object.
71
+ * The list will not be created on the server until <i>commitUpdate()</i> has been called.
72
+ *
73
+ * @return Inx_Api_List_FilterListContext an <i>Inx_Api_List_FilterListContext</i> object.
74
+ */
75
+ public function createFilterList();
76
+
77
+ }
lib/Inx/Api/List/ListSize.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage List
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_List_ListSize</i> object contains the list size and the computation date of the size.
8
+ *
9
+ * @since API 1.4.3
10
+ * @package Inxmail
11
+ * @subpackage List
12
+ */
13
+ interface Inx_Api_List_ListSize
14
+ {
15
+ /**
16
+ * Returns the number of recipients that are subscribed to the list.
17
+ *
18
+ * @return int the list size as integer.
19
+ */
20
+ public function getSize();
21
+
22
+ /**
23
+ * Returns the creation datetime when the list size was computed.
24
+ *
25
+ * @return the creation datetime as ISO 8601 formatted datetime string.
26
+ */
27
+ public function getCreationDate();
28
+ }
29
+ ?>
lib/Inx/Api/List/StandardListContext.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage List
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_List_StandardListContext</i> represents a normal mailing list.
8
+ * Recipients can subscribe or unsubscribe from the list using landing pages and links.
9
+ * Manual subscription and unsubscription of recipients can be accomplished using the
10
+ * <i>Inx_Api_Subscription_SubscriptionManager</i>.
11
+ *
12
+ * @since API 1.0
13
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
14
+ * @package Inxmail
15
+ * @subpackage List
16
+ */
17
+ interface Inx_Api_List_StandardListContext extends Inx_Api_List_ListContext
18
+ {
19
+
20
+ /**
21
+ * Changes the list name. The list will not be updated on the server until <i>commitUpdate()</i> has been called.
22
+ *
23
+ * @param string $sName the new list name.
24
+ */
25
+ public function updateName( $sName );
26
+
27
+ }
lib/Inx/Api/List/SystemListContext.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage List
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_List_SystemListContext</i> does not represent a usual mailing list.
8
+ * Recipients cannot subscribe to this list and it is not possible to write emails to the recipients of the system list.
9
+ * The system list stores all recipient data regardless of any mailing list association.
10
+ * <p>
11
+ * The property settings defined in the system list are global in that they apply to all mailing list.
12
+ * A lot of property settings can only be defined here.
13
+ *
14
+ * @since API 1.0
15
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
16
+ * @package Inxmail
17
+ * @subpackage List
18
+ */
19
+ interface Inx_Api_List_SystemListContext extends Inx_Api_List_ListContext
20
+ {
21
+
22
+ /**
23
+ * The predefined, immutable name of the system list.
24
+ */
25
+ const NAME = "system";
26
+
27
+ }
lib/Inx/Api/LockException.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_LockException</i> is thrown if a lockable object (e.g. Mailing) is already locked.
7
+ *
8
+ * @see Inx_Api_Mailing_Mailing#lock()
9
+ * @since API 1.0
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ */
13
+ class Inx_Api_LockException extends Exception
14
+ {
15
+
16
+ private $_oLockTicket;
17
+
18
+
19
+ /**
20
+ * Constructs a <i>Inx_Api_LockException</i> with the specified detail message and
21
+ * specific details from lock owner.
22
+ *
23
+ * @param string $sMsg the detail message.
24
+ * @param Inx_Api_LockTicket $oLockTicket the ticket of lock information.
25
+ */
26
+ public function __construct( $sMsg, Inx_Api_LockTicket $oLockTicket )
27
+ {
28
+ $this->_oLockTicket = $oLockTicket;
29
+ parent::__construct($sMsg);
30
+ }
31
+
32
+
33
+ /**
34
+ * Returns the lock ticket. The lock ticket contains specific details from the lock owner.
35
+ *
36
+ * @return Inx_Api_LockTicket the lock ticket.
37
+ */
38
+ public function getLockTicket()
39
+ {
40
+ return $this->_oLockTicket;
41
+ }
42
+
43
+ }
lib/Inx/Api/LockTicket.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_LockTicket</i> contains specific informations about a lock of an object (e.g. Mailing).
7
+ * <p>
8
+ * The information provided includes:
9
+ * <ul>
10
+ * <li>The id of the user who holds the lock
11
+ * <li>The name of the user who holds the lock
12
+ * <li>The internet address of the lock owner
13
+ * <li>The creation date of the lock
14
+ * <li>Whether the object is locked by this session
15
+ * </ul>
16
+ *
17
+ * @see Inx_Api_Mailing_Mailing#getLockTicket()
18
+ * @since API 1.0
19
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
20
+ * @package Inxmail
21
+ */
22
+ class Inx_Api_LockTicket
23
+ {
24
+
25
+ private $_iUserId;
26
+
27
+ private $_sUserName;
28
+
29
+ private $_sSource;
30
+
31
+ private $_sCreationDatetime;
32
+
33
+ private $_blForeignLock;
34
+
35
+
36
+ /**
37
+ * Constructs a <i>Inx_Api_LockTicket</i> with the specified details of the lock owner.
38
+ *
39
+ * @param integer $iUserId the user id from of the lock owner.
40
+ * @param string $sUserName the user name of the lock owner.
41
+ * @param string $sSource the internet address of the lock owner.
42
+ * @param string $sCreationDatetime the creation date of the existing lock.
43
+ * @param boolean $blForeignLock true if locked by another session, false if locked by this session.
44
+ */
45
+ public function __construct( $iUserId, $sUserName, $sSource, $sCreationDatetime,
46
+ $blForeignLock )
47
+ {
48
+ $this->_iUserId = $iUserId;
49
+ $this->_sUserName = $sUserName;
50
+ $this->_sSource = $sSource;
51
+ $this->_sCreationDatetime = $sCreationDatetime;
52
+ $this->_blForeignLock = $blForeignLock;
53
+ }
54
+
55
+
56
+ /**
57
+ * Returns the creation date of the existing lock as ISO 8601 formatted date string.
58
+ *
59
+ * @return string the creation date of the existing lock.
60
+ */
61
+ public function getCreationDatetime()
62
+ {
63
+ return $this->_sCreationDatetime;
64
+ }
65
+
66
+ /**
67
+ * Returns the internet address of the lock owner.
68
+ *
69
+ * @return string the internet address of the lock owner.
70
+ */
71
+ public function getSource()
72
+ {
73
+ return $this->_sSource;
74
+ }
75
+
76
+ /**
77
+ * Returns the user id of the lock owner.
78
+ *
79
+ * @return string the user id of the lock owner.
80
+ */
81
+ public function getUserId()
82
+ {
83
+ return $this->_sUserId;
84
+ }
85
+
86
+ /**
87
+ * Returns the user name of the lock owner.
88
+ *
89
+ * @return string the user name of the lock owner.
90
+ */
91
+ public function getUserName()
92
+ {
93
+ return $this->_sUserName;
94
+ }
95
+
96
+ /**
97
+ * Checks if the object is locked by this session.
98
+ *
99
+ * @return boolean true if locked by another session, false if locked by this session.
100
+ */
101
+ public function isForeignLock()
102
+ {
103
+ return $this->_blForeignLock;
104
+ }
105
+ }
lib/Inx/Api/LoginException.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_LoginException</i> is thrown by login methods if the login process failed.
7
+ *
8
+ * @see Inx_Api_Session#createLocalSession(String, String)
9
+ * @see Inx_Api_Session#createRemoteSession(String, String, String)
10
+ * @since API 1.0
11
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
12
+ * @package Inxmail
13
+ */
14
+ class Inx_Api_LoginException extends Exception
15
+ {
16
+ /**
17
+ * System exception: The server isn't running, too many sessions are opened, no valid license can be found or the
18
+ * api is incompatible to the server version.
19
+ */
20
+ const SYSTEM_EXCEPTION = 1000;
21
+
22
+ /** An illegal username or password was specfied. */
23
+ const ILLEGAL_USERNAME_OR_PASSWORD = 1001;
24
+
25
+ /**
26
+ * The specified user is inactive, the login right for the specified user is missing or access is denied from the ip
27
+ * filter.
28
+ */
29
+ const USER_EXCEPTION = 1002;
30
+
31
+ /**
32
+ * The password expiration is elapsed.
33
+ * @since 1.4.2
34
+ */
35
+ const PWD_VALIDITY_EXPIRATION = 1003;
36
+
37
+ /**
38
+ * The user is forced to change his password by the administrator.
39
+ * @since 1.4.2
40
+ */
41
+ const PWD_FORCED_CHANGE = 1004;
42
+
43
+ /**
44
+ * The specified user has insufficient permissions.
45
+ *
46
+ * @since 1.9.0
47
+ */
48
+ const MISSING_PERMISSIONS = 1010;
49
+
50
+ /**
51
+ * The specified Plugin (secret) could not be found.
52
+ *
53
+ * @since 1.9.0
54
+ */
55
+ const MISSING_PLUGIN = 1011;
56
+ }
lib/Inx/Api/Mail/Attachment.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Mail_Attachment</i> object represents a regular attachment or an embedded image
8
+ * of a mailing and is part of the <i>Inx_Api_Mail_MailContent</i> object.
9
+ *
10
+ * @see Inx_Api_Mail_MailContent::getAttachments()
11
+ * @see Inx_Api_Mail_MailContent::getEmbeddedImages()
12
+ * @since API 1.0
13
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
14
+ * @package Inxmail
15
+ * @subpackage Mail
16
+ */
17
+ interface Inx_Api_Mail_Attachment
18
+ {
19
+
20
+ /**
21
+ * Returns the file name of a regular attachment or the image identifier of an embedded image.
22
+ * An embedded image is referenced in a message body using an &lt;img&gt; tag, as follows:
23
+ *
24
+ * <pre>
25
+ * <img src="cid:Image-Identifier">
26
+ * </pre>
27
+ *
28
+ * @return string the file name of a regular attachment or the image identifier of an embedded image.
29
+ */
30
+ public function getName();
31
+
32
+
33
+ /**
34
+ * Returns the MIME type of this attachment, e.g. <i>application/pdf</i> or <i>image/gif</i>.
35
+ *
36
+ * @return string the MIME type of this attachment.
37
+ */
38
+ public function getContentType();
39
+
40
+
41
+ /**
42
+ * Return the size of the content of this attachment in bytes.
43
+ *
44
+ * @return int the size of the content of this attachment in bytes.
45
+ */
46
+ public function getSize();
47
+
48
+
49
+ /**
50
+ * Returns an input stream of the content of this attachment.
51
+ * This method is used to download the content of this attachment.
52
+ *
53
+ * @return Inx_Api_InputStream an input stream of the content of this attachment.
54
+ */
55
+ public function getContent();
56
+
57
+ }
lib/Inx/Api/Mail/BuildException.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Mail_BuildException</i> is thrown when the building of a mailing fails.
8
+ * This may be due to an illegal recipient address or a general building failure.
9
+ * For a deeper insight on the error, consult the <i>Inx_Api_Mail_RenderError</i> associated with the exception.
10
+ *
11
+ * @see Inx_Api_Mail_RenderError
12
+ * @see Inx_Api_Mail_MailingRenderer::build($iRecipientId, $iPreferredMailType=null)
13
+ * @version $Revision: 9479 $ $Date: 2007-12-18 15:43:23 +0200 (An, 18 Grd 2007) $ $Author: aurimas $
14
+ * @package Inxmail
15
+ * @subpackage Mail
16
+ */
17
+ class Inx_Api_Mail_BuildException extends Exception
18
+ {
19
+ /**
20
+ * The email address of the recipient for which the mailing was built.
21
+ * @var string
22
+ */
23
+ protected $sEmailAddress;
24
+
25
+ /**
26
+ * Contains detail information about the error.
27
+ * @var Inx_Api_Mail_RenderError
28
+ */
29
+ protected $oError;
30
+
31
+ /**
32
+ * Creates an <i>Inx_Api_Mail_BuildException</i> with the given recipient address and render error.
33
+ *
34
+ * @param string $sEmailAddress the email address of the recipient for which the mailing was built.
35
+ * @param Inx_Api_Mail_RenderError $oError contains detail information about the error.
36
+ */
37
+ public function __construct( $sEmailAddress, $oError )
38
+ {
39
+ $this->sEmailAddress = $sEmailAddress;
40
+ $this->oError = $oError;
41
+ }
42
+
43
+ /**
44
+ * Returns detail information about the error.
45
+ *
46
+ * @return Inx_Api_Mail_RenderError detail information about the error.
47
+ */
48
+ public function getError()
49
+ {
50
+ return $this->oError;
51
+ }
52
+
53
+ /**
54
+ * Returns the email address of the recipient for which the mailing was built.
55
+ *
56
+ * @return string the recipients email address.
57
+ */
58
+ public function getEmailAddress()
59
+ {
60
+ return $this->sEmailAddress;
61
+ }
62
+
63
+ }
lib/Inx/Api/Mail/HeaderField.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_Mail_HeaderField</i> stores a name/value pair of an email header field.
9
+ *
10
+ * @since API 1.9.0
11
+ * @author chge
12
+ */
13
+ class Inx_Api_Mail_HeaderField
14
+ {
15
+ private $sName;
16
+
17
+ private $sValue;
18
+
19
+
20
+ /**
21
+ * Creates an <i>Inx_Api_Mail_HeaderField</i> with the specified name and value.
22
+ *
23
+ * @param string $sName the name of the header field. May be ommitted.
24
+ * @param string $sValue the value of the header field. May be ommitted.
25
+ */
26
+ public function __construct( $sName = null, $sValue = null )
27
+ {
28
+ $this->setName( $sName );
29
+ $this->setValue( $sValue );
30
+ }
31
+
32
+
33
+ /**
34
+ * Returns the name of the header field.
35
+ *
36
+ * @return string the name of the header field.
37
+ */
38
+ public function getName()
39
+ {
40
+ return $this->sName;
41
+ }
42
+
43
+
44
+ /**
45
+ * Returns the value of the header field.
46
+ *
47
+ * @return string the value of the header field.
48
+ */
49
+ public function getValue()
50
+ {
51
+ return $this->sValue;
52
+ }
53
+
54
+
55
+ /**
56
+ * Sets the name of the header field.
57
+ *
58
+ * @param string $sName the name of the header field.
59
+ */
60
+ public function setName( $sName )
61
+ {
62
+ $this->sName = $sName;
63
+ }
64
+
65
+
66
+ /**
67
+ * Sets the value of the header field.
68
+ *
69
+ * @param string $sValue the value of the header field.
70
+ */
71
+ public function setValue( $sValue )
72
+ {
73
+ $this->sValue = $sValue;
74
+ }
75
+ }
lib/Inx/Api/Mail/MailContent.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_Mail_MailContent</i> contains the personalized content of a mailing for a specific recipient.
9
+ * The information that can be retrieved from the <i>Inx_Api_Mail_MailContent</i> includes:
10
+ * <ul>
11
+ * <li>The mail type: <i>getMailType()</i>
12
+ * <li>Plain/HTML text: <i>getPlainText()</i> and <i>getHtmlText()</i>
13
+ * <li>The subject: <i>getSubject()</i>
14
+ * <li>The recipient address: <i>getRecipientAddress()</i>
15
+ * <li>Attachments: <i>getAttachments()</i>
16
+ * <li>Embedded images: <i>getEmbeddedImages()</i>
17
+ * <li>The sender address: <i>getSenderAddress()</i>
18
+ * <li>The bounce and reply addresses: <i>getBounceAddress()</i> and <i>getReplyToAddress()</i>
19
+ * <li>The mail headers: <i>getHeader()</i> or <i>getMultipleHeaders()</i>
20
+ * </ul>
21
+ * An <i>Inx_Api_Mail_MailContent</i> object is created by an <i>Inx_Api_Mail_MailingRenderer</i> using its <i>build</i> methods.
22
+ *
23
+ * @see Inx_Api_Mail_MailingRenderer::build($iRecipientId, $iPreferredMailType=null)
24
+ * @since API 1.0
25
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
26
+ * @package Inxmail
27
+ * @subpackage Mail
28
+ */
29
+ interface Inx_Api_Mail_MailContent
30
+ {
31
+
32
+ /**
33
+ * Mail type indicating a HTML text mail. This mail has only a HTML text part.
34
+ */
35
+ const MAIL_TYPE_HTML_TEXT = 0;
36
+
37
+ /**
38
+ * Mail type indicating a plain text mail. This mail has only a plain text part.
39
+ */
40
+ const MAIL_TYPE_PLAIN_TEXT = 1;
41
+
42
+ /**
43
+ * Mail type indicating a multipart mail. This mail has a HTML and a plain text part.
44
+ */
45
+ const MAIL_TYPE_MULTIPART = 2;
46
+
47
+
48
+ /**
49
+ * Returns the mail type of this mail - either:
50
+ * <ul>
51
+ * <li><i>Inx_Api_Mail_MailContent::MAIL_TYPE_HTML_TEXT</i>,
52
+ * <li><i>Inx_Api_Mail_MailContent::MAIL_TYPE_PLAIN_TEXT</i> or
53
+ * <li><i>Inx_Api_Mail_MailContent::MAIL_TYPE_MULTIPART</i>
54
+ * </ul>
55
+ *
56
+ * @return int the mail type of this mail.
57
+ */
58
+ public function getMailType();
59
+
60
+
61
+ /**
62
+ * Returns the HTML text part of the mail, or <i>null</i> if the mail type is
63
+ * <i>Inx_Api_Mail_MailContent::MAIL_TYPE_PLAIN_TEXT</i>
64
+ *
65
+ * @return string the html text part of the mail, if any.
66
+ */
67
+ public function getHtmlText();
68
+
69
+
70
+ /**
71
+ * Returns the plain text part of the mail, or <i>null</i> if the mail type is
72
+ * <i>Inx_Api_Mail_MailContent::MAIL_TYPE_HTML_TEXT</i>
73
+ *
74
+ * @return string the plain text part of the mail, if any.
75
+ */
76
+ public function getPlainText();
77
+
78
+
79
+ /**
80
+ * Returns the subject of the mail.
81
+ *
82
+ * @return string the subject of the mail.
83
+ */
84
+ public function getSubject();
85
+
86
+
87
+ /**
88
+ * Returns the recipient address of the mail.
89
+ *
90
+ * @return string the recipient address of the mail.
91
+ */
92
+ public function getRecipientAddress();
93
+
94
+
95
+ /**
96
+ * Returns the sender address of the mail.
97
+ *
98
+ * @return string the sender address of the mail.
99
+ */
100
+ public function getSenderAddress();
101
+
102
+
103
+ /**
104
+ * Returns the reply address of the mail. This address will be used for replies.
105
+ *
106
+ * @return string the reply address of the mail.
107
+ */
108
+ public function getReplyToAddress();
109
+
110
+
111
+ /**
112
+ * Returns the bounce address of the mail. This address will be used for bounce messages.
113
+ *
114
+ * @return string the bounce address of the mail.
115
+ */
116
+ public function getBounceAddress();
117
+
118
+
119
+ /**
120
+ * Returns all regular attachments (files) of the mail.
121
+ *
122
+ * @return array all regular attachments of the mail.
123
+ */
124
+ public function getAttachments();
125
+
126
+
127
+ /**
128
+ * Returns all embedded images of the mail.
129
+ *
130
+ * @return array all embedded images of the mail.
131
+ */
132
+ public function getEmbeddedImages();
133
+
134
+
135
+ /**
136
+ * Returns the header information of the mail.
137
+ * The associative array contains the key/value-pair of the headers.
138
+ * <p>
139
+ * Note: This method allows header fields only to be defined once.
140
+ * If a header field is defined multiple times, the last value will be used.
141
+ * If you wish to define header fields multiple times, use the <i>getMultipleHeaders()<i> method instead.
142
+ * Nonetheless, you should be aware that defining the same header field multiple times is discouraged by RFC 5322
143
+ * as this is an obsolete behavior only permitted by legacy implementations.
144
+ *
145
+ * @return array the header information of the mail.
146
+ */
147
+ public function getHeader();
148
+
149
+ /**
150
+ * Returns the header information of the mail.
151
+ * The array contains <i>Inx_Api_Mail_HeaderField</i> objects encapsulating the key/value-pairs of the headers.
152
+ * This method allows for multiple defined header fields.
153
+ * <p>
154
+ * Note: You should be aware that defining the same header field multiple times is discouraged by RFC 5322 as this
155
+ * is an obsolete behavior only permitted by legacy implementations.
156
+ *
157
+ * @return array the header information of the mail.
158
+ * @since API 1.9.0
159
+ */
160
+ public function getMultipleHeaders();
161
+ }
lib/Inx/Api/Mail/MailingRenderer.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_Mail_MailingRenderer</i> is used to generate mail content using the API.
9
+ * The main use of the class will be to generate personalized previews of mailings.
10
+ * The class can also be used to generate and send single mails using a different mail sender.
11
+ * Be aware that in this case the mail sending rate would decrease enormously.
12
+ * <p>
13
+ * To preview a mailing, acquire an <i>Inx_Api_Mail_MailingRenderer</i> from the <i>Inx_Api_Mailing_MailingManager</i>.
14
+ * Each mailing needs to be parsed before building it.
15
+ * The following snippet shows how to build a mail for a given recipient:
16
+ * <pre>
17
+ * $oMailingRenderer = $oSession->getMailingManager()->createRenderer();
18
+ * $oMailingRenderer->parse( $oMailing->getId(), Inx_Api_Mail_MailingRenderer::BUILD_MODE_ALTERNATIVEVIEW_ACTIVE );
19
+ * $oMailContent = $oMailingRenderer->build( $iRecipientId );
20
+ * </pre>
21
+ * <p>
22
+ * <i>Inx_Api_Mail_MailingRenderer</i> can handle the following different build modes:
23
+ * <ol>
24
+ * <li><i>BUILD_MODE_PREVIEW</i> - Trackable links will not trigger any events, unsubscription links will redirect but
25
+ * not unsubscribe anybody. Embedded images are replaced with http references to image resources on the Inxmail server.
26
+ * <li><i>BUILD_MODE_VIEW</i> - deprecated, should not longer be used.
27
+ * <li><i>BUILD_MODE_ALTERNATIVEVIEW_ACTIVE</i> - All links are fully functional. Embedded images are replaced
28
+ * with http references to image resources on the Inxmail server.
29
+ * <li><i>BUILD_MODE_ALTERNATIVEVIEW_INACTIVE</i> - All links are not functional. Embedded images are replaced
30
+ * with http references to image resources on the Inxmail server.
31
+ * <li><i>BUILD_MODE_NORMAL</i> - The mail is rendered, ready to be sent.
32
+ * <li><i>BUILD_MODE_ARCHIVE</i> - Trackable links will not trigger any events, unsubscription links will redirect but
33
+ * not unsubscribe anybody. Embedded images are replaced with http references to image resources on the Inxmail server.
34
+ * <li><i>BUILD_MODE_ALTERNATIVEVIEW_ACTIVE_SIMPLE_LINKS</i> - All links are fully functional but converted to
35
+ * simple links. Embedded images are replaced with http references to image resources on the Inxmail server.
36
+ * <li><i>BUILD_MODE_NEWSLETTER_SIMPLE_LINKS</i> - The same as above, but the function InInboxView returns true.
37
+ * </ol>
38
+ * <p>
39
+ * <strong>Note:</strong> An <i>Inx_Api_Mail_MailingRenderer</i> object <strong>must</strong> be closed once it is not needed
40
+ * anymore to prevent memory leaks and other potentially harmful side effects.
41
+ *
42
+ * @see Inx_Api_Mail_MailContent
43
+ * @since API 1.0
44
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
45
+ * @package Inxmail
46
+ * @subpackage Mail
47
+ */
48
+ interface Inx_Api_Mail_MailingRenderer
49
+ {
50
+
51
+ /** The mode to generate a normal mail, ready to be sent. */
52
+ const BUILD_MODE_NORMAL = 100;
53
+
54
+ /**
55
+ * @deprecated use <i>BUILD_MODE_ALTERNATIVEVIEW_ACTIVE</i> instead.
56
+ */
57
+ const BUILD_MODE_VIEW = 101;
58
+
59
+ /**
60
+ * The mode for mail view: All links are fully functional.
61
+ * Embedded images are replaced with http references to image resources on the Inxmail server.
62
+ */
63
+ const BUILD_MODE_ALTERNATIVEVIEW_ACTIVE = 101;
64
+
65
+
66
+ /**
67
+ * The mode for mail view: All links are not functional.
68
+ * Embedded images are replaced with http references to image resources on the Inxmail server.
69
+ */
70
+ const BUILD_MODE_ALTERNATIVEVIEW_INACTIVE = 104;
71
+
72
+ /**
73
+ * The mode for mail preview: Trackable links will not trigger any events, unsubscription links will redirect but
74
+ * not unsubscribe anybody.
75
+ * Embedded images are replaced with http references to image resources on the Inxmail server.
76
+ */
77
+ const BUILD_MODE_PREVIEW = 102;
78
+
79
+ /**
80
+ * The mode for mail archive view: Trackable links will not trigger any events, unsubscription links will redirect
81
+ * but not unsubscribe anybody.
82
+ * Embedded images are replaced with http references to image resources on the Inxmail server.
83
+ */
84
+ const BUILD_MODE_ARCHIVE = 103;
85
+
86
+
87
+ /**
88
+ * Prepares the mailing for a preview.
89
+ * It checks the mail quality (syntax errors, references to orphaned elements, ... ).<br>
90
+ * Errors will be listed in the <i>Inx_Api_Mail_ParseException</i>.<br>
91
+ * The mailingId is supposed to be valid (existing mailing).<br>
92
+ *
93
+ * @param int $iMailingId the id of the mailing to be parsed.
94
+ * @param int $iBuildMode the mode of the build. May be one of the constants defined in this class:
95
+ * <ul>
96
+ * <li><i>BUILD_MODE_NORMAL</i>
97
+ * <li><i>BUILD_MODE_ALTERNATIVEVIEW_ACTIVE</i>
98
+ * <li><i>BUILD_MODE_ALTERNATIVEVIEW_INACTIVE</i>
99
+ * <li><i>BUILD_MODE_PREVIEW</i>
100
+ * <li><i>BUILD_MODE_ARCHIVE</i>
101
+ * <li><i>BUILD_MODE_ALTERNATIVEVIEW_ACTIVE_SIMPLE_LINKS</i>
102
+ * <li><i>BUILD_MODE_NEWSLETTER_SIMPLE_LINKS</i>
103
+ * </ul>
104
+ * @throws Inx_Api_Mail_ParseException if any syntax error is present in the mail.
105
+ * @throws Inx_Api_APIException if the mailing id is no longer valid.
106
+ */
107
+ public function parse( $iMailingId, $iBuildMode );
108
+
109
+ /**
110
+ * Generates the personalized mail content (recipient address, subject, HTML and/or plain text, ...) for the
111
+ * specified recipient with a specified mail type restriction.
112
+ *
113
+ * @param int $iRecipientId the id of the recipient for which the mail shall be personalized.
114
+ * @param int $iPreferredMailType the mail type. May be one of:
115
+ * <ul>
116
+ * <li><i>Inx_Api_Mail_MailContent::MAIL_TYPE_HTML_TEXT</i>
117
+ * <li><i>Inx_Api_Mail_MailContent::MAIL_TYPE_PLAIN_TEXT</i>
118
+ * <li><i>Inx_Api_Mail_MailContent::MAIL_TYPE_MULTIPART</i>
119
+ * </ul>
120
+ * May be ommitted (defaults to the standard mail type).
121
+ * @return Inx_Api_Mail_MailContent the personalized content of the mail.
122
+ * @throws Inx_Api_Mail_BuildException if the recipient could not be found, or the building failed.
123
+ */
124
+ public function build( $iRecipientId, $iPreferredMailType=null );
125
+
126
+
127
+ /**
128
+ * Closes this <i>Inx_Api_Mail_MailingRenderer</i> and releases any server resources associated with this object.
129
+ * An <i>Inx_Api_Mail_MailingRenderer</i> object <strong>must</strong> be closed once it is not needed
130
+ * anymore to prevent memory leaks and other potentially harmful side effects.
131
+ */
132
+ public function close();
133
+
134
+ }
lib/Inx/Api/Mail/ParseException.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Mail_ParseException</i> is thrown when the parsing of a mailing fails.
8
+ * The reason for such a failure usually is a syntax error.
9
+ * For a deeper insight on the error, consult the {@link RenderError}s associated with the exception.
10
+ *
11
+ * @see Inx_Api_Mail_RenderError
12
+ * @see Inx_Api_Mail_MailingRenderer::parse( $iRecipientId, $iPreferredMailType=null )
13
+ * @version $Revision: 9479 $ $Date: 2007-12-18 15:43:23 +0200 (An, 18 Grd 2007) $ $Author: aurimas $
14
+ * @package Inxmail
15
+ * @subpackage Mail
16
+ */
17
+ class Inx_Api_Mail_ParseException extends Exception
18
+ {
19
+ /**
20
+ * Contains detail information about the error.
21
+ * @var array() of Inx_Api_Mail_RenderError objects
22
+ */
23
+ protected $aErrors = array();
24
+
25
+
26
+ /**
27
+ * Creates an <i>Inx_Api_Mail_ParseException</i> with the given render errors.
28
+ *
29
+ * @param array $aErrors the render errors which occurred during the parsing.
30
+ */
31
+ public function __construct( $aErrors )
32
+ {
33
+ $this->aErrors = $aErrors;
34
+ }
35
+
36
+ /**
37
+ * Returns detail information about the error by returning the render error with the given index.
38
+ *
39
+ * @param int $iIndex the index of the render error to be returned.
40
+ * @return Inx_Api_Mail_RenderError the render error with the given index.
41
+ */
42
+ public function getError( $iIndex )
43
+ {
44
+ return $this->aErrors[$iIndex];
45
+ }
46
+
47
+ /**
48
+ * Returns the number of render errors associated with this <i>Inx_Api_Mail_ParseException</i>.
49
+ *
50
+ * @return int the number of render errors.
51
+ */
52
+ public function getErrorCount()
53
+ {
54
+ return count($this->aErrors);
55
+ }
56
+
57
+ }
lib/Inx/Api/Mail/RenderError.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Mail_RenderError</i> object describes the details of an error which occurred during the parsing or building of
8
+ * a mailing.
9
+ * <i>Inx_Api_Mail_RenderError</i> offers the following information:
10
+ * <ul>
11
+ * <li><i>Error type</i>: an internal error code
12
+ * <li><i>Mail part</i>: the internal mail part code
13
+ * <li><i>Begin line / column</i>: the line and column where the malicious token begins
14
+ * <li><i>End line / column</i>: the line and column where the malicious token ends.
15
+ * <li><i>Error messages</i>: the error messages
16
+ * </ul>
17
+ * <p>
18
+ * <i>Inx_Api_Mail_RenderError</i> is mainly used internally but may provide some insight on the error source to API developers.
19
+ * For example, the token position will assist you in identifying syntax errors.
20
+ * The error messages may also be analyzed to identify the error source.
21
+ *
22
+ * @see Inx_Api_Mail_BuildException::getError()
23
+ * @see Inx_Api_Mail_ParseException::getError($iIndex)
24
+ * @version $Revision: 9479 $ $Date: 2007-12-18 15:43:23 +0200 (An, 18 Grd 2007) $ $Author: aurimas $
25
+ * @package Inxmail
26
+ * @subpackage Mail
27
+ */
28
+ class Inx_Api_Mail_RenderError
29
+ {
30
+ private $iErrorType;
31
+ private $iMailPart;
32
+ private $iBeginLine;
33
+ private $iEndLine;
34
+ private $iBeginColumn;
35
+ private $iEndColumn;
36
+ /**
37
+ * @var array of string arguments
38
+ */
39
+ private $aMsgArgs;
40
+
41
+
42
+ /**
43
+ * Creates an <i>Inx_Api_Mail_RenderError</i> with the given details.
44
+ *
45
+ * @param $iErrorType the internal error code.
46
+ * @param $iMailPart the internal mail part code.
47
+ * @param $iBeginLine the line where the malicious token begins.
48
+ * @param $iEndLine the line where the malicious token ends.
49
+ * @param $iBeginColumn the column where the malicious token begins.
50
+ * @param $iEndColumn the column where the malicious token ends.
51
+ * @param $aMsgArgs the string error messages.
52
+ */
53
+ public function __construct( $iErrorType, $iMailPart, $iBeginLine,
54
+ $iEndLine, $iBeginColumn, $iEndColumn, $aMsgArgs )
55
+ {
56
+ $this->iErrorType = $iErrorType;
57
+ $this->iMailPart = $iMailPart;
58
+ $this->iBeginLine = $iBeginLine;
59
+ $this->iEndLine = $iEndLine;
60
+ $this->iBeginColumn = $iBeginColumn;
61
+ $this->iEndColumn = $iEndColumn;
62
+ $this->aMsgArgs = $aMsgArgs;
63
+ }
64
+
65
+
66
+ /**
67
+ * Returns the internal error code.
68
+ *
69
+ * @return int the internal error code.
70
+ */
71
+ public function getErrorType()
72
+ {
73
+ return $this->iErrorType;
74
+ }
75
+
76
+
77
+ /**
78
+ * Returns the internal mail part code.
79
+ *
80
+ * @return int the internal mail part code.
81
+ */
82
+ public function getMailPart()
83
+ {
84
+ return $this->iMailPart ;
85
+ }
86
+
87
+
88
+ /**
89
+ * Returns the line where the malicious token begins.
90
+ *
91
+ * @return int the line where the malicious token begins.
92
+ */
93
+ public function getBeginLine()
94
+ {
95
+ return $this->iBeginLine;
96
+ }
97
+
98
+
99
+ /**
100
+ * Returns the line where the malicious token ends.
101
+ *
102
+ * @return int the line where the malicious token ends.
103
+ */
104
+ public function getEndLine()
105
+ {
106
+ return $this->iEndLine;
107
+ }
108
+
109
+
110
+ /**
111
+ * Returns the column where the malicious token begins.
112
+ *
113
+ * @return int the column where the malicious token begins.
114
+ */
115
+ public function getBeginColumn()
116
+ {
117
+ return $this->iBeginColumn;
118
+ }
119
+
120
+
121
+ /**
122
+ * Returns the column where the malicious token ends.
123
+ *
124
+ * @return int the column where the malicious token ends.
125
+ */
126
+ public function getEndColumn()
127
+ {
128
+ return $this->iEndColumn;
129
+ }
130
+
131
+
132
+ /**
133
+ * Returns the error messages.
134
+ *
135
+ * @return array the string error messages.
136
+ */
137
+ public function getMsgArgs()
138
+ {
139
+ return $this->aMsgArgs;
140
+ }
141
+
142
+ }
lib/Inx/Api/Mailing/ContentHandler.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Mailing_ContentHandler</i> interface identifies content handlers.
8
+ * Content handlers are used to store and update the content of a mailing in a specific format.
9
+ * Some content handlers (like <i>Inx_Api_Mailing_XsltContentHandler</i>) provide special functionality like applying
10
+ * styles to a mailing (used by templates).
11
+ * <p>
12
+ * There are no requirements common for all content handlers, thus content handlers are free to provide only the
13
+ * methods needed for the current content type.
14
+ *
15
+ * @see Inx_Api_Mailing_Mailing::getContentHandler()
16
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
17
+ * @package Inxmail
18
+ * @subpackage Mailing
19
+ */
20
+ interface Inx_Api_Mailing_ContentHandler
21
+ {
22
+
23
+ }
lib/Inx/Api/Mailing/HtmlTextContentHandler.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Mailing_HtmlTextContentHandler</i> is a simple content handler used to store and update mailing
8
+ * content in HTML format.
9
+ * This content handler can only handle HTML content.
10
+ * If you wish to use both, plain and HTML text content, use the <i>Inx_Api_Mailing_MultiPartContentHandler</i> instead.
11
+ *
12
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
13
+ * @package Inxmail
14
+ * @subpackage Mailing
15
+ */
16
+ interface Inx_Api_Mailing_HtmlTextContentHandler extends Inx_Api_Mailing_SinglePartContentHandler
17
+ {
18
+
19
+ }
lib/Inx/Api/Mailing/Mailing.php ADDED
@@ -0,0 +1,689 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_Mailing_Mailing</i> object represents a mailing in inxmail.
9
+ * An <i>Inx_Api_Mailing_Mailing</i> object can be used to perform various tasks:
10
+ * <ul>
11
+ * <li>Retrieve and update mailing meta information and content
12
+ * <li>Send the mailing (immediately or scheduled)
13
+ * <li>Stop sending the mailing
14
+ * <li>Request the approval of a mailing
15
+ * <li>Approve or revoke the approval for the mailing
16
+ * </ul>
17
+ * <strong>Handling mailing content</strong>
18
+ * <p>
19
+ * Content is put into mailings using content handlers. There are a number of such handlers:
20
+ * <ul>
21
+ * <li><i>Inx_Api_Mailing_PlainTextContentHandler</i> - Handles plain text content. This is the default content handler.
22
+ * <li><i>Inx_Api_Mailing_HtmlTextContentHandler</i> - Handles HTML-only content.
23
+ * <li><i>Inx_Api_Mailing_MultiPartContentHandler</i> - Handles multipart content (HTML and plain text), or mailings
24
+ * where the content type is selected depending on the recipient profile.
25
+ * <li><i>Inx_Api_Mailing_XsltMultiPartContentHandler</i> - Handles multipart content defined by XML/XSLT, or mailings
26
+ * where the content type is selected depending on the recipient profile. Used by templates.
27
+ * <li><i>Inx_Api_Mailing_XsltPlainTextContentHandler</i> - Handles plain text defined by XML/XSLT. Used by templates.
28
+ * <li><i>Inx_Api_Mailing_XsltHtmlTextContentHandler</i> - Handles HTML text content defined by XML/XSLT. Used by templates.
29
+ * </ul>
30
+ * <p>
31
+ * All of these handlers offer methods to edit the content of the mailing.
32
+ * The following snippet changes the content of a plain text mailing:
33
+ *
34
+ * <pre>
35
+ * $oMailing->setContentHandler( 'Inx_Api_Mailing_PlainTextContentHandler' );
36
+ * $oContentHandler = $oMailing->getContentHandler();
37
+ * $oContentHandler->updateContent( "...any mailing content..." );
38
+ * $oMailing->commitUpdate();
39
+ * </pre>
40
+ *
41
+ * <strong>Approval and controlling dispatch</strong>
42
+ * <p>
43
+ * The following methods can be used for the approval of mailings:
44
+ * <ul>
45
+ * <li><i>approve($iApproverId, $sComment)</i>: approves the mailing using the given approver.
46
+ * <li><i>denyApprove($iApproverId, $sComment)</i>: denies the approval of the mailing using the given approver.
47
+ * <li><i>revokeApproval($sComment)</i>: revokes the approval of the mailing using the given approver.
48
+ * <li><i>requestIdenticalApproval($sDeadline, $aApprovers, $aRecipients, $bIsTestRecipient, $sLocale)</i>: requests
49
+ * the approval of the mailing using the given equitable approvers.
50
+ * <li><i>requestEscalationApproval($sEscalation, $sDeadline, $aApprovers, $aRecipients, $bIsTestRecipient, $sLocale)</i>:
51
+ * requests the approval of the mailing using the given hierarchical approvers.
52
+ * </ul>
53
+ * As listed above, there are two methods for requesting the approval of a mailing:
54
+ * <i>requestIdenticalApproval(...)</i> and <i>requestEscalationApproval(...)</i>.
55
+ * Both methods require two approvers but involve them differently.<br>
56
+ * The identical approval process sends the request to both approvers simultaneously and requires only one of the
57
+ * approvers to approve the mailing.
58
+ * The escalation approval process at first sends the request only to the first approver.
59
+ * If the escalation date expires without the first approver having approved the mailing, the request is sent to the
60
+ * second approver.<br>
61
+ * If the deadline date expires without any of the approvers having approved the mailing, the request will be cancelled.
62
+ * In order to approve it, the mailing creator will have to request the approval again.
63
+ * <p>
64
+ * Note: The methods for approving a mailing are functional since Inxmail 3.8.1.
65
+ * <p>
66
+ * The Following methods can be used to send mailings:
67
+ * <ul>
68
+ * <li><i>startSending()</i>: starts the normal sending process.
69
+ * <li><i>sendSingleMail($iRecipientId)</i>: send the mailing only to the specified recipient.
70
+ * <li><i>sendTestMail($sTestAddress, $iRecipientId)</i>: send the mailing to the specified address, personalized for the
71
+ * given recipient.
72
+ * <li><i>sendTestMailWithTestprofile($sTestAddress, $iTestRecipientId)</i>: send the mailing to the specified address,
73
+ * personalized for the given test profile.
74
+ * </ul>
75
+ * <p>
76
+ * To schedule a mailing instead of sending it immediately, use the <i>scheduleMailing($sScheduleTime)</i> method.
77
+ * The following snippet shows how to schedule a mailing to be sent in one hour:
78
+ *
79
+ * <pre>
80
+ * $oMailing->scheduleMailing( date( 'c', strtotime("+1 hour") ) );
81
+ * </pre>
82
+ * <p>
83
+ * The following snippet shows how to revoke the scheduled sending of a mailing:
84
+ *
85
+ * <pre>
86
+ * mailing->unscheduleMailing();
87
+ * </pre>
88
+ * <p>
89
+ * <strong>Note:</strong> For existing mailings, always call <code>lock()</code> before updating it, and
90
+ * <code>unlock()</code> after committing changes!
91
+ * <p>
92
+ * For an example on how to retrieve and create mailings, see the <i>Inx_Api_Mailing_MailingManager</i> documentation.
93
+ * <p>
94
+ * For more information on the creation of <i>Inx_Api_Approval_Approver</i>s, see the
95
+ * <i>Inx_Api_Approval_ApproverManager</i> documentation.
96
+ *
97
+ * @see Inx_Api_Mailing_MailingManager
98
+ * @see Inx_Api_Mailing_ContentHandler
99
+ * @see Inx_Api_Approval_ApproverManager
100
+ * @since API 1.0
101
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
102
+ * @package Inxmail
103
+ * @subpackage Mailing
104
+ */
105
+ interface Inx_Api_Mailing_Mailing extends Inx_Api_BusinessObject
106
+ {
107
+
108
+ const ATTRIBUTE_SUBJECT = 3;
109
+
110
+ const ATTRIBUTE_PLAIN_TEXT = 4;
111
+
112
+ const ATTRIBUTE_HTML_TEXT = 5;
113
+
114
+ const ATTRIBUTE_XML_CONTENT = 6;
115
+
116
+ const ATTRIBUTE_PLAIN_TEXT_XSL = 7;
117
+
118
+ const ATTRIBUTE_HTML_TEXT_XSL = 8;
119
+
120
+ const ATTRIBUTE_FILTER_ID = 9;
121
+
122
+ const ATTRIBUTE_SENDER_ADDRESS = 10;
123
+
124
+ const ATTRIBUTE_RECIPIENT_ADDRESS = 11;
125
+
126
+ const ATTRIBUTE_REPLY_TO_ADDRESS = 12;
127
+
128
+ const ATTRIBUTE_PRIORITY = 13;
129
+
130
+ const ATTRIBUTE_SCHEDULE_DATETIME = 14;
131
+
132
+ const ATTRIBUTE_MODIFICATION_DATETIME = 15;
133
+
134
+ const ATTRIBUTE_STYLE = 16;
135
+
136
+ const ATTRIBUTE_SENT_START_DATETIME = 17;
137
+
138
+ const ATTRIBUTE_SENT_END_DATETIME = 18;
139
+
140
+ const ATTRIBUTE_NAME = 19;
141
+
142
+ const STATE_DRAFT = 1;
143
+
144
+ const STATE_TO_BE_APPROVE = 2;
145
+
146
+ const STATE_APPROVED = 4;
147
+
148
+ const STATE_SCHEDULED = 8;
149
+
150
+ const STATE_SENDING = 16;
151
+
152
+ const STATE_INTERRUPTED = 32;
153
+
154
+ const STATE_SENT = 64;
155
+
156
+ const STATE_SENDING_FAILED = 128;
157
+
158
+
159
+ /**
160
+ * @since API 1.6.0
161
+ */
162
+ const FILTER_AND = 1;
163
+
164
+ /**
165
+ * @since API 1.6.0
166
+ */
167
+ const FILTER_OR = 2;
168
+
169
+ /**
170
+ * @since API 1.6.0
171
+ */
172
+ const FILTER_NOT_IN = 3;
173
+
174
+
175
+
176
+ /**
177
+ * Sending this mailing to the test address. Using the specified recipient
178
+ * to generating the email content.
179
+ *
180
+ * @param string $sTestAddresss the email address
181
+ * @param int $iRecipientId the recipient to generating the email content
182
+ * @throws Inx_Api_Mailing_SendException
183
+ * @throws Inx_Api_Mailing_MailingStateException if this mailing has a illegal state
184
+ * @throws Inx_Api_DataException if this mailing is not found on the server
185
+ */
186
+ public function sendTestMail( $sTestAddress, $iRecipientId );
187
+
188
+ /**
189
+ * Sending this mailing to the test address. Using the specified recipient
190
+ * to generating the email content.
191
+ *
192
+ * @param string $sTestAddresss the email address
193
+ * @param int $iTestprofileId the recipient to generating the email content
194
+ * @throws Inx_Api_Mailing_SendException
195
+ * @throws Inx_Api_Mailing_MailingStateException if this mailing has a illegal state
196
+ * @throws Inx_Api_DataException if this mailing is not found on the server
197
+ * @since API 1.6.1
198
+ */
199
+ public function sendTestMailWithTestprofile( $sTestAddress, $iTestprofileId );
200
+
201
+
202
+ /**
203
+ * Sending this mailing to the specified recipient. Using the recipient
204
+ * to generating the email content.
205
+ *
206
+ * @param int $iRecipientId the recipient to generating the email content
207
+ * @return the updated mailing
208
+ * @throws Inx_Api_Mailing_SendException
209
+ * @throws Inx_Api_Mailing_MailingStateException if this mailing has a illegal state
210
+ * @throws Inx_Api_DataException if this mailing is not found on the server
211
+ */
212
+ public function sendSingleMail( $iRecipientId );
213
+
214
+
215
+ /**
216
+ * Start or restart the sending of this mailing.
217
+ *
218
+ * Allowed mailing states are:
219
+ * <ul>
220
+ * <li>Inx_Api_Mailing_Mailing::STATE_APPROVED ( -> STATE_SENDING )
221
+ * <li>Inx_Api_Mailing_Mailing::STATE_IInx_Api_Mailing_Mailing::ED ( -> STATE_SENDING )
222
+ * </ul>
223
+ *
224
+ * @throws Inx_Api_Mailing_MailingStateException if this mailing has a illegal state
225
+ * @throws Inx_Api_DataException if this mailing is not found on the server
226
+ */
227
+ public function startSending();
228
+
229
+
230
+ /**
231
+ * Stop the sending of the specified mailing.
232
+ *
233
+ * Allowed mailing states are:
234
+ * <ul>
235
+ * <li>Inx_Api_Mailing_Mailing::STATE_SENDING ( -> STATE_INTERRUPTED )
236
+ * </ul>
237
+ *
238
+ * @throws Inx_Api_Mailing_MailingStateException if this mailing has a illegal state
239
+ * @throws Inx_Api_DataException if this mailing is not found on the server
240
+ */
241
+ public function stopSending();
242
+
243
+
244
+ /**
245
+ * Approve this mailing for sending.
246
+ * <p>
247
+ * Allowed mailing states are:
248
+ * <ul>
249
+ * <li>Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE ( -> STATE_APPROVED or STATE_STATE_SCHEDULED )
250
+ * </ul>
251
+ *
252
+ * @param approverId id of the approver
253
+ * @param comment message of the approver
254
+ * @throws MailingStateException if this mailing has a illegal state
255
+ * @throws DataException if this mailing is not found on the server
256
+ * @throws UpdateException if the request goes wrong, for example approval not active
257
+ */
258
+ public function approve( $iApproverId = 0, $sComment = null );
259
+
260
+
261
+ /**
262
+ * Deny approval of this mailing.
263
+ * <p>
264
+ * Allowed mailing states are:
265
+ * <ul>
266
+ * <li>Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE ( -> STATE_DRAFT )
267
+ * </ul>
268
+ *
269
+ * @param approverId id of the approver
270
+ * @param comment message of the approver
271
+ * @throws MailingStateException if this mailing has a illegal state
272
+ * @throws DataException if this mailing is not found on the server
273
+ * @throws UpdateException if the request goes wrong, for example approval not active
274
+ */
275
+ public function denyApprove( $iApproverId, $sComment );
276
+
277
+
278
+
279
+ /**
280
+ * Request the approval for this mailing.
281
+ *
282
+ * Allowed mailing states are:
283
+ * <ul>
284
+ * <li>Inx_Api_Mailing_Mailing::STATE_DRAFT ( -> STATE_TO_BE_APPROVE )
285
+ * </ul>
286
+ * @deprecated
287
+ * @throws Inx_Api_Mailing_MailingStateException if this mailing has a illegal state
288
+ * @throws Inx_Api_DataException if this mailing is not found on the server
289
+ */
290
+ public function requestApproval();
291
+
292
+ /**
293
+ * Request the escalating approval for this mailing.
294
+ * <p>
295
+ * Allowed mailing states are:
296
+ * <ul>
297
+ * <li>Inx_Api_Mailing_Mailing::STATE_DRAFT ( -> STATE_TO_BE_APPROVE )
298
+ * </ul>
299
+ *
300
+ * @throws MailingStateException if this mailing has a illegal state
301
+ * @throws DataException if this mailing is not found on the server
302
+ * @throws UpdateException if the request goes wrong, for example approval not active
303
+ */
304
+ public function requestEscalationApproval( $oEscalationDate, $oDeadline, $approverIds, $recipientIds,
305
+ $bIsTestRecipient, $sLocale );
306
+
307
+
308
+ /**
309
+ * Request the escalating approval for this mailing.
310
+ * <p>
311
+ * Allowed mailing states are:
312
+ * <ul>
313
+ * <li>Inx_Api_Mailing_Mailing::STATE_DRAFT ( -> STATE_TO_BE_APPROVE )
314
+ * </ul>
315
+ *
316
+ * @throws MailingStateException if this mailing has a illegal state
317
+ * @throws DataException if this mailing is not found on the server
318
+ * @throws UpdateException if the request goes wrong, for example approval not active
319
+ */
320
+ public function requestIdenticalApproval( $oDeadline, $approverIds, $recipientIds, $bIsTestRecipient,
321
+ $sLocale );
322
+
323
+
324
+
325
+ /**
326
+ * Revoke the approval or scheduling for this mailing.
327
+ * <p>
328
+ * Allowed mailing states are:
329
+ * <ul>
330
+ * <li>Inx_Api_Mailing_Mailing::STATE_APPROVED ( -> STATE_DRAFT )
331
+ * <li>Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE ( -> STATE_DRAFT )
332
+ * <li>Inx_Api_Mailing_Mailing::STATE_SCHEDULED ( -> STATE_DRAFT )
333
+ * </ul>
334
+ *
335
+ * @param comment reason why revoke is called
336
+ * @throws MailingStateException if this mailing has a illegal state
337
+ * @throws DataException if this mailing is not found on the server
338
+ * @throws UpdateException if the request goes wrong, for example approval not active
339
+ */
340
+ public function revokeApproval( $sComment = null );
341
+
342
+
343
+ /**
344
+ * Schedules the mailing with the given date.
345
+ * <p>
346
+ * Allowed mailing states are:
347
+ * <ul>
348
+ * <li>Inx_Api_Mailing_Mailing::STATE_DRAFT ( -> STATE_SHEDULED ) if no approval is active
349
+ * <li>Inx_Api_Mailing_Mailing::STATE_DRAFT ( -> STATE_DRAFT ) if approval is active
350
+ * <li>Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVED ( -> STATE_TO_BE_APPROVED )
351
+ * <li>Inx_Api_Mailing_Mailing::STATE_APPROVED ( -> STATE_SHEDULED )
352
+ * <li>Inx_Api_Mailing_Mailing::STATE_INTERRUPTED ( -> STATE_SHEDULED )
353
+ * </ul>
354
+ *
355
+ * @param scheduleTime new schedule time of the mailing
356
+ * @throws MailingStateException if this mailing has a illegal state
357
+ * @throws DataException if this mailing is not found on the server
358
+ */
359
+ public function scheduleMailing( $oScheduleTime = null ) ;
360
+
361
+
362
+ /**
363
+ * Unschedules the mailing.
364
+ * <p>
365
+ * Allowed mailing states are:
366
+ * <ul>
367
+ * <li>Inx_Api_Mailing_Mailing::STATE_SHEDULED( -> STATE_APPROVED or STATE_DRAFT )
368
+ * <li>Inx_Api_Mailing_Mailing::STATE_DRAFT ( -> STATE_DRAFT )
369
+ * <li>Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVED ( -> STATE_TO_BE_APPROVED )
370
+ * </ul>
371
+ *
372
+ * @throws MailingStateException if this mailing has a illegal state
373
+ * @throws DataException if this mailing is not found on the server
374
+ */
375
+ public function unscheduleMailing();
376
+
377
+ /**
378
+ * Lock the this <i>Inx_Api_Mailing_Mailing</i>. For existing mailings, always
379
+ * call <i>lock()</i> before updating it, and <i>unlock()</i>
380
+ * after committing changes!
381
+ *
382
+ * @throws Inx_Api_LockException if this mailing already locked
383
+ * @throws Inx_Api_Mailing_MailingStateException if this mailing has a illegal state
384
+ * @throws Inx_Api_DataException if this mailing is not found on the server
385
+ */
386
+ public function lock();
387
+
388
+
389
+ /**
390
+ * Release the lock of this <i>Inx_Api_Mailing_Mailing</i>.
391
+ *
392
+ * @param boolean forceForeignLock <i>true</i> - release foreign and own locks,
393
+ * <i>false</i> - release only own locks
394
+ * @return boolean <i>true</i> if this mailing was unlocked, <i>false</i> otherwise
395
+ * @throws Inx_Api_DataException
396
+ */
397
+ public function unlock( $blForceForeignLock = false );
398
+
399
+
400
+ /**
401
+ * Returns the mailing state.
402
+ *
403
+ * @return int the mailing state
404
+ */
405
+ public function getState();
406
+
407
+
408
+ /**
409
+ * Checks if this mailing has a lock.
410
+ *
411
+ * @return boolean true if this mailing has a lock, otherwise false
412
+ */
413
+ public function isLocked();
414
+
415
+
416
+ /**
417
+ * Returns the lock ticket.
418
+ *
419
+ * @return Inx_Api_LockTicket the lock ticket
420
+ */
421
+ public function getLockTicket();
422
+
423
+
424
+ /**
425
+ * Returns the last modification datetime.
426
+ *
427
+ * @return string the last modification datetime
428
+ */
429
+ public function getModificationDatetime();
430
+
431
+
432
+ /**
433
+ * Returns the schedule datetime.
434
+ *
435
+ * @return string the schedule datetime, can be null
436
+ */
437
+ public function getScheduleDatetime();
438
+
439
+
440
+ /**
441
+ * Sets the schedule datetime.
442
+ *
443
+ * @param string $dtScheduleDatetime the schedule datetime, or null
444
+ */
445
+ public function updateScheduleDatetime( $dtScheduleDatetime );
446
+
447
+
448
+ /**
449
+ * Returns the sent datetime, null if this mailing not yet sent.
450
+ *
451
+ * @return string the sent datetime, or null
452
+ */
453
+ public function getSentDatetime();
454
+
455
+
456
+ /**
457
+ * Returns the approval escalation datetime of this mailing if the mailing is in the state
458
+ * <i>STATE_TO_BE_APPROVE</i> and the approval process is escalating.
459
+ * If the mailing state is not <i>STATE_TO_BE_APPROVE</i> or the approval process is identical,
460
+ * <i>null</i> may be returned.
461
+ * The date will be returned as ISO 8601 formatted datetime string.
462
+ *
463
+ * @see requestEscalationApproval( $oEscalationDate, $oDeadline, $approverIds, $recipientIds, $bIsTestRecipient, $sLocale )
464
+ * @return string the approval escalation datetime, or <i>null</i>.
465
+ * @since API 1.9.0
466
+ */
467
+ public function getEscalationDatetime();
468
+
469
+
470
+ /**
471
+ * Returns the approval deadline datetime of this mailing if the mailing is in the state <i>STATE_TO_BE_APPROVE</i>.
472
+ * If the mailing state is not <i>STATE_TO_BE_APPROVE</i>, <i>null</i> may be returned.
473
+ * The date will be returned as ISO 8601 formatted datetime string.
474
+ *
475
+ * @see requestIdenticalApproval( $oDeadline, $approverIds, $recipientIds, $bIsTestRecipient, $sLocale );
476
+ * @see requestEscalationApproval( $oEscalationDate, $oDeadline, $approverIds, $recipientIds, $bIsTestRecipient, $sLocale )
477
+ * @return string the approval deadline datetime, or <i>null</i>.
478
+ * @since API 1.9.0
479
+ */
480
+ public function getDeadlineDatetime();
481
+
482
+
483
+ /**
484
+ * Returns the id of list context which this mailing belongs to.
485
+ *
486
+ * @return int the id of list context which this mailing belongs to
487
+ */
488
+ public function getListContextId();
489
+
490
+
491
+ /**
492
+ * Returns the sender address of this mailing.
493
+ *
494
+ * @return String the sender address of this mailing
495
+ */
496
+ public function getSenderAddress();
497
+
498
+
499
+ /**
500
+ * Sets the sender address of this mailing.
501
+ *
502
+ * @param string $sSenderAddress the sender address of this mailing
503
+ */
504
+ public function updateSenderAddress( $sSenderAddress );
505
+
506
+
507
+ /**
508
+ * Returns the recipient address of this mailing.
509
+ *
510
+ * @return String the recipient address of this mailing
511
+ */
512
+ public function getRecipientAddress();
513
+
514
+
515
+ /**
516
+ * Sets the recipient address of this mailing.
517
+ *
518
+ * @param string $sRecipientAddress the recipient address of this mailing
519
+ */
520
+ public function updateRecipientAddress( $sRecipientAddress );
521
+
522
+
523
+ /**
524
+ * Returns the recipient address of this mailing.
525
+ *
526
+ * @return string the recipient address of this mailing
527
+ */
528
+ public function getReplyToAddress();
529
+
530
+
531
+ /**
532
+ * Sets the replyTo address of this mailing.
533
+ *
534
+ * @param string $sReplyToAddress the replyTo address of this mailing
535
+ */
536
+ public function updateReplyToAddress( $sReplyToAddress );
537
+
538
+
539
+ /**
540
+ * Returns a sending filter of this mailing.
541
+ *
542
+ * @return int the filter id, 0 means that no filter is set
543
+ * @since API 1.1.0
544
+ */
545
+ public function getFilterId();
546
+
547
+
548
+ /**
549
+ * Sets a sending filter of this mailing.
550
+ *
551
+ * @param int $iFilterId the filter id, 0 means that no filter is set
552
+ * @see com.inxmail.xpro.api.filter.Filter#getId()
553
+ * @since API 1.1.0
554
+ */
555
+ public function updateFilterId( $iFilterId );
556
+
557
+ /**
558
+ * Returns the sending filter of this mailing.
559
+ *
560
+ * @return the filter id, null means that no filter is set
561
+ * @since API 1.6.0
562
+ */
563
+ public function getFilterIds();
564
+
565
+
566
+ /**
567
+ * Returns the sending filter concatenation type of this mailing.
568
+ *
569
+ * @return <code>FILTER_AND</code> or <code>FILTER_OR</code> or <code>FILTER_NOT_IN</code> or 0 if it is not set
570
+ * @since API 1.6.0
571
+ */
572
+ public function getFilterConcatinationType();
573
+
574
+
575
+ /**
576
+ * Sets a couple of sending filter to this mailing.
577
+ *
578
+ * @param filterIds array of the filter ids, null for no filter is set
579
+ * @param concatinationType sets how the filter should be concatinated, <code>FILTER_AND</code>,
580
+ * <code>FILTER_OR</code>, <code>FILTER_NOT_IN</code>
581
+ * @since API 1.6.0
582
+ */
583
+ public function updateFilterIds( $filterIds, $iConcatinationType );
584
+
585
+
586
+ /**
587
+ * Returns the value of X-Priority header. Allowed values are:
588
+ * <ul>
589
+ * <li><tt>null</tt> - not specified, the X-Priority header will not be set
590
+ * <li>5 - lowest priority
591
+ * <li>4 - low priority
592
+ * <li>3 - normal priority
593
+ * <li>2 - high priority
594
+ * <li>1 - highest priority
595
+ * </ul>
596
+ *
597
+ * @return Integer the value of X-Priority header, or <tt>null</tt>
598
+ */
599
+ public function getPriority();
600
+
601
+
602
+ /**
603
+ * Sets the value of X-Priority header. Allowed values are:
604
+ * <ul>
605
+ * <li><tt>null</tt> - not specified, the X-Priority header will not be set
606
+ * <li>5 - lowest priority
607
+ * <li>4 - low priority
608
+ * <li>3 - normal priority
609
+ * <li>2 - high priority
610
+ * <li>1 - highest priority
611
+ * </ul>
612
+ *
613
+ * @param Integer $iPriority the value of X-Priority header, or <tt>null</tt>
614
+ */
615
+ public function updatePriority( $iPriority );
616
+
617
+
618
+ /**
619
+ * Returns the subject of this mailing.
620
+ *
621
+ * @return String the subject of this mailing
622
+ */
623
+ public function getSubject();
624
+
625
+
626
+ /**
627
+ * Sets the subject of this mailing.
628
+ *
629
+ * @param String subject the subject of this mailing
630
+ */
631
+ public function updateSubject( $sSubject );
632
+
633
+ /**
634
+ * Returns the name of this mailing.
635
+ *
636
+ * @return String the name of this mailing
637
+ */
638
+ public function getName();
639
+
640
+
641
+ /**
642
+ * Sets the name of this mailing.
643
+ *
644
+ * @param String name the name of this mailing
645
+ */
646
+ public function updateName( $sName );
647
+
648
+
649
+
650
+ /**
651
+ * Returns the content handler, which contains the format-specific mail content.
652
+ *
653
+ * @return Inx_Api_Mailing_ContentHandler the content handler
654
+ */
655
+ public function getContentHandler();
656
+
657
+
658
+ /**
659
+ * Creates a new content handler. Allowed classes are:
660
+ * <ul>
661
+ * <li><i>PlainTextContentHandler</i>
662
+ * <li><i>HtmlTextContentHandler</i>
663
+ * <li><i>MultiPartContentHandler</i>
664
+ * <li><i>XsltMultiPartContentHandler</i>
665
+ * <li><i>XsltHtmlTextContentHandler</i>
666
+ * <li><i>XsltPlainTextContentHandler</i>
667
+ * </ul>
668
+ *
669
+ * @param string $oContentHandlerClazz the <i>Class</i> of the content handler
670
+ */
671
+ public function setContentHandler( $oContentHandlerClazz );
672
+
673
+
674
+ /**
675
+ * Returns the mailing info object which contains the number sent mails.
676
+ *
677
+ * @return the mailing info object
678
+ * @throws Inx_Api_DataException
679
+ */
680
+ public function getSendingInfo();
681
+
682
+ /**
683
+ * Returns the create date of the mailing
684
+ *
685
+ * @return the creation date
686
+ * @since 1.7.1
687
+ */
688
+ public function getCreationDatetime();
689
+ }
lib/Inx/Api/Mailing/MailingConstants.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+ /**
7
+ * MailingConstants
8
+ *
9
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
10
+ * @package Inxmail
11
+ * @subpackage Mailing
12
+ */
13
+ interface Inx_Api_Mailing_MailingConstants
14
+ {
15
+
16
+ const MAIL_CONTENT_TYPE_PLAIN_TEXT = 100;
17
+
18
+ const MAIL_CONTENT_TYPE_HTML_TEXT = 101;
19
+
20
+ const MAIL_CONTENT_TYPE_MULTI_PART = 102;
21
+
22
+ const MAIL_CONTENT_TYPE_XML_XSLT_MULTI_PART = 103;
23
+
24
+ const MAIL_CONTENT_TYPE_XML_XSLT_PLAIN_TEXT = 104;
25
+
26
+ const MAIL_CONTENT_TYPE_XML_XSLT_HTML_TEXT = 105;
27
+
28
+
29
+ /**
30
+ * the array index of list type of mailing bo
31
+ */
32
+ const INTERNAL_MAILING_LIST_ID = 0;
33
+
34
+ const INTERNAL_MAILING_CONTENT_MAIL_TYPE = 1;
35
+
36
+ const INTERNAL_MAILING_FEATURE_ID = 2;
37
+
38
+
39
+ const MAILING_EXCEPTION_TYPE_STATE = 1000;
40
+
41
+ const MAILING_EXCEPTION_TYPE_RECIPIENT_NOT_FOUND = 1001;
42
+
43
+ const MAILING_EXCEPTION_TYPE_MAILBUILD = 1002;
44
+
45
+ const MAILING_EXCEPTION_TYPE_MAILING_FEATURE_DISABLED = 1003;
46
+
47
+
48
+ const PARSE_SUCCESSFUL = 1;
49
+
50
+ const PARSE_EXCEPTION = 2;
51
+
52
+ const MAILING_NOT_FOUND = 3;
53
+
54
+
55
+ const BUILD_SUCCESSFUL = 1;
56
+
57
+ const BUILD_EXCEPTION = 2;
58
+
59
+
60
+ const MAIL_TYPE_SYSTEM = -1;
61
+
62
+ const MAILING_MAX_CHANGEDATTR_SIZE = 20;
63
+
64
+ }
lib/Inx/Api/Mailing/MailingManager.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_Mailing_MailingManager</i> manages all mailings.
9
+ * The <i>MailingManager</i> can be used to perform the following tasks:
10
+ * <ul>
11
+ * <li>Retrieve mailings
12
+ * <li>Create mailings
13
+ * <li>Clone mailings
14
+ * <li>Create a renderer to generate a preview of the mailing
15
+ * </ul>
16
+ * <p>
17
+ * <strong>Mailing retrieval</strong>
18
+ * <p>
19
+ * There are several ways to retrieve mailings.
20
+ * The simplest way is to call <i>selectAll()</i> which will retrieve all mailings.
21
+ * To retrieve a single mailing, use the <i>get($iMailingId)</i> method.
22
+ * To retrieve all mailings of a specific list use one of the <i>select(...)</i> methods.
23
+ * Using this type of method gives you the ability to define search filters, like the mailing state.
24
+ * It is also possible to order the result.
25
+ * <p>
26
+ * The following snippet shows how to retrieve all mailings of a specific list, which are either in the
27
+ * <code>DRAFT</code> or the <code>TO_BE_APPROVE</code> state and print out their names:
28
+ *
29
+ * <pre>
30
+ * $oMailingManager = $oSession->getMailingManager();
31
+ * $oBOResultSet = $oMailingManager->select($oListContext, Inx_Api_Mailing_Mailing::STATE_DRAFT
32
+ * | Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE);
33
+ *
34
+ * for( $i = 0; $i < $oBOResultSet->size(); $i++ )
35
+ * {
36
+ * $oMailing = $oBOResultSet->get($i);
37
+ * echo $oMailing->getName()."&#60;br&#62;";
38
+ * }
39
+ *
40
+ * $oBOResultSet->close();
41
+ * </pre>
42
+ *
43
+ * To retrieve all mailings of a specific list, disregarding their state, use the state filter <i>STATE_FILTER_ALL</i>.
44
+ * This filter produces the same result as a bitwise combination of all mailing states.
45
+ * <p>
46
+ * If needed, it is possible to create much more complex select statements than the one above. This can be accomplished
47
+ * using filter expressions. The following snippet extends the previous select statement with a filter that restricts
48
+ * the result to mailings which were modified during the last hour. The result is also ordered by the mailing name:
49
+ *
50
+ * <pre>
51
+ * $oMailingManager = $oSession->getMailingManager();
52
+ *
53
+ * $filterDate = date("d.m.Y H:i:s", strtotime("-1 hour"));
54
+ * $filter = "Attribute(".Inx_Api_Mailing_Mailing::ATTRIBUTE_MODIFICATION_DATETIME.") > #".$filterDate."#";
55
+ *
56
+ * $oBOResultSet = $oMailingManager->select($oListContext, Inx_Api_Mailing_Mailing::STATE_DRAFT
57
+ * | Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE, $filter, Inx_Api_Mailing_Mailing::ATTRIBUTE_NAME,
58
+ * Inx_Api_Order::ASC);
59
+ *
60
+ * for($i = 0; $i < $oBOResultSet->size(); $i++)
61
+ * {
62
+ * $oMailing = $oBOResultSet->get($i);
63
+ * echo $oMailing->getName()."&#60;br&#62;";
64
+ * }
65
+ *
66
+ * $oBOResultSet->close();
67
+ * </pre>
68
+ * <p>
69
+ * <strong>Mailing creation and editing</strong>
70
+ * <p>
71
+ * The following snippet shows how to create a mailing:
72
+ *
73
+ * <pre>
74
+ * $oMailingManager = $oSession->getMailingManager();
75
+ * $oMailing = $oMailingManager->createMailing($oListContext);
76
+ * $oMailing->updateSubject("Monthly Newsletter");
77
+ * $oMailing->commitUpdate();
78
+ * </pre>
79
+ * <p>
80
+ * <strong>Note:</strong> For existing mailings, always call <i>lock()</i> before updating it, and
81
+ * <i>unlock()</i> after committing changes!
82
+ * <p>
83
+ * The following snippet shows how to edit an existing mailing:
84
+ *
85
+ * <pre>
86
+ * $oMailingManager = $oSession->getMailingManager();
87
+ * $oMailing = $oMailingManager->get($iMailingId);
88
+ *
89
+ * try
90
+ * {
91
+ * $oMailing->lock();
92
+ * $oMailing->updateSubject("New Subject");
93
+ * $oMailing->commitUpdate();
94
+ * $oMailing->unlock();
95
+ * }
96
+ * catch(Inx_Api_LockException $x)
97
+ * {
98
+ * //somone else has locked this mailing
99
+ * }
100
+ * </pre>
101
+ * <p>
102
+ * It is not necessary to repeatedly create almost identical mailings. This can be accomplished a lot easier using the
103
+ * <i>clone()</i> method.
104
+ * <p>
105
+ * The following snippet shows how to clone a mailing and put the clone in the specified list:
106
+ *
107
+ * <pre>
108
+ * $oMailingManager = $oSession->getMailingManager();
109
+ * $oMailingManager->cloneMailing($iMailingId, $oListContext);
110
+ * </pre>
111
+ * <p>
112
+ * <strong>Preview generation</strong>
113
+ * <p>
114
+ * To create a preview of a mailing, an <i>Inx_Api_Mail_MailingRenderer</i> is needed.
115
+ * A renderer can be obtained using the <i>createRenderer()</i> method.
116
+ * <p>
117
+ * The following snippet shows how to create a <code>MailingRenderer</code> and generate a preview of the mailing:
118
+ *
119
+ * <pre>
120
+ * $oMailingManager = $oSession->getMailingManager();
121
+ * $oMailingRenderer = $oMailingManager->createRenderer();
122
+ * $oMailingRenderer->parse($iMailingId, Inx_Api_Mail_MailingRenderer::BUILD_MODE_PREVIEW);
123
+ * $oMailContent = $oMailingRenderer->build($iRecipientId);
124
+ *
125
+ * echo $oMailContent->getPlainText()."&#60;br&#62;";
126
+ * </pre>
127
+ * <p>
128
+ * For more information on mailings, see the <i>Inx_Api_Mailing_Mailing</i> documentation.
129
+ * <p>
130
+ * Note: To use mailings, the following api user right is required: <i>Inx_Api_UserRights::MAILING_FEATURE_USE</i>
131
+ *
132
+ * @see Inx_Api_Mailing_Mailing
133
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
134
+ * @package Inxmail
135
+ * @subpackage Mailing
136
+ */
137
+ interface Inx_Api_Mailing_MailingManager extends Inx_Api_BOManager
138
+ {
139
+
140
+ /** @deprecated replaced by Inx_Api_Order::ASC */
141
+ const ORDER_ASC = 0;
142
+
143
+ /** @deprecated replaced by Inx_Api_Order::DESC */
144
+ const ORDER_DESC = 1;
145
+
146
+
147
+ /**
148
+ * State filter constants to returning all mailings.
149
+ * It's the same like:
150
+ * <pre>
151
+ * $iStateFilter = Inx_Api_Mailing_Mailing::STATE_DRAFT | Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE | Inx_Api_Mailing_Mailing::STATE_APPROVED
152
+ * | Inx_Api_Mailing_Mailing::STATE_SCHEDULED | Inx_Api_Mailing_Mailing::STATE_SENDING| Inx_Api_Mailing_Mailing::STATE_INTERRUPTED
153
+ * | Inx_Api_Mailing_Mailing::STATE_SENT | Inx_Api_Mailing_Mailing::STATE_SENDING_FAILED;
154
+ * </pre>
155
+ */
156
+ const STATE_FILTER_ALL = 0xFFFF;
157
+
158
+ /**
159
+ * Selects mailings in specified order, filtered by the supplied condition.<br>
160
+ * The <i>Inx_Api_BOResultSet</i> contains a set of <i>Inx_Api_Mailing_Mailing</i> objects.
161
+ *
162
+ * The stateFilter must be either a single value like:
163
+ * <ul>
164
+ * <li>Inx_Api_Mailing_Mailing::STATE_DRAFT
165
+ * <li>Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE
166
+ * <li>Inx_Api_Mailing_Mailing::STATE_APPROVED
167
+ * <li>Inx_Api_Mailing_Mailing::STATE_SCHEDULED
168
+ * <li>Inx_Api_Mailing_Mailing::STATE_SENDING
169
+ * <li>Inx_Api_Mailing_Mailing::STATE_INTERRUPTED
170
+ * <li>Inx_Api_Mailing_Mailing::STATE_SENT
171
+ * <li>Inx_Api_Mailing_Mailing::STATE_SENDING_FAILED
172
+ * </ul>
173
+ * or a bitwise combination, e.g. Inx_Api_Mailing_Mailing::STATE_SCHEDULED|Inx_Api_Mailing_Mailing::STATE_SENDING
174
+ * or Inx_Api_Mailing_Mailing::STATE_DRAFT|Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE|Inx_Api_Mailing_Mailing::STATE_APPROVED
175
+ *
176
+ *
177
+ * The filter is a boolean expression on one mailing attribute. Attributes are specified with the function <i>Attribute(id)</i>.
178
+ * Please note that date-values for the filter have to be specified in german 24-hour date-format. To accomplish this, the date()
179
+ * function with the following date-pattern can be used:
180
+ *
181
+ * <pre>
182
+ * $filterDate = date("d.m.Y H:i:s");
183
+ * </pre>
184
+ *
185
+ * The orderAttribute is the id of the order attribute.
186
+ *
187
+ * Allowed values for attribute ids are:
188
+ * <ul>
189
+ * <li>Inx_Api_Mailing_Mailing::ATTRIBUTE_SUBJECT
190
+ * <li>Inx_Api_Mailing_Mailing::ATTRIBUTE_MODIFICATION_DATETIME
191
+ * <li>Inx_Api_Mailing_Mailing::ATTRIBUTE_SENT_START_DATETIME
192
+ * <li>Inx_Api_Mailing_Mailing::ATTRIBUTE_SENT_END_DATETIME
193
+ * </ul>
194
+ *
195
+ * @param Inx_Api_List_ListContext $oListContext list from which to select
196
+ * @param int $iStateFilter s.above.
197
+ * @param string $sFilter filter expression
198
+ * @param int $iOrderAttribute order attribute id
199
+ * @param int $iOrderType one of Order.ASC and Order.DESC fort order direction
200
+ * @return Inx_Api_BOResultSet the result set of <i>Inx_Api_Mailing_Mailing</i> objects
201
+ * @throws Inx_Api_FilterStmtException
202
+ */
203
+ public function select( Inx_Api_List_ListContext $oListContext = null, $iStateFilter, $sFilter = null,
204
+ $iOrderAttribute = null, $iOrderType = null );
205
+
206
+ /**
207
+ * Creates a new mailing in the specified list.
208
+ *
209
+ * @param $oListContext list owner of the mailing
210
+ * @return Inx_Api_Mailing_Mailing a new mailing
211
+ */
212
+ public function createMailing( Inx_Api_List_ListContext $oListContext );
213
+
214
+
215
+ /**
216
+ * Creates the new <i>Inx_Api_Mail_MailingRenderer</i> to rendering a <i>Inx_Api_Mailing_Mailing</i>.
217
+ *
218
+ * @return Inx_Api_Mail_MailingRenderer the new <i>Inx_Api_Mail_MailingRenderer</i>
219
+ */
220
+ public function createRenderer();
221
+
222
+ /**
223
+ * Creates the new <code>Inx_Api_Mail_MailingRenderer</code> to rendering a <code>Mailing</code> with test recipients.
224
+ *
225
+ * @return the new <code>Inx_Api_Mail_MailingRenderer</code>
226
+ * @since API 1.6.0
227
+ */
228
+ public function createRendererForTestRecipient();
229
+
230
+ /**
231
+ * Copies a <code>Inx_Api_Mail_Mailing</code> to the specified list.
232
+ *
233
+ * @return the new <code>Inx_Api_Mail_Mailing</code>
234
+ * @since API 1.6.0
235
+ */
236
+ public function cloneMailing($iMailingId, Inx_Api_List_ListContext $oListContext );
237
+
238
+ }
lib/Inx/Api/Mailing/MailingStateException.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_Mailing_MailingStateException</i> is thrown when a mailing action is invoked which is not allowed
9
+ * to be performed in the current state.
10
+ * For example, invoking <i>Inx_Api_Mailing_Mailing::startSending()</i> is not allowed if the mailing is in the
11
+ * state <i>Inx_Api_Mailing_Mailing::STATE_TO_BE_APPROVE</i>, thus raising a <i>MailingStateException</i>.
12
+ *
13
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
14
+ * @package Inxmail
15
+ * @subpackage Mailing
16
+ */
17
+ class Inx_Api_Mailing_MailingStateException extends Exception
18
+ {
19
+ /**
20
+ * <i>true</i> if the mailing is locked, <i>false</i> otherwise.
21
+ *
22
+ * @var boolean
23
+ */
24
+ private $_blLocked;
25
+
26
+ /**
27
+ * Creates a <code>MailingStateException</code> with the given detail message, current state and locking state.
28
+ *
29
+ * @param string $sMsg the detail message.
30
+ * @param int $iCurrentState the current state of the affected mailing.
31
+ * @param bool $blLocked <code>true</code> if the mailing is locked, <code>false</code> otherwise.
32
+ */
33
+ public function __construct( $sMsg = null, $iCurrentState = null, $blLocked = null )
34
+ {
35
+ parent::__construct( $sMsg, $iCurrentState );
36
+
37
+ $this->_blLocked = $blLocked;
38
+ }
39
+
40
+
41
+ /**
42
+ * Returns the current state of the affected mailing.
43
+ * Alias for <i>Inx_Api_Mailing_MailingStateException::getCode()</i>
44
+ *
45
+ * @return int the current state.
46
+ */
47
+ public function getCurrentState()
48
+ {
49
+ return $this->getCode();
50
+ }
51
+
52
+ /**
53
+ * Checks if the mailing is locked.
54
+ *
55
+ * @return bool <i>true</i> if the mailing is locked, <i>false</i> otherwise.
56
+ */
57
+ public function isLocked()
58
+ {
59
+ return $this->blLocked;
60
+ }
61
+ }
lib/Inx/Api/Mailing/MultiPartContentHandler.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Mailing
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Mailing_MultiPartContentHandler</i> is a simple content handler used to store and update mailing content in
9
+ * both, plain and HTML text format. Both content parts can be used separately.
10
+ *
11
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
12
+ * @package Inxmail
13
+ * @subpackage Mailing
14
+ */
15
+ interface Inx_Api_Mailing_MultiPartContentHandler extends Inx_Api_Mailing_ContentHandler
16
+ {
17
+
18
+ /**
19
+ * Returns the plain text content stored by this content handler.
20
+ *
21
+ * @return string the plain text content.
22
+ */
23
+ public function getPlainTextContent();
24
+
25
+ /**
26
+ * Updates the plain text content stored by this content handler.
27
+ *
28
+ * @param string $sPlainTextContent the new plain text content.
29
+ */
30
+ public function updatePlainTextContent( $sPlainTextContent );
31
+
32
+
33
+ /**
34
+ * Returns the HTML text content stored by this content handler.
35
+ *
36
+ * @return string the HTML text content.
37
+ */
38
+ public function getHtmlTextContent();
39
+
40
+ /**
41
+ * Updates the HTML text content stored by this content handler.
42
+ *
43
+ * @param string $sHtmlTextContent the new HTML text content.
44
+ */
45
+ public function updateHtmlTextContent( $sHtmlTextContent );
46
+
47
+ }
lib/Inx/Api/Mailing/PlainTextContentHandler.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Mailing
6
+ */
7
+ /**
8
+ * Inx_Api_Mailing_PlainTextContentHandler
9
+ *
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ * @subpackage Mailing
13
+ */
14
+ interface Inx_Api_Mailing_PlainTextContentHandler extends Inx_Api_Mailing_SinglePartContentHandler
15
+ {
16
+
17
+ }
lib/Inx/Api/Mailing/SendException.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Mailing
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Mailing_SendException</i> is thrown when an error occurs while sending a mailing.
9
+ *
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ * @subpackage Mailing
13
+ */
14
+ class Inx_Api_Mailing_SendException extends Exception
15
+ {
16
+
17
+ }
lib/Inx/Api/Mailing/SendingInfo.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mail
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_Mailng_SendingInfo</i> object contains additional information regarding the sending of a mailing.
9
+ * For example, the average mail size or the number of delivered mails.
10
+ *
11
+ * @since API 1.4.3
12
+ * @version $Revision: 9482 $ $Date: 2007-12-18 16:42:11 +0200 (An, 18 Grd 2007) $ $Author: vladas $
13
+ * @package Inxmail
14
+ * @subpackage Mail
15
+ */
16
+ interface Inx_Api_Mailing_SendingInfo
17
+ {
18
+
19
+ /**
20
+ * Returns the number of mailings which were successfully delivered by Inxmail.
21
+ *
22
+ * @return int the number of mailings which were successfully delivered by Inxmail.
23
+ */
24
+ public function getDeliveredMailsCount();
25
+
26
+
27
+ /**
28
+ * Returns the number of mailings which encountered an error while sending.
29
+ *
30
+ * @return int the number of mailings which encountered an error while sending.
31
+ */
32
+ public function getSentErrorCount();
33
+
34
+ /**
35
+ * Returns the number of mailings for which bounce messages were received.
36
+ *
37
+ * @return int the number of mailings for which bounce messages were received.
38
+ */
39
+ public function getBounceCount();
40
+
41
+ /**
42
+ * Returns the number of mailings which have not been sent by Inxmail, for example because of an existing no-mail tag.
43
+ *
44
+ * @return int the number of mailings which have not been sent by Inxmail.
45
+ */
46
+ public function getNotSentMailsCount();
47
+
48
+
49
+ /**
50
+ * Returns the average mailing size for the sent mailing.
51
+ *
52
+ * @return int the average mailing size for the sent mailing.
53
+ */
54
+ public function getAverageMailSize();
55
+ }
56
+ ?>
lib/Inx/Api/Mailing/SinglePartContentHandler.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Mailing
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Mailing_SinglePartContentHandler</i> interface defines the basic requirements of a content
9
+ * handler that handles only one content type (for example text or HTML).
10
+ *
11
+ * @since API 1.2.0
12
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
13
+ * @package Inxmail
14
+ * @subpackage Mailing
15
+ */
16
+ interface Inx_Api_Mailing_SinglePartContentHandler extends Inx_Api_Mailing_ContentHandler
17
+ {
18
+
19
+ /**
20
+ * Returns the content stored by this content handler.
21
+ *
22
+ * @return string the content.
23
+ */
24
+ public function getContent();
25
+
26
+ /**
27
+ * Updates the content stored by this content handler.
28
+ *
29
+ * @param string $sContent the new content.
30
+ */
31
+ public function updateContent( $sContent );
32
+
33
+ }
lib/Inx/Api/Mailing/XsltContentHandler.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Mailing
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Mailing_XsltContentHandler</i> defines the basic requirements for a content handler that handles XML based
9
+ * content. This type of content handler is used by templates to structure (XML content) and format (Style) a mailing.
10
+ *
11
+ * @since API 1.2.0
12
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
13
+ * @package Inxmail
14
+ * @subpackage Mailing
15
+ */
16
+ interface Inx_Api_Mailing_XsltContentHandler extends Inx_Api_Mailing_ContentHandler
17
+ {
18
+
19
+ /**
20
+ * Returns the raw XML content stored by this content handler.
21
+ *
22
+ * @return string the raw XML content.
23
+ */
24
+ public function getXmlContent();
25
+
26
+ /**
27
+ * Updates the raw XML content stored by this content handler.
28
+ *
29
+ * @param string $sContent the new raw XML content.
30
+ */
31
+ public function updateXmlContent( $sContent );
32
+
33
+
34
+ /**
35
+ * Returns the style, the mailing has been created with.
36
+ * The style is used to format the mailing, very similar to a CSS file.
37
+ *
38
+ * @return Inx_Api_DesignTemplate_Style the style used to format the mailing.
39
+ */
40
+ public function getStyle();
41
+
42
+ /**
43
+ * Updates the style used for the mailing. The style is used to format the mailing, very similar to a CSS file.
44
+ *
45
+ * @param Inx_Api_DesignTemplate_Style style the new style (has to be from the same template as the old one).
46
+ */
47
+ public function updateStyle( Inx_Api_DesignTemplate_Style $oStyle );
48
+ }
lib/Inx/Api/Mailing/XsltHtmlTextContentHandler.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Mailing
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Mailing_XsltHtmlTextContentHandler</i> is a content handler used by templates to structure (XML content) and
9
+ * format (Style) mailings with HTML text content.
10
+ * This content handler can only handle HTML content.
11
+ * If you wish to use both, plain and HTML text content, use the <i>Inx_Api_Mailing_XsltMultiPartContentHandler</i> instead.
12
+ *
13
+ * @since API 1.0.1
14
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
15
+ * @package Inxmail
16
+ * @subpackage Mailing
17
+ */
18
+ interface Inx_Api_Mailing_XsltHtmlTextContentHandler extends Inx_Api_Mailing_XsltContentHandler
19
+ {
20
+
21
+ /**
22
+ * Returns the HTML style XML content stored by this content handler.
23
+ *
24
+ * @return string the HTML style XML content.
25
+ */
26
+ public function getHtmlTextXslt();
27
+
28
+ /**
29
+ * Updates the HTML style XML content stored by this content handler.
30
+ *
31
+ * @param string $sHtmlTextXslt the HTML style XML content.
32
+ */
33
+ public function updateHtmlTextXslt( $sHtmlTextXslt );
34
+
35
+ }
lib/Inx/Api/Mailing/XsltMultiPartContentHandler.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Mailing_XsltMultiPartContentHandler</i> is a content handler used by templates to structure (XML content) and
8
+ * format (Style) mailings with both, plain and HTML text content. Both content parts can be used separately.
9
+ *
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ * @subpackage Mailing
13
+ */
14
+ interface Inx_Api_Mailing_XsltMultiPartContentHandler extends Inx_Api_Mailing_XsltContentHandler
15
+ {
16
+ /**
17
+ * Returns the plain text style XML content stored by this content handler.
18
+ *
19
+ * @return string the plain text style XML content.
20
+ */
21
+ public function getPlainTextXslt();
22
+
23
+
24
+ /**
25
+ * Updates the plain text style XML content stored by this content handler.
26
+ *
27
+ * @param String $sPlainTextXslt the new plain text style XML content.
28
+ */
29
+ public function updatePlainTextXslt( $sPlainTextXslt );
30
+
31
+ /**
32
+ * Returns the HTML style XML content stored by this content handler.
33
+ *
34
+ * @return string the HTML style XML content.
35
+ */
36
+ public function getHtmlTextXslt();
37
+
38
+ /**
39
+ * Updates the HTML style XML content stored by this content handler.
40
+ *
41
+ * @param String $sHtmlTextXslt the new HTML style XML content.
42
+ */
43
+ public function updateHtmlTextXslt( $sHtmlTextXslt );
44
+
45
+ }
lib/Inx/Api/Mailing/XsltPlainTextContentHandler.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Mailing
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Mailing_XsltPlainTextContentHandler</i> is a content handler used by templates to structure (XML content) and
8
+ * format (Style) mailings with plain text content.
9
+ * This content handler can only handle plain text content.
10
+ * If you wish to use both, plain and HTML text content, use the <i>Inx_Api_Mailing_XsltMultiPartContentHandler</i> instead.
11
+ *
12
+ * @since API 1.0.1
13
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
14
+ * @package Inxmail
15
+ * @subpackage Mailing
16
+ */
17
+ interface Inx_Api_Mailing_XsltPlainTextContentHandler extends Inx_Api_Mailing_XsltContentHandler
18
+ {
19
+
20
+ /**
21
+ * Returns the plain text style XML content stored by this content handler.
22
+ *
23
+ * @return string the plain text style XML content.
24
+ */
25
+ public function getPlainTextXslt();
26
+
27
+ /**
28
+ * Updates the plain text style XML content stored by this content handler.
29
+ *
30
+ * @param string $sPlainTextXslt the new plain text style XML content.
31
+ */
32
+ public function updatePlainTextXslt( $sPlainTextXslt );
33
+
34
+ }
lib/Inx/Api/MailingTemplate/MailingTemplate.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage MailingTemplate
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_MailingTemplate_MailingTemplate</i> represents reusable mailing content that can be used as a basis
8
+ * for new mailings.
9
+ * These templates are far less powerful than the templates provided by design collections, but can still save time in
10
+ * the creation of complex mailings with a common structure.
11
+ * <p>
12
+ * For an example on how to retrieve and create <i>MailingTemplate</i>s, see the
13
+ * <i>Inx_Api_MailingTemplate_MailingTemplateManager</i> documentation.
14
+ *
15
+ * @see Inx_Api_MailingTemplate_MailingTemplateManager
16
+ * @since API 1.4.0
17
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $*
18
+ * @package Inxmail
19
+ * @subpackage MailingTemplate
20
+ */
21
+ interface Inx_Api_MailingTemplate_MailingTemplate extends Inx_Api_BusinessObject
22
+ {
23
+ /**
24
+ * MIME type constant for HTML text templates. This template has only a HTML text part.
25
+ */
26
+ const MIME_TYPE_HTML_TEXT = 0;
27
+
28
+ /**
29
+ * MIME type constant for plain text templates. This template has only a plain text part.
30
+ */
31
+ const MIME_TYPE_PLAIN_TEXT = 1;
32
+
33
+ /**
34
+ * MIME type constant for multipart templates. This template has a HTML and a plain text part.
35
+ */
36
+ const MIME_TYPE_MULTIPART = 2;
37
+
38
+ /**
39
+ * Constant for the name attribute. Used for ordering by the <i>Inx_Api_MailingTemplate_MailingTemplateManager</i>.
40
+ *
41
+ * @see Inx_Api_MailingTemplate_MailingTemplateManager::select($oListContext, $iOrderAttribute, $iOrderType)
42
+ */
43
+ const ATTRIBUTE_NAME = 0;
44
+
45
+ /**
46
+ * Constant for the plain text attribute.
47
+ */
48
+ const ATTRIBUTE_PLAIN_TEXT = 1;
49
+
50
+ /**
51
+ * Constant for the HTML text attribute.
52
+ */
53
+ const ATTRIBUTE_HTML_TEXT = 2;
54
+
55
+ /**
56
+ * Constant for the list context id attribute.
57
+ */
58
+ const ATTRIBUTE_LIST_CONTEXT_ID = 3;
59
+
60
+ /**
61
+ * Constant for the MIME type attribute.
62
+ */
63
+ const ATTRIBUTE_MIME_TYPE = 4;
64
+
65
+ /**
66
+ * Returns the name of the mailing template.
67
+ *
68
+ * @return string the name of the mailing template.
69
+ */
70
+ public function getName();
71
+
72
+ /**
73
+ * Updates the name of the mailing template.
74
+ * The mailing template will not be updated on the server until <i>commitUpdate()</i> has been called.
75
+ *
76
+ * @param string $sName the new template name.
77
+ */
78
+ public function updateName( $sName );
79
+
80
+ /**
81
+ * Returns the id of the list which this mailing template belongs to.
82
+ *
83
+ * @return int the id of the list which this mailing template belongs to.
84
+ */
85
+ public function getListContextId();
86
+
87
+ /**
88
+ * Returns the MIME type of this mailing template. May be one of:
89
+ * <ul>
90
+ * <li><i>MIME_TYPE_HTML_TEXT</i>: Only HTML text
91
+ * <li><i>MIME_TYPE_PLAIN_TEXT</i>: Only plain text
92
+ * <li><i>MIME_TYPE_MULTIPART</i>: Both, HTML and plain text
93
+ * </ul>
94
+ *
95
+ * @return int the MIME type of this mailing template.
96
+ */
97
+ public function getMimeType();
98
+
99
+ /**
100
+ * Returns the HTML text part of this mailing template, or <i>null</i> if the MIME type is
101
+ * <i>MIME_TYPE_PLAIN_TEXT</i>.
102
+ *
103
+ * @return string the HTML text part of this mailing template, if any.
104
+ */
105
+ public function getHtmlTextContent();
106
+
107
+ /**
108
+ * Updates the HTML text part of this mailing template. The mailing template will not be updated on the server until
109
+ * <i>commitUpdate()</i> has been called.
110
+ *
111
+ * @param string $sHtmlTextContent the new HTML text part.
112
+ */
113
+ public function updateHtmlTextContent( $sHtmlTextContent );
114
+
115
+ /**
116
+ * Returns the plain text part of this mailing template, or <code>null</code> if the MIME type is
117
+ * <i>MIME_TYPE_HTML_TEXT</i>.
118
+ *
119
+ * @return string the plain text part of this mailing template, if any.
120
+ */
121
+ public function getPlainTextContent();
122
+
123
+ /**
124
+ * Updates the plain text part of the mailing template. The mailing template will not be updated on the server until
125
+ * <i>commitUpdate()</i> has been called.
126
+ *
127
+ * @param string $sPlainTextContent the new plain text part.
128
+ */
129
+ public function updatePlainTextContent( $sPlainTextContent );
130
+ }
lib/Inx/Api/MailingTemplate/MailingTemplateManager.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage MailingTemplate
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_MailingTemplate_MailingTemplateManager</i> can be used to manage mailing templates.
8
+ * This includes the retrieval and creation of <i>Inx_Api_MailingTemplate_MailingTemplate</i>s.
9
+ * <p>
10
+ * To retrieve or create a globally available mailing template, use the system list. The following snippet shows how to
11
+ * retrieve all global mailing templates ordered by name:
12
+ *
13
+ * <pre>
14
+ * $oMailingTemplateManager = $oSession->getMailingTemplateManager();
15
+ * $oSystemListContext = $oSession->getListContextManager()->findByName( Inx_Api_List_SystemListContext::NAME );
16
+ *
17
+ * $oBOResultSet = $oMailingTemplateManager->select( $oSystemListContext,
18
+ * Inx_Api_MailingTemplate_MailingTemplate::ATTRIBUTE_NAME, Inx_Api_Order::ASC );
19
+ *
20
+ * for( $i = 0; $i &lt; $oBOResultSet->size(); $i++ )
21
+ * {
22
+ * $oMailingTemplate = $oBOResultSet->get( $i );
23
+ * echo $oMailingTemplate->getName()."&#60;br&#62;";
24
+ * }
25
+ *
26
+ * $oBOResultSet->close();
27
+ * </pre>
28
+ *
29
+ * To retrieve all mailing templates, disregarding their list membership, use the inherited <i>selectAll()</i> method.
30
+ * <p>
31
+ * Be aware that mailing template names are not nullable and are unique in each list.
32
+ * However, it is possible to have two mailing templates with the same name in different lists.
33
+ * The following snippet shows how to create an <i>Inx_Api_MailingTemplate_MailingTemplate</i> and update its name:
34
+ *
35
+ * <pre>
36
+ * $oMailingTemplateManager = $oSession->getMailingTemplateManager();
37
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Name of the desired List&quot; );
38
+ * $oMailingTemplate = $oMailingTemplateManager->createTemplate( $oListContext,
39
+ * Inx_Api_MailingTemplate_MailingTemplate::MIME_TYPE_HTML_TEXT );
40
+ *
41
+ * $oMailingTemplate->updateName( &quot;Desired name&quot; );
42
+ * $oMailingTemplate->commitUpdate();
43
+ * </pre>
44
+ * <p>
45
+ * The usage of mailing templates requires the api user right: <i>Inx_Api_UserRights::TEMPLATE_FEATURE_USE</i>
46
+ * <p>
47
+ * For more information on mailing templates, see the <i>Inx_Api_MailingTemplate_MailingTemplate</i> documentation.
48
+ *
49
+ * @see Inx_Api_MailingTemplate_MailingTemplate
50
+ * @since API 1.4.0
51
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
52
+ * @package Inxmail
53
+ * @subpackage MailingTemplate
54
+ */
55
+ interface Inx_Api_MailingTemplate_MailingTemplateManager extends Inx_Api_BOManager
56
+ {
57
+
58
+ /**
59
+ * Creates a mailing template in the specified list with the specified MIME type.
60
+ *
61
+ * @param Inx_Api_List_ListContext $oListContext the list this template belongs to.
62
+ * @param int $iMimeType the MIME type of this template. May be one of:
63
+ * <ul>
64
+ * <li><i>Inx_Api_MailingTemplate_MailingTemplate::MIME_TYPE_HTML_TEXT</i>,
65
+ * <li><i>Inx_Api_MailingTemplate_MailingTemplate::MIME_TYPE_PLAIN_TEXT</i> or
66
+ * <li><i>Inx_Api_MailingTemplate_MailingTemplate::MIME_TYPE_MULTIPART</i>
67
+ * </ul>
68
+ * @return Inx_Api_MailingTemplate_MailingTempalte a new mailing template.
69
+ */
70
+ public function createTemplate( Inx_Api_List_ListContext $oListContext, $iMimeType );
71
+
72
+ /**
73
+ * Returns an <i>Inx_Api_BOResultSet</i> containing all mailing templates assigned to the given list, ordered by the
74
+ * given attribute and order type.
75
+ * To retrieve the globally available mailing templates, use the system list.
76
+ * <p>
77
+ * The following snippet shows how to retrieve the system list context:
78
+ *
79
+ * <pre>
80
+ * $oSystemListContext = $oSession->getListContextManager()->findByName(
81
+ * Inx_Api_List_SystemListContext::NAME );
82
+ * </pre>
83
+ *
84
+ * @param Inx_Api_List_ListContext $oListContext all mailing templates assigned to this list will be fetched.
85
+ * This parameter may <strong>not</strong> be <i>null</i>.
86
+ * If you wish to retrieve all mailing templates, use <i>selectAll()</i> instead.
87
+ * @param int $iOrderAttribute the id of the attribute used to order the result (only
88
+ * <i>Inx_Api_MailingTemplate_MailingTemplate::ATTRIBUTE_NAME</i>).
89
+ * Be aware that any other attribute as well as ommitting this parameter will default to the name attribute.
90
+ * @param int $iOrderType the order type (<i>Inx_Api_Order::ASC</i> or <i>Inx_Api_Order::DESC</i>).
91
+ * May be ommitted if $iOrderAttribute is ommitted as well.
92
+ * @return Inx_Api_BOResultSet an <i>Inx_Api_BOResultSet</i> containing all mailing templates assigned to the given list.
93
+ */
94
+ public function select( Inx_Api_List_ListContext $oListContext, $iOrderAttribute = -1, $iOrderType = -1 );
95
+
96
+ }
lib/Inx/Api/NameException.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * An <i>Inx_Api_NameException</i> is thrown when a specified name (e.g. attribute name) is invalid or already used.
7
+ *
8
+ * @see Inx_Api_Recipient_AttributeManager#create(string, int, int)
9
+ * @since API 1.0
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ */
13
+ class Inx_Api_NameException extends Exception
14
+ {
15
+ /** Type indicating that the specified name is already used. */
16
+ const DUPLICATE_NAME = 100;
17
+
18
+ /** Type indicating that the specified name is invalid. */
19
+ const ILLEGAL_NAME = 101;
20
+ }
lib/Inx/Api/NullPointerException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+
6
+ /**
7
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
8
+ * @package Inxmail
9
+ */
10
+ class Inx_Api_NullPointerException extends Exception
11
+ {
12
+ }
lib/Inx/Api/Order.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * Defines the order types, used by selections in result sets.
7
+ *
8
+ * @since API 1.0.1
9
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
10
+ * @package Inxmail
11
+ */
12
+ interface Inx_Api_Order
13
+ {
14
+ /** Ascending order type. */
15
+ const ASC = 0;
16
+
17
+ /** Descending order type. */
18
+ const DESC = 1;
19
+ }
lib/Inx/Api/Plugin/PluginStore.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Plugin
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Plugin_PluginStore</i> is used by plug-ins for storing small amounts of data on the Inxmail
9
+ * Professional system.
10
+ * Each plug-in may only use its isolated storage, identified by the plug-in secret.
11
+ * The data is allocated using unique keys.
12
+ * <p>
13
+ * <strong>Note:</strong> It is <strong>strongly recommended</strong> to upload a maximum of 1 MB of data.
14
+ * Uploading too much data may significantly reduce the performance of the server.
15
+ * <p>
16
+ * The following snippet shows how to upload an image to the plug-in store of a plug-in with the secret id
17
+ * "plug-in secret":
18
+ *
19
+ * <pre>
20
+ * $oPluginStore = $oSession->getPluginStore();
21
+ * $handle = fopen("test.png","r");
22
+ * $oPluginStore->put("plug-in secret","test-image",$handle);
23
+ * </pre>
24
+ * <p>
25
+ * The following snippet shows how to download the previously uploaded image for saving and displaying:
26
+ *
27
+ * <pre>
28
+ * $oPluginStore = $oSession->getPluginStore();
29
+ * $oInputStream = $oPluginStore->get("plug-in secret", "test-image");
30
+ *
31
+ * $validate = fopen("validate.png",'w') or die("can't open file");
32
+ *
33
+ * while(($chunk = $oInputStream->read()) != -1)
34
+ * {
35
+ * fwrite($validate,$chunk);
36
+ * }
37
+ *
38
+ * fclose($validate);
39
+ *
40
+ * echo '&#60;img src="validate.png"&#62;';
41
+ * </pre>
42
+ *
43
+ * @since API 1.7.0
44
+ * @version $Revision: 2934 $ $Date: 2005-07-04 17:00:09 +0200 (Mo, 04 Jul 2005) $ $Author: bgn $
45
+ * @package Inxmail
46
+ * @subpackage Plugin
47
+ */
48
+ interface Inx_Api_Plugin_PluginStore
49
+ {
50
+
51
+ /**
52
+ * Uploads data from a plug-in which needs to be stored in Inxmail Professional.
53
+ * The data should be no bigger than 1 MB.
54
+ * Uploading more data is <strong>strongly discouraged</strong> as it may significantly reduce the performance of the server.
55
+ *
56
+ * @param string $secretId the secret id of the plug-in.
57
+ * @param string $key the key for the uploaded data.
58
+ * @param Inx_Api_InputStream $is the input stream to read the data from.
59
+ * @return bool <i>true</i> if the upload was successful, <i>false</i> otherwise.
60
+ */
61
+ public function put( $secretId, $key, $is );
62
+
63
+
64
+ /**
65
+ * Returns an <i>Inx_Api_InputStream</i> to download the data for the given key.
66
+ *
67
+ * @param string $secretId the secret id of the plug-in.
68
+ * @param string $key the key of the data to download.
69
+ * @return Inx_Api_InputStream an <i>Inx_Api_InputStream</i> to download the data.
70
+ * @throws Inx_Api_DataException if the there is no data for that key (i.e. the key does not exist).
71
+ */
72
+ public function get( $secretId, $key );
73
+
74
+
75
+ /**
76
+ * Returns all keys which are stored for the given plug-in secret id.
77
+ *
78
+ * @param string $secretId the secret id of the plug-in.
79
+ * @return array an array of string keys.
80
+ */
81
+ public function getKeys( $secretId );
82
+
83
+
84
+ /**
85
+ * Removes the given key and its value from the plug-in store. Removing an unknown key will have no effect.
86
+ *
87
+ * @param string $secretId the secret id of the plug-in.
88
+ * @param string $key the key of the data which should be deleted.
89
+ */
90
+ public function remove( $secretId, $key );
91
+
92
+
93
+ /**
94
+ * Removes all keys from the plug-in store for the given plug-in secret id.
95
+ *
96
+ * @param string $secretId the secret id of the plug-in.
97
+ */
98
+ public function removeAll( $secretId );
99
+ }
lib/Inx/Api/PluginStatusService.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+
6
+
7
+ abstract class Inx_Api_PluginStatusService
8
+ {
9
+ protected $oService;
10
+
11
+ protected static $_aProperties = array();
12
+ protected $_sApplicationUrl = null;
13
+
14
+ public static function create( $applicationUrl )
15
+ {
16
+ try
17
+ {
18
+ return new Inx_Apiimpl_AxisPluginStatusService($applicationUrl);
19
+ }
20
+ catch( Exception $x )
21
+ {
22
+ throw new Inx_Api_APIException( "Unknown error in PluginStatusService", $x );
23
+ }
24
+ }
25
+
26
+
27
+ public function isPluginInstalled( $sPluginSecretId )
28
+ {
29
+ try
30
+ {
31
+ return $this->oService->isPluginInstalled( $sPluginSecretId );
32
+ }
33
+ catch( Inx_Api_RemoteException $x )
34
+ {
35
+ $this->rebuildException( $x );
36
+ return null;
37
+ }
38
+ }
39
+
40
+
41
+ public function isPluginActive( $pluginSecretId, $listContextId )
42
+ {
43
+ try
44
+ {
45
+ return $this->oService->isPluginActive( $pluginSecretId, $listContextId );
46
+ }
47
+ catch( Inx_Api_RemoteException $x )
48
+ {
49
+ $this->rebuildException( $x );
50
+ return null;
51
+ }
52
+ }
53
+
54
+
55
+ public function getListContextIdsWherePluginActive( $pluginSecretId )
56
+ {
57
+
58
+ try
59
+ {
60
+ return $this->oService->getListContextIdsWherePluginActive( $pluginSecretId );
61
+ }
62
+ catch( Inx_Api_RemoteException $x )
63
+ {
64
+ $this->rebuildException( $x );
65
+ return null;
66
+ }
67
+ }
68
+
69
+
70
+ protected abstract function rebuildException( Inx_Api_RemoteException $e );
71
+
72
+
73
+
74
+ /**
75
+ * Sets property value
76
+ *
77
+ * @param string $sKey Property name. Possible values are: <i>http.proxyHost</i>, <i>http.proxyPort</i>, <i>http.proxyUser</i>, <i>http.proxyPassword</i>, <i>soap.connectionTimeout</i>
78
+ * @param string|int $sValue
79
+ */
80
+ public static function setProperty($sKey, $mxValue)
81
+ {
82
+ if (empty($sKey)) {
83
+ throw new Inx_Api_IllegalArgumentException("Key can't be empty.");
84
+ }
85
+
86
+ if (! (is_string($mxValue) || is_int($mxValue))) {
87
+ throw new Inx_Api_IllegalArgumentException("Value must be string or int.");
88
+ }
89
+
90
+ self::$_aProperties[$sKey] = $mxValue;
91
+ }
92
+
93
+ /**
94
+ * Returns property value
95
+ *
96
+ * @param string $sKey
97
+ * @return string|int
98
+ */
99
+ public static function getProperty($sKey)
100
+ {
101
+ if (empty($sKey)) {
102
+ throw new Inx_Api_IllegalArgumentException("Key can't be empty.");
103
+ }
104
+ if (isset(self::$_aProperties[$sKey])) {
105
+ return self::$_aProperties[$sKey];
106
+ }
107
+
108
+ return null;
109
+ }
110
+ }
lib/Inx/Api/Property/ApprovalPropertyValue.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Property
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Property_ApprovalPropertyValue</i> is a wrapper class for the approval property values.
8
+ * This value determines if and how mailings shall be approved and by whom.
9
+ * An <i>Inx_Api_Property_ApprovalPropertyValue</i> therefore consists of three parts which define the approval strategy:
10
+ * <ul>
11
+ * <li><i>The approval type</i>: Defines if and how mailings shall be approved.
12
+ * <li><i>The primary approver</i>: Approver that will be involved in all approval types immediately.
13
+ * <li><i>The secondary approver</i>: Approver that will only get involved in certain conditions.
14
+ * </ul>
15
+ * If and how the approvers will get involved is determined from the approval type.
16
+ * The possible values for the approval type are:
17
+ * <p>
18
+ * <ul>
19
+ * <li><i>APPROVAL_TYPE_OFF</i>: Approval is completely turned off.
20
+ * No approver will get involved, the editor is the only one responsible for the correctness of the mailing content.
21
+ * <li><i>APPROVAL_TYPE_SYSTEM</i>: The approval type is inherited from the system list.
22
+ * <li><i>APPROVAL_TYPE_IDENTICAL</i>: Both approvers will get involved immediately.
23
+ * Only one of them has to approve the mailing.
24
+ * <li><i>APPROVAL_TYPE_ESCALATION</i>: At first, only the primary approver will be involved.
25
+ * If the escalation date expires without the primary approver having approved the mailing, the secondary
26
+ * approver will get involved.
27
+ * </ul>
28
+ * <p>
29
+ * To convert an <i>Inx_Api_Property_ApprovalPropertyValue</i> into the internal representation needed for the
30
+ * approval property, use the
31
+ * <i>Inx_Api_Property_PropertyFormatter::createApprovalPropertyValue($oApprovalPropertyValue)</i> method.
32
+ * To convert the internal representation into an <i>Inx_Api_Property_ApprovalPropertyValue</i> object, use the
33
+ * <i>Inx_Api_Property_PropertyFormatter::parseApprovalPropertyValue($oProperty)</i> method.
34
+ *
35
+ * @see com.inxmail.xpro.api.property.PropertyFormatter
36
+ * @see com.inxmail.xpro.api.property.PropertyNames#APPROVAL_ACTIVE
37
+ *
38
+ * @since API 1.6.0
39
+ * @version $Revision: 10520 $ $Date: 2008-09-12 14:40:48 +0200 (Fr, 12 Sep 2008) $ $Author: sbn $
40
+ * @package Inxmail
41
+ * @subpackage Property
42
+ */
43
+ class Inx_Api_Property_ApprovalPropertyValue
44
+ {
45
+ private $approvalType;
46
+
47
+ private $primaryApproverId;
48
+
49
+ private $secondaryApproverId;
50
+
51
+ /**
52
+ * Approval type used for deactivating the approval process.
53
+ * No approver will get involved, the editor is the only one responsible for the correctness of the mailing content.
54
+ */
55
+ const APPROVAL_TYPE_OFF = 0;
56
+
57
+ /**
58
+ * Approval type used to inherit the type from the system approval property.
59
+ * If this type is used in the system list, the system approval property will be set to <i>APPROVAL_TYPE_OFF</i>.
60
+ */
61
+ const APPROVAL_TYPE_SYSTEM = 1;
62
+
63
+ /**
64
+ * Approval type used for the escalating approval process.
65
+ * At first, only the primary approver will be involved.
66
+ * If the escalation date expires without the primary approver having approved the mailing, the secondary approver
67
+ * will get involved.
68
+ */
69
+ const APPROVAL_TYPE_ESCALATION = 2;
70
+
71
+ /**
72
+ * Approval type used for the identical approval process.
73
+ * Both approvers will get involved immediately.
74
+ * Only one of them has to approve the mailing.
75
+ */
76
+ const APPROVAL_TYPE_IDENTICAL = 3;
77
+
78
+
79
+ /**
80
+ * Creates an <i>Inx_Api_Property_ApprovalPropertyValue</i> instance with the given approval type, primary
81
+ * approver and secondary approver.
82
+ * If the approval type is <i>APPROVAL_TYPE_OFF</i> or <i>APPROVAL_TYPE_SYSTEM</i>, no approvers need to be defined.
83
+ * In that case use -1 as the id of both approvers.
84
+ *
85
+ * @param int $approvalType the approval type. May be one of:
86
+ * <ul>
87
+ * <li><i>APPROVAL_TYPE_OFF</i>
88
+ * <li><i>APPROVAL_TYPE_SYSTEM</i>
89
+ * <li><i>APPROVAL_TYPE_IDENTICAL</i>
90
+ * <li><i>APPROVAL_TYPE_ESCALATION</i>
91
+ * </ul>
92
+ * @param int $primaryApproverId the id of the primary approver, or -1 if none is needed.
93
+ * @param int $secondaryApproverId the id of the secondary approver, or -1 if none is needed.
94
+ */
95
+ public function __construct( $approvalType, $primaryApproverId, $secondaryApproverId )
96
+ {
97
+ $this->approvalType = $approvalType;
98
+ $this->primaryApproverId = $primaryApproverId;
99
+ $this->secondaryApproverId = $secondaryApproverId;
100
+ }
101
+
102
+
103
+ /**
104
+ * Returns the type of the approval process, also indicates if the process is deactivated.
105
+ *
106
+ * @return int the approval type. May be one of:
107
+ * <ul>
108
+ * <li><i>APPROVAL_TYPE_OFF</i>
109
+ * <li><i>APPROVAL_TYPE_SYSTEM</i>
110
+ * <li><i>APPROVAL_TYPE_IDENTICAL</i>
111
+ * <li><i>APPROVAL_TYPE_ESCALATION</i>
112
+ * </ul>
113
+ */
114
+ public function getApprovalType()
115
+ {
116
+ return $this->approvalType;
117
+ }
118
+
119
+
120
+ /**
121
+ * Returns the id of the primary approver.
122
+ *
123
+ * @return int the id of the primary approver.
124
+ */
125
+ public function getPrimaryApproverId()
126
+ {
127
+ return $this->primaryApproverId;
128
+ }
129
+
130
+
131
+ /**
132
+ * Returns the id of the secondary approver.
133
+ *
134
+ * @return int the id of the secondary approver.
135
+ */
136
+ public function getSecondaryApproverId()
137
+ {
138
+ return $this->secondaryApproverId;
139
+ }
140
+
141
+ }
lib/Inx/Api/Property/FormatChoicePropertyFormatter.php ADDED
@@ -0,0 +1,467 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Property
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Property_FormatChoicePropertyFormatter</i> is used for converting the mail format property
8
+ * to and from the internal string representation.
9
+ * For this property, there is no dedicated value holder like the <i>Inx_Api_Property_ApprovalPropertyValue</i>.
10
+ * Instead, the formatter itself contains all relevant data:
11
+ * <p>
12
+ * <ul>
13
+ * <li><i>The formatting (choice) strategy</i>: Defines how mailings shall be formatted.
14
+ * <li><i>The default format</i>: Defines which format shall be used by default.
15
+ * <li><i>The attribute id</i>: Defines the recipient attribute which shall be used to determine which format to use.
16
+ * <li><i>The patterns</i>: Define which attribute value will trigger the use of a specific format.
17
+ * </ul>
18
+ * The formatting (choice) strategy may be one of the following constants:
19
+ * <p>
20
+ * <ul>
21
+ * <li><i>MAILING_FORMAT_STRATEGY</i>: The editor may freely choose the mail format for each individual mailing.
22
+ * Used by <i>formatMailingChoice()</i>.
23
+ * <li><i>FIXED_STRATEGY</i>: Only one specific mail format may be used.
24
+ * Used by <i>formatFixedChoice($sFormat)</i>.
25
+ * <li><i>ATTRIBUTE_STRATEGY</i>: A recipient attribute is used to determine the mail format.
26
+ * Used by <i>formatAttributeChoice($iAttributeId, $sDefaultFormat, $sPlainTextPattern, $sHtmlTextPattern, $sMultipartPattern)</i>.
27
+ * </ul>
28
+ * The default format is used by the <i>FIXED_STRATEGY</i> and the <i>ATTRIBUTE_STRATEGY</i>.
29
+ * The possible formats are:
30
+ * <p>
31
+ * <ul>
32
+ * <li><i>PLAIN_TEXT_FORMAT</i>: Mailings will contain plain text only.
33
+ * <li><i>HTML_TEXT_FORMAT</i>: Mailings will contain HTML text only.
34
+ * <li><i>MULTIPART_FORMAT</i>: Mailings will contain both, plain and HTML text parts.
35
+ * </ul>
36
+ * <p>
37
+ * <strong>Note:</strong> When using the <i>ATTRIBUTE_STRATEGY</i> it is recommended to create multipart mailings only.
38
+ * However, it is still possible to create plain or HTML text mailings.
39
+ * Be aware that in such a case, all recipients will receive the mailing in the same format (which is plain or HTML text).
40
+ * <p>
41
+ * The attribute strategy requires an attribute id, a default mail format and attribute value patterns that determine
42
+ * which mail format to use.
43
+ * If the value of an attribute matches the pattern, the format associated to this pattern will be chosen.
44
+ * If the value matches none of the specified patterns, the default format will be used.
45
+ * The pattern of the default format is automatically set to <i>null</i>.
46
+ * <p>
47
+ * The patterns are <strong>not</strong> patterns in the ordinary sense.
48
+ * No operators or wildcards are allowed and the value is case sensitive and without quotes.
49
+ * Let's say we use the following patterns:
50
+ * <p>
51
+ * <ul>
52
+ * <li><i>Plain text pattern</i>: plain%
53
+ * <li><i>HTML text pattern</i>: html
54
+ * <li><i>Multipart pattern (default)</i>: multipart
55
+ * </ul>
56
+ * If the attribute value is equal to plain, the recipient will get a multipart mailing as the % wildcard is considered
57
+ * an ordinary character.
58
+ * If it is equal to html, the recipient gets the HTML flavour.
59
+ * However, if the attribute value is equal to HTML, the recipient will also get a multipart mailing, as the patterns
60
+ * are case sensitive.
61
+ * The multipart pattern may also be set to <i>null</i> as multipart is the default format and therefore the pattern
62
+ * is set to <i>null</i> anyway.
63
+ * <p>
64
+ * The following snippet shows how to retrieve and parse the mail format property of the specified list:
65
+ *
66
+ * <pre>
67
+ * $oListContext = $oSession->getListContextManager()->findByName(&quot;Desired list&quot;);
68
+ * $oProperty = $oListContext->findProperty(Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE);
69
+ *
70
+ * $oFormatChoicePropertyFormatter = Inx_Api_Property_FormatChoicePropertyFormatter::parse($oProperty);
71
+ * echo &quot;Format strategy: &quot;.$oFormatChoicePropertyFormatter->getChoiceStategy()."&#60;br&#62;";
72
+ * echo &quot;Default format: &quot;.$oFormatChoicePropertyFormatter->getDefaultFormat()."&#60;br&#62;";
73
+ * echo &quot;Attribute id: &quot;.$oFormatChoicePropertyFormatter->getAttributeId()."&#60;br&#62;";
74
+ * echo &quot;HTML pattern: &quot;.$oFormatChoicePropertyFormatter->getPattern(
75
+ * Inx_Api_Property_FormatChoicePropertyFormatter::HTML_TEXT_FORMAT)."&#60;br&#62;";
76
+ * </pre>
77
+ * <p>
78
+ * To give the editor free choice to use any mail format she or he considers appropriate, use the
79
+ * <i>formatMailingChoice()</i> method.
80
+ * The following snippet shows how this can be achieved:
81
+ *
82
+ * <pre>
83
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
84
+ * $oProperty = $oListContext->findProperty( Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE );
85
+ *
86
+ * $oProperty->updateInternalValue( Inx_Api_Property_FormatChoicePropertyFormatter::formatMailingChoice() );
87
+ * $oProperty->commitUpdate();
88
+ * </pre>
89
+ * <p>
90
+ * The opposite strategy is to restrict all mailings of a list to a certain mail format.
91
+ * The following snippet shows how to restrict the mailing format of the specified list to the multipart format:
92
+ *
93
+ * <pre>
94
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
95
+ * $oProperty = $oListContext->findProperty( Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE );
96
+ *
97
+ * $oProperty->updateInternalValue( Inx_Api_Property_FormatChoicePropertyFormatter::formatFixedChoice(
98
+ * Inx_Api_Property_FormatChoicePropertyFormatter::MULTIPART_FORMAT ) );
99
+ * $oProperty->commitUpdate();
100
+ * </pre>
101
+ * <p>
102
+ * The final strategy is to choose the mailing format based on the value of a recipient attribute.
103
+ * The following snippet shows how to send HTML mailings to recipients with the attribute value html, plain text
104
+ * mailings to recipients with the attribute value plain and multipart mailings to all other recipients:
105
+ *
106
+ * <pre>
107
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
108
+ * $oRecipientMetaData = $oSession->createRecipientContext()->getMetaData();
109
+ * $oProperty = $oListContext->findProperty( Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE );
110
+ *
111
+ * $iAttributeId = $oRecipientMetaData->getUserAttribute( &quot;format&quot; )->getId();
112
+ * $sPlainTextPattern = &quot;plain&quot;;
113
+ * $sHtmlTextPattern = &quot;html&quot;;
114
+ *
115
+ * $sStrategy = Inx_Api_Property_FormatChoicePropertyFormatter::formatAttributeChoice( $iAttributeId,
116
+ * Inx_Api_Property_FormatChoicePropertyFormatter::MULTIPART_FORMAT, $sPlainTextPattern, $sHtmlTextPattern, null );
117
+ * $oProperty->updateInternalValue( $sStrategy );
118
+ * $oProperty->commitUpdate();
119
+ * </pre>
120
+ * <p>
121
+ * For more information on properties in general, see the <i>Inx_Api_Property_Property</i> documentation.
122
+ *
123
+ * @see Inx_Api_Property_Property
124
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
125
+ * @package Inxmail
126
+ * @subpackage Property
127
+ */
128
+ class Inx_Api_Property_FormatChoicePropertyFormatter
129
+ {
130
+ const PREFIX = "EmailFormat[";
131
+
132
+ const SUFFIX = "]";
133
+
134
+
135
+ /**
136
+ * Strategy constant which lets the editor freely choose the appropriate mail format.
137
+ *
138
+ * @var int
139
+ */
140
+ const MAILING_FORMAT_STRATEGY = 0;
141
+
142
+ /**
143
+ * Strategy constant which restricts the mail format to exactly one specified format.
144
+ *
145
+ * @var int
146
+ */
147
+ const FIXED_STRATEGY = 1;
148
+
149
+ /**
150
+ * Strategy constant which is used to determine the mail format based on the value of a recipient attribute.
151
+ *
152
+ * @var int
153
+ */
154
+ const ATTRIBUTE_STRATEGY = 2;
155
+
156
+
157
+ /**
158
+ * Constant for the plain text pattern.
159
+ *
160
+ * @var string
161
+ */
162
+ const PLAIN_TEXT_FORMAT = "text/plain";
163
+
164
+ /**
165
+ * Constant for the HTML text pattern.
166
+ *
167
+ * @var string
168
+ */
169
+ const HTML_TEXT_FORMAT = "text/html";
170
+
171
+ /**
172
+ * Constant for the multipart pattern.
173
+ *
174
+ * @var string
175
+ */
176
+ const MULTIPART_FORMAT = "multipart";
177
+
178
+
179
+ /**
180
+ * The strategy used to choose the mailing format.
181
+ *
182
+ * @var int
183
+ */
184
+ protected $iChoiceStategy;
185
+
186
+ /**
187
+ * The attribute that controls which format to choose.
188
+ *
189
+ * @var int
190
+ */
191
+ protected $iAttributeId;
192
+
193
+ /**
194
+ * The plain text pattern.
195
+ *
196
+ * @var string
197
+ */
198
+ protected $sPlainTextPattern;
199
+
200
+ /**
201
+ * The HTML text pattern.
202
+ *
203
+ * @var string
204
+ */
205
+ protected $sHtmlTextPattern;
206
+
207
+ /**
208
+ * The multipart pattern.
209
+ *
210
+ * @var string
211
+ */
212
+ protected $sMultipartPattern;
213
+
214
+ /**
215
+ * The default mailing format.
216
+ *
217
+ * @var string
218
+ */
219
+ protected $sFormat;
220
+
221
+
222
+ /**
223
+ * Default constructor which may only be used by derived classes.
224
+ */
225
+ protected function __construct()
226
+ {}
227
+
228
+
229
+ /**
230
+ * Parses the given property and extracts the format choice policy into a new
231
+ * <i>Inx_Api_Property_FormatChoicePropertyFormatter</i> for easy retrieval.
232
+ * Only the <i>Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE</i> property is allowed.
233
+ * Using any other property will trigger an <i>Inx_Api_IllegalArgumentException</i>.
234
+ *
235
+ * @param property the property to parse.
236
+ * @return Inx_Api_Property_FormatChoicePropertyFormatter an <i>Inx_Api_Property_FormatChoicePropertyFormatter</i>
237
+ * which can be used for easy retrieval of the property values.
238
+ * @throws Inx_Api_IllegalArgumentException if the given property is not an
239
+ * <i>Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE</i> property.
240
+ */
241
+ public static function parse( Inx_Api_Property_Property $oProperty )
242
+ {
243
+ $sValue = $oProperty->getInternalValue();
244
+ $oFormat = new Inx_Api_Property_FormatChoicePropertyFormatter();
245
+
246
+ if( $sValue === null || strlen($sValue) == 0 )
247
+ {
248
+ $oFormat->iChoiceStategy = self::MAILING_FORMAT_STRATEGY;
249
+ return $oFormat;
250
+ }
251
+
252
+ if( strpos($sValue, self::PREFIX) === 0 && true ===(strrpos($sValue, self::SUFFIX) == strlen($sValue) - strlen(self::SUFFIX)) )
253
+ {
254
+ $s = substr($sValue, strlen(self::PREFIX), -1);
255
+
256
+
257
+ if( strcmp('0', $s) === 0 ) // EmailFormat[0]
258
+ {
259
+ $oFormat->iChoiceStategy = self::MAILING_FORMAT_STRATEGY;
260
+ return $oFormat;
261
+ }
262
+ if( strcmp('1|text/plain', $s ) === 0 ) // EmailFormat[1|text/plain]
263
+ {
264
+ $oFormat->iChoiceStategy = self::FIXED_STRATEGY;
265
+ $oFormat->sFormat = self::PLAIN_TEXT_FORMAT;
266
+ return $oFormat;
267
+ }
268
+ if( strcmp('1|text/html', $s ) === 0) // EmailFormat[1|text/html]
269
+ {
270
+ $oFormat->iChoiceStategy = self::FIXED_STRATEGY;
271
+ $oFormat->sFormat = self::HTML_TEXT_FORMAT;
272
+ return $oFormat;
273
+ }
274
+ if( strcmp('1|multipart', $s ) === 0 ) // EmailFormat[1|multipart]
275
+ {
276
+ $oFormat->iChoiceStategy = self::FIXED_STRATEGY;
277
+ $oFormat->sFormat = self::MULTIPART_FORMAT;
278
+ return $oFormat;
279
+ }
280
+
281
+ // EmailFormat[2|<attrId>|<htmltext-pattern>|<plaintext-pattern>|<multipart-pattern>|<defaultForamt>]
282
+ $aTokens = explode('|', $s);
283
+ if ((count($aTokens) === 6) && strcmp('2', $aTokens[0]) === 0 && ctype_digit($aTokens[1]))
284
+ {
285
+ $oFormat->iChoiceStategy = self::ATTRIBUTE_STRATEGY;
286
+ $oFormat->iAttributeId = (int) $aTokens[1];
287
+ $oFormat->sHtmlTextPattern = $aTokens[2];
288
+ $oFormat->sPlainTextPattern = $aTokens[3];
289
+ $oFormat->sMultipartPattern = $aTokens[4];
290
+ $df = $aTokens[5];
291
+ if(strcmp($df, self::PLAIN_TEXT_FORMAT) === 0) {
292
+ $oFormat->sFormat = self::PLAIN_TEXT_FORMAT;
293
+ return $oFormat;
294
+ }
295
+
296
+ if(strcmp($df, self::HTML_TEXT_FORMAT) === 0) {
297
+ $oFormat->sFormat = self::HTML_TEXT_FORMAT;
298
+ return $oFormat;
299
+ }
300
+
301
+ if(strcmp($df, self::MULTIPART_FORMAT) === 0) {
302
+ $oFormat->sFormat = self::MULTIPART_FORMAT;
303
+ return $oFormat;
304
+ }
305
+ }
306
+ }
307
+ throw new Inx_Api_IllegalArgumentException( "illegal mail choise format: " . value );
308
+ }
309
+
310
+ /**
311
+ * Returns the formatting (choice) strategy. May be one of:
312
+ * <ul>
313
+ * <li><i>MAILING_FORMAT_STRATEGY</i>
314
+ * <li><i>FIXED_STRATEGY</i>
315
+ * <li><i>ATTRIBUTE_STRATEGY</i>
316
+ * </ul>
317
+ *
318
+ * @return int the formatting (choice) strategy.
319
+ */
320
+ public function getChoiceStategy()
321
+ {
322
+ return $this->iChoiceStategy;
323
+ }
324
+
325
+ /**
326
+ * Returns the id of the recipient attribute used to determine the mailing format.
327
+ * If the choice strategy is not <i>ATTRIBUTE_STRATEGY</i>, 0 will be returned.
328
+ *
329
+ * @return int the id of the recipient attribute used to determine the mailing format, or 0 if none is needed.
330
+ */
331
+ public function getAttributeId()
332
+ {
333
+ return $this->iAttributeId;
334
+ }
335
+
336
+ /**
337
+ * Returns the pattern for the given mailing format.
338
+ * Patterns are only used by the choice strategy <i>ATTRIBUTE_STRATEGY</i>.
339
+ *
340
+ * @param string $sFormat the mailing format for which the pattern shall be returned. May be one of:
341
+ * <ul>
342
+ * <li><i>PLAIN_TEXT_FORMAT</i>
343
+ * <li><i>HTML_TEXT_FORMAT</i>
344
+ * <li><i>MULTIPART_FORMAT</i>
345
+ * </ul>
346
+ * @return string the pattern for the given format, if any, <i>null</i> otherwise.
347
+ */
348
+ public function getPattern( $sFormat )
349
+ {
350
+ if( strcmp($sFormat, self::PLAIN_TEXT_FORMAT) === 0 )
351
+ return $this->sPlainTextPattern;
352
+ if( strcmp($sFormat, self::HTML_TEXT_FORMAT) === 0 )
353
+ return $this->sHtmlTextPattern;
354
+ if( strcmp($sFormat, self::MULTIPART_FORMAT) === 0 )
355
+ return $this->sMultipartPattern;
356
+
357
+ throw new Inx_Api_IllegalArgumentException( "unknown format: " . $sFormat );
358
+ }
359
+
360
+ /**
361
+ * Returns the default mailing format.
362
+ * The default format is only used by the choice strategies <i>FIXED_STRATEGY</i> and <i>ATTRIBUTE_STRATEGY</i>.
363
+ *
364
+ * @return string the default mailing format, if any, <i>null</i> otherwise.
365
+ */
366
+ public function getDefaultFormat()
367
+ {
368
+ return $this->sFormat;
369
+ }
370
+
371
+ /**
372
+ * Creates the internal string value for the <i>MAILING_FORMAT_STRATEGY</i>.
373
+ *
374
+ * @return string the internal string value for the <i>MAILING_FORMAT_STRATEGY</i>.
375
+ */
376
+ public static function formatMailingChoice()
377
+ {
378
+ return self::PREFIX . "0" . self::SUFFIX;
379
+ }
380
+
381
+ /**
382
+ * Creates the internal string value for the <i>FIXED_STRATEGY</i> using the given default mailing format.
383
+ * The default format may be one of:
384
+ * <ul>
385
+ * <li><i>PLAIN_TEXT_FORMAT</i>
386
+ * <li><i>HTML_TEXT_FORMAT</i>
387
+ * <li><i>MULTIPART_FORMAT</i>
388
+ * </ul>
389
+ *
390
+ * @param string $sFormat the default mailing format.
391
+ * @return string the internal string value for the <i>FIXED_STRATEGY</i>.
392
+ */
393
+ public static function formatFixedChoice( $sFormat )
394
+ {
395
+ self::checkFormat( $sFormat );
396
+ return self::PREFIX . "1|" . $sFormat . self::SUFFIX;
397
+ }
398
+
399
+ /**
400
+ * Creates the internal string value for the <i>ATTRIBUTE_STRATEGY</i> using the given recipient attribute id,
401
+ * default mailing format and patterns.
402
+ * For a description of the pattern syntax, see the documentation of this class.
403
+ * The default mailing attribute may be one of:
404
+ * <ul>
405
+ * <li><i>PLAIN_TEXT_FORMAT</i>
406
+ * <li><i>HTML_TEXT_FORMAT</i>
407
+ * <li><i>MULTIPART_FORMAT</i>
408
+ * </ul>
409
+ *
410
+ * @param int $iAttributeId the id of the recipient attribute used to determine the mailing format.
411
+ * @param string $sDefaultFormat the default mailing format.
412
+ * @param string $sPlainTextPattern the plain text pattern. May be <i>null</i> if this is the default format.
413
+ * @param string $sHtmlTextPattern the HTML text pattern. May be <i>null</i> if this is the default format.
414
+ * @param string $sMultipartPattern the multipart text pattern. May be <i>null</i> if this is the default format.
415
+ * @return string the internal string value for the <i>ATTRIBUTE_STRATEGY</i>.
416
+ */
417
+ public static function formatAttributeChoice( $iAttributeId, $sDefaultFormat,
418
+ $sPlainTextPattern, $sHtmlTextPattern, $sMultipartPattern )
419
+ {
420
+ if( strcmp($sDefaultFormat, self::PLAIN_TEXT_FORMAT) === 0)
421
+ {
422
+ //fixes XAPI35 (comment): use "null" instead of null
423
+ $sPlainTextPattern = "null";
424
+ if( $sHtmlTextPattern === null || strlen($sHtmlTextPattern) == 0 )
425
+ throw new Inx_Api_IllegalArgumentException( "htmlTextPattern - illegal value: " . $sHtmlTextPattern );
426
+ if( $sMultipartPattern === null || strlen($sMultipartPattern) == 0 )
427
+ throw new Inx_Api_IllegalArgumentException( "multipartPattern - illegal value: " . $sMultipartPattern );
428
+ }
429
+ else if( strcmp($sDefaultFormat, self::HTML_TEXT_FORMAT) === 0)
430
+ {
431
+ //fixes XAPI35 (comment): use "null" instead of null
432
+ $sHtmlTextPattern = "null";
433
+ if( $sPlainTextPattern === null || strlen($sPlainTextPattern) == 0 )
434
+ throw new Inx_Api_IllegalArgumentException( "plainTextPattern - illegal value: " . $sPlainTextPattern );
435
+ if( $sMultipartPattern === null || strlen($sMultipartPattern) == 0 )
436
+ throw new Inx_Api_IllegalArgumentException( "multipartPattern - illegal value: " . $sMultipartPattern );
437
+ }
438
+ else if( strcmp($sDefaultFormat, self::MULTIPART_FORMAT) === 0 )
439
+ {
440
+ //fixes XAPI35 (comment): use "null" instead of null
441
+ $sMultipartPattern = "null";
442
+ //fixes XAPI-35: strlen() instead of length()
443
+ if( $sPlainTextPattern === null || strlen($sPlainTextPattern) == 0 )
444
+ throw new Inx_Api_IllegalArgumentException( "plainTextPattern - illegal value: " . $sPlainTextPattern );
445
+ if( $sHtmlTextPattern === null || strlen($sHtmlTextPattern) == 0 )
446
+ throw new Inx_Api_IllegalArgumentException( "htmlTextPattern - illegal value: " . $sHtmlTextPattern );
447
+ }
448
+ else
449
+ throw new Inx_Api_IllegalArgumentException( "unknown defaultFormat: " . $sDefaultFormat );
450
+
451
+ return self::PREFIX . "2|" . $iAttributeId . "|" . $sHtmlTextPattern . "|" . $sPlainTextPattern
452
+ . "|" . $sMultipartPattern . "|" . $sDefaultFormat . self::SUFFIX;
453
+ }
454
+
455
+
456
+ private static function checkFormat( $sFormat )
457
+ {
458
+ if( strcmp(self::PLAIN_TEXT_FORMAT, $sFormat ) === 0)
459
+ return;
460
+ if( strcmp(self::HTML_TEXT_FORMAT, $sFormat ) === 0)
461
+ return;
462
+ if( strcmp(self::MULTIPART_FORMAT, $sFormat ) === 0)
463
+ return;
464
+
465
+ throw new Inx_Api_IllegalArgumentException( "unknown format: " . $sFormat );
466
+ }
467
+ }
lib/Inx/Api/Property/Property.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Property
5
+ */
6
+ /**
7
+ * Mailing lists have properties, which control the list behaviour.
8
+ * An <i>Inx_Api_Property_Property</i> may control, for example, the default mail encoding, the maximal sending
9
+ * performance, or settings used by features, such as the hard bounce threshold.
10
+ * The properties can be accessed through the <i>Inx_Api_List_ListContext::findProperty($sPropertyName)</i> and
11
+ * <i>Inx_Api_List_ListContext::selectProperties()</i> methods.
12
+ * <p>
13
+ * The following snippet shows how to retrieve a specific property, namely the mail encoding property:
14
+ *
15
+ * <pre>
16
+ * $oListContext = ...
17
+ * $oProperty = $oListContext->findProperty( Inx_Api_Property_PropertyNames::MAIL_ENCODING );
18
+ * echo $oProperty->getInternalValue();
19
+ * </pre>
20
+ *
21
+ * Note: Not all properties are available for all lists.
22
+ * The <i>Inx_Api_Property_PropertyNames</i> interface documentation states, which properties are available for which lists.
23
+ * <p>
24
+ * The following snippet shows how to retrieve all properties of a list:
25
+ *
26
+ * <pre>
27
+ * $oBOResultSet = $oListContext->selectProperties();
28
+ *
29
+ * for( $i = 0; $i &lt; $oBOResultSet->size(); $i++ )
30
+ * {
31
+ * $oProperty = $oBOResultSet->get( $i );
32
+ * echo $oProperty->getName()."&#60;br&#62;";
33
+ * }
34
+ *
35
+ * $oBOResultSet->close();
36
+ * </pre>
37
+ * <p>
38
+ * The following snippet shows how to change the locale of a specific list to English:
39
+ *
40
+ * <pre>
41
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
42
+ *
43
+ * $oProperty = $oListContext->findProperty( Inx_Api_Property_PropertyNames::FORMAT_LOCALE );
44
+ * $oProperty->updateInternalValue( &quot;en&quot; );
45
+ * $oProperty->commitUpdate();
46
+ * </pre>
47
+ * <p>
48
+ * Most of the properties can be set easily as the values are simple numbers or strings (see above).
49
+ * However, there are two special properties which require a bit more effort to be set correctly:
50
+ * <ol>
51
+ * <li><i>Inx_Api_Property_PropertyNames::APPROVAL_ACTIVE</i>: Defines the approval method and the approvers.
52
+ * <li><i>Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE</i>: Defines the default mailing format.
53
+ * </ol>
54
+ * These two properties have a special internal value syntax.
55
+ * To ease the setting of these two properties, there are two formatters used to parse and create the internal values:
56
+ * <ol>
57
+ * <li><i>Inx_Api_Property_PropertyFormatter</i> for the approval property.
58
+ * <li><i>Inx_Api_Property_FormatChoicePropertyFormatter</i> for the mail format property.
59
+ * </ol>
60
+ * An <i>Inx_Api_Property_PropertyFormatter</i> instance can be obtained using the <i>getFormatter()</i> method.
61
+ * The <i>Inx_Api_Property_FormatChoicePropertyFormatter</i> offers static methods for conversion instead.
62
+ * For examples on how to use the formatters, see their respective documentation.
63
+ * <p>
64
+ * Note: Several api user rights are required to use properties, depending on which properties shall be
65
+ * retrieved/manipulated.
66
+ * See the PROPERTY_* constants in the <i>Inx_Api_UserRights</i> documentation.
67
+ *
68
+ * @see Inx_Api_List_ListContext::findProperty($sPropertyName)
69
+ * @see Inx_Api_List_ListContext::selectProperties()
70
+ * @see Inx_Api_Property_PropertyNames
71
+ * @see Inx_Api_Property_PropertyFormatter
72
+ * @see Inx_Api_Property_FormatChoicePropertyFormatter
73
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
74
+ * @package Inxmail
75
+ * @subpackage Property
76
+ */
77
+ interface Inx_Api_Property_Property extends Inx_Api_BusinessObject
78
+ {
79
+ /**
80
+ * Constant for the property value attribute. Used by the <i>UpdateException</i> to indicate the error source.
81
+ *
82
+ * @see Inx_Api_UpdateException#getErrorSource()
83
+ */
84
+ const ATTRIBUTE_VALUE = 1;
85
+
86
+
87
+ /**
88
+ * Returns the name of the property.
89
+ *
90
+ * @see Inx_Api_Property_PropertyNames
91
+ * @return string the name of the property.
92
+ */
93
+ public function getName();
94
+
95
+
96
+ /**
97
+ * Returns the value of the property.
98
+ *
99
+ * @return string the value of the property.
100
+ */
101
+ public function getInternalValue();
102
+
103
+
104
+ /**
105
+ * Updates the value of the property.
106
+ * <p>
107
+ * For the <i>Inx_Api_Property_PropertyNames::APPROVAL_ACTIVE</i> property use the
108
+ * <i>Inx_Api_Property_PropertyFormatter</i> provided by <i>getFormatter()<i>.
109
+ * For the <i>Inx_Api_Property_PropertyNames::MAIL_FORMAT_CHOICE<i> property use the
110
+ * <i>Inx_Api_Property_FormatChoicePropertyFormatter</i>.
111
+ *
112
+ * @param string $sValue the value of the property.
113
+ */
114
+ public function updateInternalValue( $sValue );
115
+
116
+
117
+ /**
118
+ * Returns the <i>Inx_Api_Property_PropertyFormatter</i> instance used to format the
119
+ * <i>Inx_Api_Property_PropertyNames::APPROVAL_ACTIVE</i> property.
120
+ *
121
+ * @return Inx_Api_Property_PropertyFormatter the <i>PropertyFormatter</i> used to format the approval property.
122
+ * @since API 1.6.0
123
+ */
124
+ public function getFormatter();
125
+
126
+ }
lib/Inx/Api/Property/PropertyFormatter.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Property
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Property_PropertyFormatter</i> is used for converting property values.
8
+ * At the moment it is only used for converting the approval property to and from the internal string representation.
9
+ * An <i>Inx_Api_Property_PropertyFormatter</i> can be obtained by calling <i>Inx_Api_Property_Property::getFormatter()</i>.
10
+ * <p>
11
+ * The following snippet shows how to retrieve and parse the approval property of the specified list:
12
+ *
13
+ * <pre>
14
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
15
+ * $oProperty = $oListContext->findProperty( Inx_Api_Property_PropertyNames::APPROVAL_ACTIVE );
16
+ *
17
+ * $oPropertyFormatter = $oProperty->getFormatter();
18
+ * $oApprovalPropertyValue = $oPropertyFormatter->parseApprovalPropertyValue( $oProperty );
19
+ * echo "Approval type: ".$oApprovalPropertyValue->getApprovalType()."&#60;br&#62;";
20
+ * echo "Primary approver: ".$oApprovalPropertyValue->getPrimaryApproverId()."&#60;br&#62;";
21
+ * echo "Secondary approver: ".$oApprovalPropertyValue->getSecondaryApproverId()."&#60;br&#62;";
22
+ * </pre>
23
+ *
24
+ * It is also possible to convert an <i>Inx_Api_Property_ApprovalPropertyValue</i> into the internal string representation.
25
+ * The following snippet shows how to update the approval process policy of the specified list:
26
+ *
27
+ * <pre>
28
+ * $iPrimaryApproverId = ...
29
+ * $iSecondaryApproverId = ...
30
+ *
31
+ * $oListContext = $oSession->getListContextManager()->findByName(&quot;Desired list&quot;);
32
+ * $oProperty = $oListContext->findProperty(Inx_Api_Property_PropertyNames::APPROVAL_ACTIVE);
33
+ *
34
+ * $oPropertyFormatter = $oProperty->getFormatter();
35
+ * $oApprovalPropertyValue = new Inx_Api_Property_ApprovalPropertyValue(
36
+ * Inx_Api_Property_ApprovalPropertyValue::APPROVAL_TYPE_ESCALATION, $iPrimaryApproverId, $iSecondaryApproverId);
37
+ * $oProperty->updateInternalValue($oPropertyFormatter->createApprovalPropertyValue($oApprovalPropertyValue));
38
+ * $oProperty->commitUpdate();
39
+ * </pre>
40
+ * <p>
41
+ * For more information on the approval property and the possible approval types, see the
42
+ * <i>Inx_Api_Propterty_ApprovalPropertyValue</i> documentation.
43
+ * <p>
44
+ * For more information on properties in general, see the <i>Inx_Api_Property_Property</i> documentation.
45
+ *
46
+ * @see Inx_Api_Property_ApprovalPropertyValue
47
+ * @see Inx_Api_Property_Property
48
+ * @since API 1.6.0
49
+ * @version $Revision: 10520 $ $Date: 2008-09-12 14:40:48 +0200 (Fr, 12 Sep 2008) $ $Author: sbn $
50
+ * @package Inxmail
51
+ * @subpackage Property
52
+ */
53
+ interface Inx_Api_Property_PropertyFormatter
54
+ {
55
+ /**
56
+ * Creates the internal value string for the given <i>Inx_Api_Property_ApprovalPropertyValue</i> which is
57
+ * used for <i>Inx_Api_Property_Property::updateInternalValue($sValue)</i>.
58
+ *
59
+ * @param string $value the <i>Inx_Api_Property_ApprovalPropertyValue</i> which contains the new approval
60
+ * process policy.
61
+ * @return string the internal value string.
62
+ */
63
+ public function createApprovalPropertyValue( $value );
64
+
65
+
66
+ /**
67
+ * Parses a property and creates an <i>Inx_Api_Property_ApprovalPropertyValue</i> object containing the
68
+ * approval process policy.
69
+ * This object can be used to easily retrieve the specifics of the approval process policy.
70
+ *
71
+ * @param Inx_Api_Property_Property $property the property containing the approval value.
72
+ * @return Inx_Api_Property_ApprovalPropertyValue an <i>Inx_Api_Property_ApprovalPropertyValue</i> containing
73
+ * the approval process policy.
74
+ */
75
+ public function parseApprovalPropertyValue( $property );
76
+
77
+ }
lib/Inx/Api/Property/PropertyNames.php ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Property
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Property_PropertyNames</i> interface defines the properties which can be set by the API.
8
+ * Not all properties are available for all list types.
9
+ * See the documentation of a specific property for its list type availability.
10
+ *
11
+ * @see Inx_Api_Property_Property
12
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
13
+ * @package Inxmail
14
+ * @subpackage Property
15
+ */
16
+ interface Inx_Api_Property_PropertyNames
17
+ {
18
+ /**
19
+ * Constant for the locale property. The locale property defines how numbers and dates are formatted.
20
+ * This property is available for the following list types:
21
+ * <ul>
22
+ * <li>Standard list
23
+ * <li>Filter list
24
+ * <li>System list
25
+ * </ul>
26
+ */
27
+ const FORMAT_LOCALE = "listFormatLocale";
28
+
29
+ /**
30
+ * Constant for the fraction digits property.
31
+ * The fraction digits property defines how many decimal fraction digits shall be viewed of a floating point
32
+ * (or floating comma) value.
33
+ * This property is available for the following list types:
34
+ * <ul>
35
+ * <li>Standard list
36
+ * <li>Filter list
37
+ * <li>System list
38
+ * </ul>
39
+ */
40
+ const FORMAT_FRACTION_DIGITS = "floatDecimalPlacesProperty";
41
+
42
+ /**
43
+ * Constant for the decimal separator property.
44
+ * The decimal separator property defines which character is used to separate a decimal number from its fractions.
45
+ * This property is available for the following list types:
46
+ * <ul>
47
+ * <li>Standard list
48
+ * <li>Filter list
49
+ * <li>System list
50
+ * </ul>
51
+ */
52
+ const FORMAT_SEPERATOR = "floatDecimalSeperatorProperty";
53
+
54
+ /**
55
+ * Constant for the line break property.
56
+ * The line break property defines after how many characters a text mailing line will break automatically.
57
+ * This property is available for the following list types:
58
+ * <ul>
59
+ * <li>Standard list
60
+ * <li>Filter list
61
+ * </ul>
62
+ */
63
+ const FORMAT_LINEBREAK = "editor-max-columns";
64
+
65
+ /**
66
+ * Constant for the character set property.
67
+ * The character set property defines how characters are encoded (e.g. UTF-8).
68
+ * This property is available for the following list types:
69
+ * <ul>
70
+ * <li>Standard list
71
+ * <li>Filter list
72
+ * <li>System list
73
+ * </ul>
74
+ */
75
+ const MAIL_ENCODING = "charset";
76
+
77
+ /**
78
+ * Constant for the mail format property.
79
+ * The mail format property defines which formats (plain text, HTML text or multipart) may be used in a specific list.
80
+ * This special property can be set using the <i>Inx_Api_Property_FormatChoicePropertyFormatter</i>.
81
+ * This property is available for the following list types:
82
+ * <ul>
83
+ * <li>Standard list
84
+ * <li>Filter list
85
+ * </ul>
86
+ *
87
+ * @see Inx_Api_Property_FormatChoicePropertyFormatter
88
+ */
89
+ const MAIL_FORMAT_CHOICE = "email-format";
90
+
91
+ /**
92
+ * Constant for the sender address property.
93
+ * The sender address property defines which which address is used to send the mailings of a list.
94
+ * This property is available for the following list types:
95
+ * <ul>
96
+ * <li>Standard list
97
+ * <li>Filter list
98
+ * </ul>
99
+ */
100
+ const MAIL_SENDER_ADDRESS = "sender-address";
101
+
102
+ /**
103
+ * Constant for the reply address property.
104
+ * The reply address property defines which address the recipient may use for replies.
105
+ * This property is available for the following list types:
106
+ * <ul>
107
+ * <li>Standard list
108
+ * <li>Filter list
109
+ * </ul>
110
+ */
111
+ const MAIL_REPLY_ADDRESS = "reply-address";
112
+
113
+ /**
114
+ * Constant for the system mail sender address property.
115
+ * The system mail sender address property defines which address is used to send system mails.
116
+ * This property is available for the following list types:
117
+ * <ul>
118
+ * <li>Administration list
119
+ * </ul>
120
+ */
121
+ const SYSTEM_MAIL_SENDER_ADDRESS = "SystemSenderEmail";
122
+
123
+ /**
124
+ * @deprecated this property will be removed in further versions.
125
+ */
126
+ const SERVER_NAME = "RedirectServerHostName";
127
+
128
+ /**
129
+ * @deprecated this property will be removed in further versions.
130
+ */
131
+ const SERVER_PORT = "RedirectServerHostPort";
132
+
133
+ /**
134
+ * Constant for the sending performance property.
135
+ * The sending performance property defines how many mails may be sent per hour at a maximum.
136
+ * The value has to be set in steps of 3600, where 0 means no limit at all.
137
+ * This property is available for the following list types:
138
+ * <ul>
139
+ * <li>Standard list
140
+ * <li>Filter list
141
+ * <li>System list
142
+ * </ul>
143
+ */
144
+ const SENDING_MAILS_PER_HOUR = "sendrate";
145
+
146
+ /**
147
+ * @deprecated this property will be removed in further versions.
148
+ */
149
+ const HTML_PREVIEW = "html-preview";
150
+
151
+ /**
152
+ * @deprecated this property will be removed in further versions.
153
+ */
154
+ const MAIL_TEST_ADDRESS = "test-recipient";
155
+
156
+ /**
157
+ * Constant for the hard bounce threshold property.
158
+ * The hard bounce threshold property defines how many hard bounces may be received before a recipient is
159
+ * marked as unreachable.
160
+ * A value of 0 means the recipient will never be marked as unreachable automatically.
161
+ * This property is available for the following list types:
162
+ * <ul>
163
+ * <li>Administration list
164
+ * </ul>
165
+ *
166
+ * @since API 1.6.0
167
+ */
168
+ const HARDBOUNCE_THRESHOLD = "HardbounceThreshold";
169
+
170
+ /**
171
+ * Constant for the hard bounce active property.
172
+ * The hard bounce active property defines if recipients are automatically marked as unreachable if a
173
+ * specific threshold (see <i>HARDBOUNCE_THRESHOLD</i>) is reached.
174
+ * This property is available for the following list types:
175
+ * <ul>
176
+ * <li>Administration list
177
+ * </ul>
178
+ *
179
+ * @since API 1.6.0
180
+ */
181
+ const HARDBOUNCE_ACTIVE = "HardbounceActive";
182
+
183
+ /**
184
+ * Constant for the approval property.
185
+ * The approval property defines if the approval of of mailings is activated and how it is done.
186
+ * This special property may be set using the <i>Inx_Api_Property_PropertyFormatter</i> provided by
187
+ * <i>Inx_Api_Property_Property::getFormatter()</i>.
188
+ * This property is available for the following list types:
189
+ * <ul>
190
+ * <li>Standard list
191
+ * <li>Filter list
192
+ * <li>System list
193
+ * </ul>
194
+ *
195
+ * @see Inx_Api_Property_Property::getFormatter()
196
+ * @since API 1.6.0
197
+ */
198
+ const APPROVAL_ACTIVE = "ApprovalActive";
199
+
200
+ /**
201
+ * Constant for the server URL property.
202
+ * The server URL property defines the address of the Inxmail customer. This value is important for JSPs.
203
+ * This property is available for the following list types:
204
+ * <ul>
205
+ * <li>Standard list
206
+ * <li>Filter list
207
+ * <li>Administration list
208
+ * </ul>
209
+ *
210
+ * @since API 1.6.1
211
+ */
212
+ const SERVER_URL = "RedirectServerUrl";
213
+
214
+ /**
215
+ * Constant for the link URL property.
216
+ * The link URL property defines the address of the Inxmail customer. This value is used for link tracking.
217
+ * This property is available for the following list types:
218
+ * <ul>
219
+ * <li>Standard list
220
+ * <li>Filter list
221
+ * <li>Administration list
222
+ * </ul>
223
+ *
224
+ * @since API 1.6.1
225
+ */
226
+ const LINK_URL = "RedirectLinkUrl";
227
+
228
+ /**
229
+ * Constant for the tracking proxy property.
230
+ * The tracking proxy property defines if a tracking proxy shall be used and which one to use.
231
+ * This property is available for the following list types:
232
+ * <ul>
233
+ * <li>Administration list
234
+ * </ul>
235
+ *
236
+ * @since API 1.6.1
237
+ */
238
+ const TRACKING_PROXY = "TrackingProxy";
239
+
240
+ }
lib/Inx/Api/Recipient/Attribute.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Recipient
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Recipient_Attribute</i> contains meta data of recipients.
8
+ * It is the API equivalent of a column in the Inxmail recipient list view.
9
+ * There are mainly two categories of attributes:
10
+ * <ol>
11
+ * <li>Predefined attributes are created by Inxmail and may not be removed or renamed.
12
+ * The most important attributes of this type are:
13
+ * <ul>
14
+ * <li><i>The id attribute</i>: Contains the id of the recipient</li>
15
+ * <li><i>The email attribute</i>: Contains the email address of the recipient</li>
16
+ * <li><i>The key attribute</i>: In general the same as the email attribute</li>
17
+ * <li><i>The subscription attribute</i>: Contains the subscription date of the recipient - Individual for every list</li>
18
+ * <li><i>The last modification attribute</i>: Contains the date of the last modification of the recipient</li>
19
+ * <li><i>The hard bounce attribute</i>: Contains the number of hard bounces received for the recipient</li>
20
+ * </ul>
21
+ * </li>
22
+ * <li>User attributes are created by Inxmail users and may be freely removed or renamed.
23
+ * User attributes give you the ability to treat a recipient according to certain properties.
24
+ * For example you could create an user attribute called 'format' which contains the users preferred mail format.
25
+ * You could then set the mailing format according to this attribute.
26
+ * You could also define an user attribute to store certain interests of the recipient and generate filters
27
+ * (target groups) to send a mailing only to recipients who are interested in the topic covered by the mailing.</li>
28
+ * </ol>
29
+ * All attributes share a common set of properties, which define them. These properties are:
30
+ * <p/>
31
+ * <ul>
32
+ * <li><i>The id</i>: Each attribute has a unique id.</li>
33
+ * <li><i>The name</i>: Each attribute has an unique name. This name is only retrievable for user attributes, though.</li>
34
+ * <li><i>The type</i>: The different attribute types are:
35
+ * <ul>
36
+ * <li><i>EMAIL_ATTRIBUTE_TYPE</i>: The email attribute</li>
37
+ * <li><i>ID_ATTRIBUTE_TYPE</i>: The id attribute</li>
38
+ * <li><i>SUBSCRIPTION_ATTRIBUTE_TYPE</i>: An attribute that indicates the subscription state for a specific list</li>
39
+ * <li><i>LAST_MODIFICATION_ATTRIBUTE_TYPE</i>: The last modification date attribute</li>
40
+ * <li><i>HARDBOUNCE_ATTRIBUTE_TYPE</i>: Contains the number of hard bounces received for a recipient</li>
41
+ * <li><i>FEATURE_ATTRIBUTE_TYPE</i>: An attribute associated with a feature (agent)</li>
42
+ * <li><i>USER_ATTRIBUTE_TYPE</i>: An user defined attribute</li>
43
+ * </ul>
44
+ * </li>
45
+ * <li><i>The data type</i>: The different data types are:
46
+ * <ul>
47
+ * <li><i>DATA_TYPE_STRING</i></li>
48
+ * <li><i>DATA_TYPE_DATETIME</i></li>
49
+ * <li><i>DATA_TYPE_DATE</i></li>
50
+ * <li><i>DATA_TYPE_TIME</i></li>
51
+ * <li><i>DATA_TYPE_BOOLEAN</i></li>
52
+ * <li><i>DATA_TYPE_INTEGER</i></li>
53
+ * <li><i>DATA_TYPE_DOUBLE</i></li>
54
+ * </ul>
55
+ * </li>
56
+ * <li><i>The maximum String length</i>: If the data type is <i>DATA_TYPE_STRING</i>, the attribute can not be longer
57
+ * than the maximum length defined in this property.</li>
58
+ * <li><i>The list context id</i>: Mainly used by attributes of type <i>SUBSCRIPTION_ATTRIBUTE_TYPE</i> to indicate
59
+ * the list they are responsible for.</li>
60
+ * <li><i>The feature (agent) id</i>: Some attributes are used by specific features.</li>
61
+ * <li><i>The accessibility</i>: Only relevant for plug-ins.</li>
62
+ * </ul>
63
+ * <p/>
64
+ * Predefined attributes can easily be retrieved using the various get methods of the <i>Inx_Api_Recipient_RecipientMetaData</i> class.
65
+ * User attributes are retrieved using the <i>Inx_Api_Recipient_RecipientMetaData::getUserAttribute($sName)</i> method
66
+ * and are identified by their unique name.
67
+ * See the <i>Inx_Api_Recipient_RecipientMetaData</i> documentation for more information.
68
+ * <p/>
69
+ * User attributes may be created, removed and renamed using the <i>Inx_Api_Recipient_AttributeManager</i>.
70
+ * For more information on this topic, see the <i>AttributeManager</i> documentation.
71
+ *
72
+ * @see Inx_Api_Recipient_AttributeManager
73
+ * @see Inx_Api_Recipient_RecipientMetaData
74
+ * @since API 1.0
75
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
76
+ * @package Inxmail
77
+ * @subpackage Recipient
78
+ */
79
+ interface Inx_Api_Recipient_Attribute
80
+ {
81
+ /**
82
+ * Constant for the data type String.
83
+ *
84
+ * @var int
85
+ */
86
+ const DATA_TYPE_STRING = 1;
87
+
88
+ /**
89
+ * Constant for the data type Integer.
90
+ *
91
+ * @var int
92
+ */
93
+ const DATA_TYPE_INTEGER = 2;
94
+
95
+ /**
96
+ * Constant for the data type Double.
97
+ *
98
+ * @var int
99
+ */
100
+ const DATA_TYPE_DOUBLE = 3;
101
+
102
+ /**
103
+ * Constant for the data type Boolean.
104
+ *
105
+ * @var int
106
+ */
107
+ const DATA_TYPE_BOOLEAN = 4;
108
+
109
+ /**
110
+ * Constant for the data type Datetime (Date + Time).
111
+ *
112
+ * @var int
113
+ */
114
+ const DATA_TYPE_DATETIME = 10;
115
+
116
+ /**
117
+ * Constant for the data type Date (without Time).
118
+ *
119
+ * @var int
120
+ */
121
+ const DATA_TYPE_DATE = 11;
122
+
123
+ /**
124
+ * Constant for the data type Time (without Date).
125
+ *
126
+ * @var int
127
+ */
128
+ const DATA_TYPE_TIME = 12;
129
+
130
+
131
+ /**
132
+ * Constant for attributes used by features.
133
+ *
134
+ * @var int
135
+ */
136
+ const FEATURE_ATTRIBUTE_TYPE = 1;
137
+
138
+ /**
139
+ * Constant for attributes containing list subscription information.
140
+ *
141
+ * @var int
142
+ */
143
+ const SUBSCRIPTION_ATTRIBUTE_TYPE = 2;
144
+
145
+ /**
146
+ * Constant for the email attribute.
147
+ *
148
+ * @var int
149
+ */
150
+ const EMAIL_ATTRIBUTE_TYPE = 3;
151
+
152
+ /**
153
+ * Constant for the id attribute.
154
+ *
155
+ * @var int
156
+ */
157
+ const ID_ATTRIBUTE_TYPE = 4;
158
+
159
+ /**
160
+ * Constant for user defined attributes.
161
+ *
162
+ * @var int
163
+ */
164
+ const USER_ATTRIBUTE_TYPE = 5;
165
+
166
+ /**
167
+ * Constant for the last modification attribute.
168
+ *
169
+ * @var int
170
+ */
171
+ const LAST_MODIFICATION_ATTRIBUTE_TYPE = 7;
172
+
173
+ /**
174
+ * Constant for the hard bounce attribute (counter).
175
+ *
176
+ * @var int
177
+ * @since API 1.6.0
178
+ */
179
+ const HARDBOUNCE_ATTRIBUTE_TYPE = 8;
180
+
181
+
182
+ /**
183
+ * Returns the unique id of this attribute.
184
+ *
185
+ * @return int the unique id of this attribute.
186
+ */
187
+ public function getId();
188
+
189
+
190
+ /**
191
+ * Returns the unique name of this attribute.
192
+ *
193
+ * @return string the unique name of this attribute.
194
+ */
195
+ public function getName();
196
+
197
+
198
+ /**
199
+ * Returns the attribute type of this attribute.
200
+ * May be one of:
201
+ * <ul>
202
+ * <li><i>ID_ATTRIBUTE_TYPE</i>
203
+ * <li><i>EMAIL_ATTRIBUTE_TYPE</i>
204
+ * <li><i>USER_ATTRIBUTE_TYPE</i>
205
+ * <li><i>SUBSCRIPTION_ATTRIBUTE_TYPE</i>
206
+ * <li><i>LAST_MODIFIED_ATTRIBUTE_TYPE</i>
207
+ * <li><i>FEATURE_ATTRIBUTE_TYPE</i>
208
+ * </ul>
209
+ *
210
+ * @return int the attribute type of this attribute.
211
+ */
212
+ public function getType();
213
+
214
+
215
+ /**
216
+ * Returns the data type of this attribute.
217
+ * May be one of:
218
+ * <ul>
219
+ * <li><i>DATA_TYPE_STRING</i>
220
+ * <li><i>DATA_TYPE_INTEGER</i>
221
+ * <li><i>DATA_TYPE_DOUBLE</i>
222
+ * <li><i>DATA_TYPE_BOOLEAN</i>
223
+ * <li><i>DATA_TYPE_DATETIME</i>
224
+ * <li><i>DATA_TYPE_DATE</i>
225
+ * <li><i>DATA_TYPE_TIME</i>
226
+ * </ul>
227
+ *
228
+ * @return int the data type of this attribute.
229
+ */
230
+ public function getDataType();
231
+
232
+
233
+ /**
234
+ * Returns the maximum length of the string value of this attribute.
235
+ * Only relevant if the data type is <i>DATA_TYPE_STRING</i>.
236
+ *
237
+ * @return int the maximum length of the string value of this attribute.
238
+ */
239
+ public function getMaxStringLength();
240
+
241
+
242
+ /**
243
+ * Returns the list context id of this attribute.
244
+ * Only relevant if the attribute type is <i>SUBSCRIPTION_ATTRIBUTE_TYPE</i> or <i>FEATURE_ATTRIBUTE_TYPE</i>.
245
+ *
246
+ * @return int the list context id of this attribute.
247
+ */
248
+ public function getListContextId();
249
+
250
+
251
+ /**
252
+ * Returns the feature id of this attribute.
253
+ * Only relevant if the attribute type is <i>FEATURE_ATTRIBUTE_TYPE</i>.
254
+ *
255
+ * @return int the feature id of this attribute.
256
+ */
257
+ public function getFeatureId();
258
+
259
+ /**
260
+ * Only relevant in a plug-in api session.
261
+ *
262
+ * @return bool the accessibility of this attribute.
263
+ */
264
+ public function isAccessible();
265
+
266
+ }
lib/Inx/Api/Recipient/AttributeManager.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Recipient
5
+ */
6
+ /**
7
+ * Using the <i>Inx_Api_Recipient_AttributeManager</i>, attributes (columns) can be manipulated.
8
+ * The following operations can be performed using the <i>AttributeManager</i>:
9
+ * <p>
10
+ * <ul>
11
+ * <li>Creating attributes: <i>create(String, int, int)</i>
12
+ * <li>Removing user attributes: <i>remove(Attribute)</i>
13
+ * <li>Renaming user attributes: <i>rename(Attribute, String)</i>
14
+ * <li>Checking list visibility: <i>isAttributeVisibleInList(Attribute, int)</i> and
15
+ * <i>areAttributesVisibleInList(List, int)</i>
16
+ * <li>Setting list visibility: <i>setAttributeListVisibility(Attribute, int, boolean)</i> and
17
+ * <i>setAttributeListVisibilities(List, int, boolean)</i>
18
+ * <li>Setting global visibility: <i>setGlobalAttributeVisibility(Attribute, boolean)</i> and
19
+ * <i>setGlobalAttributeVisibilities(List, boolean)</i>
20
+ * </ul>
21
+ * Note: Changing the data type of an attribute is not supported by the <i>AttributeManager</i>.
22
+ * This is a possibly dangerous operation that should - if at all - be performed using the client which can
23
+ * provide guidance and assistance in converting attributes from on type into another.
24
+ * <p>
25
+ * The <i>AttributeManager</i> can not be used to change attribute values for recipients.
26
+ * This is performed using the <i>Inx_Api_Recipient_RecipientContext</i>.
27
+ * See the <i>RecipientContext</i> documentation for more information on this topic.
28
+ * <p>
29
+ * Following example illustrates how to create a new text attribute with a length of 50 characters:
30
+ *
31
+ * <pre>
32
+ * $oSession->getAttributeManager()->create( "Firstname", Inx_Api_Recipient_Attribute::DATA_TYPE_STRING, 50 );
33
+ * </pre>
34
+ * <p>
35
+ * For more information on <i>Attribute</i>s in general, see the <i>Inx_Api_Recipient_Attribute</i> documentation.
36
+ *
37
+ * @see Inx_Api_Recipient_Attribute
38
+ * @see Inx_Api_Recipient_RecipientContext
39
+ * @since API 1.0
40
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
41
+ * @package Inxmail
42
+ * @subpackage Recipient
43
+ */
44
+ interface Inx_Api_Recipient_AttributeManager
45
+ {
46
+
47
+ /**
48
+ * Create a new user attribute.
49
+ *
50
+ * @param attributeName the unique name of the attribute
51
+ * @param dataType the data type of the attribute
52
+ * @param maxStringLenth the length of the string attribute (length from 1 to 255),
53
+ * only for <i>Inx_Api_Recipient_Attribute::DATA_TYPE_STRING</i>
54
+ * @return the attribute id of the new attribute
55
+ * @throws Inx_Api_NameException if the attribute name is illegal or already exist
56
+ * @see Inx_Api_Recipient_Attribute
57
+ */
58
+ public function create( $sAttributeName, $iDataType, $iMaxStringLenth );
59
+
60
+
61
+ /**
62
+ * Rename a user attribute.
63
+ *
64
+ * @param Inx_Api_Recipient_Attribute $oAttribute the attribute to rename
65
+ * @param string $sAttributeName the new attribute name
66
+ * @return boolean true, if the attribute is renamed, otherwise false
67
+ * @throws Inx_Api_NameException if the attribute name is illegal or already exist
68
+ */
69
+ public function rename( Inx_Api_Recipient_Attribute $oAttribute, $sAttributeName );
70
+
71
+
72
+ /**
73
+ * Remove a user attribute.
74
+ *
75
+ * @param Inx_Api_Recipient_Attribute $oAttribute the attribute to remove
76
+ * @return boolean true, if the attribute is removed, otherwise false
77
+ */
78
+ public function remove( Inx_Api_Recipient_Attribute $oAttribute = null );
79
+
80
+
81
+ /**
82
+ * Checks whether the given attribute is visible in the specified list.
83
+ *
84
+ * @param Inx_Api_Recipient_Attribute $oAttribute the attribute to check.
85
+ * @param int $iListId the id of the list to check.
86
+ * @return bool <i>true</i> if the attribute is visible in the list, <i>false</i> otherwise.
87
+ * @since API 1.10.0
88
+ */
89
+ public function isAttributeVisibleInList( Inx_Api_Recipient_Attribute $oAttribute, $iListId );
90
+
91
+
92
+ /**
93
+ * Checks whether the given attributes are visible in the specified list.
94
+ * The result is an associative array where the attribute id is the key and the value is a <i>bool</i> indicating
95
+ * the visibility of the attribute.
96
+ *
97
+ * @param array $aAttributes a list of <i>Inx_Api_Recipient_Attribute</i>s to check.
98
+ * @param int $iListId the id of the list to check.
99
+ * @return array an associative array containing int/bool pairs.
100
+ * @since API 1.10.0
101
+ */
102
+ public function areAttributesVisibleInList( $aAttributes, $iListId );
103
+
104
+
105
+ /**
106
+ * Sets the visibility of an attribute (column) in a specific list.
107
+ * Some attributes, like the email attribute, may not be shown or hidden and will therefore trigger an
108
+ * <i>Inx_Api_APIException</i>.
109
+ *
110
+ * @param Inx_Api_Recipient_Attribute $oAttribute the attribute to show or hide.
111
+ * @param int $iListId the id of the list in which the attribute shall be shown or hidden.
112
+ * @param bool $blVisible <i>true</i> if the attribute shall be shown, <i>false</i> if it shall be hidden.
113
+ * @throws Inx_Api_APIException if the attribute can not be shown / hidden.
114
+ * @since API 1.9.0
115
+ */
116
+ public function setAttributeListVisibility( Inx_Api_Recipient_Attribute $oAttribute, $iListId, $blVisible );
117
+
118
+
119
+ /**
120
+ * Sets the visibility of a list of attributes (columns) in a specific list.
121
+ * Some attributes, like the email attribute, may not be shown or hidden and will therefore trigger an
122
+ * <i>Inx_Api_APIException</i>.
123
+ * If the list contains such an attribute, none of the attributes will be modified.
124
+ *
125
+ * @param array $aAttributes a list of <i>Inx_Api_Recipient_Attribute</i>s to show or hide.
126
+ * @param int $iListId the id of the list in which the attributes shall be shown or hidden.
127
+ * @param bool $blVisible <i>true</i> if the attributes shall be shown, <i>false</codei> if they shall be hidden.
128
+ * @throws Inx_Api_APIException if at least one attribute can not be shown / hidden.
129
+ * @since API 1.9.0
130
+ */
131
+ public function setAttributeListVisibilities( $aAttributes, $iListId, $blVisible );
132
+
133
+
134
+ /**
135
+ * Sets the visibility of an attribute (column) in all lists.
136
+ * Some attributes, like the email attribute, may not be shown or hidden and will therefore trigger an
137
+ * <i>Inx_Api_APIException</i>.
138
+ *
139
+ * @param Inx_Api_Recipient_Attribute $oAttribute the attribute to show or hide.
140
+ * @param bool $blVisible <i>true</i> if the attribute shall be shown, <i>false</i> if it shall be hidden.
141
+ * @throws Inx_Api_APIException if the attribute can not be shown / hidden.
142
+ * @since API 1.9.0
143
+ */
144
+ public function setGlobalAttributeVisibility( Inx_Api_Recipient_Attribute $oAttribute, $blVisible );
145
+
146
+
147
+ /**
148
+ * Sets the visibility of a list of attributes (columns) in all lists.
149
+ * Some attributes, like the email attribute, may not be shown or hidden and will therefore trigger an
150
+ * <i>Inx_Api_APIException</i>.
151
+ * If the list contains such an attribute, none of the attributes will be modified.
152
+ *
153
+ * @param array $aAttributes a list of <i>Inx_Api_Recipient_Attribute</i>s to show or hide.
154
+ * @param bool $blVisible <i>true</i> if the attributes shall be shown, <i>false</i> if they shall be hidden.
155
+ * @throws Inx_Api_APIException if at least one attribute can not be shown / hidden.
156
+ * @since API 1.9.0
157
+ */
158
+ public function setGlobalAttributeVisibilities( $aAttributes, $blVisible );
159
+ }
lib/Inx/Api/Recipient/AttributeNotFoundException.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Recipient
5
+ */
6
+ /**
7
+ * An exception thrown by the <i>Inx_Api_Recipient_RecipientMetaData</i> when an attribute does not exist.
8
+ *
9
+ * @since API 1.0
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ * @subpackage Recipient
13
+ */
14
+ class Inx_Api_Recipient_AttributeNotFoundException extends Exception
15
+ {
16
+
17
+ }
lib/Inx/Api/Recipient/BatchChannel.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Recipient_BatchChannel</i> can (and should) be used for manipulation of large amounts of data.
9
+ * The <i>createRecipient()</i> and <i>selectRecipient()</i> methods are used to create and/or select a recipient.
10
+ * After creating or selecting a recipient, the following batch commands operate on this until another recipient is selected.
11
+ * <p>
12
+ * An <i>Inx_Api_Recipient_BatchChannel</i> may be used to perform the following operations:
13
+ * <p>
14
+ * <ul>
15
+ * <li>Select recipients: <i>selectRecipient($sKeyValue)</i>
16
+ * <li>Create recipients: <i>createRecipient($sKeyValue, $blSelectIfExistant)</i>
17
+ * <li>Remove recipients: <i>removeRecipient($sKeyValue)</i>
18
+ * <li>Manipulate recipient attributes <i>write($oAttribute, $oValue)</i> and <i>writeIfNull($oAttribute, $sValue)</i>
19
+ * <li>Subscribe recipients: <i>subscribeIfNotUnsubscribed($oListContext, $sSubscriptionDate)</i>
20
+ * <li>Unsubscribe recipients: <i>unsubscribe($oListContext)</i>
21
+ * </ul>
22
+ * The selection, creation and removal of recipients requires a value corresponding to the recipient key.
23
+ * Usually, this key is the email address.
24
+ * It is possible to use a different attribute as recipient key for the <i>BatchChannel</i>.
25
+ * To do this, use the <i>Inx_Api_Recipient_RecipientContext::createBatchChannel($oAttribute)</i> method to create
26
+ * the <i>Inx_Api_Recipient_BatchChannel</i> object and pass the attribute used as key.
27
+ * However, be aware that the attribute used as key should be unique, although this is no hard technical requirement.
28
+ * Using a non unique attribute as key will return any of the matching recipients (undetermined).
29
+ * Also, the creation of recipients using a different key attribute is not possible.
30
+ * <p>
31
+ * Note: Resubscription is not supported by <code>BatchChannel</code>.
32
+ * If you wish to resubscribe a recipient, use <i>In_Api_Recipient_UnsubscriptionRecipientRowSet::resubscribe($sDate)</i> instead.
33
+ * <p>
34
+ * The following snippet shows how to add two new addresses and change their "Firstname" and "Lastname" attributes.
35
+ * If the addresses exist already, these attribute values will be overwritten.
36
+ *
37
+ * <pre>
38
+ * $oRecipientContext = $oSession->createRecipientContext();
39
+ * $oBatchChannel = $oRecipientContext->createBatchChannel();
40
+ * $oRecipientMetaData = $oRecipientContext->getMetaData();
41
+ *
42
+ * $oBatchChannel->createRecipient( "mueller@yourcompany.com", true );
43
+ * $oBatchChannel->write( $oRecipientMetaData->getUserAttribute( "Firstname" ), "George" );
44
+ * $oBatchChannel->write( $oRecipientMetaData->getUserAttribute( "Lastname" ), "Müller" );
45
+ *
46
+ * $oBatchChannel->createRecipient( "clinton@yourcompany.com", true );
47
+ * $oBatchChannel->write( $oRecipientMetaData->getUserAttribute( "Firstname" ), "Bill" );
48
+ * $oBatchChannel->write( $oRecipientMetaData->getUserAttribute( "Lastname" ), "Clinton" );
49
+ *
50
+ * $retArr = $oBatchChannel->executeBatch();
51
+ * </pre>
52
+ *
53
+ * Note: The <i>boolean</i> parameter of <i>createRecipient</i> defines how to handle already existent recipients.
54
+ * If the parameter is set to <i>true</i> - as in the example - the recipient will only be created if it does not already exist.
55
+ * Existent recipients are selected instead.
56
+ * If the parameter is set to <i>false</i> the <i>BatchChannel</i> will attempt to create the recipient.
57
+ * If the recipient is not already existing it will be created and selected.
58
+ * However, if the recipient exists already, the result will be <i>RESULT_FAILURE_DUPLICATE_KEY</i> and the recipient will
59
+ * <strong>not</strong> be selected.
60
+ * Therefore, all succeeding operations on this recipient will not be committed (<i>RESULT_NOT_COMMITTED</i>).
61
+ * <p>
62
+ * The selection and removal of recipients works very much the same, except that <i>removeRecipient($sKeyValue)</i> will
63
+ * not select the deleted recipient of course.
64
+ * After deleting a recipient, a new recipient must be selected (or created) before any tasks may be invoked.
65
+ * This is because the <i>remove()</i> method resets the currently selected recipient.
66
+ * <p>
67
+ * The <i>writeIfNull($oAttribute, $sValue)</i> method allows you to set an attribute value only, if no value was
68
+ * assigned previously (i.e. the attribute value is <i>null</i>).
69
+ * A similar technique is used by <i>subscribeIfNotUnsubscribed($oListContext, $sDate)</i>.
70
+ * This method subscribes the selected recipient to the given list, only when the recipient was not unsubscribed from that list before.
71
+ * <p>
72
+ * Each command to the BatchChannel results in a value in the returned integer array.
73
+ * By scanning the array, you can find out which of the commands have been executed, and which have not.
74
+ * <p>
75
+ * The values produced by <code>removeRecipient()</code>:
76
+ * <ul>
77
+ * <LI>The recipientId is returned if the recipient is removed
78
+ * <LI><i>RESULT_FAILURE_KEY_NOT_FOUND</i> is returned if the recipient doesn't exists
79
+ * </ul>
80
+ * <P>
81
+ * The values produced by <i>selectRecipient()</i>:
82
+ * <ul>
83
+ * <LI>The recipientId is returned if the recipient is selected
84
+ * <LI><i>RESULT_FAILURE_DUPLICATE_KEY</i> is returned if the unique key already exists
85
+ * <LI><i>RESULT_FAILURE_BLOCKED_BY_BLACKLIST</i> is returned if the email address is blocked
86
+ * <LI><i>RESULT_FAILURE_KEY_NOT_FOUND</i> is returned if the recipient doesn't exist
87
+ * </ul>
88
+ * <P>
89
+ * The values produced by <i>createRecipient()</i>:
90
+ * <ul>
91
+ * <LI>The recipientId is returned if the recipient was successfully created or selected
92
+ * <LI><i>RESULT_FAILURE_DUPLICATE_KEY</i> is returned if the unique key already exists
93
+ * <LI><i>RESULT_FAILURE_BLOCKED_BY_BLACKLIST</i> is returned if the email address is blocked
94
+ * <LI><i>RESULT_FAILURE_ILLEGAL_VALUE</i> is returned if the key value is illegal
95
+ * </ul>
96
+ * <P>
97
+ * The values produced by <i>write()</i> and <i>writeIfNull()</i>
98
+ * <ul>
99
+ * <LI><i>RESULT_COMMITTED</i> is returned if the value is set and committed
100
+ * <LI><i>RESULT_NOT_COMMITTED</i> is returned if the value is set, but could not be committed
101
+ * <LI><i>RESULT_FAILURE_ILLEGAL_VALUE</i> is returned if the value of the attribute is illegal
102
+ * </ul>
103
+ * <P>
104
+ * The values produced by <i>subscribeIfNotUnsubscribed()</i>
105
+ * <ul>
106
+ * <LI><i>RESULT_COMMITTED</i> is returned if the recipient was subscribed
107
+ * <LI><i>RESULT_NOT_COMMITTED</i> is returned if the recipient was unsubscribed before
108
+ * </ul>
109
+ * <P>
110
+ * The values produced by <i>unsubscribe()</i>
111
+ * <ul>
112
+ * <LI><i>RESULT_COMMITTED</i> is returned if the recipient was unsubscribed
113
+ * <LI><i>RESULT_NOT_COMMITTED</i> is returned if the recipient was already unsubscribed before
114
+ * </ul>
115
+ * <p>
116
+ * For more information on recipients, see the <i>Inx_Api_Recipient_RecipientContext</i> documentation.
117
+ *
118
+ * @see Inx_Api_Recipient_RecipientContext
119
+ * @since API 1.0
120
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
121
+ * @package Inxmail
122
+ * @subpackage Recipient
123
+ */
124
+ interface Inx_Api_Recipient_BatchChannel
125
+ {
126
+
127
+ /** RESULT_COMMITTED is returned if the value is set and committed. */
128
+ const RESULT_COMMITTED = -100;
129
+
130
+ /** RESULT_NOT_COMMITTED is returned if the data was not committed. */
131
+ const RESULT_NOT_COMMITTED = -101;
132
+
133
+ /** RESULT_FAILURE_ILLEGAL_VALUE is returned if the key value is illegal. */
134
+ const RESULT_FAILURE_ILLEGAL_VALUE = -102;
135
+
136
+ /** RESULT_FAILURE_BLOCKED_BY_BLACKLIST is returned if the email address is blocked by a blacklist entry. */
137
+ const RESULT_FAILURE_BLOCKED_BY_BLACKLIST = -103;
138
+
139
+ /** RESULT_FAILURE_DUPLICATE_KEY is returned if the unique key already exists. */
140
+ const RESULT_FAILURE_DUPLICATE_KEY = -104;
141
+
142
+ /** RESULT_FAILURE_KEY_NOT_FOUND is returned if the recipient doesn't exist. */
143
+ const RESULT_FAILURE_KEY_NOT_FOUND = -105;
144
+
145
+ /** RESULT_PERMISSION_DENIED is returned if the permission is denied to create, update or remove a recipient. */
146
+ const RESULT_PERMISSION_DENIED = -200;
147
+
148
+
149
+ /**
150
+ * Removes the recipient identified by the given key value from the system.
151
+ * <p>
152
+ * A key different from the email address may be specified using
153
+ * <i>Inx_Api_Recipient_RecipientContext::createBatchChannel($oAttribute)</i>.
154
+ * However, be careful with that method, as the selected recipient for non unique key attributes is not determined.
155
+ * In such a case, any of the matching recipients may be removed.
156
+ *
157
+ * @param string $sKeyValue the key value of the desired recipient.
158
+ */
159
+ public function removeRecipient( $sKeyValue );
160
+
161
+
162
+ /**
163
+ * Selects an existing recipient identified by the given key value.
164
+ * <p>
165
+ * A key different from the email address may be specified using
166
+ * <i>Inx_Api_Recipient_RecipientContext::createBatchChannel($oAttribute)</i>.
167
+ * However, be careful with that method, as the selected recipient for non unique key attributes is not determined.
168
+ * In such a case, any of the matching recipients may be selected.
169
+ *
170
+ * @param string $sKeyValue the key value from the desired recipient.
171
+ */
172
+ public function selectRecipient( $sKeyValue );
173
+
174
+
175
+ /**
176
+ * Create and/or select a recipient identified by the given key value.
177
+ * The behaviour of this method depends on the value of the <i>bool</i> parameter and the recipient state (existing or not existing).
178
+ * The behaviour is defined as follows:
179
+ * <ul>
180
+ * <li>Recipient does not exist, parameter is <i>false</i>: The recipient will be created and selected.
181
+ * <li>Recipient already exists, parameter is <i>false</i>: The recipient will neither be created nor selected.
182
+ * <li>Recipient does not exist, parameter is <i>true</i>: The recipient will be created and selected.
183
+ * <li>Recipient already exists, parameter is <i>true</i>: The recipient will not be created but selected.
184
+ * </ul>
185
+ * <strong>Note:</strong> If a key different from the email address is used by this <i>Inx_Api_Recipient_BatchChannel</i>
186
+ * this method will not create any recipient.
187
+ * To use this method you must use the email address as recipient key.
188
+ * <p>
189
+ *
190
+ * @param string $sKeyValue the key value of the recipient to create/select.
191
+ * @param bool $blSelectIfExistant <i>true</i> if existent recipients shall be selected, <i>false</i> if existent
192
+ * recipients shall neither be created nor selected.
193
+ */
194
+ public function createRecipient( $sKeyValue, $blSelectIfExistant );
195
+
196
+
197
+ /**
198
+ * Sets a new value to the specified attribute.
199
+ * Requires a previously invoked select or create command.
200
+ * If the attribute is changed several times during a batch command, the last will be the new value.
201
+ *
202
+ * @param Inx_Api_Recipient_Attribute $oAttribute the attribute to be set.
203
+ * @param string $sValue the new value.
204
+ */
205
+ public function write( Inx_Api_Recipient_Attribute $oAttribute, $sValue );
206
+
207
+
208
+ /**
209
+ * Sets a new value to the specified attribute, only if the current value is <i>null</i>.
210
+ * Requires a previously invoked select or create command.
211
+ * If this method is invoked several times during a batch command, the first value will be set.
212
+ *
213
+ * @param Inx_Api_Recipient_Attribute $oAttribute the attribute to be set.
214
+ * @param string $sValue the new value.
215
+ */
216
+ public function writeIfNull( Inx_Api_Recipient_Attribute $oAttribute, $sValue );
217
+
218
+
219
+ /**
220
+ * Unsubscribes the current recipient from the specified list.
221
+ * Requires a previously invoked select or create command and the recipient must be a member of the list.
222
+ *
223
+ * @param lc the list from which the recipient should be unsubscribed.
224
+ * @since API 1.6.0
225
+ */
226
+ public function unsubscribe( Inx_Api_List_ListContext $lc );
227
+
228
+
229
+ /**
230
+ * Subscribes a new recipient to the given list, if she/he was not unsubscribed from it before.
231
+ * Use the <i>write()</i> method to overwrite the unsubscription of the recipient or use
232
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet::resubscribe($sDate)</i> instead.
233
+ *
234
+ * @param lc the list to which the recipient should be subscribed.
235
+ * @param subscriptionDate the subscription date. May <strong>not</strong> be <i>null</i>.
236
+ * @since API 1.6.0
237
+ */
238
+ public function subscribeIfNotUnsubscribed( Inx_Api_List_ListContext $lc, $subscriptionDate );
239
+
240
+
241
+
242
+ /**
243
+ * Execute the batched commands.
244
+ *
245
+ * @return array an array of <i>int</i>, with each element indicating the result of a the corresponding command.
246
+ * May be one of:
247
+ * <ul>
248
+ * <li><i>RESULT_COMMITTED</i>
249
+ * <li><i>RESULT_NOT_COMMITTED</i>
250
+ * <li><i>RESULT_FAILURE_BLOCKED_BY_BLACKLIST</i>
251
+ * <li><i>RESULT_FAILURE_DUPLICATE_KEY</i>
252
+ * <li><i>RESULT_FAILURE_ILLEGAL_VALUE</i>
253
+ * <li><i>RESULT_FAILURE_KEY_NOT_FOUND</i>
254
+ * <li><i>RESULT_PERMISSION_DENIED</i>
255
+ * </ul>
256
+ */
257
+ public function executeBatch();
258
+
259
+
260
+ /**
261
+ * Retrieves the <i>Inx_Api_Recipient_RecipientContext</i> which created this <i>BatchChannel</i>.
262
+ *
263
+ * @return Inx_Api_Recipient_RecipientContext the <i>RecipientContext</i> which created this <i>BatchChannel</i>.
264
+ */
265
+ public function getContext();
266
+
267
+ }
lib/Inx/Api/Recipient/BlackListException.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Recipient
5
+ */
6
+ /**
7
+ * A <i>Inx_Api_Recipient_BlackListException</i> is thrown when the email address of a recipient is blocked by the black list.
8
+ *
9
+ * @since API 1.0
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ * @subpackage Recipient
13
+ */
14
+ class Inx_Api_Recipient_BlackListException extends Exception
15
+ {
16
+
17
+ }
lib/Inx/Api/Recipient/DuplicateKeyException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Recipient
5
+ */
6
+ /**
7
+ * An <i>Inx_Api_Recipient_DuplicateKeyException</i> is thrown when a recipient with the same key value already exists.
8
+ * The key usually is the email address.
9
+ *
10
+ * @since API 1.0
11
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
12
+ * @package Inxmail
13
+ * @subpackage Recipient
14
+ */
15
+ class Inx_Api_Recipient_DuplicateKeyException extends Exception
16
+ {
17
+
18
+ }
lib/Inx/Api/Recipient/IllegalValueException.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+ /**
8
+ * Thrown by the <i>commitRowUpdate</i> method of an <I>Inx_Api_Recipient_RecipientRowSet</i> or
9
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> to indicate that the value of the specified attribute is illegal.
10
+ * The source attribute id is coded as error code.
11
+ *
12
+ * @since API 1.0
13
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
14
+ * @package Inxmail
15
+ * @subpackage Recipient
16
+ */
17
+ class Inx_Api_Recipient_IllegalValueException extends Exception
18
+ {
19
+
20
+ }
lib/Inx/Api/Recipient/RecipientContext.php ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Recipient_RecipientContext</i> is used to access and manipulate recipient data.
9
+ * The following operations can be performed using the <i>RecipientContext</i>:
10
+ * <p>
11
+ * <ul>
12
+ * <li>Fetch recipient data as <i>Inx_Api_Recipient_RecipientRowSet</i>
13
+ * <li>Fetch data of unsubscribed recipients as <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i>
14
+ * <li>Add and remove recipients (multiple methods)
15
+ * <li>Retrieve and manipulate recipient attributes using <i>Inx_Api_Recipient_RecipientMetaData</i>
16
+ * and the <i>Inx_Api_Recipient_AttributeManager</i>
17
+ * <li>Retrieve and update recipient attribute values (multiple methods)
18
+ * <li>Resubscribe recipients using <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i>
19
+ * </ul>
20
+ * There are a number of varieties of the methods for fetching recipient data either as
21
+ * <i>Inx_Api_RecipientRecipientRowSet</i> or <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i>.
22
+ * The following snippet exemplary shows how to use one specific <i>select</i> method which retrieves all
23
+ * recipients of the specified list whose name starts with the letter M, ordered by the given attribute:
24
+ *
25
+ * <pre>
26
+ * $oRecipientContext = $oSession->createRecipientContext();
27
+ * $oAttribute = $oRecipientContext->getMetaData()->getUserAttribute( &quot;name&quot; );
28
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
29
+ *
30
+ * $sNameFilter = 'Column(&quot;name&quot;) LIKE &quot;m%&quot;';
31
+ * $oRecipientRowSet = $oRecipientContext->select( $oListContext, null, $sNameFilter, $oAttribute, Inx_Api_Order::ASC );
32
+ *
33
+ * while( $oRecipientRowSet->next() )
34
+ * {
35
+ * echo $oRecipientRowSet->getString( $oAttribute ).&quot;&#60;br&#62;&quot;;
36
+ * }
37
+ *
38
+ * $oRecipientRowSet->close();
39
+ * </pre>
40
+ *
41
+ * To fetch only recipients which unsubscribed from a specific list, use the <i>selectUnsubscriber()</i> method
42
+ * which returns an <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i>.
43
+ * <p>
44
+ * Adding and removing recipients can be accomplished in two ways:
45
+ * <ol>
46
+ * <li>Using the <i>Inx_Api_Recipient_RecipientRowSet</i>
47
+ * <li>Using the <i>Inx_Api_Recipient_BatchChannel</i>
48
+ * </ol>
49
+ * The <i>Inx_Api_Recipient_BatchChannel</i> is a powerful tool which enables you to update large amounts of data with
50
+ * a reasonable performance by aggregating the commands.
51
+ * The usage of the <i>BatchChannel</i> is not covered by this documentation.
52
+ * For more information, see the <i>Inx_Api_Recipient_BatchChannel</i> documentation.
53
+ * <p>
54
+ * The following snippet shows how to add a new recipient using an empty <i>Inx_Api_Recipient_RecipientRowSet</i>:
55
+ *
56
+ * <pre>
57
+ * $oRecipientContext = $oSession->createRecipientContext();
58
+ * $oRecipientRowSet = $oRecipientContext->createRowSet();
59
+ * $oAttribute = $oRecipientRowSet->getMetaData()->getEmailAttribute();
60
+ *
61
+ * $oRecipientRowSet->moveToInsertRow();
62
+ * $oRecipientRowSet->updateString( $oAttribute, &quot;new@recipient.invalid&quot; );
63
+ * $oRecipientRowSet->commitRowUpdate();
64
+ * $oRecipientRowSet->close();
65
+ * </pre>
66
+ *
67
+ * Removing a recipient using the <i>Inx_Api_Recipient_RecipientRowSet</i> can be accomplished by selecting only
68
+ * one specific recipient.
69
+ * To do so, use a filter expression on the email attribute. The following snippet shows how to do this:
70
+ *
71
+ * <pre>
72
+ * $oRecipientContext = $oSession->createRecipientContext();
73
+ * $oRecipientRowSet = $oRecipientContext->select( null, null, 'Column(&quot;email&quot;) = &quot;abusive@recipient.invalid&quot;' );
74
+ *
75
+ * $oRecipientRowSet->next();
76
+ * $oRecipientRowSet->deleteRow();
77
+ * $oRecipientRowSet->close();
78
+ * </pre>
79
+ *
80
+ * Note: Both tasks are easier to perform using the <i>Inx_Api_Recipient_BatchChannel</i>.
81
+ * <p>
82
+ * The retrieval of recipient attributes using the <i>Inx_Api_Recipient_RecipientMetaData</i> was already shown in
83
+ * the fetching example.
84
+ * Creating new attributes is almost as easy, as shown in the following snippet which creates the previously used
85
+ * name attribute:
86
+ *
87
+ * <pre>
88
+ * $oAttributeManager = $oSession->getAttributeManager();
89
+ * $oAttributeManager->create( &quot;name&quot;, Inx_Api_Recipient_Attribute::DATA_TYPE_STRING, 50 );
90
+ * </pre>
91
+ *
92
+ * For more information on the manipulation of recipient attributes, see the <i>Inx_Api_Recipient_AttributeManager</i> documentation.
93
+ * <p>
94
+ * A more common action than manipulating recipient attributes is to update their values.
95
+ * There are several ways in which this can be accomplished:
96
+ * <p>
97
+ * <ul>
98
+ * <li>Using the <i>setAttributeValue($oAttribute, $oValue)</i> method to change the attribute value for all recipients
99
+ * <li>Using the <i>Inx_Api_Recipient_RecipientRowSet::setAttributeValue($oAttribute, $oValue)</I> method to change the
100
+ * attribute value for a set of recipients
101
+ * <li>Using one of the <i>update*()</i> methods in <i>Inx_Api_Recipient_RecipientRowSet</i>
102
+ * <li>Using <i>Inx_Api_Recipient_BatchChannel::write($oAttribute, $oValue)</i> or
103
+ * <i>Inx_Api_Recipient_BatchChannel::writeIfNull($oAttribute, $oValue)</i>
104
+ * </ul>
105
+ * For the <i>BatchChannel</i> methods, see the <i>Inx_Api_Recipient_BatchChannel</i> documentation.
106
+ * The following snippet shows how to change the attribute value of all recipients:
107
+ *
108
+ * <pre>
109
+ * $oRecipientContext = $oSession->createRecipientContext();
110
+ * $oAttribute = $oRecipientContext->getMetaData()->getUserAttribute( &quot;defaultFormat&quot; );
111
+ *
112
+ * $value = new stdClass();
113
+ * $value->value = &quot;html&quot;;
114
+ * $oRecipientContext->setAttributeValue( $oAttribute, $value );
115
+ * </pre>
116
+ *
117
+ * Setting the attribute value for all recipients in a specific <i>Inx_Api_Recipient_RecipientRowSet</i> works very much the same.
118
+ * Also, the <i>RecipientRowSet</i> can be used to change the attribute value for a selection of recipients in the set.
119
+ * The following snippet shows how to do this:
120
+ *
121
+ * <pre>
122
+ * $oRecipientContext = $oSession->createRecipientContext();
123
+ * $oAttribute = $oRecipientContext->getMetaData()->getUserAttribute( &quot;top10&quot; );
124
+ * $oRecipientRowSet = $oRecipientContext->select(); // fetches all recipients
125
+ *
126
+ * $value = new stdClass();
127
+ * $value->value = true;
128
+ * $oRecipientRowSet->setAttributeValue( $oAttribute, $value, new Inx_Api_IndexSelection( 0, 9 ) );
129
+ * $oRecipientRowSet->close();
130
+ * </pre>
131
+ *
132
+ * The last available option is to change the attribute value of a single recipient.
133
+ * The recipient creation example further above used this method to update the email address of the newly created recipient.
134
+ * <p>
135
+ * For an example on how to resubscribe recipients to a list, see the <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i>
136
+ * documentation.
137
+ * <p>
138
+ * <strong>Note:</strong> Getting this context from the session will get a snapshot of the current attributes defined.
139
+ * This snapshot will be used for the lifetime of the context, changes in the underlying attribute configuration won't
140
+ * be reflected to it.
141
+ * This ensures that you can safely work with recipient data, even if other users possibly add or change attributes.
142
+ * <p>
143
+ * However, if a recipient attribute is deleted or the type is changed, this will also not be reflected to the <i>RecipientContext</i>.
144
+ * The attribute values may still be changed without any error, though this change will not be visible in Inxmail.
145
+ * The recipient attribute will not be undeleted.
146
+ * Therefore, it is not recommended to use the same recipient context during long operations as the possibility of
147
+ * changes in the recipient attributes will rise.
148
+ * <p>
149
+ * Instead of creating a new <i>Inx_Api_Recipient_RecipientContext</i> repeatedly (possibly without any need to do this),
150
+ * it is also possible to check whether some attributes have changed.
151
+ * This can be achieved using the <i>isUpToDate()</i> method. The following snippet shows hot to use this method:
152
+ *
153
+ * <pre>
154
+ * $oRecipientContext = $oSession->createRecipientContext();
155
+ *
156
+ * while( !$taskDone )
157
+ * {
158
+ * if( !$oRecipientContext->isUpToDate() )
159
+ * {
160
+ * $oRecipientContext = $oSession->createRecipientContext();
161
+ * }
162
+ *
163
+ * // perform some operations on the recipient context
164
+ * }
165
+ * </pre>
166
+ *
167
+ * Of course this is a very simple example, though it illustrates how to update the <i>RecipientContext</i> only if needed.
168
+ * A more realistic example might be a triggered operation that checks if the <i>RecipientContext</i>is still up to date
169
+ * (possibly some time passed after the last trigger) before executing the operation.
170
+ * <p>
171
+ * <strong>Note:</strong> An <i>Inx_Api_Recipient_RecipientContext</i> object <strong>must</strong> be closed once it is
172
+ * not needed anymore to prevent memory leaks and other potentially harmful side effects.
173
+ *
174
+ * @see Inx_Api_Recipient_RecipientRowSet
175
+ * @see Inx_Api_Recipient_UnsubscriptionRecipientRowSet
176
+ * @see Inx_Api_Recipient_RecipientMetaData
177
+ * @see Inx_Api_Recipient_BatchChannel
178
+ * @see Inx_Api_Recipient_AttributeManager
179
+ * @since API 1.0
180
+ * @version $Revision: 9506 $ $Date: 2007-12-20 15:44:56 +0200 (Kt, 20 Grd 2007) $ $Author: vladas $
181
+ * @package Inxmail
182
+ * @subpackage Recipient
183
+ */
184
+ interface Inx_Api_Recipient_RecipientContext
185
+ {
186
+
187
+ /** @deprecated replaced by <i>Inx_Api_Order::ASC</i> */
188
+ const ORDER_ASC = 0;
189
+
190
+ /** @deprecated replaced by <i>Inx_Api_Order::DESC</i> */
191
+ const ORDER_DESC = 1;
192
+
193
+
194
+ /**
195
+ * Retrieves an <i>Inx_Api_Recipient_RecipientMetaData</i> object that contains meta data about the recipients
196
+ * represented by this <i>Inx_Api_Recipient_RecipientMetaData</i> object.
197
+ * The meta data includes information about the available attributes, though can not be used to retrieve the
198
+ * actual attribute values.
199
+ *
200
+ * @return Inx_Api_Recipient_RecipientMetaData an <i>Inx_Api_Recipient_RecipientMetaData</i> object that contains meta data.
201
+ */
202
+ public function getMetaData();
203
+
204
+
205
+ /**
206
+ * Returns an empty <i>Inx_Api_Recipient_RecipientRowSet</i>. Use this to add new recipients to the system.
207
+ *
208
+ * @return Inx_Api_Recipient_RecipientRowSet an empty <i>Inx_Api_Recipient_RecipientRowSet</i>.
209
+ */
210
+ public function createRowSet();
211
+
212
+ /**
213
+ * Returns an <i>Inx_Api_Recipient_RecipientRowSet</i> containing all recipients that are members of the given list
214
+ * and match the given filter and additional filter statement, ordered by the given attribute and order type.
215
+ * All of the parameters are optional and may be omitted.
216
+ * <p>
217
+ * For further information on the filter statement syntax, see the
218
+ * <i>Inx_Api_Filter_Filter::updateStatement($sStmt)</i> documentation.
219
+ *
220
+ * @param Inx_Api_List_ListContext $list all members of this list will be selected. May be omitted.
221
+ * @param Inx_Api_Filter_Filter $oFilter the selection filter. May be omitted.
222
+ * @param string $sAdditionalFilter the additional filter statement. May be omitted.
223
+ * @param Inx_Api_Recipient_Attribute $oOrderAttribute the attribute used to order the result. May be omitted.
224
+ * @param int $iOrderType the order type (<i>Inx_Api_Order::ASC</i> or <i>Inx_Api_Order::DESC</i>). May be omitted.
225
+ * @return Inx_Api_Recipient_RecipientRowSet a <i>RecipientRowSet</i> containing all recipients fetched by the given query.
226
+ * @throws Inx_Api_Recipient_SelectException if the selection failed.
227
+ */
228
+ public function select(Inx_Api_List_ListContext $list=null, Inx_Api_Filter_Filter $oFilter=null, $sAdditionalFilter=null,
229
+ Inx_Api_Recipient_Attribute $oOrderAttribute=null, $iOrderType=null);
230
+
231
+
232
+ /**
233
+ * Returns an <i>Inx_Api_Recipient_RecipientRowSet</i> containing exactly one recipient: the one with the specified key.
234
+ * If multiple recipients use that key, only the first one will be retrieved.
235
+ * If you wish to retrieve all recipients with the given key, use <i>findAllByKey($sKey)</i> instead.
236
+ *
237
+ * @param $sKey the key of the recipient to be retrieved. Usually the email address.
238
+ * @return Inx_Api_Recipient_RecipientRowSet a <i>RecipientRowSet</i> containing only the first matching recipient.
239
+ * @since API 1.9.0
240
+ */
241
+ public function findByKey( $sKey );
242
+
243
+
244
+ /**
245
+ * Returns an <i>Inx_Api_Recipient_RecipientRowSet</i> containing all recipients with the specified key.
246
+ * If multiple recipients use that key, all of them will be retrieved.
247
+ * If you wish to retrieve only the first recipient with that key, use <i>findByKey($sKey)</i> instead.
248
+ *
249
+ * @param $sKey the key of the recipients to be retrieved. Usually the email address.
250
+ * @return Inx_Api_Recipient_RecipientRowSet a <i>RecipientRowSet</i> containing all recipients with the given key.
251
+ * @since API 1.9.0
252
+ */
253
+ public function findAllByKey( $sKey );
254
+
255
+
256
+ /**
257
+ * Returns an <i>Inx_Api_Recipient_RecipientRowSet</i> containing all recipients with the specified keys.
258
+ * If multiple recipients use one of the keys, only the first one will be retrieved.
259
+ * If you wish to retrieve all recipients with that key, use <i>findAllByKeys($aKeys)</i> instead.
260
+ *
261
+ * @param $aKeys the keys of the recipients to be retrieved. Usually the email address.
262
+ * @return Inx_Api_Recipient_RecipientRowSet a <i>RecipientRowSet</i> containing all recipients with the given keys.
263
+ * @since API 1.9.0
264
+ */
265
+ public function findByKeys( $aKeys );
266
+
267
+
268
+ /**
269
+ * Returns an <i>Inx_Api_Recipient_RecipientRowSet</i> containing all recipients with the specified keys.
270
+ * If multiple recipients use one of the keys, all of them will be retrieved.
271
+ * If you wish to retrieve only the first recipient with that key, use <i>findByKeys($aKeys)</i> instead.
272
+ *
273
+ * @param $aKeys the keys of the recipients to be retrieved. Usually the email address.
274
+ * @return Inx_Api_Recipient_RecipientRowSet a <i>RecipientRowSet</i> containing all recipients with the given keys.
275
+ * @since API 1.9.0
276
+ */
277
+ public function findAllByKeys( $aKeys );
278
+
279
+
280
+ /**
281
+ * Returns an <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> containing all recipients that have been
282
+ * unsubscribed from the given list and match the given filter and additional filter statement, ordered by the
283
+ * given attribute and order type.
284
+ * All parameters except for the list are optional and may be omitted.
285
+ * <p>
286
+ * For further information on the filter statement syntax, see the
287
+ * <i>Inx_Api_Filter_Filter::updateStatement($sStmt)</i> documentation.
288
+ *
289
+ * @param Inx_Api_List_ListContext $list all recipients that have been unsubscribed from this list will be selected.
290
+ * @param Inx_Api_Filter_Filter $oFilter the selection filter. May be omitted.
291
+ * @param string $sAdditionalFilter the additional filter statement. May be omitted.
292
+ * @param Inx_Api_Recipient_Attribute $oOrderAttribute the attribute used to order the result. May be omitted.
293
+ * @param int $iOrderType the order type (<i>Inx_Api_Order::ASC</i> or <i>Inx_Api_Order::DESC</i>). May be omitted.
294
+ * @return Inx_Api_Recipient_UnsubscriptionRecipientRowSet an <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i>
295
+ * containing all recipients fetched by the given query.
296
+ * @throws Inx_Api_Recipient_SelectException if the selection failed.
297
+ * @since API 1.6.0
298
+ */
299
+ public function selectUnsubscriber( Inx_Api_List_ListContext $list, Inx_Api_Filter_Filter $oFilter=null, $sAdditionalFilter=null,
300
+ Inx_Api_Recipient_Attribute $oOrderAttribute=null, $iOrderType=null );
301
+
302
+
303
+
304
+ /**
305
+ * Sets the specified attribute value to all recipients in the system.
306
+ * Note: $newValue must be of type stdClass. To set the actual value, use the value variable.
307
+ * The following snippet demonstrates this:
308
+ * <pre>
309
+ * $value = new stdClass();
310
+ * $value->value = "the new value of any type";
311
+ *
312
+ * $oRecipientContext->setAttributeValue($oAttribute, $value);
313
+ * </pre>
314
+ *
315
+ * @param Inx_Api_Recipient_Attribute $attr the designated attribute.
316
+ * @param stdClass $newValue the new attribute value.
317
+ * @return bool <i>true</i>, if the attribute was updated on all recipients, <i>false</i> otherwise.
318
+ */
319
+ public function setAttributeValue( Inx_Api_Recipient_Attribute $attr, stdClass $newValue );
320
+
321
+
322
+
323
+ /**
324
+ * Creates an <i>Inx_Api_Recipient_BatchChannel</i> for fast recipient data manipulation with an optional
325
+ * alternative 'key attribute' to select the recipient.
326
+ *
327
+ * The type of the select attribute must be <i>Inx_Api_Recipient_Attribute::DATA_TYPE_STRING</i> or
328
+ * <i>Inx_Api_Recipient_Attribute::DATA_TYPE_INTEGER</i>.
329
+ *
330
+ * If the specified select value exists for multiple recipients, any of these recipients may be selected (undetermined).
331
+ *
332
+ * @return Inx_Api_Recipient_BatchChannel an <i>Inx_Api_Recipient_BatchChannel</i>.
333
+ */
334
+ public function createBatchChannel( Inx_Api_Recipient_Attribute $oSelectAttribute = null );
335
+
336
+
337
+ /**
338
+ * Checks whether or not this <i>Inx_Api_Recipient_RecipientContext</i> is up to date.
339
+ * If attributes were added, removed or manipulated (renamed, different type) since this
340
+ * <i>RecipientContext</i> was created, <i>false</i> will be returned.
341
+ * This information may be used to check whether the <i>RecipientContext</i> needs to be
342
+ * updated before executing the next operation.
343
+ *
344
+ * @return bool <i>true</i> if this <i>RecipientContext</i> is up to date, <i>false</i> otherwise.
345
+ */
346
+ public function isUpToDate();
347
+
348
+
349
+ /**
350
+ * Determines if the key is unique. If you have not explicitly allowed the recipient key to have duplicate values,
351
+ * you need not worry about this method.
352
+ *
353
+ * @return bool <i>true</i> if the key is unique, <i>false</i> otherwise.
354
+ */
355
+ public function isKeyUnique();
356
+
357
+
358
+ /**
359
+ * Closes this recipient context and releases any resources associated with it.
360
+ * An <i>Inx_Api_Recipient_RecipientContext</i> object <strong>must</strong> be closed once it is
361
+ * not needed anymore to prevent memory leaks and other potentially harmful side effects.
362
+ */
363
+ public function close();
364
+
365
+ }
lib/Inx/Api/Recipient/RecipientMetaData.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Recipient_RecipientMetaData</i> object contains meta data about the recipients represented by an
9
+ * <i>Inx_Api_Recipient_RecipientContext</i> object.
10
+ * The meta data includes information about the available attributes, though can not be used to retrieve the
11
+ * actual attribute values.
12
+ *
13
+ * @see Inx_Api_Recipient_RecipientContext
14
+ * @since API 1.0
15
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
16
+ * @package Inxmail
17
+ * @subpackage Recipient
18
+ */
19
+ interface Inx_Api_Recipient_RecipientMetaData
20
+ {
21
+
22
+ /**
23
+ * Returns the id attribute.
24
+ *
25
+ * @return Inx_Api_Recipient_Attribute the id attribute.
26
+ */
27
+ public function getIdAttribute();
28
+
29
+ /**
30
+ * Returns the key attribute.
31
+ *
32
+ * @return Inx_Api_Recipient_Attribute the key attribute.
33
+ */
34
+ public function getKeyAttribute();
35
+
36
+ /**
37
+ * Returns the email attribute.
38
+ *
39
+ * @return Inx_Api_Recipient_Attribute the email attribute.
40
+ */
41
+ public function getEmailAttribute();
42
+
43
+
44
+ /**
45
+ * Returns the last modification attribute.
46
+ *
47
+ * @return Inx_Api_Recipient_Attribute the last modification attribute.
48
+ */
49
+ public function getLastModificationAttribute();
50
+
51
+
52
+
53
+ /**
54
+ * Returns the hardbounce attribute.
55
+ *
56
+ * @return Inx_Api_Recipient_Attribute the hardbounce attribute.
57
+ */
58
+ public function getHardbounceAttribute();
59
+
60
+
61
+ /**
62
+ * Returns the attribute specified by the given name.
63
+ *
64
+ * @param string $sAttributeName the name of the attribute to retrieve, ignoring case considerations.
65
+ *
66
+ * @return Inx_Api_Recipient_Attribute the attribute object.
67
+ * @throws Inx_Api_Recipient_AttributeNotFoundException if the attribute could not be found.
68
+ */
69
+ public function getUserAttribute( $sAttributeName );
70
+
71
+ /**
72
+ * Returns the subscription attribute for the specified list.
73
+ * A recipient has a subscription attribute for each standard list.
74
+ *
75
+ * @param Inx_Api_List_ListContext $oList the list context.
76
+ *
77
+ * @return Inx_Api_Recipient_Attribute the attribute object.
78
+ * @throws Inx_Api_Recipient_AttributeNotFoundException if the list is not a standard list.
79
+ */
80
+ public function getSubscriptionAttribute( Inx_Api_List_ListContext $oList );
81
+
82
+ /**
83
+ * Returns the attribute specified by the given id.
84
+ *
85
+ * @param int $iAttributeId the id of the attribute to retrieve.
86
+ *
87
+ * @return Inx_Api_Recipient_Attribute the attribute object.
88
+ * @throws Inx_Api_Recipient_AttributeNotFoundException if the attribute could not be found.
89
+ */
90
+ public function getAttribute( $iAttributeId );
91
+
92
+ /**
93
+ * Returns the number of attributes.
94
+ *
95
+ * @return int the number of attributes.
96
+ */
97
+ public function getAttributeCount();
98
+
99
+ /**
100
+ * Returns an <i>Inx_Apiimpl_Recipient_RecipientContextImpl_AttributeIterator</i> over the attributes in this meta data.
101
+ * <p>
102
+ * The following snippet shows how to iterate over the recipient attributes:
103
+ *
104
+ * <pre>
105
+ * $oRecipientMetaData = $oSession->createRecipientContext()->getMetaData();
106
+ * $oAttributeIterator = $oRecipientMetaData->getAttributeIterator();
107
+ *
108
+ * while( $oAttributeIterator->hasNext() )
109
+ * {
110
+ * $oAttribute = $oAttributeIterator->current();
111
+ * echo $oAttribute->getName().&quot;&#60;br&#62;&quot;;
112
+ * $oAttributeIterator->next();
113
+ * }
114
+ * </pre>
115
+ *
116
+ * @return Inx_Apiimpl_Recipient_RecipientContextImpl_AttributeIterator an iterator over the attributes.
117
+ */
118
+ public function getAttributeIterator();
119
+
120
+ }
lib/Inx/Api/Recipient/RecipientRowSet.php ADDED
@@ -0,0 +1,487 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Recipient_RecipientRowSet</i> is best explained as a table of data representing a set of recipients,
9
+ * which is usually generated by executing a selection that queries the recipient context.
10
+ * <P>
11
+ * An <i>Inx_Api_Recipient_RecipientRowSet</i> object maintains a cursor pointing to its current row of data.
12
+ * Initially the cursor is positioned before the first row.
13
+ * The <i>next()</i> method moves the cursor to the next row (recipient), and because it returns <i>false</i> when
14
+ * there are no more rows in the <i>Inx_Api_Recipient_RecipientRowSet</i> object, it can be used in a <i>while</i>
15
+ * loop to iterate through the result set.
16
+ * <p>
17
+ * Be sure to call <i>next()</i> before the first retrieval statement on the row set.
18
+ * As stated above, initially the cursor is before the first row, thus no data can be retrieved from the row set
19
+ * before calling <i>next()</i>.
20
+ * Doing so will trigger an <i>Inx_Api_DataException</i>.
21
+ * <P>
22
+ * The <i>Inx_Api_Recipient_RecipientRowSet</i> interface provides <i>getter</i> methods (<i>getString</i>,
23
+ * <i>getInteger</i>, and so on) for retrieving attribute values from the current row.
24
+ * Values can be retrieved using the attribute object.
25
+ * <p>
26
+ * The following snippet shows how to retrieve the email address of all recipients in the row set, thus also
27
+ * illustrating how to iterate over an <i>Inx_Api_Recipient_RecipientRowSet</i>:
28
+ *
29
+ * <pre>
30
+ * $oRecipientContext = $oSession->createRecipientContext();
31
+ * $oAttribute = $oRecipientContext->getMetaData()->getEmailAttribute();
32
+ * $oRecipientRowSet = $oRecipientContext->select();
33
+ *
34
+ * while( $oRecipientRowSet->next() )
35
+ * {
36
+ * echo $oRecipientRowSet->getString( $oAttribute ).&quot;&#60;br&#62;&quot;;
37
+ * }
38
+ * </pre>
39
+ * <P>
40
+ * The update methods may be used in two ways:
41
+ * <ol>
42
+ * <LI>To update a column value in the current row.
43
+ * In an <i>Inx_Api_Recipient_RecipientRowSet</i> object, the cursor can be moved backwards and forwards, to an absolute position.
44
+ * The following snippet shows how to update the <i>Lastname</i> attribute in the fifth row of the <i>RecipientRowSet</i>
45
+ * object <i>rrs</i> and then uses the method <i>commitRowUpdate</i> to commit the changed data from which <i>rrs</i> was derived:
46
+ *
47
+ * <PRE>
48
+ * $oAttribute = $oRecipientMetaData->getUserAttribute( &quot;Lastname&quot; );
49
+ * $oRecipientRowSet->setRow(4); // moves the cursor to the fifth row of $recipientRowSet
50
+ * // updates the 'Lastname' attribute of row 4 (fifth row) to be 'Smith'
51
+ * $oRecipientRowSet->updateString( $oAttribute, "Smith" );
52
+ * $oRecipientRowSet->commitRowUpdate(); // updates the row in the data source
53
+ * </PRE>
54
+ * <LI>To insert attribute values into the insert row.
55
+ * The <i>Inx_Api_Recipient_RecipientRowSet</i> object has a special row associated with it that serves as a staging area for
56
+ * building a recipient to be inserted.
57
+ * The following snippet shows how to move the cursor to the insert row and insert the new recipient data into <i>rrs</i>
58
+ * and into the data source table using the method <i>commitRowUpdate</i>:
59
+ *
60
+ * <PRE>
61
+ * $oAttribute_email = $oRecipientMetaData->getEmailAttribute();
62
+ * $oAttribute_attr = $oRecipientMetaData->getUserAttribute( &quot;Lastname&quot; );
63
+ * $oRecipientRowSet->moveToInsertRow(); // moves cursor to the insert row
64
+ * // email attribute of the insert row to be <i>smith@gmx.com</i>
65
+ * $oRecipientRowSet->updateString( $oAttribute_email, &quot;smith@gmx.com&quot;);
66
+ * $oRecipientRowSet->updateString( $oAttribute_attr, &quot;Smith&quot;);
67
+ * $oRecipientRowSet->commitRowUpdate(); // insert the row in the data source
68
+ * </PRE>
69
+ *
70
+ * The code above will create a new recipient with the address smith@gmx.com and the last name Smith.
71
+ * Usually creating new recipients is accomplished using an empty <i>Inx_Api_Recipient_RecipientRowSet</i>.
72
+ * Such a row set can be obtained using the <i>Inx_Api_Recipient_RecipientContext::createRowSet()</i> method.
73
+ * However, the returned row set can only be used to create recipients, as there are no recipients in the row set.
74
+ * </ol>
75
+ * <p>
76
+ * All row changes except for the <i>remove()</i> and <i>setAttributeValue()</i> methods require a call of
77
+ * <i>commitRowUpdate()</i> to be reflected on the server.
78
+ * Any uncommitted changes will be lost once the <i>Inx_Api_Recipient_RecipientRowSet</i> is closed.
79
+ * However, calling <i>commitRowUpdate()</i> on deleted rows will trigger an <i>Inx_Api_DataException</i>, as the
80
+ * recipient in the current row no longer exists.
81
+ * <p>
82
+ * Note: To safely abandon all changes of the current row, use the <i>rollbackRowUpdate()</i> method.
83
+ * This will prevent any changes to the current row from being committed through <i>commitRowUpdate()</i>.
84
+ * Be aware that <i>rollbackRowUpdate</i> will only undo <i>uncommitted</i> changes to the current row.
85
+ * So, once you called <i>commitRowUpdate()</i> there is &quot;no way back&quot;.
86
+ * <p>
87
+ * <strong>Note:</strong> An <i>Inx_Api_Recipient_RecipientContext</i> object <strong>must</strong> be closed once it
88
+ * is not needed anymore to prevent memory leaks and other potentially harmful side effects.
89
+ * <p>
90
+ * For more information about recipients and the operations that can be performed on them, see the
91
+ * <i>Inx_Api_Recipient_RecipientContext</i> documentation.
92
+ *
93
+ * @see Inx_Api_Recipient_RecipientContext
94
+ * @since API 1.0
95
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
96
+ * @package Inxmail
97
+ * @subpackage Recipient
98
+ */
99
+ interface Inx_Api_Recipient_RecipientRowSet
100
+ {
101
+
102
+ /**
103
+ * Moves the cursor to the front of this <i>Inx_Api_Recipient_RecipientRowSet</i> object, just before the first row.
104
+ * This method has no effect if the result set contains no rows.
105
+ */
106
+ public function beforeFirstRow();
107
+
108
+ /**
109
+ * Moves the cursor to the end of this <i>Inx_Api_Recipient_RecipientRowSet</i> object, just after the last row.
110
+ * This method has no effect if the result set contains no rows.
111
+ */
112
+ public function afterLastRow();
113
+
114
+ /**
115
+ * Moves the cursor to the given row number in this <i>Inx_Api_Recipient_RecipientRowSet</i> object.
116
+ * The first row is row 0, the second is row 1, and so on.
117
+ *
118
+ * @param int $iRow the number of the row to which the cursor should move.
119
+ */
120
+ public function setRow( $iRow );
121
+
122
+ /**
123
+ * Retrieves the current row number. The first row is number 0, the second number 1, and so on.
124
+ *
125
+ * @return int the current row number.
126
+ */
127
+ public function getRow();
128
+
129
+ /**
130
+ * Moves the cursor down one row from its current position.
131
+ * An <i>Inx_Api_Recipient_RecipientRowSet</i> cursor is initially positioned before the first row; the first call to
132
+ * the method <i>next()</i> makes the first row the current row; the second call makes the second row the current row,
133
+ * and so on.
134
+ *
135
+ * @return bool <i>true</i> if the new current row is valid, <i>false</i> if there are no more rows.
136
+ */
137
+ public function next();
138
+
139
+ /**
140
+ * Moves the cursor to the previous row in this <i>Inx_Api_Recipient_RecipientRowSet</i> object.
141
+ *
142
+ * @return bool <i>true</i> if the cursor is on a valid row, <i>false</i> if it is off the result set.
143
+ */
144
+ public function previous();
145
+
146
+ /**
147
+ * Returns the number of rows in this <i>Inx_Api_Recipient_RecipientRowSet</i> object.
148
+ *
149
+ * @return int the number of rows.
150
+ */
151
+ public function getRowCount();
152
+
153
+ /**
154
+ * Updates the underlying recipient on the server with the new contents of the current row of this
155
+ * <i>Inx_Api_Recipient_RecipientRowSet</i> object.
156
+ *
157
+ * @throws Inx_Api_Recipient_BlackListException if the email address is blocked by a blacklist entry.
158
+ * @throws Inx_Api_Recipient_IllegalValueException if one of the attribute values is invalid.
159
+ * @throws Inx_Api_Recipient_DuplicateKeyException if the key value is already used.
160
+ * @throws Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
161
+ * <i>next()</i>).
162
+ */
163
+ public function commitRowUpdate();
164
+
165
+ /**
166
+ * Reverts the updates made to the current row in this <i>Inx_Api_Recipient_RecipientRowSet</i> object.
167
+ * This method may be called after calling one or several update methods to roll back the updates made to a row.
168
+ * If no updates have been made or <i>commitRowUpdate</i> has already been called, this method has no effect.
169
+ */
170
+ public function rollbackRowUpdate();
171
+
172
+ /**
173
+ * Deletes the current row from this <i>Inx_Api_Recipient_RecipientRowSet</i> object.
174
+ * This method cannot be called when the cursor is on the insert row.
175
+ * Do <strong>not</strong> call <i>commitRowUpdate()</i> after invoking this method, as this would trigger an
176
+ * <i>Inx_Api_DataException</i>.
177
+ */
178
+ public function deleteRow();
179
+
180
+ /**
181
+ * Deletes the specified rows from this <i>Inx_Api_Recipient_RecipientRowSet</i> object.
182
+ * Do <strong>not</strong> call <i>commitRowUpdate()</i> on an affected row after invoking this method, as this
183
+ * would trigger an <i>Inx_Api_DataException</i>.
184
+ *
185
+ * @param Inx_Api_IndexSelection $oSelection the rows to be deleted.
186
+ */
187
+ public function deleteRows( Inx_Api_IndexSelection $oSelection );
188
+
189
+ /**
190
+ * Sets the specified attribute value to the recipients in the specified selection.
191
+ * This method does <strong>not</strong> require a call to <i>commitRowUpdate()</i> to be reflected on the server.
192
+ * The selection parameter may be ommitted to set the attribute value for all recipients in this row set.
193
+ *
194
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
195
+ * @param mixed $oNewValue the new attribute value.
196
+ * @param Inx_Api_IndexSelection $oSelection the recipient rows to change the value of. May be ommitted.
197
+ * @return bool <i>true</i> if the attribute was updated, <i>false</i> otherwise.
198
+ */
199
+ public function setAttributeValue( Inx_Api_Recipient_Attribute $oAttr, $mNewValue, Inx_Api_IndexSelection $oSelection=null );
200
+
201
+ /**
202
+ * Moves the cursor to the insert row.
203
+ * The current cursor position is remembered while the cursor is positioned on the insert row.
204
+ * The insert row is a special row associated with an <i>Inx_Api_Recipient_RecipientRowSet</i>.
205
+ * It is essentially a buffer where a new row may be constructed by calling the update methods prior to inserting
206
+ * the row into the row set.
207
+ * Only the update, getter, and <i>commitRowUpdate</i> method may be called when the cursor is on the insert row.
208
+ */
209
+ public function moveToInsertRow();
210
+
211
+ /**
212
+ * Reports whether the underlying recipient is deleted or not.
213
+ *
214
+ * @return bool <i>true</i> if the underlaying recipient is deleted, <i>false</i> otherwise.
215
+ */
216
+ public function isRowDeleted();
217
+
218
+ /**
219
+ * Retrieves the recipient id of the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i> object.
220
+ *
221
+ * @return int the recipient id in the current recipient.
222
+ * @throws Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
223
+ * <i>next()</i>).
224
+ */
225
+ public function getId();
226
+
227
+ /**
228
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
229
+ * object as a <i>string</i>.
230
+ *
231
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
232
+ * @return string the attribute value as String.
233
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
234
+ * <i>next()</i>).
235
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>string</i>.
236
+ */
237
+ public function getString( Inx_Api_Recipient_Attribute $oAttr );
238
+
239
+ /**
240
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
241
+ * object as a <i>bool</i>.
242
+ *
243
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
244
+ * @return bool the attribute value as bool.
245
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
246
+ * <i>next()</i>).
247
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>bool</i>.
248
+ */
249
+ public function getBoolean( Inx_Api_Recipient_Attribute $oAttr );
250
+
251
+ /**
252
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
253
+ * object as a <i>int</i>.
254
+ *
255
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
256
+ * @return int the attribute value as int.
257
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
258
+ * <i>next()</i>).
259
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>int</i>.
260
+ */
261
+ public function getInteger( Inx_Api_Recipient_Attribute $oAttr );
262
+
263
+ /**
264
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
265
+ * object as a <i>double</i>.
266
+ *
267
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
268
+ * @return double the attribute value as double.
269
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
270
+ * <i>next()</i>).
271
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>double</i>.
272
+ */
273
+ public function getDouble( Inx_Api_Recipient_Attribute $oAttr );
274
+
275
+ /**
276
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
277
+ * object as a <i>date</i>.
278
+ *
279
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
280
+ * @return string the date value as ISO 8601 formatted date string.
281
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
282
+ * <i>next()</i>).
283
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>date</i>.
284
+ */
285
+ public function getDate( Inx_Api_Recipient_Attribute $oAttr );
286
+
287
+ /**
288
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
289
+ * object as a <i>time</i>.
290
+ *
291
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
292
+ * @return string the time value as ISO 8601 formatted time string.
293
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
294
+ * <i>next()</i>).
295
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>time</i>.
296
+ */
297
+ public function getTime( Inx_Api_Recipient_Attribute $oAttr );
298
+
299
+ /**
300
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
301
+ * object as a <i>datetime</i>.
302
+ *
303
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
304
+ * @return string the datetime value as ISO 8601 formatted datetime string.
305
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
306
+ * <i>next()</i>).
307
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>datetime</i>.
308
+ */
309
+ public function getDatetime( Inx_Api_Recipient_Attribute $oAttr );
310
+
311
+ /**
312
+ * Retrieves the value of the designated attribute in the current row of this <i>Inx_Api_Recipient_RecipientRowSet</i>
313
+ * object as the same data type as the attribute.
314
+ *
315
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
316
+ * @return mixed the attribute value.
317
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
318
+ * <i>next()</i>).
319
+ */
320
+ public function getObject( Inx_Api_Recipient_Attribute $oAttr );
321
+
322
+ /**
323
+ * Updates the designated attribute with a <i>string</i> value.
324
+ * The update methods are used to update attribute values in the current row or the insert row.
325
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
326
+ * method is called to commit the changes.
327
+ *
328
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
329
+ * @param string $sValue the new attribute value.
330
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
331
+ * <i>next()</i>).
332
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>string</i>.
333
+ */
334
+ public function updateString( Inx_Api_Recipient_Attribute $oAttr, $sValue );
335
+
336
+ /**
337
+ * Updates the designated attribute with a <i>bool</i> value.
338
+ * The update methods are used to update attribute values in the current row or the insert row.
339
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
340
+ * method is called to commit the changes.
341
+ *
342
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
343
+ * @param bool $blValue the new attribute value.
344
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
345
+ * <i>next()</i>).
346
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>bool</i>.
347
+ */
348
+ public function updateBoolean( Inx_Api_Recipient_Attribute $oAttr, $blValue );
349
+
350
+ /**
351
+ * Updates the designated attribute with a <i>int</i> value.
352
+ * The update methods are used to update attribute values in the current row or the insert row.
353
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
354
+ * method is called to commit the changes.
355
+ *
356
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
357
+ * @param int $iValue the new attribute value.
358
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
359
+ * <i>next()</i>).
360
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>int</i>.
361
+ */
362
+ public function updateInteger( Inx_Api_Recipient_Attribute $oAttr, $iValue );
363
+
364
+ /**
365
+ * Updates the designated attribute with a <i>float</i> value.
366
+ * The update methods are used to update attribute values in the current row or the insert row.
367
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
368
+ * method is called to commit the changes.
369
+ *
370
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
371
+ * @param float $iValue the new attribute value.
372
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
373
+ * <i>next()</i>).
374
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>float</i>.
375
+ */
376
+ public function updateDouble( Inx_Api_Recipient_Attribute $oAttr, $iValue );
377
+
378
+ /**
379
+ * Updates the designated attribute with a <i>date</i> value.
380
+ * The value has to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted date string.
381
+ * To format the value correctly, use one of the following methods:
382
+ * <ul>
383
+ * <li><i>ISO-8601</i>: <pre>$sDate = date("Y-m-d");</pre>
384
+ * <li><i>Unix-Timestamp</i>: <pre>$iTimestamp = time();</pre>
385
+ * </ul>
386
+ * The update methods are used to update attribute values in the current row or the insert row.
387
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
388
+ * method is called to commit the changes.
389
+ *
390
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
391
+ * @param string $dtValue the new attribute value (either a <i>Unix-Timestamp</i> or a date in the form <i>'2009-11-23'</i>).
392
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
393
+ * <i>next()</i>).
394
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>date</i>.
395
+ */
396
+ public function updateDate( Inx_Api_Recipient_Attribute $oAttr, $dtValue );
397
+
398
+ /**
399
+ * Updates the designated attribute with a <i>time</i> value.
400
+ * The value has to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted time string.
401
+ * To format the value correctly, use one of the following methods:
402
+ * <ul>
403
+ * <li><i>ISO-8601</i>: <pre>$sTime = date("H:i:sP");</pre>
404
+ * <li><i>Unix-Timestamp</i>: <pre>$iTimestamp = time();</pre>
405
+ * </ul>
406
+ * The update methods are used to update attribute values in the current row or the insert row.
407
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
408
+ * method is called to commit the changes.
409
+ *
410
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
411
+ * @param string $tValue the new attribute value (either a <i>Unix-Timestamp</i> or a date in the form <i>'21:46:59'</i>).
412
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
413
+ * <i>next()</i>).
414
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>time</i>.
415
+ */
416
+ public function updateTime( Inx_Api_Recipient_Attribute $oAttr, $tValue );
417
+
418
+ /**
419
+ * Updates the designated attribute with a <i>datetime</i> value.
420
+ * The value has to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted datetime string.
421
+ * To format the value correctly, use one of the following methods:
422
+ * <ul>
423
+ * <li><i>ISO-8601</i>: <pre>$sDatetime = date('c');</pre>
424
+ * <li><i>Unix-Timestamp</i>: <pre>$iTimestamp = time();</pre>
425
+ * </ul>
426
+ * The update methods are used to update attribute values in the current row or the insert row.
427
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
428
+ * method is called to commit the changes.
429
+ *
430
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
431
+ * @param string $sValue the new attribute value (either a <i>Unix-Timestamp</i> or an ISO 8601 date in the form <i>'2004-02-12T15:19:21+00:00'</i>).
432
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
433
+ * <i>next()</i>).
434
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>datetime</i>.
435
+ */
436
+ public function updateDatetime( Inx_Api_Recipient_Attribute $oAttr, $sValue );
437
+
438
+ /**
439
+ * Updates the designated attribute with a <i>string</i> or <i>mixed</i> value.
440
+ * Most string values can be converted regardless of their content.
441
+ * The string "test" can, for example, be converted to a boolean and will return true.
442
+ * However, this is not true for attributes of type date, time or datetime.
443
+ * These values have to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted date, time or datetime string.
444
+ * To format the value correctly, use one of the following methods, according to the datatype of the attribute:
445
+ * <ul>
446
+ * <li><i>Date</i>: <pre>$sDate = date("Y-m-d");</pre>
447
+ * <li><i>Time</i>: <pre>$sTime = date("H:i:sP");</pre>
448
+ * <li><i>Datetime</i>: <pre>$sDatetime = date('c');</pre>
449
+ * <li><i>Unix-Timestamp (works for all)</i>: <pre>$iTimestamp = time();</pre>
450
+ * </ul>
451
+ * The update methods are used to update attribute values in the current row or the insert row.
452
+ * The update methods do not update the underlying recipient on the server; instead the <i>commitRowUpdate</i>
453
+ * method is called to commit the changes.
454
+ *
455
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
456
+ * @param string|mixed $sValue the new attribute value.
457
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
458
+ * <i>next()</i>).
459
+ */
460
+ public function updateObject( Inx_Api_Recipient_Attribute $oAttr, $sValue );
461
+
462
+ /**
463
+ * Retrieves the <i>Inx_Api_Recipient_RecipientContext</i> which created this <i>Inx_Api_Recipient_RecipientRowSet</i>.
464
+ *
465
+ * @return Inx_Api_Recipient_RecipientContext the <i>Inx_Api_Recipient_RecipientContext</i> which created this
466
+ * <i>Inx_Api_Recipient_RecipientRowSet</i>.
467
+ */
468
+ public function getContext();
469
+
470
+ /**
471
+ * Retrieves the <i>Inx_Api_Recipient_RecipientMetaData</i> object associated with this
472
+ * <i>Inx_Api_RecipientRecipientRowSet</i>.
473
+ *
474
+ * @since API 1.0.1
475
+ * @return Inx_Api_Recipient_RecipientMetaData the <i>Inx_Api_Recipient_RecipientMetaData</i> object associated with this
476
+ * <i>Inx_Api_RecipientRecipientRowSet</i>.
477
+ */
478
+ public function getMetaData();
479
+
480
+ /**
481
+ * Releases the resources associated with this <i>Inx_Api_Recipient_RecipientRowSet</i> object on the server immediately.
482
+ * <p>
483
+ * An <i>Inx_Api_Recipient_RecipientContext</i> object <strong>must</strong> be closed once it
484
+ * is not needed anymore to prevent memory leaks and other potentially harmful side effects.
485
+ */
486
+ public function close();
487
+ }
lib/Inx/Api/Recipient/SelectException.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Recipient_SelectException</i> is thrown by the <i>select()</i> methods of the
9
+ * <i>Inx_Api_Recipient_RecipientContext</i> when a selection failed.
10
+ *
11
+ * @see Inx_Api_Recipient_RecipientContext
12
+ * @since API 1.0
13
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
14
+ * @package Inxmail
15
+ * @subpackage Recipient
16
+ */
17
+ class Inx_Api_Recipient_SelectException extends Exception
18
+ {
19
+
20
+ }
lib/Inx/Api/Recipient/UnsubscriptionRecipientRowSet.php ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> is best explained as a table of data representing a
9
+ * set of recipients, which is usually generated by executing a selection that queries unsubscribed recipients
10
+ * from the recipient context.
11
+ * <P>
12
+ * An <i>UnsubscriptionRecipientRowSet</i> object maintains a cursor pointing to its current row of data.
13
+ * Initially the cursor is positioned before the first row.
14
+ * The <i>next()</i> method moves the cursor to the next row (recipient), and because it returns <i>false</i> when
15
+ * there are no more rows in the <i>UnsubscriptionRecipientRowSet</i>, it can be used in a <i>while</i> loop to
16
+ * iterate through the result set.
17
+ * <p>
18
+ * Be sure to call <i>next()</i> before the first retrieval statement on the row set.
19
+ * As stated above, initially the cursor is before the first row, thus no data can be retrieved from the row set
20
+ * before calling <i>next()</i>.
21
+ * Doing so will trigger an <i>Inx_Api_DataException</i>.
22
+ * <P>
23
+ * The <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> interface provides <i>getter</i> methods (<i>getString</i>,
24
+ * <i>getInteger</i>, and so on) for retrieving attribute values from the current row.
25
+ * Values can be retrieved using the attribute object.
26
+ * <p>
27
+ * The following snippet shows how to retrieve the email address of all recipients in the row set (all recipients who
28
+ * were unsubscribed from the specified list), thus also illustrating how to iterate over an
29
+ * <i>UnsubscriptionRecipientRowSet</i>:
30
+ *
31
+ * <pre>
32
+ * $oRecipientContext = $oSession->createRecipientContext();
33
+ * $oAttribute = $oRecipientContext->getMetaData()->getEmailAttribute();
34
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
35
+ * $oUnsubscriptionRecipientRowSet = $oRecipientContext->selectUnsubscriber( $oListContext );
36
+ *
37
+ * while( $oUnsubscriptionRecipientRowSet->next() )
38
+ * {
39
+ * echo $oUnsubscriptionRecipientRowSet->getString( $oAttribute ).&quot;&#60;br&#62;&quot;;
40
+ * }
41
+ *
42
+ * $oUnsubscriptionRecipientRowSet->close();
43
+ * </pre>
44
+ * <P>
45
+ * An <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> offers no update methods.
46
+ * It's primary purpose is to resubscribe recipients, who were previously unsubscribed from a list.
47
+ * To update recipient data, either use an <i>Inx_Api_Recipient_RecipientRowSet</i> or the <I>Inx_Api_Recipient_BatchChannel</i>.
48
+ * <p>
49
+ * For resubscription of the recipient use the <i>resubscribe()</i> method.
50
+ * It offers a date parameter for setting a new subscription date.
51
+ * If you want to use the original subscription date set the parameter to <i>null</i>.
52
+ * The following snippet shows how to resubscribe the first ten recipients in the row set using the current datetime
53
+ * as subscription date:
54
+ *
55
+ * <pre>
56
+ * $oRecipientContext = $oSession->createRecipientContext();
57
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
58
+ * $oUnsubscriptionRecipientRowSet = $oRecipientContext->selectUnsubscriber( $oListContext );
59
+ *
60
+ * $oUnsubscriptionRecipientRowSet->setResubscribe( date('c'), new Inx_Api_IndexSelection( 0, 9 ) );
61
+ * $oUnsubscriptionRecipientRowSet->close();
62
+ * </pre>
63
+ *
64
+ * Note: The <i>setResubscribe()</i> methods do not require a call to <i>commitRowUpdate()</i> to be reflected on the server.
65
+ * However, the <i>resubscribe()</i> method does.
66
+ * <p>
67
+ * <strong>Note:<strong> An <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object <strong>must</strong> be closed once
68
+ * it is not needed anymore to prevent memory leaks and other potentially harmful side effects.
69
+ * <p>
70
+ * For more information about recipients and the operations that can be performed on them, see the
71
+ * <i>Inx_Api_Recipient_RecipientContext</i> documentation.
72
+ *
73
+ * @see Inx_Api_Recipient_RecipientContext
74
+ * @see Inx_Api_Recipient_RecipientRowSet
75
+ * @since API 1.6
76
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
77
+ * @package Inxmail
78
+ * @subpackage Recipient
79
+ */
80
+ interface Inx_Api_Recipient_UnsubscriptionRecipientRowSet
81
+ {
82
+
83
+ /**
84
+ * Moves the cursor to the front of this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object, just before the first row.
85
+ * This method has no effect if the result set contains no rows.
86
+ */
87
+ public function beforeFirstRow();
88
+
89
+ /**
90
+ * Moves the cursor to the end of this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object, just after the last row.
91
+ * This method has no effect if the result set contains no rows.
92
+ */
93
+ public function afterLastRow();
94
+
95
+ /**
96
+ * Moves the cursor to the given row number in this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object.
97
+ * The first row is row 0, the second is row 1, and so on.
98
+ *
99
+ * @param int $iRow the number of the row to which the cursor should move.
100
+ */
101
+ public function setRow( $iRow );
102
+
103
+ /**
104
+ * Retrieves the current row number. The first row is number 0, the second number 1, and so on.
105
+ *
106
+ * @return int the current row number.
107
+ */
108
+ public function getRow();
109
+
110
+ /**
111
+ * Moves the cursor down one row from its current position.
112
+ * An <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> cursor is initially positioned before the first row; the
113
+ * first call to the method <i>next()</i> makes the first row the current row; the second call makes the second row
114
+ * the current row, and so on.
115
+ *
116
+ * @return bool <i>true</i> if the new current row is valid, <i>false</i> if there are no more rows.
117
+ */
118
+ public function next();
119
+
120
+ /**
121
+ * Moves the cursor to the previous row in this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object.
122
+ *
123
+ * @return bool <i>true</i> if the cursor is on a valid row, <i>false</i> if it is off the result set.
124
+ */
125
+ public function previous();
126
+
127
+ /**
128
+ * Returns the number of rows in this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object.
129
+ *
130
+ * @return int the number of rows.
131
+ */
132
+ public function getRowCount();
133
+
134
+ /**
135
+ * Updates the underlying recipient on the server with the new contents of the current row of this
136
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object.
137
+ *
138
+ * @throws Inx_Api_Recipient_BlackListException if the email address is blocked by a blacklist entry.
139
+ * @throws Inx_Api_Recipient_IllegalValueException if one of the attribute values is invalid.
140
+ * @throws Inx_Api_Recipient_DuplicateKeyException if the key value is already used.
141
+ * @throws Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
142
+ * <i>next()</i>).
143
+ */
144
+ public function commitRowUpdate();
145
+
146
+
147
+ /**
148
+ * Deletes the current row from this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object.
149
+ * This method cannot be called when the cursor is on the insert row.
150
+ * Do <strong>not</strong> call <i>commitRowUpdate()</i> after invoking this method, as this would trigger an
151
+ * <i>Inx_Api_DataException</i>.
152
+ */
153
+ public function deleteRow();
154
+
155
+ /**
156
+ * Deletes the specified rows from this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object.
157
+ * Do <strong>not</strong> call <i>commitRowUpdate()</i> on an affected row after invoking this method, as this
158
+ * would trigger an <i>Inx_Api_DataException</i>.
159
+ *
160
+ * @param Inx_Api_IndexSelection $oSelection the rows to be deleted.
161
+ */
162
+ public function deleteRows( Inx_Api_IndexSelection $oSelection );
163
+
164
+ /**
165
+ * Resubscribes the recipient. The resubscription will be processed after calling <code>commitRowUpdate()</code>.
166
+ *
167
+ * @param subscriptionDate the subscription date. If <i>null</i> the original subscription date will be used.
168
+ * @since API 1.6.0
169
+ */
170
+ public function resubscribe( $subscriptionDate );
171
+
172
+
173
+ /**
174
+ * Resubscribes the recipients in the specified selection.
175
+ * If the selection is ommitted, all recipients in this row set will be resubscribed.
176
+ *
177
+ * @param subscriptionDate the subscription date. If <i>null</i> the original subscription date will be used.
178
+ * @param selection the selected rows. May be ommitted.
179
+ * @return <i>true</i>, if the recipients were resubscribed, <i>false</i> otherwise.
180
+ */
181
+ public function setResubscribe( $subscriptionDate, Inx_Api_IndexSelection $oSelection=null );
182
+
183
+
184
+ /**
185
+ * Reports whether the underlying recipient is deleted or not.
186
+ *
187
+ * @return bool <i>true</i> if the underlying recipient is deleted, <i>false</i> otherwise.
188
+ */
189
+ public function isRowDeleted();
190
+
191
+ /**
192
+ * Retrieves the recipient id in the current row of this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object.
193
+ *
194
+ * @return int the recipient id in the current row.
195
+ * @throws Inx_Api_DataException if the selected recipient is deleted.
196
+ */
197
+ public function getId();
198
+
199
+ /**
200
+ * Retrieves the value of the designated attribute in the current row of this
201
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as a <i>string</i>.
202
+ *
203
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
204
+ * @return string the attribute value as String.
205
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
206
+ * <i>next()</i>).
207
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>string</i>.
208
+ */
209
+ public function getString( Inx_Api_Recipient_Attribute $oAttr );
210
+
211
+ /**
212
+ * Retrieves the value of the designated attribute in the current row of this
213
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as a <i>bool</i>.
214
+ *
215
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
216
+ * @return bool the attribute value as bool.
217
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
218
+ * <i>next()</i>).
219
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>bool</i>.
220
+ */
221
+ public function getBoolean( Inx_Api_Recipient_Attribute $oAttr );
222
+
223
+ /**
224
+ * Retrieves the value of the designated attribute in the current row of this
225
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as a <i>int</i>.
226
+ *
227
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
228
+ * @return int the attribute value as int.
229
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
230
+ * <i>next()</i>).
231
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>int</i>.
232
+ */
233
+ public function getInteger( Inx_Api_Recipient_Attribute $oAttr );
234
+
235
+ /**
236
+ * Retrieves the value of the designated attribute in the current row of this
237
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as a <i>double</i>.
238
+ *
239
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
240
+ * @return double the attribute value as double.
241
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
242
+ * <i>next()</i>).
243
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>double</i>.
244
+ */
245
+ public function getDouble( Inx_Api_Recipient_Attribute $oAttr );
246
+
247
+ /**
248
+ * Retrieves the value of the designated attribute in the current row of this
249
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as a <i>date</i>.
250
+ *
251
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
252
+ * @return string the date value as ISO 8601 formatted date string.
253
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
254
+ * <i>next()</i>).
255
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>date</i>.
256
+ */
257
+ public function getDate( Inx_Api_Recipient_Attribute $oAttr );
258
+
259
+ /**
260
+ * Retrieves the value of the designated attribute in the current row of this
261
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as a <i>time</i>.
262
+ *
263
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
264
+ * @return string the time value as ISO 8601 formatted time string.
265
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
266
+ * <i>next()</i>).
267
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>time</i>.
268
+ */
269
+ public function getTime( Inx_Api_Recipient_Attribute $oAttr );
270
+
271
+ /**
272
+ * Retrieves the value of the designated attribute in the current row of this
273
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as a <i>datetime</i>.
274
+ *
275
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
276
+ * @return string the datetime value as ISO 8601 formatted datetime string.
277
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
278
+ * <i>next()</i>).
279
+ * @exception Inx_Api_IllegalStateException if the attribute is not of type <i>datetime</i>.
280
+ */
281
+ public function getDatetime( Inx_Api_Recipient_Attribute $oAttr );
282
+
283
+ /**
284
+ * Retrieves the value of the designated attribute in the current row of this
285
+ * <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object as the same data type as the attribute.
286
+ *
287
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
288
+ * @return mixed the attribute value.
289
+ * @exception Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call
290
+ * <i>next()</i>).
291
+ */
292
+ public function getObject( Inx_Api_Recipient_Attribute $oAttr );
293
+
294
+
295
+ /**
296
+ * Releases the resources associated with this <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object on
297
+ * the server immediately.
298
+ * <p>
299
+ * An <i>Inx_Api_Recipient_UnsubscriptionRecipientRowSet</i> object <strong>must</strong> be closed once
300
+ * it is not needed anymore to prevent memory leaks and other potentially harmful side effects.
301
+ */
302
+ public function close();
303
+ }
lib/Inx/Api/RemoteException.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * @package Inxmail
7
+ */
8
+ class Inx_Api_RemoteException extends Exception
9
+ {
10
+ protected $_oOrigExc = null;
11
+
12
+ /**
13
+ * Enter description here...
14
+ *
15
+ * @param string $sMsg
16
+ * @param int $iCode
17
+ * @param Exception $oOrigExc original exception object
18
+ */
19
+ public function __construct($sMsg, $iCode=null, $oOrigExc=null)
20
+ {
21
+ $this->_oOrigExc = $oOrigExc;
22
+ parent::__construct($sMsg, $iCode);
23
+ }
24
+ /**
25
+ * @return Exception object
26
+ */
27
+ public function getOrigException()
28
+ {
29
+ return $this->_oOrigExc;
30
+ }
31
+ }
lib/Inx/Api/Reporting/ConfigDescriptor.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Reporting
6
+ */
7
+ /**
8
+ * Every report type has a configuration descriptor.
9
+ * The <i>Inx_Api_Reporting_ConfigDescriptor</i> describes the structure and elements of the report configuration area.
10
+ * A <i>ConfigDescriptor</i> contains a set of <i>Inx_Api_Reporting_ControlUnit</i>s (mostly zero or one) which in turn
11
+ * contain a set of <i>Inx_Api_Reporting_Control</i>s.
12
+ * An <i>Inx_Api_Reporting_Control</i> describes a configuration element like the list or mailing chooser.
13
+ * <p>
14
+ * The following snippet shows how to print out the content of the <i>ConfigurationDescriptor</i> for the
15
+ * ClickReactionTimeResponse report:
16
+ *
17
+ * <pre>
18
+ * $oReportEngine = $oSession->getReportEngine();
19
+ * $oConfigDescriptor = $oReportEngine->getDescriptor( &quot;ClickReactionTimeResponse&quot;, &quot;en_GB&quot; );
20
+ *
21
+ * echo &quot;&#60;pre&#62;&quot;;
22
+ * echo &quot;Localized Report Title: &quot;.$oConfigDescriptor->getTitle().&quot;&#60;br&#62;&#60;br&#62;&quot;;
23
+ *
24
+ * for( $i = 0; $i &lt; $oConfigDescriptor->getControlUnitCount(); $i++ )
25
+ * {
26
+ * echo &quot;Control Unit #&quot;.$i.&quot;:&#60;br&#62;&quot;;
27
+ * $oControlUnit = $oConfigDescriptor->getControlUnit( $i );
28
+ *
29
+ * echo &quot;Localized control title: &quot;.$oControlUnit->getTitle().&quot;&#60;br&#62;&quot;;
30
+ *
31
+ * for( $j = 0; $j &lt; $oControlUnit->getControlCount(); $j++ )
32
+ * {
33
+ * $oControl = $oControlUnit->getControl( $j );
34
+ *
35
+ * echo &quot; Control #&quot;.$j.&quot;:&#60;br&#62;&quot;;
36
+ * echo &quot; Control type: &quot;.$oControl->getType().&quot;&#60;br&#62;&quot;;
37
+ *
38
+ * foreach( $oControl->getPropertyKeys() as $sKey )
39
+ * {
40
+ * echo &quot; Key: &quot;.$sKey.&quot; - Value: &quot;.$oControl->getProperty( $sKey ).&quot;&#60;br&#62;&quot;;
41
+ * }
42
+ * }
43
+ * }
44
+ *
45
+ * echo &quot;&#60;/pre&#62;&quot;;
46
+ * </pre>
47
+ *
48
+ * This snippet will produce the following output:
49
+ *
50
+ * <pre>
51
+ * Localized Report Title: Clicks over time
52
+ *
53
+ * Control Unit #0:
54
+ * Localized control title: Settings
55
+ * Control #0:
56
+ * Control type: mailingChooser
57
+ * Key: listTitle - Value: Mailing list:
58
+ * Key: mailingTitle - Value: Mailing:
59
+ * Key: listBind - Value: listid
60
+ * Key: mailingBind - Value: mailingid
61
+ * Control #1:
62
+ * Control type: simpleTimeIntervalControl
63
+ * Key: title - Value: Report time period:
64
+ * Key: countBind - Value: count
65
+ * Key: intervalBind - Value: interval
66
+ * Key: clause - Value: until today
67
+ * </pre>
68
+ * <p>
69
+ * For more information on controls, see the <i>Inx_Api_Reporting_Control</i> documentation.
70
+ *
71
+ * @see Inx_Api_Reporting_ReportEngine
72
+ * @see Inx_Api_Reporting_ControlUnit
73
+ * @see Inx_Api_Reporting_Control
74
+ * @since API 1.3
75
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
76
+ * @package Inxmail
77
+ * @subpackage Reporting
78
+ */
79
+ interface Inx_Api_Reporting_ConfigDescriptor
80
+ {
81
+
82
+ /**
83
+ * Returns the localized title of this report.
84
+ *
85
+ * @return string the localized title of this report.
86
+ */
87
+ public function getTitle();
88
+
89
+
90
+ /**
91
+ * Returns the <i>Inx_Api_Reporting_ControlUnit</i> at the specified position.
92
+ *
93
+ * @param int $iIndex the index of the control unit to return.
94
+ * @return Inx_Api_Reporting_ControlUnit the control unit at the specified position.
95
+ */
96
+ public function getControlUnit( $iIndex );
97
+
98
+
99
+ /**
100
+ * Returns the number of <i>Inx_Api_Reporting_ControlUnit</i>s.
101
+ *
102
+ * @return int the number of control units.
103
+ */
104
+ public function getControlUnitCount();
105
+
106
+ }
lib/Inx/Api/Reporting/Control.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Reporting
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Reporting_Control</i> describes a configuration element like the list or mailing chooser.
9
+ * You can determine which element a <i>Control</i> describes using the <i>getType()</i> method.
10
+ * For a list of all available types, see below.
11
+ * A <i>Control</i> also provides some localized labels and the names of the value bindings, used to set
12
+ * the value of a property.
13
+ * <p>
14
+ * The following snippet shows how to use <i>getProperty($sKey)</i> to acquire the parameter bindings:
15
+ *
16
+ * <pre>
17
+ * $domainParam = $domainControl->getProperty( "bind" ); // $domainControl is of type stringControl
18
+ * $intervalParam = $timeIntervalChooser->getProperty( "intervalBind" );
19
+ * $countParam = $timeIntervalChooser->getProperty( "countBind" );
20
+ *
21
+ * $oReportRequest = new Inx_Api_Reporting_ReportRequest( "IncomingMailDetailsForDomain",
22
+ * Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_HTML, "de_DE", "Europe/Berlin" );
23
+ * $oReportRequest->putParameter( $domainParam, "org" );
24
+ * $oReportRequest->putParameter( $intervalParam, "day" );
25
+ * $oReportRequest->putParameter( $countParam, "14" );
26
+ * </pre>
27
+ * <p>
28
+ * <b><u>Supported control types since Inxmail 3.5:</u></b>
29
+ * <p>
30
+ * <b>stringControl</b><br>
31
+ * This control has following properties:<br>
32
+ * title - the localized title of the control<br>
33
+ * bind - the unique parameter key (like "domain"); the value as string (like "com")<br>
34
+ * <p>
35
+ * <b>timeIntervalChooser</b><br>
36
+ * title - the localized title of this control<br>
37
+ * beginBind - the unique parameter key; the begin date of the interval as number of milliseconds since January 1, 1970,
38
+ * 00:00:00 GMT<br>
39
+ * endBind - the unique parameter key; the end date of the interval as number of milliseconds since January 1, 1970,
40
+ * 00:00:00 GMT<br>
41
+ * intervalBind - the unique parameter key; the interval type - hour, day, week and month<br>
42
+ * countBind - the unique parameter key; the count of intervals<br>
43
+ * <p>
44
+ * <b>simpleTimeIntervalControl</b><br>
45
+ * title - the localized title of this control<br>
46
+ * clause - the localized title of this control<br>
47
+ * intervalBind - the unique parameter key; the interval type - hour, day, week and month<br>
48
+ * countBind - the unique parameter key; the count of intervals<br>
49
+ * <p>
50
+ * <b>dateSpanControl</b><br>
51
+ * title - the localized title of this control<br>
52
+ * beginBind - the unique parameter key; the begin date of the interval as number of milliseconds since January 1, 1970,
53
+ * 00:00:00 GMT<br>
54
+ * endBind - the unique parameter key; the end date of the interval as number of milliseconds since January 1, 1970,
55
+ * 00:00:00 GMT<br>
56
+ * countBind - the unique parameter key; the count of intervals<br>
57
+ * <p>
58
+ * <b>limitControl</b><br>
59
+ * title - the localized title of this control<br>
60
+ * bind - the unique parameter key (like "limit"); the integer value as string (like "25")<br>
61
+ * <p>
62
+ * <b>attributeChooser</b><br>
63
+ * title - the localized title of this control<br>
64
+ * bind - the unique parameter key (like "attrid"); the parameter value is the attribute id<br>
65
+ * <p>
66
+ * <b>listChooser</b><br>
67
+ * title - the localized title of this control<br>
68
+ * bind - the unique parameter key (like "listid"); the parameter value is the list id<br>
69
+ * <p>
70
+ * <b>mailingChooser</b><br>
71
+ * listTitle - the localized title of this control<br>
72
+ * mailingTitle - the localized title of this control<br>
73
+ * listBind - the unique parameter key (like "attrid"); the parameter value is the attribute id<br>
74
+ * mailingBind - the unique parameter key (like "listid"); the parameter value is the list id<br>
75
+ * <p>
76
+ * <b>checkboxControl</b><br>
77
+ * title - the localized title of this control<br>
78
+ * bind - the unique parameter key (like "enabled1"); the valid values are "true" and "false"<br>
79
+ * <p>
80
+ * For more information on the report configuration in general, see the <i>Inx_Api_Reporting_ConfigDescriptor</i> documentation.
81
+ *
82
+ * @see Inx_Api_Reporting_ControlUnit
83
+ * @see Inx_Api_Reporting_ConfigDescriptor
84
+ * @since API 1.3
85
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
86
+ * @package Inxmail
87
+ * @subpackage Reporting
88
+ */
89
+ interface Inx_Api_Reporting_Control
90
+ {
91
+
92
+ /**
93
+ * Returns the type of this control.
94
+ * <p>
95
+ * The supported types are:
96
+ * <ul>
97
+ * <li>stringControl,
98
+ * <li>timeIntervalChooser,
99
+ * <li>simpleTimeIntervalControl,
100
+ * <li>dateSpanControl,
101
+ * <li>limitControl,
102
+ * <li>attributeChooser,
103
+ * <li>listChooser,
104
+ * <li>mailingChooser and
105
+ * <li>checkboxControl
106
+ * </ul>
107
+ *
108
+ * @return string the type of this control.
109
+ */
110
+ public function getType();
111
+
112
+
113
+ /**
114
+ * Returns the value to which this control maps the specified key.
115
+ * The control contains localized titles and parameter bindings.
116
+ *
117
+ * @param string $sKey the key whose associated value shall be returned.
118
+ * @return string the value to which this control maps the specified key.
119
+ */
120
+ public function getProperty( $sKey );
121
+
122
+
123
+ /**
124
+ * Returns an array of the keys contained in this control.
125
+ *
126
+ * @return array an array of the keys.
127
+ */
128
+ public function getPropertyKeys();
129
+ }
lib/Inx/Api/Reporting/ControlUnit.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Reporting
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Reporting_ControlUnit</i> describes the configuration area of a report.
9
+ * It holds the localized title and a list of <i>Inx_Api_Reporting_Control</i>s.
10
+ * <i>Inx_Api_Reporting_Control</i>s describe configuration elements like the list or mailing chooser.
11
+ * <p>
12
+ * For more information on controls, see the <i>Inx_Api_Reporting_Control</i> documentation.
13
+ * <p>
14
+ * For more information on the report configuration in general, see the <i>Inx_Api_Reporting_ConfigDescriptor</i> documentation.
15
+ *
16
+ * @see Inx_Api_Reporting_ConfigDescriptor
17
+ * @see Inx_Api_Reporting_Control
18
+ * @since API 1.3
19
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
20
+ * @package Inxmail
21
+ * @subpackage Reporting
22
+ */
23
+ interface Inx_Api_Reporting_ControlUnit
24
+ {
25
+
26
+ /**
27
+ * Returns the localized title of this control unit.
28
+ *
29
+ * @return string the localized title of this control unit.
30
+ */
31
+ public function getTitle();
32
+
33
+
34
+ /**
35
+ * Returns the control at the specified position.
36
+ *
37
+ * @param int $iIndex the index of the control to return.
38
+ * @return Inx_Api_Reporting_Control the control at the specified position.
39
+ */
40
+ public function getControl( $iIndex );
41
+
42
+
43
+ /**
44
+ * Returns the number of controls.
45
+ *
46
+ * @return int the number of controls.
47
+ */
48
+ public function getControlCount();
49
+
50
+ }
lib/Inx/Api/Reporting/DownloadableResult.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Reporting
6
+ */
7
+ /**
8
+ * Use the <i>Inx_Api_Reporting_DownloadableResult</i> to download a generated report.
9
+ * A <i>DownloadableResult</i> can be obtained using <i>Inx_Api_Reporting_ReportTicket::fetchDownloadableResult()</i>.
10
+ * The report ticket is returned by <i>Inx_Api_Reporting_ReportEngine::generate($oRequest, $blIgnoreCache)</i>.
11
+ * As the report generation is an asynchronous process, the <i>DownloadableResult</i> must be polled.
12
+ * <i>Inx_Api_Reporting_ReportTicket::fetchDownloadableResult()</i> will return <i>null</i> as long as the report
13
+ * generation has not finished.
14
+ * <p/>
15
+ * The following snippet shows how to download a report using the <i>DownloadableResult</i>:
16
+ *
17
+ * <pre>
18
+ * $oResult = $oReportTicket->fetchDownloadableResult();
19
+ * while( $oResult == null )
20
+ * {
21
+ * sleep( 3 );
22
+ * $oResult = $oReportTicket->fetchDownloadableResult();
23
+ * }
24
+ *
25
+ * $sOutputFile = &quot;SystemDomainDistribution.pdf&quot;;
26
+ * download( $oResult->getInputStream(), $sOutputFile );
27
+ *
28
+ * if( $oReportTicket != null )
29
+ * {
30
+ * $oReportTicket->close();
31
+ * }
32
+ * </pre>
33
+ * <p/>
34
+ * Some output formats (e.g. <code>OUTPUT_FORMAT_HTML</code>, <code>OUTPUT_FORMAT_HTML_INXLINKS</code> or
35
+ * <code>OUTPUT_FORMAT_CSV</code>) are provide as ZIP compressed archive file, as these formats usually contain several
36
+ * files.
37
+ * The PDF output formats on the other hand are provided as single PDF files.
38
+ * The <code>download()</code> method presented in the following snippet is used to download these files, but will not
39
+ * uncompress ZIP files:
40
+ *
41
+ * <pre>
42
+ * function download($inputStream, $sFileName)
43
+ * {
44
+ * $handle = fopen($sFileName, 'w+b');
45
+ * while (($ch = $inputStream->read()) != -1)
46
+ * {
47
+ * fwrite($handle, $ch);
48
+ * }
49
+ *
50
+ * $inputStream->close();
51
+ * fclose($handle);
52
+ * }
53
+ * </pre>
54
+ * <p/>
55
+ * For a more complete example on how to generate and download reports, see the <i>Inx_Api_Reporting_ReportEngine</i> documentation.
56
+ *
57
+ * @see Inx_Api_Reporting_ReportEngine
58
+ * @since API 1.3
59
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
60
+ * @package Inxmail
61
+ * @subpackage Reporting
62
+ */
63
+ interface Inx_Api_Reporting_DownloadableResult
64
+ {
65
+
66
+ /**
67
+ * Returns an <i>Inx_Api_InputStream</i> which can be used to download the report.
68
+ *
69
+ * @return Inx_Api_InputStream an <i>Inx_Api_InputStream</i> to download the report.
70
+ */
71
+ public function getInputStream();
72
+
73
+
74
+ /**
75
+ * This method returns the content type of the data in the form of a string.
76
+ * <p/>
77
+ * It always returns one of the following types:
78
+ * <ol>
79
+ * <li>"zip" - if the output format is one of:
80
+ * <ul>
81
+ * <li><i>Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_HTML</i>,</li>
82
+ * <li><i>Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_HTML_INXLINKS</i> or</li>
83
+ * <li><i>Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_CSV</i></li>
84
+ * </ul>
85
+ * </li>
86
+ * <li>"pdf" - if the output format is one of
87
+ * <ul>
88
+ * <li><i>Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_A4</i></li>
89
+ * <li><i>Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_US_LETTER</i></li>
90
+ * <li><i>Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_US_LEGAL</i></li>
91
+ * </ul>
92
+ * </li>
93
+ * </ol>
94
+ *
95
+ * @return string the content type.
96
+ */
97
+ public function getContentType();
98
+
99
+
100
+ /**
101
+ * Returns the creation date of this report.
102
+ * The date will be returned as ISO-8601 formatted datetime string.
103
+ *
104
+ * @return string the creation date of this report.
105
+ */
106
+ public function getCreationDate();
107
+
108
+ }
lib/Inx/Api/Reporting/ReportEngine.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Reporting
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Reporting_ReportEngine</i> is used to generate reports.
8
+ * To generate a report, you first need to create an <i>Inx_Api_Reporting_ReportRequest</i> which contains the relevant
9
+ * information needed to generate the report:
10
+ * <p>
11
+ * <ul>
12
+ * <li>The report name
13
+ * <li>The output format (e.g. OUTPUT_FORMAT_HTML, OUTPUT_FORMAT_PDF_A4)
14
+ * <li>The output locale (e.g. "de_DE", "en_GB")
15
+ * <li>The output time zone (e.g. "Europe/Berlin", "America/New_York")
16
+ * <li>Probably some report specific properties (e.g. "listid")
17
+ * </ul>
18
+ * The report request is sent to the server where the actual report generation takes place.
19
+ * The <i>ReportEngine</i> returns an <i>Inx_Api_Reporting_ReportTicket</i> which can be used to retrieve the result as
20
+ * <i>Inx_Api_Reporting_DownloadableResult</i>.
21
+ * However, be aware that the report generation is processed asynchronous.
22
+ * Therefore, the <i>DownloadableResult</i> must be polled until it is available.
23
+ * Once it is available an <i>Inx_Api_InputStream</i> may be retrieved which can be used to download the report in the
24
+ * desired output format.
25
+ * <p>
26
+ * The following snippet shows how to download the report 'SystemDomainDistribution' as PDF report in the
27
+ * German locale and time zone with a limit of 20 entries and save it to the file 'SystemDomainDistribution.pdf':
28
+ *
29
+ * <pre>
30
+ * $oReportRequest = new Inx_Api_Reporting_ReportRequest( &quot;SystemDomainDistribution&quot;,
31
+ * Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_A4, &quot;de_DE&quot;, &quot;Europe/Berlin&quot; );
32
+ * $oReportRequest->putParameter( &quot;limit&quot;, &quot;20&quot; );
33
+ *
34
+ * $oReportEngine = $oSession->getReportEngine();
35
+ * $oReportTicket = $oReportEngine->generate( $oReportRequest, false );
36
+ *
37
+ * $oResult = $oReportTicket->fetchDownloadableResult();
38
+ * while( $oResult == null )
39
+ * {
40
+ * sleep( 3 );
41
+ * $oResult = $oReportTicket->fetchDownloadableResult();
42
+ * }
43
+ *
44
+ * $sOutputFile = &quot;SystemDomainDistribution.pdf&quot;;
45
+ * download( $oResult->getInputStream(), $sOutputFile );
46
+ *
47
+ * if( $oReportTicket != null )
48
+ * {
49
+ * $oReportTicket->close();
50
+ * }
51
+ * </pre>
52
+ * <p>
53
+ * The <i>download()</i> method - which is not part of the API - may be used to save the report to a file on disk.
54
+ * The following snippet shows the definition of the <i>download()</i> method:
55
+ * <p>
56
+ *
57
+ * <pre>
58
+ * function download($inputStream, $sFileName)
59
+ * {
60
+ * $handle = fopen($sFileName, 'w+b');
61
+ * while (($ch = $inputStream->read()) != -1)
62
+ * {
63
+ * fwrite($handle, $ch);
64
+ * }
65
+ *
66
+ * $inputStream->close();
67
+ * fclose($handle);
68
+ * }
69
+ * </pre>
70
+ * <p>
71
+ * For a complete list of the available reports and the properties associated with them, see Appendix A of the API
72
+ * developer guide.
73
+ *
74
+ * @see Inx_Api_Reporting_ReportRequest
75
+ * @see Inx_Api_Reporting_ReportTicket
76
+ * @since API 1.3
77
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
78
+ * @package Inxmail
79
+ * @subpackage Reporting
80
+ */
81
+ interface Inx_Api_Reporting_ReportEngine
82
+ {
83
+
84
+ /**
85
+ * This method is used to initiate the generation of the report specified by the given <i>Inx_Api_Reporting_ReportRequest</i>.
86
+ * The returned <i>Inx_Api_Reporting_ReportTicket</i> may be used to poll for the <i>Inx_Api_Reporting_DownloadableResult</i>
87
+ * used to download the generated report.
88
+ * For an example on how to do this, see the documentation of this class.
89
+ *
90
+ * @param Inx_Api_Reporting_ReportRequest $oRequest the description of the report to generate.
91
+ * @param boolean $blIgnoreCache <i>true</i> if the cache shall be ignored, <i>false</i> otherwise.
92
+ * This will force the report to be generated instead of using a previously generated report.
93
+ * @return Inx_Api_Reporting_ReportTicket a report ticket which can be used to poll for the <i>DownloadableResult</i>.
94
+ */
95
+ public function generate( Inx_Api_Reporting_ReportRequest $oRequest, $blIgnoreCache );
96
+
97
+
98
+ /**
99
+ * Returns all names of the default and custom report types.
100
+ *
101
+ * @return array all names of the default and custom report types.
102
+ */
103
+ public function getReportNames();
104
+
105
+
106
+ /**
107
+ * Returns the localized <i>Inx_Api_Reporting_ConfigDescriptor</i> of the specified report.
108
+ * The <i>ConfigDescriptor</i> describes the structure and elements of the report configuration area.
109
+ * A <i>ConfigDescriptor</i> contains a set of <i>Inx_Api_Reporting_ControlUnit</i>s which in turn contain a set
110
+ * of <i>Inx_Api_Reporting_Control</i>s.
111
+ * A <i>Control</i> describes a configuration element like the list or mailing chooser.
112
+ *
113
+ * @param string $sReportName the name of the report whose configuration descriptor shall be returned.
114
+ * @param string $sLocale the locale in which the <code>ConfigDescriptor</code> shall be returned. Use the name of the
115
+ * locale, with the language (defined by ISO-639) or the language and country (defined by ISO-3166)
116
+ * separated by an underscore. For example: "de_DE", "de_CH", "de", "en", "en_GB", "it_IT", "fr_FR"
117
+ * @return Inx_Api_Reporting_ConfigDescriptor the localized descriptor of the specified report, or null if the report
118
+ * name is unknown.
119
+ */
120
+ public function getDescriptor( $sReportName, $sLocale );
121
+
122
+
123
+ /**
124
+ * Returns all supported time zones.
125
+ *
126
+ * @return array all supported time zones as string array.
127
+ */
128
+ public function getSupportedTimeZones();
129
+ }
lib/Inx/Api/Reporting/ReportException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Reporting
6
+ */
7
+ /**
8
+ * This exception may be thrown by <i>Inx_Api_Reporting_ReportTicket::fetchDownloadableResult()</i> if an
9
+ * invalid configuration of the <i>Inx_Api_Reporting_ReportRequest</i> or an internal runtime error was detected.
10
+ *
11
+ * @since API 1.3
12
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
13
+ * @package Inxmail
14
+ * @subpackage Reporting
15
+ */
16
+ class Inx_Api_Reporting_ReportException extends Exception
17
+ {
18
+
19
+ }
lib/Inx/Api/Reporting/ReportRequest.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Reporting
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Reporting_ReportRequest</i> describes a report to be generated.
9
+ * To generate a report, you first need to create a <i>ReportRequest</i> which contains the relevant information
10
+ * needed to generate the report:
11
+ * <p>
12
+ * <ul>
13
+ * <li>The report name
14
+ * <li>The output format (e.g. OUTPUT_FORMAT_HTML, OUTPUT_FORMAT_PDF_A4)
15
+ * <li>The output locale (e.g. "de_DE", "en_US")
16
+ * <li>The output time zone (e.g. "Europe/Berlin", "America/New_York")
17
+ * <li>Probably some report specific properties (e.g. "listid", "limit")
18
+ * </ul>
19
+ * The report request is sent to the server where the actual report generation takes place.
20
+ * <p>
21
+ * To specify dates, like the begin or end date of a report, use <i>putParameter()</i> and specify the number of
22
+ * milliseconds since the epoch.
23
+ * To do so, use the <i>strtotime()</i> function.
24
+ * The following snippet shows how to specify an end date one week ago:
25
+ *
26
+ * <pre>
27
+ * //strtotime returns the seconds since the epoch -> * 1000
28
+ * $iOneWeekAgo = strtotime("-1 week") * 1000;
29
+ *
30
+ * $oReportRequest = ...
31
+ * $oReportRequest->putParameter("end", $iOneWeekAgo);
32
+ * </pre>
33
+ *
34
+ * To pass a specific date, use the english date format (YYYY-MM-DD HH:MM:SS).
35
+ * The following snippet shows how to specify the begin date 2000-01-01 00:00:
36
+ *
37
+ * <pre>
38
+ * //strtotime returns the seconds since the epoch -> * 1000
39
+ * $iMillennium = strtotime("2000-01-01 00:00") * 1000;
40
+ *
41
+ * $oReportRequest = ...
42
+ * $oReportRequest->putParameter("begin", $iMillennium);
43
+ * </pre>
44
+ * <p>
45
+ * For an example on how to retrieve a report, see the <i>Inx_Api_Reporting_ReportEngine</i> documentation.
46
+ *
47
+ * @see Inx_Api_Reporting_ReportEngine
48
+ * @since API 1.3
49
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
50
+ * @package Inxmail
51
+ * @subpackage Reporting
52
+ */
53
+ class Inx_Api_Reporting_ReportRequest
54
+ {
55
+
56
+ /** Output format: HTML with inxmail special hyperlinks */
57
+ const OUTPUT_FORMAT_HTML_INXLINKS = 10;
58
+
59
+ /** Output format: HTML */
60
+ const OUTPUT_FORMAT_HTML = 11;
61
+
62
+ /** Output format: Character Separated Values (CSV) */
63
+ const OUTPUT_FORMAT_CSV = 20;
64
+
65
+ /** Output format: PDF on A4 page size */
66
+ const OUTPUT_FORMAT_PDF_A4 = 30;
67
+
68
+ /** Output format: PDF on US-Letter page size */
69
+ const OUTPUT_FORMAT_PDF_US_LETTER = 31;
70
+
71
+ /** Output format: PDF on US-Legal page size */
72
+ const OUTPUT_FORMAT_PDF_US_LEGAL = 32;
73
+
74
+ /**
75
+ * The technical report name.
76
+ * @var string
77
+ */
78
+ private $sReportName;
79
+
80
+ /**
81
+ * The output format.
82
+ * @var int
83
+ */
84
+ private $sOutputFormat;
85
+
86
+ /**
87
+ * The output locale.
88
+ * @var string
89
+ */
90
+ private $sOutputLocale;
91
+
92
+ /**
93
+ * The output time zone.
94
+ * @var string
95
+ */
96
+ private $sOutputTimeZone;
97
+
98
+ /**
99
+ * The set of parameters for the report.
100
+ * @var associative array
101
+ */
102
+ private $aParameterMap = array();
103
+
104
+
105
+ /**
106
+ * Creates a new report request object for the report specified by the given name.
107
+ * The report will be generated in the given output format, using the specified locale and time zone.
108
+ *
109
+ * @param string $sReportName the name of the report to generate.
110
+ * For a full list of the supported reports, see Appendix A of the API Developer Guide.
111
+ * @param int $sOutputFormat the output format. The supported formats are:
112
+ * <ul>
113
+ * <li><i>OUTPUT_FORMAT_HTML_INXLINKS</i>
114
+ * <li><i>OUTPUT_FORMAT_HTML</i>
115
+ * <li><i>OUTPUT_FORMAT_PDF_A4</i>
116
+ * <li><i>OUTPUT_FORMAT_PDF_US_LETTER</i>
117
+ * <li><i>OUTPUT_FORMAT_PDF_US_LEGAL</i>
118
+ * <li><i>OUTPUT_FORMAT_CSV</i>
119
+ * </ul>
120
+ * @param string $sOutputLocale the output locale.
121
+ * Use the name of the locale, with the language (defined by ISO-639) or the language and country
122
+ * (defined by ISO-3166) separated by an underscore.
123
+ * For example: "de_DE", "de_CH", "de", "en", "en_GB", "it_IT", "fr_FR"
124
+ * @param string $sOutputTimeZone the output time zone.
125
+ * Use <i>Inx_Api_Reporting_ReportEngine::getSupportedTimeZones()</i> to find out which time zones
126
+ * are supported.
127
+ * For example: "Europe/Berlin", "Europe/Rome", "America/New_York"
128
+ */
129
+ public function __construct( $sReportName, $sOutputFormat,
130
+ $sOutputLocale, $sOutputTimeZone )
131
+ {
132
+ $this->sReportName = $sReportName;
133
+ $this->sOutputFormat = $sOutputFormat;
134
+ $this->sOutputLocale = $sOutputLocale;
135
+ $this->sOutputTimeZone = $sOutputTimeZone;
136
+ }
137
+
138
+
139
+ /**
140
+ * Returns the name of the report to generate.
141
+ *
142
+ * @return string the name of the report.
143
+ */
144
+ public function getReportName()
145
+ {
146
+ return $this->sReportName;
147
+ }
148
+
149
+
150
+ /**
151
+ * Returns the output format of the report. May be one of:
152
+ * <ul>
153
+ * <li><i>OUTPUT_FORMAT_HTML_INXLINKS</i>
154
+ * <li><i>OUTPUT_FORMAT_HTML</i>
155
+ * <li><i>OUTPUT_FORMAT_PDF_A4</i>
156
+ * <li><i>OUTPUT_FORMAT_PDF_US_LETTER</i>
157
+ * <li><i>OUTPUT_FORMAT_PDF_US_LEGAL</i>
158
+ * <li><i>OUTPUT_FORMAT_CSV</i>
159
+ * </ul>
160
+ *
161
+ * @return int the output format.
162
+ */
163
+ public function getOutputFormat()
164
+ {
165
+ return $this->sOutputFormat;
166
+ }
167
+
168
+
169
+ /**
170
+ * Returns the output locale of the report.
171
+ * Use the name of the locale, with the language (defined by ISO-639) or the language and
172
+ * country (defined by ISO-3166) separated by an underscore.
173
+ * <p>
174
+ * For example: "de", "de_CH", "en", "en_GB", "it", "fr"
175
+ *
176
+ * @return string the output locale of the report.
177
+ */
178
+ public function getOutputLocale()
179
+ {
180
+ return $this->sOutputLocale;
181
+ }
182
+
183
+
184
+ /**
185
+ * Returns the output time zone of the report.
186
+ * Use <i>Inx_Api_Reporting_ReportEngine::getSupportedTimeZones()</i> to find out which
187
+ * time zones are supported.
188
+ * <p>
189
+ * For example: "Europe/Berlin", "Europe/Rome", "America/New_York"
190
+ *
191
+ * @return string the output time zone of the report.
192
+ */
193
+ public function getOutputTimeZone()
194
+ {
195
+ return $this->sOutputTimeZone;
196
+ }
197
+
198
+
199
+ /**
200
+ * Returns the value to which this <i>Inx_Api_Reportin_ReportRequest</i> maps the specified key.
201
+ * Returns <i>null</i> if this report request contains no mapping for this key.
202
+ *
203
+ * @param string $sKey the key whose value shall be returned.
204
+ * @return string the value to which this <i>ReportRequest</i> maps the specified key, or <i>null</i> if this
205
+ * report request contains no mapping for this key.
206
+ */
207
+ public function getParameter( $sKey )
208
+ {
209
+ if (isset($this->aParameterMap[$sKey]))
210
+ return $this->aParameterMap[$sKey];
211
+ return null;
212
+ }
213
+
214
+
215
+ /**
216
+ * Associates the specified value with the specified key in this report request.
217
+ * For an example on how to specify dates, see the documentation of this class.
218
+ *
219
+ * @param string $sKey the key with which the specified value is to be associated.
220
+ * @param string $value the value to be associated with the specified key.
221
+ */
222
+ public function putParameter( $sKey, $value )
223
+ {
224
+ $this->aParameterMap[$sKey] = $value;
225
+ }
226
+
227
+
228
+ /**
229
+ * Returns an array of the keys contained in this report request.
230
+ *
231
+ * @return array an array of the keys contained in this report request.
232
+ */
233
+ public function getParameterKeys()
234
+ {
235
+ return array_keys($this->aParameterMap);
236
+ }
237
+ }
lib/Inx/Api/Reporting/ReportTicket.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Reporting
5
+ */
6
+ /**
7
+ * The <i>Inx_Api_Reporting_ReportTicket</i> is a handle to access the report.
8
+ * Using the <i>Inx_Api_Reporting_ReportEngine</i> it is not possible to generate a report synchronous.
9
+ * The <i>Inx_Api_Reporting_ReportRequest</i> is sent to the server instead, where the actual generation takes place.
10
+ * This generation is processed asynchronous, thus the result must be polled.
11
+ * This polling is accomplished using the <i>ReportTicket</i> returned by
12
+ * <i>Inx_Api_Reporting_ReportEngine::generate($oRequest, $blIgnoreCache)</i>.
13
+ * <p>
14
+ * The following snippet briefly shows how to retrieve and use a <i>ReportTicket</i>:
15
+ *
16
+ * <pre>
17
+ * $oReportRequest = new Inx_Api_Reporting_ReportRequest( "SystemDomainDistribution",
18
+ * Inx_Api_Reporting_ReportRequest::OUTPUT_FORMAT_PDF_A4, "de_DE", "Europe/Berlin" );
19
+ * $oReportRequest->putParameter( "limit", 20 );
20
+ *
21
+ * $oTicket = $oSession->getReportEngine()->generate( $oReportRequest, false );
22
+ * try
23
+ * {
24
+ * $oDownloadableResult = $oTicket->fetchDownloadableResult();
25
+ * while( $oDownloadableResult == null )
26
+ * {
27
+ * echo "Waiting for the report to finish..." ;
28
+ * sleep( 3 );
29
+ * $oDownloadableResult = $oTicket->fetchDownloadableResult();
30
+ * }
31
+ *
32
+ * $oInputStream = $oDownloadableResult->getInputStream();
33
+ * ...
34
+ * }
35
+ * catch( ReportException x )
36
+ * {
37
+ * echo $x->getMessage();
38
+ * }
39
+ *
40
+ * if($oTicket != null)
41
+ * {
42
+ * $oTicket->close();
43
+ * }
44
+ * </pre>
45
+ * <p>
46
+ * The <i>Inx_Api_Reporting_DownloadableResult</i> fetched from the <i>ReportTicket</i> is used to download the generated report.
47
+ * <i>fetchDownloadableResult()</i> will return <i>null</i> as long as the report generation is not finished.
48
+ * To download the report, just poll for the <i>DownloadableResult</i> to become something different from <i>null</i>
49
+ * and use the provided <i>Inx_Api_InputStream</i> to download the report.
50
+ * <p>
51
+ * <strong>Note:</strong> An <i>Inx_Api_Reporting_ReportTicket</i> object <strong>must</strong> be closed once it is not needed
52
+ * anymore to prevent memory leaks and other potentially harmful side effects.
53
+ * <p>
54
+ * For a more complete example on how to generate and retrieve reports, see the <i>Inx_Api_Reporting_ReportEngine</i> documentation.
55
+ *
56
+ * @see Inx_Api_Reporting_ReportEngine
57
+ * @since API 1.3
58
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
59
+ * @package Inxmail
60
+ * @subpackage Reporting
61
+ */
62
+ interface Inx_Api_Reporting_ReportTicket
63
+ {
64
+
65
+ /**
66
+ * The original description used to generate this report.
67
+ *
68
+ * @return Inx_Api_Reporting_ReportRequest the report request
69
+ */
70
+ public function getReportRequest();
71
+
72
+
73
+ /**
74
+ * Returns the <i>Inx_Api_Reporting_DownloadableResult</i> object, if the report is completely generated.
75
+ * Returns <i>null</i>, if the generation of the report has not yet finished.
76
+ *
77
+ * @return the <i>DownloadableResult</i> or <i>null</i>.
78
+ * @throws Inx_Api_Reporting_ReportException if an error in the report engine has occurred.
79
+ */
80
+ public function fetchDownloadableResult();
81
+
82
+
83
+ /**
84
+ * Closes this <i>Inx_Api_Reporting_ReportTicket</i> and releases any resources on
85
+ * the server associated with this object.
86
+ * An <i>Inx_Api_Reporting_ReportTicket</i> object <strong>must</strong> be closed once it is not needed
87
+ * anymore to prevent memory leaks and other potentially harmful side effects.
88
+ */
89
+ public function close();
90
+
91
+ }
lib/Inx/Api/Resource/Resource.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Resource
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Resource_Resource</i> is a business object representing an attachment or an embedded image stored on the server.
9
+ * <i>Resource</i>s can be used in mailings, depending on their sharing type.
10
+ * The following sharing types are supported:
11
+ * <p>
12
+ * <ul>
13
+ * <li><i>SHARING_TYPE_SYSTEM</i>: The resource can be used by all mailings in all lists
14
+ * <li><i>SHARING_TYPE_MAILING</i>: The resource can only be used by one specific mailing
15
+ * <li><i>SHARING_TYPE_LIST</i>: The resource can be used by all mailings of a specific list
16
+ * </ul>
17
+ * <p>
18
+ * Besides of the sharing type a <i>Resource</i> contains meta information about the represented resource:
19
+ * <p>
20
+ * <ul>
21
+ * <li><i>The name</i>: Each resource has a name. The name does not have to be unique.
22
+ * <li><i>The content type</i>: Contains the MIME type of the resource.
23
+ * <li><i>The creation datetime</i>: The datetime when the resource was uploaded.
24
+ * <li><i>The size</i>: The size of the resource in bytes.
25
+ * <li><i>The user id</i>: References the user who uploaded the resource.
26
+ * </ul>
27
+ * <p>
28
+ * To download a resource, use the <i>Inx_Api_InputStream</i> provided by <i>getInputStream()</i>.
29
+ * <p>
30
+ * For an example on how to upload, retrieve and use resources, see the <i>Inx_Api_Resource_ResourceManager</i>
31
+ * documentation.
32
+ *
33
+ * @see com.inxmail.xpro.api.resource.ResourceManager
34
+ * @since API 1.0
35
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
36
+ * @package Inxmail
37
+ * @subpackage Resource
38
+ */
39
+ interface Inx_Api_Resource_Resource extends Inx_Api_BusinessObject
40
+ {
41
+
42
+ /**
43
+ * Constant for the name attribute.
44
+ * Used by the <i>select()</i> and <i>selectAll()</i> methods to order the result.
45
+ *
46
+ * @see Inx_Api_Resource_ResourceManager#select(Mailing, int orderAttribute, int)
47
+ * @see Inx_Api_Resource_ResourceManager#selectAll(int orderAttribute, int)
48
+ * @var int
49
+ */
50
+ const ATTRIBUTE_NAME = 0;
51
+
52
+ /**
53
+ * Constant for the size attribute.
54
+ * Used by the <i>select()</i> and <i>selectAll()</i> methods to order the result.
55
+ *
56
+ * @see Inx_Api_Resource_ResourceManager#select(Mailing, int orderAttribute, int)
57
+ * @see Inx_Api_Resource_ResourceManager#selectAll(int orderAttribute, int)
58
+ * @var int
59
+ */
60
+ const ATTRIBUTE_SIZE = 1;
61
+
62
+ /**
63
+ * Constant for the creation date attribute.
64
+ * Used by the <i>select()</i> and <i>selectAll()</i> methods to order the result.
65
+ *
66
+ * @see Inx_Api_Resource_ResourceManager#select(Mailing, int orderAttribute, int)
67
+ * @see Inx_Api_Resource_ResourceManager#selectAll(int orderAttribute, int)
68
+ * @var int
69
+ */
70
+ const ATTRIBUTE_CREATION_DATETIME = 2;
71
+
72
+ /**
73
+ * Constant for the sharing type attribute.
74
+ * Used by the <i>select()</i> and <i>selectAll()</i> methods to order the result.
75
+ *
76
+ * @see Inx_Api_Resource_ResourceManager#select(Mailing, int orderAttribute, int)
77
+ * @see Inx_Api_Resource_ResourceManager#selectAll(int orderAttribute, int)
78
+ * @var int
79
+ */
80
+ const ATTRIBUTE_SHARING_TYPE = 4;
81
+
82
+ /**
83
+ * Constant for the user id attribute.
84
+ * Used by the <i>select()</i> and <i>selectAll()</i> methods to order the result.
85
+ *
86
+ * @see Inx_Api_Resource_ResourceManager#select(Mailing, int orderAttribute, int)
87
+ * @see Inx_Api_Resource_ResourceManager#selectAll(int orderAttribute, int)
88
+ * @var int
89
+ */
90
+ const ATTRIBUTE_USER_ID = 5;
91
+
92
+
93
+ /**
94
+ * Sharing behaviour: Resource is not shared, but bound to the specified mailing - <i>getMailingId()</i>.
95
+ *
96
+ * @see ::getSharingType()
97
+ * @var int
98
+ */
99
+ const SHARING_TYPE_MAILING = 0;
100
+
101
+ /**
102
+ * Sharing behaviour: Resource is list shared, thus bound to the the specified list - <i>getListContextId()</i>.
103
+ *
104
+ * @see ::getSharingType()
105
+ * @var int
106
+ */
107
+ const SHARING_TYPE_LIST = 1;
108
+
109
+ /**
110
+ * Sharing behaviour: Resource is system shared, thus not bound to a single mailing or list.
111
+ *
112
+ * @see ::getSharingType()
113
+ * @var int
114
+ */
115
+ const SHARING_TYPE_SYSTEM = 2;
116
+
117
+
118
+ /**
119
+ * Returns the filename of the resource.
120
+ *
121
+ * @return string the filename of the resource.
122
+ */
123
+ public function getName();
124
+
125
+
126
+ /**
127
+ * Returns the creation date of the resource.
128
+ *
129
+ * @return string the creation date of the resource.
130
+ */
131
+ public function getCreationDatetime();
132
+
133
+
134
+ /**
135
+ * Returns the size of the resource file in bytes.
136
+ *
137
+ * @return int the size of the resource file in bytes.
138
+ */
139
+ public function getSize();
140
+
141
+
142
+ /**
143
+ * Returns the id of the user who uploaded the resource.
144
+ *
145
+ * @return int the id of the user who uploaded the resource.
146
+ */
147
+ public function getUserId();
148
+
149
+
150
+ /**
151
+ * Returns the id of the list this resource is bound to. Only specified, if the sharing type is <i>SHARING_TYPE_LIST</i>.
152
+ *
153
+ * @return int the id of the list this resource is bound to.
154
+ */
155
+ public function getListContextId();
156
+
157
+
158
+ /**
159
+ * Returns the id of the mailing this resource is bound to. Only specified, if the sharing type is <i>SHARING_TYPE_MAILING</i>.
160
+ *
161
+ * @return int the id of the mailing this resource is bound to.
162
+ */
163
+ public function getMailingId();
164
+
165
+
166
+ /**
167
+ * Returns the sharing type. The following sharing type values are allowed:
168
+ * <ul>
169
+ * <li> <i>SHARING_TYPE_MAILING</i>: Resource is not shared, but bound to the specified mailing - <i>getMailingId</i>.
170
+ * <li> <i>SHARING_TYPE_LIST</i>: Resource is list shared, thus bound to the the specified list - <i>getListContextId</i>.
171
+ * <li> <i>SHARING_TYPE_SYSTEM</i>: Resource is system shared, thus not bound to a single mailing or list.
172
+ * </ul>
173
+ *
174
+ * @return int the sharing type.
175
+ */
176
+ public function getSharingType();
177
+
178
+
179
+ /**
180
+ * Returns the MIME type of the content.
181
+ *
182
+ * @return string the MIME type of the content.
183
+ */
184
+ public function getContentType();
185
+
186
+
187
+ /**
188
+ * Returns an <i>Inx_Api_InputStream</i> which can be used to download the resource file.
189
+ *
190
+ * @return Inx_Api_InputStream an <i>InputStream</i> to download the resource file.
191
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
192
+ * <i>Inx_Api_UserRights::RESOURCE_FEATURE_USE</i>
193
+ */
194
+ public function getInputStream();
195
+
196
+ }
lib/Inx/Api/Resource/ResourceManager.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Resource
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_Resource_ResourceManager</i> manages the file resources.
9
+ * An <i>Inx_Api_Resource_Resource</i> can be used as attachment or embedded image in a mailing.
10
+ * <p>
11
+ * Attachments and embedded images used in mailings are "resources".
12
+ * Using the <i>ResourceManager</i>, these resources can be upload to and download from the Inxmail server.
13
+ * Resources can be bound to mailing lists or mailings, which means they are not visible outside these bounds,
14
+ * and will be removed with their mailing list or mailing.
15
+ * <p>
16
+ * The following snippet shows how to upload a resource (logo.gif) which can be used by all mailings in all lists:
17
+ *
18
+ * <PRE>
19
+ * $oResourceManager = $oSession->getResourceManager();
20
+ * $in = fopen("/images/logo.gif", 'rb');
21
+ * $oResource = $oResourceManager->upload( null, "logo.gif", $in );
22
+ * fclose($in);
23
+ * </PRE>
24
+ *
25
+ * Inxmail assigns an unique identifier to the uploaded resource.
26
+ * To attach a resource to a mailing, add the <i>attach</i> tag to the mail body.
27
+ * The following snippet shows how to attach the resource with the id 42 to a mailing:
28
+ *
29
+ * <PRE>
30
+ * $sb = "[%attach(".$oResource->getId(). "); ".$res->getName(). "]" ;
31
+ * </PRE>
32
+ *
33
+ * This results in a string like <i>[%attach(42); logo.gif]</i>.
34
+ * To embed an image instead of adding it as attachment, replace 'attach' with 'embedded-image':
35
+ * <i>[%embedded-image(42); logo.gif]</i>.
36
+ * <p>
37
+ * To locate existing resources, use one of the <i>select</i> methods of the <i>ResourceManager</i>.
38
+ * The following snippet shows how to retrieve all <i>Inx_Api_Resource_Resource</i>s available for a specific mailing
39
+ * and prints their IDs and names:
40
+ *
41
+ * <pre>
42
+ * $oMailing = $oSession->getMailingManager()->get( 4711 );
43
+ *
44
+ * $oResourceManager = $oSession->getResourceManager();
45
+ * $oBOResultSet = $oResourceManager->select( $oMailing, Inx_Api_Resource_Resource::ATTRIBUTE_NAME, Inx_Api_Order::ASC );
46
+ *
47
+ * for( $i = 0; $i &lt; $oBOResultSet->size(); $i++ )
48
+ * {
49
+ * $oResource = $oBOResultSet->get( $i );
50
+ * echo $oResource->getId().&quot;: &quot;.$oResource->getName().&quot;&#60;br&#62;&quot;;
51
+ * }
52
+ * </pre>
53
+ * <p>
54
+ * For more information on resources, see the <i>Inx_Api_Resource_Resource</i> documentation.
55
+ *
56
+ * @see Inx_Api_Resource_Resource
57
+ * @since API 1.0
58
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
59
+ * @package Inxmail
60
+ * @subpackage Resource
61
+ */
62
+ interface Inx_Api_Resource_ResourceManager extends Inx_Api_BOManager
63
+ {
64
+
65
+ /** @deprecated replaced by <i>Inx_Api_Order::ASC</i> */
66
+ const ORDER_ASC = 0;
67
+
68
+ /** @deprecated replaced by <i>Inx_Api_Order::DESC</i> */
69
+ const ORDER_DESC = 1;
70
+
71
+
72
+ /**
73
+ * Uploads a file resource to Inxmail.
74
+ * The sharing type depends on the type of the $mOwner parameter:
75
+ * <ol>
76
+ * <li>If you pass a <code>null</code> value, the resource will be shared with all other mailings in the system (i.e.
77
+ * sharingType is <i>Inx_Api_Resource_Resource::SHARING_TYPE_SYSTEM</i>).
78
+ * <li>If you pass an instance of <i>Inx_Api_Mailing_Mailing</i>, the resource will not be shared with other mailings
79
+ * (i.e. sharingType is <i>Inx_Api_Resource_Resource::SHARING_TYPE_MAILING</i>).
80
+ * <li>If you pass an instance of <i>Inx_Api_List_ListContext</i>, The resource will be shared with other mailings in
81
+ * the specified list (i.e. sharingType is <i>Inx_Api_Resource_Resource::SHARING_TYPE_LIST</i>).
82
+ * <li>Any other non <i>null</i> value will render no effect. The method will not perform the upload.
83
+ * </ol>
84
+ * If a resource with the specified name already exists it will not be overwritten.
85
+ * Instead a second resource with the same name and the new content will be created.
86
+ *
87
+ * @param Inx_Api_List_ListContext|Inx_Api_Mailing_Mailing $mOwner the list or mailing this resource will be restricted to.
88
+ * May be <i>null</i> to share the resource with all mailings in all lists.
89
+ * @param string $sFilename the filename of the resource (e.g. logo.gif).
90
+ * @param resource $rsInputStream the input stream of the file content.
91
+ * @return Inx_Api_Resource_Resource the new resource, or <i>null</i> if the upload failed.
92
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
93
+ * <i>Inx_Api_UserRights::RESOURCE_UPLOAD_MAILING_SHARING</i>
94
+ */
95
+ public function upload( $mOwner, $sFilename, $rsInputStream );
96
+
97
+
98
+ /**
99
+ * Returns an <i>Inx_Api_BOResultSet</i> containing all resources available for the given <i>Inx_Api_Mailing_Mailing</i>.
100
+ * This includes all non shared resources available for this mailing, list shared resources and system shared resources.
101
+ *
102
+ * @param Inx_Api_Mailing_Mailing $oMailing the mailing for which the available resources shall be retrieved.
103
+ * @param int $iOrderAttribute the order attribute. May be one of:
104
+ * <ul>
105
+ * <li><i>Inx_Api_Resource_Resource::ATTRIBUTE_NAME</i>
106
+ * <li><i>Inx_Api_Resource_Resource::ATTRIBUTE_SHARING_TYPE</i>
107
+ * <li><i>Inx_Api_Resource_Resource::ATTRIBUTE_SIZE</i>
108
+ * <li><i>Inx_Api_Resource_Resource::ATTRIBUTE_CREATION_DATETIME</i>
109
+ * <li><i>Inx_Api_Resource_Resource::ATTRIBUTE_USER_ID</i>
110
+ * </ul>
111
+ * @param int $iOrderType the order type <i>Inx_Api_Order::ASC</i> or <i>Inx_Api_Order::DESC</i>).
112
+ * @return Inx_Api_BOResultSet an <i>BOResultSet</i> object that contains the data produced by the given query.
113
+ * @throws SecurityException if the session user doesn't have the following permission:
114
+ * <i>Inx__Api_UserRights::RESOURCE_FEATURE_USE</i>
115
+ */
116
+ public function select( Inx_Api_Mailing_Mailing $oMailing, $iOrderAttribute, $iOrderType );
117
+
118
+ }
lib/Inx/Api/SecurityException.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * @package Inxmail
7
+ */
8
+ class Inx_Api_SecurityException extends Exception
9
+ {
10
+
11
+ }
lib/Inx/Api/ServerTime.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * The <i>Inx_Api_ServerTime</code> represents the server time. With this, you are able to translate the date from your time
7
+ * zone to the time zone of the server. Copyright (c) 2008 Inxmail GmbH. All Rights Reserved.
8
+ *
9
+ * @since API 1.4.4
10
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
11
+ * @package Inxmail
12
+ */
13
+ interface Inx_Api_ServerTime
14
+ {
15
+
16
+ /**
17
+ * Returns the server time as iso 8601 formatted datetime string.
18
+ *
19
+ * @return the server time as iso 8601 formatted datetime string.
20
+ */
21
+ public function getDatetime();
22
+
23
+
24
+ /**
25
+ * Returns the GMT offset of the server in milliseconds.
26
+ *
27
+ * @return the GMT offset in milliseconds.
28
+ */
29
+ public function getGMTOffset();
30
+
31
+
32
+ /**
33
+ * Returns the day light saving time offset of the server in milliseconds.
34
+ *
35
+ * @return the DST offset in milliseconds.
36
+ */
37
+ public function getDSTOffset();
38
+
39
+
40
+ /**
41
+ * Returns the time zone id, for example "Europe/Berlin".
42
+ *
43
+ * @return the time zone as string.
44
+ */
45
+ public function getTimezoneId();
46
+
47
+ }
lib/Inx/Api/Session.php ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ */
5
+ /**
6
+ * The <i>Inx_Api_Session</i> is the entry point to the API.
7
+ *
8
+ * The createRemoteSession method may be used in following way to create a remote session:
9
+ *
10
+ * <PRE>
11
+ * Inx_Api_Session::setProperty( &quot;http.proxyHost&quot;, &quot;192.168.1.142&quot; );
12
+ * Inx_Api_Session::setProperty( &quot;http.proxyPort&quot;, &quot;8080&quot; );
13
+ * Inx_Api_Session::setProperty( &quot;http.nonProxyHosts&quot;, &quot;localhost|127.0.0.1&quot; );
14
+ * Inx_Api_Session::setProperty( &quot;http.proxyUser&quot;, &quot;test&quot; );
15
+ * Inx_Api_Session::setProperty( &quot;http.proxyPassword&quot;, &quot;test&quot; );
16
+ *
17
+ * $s = null;
18
+ *
19
+ * try
20
+ * {
21
+ * $s = Inx_Api_Session::createRemoteSession( "http://localhost:80/inxmail", "apiuser", "password" );
22
+ * ...
23
+ * $s->close(); //close the session
24
+ * }
25
+ * catch( LoginException x )
26
+ * {
27
+ * ...
28
+ * }
29
+ * </PRE>
30
+ *
31
+ * <P/>
32
+ * The createLocalSession method may be used in following way to create a local session:
33
+ *
34
+ * <PRE>
35
+ * $s = null;
36
+ *
37
+ * try
38
+ * {
39
+ * $s = Inx_Api_Session::createLocalSession( &quot;apiuser&quot;, &quot;password&quot; );
40
+ * ...
41
+ * $s->close(); //close the session
42
+ * }
43
+ * catch( LoginException x )
44
+ * {
45
+ * ...
46
+ * }
47
+ * </PRE>
48
+ *
49
+ * <p/>
50
+ * <strong>Note:</strong> An <i>Inx_Api_Session</i> object <strong>must</strong> be closed once it is not needed anymore to
51
+ * prevent memory leaks and other potentially harmful side effects.
52
+ *
53
+ * @since API 1.0
54
+ * @version $Revision: 9729 $ $Date: 2008-01-18 17:31:31 +0200 (Pn, 18 Sau 2008) $ $Author: aurimas $
55
+ * @package Inxmail
56
+ */
57
+ abstract class Inx_Api_Session
58
+ {
59
+ protected static $_aProperties = array();
60
+ /**
61
+ * Attempts to establish a session to the given inxmail application.
62
+ *
63
+ * @param string $sApplicationUrl an application url of the form http://[host]:[port]/[webapps].
64
+ * @param string $sUsername the inxmail user on whose behalf the session is being created.
65
+ * @param string $sPassword the user's password.
66
+ * @param bool $blPwdEncrypted determines whether the password will be transfered in encrypted form,
67
+ * may be omitted.
68
+ * @return Inx_Api_Session a session to the given inxmail application.
69
+ * @throws Inx_Api_LoginException if the login failed.
70
+ * @throws Inx_Api_ConnectException if the connection could not be established.
71
+ * @since API 1.0
72
+ */
73
+ public static function createRemoteSession( $sApplicationUrl, $sUsername,
74
+ $sPassword, $blPwdEncrypted=false )
75
+ {
76
+ try
77
+ {
78
+ $sClassName='';
79
+ if( strpos($sApplicationUrl, "rmi://")===0 )
80
+ throw new Exception('Not implemented!');
81
+ elseif( strpos($sApplicationUrl, "hessian://")===0 )
82
+ throw new Exception('Not implemented!');
83
+ elseif( strpos($sApplicationUrl, "hessians://")===0 )
84
+ throw new Exception('Not implemented!');
85
+ else
86
+ $sClassName = "Inx_Apiimpl_SoapSession";
87
+ return $class = new $sClassName($sApplicationUrl, $sUsername, $sPassword, $blPwdEncrypted);
88
+ } catch( Inx_Api_LoginException $e ) {
89
+ throw new Inx_Api_LoginException($e->getMessage(), $e->getCode());
90
+ } catch( Inx_Api_APIException $e ) {
91
+ throw new Inx_Api_APIException($e->getMessage(), $e);
92
+ } catch( Inx_Api_ConnectException $e ) {
93
+ throw new Inx_Api_ConnectException($e->getMessage(), $e->getCode());
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Attempts to establish a session used for plug-ins.
99
+ *
100
+ * @param string $sApplicationUrl an application url of the form http://[host]:[port]/[webapps].
101
+ * @param string $sLoginToken the token used to login the plug-in.
102
+ * @return Inx_Api_Session a session to the given inxmail application.
103
+ * @throws Inx_Api_LoginException if the login failed.
104
+ * @throws Inx_Api_ConnectException if the connection could not be established.
105
+ * @since API 1.4.5
106
+ */
107
+ public static function createPluginSession( $sApplicationUrl, $sLoginToken)
108
+ {
109
+ try
110
+ {
111
+ $sClassName='';
112
+ if( strpos($sApplicationUrl, "rmi://")===0 )
113
+ throw new Exception('Not implemented!');
114
+ elseif( strpos($sApplicationUrl, "hessian://")===0 )
115
+ throw new Exception('Not implemented!');
116
+ elseif( strpos($sApplicationUrl, "hessians://")===0 )
117
+ throw new Exception('Not implemented!');
118
+ else
119
+ $sClassName = "Inx_Apiimpl_SoapSession";
120
+ return $class = new $sClassName($sApplicationUrl, null, null, false, $sLoginToken);
121
+ } catch( Inx_Api_LoginException $e ) {
122
+ throw new Inx_Api_LoginException($e->getMessage(), $e->getCode());
123
+ } catch( Inx_Api_APIException $e ) {
124
+ throw new Inx_Api_APIException($e->getMessage(), $e);
125
+ } catch( Inx_Api_ConnectException $e ) {
126
+ throw new Inx_Api_ConnectException($e->getMessage(), $e->getCode());
127
+ }
128
+ }
129
+
130
+
131
+ /**
132
+ * Attempts to establish a session used for plug-ins.
133
+ *
134
+ * @param string $sApplicationUrl an application url of the form http://[host]:[port]/[webapps].
135
+ * @param string $pluginSecretId the secret id of the Plugin.
136
+ * @param string $username the inxmail user on whose behalf the session is being created.
137
+ * @param string $password the user's password.
138
+ * @param bool $pwdEncrypted determines whether the password will be transfered in encrypted form.
139
+ * @return Inx_Api_Session a session to the given inxmail application.
140
+ * @throws Inx_Api_LoginException if the login failed.
141
+ * @throws Inx_Api_ConnectException if the connection could not be established.
142
+ * @since API 1.4.5
143
+ */
144
+ public static function createPluginSession2( $sApplicationUrl, $pluginSecretId,
145
+ $username, $password, $pwdEncrypted )
146
+ {
147
+ try
148
+ {
149
+ $sClassName='';
150
+ if( strpos($sApplicationUrl, "rmi://")===0 )
151
+ throw new Exception('Not implemented!');
152
+ elseif( strpos($sApplicationUrl, "hessian://")===0 )
153
+ throw new Exception('Not implemented!');
154
+ elseif( strpos($sApplicationUrl, "hessians://")===0 )
155
+ throw new Exception('Not implemented!');
156
+ else
157
+ $sClassName = "Inx_Apiimpl_SoapSession";
158
+ return $class = new $sClassName($sApplicationUrl, $username, $password, $password, null, $pluginSecretId);
159
+ } catch( Inx_Api_LoginException $e ) {
160
+ throw new Inx_Api_LoginException($e->getMessage(), $e->getCode());
161
+ } catch( Inx_Api_APIException $e ) {
162
+ throw new Inx_Api_APIException($e->getMessage(), $e);
163
+ } catch( Inx_Api_ConnectException $e ) {
164
+ throw new Inx_Api_ConnectException($e->getMessage(), $e->getCode());
165
+ }
166
+ }
167
+
168
+
169
+ /**
170
+ * This feature is not available in the PHP API.
171
+ */
172
+ public static function createLocalSession()
173
+ {
174
+ throw new Exception('Not implemented!');
175
+ }
176
+
177
+
178
+ /**
179
+ * Creates a new <i>Inx_Api_Recipient_RecipientContext</i> that can be used to access and manipulate
180
+ * recipient data.
181
+ *
182
+ * @return Inx_Api_Recipient_RecipientContext a new <i>Inx_Api_Recipient_RecipientContext</i>.
183
+ * @since API 1.0
184
+ */
185
+ public abstract function createRecipientContext();
186
+
187
+
188
+ /**
189
+ * Returns the <i>Inx_Api_List_ListContextManager</i> object that will be used to manage lists.
190
+ *
191
+ * @return Inx_Api_List_ListContextManager the list manager.
192
+ * @since API 1.0
193
+ */
194
+ public abstract function getListContextManager();
195
+
196
+
197
+ /**
198
+ * Returns the <i>Inx_Api_Recipient_AttributeManager</i> object that will be used to manage attributes
199
+ * (recipient columns).
200
+ *
201
+ * @return Inx_Api_Recipient_AttributeManager the attribute manager.
202
+ * @since API 1.0
203
+ */
204
+ public abstract function getAttributeManager();
205
+
206
+
207
+ /**
208
+ * Returns the <i>Inx_Api_Mailing_MailingManager</i> object that will be used to manage mailings and
209
+ * produce the mailing output (HTML and/or plain text) for a single recipient.
210
+ *
211
+ * @return Inx_Api_Mailing_MailingManager the mailing manager.
212
+ * @since API 1.0
213
+ */
214
+ public abstract function getMailingManager();
215
+
216
+
217
+ /**
218
+ * Returns the <i>Inx_Api_TriggerMailing_TriggerMailingManager</i> object that will be used to manage
219
+ * trigger mailings and produce the trigger mailing output (HTML and/or plain test) for a single recipient.
220
+ *
221
+ * @return Inx_Api_TriggerMailing_TriggerMailingManager the trigger mailing manager.
222
+ * @since API 1.10.0
223
+ */
224
+ public abstract function getTriggerMailingManager();
225
+
226
+
227
+ /**
228
+ * Returns the <i>Inx_Api_Subscription_SubscriptionManager</i> object that will be used to subscribe
229
+ * and unsubscribe recipients.
230
+ *
231
+ * @return Inx_Api_Subscription_SubscriptionManager the subscription manager.
232
+ * @since API 1.0
233
+ */
234
+ public abstract function getSubscriptionManager();
235
+
236
+
237
+ /**
238
+ * Returns the <i>Inx_Api_Resource_ResourceManager</i> object that will be used to manage resources like
239
+ * attachments and embedded images stored on the server.
240
+ *
241
+ * @return Inx_Api_Resource_ResourceManager the resource manager.
242
+ * @since API 1.0
243
+ */
244
+ public abstract function getResourceManager();
245
+
246
+
247
+ /**
248
+ * Returns the <i>Inx_Api_Action_ActionManager</i> object that will be used to manage actions.
249
+ * An <i>Inx_Api_Action_Action</i> can manipulate or send a mail to a recipient for whom an event has occurred.
250
+ *
251
+ * @return Inx_Api_Action_ActionManager the action manager.
252
+ * @since API 1.2.0
253
+ */
254
+ public abstract function getActionManager();
255
+
256
+
257
+ /**
258
+ * Returns the <i>Inx_Api_Reporting_ReportEngine</i> object that will be used to generate reports.
259
+ *
260
+ * @return Inx_Api_Reporting_ReportEngine the report engine.
261
+ * @since API 1.3.0
262
+ */
263
+ public abstract function getReportEngine();
264
+
265
+
266
+ /**
267
+ * Returns the <i>Inx_Api_Blacklist_BlacklistManager</i> object that will be used to manage blacklist entries.
268
+ *
269
+ * @return Inx_Api_Blacklist_BlacklistManager the blacklist manager.
270
+ * @since API 1.1.0
271
+ */
272
+ public abstract function getBlacklistManager();
273
+
274
+ /**
275
+ * Returns the <i>Inx_Api_Bounce_BounceManager</i> object that will be used to retrieve bounce notifications.
276
+ * A bounce notification is a mail received by a mail server that indicates that a mailing could not be sent to a
277
+ * specific recipient (bounced).
278
+ * This may be due due to an unknown recipient at the destination mail server.
279
+ *
280
+ * @return Inx_Api_Bounce_BounceManager the bounce manager.
281
+ * @since API 1.4.3
282
+ */
283
+ public abstract function getBounceManager();
284
+
285
+ /**
286
+ * Returns the <i>Inx_Api_Filter_FilterManager</i> object that will be used to manage filters.
287
+ * A <code>Filter</code> is used to define target groups of recipients that share a common property.
288
+ * For example: All recipients born after 1970.
289
+ *
290
+ * @return Inx_Api_Filter_FilterManager the filter manager.
291
+ * @since API 1.1.0
292
+ */
293
+ public abstract function getFilterManager();
294
+
295
+ /**
296
+ * Returns the <i>Inx_Api_TextModule_TextModuleManager</i> object that will be used to manage text modules.
297
+ * Text modules are reusable text snippets that can be used inside mailings in the same list (or all lists
298
+ * if the text module is defined in the system list).
299
+ * A common text module is a custom salutation.
300
+ *
301
+ * @return Inx_Api_TextModule_TextModuleManager the textmodule manager.
302
+ * @since API 1.4.0
303
+ */
304
+ public abstract function getTextmoduleManager();
305
+
306
+ /**
307
+ * Returns the <i>Inx_Api_MailingTemplate_MailingTemplateManager</i> object that will be used to manage mailing templates.
308
+ * Mailing templates are reusable mailing contents that can be used as a basis for new mailings.
309
+ * These templates are far less powerful than the templates provided by design collections.
310
+ *
311
+ * @return Inx_Api_MailingTemplate_MailingTemplateManager the template manager.
312
+ * @since API 1.4.0
313
+ */
314
+ public abstract function getMailingTemplateManager();
315
+
316
+ /**
317
+ * Returns the <i>Inx_Api_DesignTemplate_DesignCollectionManager</i> object that will be used to import design collections.
318
+ * Design collections may contain multiple design templates which can be used to create complex multipart mailings.
319
+ *
320
+ * @return Inx_Api_DesignTemplate_DesignCollectionManager the design collection manager.
321
+ * @since API 1.4.0
322
+ */
323
+ public abstract function getDesignCollectionManager();
324
+
325
+ /**
326
+ * Returns the <i>Inx_Api_Util_TemporaryMailSender</i> object that will be used to send temporary mails.
327
+ * Temporary mails are not written to the database, thus not retrievable once they are sent.
328
+ *
329
+ * @return Inx_Api_Util_TemporaryMailSender the temporary mail sender.
330
+ * @since API 1.0
331
+ */
332
+ public abstract function getTemporaryMailSender();
333
+
334
+
335
+ /**
336
+ * Returns the <i>Inx_Api_Util_Utilities</i> object that can be used for special activities like the tell a friend feature.
337
+ *
338
+ * @return Inx_Api_Util_Utilities the utilities.
339
+ * @since API 1.1.0
340
+ */
341
+ public abstract function getUtilities();
342
+
343
+ /**
344
+ * Returns the <i>Inx_Api_Webpage_WebpageManager</i> used to access data of web pages (HTML files and JSPs)
345
+ * like type and URL.
346
+ *
347
+ * @return Inx_Api_Webpage_WebpageManager the web page manager.
348
+ * @since API 1.9.0
349
+ */
350
+ public abstract function getWebpageManager();
351
+
352
+
353
+ /**
354
+ * Returns the <i>Inx_Api_UserContext</i> object associated with this <code>Session</code> object.
355
+ * The <code>UserContext</code> may be used to check the rights of the session user.
356
+ *
357
+ * @return Inx_Api_UserContext the user context.
358
+ * @since API 1.0
359
+ */
360
+ public abstract function getUserContext();
361
+
362
+
363
+ /**
364
+ * Returns the <i>Inx_Api_Inbox_InboxManager</i> object that will be used to retrieve inbox messages.
365
+ *
366
+ * @return Inx_Api_Inbox_InboxManager the inbox manager.
367
+ * @since API 1.9.0
368
+ */
369
+ public abstract function getInboxManager();
370
+
371
+
372
+ /**
373
+ * Returns the <i>Inx_Api_DataAccess_DataAccess</i> object that will be used to get click and link data.
374
+ *
375
+ * @return Inx_Api_DataAccess_DataAccess the data access object.
376
+ * @since API 1.4
377
+ */
378
+ public abstract function getDataAccess();
379
+
380
+ /**
381
+ * Returns the <i>Inx_Api_Approval_ApprovalManager</i> object that will be used to manage approvers.
382
+ * An approver is responsible for approving mails before they can be sent.
383
+ *
384
+ * @return Inx_Api_Approval_ApprovalManager the approval manager.
385
+ * @since API 1.6
386
+ */
387
+ public abstract function getApprovalManager();
388
+
389
+
390
+ /**
391
+ * Returns the unique id of this session.
392
+ *
393
+ * @return string the id of this session.
394
+ * @since API 1.0
395
+ */
396
+ public abstract function sessionId();
397
+
398
+
399
+ /**
400
+ * Closes this session and releases any resources associated with the session.
401
+ * An <i>Inx_Api_Session</i> object <strong>must</strong> be closed once it is not needed anymore to prevent
402
+ * memory leaks and other potentially harmful side effects.
403
+ *
404
+ * @since API 1.0
405
+ */
406
+ public abstract function close();
407
+
408
+ /**
409
+ * Returns the server time as <i>Inx_Api_ServerTime</i> object.
410
+ * With this object, you are able to translate the date from your time zone to the time zone of the server.
411
+ *
412
+ * @return Inx_Api_ServerTime the server time.
413
+ * @since API 1.4.4
414
+ */
415
+ public abstract function getServerTime();
416
+
417
+ /**
418
+ * Returns the <code>PluginStore</code> object that will be used to manage stored informations.
419
+ * The <code>PluginStore</code> is used as isolated storage for plug-ins.
420
+ * This is only useful for plug-in usage of the api.
421
+ *
422
+ * @since API 1.7.0
423
+ */
424
+ public abstract function getPluginStore();
425
+
426
+ /**
427
+ * Creates a new <code>Inx_Api_Testprofiles_TestRecipientContext</code> that can be used to access and manipulate
428
+ * test recipient data.
429
+ * Test recipients are used to create a preview of a mailing.
430
+ *
431
+ * @return a new <code>TestRecipientContext</code>.
432
+ * @since API 1.6.0
433
+ */
434
+ public abstract function createTestRecipientContext();
435
+
436
+ /**
437
+ * Sets the session property specified by the given key to the given value.
438
+ * This may be used to configure a proxy conenction.
439
+ *
440
+ * @param string $sKey the property name. Possible values are:
441
+ * <ul>
442
+ * <li><i>http.proxyHost</i>
443
+ * <li><i>http.proxyPort</i>
444
+ * <li><i>http.proxyUser</i>
445
+ * <li><i>http.proxyPassword</i>
446
+ * <li><i>soap.connectionTimeout</i>
447
+ * </ul>
448
+ * @param string|int $sValue the property value.
449
+ */
450
+ public static function setProperty($sKey, $mxValue)
451
+ {
452
+ if (empty($sKey)) {
453
+ throw new Inx_Api_IllegalArgumentException("Key can't be empty.");
454
+ }
455
+
456
+ if (! (is_string($mxValue) || is_int($mxValue))) {
457
+ throw new Inx_Api_IllegalArgumentException("Value must be string or int.");
458
+ }
459
+
460
+ self::$_aProperties[$sKey] = $mxValue;
461
+ }
462
+
463
+ /**
464
+ * Returns the value of the session property specified by the given key.
465
+ *
466
+ * @param string $sKey the property name.
467
+ * @return string|int the property value.
468
+ */
469
+ public static function getProperty($sKey)
470
+ {
471
+ if (empty($sKey)) {
472
+ throw new Inx_Api_IllegalArgumentException("Key can't be empty.");
473
+ }
474
+ if (isset(self::$_aProperties[$sKey])) {
475
+ return self::$_aProperties[$sKey];
476
+ }
477
+
478
+ return null;
479
+ }
480
+ }
lib/Inx/Api/Subscription/SubscriptionLogEntryRowSet.php ADDED
@@ -0,0 +1,547 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Subscription
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> can be used to determine whether recipients have been
9
+ * unsubscribed from or subscribed to a list.
10
+ * It can also contain information about the recipient, if she/he exists.
11
+ * <P/>
12
+ * The following information can be retrieved using the <i>SubscriptionLogEntryRowSet</i>:
13
+ * <ul>
14
+ * <li><i>The log entry type</i>: Describes the message of the entry. May be one of:
15
+ * <ul>
16
+ * <li><i>BLACKLISTED</i>: The recipient could not be subscribed because of a blacklist entry.</li>
17
+ * <li><i>DUPLICATE_SUBSCRIPTION</i>: The recipient could not be subscribed because she/he is already subscribed.</li>
18
+ * <li><i>INVALID_ADRESS_ERROR</i>: The recipient could not be subscribed because the email address </li>
19
+ * is not conform to the RFC standard.
20
+ * <li><i>LIST_UNSUBSCRIBE_HEADER_UNSUBSCRIPTION</i>: The recipient was unsubscribed using header unsubscription.</li>
21
+ * <li><i>MANUAL_SUBSCRIPTION</i>: The recipient was subscribed by an Inxmail user.</li>
22
+ * <li><i>MANUAL_UNSUBSCRIPTION</i>: The recipient was unsubscribed by an Inxmail user.</li>
23
+ * <li><i>NOT_IN_LIST_UNSUBSCRIPTION</i>: The recipient could not be unsubscribed because she/he is not subscribed.</li>
24
+ * <li><i>PENDING_SUBSCRIPTION</i>: The subscription of the recipient is in progress (Double Opt In).</li>
25
+ * <li><i>PENDING_UNSUBSCRIPTION</i>: The unsubscription of the recipient is in progress (Double Opt Out).</li>
26
+ * <li><i>SUBSCRIPTION_EMAIL_MISSMATCH</i>: The recipient could not be subscribed because of an
27
+ * email address mismatch.</li>
28
+ * <li><i>SUBSCRIPTION_ID_NOT_VALID</i>: An invalid subscription verification was received (Double Opt In).</li>
29
+ * <li><i>SUBSCRIPTION_INTERNAL_ERROR</i>: The recipient could not be subscribed due to an internal error.</li>
30
+ * <li><i>SUBSCRIPTION_TIMED_OUT</i>: The subscription of the recipient timed out (Double Opt In).</li>
31
+ * <li><i>SUBSCRIPTION_VERIFICATION_BOUNCED</i>: A subscription verification mail bounced.</li>
32
+ * <li><i>UNSUBSCRIPTION_EMAIL_MISSATCH</i>: The recipient could not be unsubscribed because of an email address</li>
33
+ * <li><i>UNSUBSCRIPTION_ID_NOT_VALID</i>: An invalid unsubscription verification was received (Double Opt Out).</li>
34
+ * <li><i>UNSUBSCRIPTION_INTERNAL_ERROR</i>: The recipient could not be unsubscribed due to an internal error.</li>
35
+ * <li><i>UNSUBSCRIPTION_TIMED_OUT</i>: The subscription of the recipient timed out (Double Opt Out).</li>
36
+ * <li><i>UNSUBSCRIPTION_VERIFICATION_BOUNCED</i>: An unsubscription verification mail bounced.</li>
37
+ * <li><i>VERIFIED_SUBSCRIPTION</i>: A recipient subscription has been verified.</li>
38
+ * <li><i>VERIFIED_UNSUBSCRIPTION</i>: A recipient unsubscription has been verified.</li>
39
+ * <li><i>UNKNOWN_SUBSCRIPTIONTYPE</i>: The log entry type is unknown.</li>
40
+ * </ul>
41
+ * </li>
42
+ * <li><i>The log message</i>: The message associated with the log entry.</li>
43
+ * <li><i>The datetime of the entry</i>: When was the log entry created?</li>
44
+ * <li><i>The email address</i>: The email address of the recipient involved in the log entry.</li>
45
+ * <li><i>The recipient id</i>: The id of the recipient involved in the log entry.</li>
46
+ * <li><i>The recipient state</i>: The state of the recipient involved in the log entry. May be one of:
47
+ * <ul>
48
+ * <li><i>RECIPIENT_STATE_EXISTENT</i>: If the recipient exists.</li>
49
+ * <li><i>RECIPIENT_STATE_UNKNOWN_OR_DELETED</i>: If the recipient was deleted or the state is unknown.</li>
50
+ * </ul>
51
+ * </li>
52
+ * <li>Possibly some attributes queried in the <i>Inx_Api_Subscription_SubscriptionManager</i> which can be retrieved
53
+ * using the <i>getter</i> methods.</li>
54
+ * </ul>
55
+ * <P/>
56
+ * A <i>SubscriptionLogEntryRowSet</i> object maintains a cursor pointing to its current row of data.
57
+ * Initially the cursor is positioned before the first row.
58
+ * The <i>next()</i> method moves the cursor to the next row (recipient), and because it returns <i>false</i> when
59
+ * there are no more rows in the <i>SubscriptionLogEntryRowSet</i> object, it can be used in a <i>while</i> loop to
60
+ * iterate through the result set.
61
+ * <p/>
62
+ * Be sure to call <i>next()</i> before the first retrieval statement on the row set.
63
+ * As stated above, initially the cursor is before the first row, thus no data can be retrieved from the row set
64
+ * before calling <i>next()</i>.
65
+ * Doing so will trigger an <i>Inx_Api_DataException</i>.
66
+ * <P/>
67
+ * The <i>SubscriptionLogEntryRowSet</i> interface provides <i>getter</i> methods (<i>getString</i>,
68
+ * <i>getInteger</i>, and so on) for retrieving attribute values from the current row.
69
+ * Values can be retrieved using the attribute object if they were included in the query.
70
+ * <p/>
71
+ * The following snippet shows how to retrieve the email address of all (un)subscriptions in the row set, thus also
72
+ * illustrating how to iterate over a <i>SubscriptionLogEntryRowSet</i>:
73
+ *
74
+ * <pre>
75
+ * $oRecipientContext = $oSession->createRecipientContext();
76
+ * $oSubscriptionManager = $oSession->getSubscriptionManager();
77
+ * $oSubscriptionLogEntryRowSet = $oSubscriptionManager->getAllLogEntries( $oRecipientContext, null );
78
+ *
79
+ * while( $oSubscriptionLogEntryRowSet->next() )
80
+ * {
81
+ * echo $oSubscriptionLogEntryRowSet->getEmailAddress().&quot;&#60;br&#62;&quot;;
82
+ * }
83
+ *
84
+ * $oSubscriptionLogEntryRowSet->close();
85
+ * </pre>
86
+ * <p/>
87
+ * <strong>Note:</strong> An <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object <strong>must</strong> be closed
88
+ * once it is not needed anymore to prevent memory leaks and other potentially harmful side effects.
89
+ * <p/>
90
+ * For more information about the (un)subscription of recipients, see the <i>Inx_api_Subscritpion_SubscriptionManager</i>
91
+ * and Inx_Api_Recipient_RecipientContext</i> documentation.
92
+ *
93
+ * @see Inx_api_Subscritpion_SubscriptionManager
94
+ * @see Inx_Api_Recipient_RecipientContext
95
+ * @since API 1.4.4
96
+ * @version $Revision:$ $Date:$ $Author:$
97
+ * @package Inxmail
98
+ * @subpackage Subscription
99
+ */
100
+ interface Inx_Api_Subscription_SubscriptionLogEntryRowSet
101
+ {
102
+ /**
103
+ * State for missing recipient information.
104
+ * This state will be used when no attributes are specified in the query or in case of an unknown or deleted recipient.
105
+ *
106
+ * @var int
107
+ */
108
+ const RECIPIENT_STATE_UNKNOWN_OR_DELETED = 0;
109
+
110
+ /**
111
+ * State for existent recipient.
112
+ *
113
+ * @var int
114
+ */
115
+ const RECIPIENT_STATE_EXISTENT = 1;
116
+
117
+ /**
118
+ * The SubscriptionInformation State for verified subscriptions.
119
+ *
120
+ * @var int
121
+ */
122
+ const VERIFIED_SUBSCRIPTION = 1;
123
+
124
+ /**
125
+ * The SubscriptionInformation State for verified unsubscriptions.
126
+ *
127
+ * @var int
128
+ */
129
+ const VERIFIED_UNSUBSCRIPTION = 2;
130
+
131
+ /** The SubscriptionInformation State for pending subscriptions.
132
+ *
133
+ * @var int
134
+ */
135
+ const PENDING_SUBSCRIPTION = 3;
136
+
137
+ /** The SubscriptionInformation State for pending unsubscriptions.
138
+ *
139
+ * @var int
140
+ */
141
+ const PENDING_UNSUBSCRIPTION = 4;
142
+
143
+ /** The SubscriptionInformation State for an unknown subscription type.
144
+ *
145
+ * @var int
146
+ */
147
+ const UNKNOWN_SUBSCRIPTIONTYPE = -1;
148
+
149
+ /**
150
+ * The SubscriptionInformation state for forced subscriptions.
151
+ *
152
+ * @var int
153
+ * @since API 1.9.0
154
+ */
155
+ const MANUAL_SUBSCRIPTION = 5;
156
+
157
+ /**
158
+ * The SubscriptionInformation state for forced unsubscriptions.
159
+ *
160
+ * @var int
161
+ * @since API 1.9.0
162
+ */
163
+ const MANUAL_UNSUBSCRIPTION = 6;
164
+
165
+ /**
166
+ * The SubscriptionInformation state for duplicate subscriptions.
167
+ *
168
+ * @var int
169
+ * @since API 1.9.0
170
+ */
171
+ const DUPLICATE_SUBSCRIPTION = 7;
172
+
173
+ /**
174
+ * The SubscriptionInformation state for unsubscription of unknown list members.
175
+ *
176
+ * @var int
177
+ * @since API 1.9.0
178
+ */
179
+ const NOT_IN_LIST_UNSUBSCRIPTION = 8;
180
+
181
+ /**
182
+ * The SubscriptionInformation state for a timed out subscription verification.
183
+ *
184
+ * @var int
185
+ * @since API 1.9.0
186
+ */
187
+ const SUBSCRIPTION_TIMED_OUT = 9;
188
+
189
+ /**
190
+ * The SubscriptionInformation state for an invalid subscription verification.
191
+ *
192
+ * @var int
193
+ * @since API 1.9.0
194
+ */
195
+ const SUBSCRIPTION_ID_NOT_VALID = 10;
196
+
197
+ /**
198
+ * The SubscriptionInformation state for subscriber email address != mail email address.
199
+ *
200
+ * @var int
201
+ * @since API 1.9.0
202
+ */
203
+ const SUBSCRIPTION_EMAIL_MISSMATCH = 11;
204
+
205
+ /**
206
+ * The SubscriptionInformation state for a timed out unsubscription verification.
207
+ *
208
+ * @var int
209
+ * @since API 1.9.0
210
+ */
211
+ const UNSUBSCRIPTION_TIMED_OUT = 12;
212
+
213
+ /**
214
+ * The SubscriptionInformation state for an invalid unsubscription verification.
215
+ *
216
+ * @var int
217
+ * @since API 1.9.0
218
+ */
219
+ const UNSUBSCRIPTION_ID_NOT_VALID = 13;
220
+
221
+ /**
222
+ * The SubscriptionInformation state for member email address != mail email address.
223
+ *
224
+ * @var int
225
+ * @since API 1.9.0
226
+ */
227
+ const UNSUBSCRIPTION_EMAIL_MISSMATCH = 14;
228
+
229
+ /**
230
+ * The SubscriptionInformation state for an error which occurred during the subscription.
231
+ *
232
+ * @var int
233
+ * @since API 1.9.0
234
+ */
235
+ const SUBSCRIPTION_INTERNAL_ERROR = 15;
236
+
237
+ /**
238
+ * The SubscriptionInformation state for an error which occurred during the unsubscription.
239
+ *
240
+ * @var int
241
+ * @since API 1.9.0
242
+ */
243
+ const UNSUBSCRIPTION_INTERNAL_ERROR = 16;
244
+
245
+ /**
246
+ * The SubscriptionInformation State for a subscription blocked by a blacklist agent.
247
+ *
248
+ * @var int
249
+ * @since API 1.9.0
250
+ */
251
+ const BLACKLISTED = 17;
252
+
253
+ /**
254
+ * The SubscriptionInformation state for an invalid mail address.
255
+ *
256
+ * @var int
257
+ * @since API 1.9.0
258
+ */
259
+ const INVALID_ADRESS_ERROR = 18;
260
+
261
+ /**
262
+ * The SubscriptionInformation state for a bounced subscription verification.
263
+ *
264
+ * @var int
265
+ * @since API 1.9.0
266
+ */
267
+ const SUBSCRIPTION_VERIFICATION_BOUNCED = 19;
268
+
269
+ /**
270
+ * The SubscriptionInformation state for a bounced unsubscription verification.
271
+ *
272
+ * @var int
273
+ * @since API 1.9.0
274
+ */
275
+ const UNSUBSCRIPTION_VERIFICATION_BOUNCED = 20;
276
+
277
+ /**
278
+ * The SubscriptionInformation state for an unsubscription received via an unsubscription header.
279
+ *
280
+ * @var int
281
+ * @since API 1.9.0
282
+ */
283
+ const LIST_UNSUBSCRIBE_HEADER_UNSUBSCRIPTION = 21;
284
+
285
+
286
+
287
+ /**
288
+ * Returns the whole log message as string.
289
+ *
290
+ * @return string the log message as string.
291
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
292
+ */
293
+ function getLogMessage();
294
+
295
+
296
+ /**
297
+ * Returns the id of the list associated with this entry.
298
+ *
299
+ * @return int the id of the list associated with this entry.
300
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
301
+ */
302
+ function getListId() ;
303
+
304
+
305
+ /**
306
+ * Returns the type of the entry. May be one of:
307
+ * <ul>
308
+ * <li><i>BLACKLISTED</i>: The recipient could not be subscribed because of a blacklist entry.
309
+ * <li><i>DUPLICATE_SUBSCRIPTION</i>: The recipient could not be subscribed because she/he is already subscribed.
310
+ * <li><i>INVALID_ADRESS_ERROR</i>: The recipient could not be subscribed because the email address is not conform
311
+ * to the RFC standard.
312
+ * <li><i>LIST_UNSUBSCRIBE_HEADER_UNSUBSCRIPTION</i>: The recipient was unsubscribed using header unsubscription.
313
+ * <li><i>MANUAL_SUBSCRIPTION</i>: The recipient was subscribed by an Inxmail user.
314
+ * <li><i>MANUAL_UNSUBSCRIPTION</i>: The recipient was unsubscribed by an Inxmail user.
315
+ * <li><i>NOT_IN_LIST_UNSUBSCRIPTION</i>: The recipient could not be unsubscribed because she/he is not
316
+ * subscribed.
317
+ * <li><i>PENDING_SUBSCRIPTION</i>: The subscription of the recipient is in progress (Double Opt In).
318
+ * <li><i>PENDING_UNSUBSCRIPTION</i>: The unsubscription of the recipient is in progress (Double Opt Out).
319
+ * <li><i>SUBSCRIPTION_EMAIL_MISSMATCH</i>: The recipient could not be subscribed because of an email address
320
+ * mismatch.
321
+ * <li><i>SUBSCRIPTION_ID_NOT_VALID</i>: An invalid subscription verification was received (Double Opt In).
322
+ * <li><i>SUBSCRIPTION_INTERNAL_ERROR</i>: The recipient could not be subscribed due to an internal error.
323
+ * <li><i>SUBSCRIPTION_TIMED_OUT</i>: The subscription of the recipient timed out (Double Opt In).
324
+ * <li><i>SUBSCRIPTION_VERIFICATION_BOUNCED</i>: A subscription verification mail bounced.
325
+ * <li><i>UNSUBSCRIPTION_EMAIL_MISSATCH</i>: The recipient could not be unsubscribed because of an email address
326
+ * <li><i>UNSUBSCRIPTION_ID_NOT_VALID</i>: An invalid unsubscription verification was received (Double Opt Out).
327
+ * <li><i>UNSUBSCRIPTION_INTERNAL_ERROR</i>: The recipient could not be unsubscribed due to an internal error.
328
+ * <li><i>UNSUBSCRIPTION_TIMED_OUT</i>: The subscription of the recipient timed out (Double Opt Out).
329
+ * <li><i>UNSUBSCRIPTION_VERIFICATION_BOUNCED</i>: An unsubscription verification mail bounced.
330
+ * <li><i>VERIFIED_SUBSCRIPTION</i>: A recipient subscription has been verified.
331
+ * <li><i>VERIFIED_UNSUBSCRIPTION</i>: A recipient unsubscription has been verified.
332
+ * <li><i>UNKNOWN_SUBSCRIPTIONTYPE</i>: The log entry type is unknown.
333
+ * </ul>
334
+ *
335
+ * @return int the type of this entry.
336
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
337
+ */
338
+ function getType();
339
+
340
+
341
+ /**
342
+ * Returns the datetime of the entry.
343
+ *
344
+ * @return string the datetime. The datetime will be returned as ISO 8601 formatted datetime string.
345
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
346
+ */
347
+ function getEntryDatetime();
348
+
349
+
350
+ /**
351
+ * Returns the email address associated with this entry.
352
+ *
353
+ * @return the email address associated with this entry.
354
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
355
+ */
356
+ function getEmailAddress();
357
+
358
+
359
+ /**
360
+ * Returns the id of the recipient associated with this entry, if the recipient exists.
361
+ *
362
+ * @return the id of the recipient associated with this entry, if the recipient exists.
363
+ * @throws Inx_Api_DataException if the recipient does not exists or the recipient state is unknown.
364
+ * May also occur if no row is selected (e.g. you forgot to call next()).
365
+ */
366
+ function getRecipientId();
367
+
368
+
369
+ /**
370
+ * Returns the state of the recipient associated with the current log entry. May be one of:
371
+ * <ul>
372
+ * <li><i>RECIPIENT_STATE_UNKNOWN_OR_DELETED</i> - if the recipient state is unknown or the recipient was deleted.
373
+ * <li><i>RECIPIENT_STATE_EXISTENT</i> - if the recipient exists.
374
+ * </ul>
375
+ *
376
+ * @return the recipient state.
377
+ * @throws Inx_Api_DataException if the recipient state cannot be determined.
378
+ */
379
+ function getRecipientState();
380
+
381
+
382
+ /**
383
+ * Returns the integer value for the given recipient Attribute.
384
+ *
385
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
386
+ * @return int the integer value.
387
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
388
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>integer</i>.
389
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
390
+ */
391
+ function getInteger( Inx_Api_Recipient_Attribute $attr ) ;
392
+
393
+
394
+ /**
395
+ * Returns the string value for the given recipient Attribute.
396
+ *
397
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
398
+ * @return string the string value.
399
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
400
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>string</i>.
401
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
402
+ */
403
+ function getString(Inx_Api_Recipient_Attribute $attr );
404
+
405
+
406
+ /**
407
+ * Returns the datetime value for the given recipient Attribute.
408
+ *
409
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
410
+ * @return string the datetime value. The datetime will be returned as ISO 8601 formatted datetime string.
411
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
412
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>datetime</i>.
413
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
414
+ */
415
+ function getDatetime(Inx_Api_Recipient_Attribute $attr );
416
+
417
+
418
+ /**
419
+ * Returns the date value for the given recipient Attribute.
420
+ *
421
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
422
+ * @return string the date value. The date will be returned as ISO 8601 formatted date string.
423
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
424
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>date</i>.
425
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
426
+ */
427
+ function getDate(Inx_Api_Recipient_Attribute $attr );
428
+
429
+
430
+ /**
431
+ * Returns the time value for the given recipient Attribute.
432
+ *
433
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
434
+ * @return string the time value. The time will be returned as ISO 8601 formatted time string.
435
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
436
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>time</i>.
437
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
438
+ */
439
+ function getTime(Inx_Api_Recipient_Attribute $attr );
440
+
441
+
442
+ /**
443
+ * Returns the float value for the given recipient Attribute.
444
+ *
445
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
446
+ * @return float the float value.
447
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
448
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>float</i>.
449
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
450
+ */
451
+ function getDouble( Inx_Api_Recipient_Attribute $attr );
452
+
453
+
454
+ /**
455
+ * Returns the bool value for the given recipient Attribute.
456
+ *
457
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
458
+ * @return bool the bool value.
459
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
460
+ * @throws Inx_Api_IllegalStateException if the requested attribute is not of type <i>bool</i>.
461
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
462
+ */
463
+ function getBoolean(Inx_Api_Recipient_Attribute $attr );
464
+
465
+
466
+ /**
467
+ * Returns the value for the given recipient Attribute.<br>
468
+ *
469
+ * @param Inx_Api_Recipient_Attribute $attr the recipient attribute to be retrieved.
470
+ * @return mixed the value.
471
+ * @throws Inx_Api_IllegalArgumentException if the requested attribute was not fetched.
472
+ * @throws Inx_Api_DataException if no row is selected (e.g. you forgot to call next()).
473
+ */
474
+ function getObject(Inx_Api_Recipient_Attribute $attr );
475
+
476
+
477
+ /**
478
+ * Moves the cursor to the front of this <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object,
479
+ * just before the first row.
480
+ * This method has no effect if the result set contains no rows.
481
+ */
482
+ function beforeFirstRow();
483
+
484
+
485
+ /**
486
+ * Moves the cursor to the end of this <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object,
487
+ * just after the last row.
488
+ * This method has no effect if the result set contains no rows.
489
+ */
490
+ function afterLastRow();
491
+
492
+
493
+ /**
494
+ * Moves the cursor to the given row number in this <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object.
495
+ * The first row is row 0, the second is row 1, and so on.
496
+ *
497
+ * @param int $row the number of the row to which the cursor should move.
498
+ */
499
+ function setRow( $row );
500
+
501
+
502
+ /**
503
+ * Retrieves the current row number. The first row is number 0, the second number 1, and so on.
504
+ *
505
+ * @return int the current row number.
506
+ */
507
+ function getRow();
508
+
509
+
510
+ /**
511
+ * Moves the cursor down one row from its current position.
512
+ * A <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> cursor is initially positioned before the first row;
513
+ * the first call to the method <i>next()</i> makes the first row the current row;
514
+ * the second call makes the second row the current row, and so on.
515
+ *
516
+ * @return bool <i>true</i> if the new current row is valid, <i>false</i> if there are no more rows.
517
+ */
518
+ function next();
519
+
520
+
521
+ /**
522
+ * Moves the cursor to the previous row in this <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object.
523
+ *
524
+ * @return bool <i>true</i> if the cursor is on a valid row; <i>false</i> if it is off the result set.
525
+ */
526
+ function previous();
527
+
528
+
529
+ /**
530
+ * Returns the number of rows in this <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object.
531
+ *
532
+ * @return int the number of rows.
533
+ */
534
+ function getRowCount();
535
+
536
+
537
+ /**
538
+ * Releases the resources associated with this <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object on
539
+ * the server immediately.
540
+ * <p>
541
+ * An <i>Inx_Api_Subscription_SubscriptionLogEntryRowSet</i> object <strong>must</strong> be closed
542
+ * once it is not needed anymore to prevent memory leaks and other potentially harmful side effects.
543
+ */
544
+ function close();
545
+
546
+ }
547
+
lib/Inx/Api/Subscription/SubscriptionManager.php ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Subscription
6
+ */
7
+ /**
8
+ * If the subscription feature is enabled for a standard list, the <i>Inx_Api_Subscription_SubscriptionManager</i> can
9
+ * be used to subscribe and unsubscribe recipients and to retrieve log entries concerning subscription.
10
+ * <p>
11
+ * The behaviour is the same as if a recipient subscribes to a list via a web frontend.
12
+ * For example, if double opt in is configured, calling <i>processSubscription()</i> will start the normal double opt
13
+ * in subscription process.
14
+ * <p>
15
+ * The subscription process requires some information:
16
+ * <p>
17
+ * <ul>
18
+ * <li><i>The source identifier</i>: A string which describes the source of the subscription (e.g. the name of the
19
+ * landing page)
20
+ * <li><i>The remote address</i>: The IP address of the subscriber
21
+ * <li><i>The list context</i>: The mailing list to which the recipient shall be subscribed
22
+ * <li><i>The email address</i>: The email address of the subscriber
23
+ * <li><i>An attribute map</i>: An associative array of key-value pairs used to specify certain recipient attribute values
24
+ * </ul>
25
+ * <p>
26
+ * The following snippet shows how to subscribe the recipient with the email address <i>name@company.com</i>, the last
27
+ * name <i>Smith</i>, the birthday <i>1994-10-25</i> and two children to the specified list, using the specified remote
28
+ * address and <i>Hompage(german)</i> as source:
29
+ * <p>
30
+ *
31
+ * <PRE>
32
+ * $aAttributes = array(
33
+ * "Lastname" => "Smith",
34
+ * "Birthday" => "2004-05-06",
35
+ * "Children" => 2
36
+ * );
37
+ *
38
+ * $oSubscriptionManager = $oSession->getSubscriptionManager();
39
+ * $iResult = $oSubscriptionManager->processSubscription( "Homepage(german)", $sRemoteAddr, $oListContext,
40
+ * "name@company.com", $aAttributes );
41
+ * </PRE>
42
+ * <p>
43
+ * The unsubscription of recipients works pretty much the same.
44
+ * There is only one additional parameter: the <i>mailing reference</i>.
45
+ * This string identifies the mailing which contains the link used to unsubscribe the recipient.
46
+ * However, the mailing reference is only known if the link used for the unsubscription is known.
47
+ * This is the case for unsubscription JSPs but not for common API usage.
48
+ * In most cases the unsubscription of a recipient is accomplished using the <i>Inx_Api_Recipient_RecipientRowSet</i> or
49
+ * the <i>Inx_Api_Recipient_BatchChannel</i>.
50
+ * <p>
51
+ * The following snippet shows how to unsubscribe the recipient with the email address <i>name@company.com</i> from
52
+ * the specified list, using the specified remote address and mailing reference and <i>Homepage(german)</i> as source:
53
+ *
54
+ * <PRE>
55
+ * $oSubscriptionManager = $oSession->getSubscriptionManager();
56
+ * $iResult = $oSubscriptionManager->processUnsubscription( &quot;Homepage(german)&quot;, $sRemoteAddr, $oListContext, &quot;name@company.com&quot;, $sMailingRef, null );
57
+ * </PRE>
58
+ * <p>
59
+ * The result is either <i>PROCESS_ACTIVATION_SUCCESSFULLY</i> if the subscription or unsubscription succeeded, or
60
+ * <i>PROCESS_ACTIVATION_FAILED_ADDRESS_ILLEGAL</i> if the address is not conform to the RFC standard.
61
+ * <p>
62
+ * In most circumstances, you would add the recipient to the system list with all his profile data prior to calling the SubscriptionManager.
63
+ * For an example on how to add recipients to the system list, see the <i>Inx_Api_Recipient_RecipientContext</i> documentation.
64
+ * <p>
65
+ * The <i>Inx_Api_Subscription_SubscriptionManager</i> may also be used to retrieve log entries concerning subscription.
66
+ * For example you can retrieve all log entries associated with the subscription and unsubscription of a specific list in the last month.
67
+ * The following snippet shows how to do this and prints out some of the information:
68
+ *
69
+ * <pre>
70
+ * // create start date
71
+ * $sOneMonthAgo = date('c', strtotime("-1 month"));
72
+ *
73
+ * // create recipient context and attributes to query
74
+ * $oRecipientContext = $oSession->createRecipientContext();
75
+ * $oRecipientMetaData = $oRecipientContext->getMetaData();
76
+ * $oAttribute_email = $oRecipientMetaData->getEmailAttribute();
77
+ * $oAttribute_lastname = $oRecipientMetaData->getUserAttribute( &quot;Lastname&quot; );
78
+ * $aAttributes = array( $oAttribute_email, $oAttribute_lastname );
79
+ *
80
+ * $oSubscriptionManager = $oSession->getSubscriptionManager();
81
+ * $oSubscriptionLogEntryRowSet = $oSubscriptionManager->getLogEntriesAfterAndList( $oListContext, $sOneMonthAgo, $oRecipientContext, $aAttributes );
82
+ *
83
+ * while( $oSubscriptionLogEntryRowSet->next() )
84
+ * {
85
+ * echo &quot;Log message: &quot;.$oSubscriptionLogEntryRowSet->getLogMessage().&quot;&#60;br&#62;&quot;;
86
+ * echo &quot;Log date: &quot;.$oSubscriptionLogEntryRowSet->getEntryDatetime().&quot;&#60;br&#62;&quot;;
87
+ * echo &quot;Email address: &quot;.$oSubscriptionLogEntryRowSet->getString( $oAttribute_email ).&quot;&#60;br&#62;&quot;;
88
+ * echo &quot;Lastname: &quot;.$oSubscriptionLogEntryRowSet->getString( $oAttribute_lastname ).&quot;&#60;br&#62;&#60;br&#62;&quot;;
89
+ * }
90
+ * </pre>
91
+ *
92
+ * For more information on this topic, see the <i>Inx_Api_Subscruption_SubscriptionLogEntryRowSet</i> documentation.
93
+ *
94
+ * @see Inx_Api_Subscruption_SubscriptionLogEntryRowSet
95
+ * @see Inx_Api_Recipient_RecipientContext
96
+ * @see Inx_Api_Recipient_RecipientRowSet
97
+ * @see Inx_Api_Recipient_BatchChannel
98
+ * @since API 1.0.0
99
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
100
+ * @package Inxmail
101
+ * @subpackage Subscription
102
+ */
103
+ interface Inx_Api_Subscription_SubscriptionManager
104
+ {
105
+ /**
106
+ * Subscription or Unsubscription process has been successfully activated.
107
+ *
108
+ * @var int
109
+ */
110
+ const PROCESS_ACTIVATION_SUCCESSFULLY = 3000;
111
+
112
+ /**
113
+ * Subscription or Unsubscription process activation has failed, the address is not conform to the RFC standard.
114
+ *
115
+ * @var int
116
+ */
117
+ const PROCESS_ACTIVATION_FAILED_ADDRESS_ILLEGAL = 3002;
118
+
119
+
120
+ /**
121
+ * Activates the subscription process for the specified email address and sets the attribute values specified in the
122
+ * given associative array.
123
+ *
124
+ * @param string $sSourceIdentifier the source identifier used for reports (e.g. the name of the landing page).
125
+ * @param string $sRemoteAddress the remote IP address of the subscriber.
126
+ * @param Inx_Api_List_StandardListContext $oListContext the list to which the recipient shall be subscribed.
127
+ * @param string $sEmailAddress the email address of the recipient.
128
+ * @param associative array $aAttrKeyValuePairs a map of attribute key/value-pairs which will be set for the recipient;
129
+ * may be <i>null</i> or ommitted.
130
+ * @return int the state of the process activation. May be one of:
131
+ * <ul>
132
+ * <li><i>PROCESS_ACTIVATION_SUCCESSFULLY</i>: the process was successfully activated
133
+ * <li><i>PROCESS_ACTIVATION_FAILED_ADDRESS_ILLEGAL</i>: the provided email address is not conform to the
134
+ * RFC standard.
135
+ * </ul>
136
+ * @throws Inx_Api_FeatureNotAvailableException if the subscription feature is not enabled.
137
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
138
+ * <i>Inx_Api_UserRights::SUBSCRIPTION_FEATURE_USE</i>
139
+ * @since API 1.0.2
140
+ */
141
+ public function processSubscription( $sSourceIdentifier = null, $sRemoteAddress = null,
142
+ Inx_Api_List_StandardListContext $oListContext, $sEmailAddress, /*Map*/ $aAttrKeyValuePairs=array() );
143
+
144
+
145
+ /**
146
+ * Activates the unsubscription process for the specified email address and mailing id.
147
+ * The mailing id specifies the mailing, which contains the unsubscription link used to unsubscribe the recipient.
148
+ *
149
+ * @param string $sSourceIdentifier the source identifier used for reports (e.g. the name of the landing page).
150
+ * @param string $sRemoteAddress the remote IP address of the unsubscriber.
151
+ * @param Inx_Api_List_StandardListContext $ListContext the list from which the recipient shall be unsubscribed.
152
+ * @param string $sEmailAddress the email address of the recipient.
153
+ * @param int $iMailingId the id of the mailing which contains the used unsubscription link.
154
+ * @return the state of the process activation. May be one of:
155
+ * <ul>
156
+ * <li><i>PROCESS_ACTIVATION_SUCCESSFULLY</i>: the process was successfully activated
157
+ * <li><i>PROCESS_ACTIVATION_FAILED_ADDRESS_ILLEGAL</i>: the provided email address is not conform to the
158
+ * RFC standard.
159
+ * </ul>
160
+ * @throws FeatureNotAvailableException Inx_Api_FeatureNotAvailableException if the subscription feature is not enabled.
161
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
162
+ * <i>Inx_Api_UserRights::SUBSCRIPTION_FEATURE_USE</i>
163
+ * @since API 1.5.0
164
+ * @deprecated use <i>processUnsubscription3( $sSourceIdentifier, $sRemoteAddress,
165
+ Inx_Api_List_ListContext $oListContext, $sEmailAddress, $sMailingRef, $aAttrKeyValuePairs = null )</i>
166
+ */
167
+ public function processUnsubscription( $sSourceIdentifier = null, $sRemoteAddress = null,
168
+ Inx_Api_List_StandardListContext $ListContext, $sEmailAddress, $iMailingId = 0 );
169
+
170
+
171
+ /**
172
+ * Activates the unsubscription process for the specified email address and mailing id and sets the attribute values
173
+ * specified in the given associative array.
174
+ * The mailing id specifies the mailing, which contains the unsubscription link used to unsubscribe the recipient.
175
+ *
176
+ * @param string $sSourceIdentifier the source identifier used for reports (e.g. the name of the landing page).
177
+ * @param string $sRemoteAddress the remote IP address of the unsubscriber.
178
+ * @param Inx_Api_List_StandardListContext $oListContext the list from which the recipient shall be unsubscribed.
179
+ * @param string $sEmailAddress the email address of the recipient.
180
+ * @param int $iMailingId the id of the mailing which contains the used unsubscription link.
181
+ * @param array $aAttrKeyValuePairs an associative array of attribute key/value-pairs which will be set for the recipient;
182
+ * may be <i>null</i> or ommitted.
183
+ * @return int the state of the process activation. May be one of:
184
+ * <ul>
185
+ * <li><i>PROCESS_ACTIVATION_SUCCESSFULLY</i>: the process was successfully activated
186
+ * <li><i>PROCESS_ACTIVATION_FAILED_ADDRESS_ILLEGAL</i>: the provided email address is not conform to the
187
+ * RFC standard.
188
+ * </ul>
189
+ * @throws Inx_Api_FeatureNotAvailableException if the subscription feature is not enabled.
190
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
191
+ * <i>Inx_Api_UserRights::SUBSCRIPTION_FEATURE_USE</i>
192
+ * @since API 1.9.0
193
+ * @deprecated use <i>processUnsubscription3( $sSourceIdentifier, $sRemoteAddress,
194
+ Inx_Api_List_ListContext $oListContext, $sEmailAddress, $sMailingRef, $aAttrKeyValuePairs = null )</i> instead.
195
+ */
196
+ public function processUnsubscription3( $sSourceIdentifier, $sRemoteAddress,
197
+ Inx_Api_List_StandardListContext $oListContext, $sEmailAddress, $iMailingId, $aAttrKeyValuePairs = null );
198
+
199
+
200
+ /**
201
+ * Activates the unsubscription process for the specified email address and mailing reference and sets the attribute
202
+ * values specified in the given associative array.
203
+ * The mailing reference specifies the mailing, which contains the unsubscription link used to unsubscribe the recipient.
204
+ *
205
+ * @param string $sSourceIdentifier the source identifier used for reports (e.g. the name of the landing page).
206
+ * @param string $sRemoteAddress the remote IP address of the unsubscriber.
207
+ * @param Inx_Api_List_ListContext $oListContext the list from which the recipient shall be unsubscribed.
208
+ * @param string $sEmailAddress the email address of the recipient.
209
+ * @param string $sMailingRef the mailing reference of the mailing which contains the used unsubscription link.
210
+ * @param array $aAttrKeyValuePairs an associative array of attribute key/value-pairs which will be set for the recipient;
211
+ * may be <i>null</i> or ommitted.
212
+ * @return the state of the process activation. May be one of:
213
+ * <ul>
214
+ * <li><i>PROCESS_ACTIVATION_SUCCESSFULLY</i>: the process was successfully activated
215
+ * <li><i>PROCESS_ACTIVATION_FAILED_ADDRESS_ILLEGAL</i>: the provided email address is not conform to the
216
+ * RFC standard.
217
+ * </ul>
218
+ * @throws Inx_Api_FeatureNotAvailableException if the subscription feature is not enabled.
219
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
220
+ * <i>Inx_Api_UserRights::SUBSCRIPTION_FEATURE_USE</i>
221
+ * @since API 1.9.0
222
+ */
223
+ public function processUnsubscription4( $sSourceIdentifier, $sRemoteAddress,
224
+ Inx_Api_List_StandardListContext $oListContext, $sEmailAddress, $sMailingRef, $aAttrKeyValuePairs = null );
225
+
226
+
227
+ /**
228
+ * Returns an <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries.
229
+ *
230
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
231
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
232
+ * may be <i>null</i>.
233
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
234
+ * (un)subscription log entries.
235
+ */
236
+ public function getAllLogEntries($rc, $attrs );
237
+
238
+
239
+ /**
240
+ * Returns an <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries for
241
+ * a given list.
242
+ *
243
+ * @param Inx_Api_List_ListContext $lc the list for which the (un)subscription log entries shall be fetched.
244
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
245
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
246
+ * may be <i>null</i>.
247
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
248
+ * (un)subscription log entries.
249
+ */
250
+ public function getLogEntriesForList( $lc, $rc, $attrs );
251
+
252
+
253
+ /**
254
+ * Returns a <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries for a
255
+ * given list and before a given date.
256
+ *
257
+ * @param Inx_Api_List_ListContext $lc the list for which the (un)subscription log entries shall be fetched.
258
+ * @param string $before all log entries before this date will be fetched.
259
+ * The date has to be passed as ISO8601 formatted datetime string.
260
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
261
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
262
+ * may be <i>null</i>.
263
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
264
+ * (un)subscription log entries for a given list and before a given date.
265
+ */
266
+ public function getLogEntriesBeforeAndList( $lc, $before, $rc, $attrs );
267
+
268
+
269
+ /**
270
+ * Returns a <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries for a
271
+ * given list and after a given date.
272
+ *
273
+ * @param Inx_Api_List_ListContext $lc the list for which the (un)subscription log entries shall be fetched.
274
+ * @param string $after all log entries after this date will be fetched.
275
+ * The date has to be passed as ISO8601 formatted datetime string.
276
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
277
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
278
+ * may be <i>null</i>.
279
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
280
+ * (un)subscription log entries for a given list and after a given date.
281
+ */
282
+ public function getLogEntriesAfterAndList( $lc, $after, $rc, $attrs );
283
+
284
+
285
+ /**
286
+ * Returns a <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries for a
287
+ * given list and between the given dates.
288
+ *
289
+ * @param Inx_Api_List_ListContext $lc the list for which the (un)subscription log entries shall be fetched.
290
+ * @param string $start the start date for the search.
291
+ * The date has to be passed as ISO8601 formatted datetime string.
292
+ * @param string $end the end date for the search.
293
+ * The date has to be passed as ISO8601 formatted datetime string.
294
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
295
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
296
+ * may be <i>null</i>.
297
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
298
+ * (un)subscription log entries for a given list and between the given dates.
299
+ */
300
+ public function getLogEntriesBetweenAndList( $lc, $start, $end, $rc, $attrs );
301
+
302
+
303
+ /**
304
+ * Returns a <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries
305
+ * before a given date.
306
+ *
307
+ * @param string $before all log entries before this date will be fetched.
308
+ * The date has to be passed as ISO8601 formatted datetime string.
309
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
310
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
311
+ * may be <i>null</i>.
312
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
313
+ * un/subscription log entries before a given date.
314
+ */
315
+ public function getLogEntriesBefore( $before, $rc, $attrs );
316
+
317
+
318
+ /**
319
+ * Returns a <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries
320
+ * after a given date.
321
+ *
322
+ * @param string $after all log entries after this date will be fetched.
323
+ * The date has to be passed as ISO8601 formatted datetime string.
324
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
325
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
326
+ * may be <i>null</i>.
327
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
328
+ * un/subscription log entries after a given date.
329
+ */
330
+ public function getLogEntriesAfter( $after, $rc, $attrs );
331
+
332
+
333
+ /**
334
+ * Returns a <i>Inx_Api_Subsciption_SubscriptionLogEntryRowSet</i> containing all existing (un)subscription log entries
335
+ * between given dates.
336
+ *
337
+ * @param string $start the start date for the search.
338
+ * The date has to be passed as ISO8601 formatted datetime string.
339
+ * @param string $end the end date for the search.
340
+ * The date has to be passed as ISO8601 formatted datetime string.
341
+ * @param Inx_Api_Recipient_RecipientContext $rc the <i>RecipientContext</i> used to fetch the attribute data.
342
+ * @param array $attrs an array of recipient attributes (Inx_Api_Recipient_Attribute) which are fetched for later retrieval;
343
+ * may be <i>null</i>.
344
+ * @return Inx_Api_Subscription_SubscriptionLogEntryRowSet a <i>SubscriptionLogEntryRowSet</i> containing all existing
345
+ * (un)subscription log entries between given dates.
346
+ */
347
+ public function getLogEntriesBetween( $start, $end, $rc, $attrs );
348
+
349
+ }
lib/Inx/Api/Testprofiles/TestRecipientContext.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Recipient
6
+ */
7
+
8
+ /**
9
+ * The <i>Inx_Api_Testprofiles_TestRecipientContext</i> is used to access and manipulate test recipient data.
10
+ * The following operations can be performed using the <i>Inx_Api_Testprofiles_TestRecipientContext</i>:
11
+ * <p>
12
+ * <ul>
13
+ * <li>Fetch test recipient data as <i>Inx_Api_Testprofiles_TestRecipientRowSet</i>
14
+ * <li>Add and remove test recipients
15
+ * <li>Retrieve and update test recipient attribute values
16
+ * </ul>
17
+ * There are various methods for fetching test recipient data as <i>Inx_Api_Testprofiles_TestRecipientRowSet</i>.
18
+ * The following snippet exemplary shows how to use one specific <code>select</code> method which retrieves all
19
+ * test recipients of the specified list whose name is equal to smith, ignoring case considerations:
20
+ *
21
+ * <pre>
22
+ * $oTestRecipientContext = $oSession->createTestRecipientContext();
23
+ * $oRecipientContext = $oSession->createRecipientContext();
24
+ * $oAttribute_name = $oRecipientContext->getMetaData()->getUserAttribute( &quot;name&quot; );
25
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
26
+ *
27
+ * $sNameFilter = 'Column(&quot;name&quot;) LIKE &quot;smith&quot;';
28
+ * $oTestRecipientRowSet = $oTestRecipientContext->select( $oListContext, null, $sNameFilter );
29
+ *
30
+ * while( $oTestRecipientRowSet->next() )
31
+ * {
32
+ * echo $oTestRecipientRowSet->getString( $oAttribute_name ).&quot;&#60;br&#62;&quot;;
33
+ * }
34
+ *
35
+ * $oTestRecipientRowSet->close();
36
+ * </pre>
37
+ *
38
+ * <strong>Note:</strong> The % sign can not be used as wildcard in the LIKE statements of the <i>TestRecipientContext</i>.
39
+ * If you use a filter which includes the % sign, the filter will only match test recipients which contain the % sign.<br>
40
+ * For example the filter statement <i>&quot;Column(\&quot;name\&quot;) LIKE \&quot;s%\&quot;&quot;</i> will match test
41
+ * recipients whose name is either s% or S% but not, for example, Smith.
42
+ * <p>
43
+ * Adding and removing recipients can be accomplished by using the <i>Inx_Api_Testprofiles_TestRecipientRowSet</i>.
44
+ * The name and email address are mandatory fields and must be updated.
45
+ * Otherwise an <i>Inx_Api_Recipient_IllegalValueException</i> will be triggered.
46
+ * The following snippet shows how to add a new test recipient using an empty <i>TestRecipientRowSet</i>:
47
+ *
48
+ * <pre>
49
+ * $oTestRecipientContext = $oSession->createTestRecipientContext();
50
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
51
+ * $oTestRecipientRowSet = $oTestRecipientContext->createRowSet( $oListContext );
52
+ * $oAttribute_email = $oSession->createRecipientContext()->getMetaData()->getEmailAttribute();
53
+ *
54
+ * $oTestRecipientRowSet->moveToInsertRow();
55
+ * $oTestRecipientRowSet->updateName( &quot;New recipient&quot; );
56
+ * $oTestRecipientRowSet->updateString( $oAttribute_email, &quot;new@recipient.invalid&quot; );
57
+ * $oTestRecipientRowSet->commitRowUpdate();
58
+ * $oTestRecipientRowSet->close();
59
+ * </pre>
60
+ *
61
+ * Removing a recipient using the <i>TestRecipientRowSet</i> can be accomplished by selecting only one specific test recipient.
62
+ * To do so, use a filter expression on the email attribute.
63
+ * The following snippet shows how to do this:
64
+ *
65
+ * <pre>
66
+ * $oTestRecipientContext = $oSession->createTestRecipientContext();
67
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired list&quot; );
68
+ * $oTestRecipientRowSet = $oTestRecipientContext->select( $oListContext, null, 'Column(&quot;email&quot;) = &quot;abusive@recipient.invalid&quot;' );
69
+ *
70
+ * $oTestRecipientRowSet->next();
71
+ * $oTestRecipientRowSet->deleteRow();
72
+ * $oTestRecipientRowSet->close();
73
+ * </pre>
74
+ * <p>
75
+ * Test recipient attribute values can be updated using the
76
+ * <i>Inx_Api_Testprofiles_TestRecipientRowSet::setAttributeValue($oAttribute, $oValue)</i> method.
77
+ * The test recipient creation example further above used this method to update the email address of the newly created test recipient.
78
+ * <p>
79
+ * <strong>Note:</strong> Getting this context from the session will get a snapshot of the current attributes defined.
80
+ * This snapshot will be used for the lifetime of the context, changes in the underlying attribute configuration won't
81
+ * be reflected to it.
82
+ * This ensures that you can safely work with recipient data, even if other users possibly add or change attributes.
83
+ * <p>
84
+ * However, if a recipient attribute is deleted or the type is changed, this will also not be reflected to the
85
+ * <i>TestRecipientContext</i>.
86
+ * The attribute values may still be changed without any error, though this change will not be visible in Inxmail.
87
+ * The recipient attribute will not be undeleted.
88
+ * Therefore, it is not recommended to use the same test recipient context during long operations as the possibility
89
+ * of changes in the recipient attributes will rise.
90
+ * <p>
91
+ * <strong>Note:</strong> An <i>Inx_Api_Testprofiles_TestRecipientContext</i> object <strong>must</strong> be closed once it is not
92
+ * needed anymore to prevent memory leaks and other potentially harmful side effects.
93
+ *
94
+ * @see Inx_Api_Testprofiles_TestRecipientRowSet
95
+ * @see Inx_Api_Recipient_RecipientContext
96
+ * @see Inx_Api_Recipient_RecipientMetaData
97
+ * @since API 1.6
98
+ * @version $Revision: 9506 $ $Date: 2007-12-20 15:44:56 +0200 (Kt, 20 Grd 2007) $ $Author: vladas $
99
+ * @package Inxmail
100
+ * @subpackage Testprofiles
101
+ */
102
+ interface Inx_Api_Testprofiles_TestRecipientContext
103
+ {
104
+
105
+ /**
106
+ * Returns an <i>Inx_Api_Testprofiles_TestRecipientRowSet</i> containing all test recipients that are members of
107
+ * the given list and match the given filter and additional filter statement.
108
+ * The filter and additional filter statement attributes may be ommitted or <i>null</i>, though the list
109
+ * parameter is mandatory.
110
+ * <p>
111
+ * For further information on the filter statement syntax, see the
112
+ * <i>Inx_Api_Filter_Filter::updateStatement($sStatement)</i> documentation.
113
+ * <p>
114
+ * <strong>Note:</strong> The % sign can not be used as wildcard in the LIKE statements of the* <i>TestRecipientContext</i>.
115
+ * If you use a filter which includes the % sign, the filter will only match test recipients which contain the % sign.<br>
116
+ * For example the filter statement <i>'Column(&quot;name&quot;) LIKE &quot;s%&quot;'</i> will match test recipients
117
+ * whose name is either s% or S% but not, for example, Smith.
118
+ *
119
+ * @param Inx_Api_List_ListContext $list all members of this list will be selected.
120
+ * @param Inx_Api_Filter_Filter $oFilter the selection filter. May be ommitted or <i>null</i>.
121
+ * @param string $sAdditionalFilter the additional filter statement. May be ommitted or <i>null</i>.
122
+ * @return a <i>TestRecipientRowSet</i> containing all test recipients fetched by the given query.
123
+ * @throws Inx_Api_Recipient_SelectException if the selection failed.
124
+ */
125
+ public function select( Inx_Api_List_ListContext $list=null, Inx_Api_Filter_Filter $oFilter=null, $sAdditionalFilter=null );
126
+
127
+
128
+ /**
129
+ * Returns an empty <i>Inx_Api_Testprofiles_TestRecipientRowSet</i>.
130
+ * Use this to add new test recipients to the specified list.
131
+ *
132
+ * @param Inx_Api_List_ListContext $list the list context for which the test recipient should be created.
133
+ * @return an empty <i>TestRecipientRowSet</i>.
134
+ */
135
+ public function createRowSet( Inx_Api_List_ListContext $list );
136
+
137
+ /**
138
+ * Closes this test recipient context and releases any resources associated with it.
139
+ * An <i>Inx_Api_Testprofiles_TestRecipientContext</i> object <strong>must</strong> be closed once it is not
140
+ * needed anymore to prevent memory leaks and other potentially harmful side effects.
141
+ */
142
+ public function close();
143
+
144
+ }
145
+
146
+ ?>
lib/Inx/Api/Testprofiles/TestRecipientRowSet.php ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Testprofiles
6
+ */
7
+ /**
8
+ * An <i>Inx_Api_Testprofiles_TestRecipientRowSet</i> is best explained as a table of data representing a set of test
9
+ * recipients, which is usually generated by executing a selection that queries the test recipient context.
10
+ * <p>
11
+ * Test recipients (or test profiles) can be used to create a personalized preview of a mailing.
12
+ * A test recipient object holds the following information:
13
+ * <p>
14
+ * <ul>
15
+ * <li><i>The unique identifier (immutable)</i>: Uniquely identifies a test recipient.
16
+ * <li><i>The name / profile description</i>: Describes the test recipient. While this attribute is not required to be
17
+ * unique, still it is mandatory.
18
+ * <li><i>The email address</i>: Mandatory attribute which can be set using <i>updateString($oAttribute, $sValue)</i>.
19
+ * <li><i>Some other recipient attribute values</i>: Probably a test recipients contains other recipient attribute
20
+ * values which can be used to personalize a mailing.
21
+ * </ul>
22
+ * <P>
23
+ * A <i>TestRecipientRowSet</i> object maintains a cursor pointing to its current row of data.
24
+ * Initially the cursor is positioned before the first row.
25
+ * The <i>next()</i> method moves the cursor to the next row (test recipient), and because it returns <i>false</i>
26
+ * when there are no more rows in the <i>TestRecipientRowSet</i> object, it can be used in a <i>while</i> loop to
27
+ * iterate through the result set.
28
+ * <p>
29
+ * Be sure to call <i>next()</i> before the first retrieval statement on the row set.
30
+ * As stated above, initially the cursor is before the first row, thus no data can be retrieved from the row set before
31
+ * calling <i>next()</i>.
32
+ * Doing so will trigger an <i>Inx_Api_DataException</i>.
33
+ * <P>
34
+ * The <i>TestRecipientRowSet</i> interface provides <i>getter</i> methods (<i>getString</i>, <i>getInteger</i>, and so on)
35
+ * for retrieving attribute values from the current row.
36
+ * Values can be retrieved using the attribute object.
37
+ * <p>
38
+ * The following snippet shows how to retrieve the email address of all test recipients in the row set, thus also
39
+ * illustrating how to iterate over a <i>TestRecipientRowSet</i>:
40
+ *
41
+ * <pre>
42
+ * $oTestRecipientContext = $oSession->createTestRecipientContext();
43
+ * $oAttribute_email = $oSession->createRecipientContext()->getMetaData()->getEmailAttribute();
44
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired List&quot; );
45
+ * $oTestRecipientRowSet = $oTestRecipientContext->select( $oListContext );
46
+ *
47
+ * while( $oTestRecipientRowSet->next() )
48
+ * {
49
+ * echo $oTestRecipientRowSet->getString( $oAttribute_email ).&quot;&#60;br&#62;&quot;;
50
+ * }
51
+ *
52
+ * $oTestRecipientRowSet->close();
53
+ * </pre>
54
+ * <P>
55
+ * The update methods may be used in two ways:
56
+ * <ol>
57
+ * <LI>To update a column value in the current row.
58
+ * In a <i>TestRecipientRowSet</i> object, the cursor can be moved backwards and forwards, to an absolute position.
59
+ * The following snippet shows how to update the <i>Lastname</i> attribute in the fifth row of the
60
+ * <i>TestRecipientRowSet</i> object <i>trrs</i> and then uses the method <i>commitRowUpdate</i> to
61
+ * commit the changed data from which <i>trrs</i> was derived:
62
+ *
63
+ * <PRE>
64
+ * $oAttribute = $oRecipientMetaData->getUserAttribute( &quot;Lastname&quot; );
65
+ * $oTestRecipientRowSet->setRow( 4 ); // moves the cursor to the fifth row of trrs
66
+ * // updates the 'Lastname' attribute of row 4 (fifth row) to be 'Smith'
67
+ * $oTestRecipientRowSet->updateString( $oAttribute, &quot;Smith&quot; );
68
+ * $oTestRecipientRowSet->commitRowUpdate(); // updates the row in the data source
69
+ * </PRE>
70
+ * <LI>To insert attribute values into the insert row.
71
+ * The <i>TestRecipientRowSet</i> object has a special row associated with it that serves as a staging area for
72
+ * building a test recipient to be inserted.
73
+ * The following snippet shows how to move the cursor to the insert row and insert the new test recipient
74
+ * data into <i>trrs</i> and into the data source table using the method <i>commitRowUpdate</i>:
75
+ *
76
+ * <PRE>
77
+ * $oAttribute_email = $oRecipientMetaData->getEmailAttribute();
78
+ * $oAttribute_attr = $oRecipientMetaData->getUserAttribute( &quot;Lastname&quot; );
79
+ * $oTestRecipientRowSet->moveToInsertRow(); // moves cursor to the insert row
80
+ * // email attribute of the insert row to be smith@gmx.com - mandatory
81
+ * $oTestRecipientRowSet->updateString( $oAttribute_email, &quot;smith@gmx.com&quot; );
82
+ * // update profile description - mandatory
83
+ * $oTestRecipientRowSet->updateName( &quot;Smith&quot; );
84
+ * $oTestRecipientRowSet->updateString( $oAttribute_attr, &quot;Smith&quot; );
85
+ * $oTestRecipientRowSet->commitRowUpdate(); // insert the row in the data source
86
+ * </PRE>
87
+ *
88
+ * The code above will create a new recipient with the address smith@gmx.com, the name /
89
+ * profile description Smith and the last name Smith.
90
+ * Usually creating new recipients is accomplished using an empty <i>TestRecipientRowSet</i>.
91
+ * Such a row set can be obtained using the <i>Inx_Api_Testprofile_TestRecipientContext::createRowSet($oListContext)</i> method.
92
+ * However, the returned row set can only be used to create recipients, as there are no recipients in the row set.
93
+ * </ol>
94
+ * <p>
95
+ * All row changes except for the <i>remove()</i> method require a call of <i>commitRowUpdate()</i> to be reflected on the server.
96
+ * Any uncommitted changes will be lost once the <i>TestRecipientRowSet</i> is closed.
97
+ * However, calling <i>commitRowUpdate()</i> on deleted rows will trigger an <i>Inx_Api_DataException</i>, as the recipient
98
+ * in the current row no longer exists.
99
+ * <p>
100
+ * Note: To safely abandon all changes of the current row, use the <i>rollbackRowUpdate()</i> method.
101
+ * This will prevent any changes to the current row from being committed through <i>commitRowUpdate()</i>.
102
+ * Be aware that <i>rollbackRowUpdate</i> will only undo <i>uncommitted</i> changes to the current row.
103
+ * So, once you called <i>commitRowUpdate()</i> there is "no way back".
104
+ * <p>
105
+ * <strong>Note:</strong> An <i>Inx_Api_Testprofiles_TestRecipientRowSet</i> object <strong>must</strong> be closed once it is not
106
+ * needed anymore to prevent memory leaks and other potentially harmful side effects.
107
+ * <p>
108
+ * For more information about the retrieval of test recipients, see the <i>Inx_Api_Testprofile_TestRecipientContext</i> documentation.
109
+ *
110
+ * @see Inx_Api_Testprofiles_TestRecipientContext
111
+ * @since API 1.6.0
112
+ * @version $Revision: 2934 $ $Date: 2005-07-04 17:00:09 +0200 (Mo, 04 Jul 2005) $ $Author: bgn $
113
+ */
114
+ interface Inx_Api_Testprofiles_TestRecipientRowSet
115
+ {
116
+
117
+ /**
118
+ * Moves the cursor to the front of this <i>TestRecipientRowSet</i> object, just before the first row.
119
+ * This method has no effect if the result set contains no rows.
120
+ */
121
+ public function beforeFirstRow();
122
+
123
+
124
+ /**
125
+ * Moves the cursor to the end of this <i>TestRecipientRowSet</i> object, just after the last row.
126
+ * This method has no effect if the result set contains no rows.
127
+ */
128
+ public function afterLastRow();
129
+
130
+
131
+ /**
132
+ * Moves the cursor to the given row number in this <i>TestRecipientRowSet</i> object.
133
+ * The first row is row 0, the second is row 1, and so on.
134
+ *
135
+ * @param int $row the number of the row to which the cursor should move.
136
+ */
137
+ public function setRow( $row );
138
+
139
+
140
+ /**
141
+ * Retrieves the current row number.
142
+ * The first row is number 0, the second number 1, and so on.
143
+ *
144
+ * @return int the current row number.
145
+ */
146
+ public function getRow();
147
+
148
+
149
+ /**
150
+ * Moves the cursor down one row from its current position.
151
+ * A <i>TestRecipientRowSet</i> cursor is initially positioned before the first row;
152
+ * the first call to the method <i>next</i> makes the first row the current row;
153
+ * the second call makes the second row the current row, and so on.
154
+ *
155
+ * @return bool <i>true</i> if the new current row is valid, <i>false</i> if there are no more rows.
156
+ */
157
+ public function next();
158
+
159
+
160
+ /**
161
+ * Moves the cursor to the previous row in this <i>TestRecipientRowSet</i> object.
162
+ *
163
+ * @return bool <i>true</i> if the cursor is on a valid row, <i>false</i> if it is off the row set.
164
+ */
165
+ public function previous();
166
+
167
+
168
+ /**
169
+ * Returns the number of rows in this <i>TestRecipientRowSet</i> object.
170
+ *
171
+ * @return int the number of rows.
172
+ */
173
+ public function getRowCount();
174
+
175
+
176
+ /**
177
+ * Updates the underlying recipient on the server with the new contents of the current row of this
178
+ * <i>TestRecipientRowSet</i> object.
179
+ *
180
+ * @throws Inx_Api_Recipient_IllegalValueException if one of the attribute values is invalid or missing.
181
+ * @throws Inx_Api_Recipient_DuplicateKeyException if the key value is already used.
182
+ * @throws Inx_Api_DataException if the recipient was deleted or no test recipient is selected (e.g. you forgot
183
+ * to call <i>next()</i>).
184
+ */
185
+ public function commitRowUpdate() ;
186
+
187
+
188
+ /**
189
+ * Reverts the updates made to the current row in this <i>TestRecipientRowSet</i> object.
190
+ * This method may be called after calling one or several update methods to roll back the updates made to a row.
191
+ * If no updates have been made or <i>commitRowUpdate</i> has already been called, this method has no effect.
192
+ */
193
+ public function rollbackRowUpdate();
194
+
195
+
196
+ /**
197
+ * Deletes the current row from this <i>TestRecipientRowSet</i> object.
198
+ * This method cannot be called when the cursor is on the insert row.
199
+ * Do <strong>not</strong> call <i>commitRowUpdate()</i> after invoking this method, as this would trigger an
200
+ * <i>Inx_Api_DataException</i>.
201
+ */
202
+ public function deleteRow();
203
+
204
+
205
+ /**
206
+ * Deletes the specified rows from this <i>TestRecipientRowSet</i> object.
207
+ * Do <strong>not</strong> call <i>commitRowUpdate()</i> on an affected row after invoking this method, as this
208
+ * would trigger an <i>Inx_Api_DataException</i>.
209
+ *
210
+ * @param Inx_Api_IndexSelection $selection the rows to be deleted.
211
+ */
212
+ public function deleteRows( Inx_Api_IndexSelection $selection );
213
+
214
+
215
+ /**
216
+ * Moves the cursor to the insert row.
217
+ * The current cursor position is remembered while the cursor is positioned on the insert row.
218
+ * The insert row is a special row associated with a <i>TestRecipientRowSet</i>.
219
+ * It is essentially a buffer where a new row may be constructed by calling the update methods prior to inserting
220
+ * the row into the row set.
221
+ * Only the update, getter, and <i>commitRowUpdate</i> method may be called when the cursor is on the insert row.
222
+ */
223
+ public function moveToInsertRow();
224
+
225
+
226
+ /**
227
+ * Reports whether the underlying test recipient is deleted or not.
228
+ *
229
+ * @return bool <i>true</i> if the underlying test recipient is deleted, <i>false</i> otherwise.
230
+ */
231
+ public function isRowDeleted();
232
+
233
+
234
+ /**
235
+ * Retrieves the test recipient id of the current row of this <i>TestRecipientRowSet</i> object.
236
+ *
237
+ * @return int the id of the current test recipient.
238
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
239
+ * forgot to call <i>next()</i>).
240
+ */
241
+ public function getId();
242
+
243
+
244
+ /**
245
+ * Retrieves the name/profile description of the test recipient in the current row of this
246
+ * <i>TestRecipientRowSet</i> object.
247
+ *
248
+ * @return string the name of the test recipient.
249
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
250
+ * forgot to call <i>next()</i>).
251
+ */
252
+ public function getName();
253
+
254
+
255
+ /**
256
+ * Updates the name/profile description of the test recipient in the current row of this
257
+ * <i>TestRecipientRowSet</i> object.
258
+ *
259
+ * @param string $sName the name of the test recipient profile.
260
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
261
+ * forgot to call <i>next()</i>).
262
+ */
263
+ public function updateName( $sName );
264
+
265
+
266
+ /**
267
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
268
+ * object as a <i>string</i>.
269
+ *
270
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
271
+ * @return string the attribute value as string.
272
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
273
+ * forgot to call <i>next()</i>).
274
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>string</i>.
275
+ */
276
+ public function getString( Inx_Api_Recipient_Attribute $oAttr );
277
+
278
+
279
+ /**
280
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
281
+ * object as a <i>bool</i>.
282
+ *
283
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
284
+ * @return bool the attribute value as bool.
285
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
286
+ * forgot to call <i>next()</i>).
287
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>bool</i>.
288
+ */
289
+ public function getBoolean( Inx_Api_Recipient_Attribute $oAttr );
290
+
291
+
292
+ /**
293
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
294
+ * object as an <i>integer</i>.
295
+ *
296
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
297
+ * @return int the attribute value as integer.
298
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
299
+ * forgot to call <i>next()</i>).
300
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>integer</i>.
301
+ */
302
+ public function getInteger( Inx_Api_Recipient_Attribute $oAttr );
303
+
304
+
305
+ /**
306
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
307
+ * object as a <i>float</i>.
308
+ *
309
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
310
+ * @return float the attribute value as float.
311
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
312
+ * forgot to call <i>next()</i>).
313
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>float</i>.
314
+ */
315
+ public function getDouble( Inx_Api_Recipient_Attribute $oAttr );
316
+
317
+
318
+ /**
319
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
320
+ * object as a <i>date</i>.
321
+ *
322
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
323
+ * @return string the date value as ISO 8601 formatted date string.
324
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
325
+ * forgot to call <i>next()</i>).
326
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>date</i>.
327
+ */
328
+ public function getDate( Inx_Api_Recipient_Attribute $oAttr );
329
+
330
+
331
+ /**
332
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
333
+ * object as a <i>time</i>.
334
+ *
335
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
336
+ * @return string the time value as ISO 8601 formatted time string.
337
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
338
+ * forgot to call <i>next()</i>).
339
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>time</i>.
340
+ */
341
+ public function getTime( Inx_Api_Recipient_Attribute $oAttr );
342
+
343
+
344
+ /**
345
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
346
+ * object as a <i>datetime</i>.
347
+ *
348
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
349
+ * @return string the datetime value as ISO 8601 formatted datetime string.
350
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
351
+ * forgot to call <i>next()</i>).
352
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>datetime</i>.
353
+ */
354
+ public function getDatetime( Inx_Api_Recipient_Attribute $oAttr );
355
+
356
+
357
+ /**
358
+ * Retrieves the value of the designated attribute in the current row of this <i>TestRecipientRowSet</i>
359
+ * object.
360
+ *
361
+ * @param Inx_Api_Recipient_Attribute $oAttr the designated attribute.
362
+ * @return mixed the attribute value.
363
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
364
+ * forgot to call <i>next()</i>).
365
+ */
366
+ public function getObject( Inx_Api_Recipient_Attribute $attr ) ;
367
+
368
+
369
+ /**
370
+ * Updates the designated attribute with a <i>string</i> value.
371
+ * The update methods are used to update attribute values in the current row or the insert row.
372
+ * The update methods do not update the underlying recipient on the server;
373
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
374
+ *
375
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
376
+ * @param string $sValue the new attribute value.
377
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
378
+ * forgot to call <i>next()</i>).
379
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>string</i>.
380
+ */
381
+ public function updateString( Inx_Api_Recipient_Attribute $oAttr, $sValue );
382
+
383
+
384
+ /**
385
+ * Updates the designated attribute with a <i>bool</i> value.
386
+ * The update methods are used to update attribute values in the current row or the insert row.
387
+ * The update methods do not update the underlying recipient on the server;
388
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
389
+ *
390
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
391
+ * @param bool $blValue the new attribute value.
392
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
393
+ * forgot to call <i>next()</i>).
394
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>bool</i>.
395
+ */
396
+ public function updateBoolean( Inx_Api_Recipient_Attribute $oAttr, $blValue ) ;
397
+
398
+
399
+ /**
400
+ * Updates the designated attribute with an <i>integer</i> value.
401
+ * The update methods are used to update attribute values in the current row or the insert row.
402
+ * The update methods do not update the underlying recipient on the server;
403
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
404
+ *
405
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
406
+ * @param int $iValue the new attribute value.
407
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
408
+ * forgot to call <i>next()</i>).
409
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>integer</i>.
410
+ */
411
+ public function updateInteger( Inx_Api_Recipient_Attribute $oAttr, $iValue );
412
+
413
+
414
+ /**
415
+ * Updates the designated attribute with a <i>float</i> value.
416
+ * The update methods are used to update attribute values in the current row or the insert row.
417
+ * The update methods do not update the underlying recipient on the server;
418
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
419
+ *
420
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
421
+ * @param float $iValue the new attribute value.
422
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
423
+ * forgot to call <i>next()</i>).
424
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>float</i>.
425
+ */
426
+ public function updateDouble( Inx_Api_Recipient_Attribute $oAttr, $iValue );
427
+
428
+
429
+ /**
430
+ * Updates the designated attribute with a <i>float</i> value.
431
+ * The value has to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted date string.
432
+ * To format the value correctly, use one of the following methods:
433
+ * <ul>
434
+ * <li><i>ISO-8601</i>: <pre>$sDate = date("Y-m-d");</pre>
435
+ * <li><i>Unix-Timestamp</i>: <pre>$iTimestamp = time();</pre>
436
+ * </ul>
437
+ * The update methods are used to update attribute values in the current row or the insert row.
438
+ * The update methods do not update the underlying recipient on the server;
439
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
440
+ *
441
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
442
+ * @param string $dValue the new attribute value.
443
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
444
+ * forgot to call <i>next()</i>).
445
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>date</i>.
446
+ */
447
+ public function updateDate( Inx_Api_Recipient_Attribute $oAttr, $dValue );
448
+
449
+
450
+ /**
451
+ * Updates the designated attribute with a <i>time</i> value.
452
+ * The value has to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted time string.
453
+ * To format the value correctly, use one of the following methods:
454
+ * <ul>
455
+ * <li><i>ISO-8601</i>: <pre>$sTime = date("H:i:sP");</pre>
456
+ * <li><i>Unix-Timestamp</i>: <pre>$iTimestamp = time();</pre>
457
+ * </ul>
458
+ * The update methods are used to update attribute values in the current row or the insert row.
459
+ * The update methods do not update the underlying recipient on the server;
460
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
461
+ *
462
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
463
+ * @param string $tValue the new attribute value.
464
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
465
+ * forgot to call <i>next()</i>).
466
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>time</i>.
467
+ */
468
+ public function updateTime( Inx_Api_Recipient_Attribute $oAttr, $tValue );
469
+
470
+
471
+ /**
472
+ * Updates the designated attribute with a <i>datetime</i> value.
473
+ * The value has to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted datetime string.
474
+ * To format the value correctly, use one of the following methods:
475
+ * <ul>
476
+ * <li><i>ISO-8601</i>: <pre>$sDatetime = date('c');</pre>
477
+ * <li><i>Unix-Timestamp</i>: <pre>$iTimestamp = time();</pre>
478
+ * </ul>
479
+ * The update methods are used to update attribute values in the current row or the insert row.
480
+ * The update methods do not update the underlying recipient on the server;
481
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
482
+ *
483
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
484
+ * @param string $dtValue the new attribute value.
485
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
486
+ * forgot to call <i>next()</i>).
487
+ * @throws Inx_Api_IllegalStateException if the attribute is not of type <i>datetime</i>.
488
+ */
489
+ public function updateDatetime( Inx_Api_Recipient_Attribute $oAttr, $dtValue );
490
+
491
+
492
+ /**
493
+ * Updates the designated attribute with a new value.
494
+ * Most string values can be converted regardless of their content.
495
+ * The string "test" can, for example, be converted to a boolean and will return true.
496
+ * However, this is not true for attributes of type date, time or datetime.
497
+ * These values have to be passed either as a <i>Unix-Timestamp</i> or an ISO 8601 formatted date, time or datetime string.
498
+ * To format the value correctly, use one of the following methods, according to the datatype of the attribute:
499
+ * <ul>
500
+ * <li><i>Date</i>: <pre>$sDate = date("Y-m-d");</pre>
501
+ * <li><i>Time</i>: <pre>$sTime = date("H:i:sP");</pre>
502
+ * <li><i>Datetime</i>: <pre>$sDatetime = date('c');</pre>
503
+ * <li><i>Unix-Timestamp (works for all)</i>: <pre>$iTimestamp = time();</pre>
504
+ * </ul>
505
+ * The update methods are used to update attribute values in the current row or the insert row.
506
+ * The update methods do not update the underlying recipient on the server;
507
+ * instead the <i>commitRowUpdate</i> method is called to commit the changes.
508
+ *
509
+ * @param Inx_Api_Reciptient_Attribute $oAttr the designated attribute.
510
+ * @param string|mixed $oValue the new attribute value.
511
+ * @throws Inx_Api_DataException if the test recipient was deleted or no test recipient is selected (e.g. you
512
+ * forgot to call <i>next()</i>).
513
+ */
514
+ public function updateObject( Inx_Api_Recipient_Attribute $oAttr, $oValue );
515
+
516
+
517
+ /**
518
+ * Releases the resources associated with this <i>Inx_Api_Testprofiles_TestRecipientRowSet</i> object on the server immediately.
519
+ * <p>
520
+ * An <i>Inx_Api_Testprofiles_TestRecipientRowSet</i> object <strong>must</strong> be closed once it is not
521
+ * needed anymore to prevent memory leaks and other potentially harmful side effects.
522
+ */
523
+ public function close();
524
+ }
lib/Inx/Api/TextModule/TextModule.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage Textmodule
5
+ */
6
+ /**
7
+ * This class defines a text module.
8
+ * Text modules are reusable text snippets that can be used inside mailings in the same list (or all lists if the text
9
+ * module is defined in the system list).
10
+ * A common text module is a custom, personalized salutation which will be shown later.
11
+ * <p>
12
+ * You can update both of the content types (plain Text and html) but via the client only the one(s) defined by the
13
+ * MIME type will be used.
14
+ * Also, the text module name may be updated, though NOT the MIME type.
15
+ * If you wish to alter the MIME type, you have to delete the text module and create a new one with the values of
16
+ * the old text module and the new MIME type.
17
+ * <p>
18
+ * The following snippet shows how to create a global custom salutation text module using the user defined
19
+ * recipient attributes 'Surname', 'First name' and 'Gender':
20
+ *
21
+ * <pre>
22
+ * $oTextModuleManager = $oSession->getTextmoduleManager();
23
+ * $oListContext = $oSession->getListContextManager()->findByName( Inx_Api_List_SystemListContext::NAME );
24
+ * $oTextModule = $oTextModuleManager->createTextmodule( $oListContext, Inx_Api_TextModule_TextModule::MIME_TYPE_PLAIN_TEXT );
25
+ *
26
+ * $sContent = &quot;[%if Surname IS_EMPTY]Dear Sir or Madam,\n&quot;;
27
+ * $sContent .= &quot;[%elseif Column(\&quot;Gender\&quot;) = \&quot;m\&quot;]Dear Mr &quot;;
28
+ * $sContent .= &quot;[First name,postfix( )][Surname], \n&quot;;
29
+ * $sContent .= &quot;[%elseif Column(\&quot;Gender\&quot;) = \&quot;f\&quot;]Dear Ms &quot;;
30
+ * $sContent .= &quot;[First name, postfix( )][Surname], \n &quot;;
31
+ * $sContent .= &quot;[%else]Dear Sir or Madam,[%endif] \n &quot;;
32
+ *
33
+ * $oTextModule->updateName( &quot;salutation&quot; );
34
+ * $oTextModule->updatePlainTextContent( $sContent );
35
+ * $oTextModule->commitUpdate();
36
+ * </pre>
37
+ * <p>
38
+ * For more information on the possible contents of text modules, see the corresponding section of the Inxmail client manual.
39
+ * <p>
40
+ * For an example on how to retrieve existing text modules, see the <i>In_Api_TextModule_TextModuleManager</i> documentation.
41
+ *
42
+ * @see In_Api_TextModule_TextModuleManager
43
+ * @since API 1.4.0
44
+ * @version $Revision: 9497 $ $Date: 2007-12-19 17:03:25 +0200 (Tr, 19 Grd 2007) $ $Author: aurimas $
45
+ * @package Inxmail
46
+ * @subpackage Textmodule
47
+ */
48
+ interface Inx_Api_TextModule_TextModule extends Inx_Api_BusinessObject
49
+ {
50
+
51
+ /**
52
+ * MIME type constant for HTML text modules. This text module has only a HTML text part.
53
+ */
54
+ const MIME_TYPE_HTML_TEXT = 0;
55
+
56
+ /**
57
+ * MIME type constant for plain text modules. This text module has only a plain text part.
58
+ */
59
+ const MIME_TYPE_PLAIN_TEXT = 1;
60
+
61
+ /**
62
+ * MIME type constant for multipart text modules. This text module has a HTML and a plain text part.
63
+ */
64
+ const MIME_TYPE_MULTIPART = 2;
65
+
66
+ /**
67
+ * Constant for the name attribute. Used for ordering by the <i>Inx_Api_TextModule_TextModuleManager</i>.
68
+ *
69
+ * @see Inx_Api_TextModule_TextModuleManager::select($oListContext, $iOrderAttribute, $iOrderType)
70
+ */
71
+ const ATTRIBUTE_NAME = 0;
72
+
73
+ /**
74
+ * Constant for the plain text attribute.
75
+ */
76
+ const ATTRIBUTE_PLAIN_TEXT = 1;
77
+
78
+ /**
79
+ * Constant for the HTML text attribute.
80
+ */
81
+ const ATTRIBUTE_HTML_TEXT = 2;
82
+
83
+ /**
84
+ * Constant for the list context id attribute.
85
+ */
86
+ const ATTRIBUTE_LIST_CONTEXT_ID = 3;
87
+
88
+ /**
89
+ * Constant for the MIME type attribute.
90
+ */
91
+ const ATTRIBUTE_MIME_TYPE = 4;
92
+
93
+ /**
94
+ * Returns the name of this text module.
95
+ *
96
+ * @return string the name of this text module.
97
+ */
98
+ public function getName();
99
+
100
+ /**
101
+ * Updates the name of the text module.
102
+ * The text module will not be updated on the server until <i>commitUpdate()</i> has been called.
103
+ *
104
+ * @param string $sName the new text module name.
105
+ */
106
+ public function updateName( $sName );
107
+
108
+ /**
109
+ * Returns the id of the list which this text module belongs to.
110
+ *
111
+ * @return int the id of the list which this text module belongs to.
112
+ */
113
+ public function getListContextId();
114
+
115
+ /**
116
+ * Returns the MIME type of this text module. May be one of:
117
+ * <ul>
118
+ * <li><i>MIME_TYPE_HTML_TEXT</i>: Only HTML text
119
+ * <li><i>MIME_TYPE_PLAIN_TEXT</i>: Only plain text
120
+ * <li><i>MIME_TYPE_MULTIPART</i>: Both, HTML and plain text
121
+ * </ul>
122
+ *
123
+ * @return int the MIME type of this text module.
124
+ */
125
+ public function getMimeType();
126
+
127
+ /**
128
+ * Returns the HTML text part of this text module, or <i>null</i> if the MIME type is <i>MIME_TYPE_PLAIN_TEXT</i>.
129
+ *
130
+ * @return string the HTML text part of this text module, if any.
131
+ */
132
+ public function getHtmlTextContent();
133
+
134
+ /**
135
+ * Updates the HTML text part of this text module.
136
+ * The text module will not be updated on the server until <i>commitUpdate()</i> has been called.
137
+ *
138
+ * @param string $sHtmlTextContent the new HTML text part.
139
+ */
140
+ public function updateHtmlTextContent( $sHtmlTextContent );
141
+
142
+ /**
143
+ * Returns the plain text part of this text module, or <i>null</i> if the MIME type is <i>MIME_TYPE_HTML_TEXT</i>.
144
+ *
145
+ * @return string the plain text part of this text module, if any.
146
+ */
147
+ public function getPlainTextContent();
148
+
149
+ /**
150
+ * Updates the plain text part of the text module.
151
+ * The text module will not be updated on the server until <i>commitUpdate()</i> has been called.
152
+ *
153
+ * @param string $sPlainTextContent the new plain text part.
154
+ */
155
+ public function updatePlainTextContent( $sPlainTextContent );
156
+ }
lib/Inx/Api/TextModule/TextModuleManager.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package Inxmail
5
+ * @subpackage Textmodule
6
+ */
7
+ /**
8
+ * The <i>Inx_Api_TextModule_TextModuleManager</i> can be used to retrieve and create text modules.
9
+ * Text modules are reusable text snippets that can be used inside mailings in the same list (or all lists if the
10
+ * text module is defined in the system list).
11
+ * A common text module is a custom, personalized salutation.
12
+ * <p>
13
+ * The following snippet shows how to create a new text module and update its name:
14
+ *
15
+ * <pre>
16
+ * $oTextmoduleManager = $oSession->getTextmoduleManager();
17
+ * $oListContext = $oSession->getListContextManager()->findByName( &quot;Desired List&quot; );
18
+ * $oTextModule = $oTextmoduleManager->createTextmodule( $oListContext, Inx_Api_TextModule_TextModule::MIME_TYPE_HTML_TEXT );
19
+ *
20
+ * $oTextModule->updateName( &quot;Desired name&quot; );
21
+ * $oTextModule->commitUpdate();
22
+ * </pre>
23
+ *
24
+ * </p>
25
+ * To retrieve existing text modules, use one of the two <i>select</i> methods provided by this manager.
26
+ * The following snippet shows how to retrieve all global text modules, ordered by their name, and prints out some
27
+ * information regarding these text modules:
28
+ *
29
+ * <pre>
30
+ * $oTextmoduleManager = $oSession->getTextmoduleManager();
31
+ * $oListContext = $oSession->getListContextManager()->findByName( Inx_Api_List_SystemListContext::NAME );
32
+ * $oBOResultSet = $oTextmoduleManager->select( $oListContext, Inx_Api_TextModule_TextModule::ATTRIBUTE_NAME, Inx_Api_Order::DESC );
33
+ *
34
+ * for( $i = 0; $i &lt; $oBOResultSet->size(); $i++ )
35
+ * {
36
+ * $oTextModule = $oBOResultSet->get( $i );
37
+ * echo &quot;Textmodule &quot;.$oTextModule->getName().&quot; has the content type &quot;.$oTextModule->getMimeType().&quot;&#60;br&#62;&quot;;
38
+ * }
39
+ *
40
+ * $oBOResultSet->close();
41
+ * </pre>
42
+ * <p>
43
+ * For more information on text modules, see the <i>Inx_Api_TextModule_TextModule</i> documentation.
44
+ *
45
+ * @see Inx_Api_TextModule_TextModule
46
+ * @since API 1.4.0
47
+ * @version $Revision: 9553 $ $Date: 2008-01-04 11:28:41 +0200 (Pn, 04 Sau 2008) $ $Author: vladas $
48
+ * @package Inxmail
49
+ * @subpackage Textmodule
50
+ */
51
+ interface Inx_Api_TextModule_TextModuleManager extends Inx_Api_BOManager
52
+ {
53
+
54
+ /**
55
+ * Creates a new text module in the specified list.
56
+ * To create a globally available text module, use the <i>SystemListContext</i>.
57
+ * The <i>SystemListContext</i> can be retrieved using the following snippet:
58
+ *
59
+ * <pre>
60
+ * $oListContext = $oSession->getListContextManager()->findByName( Inx_Api_List_SystemListContext::NAME );
61
+ * </pre>
62
+ *
63
+ * @param Inx_Api_List_ListContext $oListContext the list the text module shall be created for.
64
+ * @param int $iMimeType the MIME type of this text module. May be one of:
65
+ * <ul>
66
+ * <li><i>Inx_Api_TextModule_TextModule::MIME_TYPE_HTML_TEXT</i>,
67
+ * <li><i>Inx_Api_TextModule_TextModule::MIME_TYPE_PLAIN_TEXT</i> or
68
+ * <li><i>Inx_Api_TextModule_TextModule::MIME_TYPE_MULTIPART</i>
69
+ * </ul>
70
+ * @return a new text module.
71
+ */
72
+ public function createTextmodule( Inx_Api_List_ListContext $oListContext, $iMimeType );
73
+
74
+ /**
75
+ * Returns an <i>Inx_Api_BOResultSet</i> containing all text modules in the specified list, ordered by the given
76
+ * attribute.
77
+ *
78
+ * @param Inx_Api_List_ListContext $oListContext all text modules of this list will be selected.
79
+ * @param int $iOrderAttribute the order attribute (only <i>Inx_Api_TextModule_TextModule::ATTRIBUTE_NAME</i>).
80
+ * May be ommitted.
81
+ * @param int $iOrderType the order type (<i>Inx_Api_Order::ASC</i> or <i>Inx_Api_Order::DES</i>).
82
+ * May be ommitted.
83
+ * @return Inx_Api_BOResultSet an <i>Inx_Api_BOResultSet</i> containing all text modules in the specified list.
84
+ * @throws Inx_Api_SecurityException if the session user doesn't have the following permission:
85
+ * <i>Inx_Api_UserRights::TEXTMODULE_FEATURE_USE</i>
86
+ */
87
+ public function select( Inx_Api_List_ListContext $oListContext, $iOrderAttribute=null, $iOrderType=null );
88
+
89
+ }
lib/Inx/Api/TriggerMail/Attachment.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * The <code>Attachment</code> object represents a regular attachment or an embedded image of a trigger mailing and is
9
+ * part of the <code>TriggerMailContent</code> object.
10
+ *
11
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailContent#getAttachments()
12
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailContent#getEmbeddedImages()
13
+ * @since API 1.10.0
14
+ * @author chge, 09.07.2012
15
+ */
16
+ interface Inx_Api_TriggerMail_Attachment
17
+ {
18
+
19
+ /**
20
+ * Returns the file name of a regular attachment or the image identifier of an embedded image. An embedded image is
21
+ * referenced in a message body using an &lt;img&gt; tag, as follows:
22
+ *
23
+ * <pre>
24
+ * &lt;img src="cid:Image-Identifier"&gt;
25
+ * </pre>
26
+ *
27
+ * @return the file name of a regular attachment or the image identifier of an embedded image.
28
+ */
29
+ public function getName();
30
+
31
+
32
+ /**
33
+ * Returns the MIME type of this attachment, e.g. <code>application/pdf</code> or <code>image/gif</code>.
34
+ *
35
+ * @return the MIME type of this attachment.
36
+ */
37
+ public function getContentType();
38
+
39
+
40
+ /**
41
+ * Return the size of the content of this attachment in bytes.
42
+ *
43
+ * @return the size of the content of this attachment in bytes.
44
+ */
45
+ public function getSize();
46
+
47
+
48
+ /**
49
+ * Returns an input stream of the content of this attachment. This method is used to download the content of this
50
+ * attachment.
51
+ *
52
+ * @return an input stream of the content of this attachment.
53
+ */
54
+ public function getContent();
55
+ }
lib/Inx/Api/TriggerMail/BuildException.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * A <code>BuildException</code> is thrown when the building of a trigger mailing fails. This may be due to an illegal
9
+ * recipient address or a general building failure. For a deeper insight on the error, consult the {@link RenderError}
10
+ * associated with the exception.
11
+ *
12
+ * @see com.inxmail.xpro.api.triggermail.RenderError
13
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailingRenderer#build(int)
14
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailingRenderer#build(int, int)
15
+ * @since API 1.10.0
16
+ * @author chge, 09.07.2012
17
+ */
18
+ class Inx_Api_TriggerMail_BuildException extends Exception
19
+ {
20
+ /** The email address of the recipient for which the trigger mailing was built. */
21
+ protected $emailAddress;
22
+
23
+ /** Contains detail information about the error. */
24
+ protected $error;
25
+
26
+
27
+ /**
28
+ * Creates a <code>BuildException</code> with the given recipient address and render error.
29
+ *
30
+ * @param emailAddress the email address of the recipient for which the trigger mailing was built.
31
+ * @param error contains detail information about the error.
32
+ */
33
+ public function __construct( $sEmailAddress, Inx_Api_TriggerMail_RenderError $error )
34
+ {
35
+ $this->emailAddress = $sEmailAddress;
36
+ $this->error = $error;
37
+ }
38
+
39
+
40
+ /**
41
+ * Returns detail information about the error.
42
+ *
43
+ * @return detail information about the error.
44
+ */
45
+ public function getError()
46
+ {
47
+ return $this->error;
48
+ }
49
+
50
+
51
+ /**
52
+ * Returns the email address of the recipient for which the trigger mailing was built.
53
+ *
54
+ * @return the recipients email address.
55
+ */
56
+ public function getEmailAddress()
57
+ {
58
+ return $this->emailAddress;
59
+ }
60
+
61
+ }
lib/Inx/Api/TriggerMail/BuildMode.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * The <code>BuildMode</code> determines how a mailing is built by the {@link TriggerMailingRenderer}.
9
+ *
10
+ * @author chge, 02.08.2012
11
+ */
12
+ final class Inx_Api_TriggerMail_BuildMode
13
+ {
14
+ private static $NORMAL = null;
15
+
16
+ private static $ALTERNATIVEVIEW_ACTIVE = null;
17
+
18
+ /** The mode to generate a normal trigger mail), ready to be sent. */
19
+ public static final function NORMAL()
20
+ {
21
+ return new Inx_Api_TriggerMail_BuildMode( 100 );
22
+ }
23
+
24
+ /**
25
+ * The mode for mail view: All links are fully functional. Embedded images are replaced with http references to
26
+ * image resources on the Inxmail server.
27
+ */
28
+ public static final function ALTERNATIVEVIEW_ACTIVE()
29
+ {
30
+ return new Inx_Api_TriggerMail_BuildMode( 101 );
31
+ }
32
+
33
+ /**
34
+ * The mode for mail view: All links are not functional. Embedded images are replaced with http references to image
35
+ * resources on the Inxmail server.
36
+ */
37
+ public static final function ALTERNATIVEVIEW_INACTIVE()
38
+ {
39
+ return new Inx_Api_TriggerMail_BuildMode( 104 );
40
+ }
41
+
42
+ /**
43
+ * The mode for mail preview: Trackable links will not trigger any events), unsubscription links will redirect but
44
+ * not unsubscribe anybody. Embedded images are replaced with http references to image resources on the Inxmail
45
+ * server.
46
+ */
47
+ public static final function PREVIEW()
48
+ {
49
+ return new Inx_Api_TriggerMail_BuildMode( 102 );
50
+ }
51
+
52
+ /**
53
+ * The mode for mail archive view: Trackable links will not trigger any events), unsubscription links will redirect
54
+ * but not unsubscribe anybody. Embedded images are replaced with http references to image resources on the Inxmail
55
+ * server.
56
+ */
57
+ public static final function ARCHIVE()
58
+ {
59
+ return new Inx_Api_TriggerMail_BuildMode( 103 );
60
+ }
61
+
62
+ /**
63
+ * The mode for mail view: All links are fully functional but converted to simple links. Embedded images are
64
+ * replaced with http references to image resources on the Inxmail server.
65
+ */
66
+ public static final function ALTERNATIVEVIEW_ACTIVE_SIMPLE_LINKS()
67
+ {
68
+ return new Inx_Api_TriggerMail_BuildMode( 105 );
69
+ }
70
+
71
+ /**
72
+ * The mode for mail view: All links are fully functional but converted to simple links. Embedded images are
73
+ * replaced with http references to image resources on the Inxmail server. The function InInboxView returns true for
74
+ * this call.
75
+ */
76
+ public static final function NEWSLETTER_SIMPLE_LINKS()
77
+ {
78
+ return new Inx_Api_TriggerMail_BuildMode( 106 );
79
+ }
80
+
81
+ /**
82
+ * Constant for an unknown build mode. This mode indicates a version mismatch between API and server.
83
+ */
84
+ public static final function UNKNOWN()
85
+ {
86
+ return new Inx_Api_TriggerMail_BuildMode( -1 );
87
+ }
88
+
89
+ private $id;
90
+
91
+
92
+ private function __construct( $iId )
93
+ {
94
+ $this->id = $iId;
95
+ }
96
+
97
+
98
+ /**
99
+ * Returns the ID of the <code>BuildMode</code>. The ID is used for transmission purposes and should not be used
100
+ * inside client code.
101
+ *
102
+ * @return the ID of the <code>BuildMode</code>.
103
+ */
104
+ public function getId()
105
+ {
106
+ return $this->id;
107
+ }
108
+
109
+
110
+ /**
111
+ * Returns the <code>BuildMode</code> corresponding to the given ID. If the ID is unknown, the <code>UKNOWN</code>
112
+ * build mode will be returned. The ID is used for transmission purposes and should not be used inside client code.
113
+ *
114
+ * @param id the ID of the <code>BuildMode</code> to retrieve.
115
+ * @return the <code>BuildMode</code> corresponding to the given ID.
116
+ */
117
+ public static function byId( $iMode )
118
+ {
119
+ foreach( self::values() as $m )
120
+ {
121
+ if( $m->getId() == $iMode )
122
+ {
123
+ return $m;
124
+ }
125
+ }
126
+
127
+ return self::UNKNOWN();
128
+ }
129
+
130
+ public static function values()
131
+ {
132
+ return array(self::NORMAL(), self::ALTERNATIVEVIEW_ACTIVE(), self::ALTERNATIVEVIEW_INACTIVE(), self::PREVIEW(),
133
+ self::ARCHIVE(), self::ALTERNATIVEVIEW_ACTIVE_SIMPLE_LINKS(), self::NEWSLETTER_SIMPLE_LINKS(),
134
+ self::UNKNOWN());
135
+ }
136
+ }
lib/Inx/Api/TriggerMail/ParseException.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * A <code>ParseException</code> is thrown when the parsing of a trigger mailing fails. The reason for such a failure
9
+ * usually is a syntax error. For a deeper insight on the error, consult the {@link RenderError}s associated with the
10
+ * exception.
11
+ *
12
+ * @see com.inxmail.xpro.api.triggermail.RenderError
13
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailingRenderer#parse(int, int)
14
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailingRenderer#parse(int, long, int)
15
+ * @since API 1.10.0
16
+ * @author chge, 09.07.2012
17
+ */
18
+ class Inx_Api_TriggerMail_ParseException extends Exception
19
+ {
20
+ /** Contains detail information about the error. */
21
+ protected $errors;
22
+
23
+
24
+ /**
25
+ * Creates a <code>ParseException</code> with the given render errors.
26
+ *
27
+ * @param errors the render errors which occurred during the parsing.
28
+ */
29
+ public function __construct( array $errors )
30
+ {
31
+ $this->errors = $errors;
32
+ }
33
+
34
+
35
+ /**
36
+ * Returns detail information about the error by returning the render error with the given index.
37
+ *
38
+ * @param index the index of the render error to be returned.
39
+ * @return the render error with the given index.
40
+ */
41
+ public function getError( $iIndex )
42
+ {
43
+ return $this->errors[$iIndex];
44
+ }
45
+
46
+
47
+ /**
48
+ * Returns the number of render errors associated with this <code>ParseException</code>.
49
+ *
50
+ * @return the number of render errors.
51
+ */
52
+ public function getErrorCount()
53
+ {
54
+ return sizeof($this->errors);
55
+ }
56
+
57
+ }
lib/Inx/Api/TriggerMail/RenderError.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * A <code>RenderError</code> object describes the details of an error which occurred during the parsing or building of
9
+ * a trigger mailing. <code>RenderError</code> offers the following information:
10
+ * <ul>
11
+ * <li><i>Error type</i>: an internal error code
12
+ * <li><i>Mail part</i>: the internal mail part code
13
+ * <li><i>Begin line / column</i>: the line and column where the malicious token begins
14
+ * <li><i>End line / column</i>: the line and column where the malicious token ends.
15
+ * <li><i>Error messages</i>: the error messages
16
+ * </ul>
17
+ * <p>
18
+ * <code>RenderError</code> is mainly used internally but may provide some insight on the error source to API
19
+ * developers. For example, the token position will assist you in identifying syntax errors. The error messages may also
20
+ * be analyzed to identify the error source.
21
+ *
22
+ * @see BuildException#getError()
23
+ * @see ParseException#getError(int)
24
+ * @since API 1.10.0
25
+ * @author chge, 09.07.2012
26
+ */
27
+ class Inx_Api_TriggerMail_RenderError
28
+ {
29
+ private $errorType;
30
+
31
+ private $mailPart;
32
+
33
+ private $beginLine;
34
+
35
+ private $endLine;
36
+
37
+ private $beginColumn;
38
+
39
+ private $endColumn;
40
+
41
+ private $msgArgs;
42
+
43
+
44
+ /**
45
+ * Creates a <code>RenderError</code> with the given details.
46
+ *
47
+ * @param errorType the internal error code.
48
+ * @param mailPart the internal mail part code.
49
+ * @param beginLine the line where the malicious token begins.
50
+ * @param endLine the line where the malicious token ends.
51
+ * @param beginColumn the column where the malicious token begins.
52
+ * @param endColumn the column where the malicious token ends.
53
+ * @param msgArgs the error messages.
54
+ */
55
+ public function __construct( $iErrorType, $iMailPart, $iBeginLine, $iEndLine, $iBeginColumn,
56
+ $iEndColumn, $aMsgArgs )
57
+ {
58
+ $this->errorType = $iErrorType;
59
+ $this->mailPart = $iMailPart;
60
+ $this->beginLine = $iBeginLine;
61
+ $this->endLine = $iEndLine;
62
+ $this->beginColumn = $iBeginColumn;
63
+ $this->endColumn = $iEndColumn;
64
+ $this->msgArgs = $aMsgArgs;
65
+ }
66
+
67
+
68
+ /**
69
+ * Returns the internal error code.
70
+ *
71
+ * @return the internal error code.
72
+ */
73
+ public function getErrorType()
74
+ {
75
+ return $this->errorType;
76
+ }
77
+
78
+
79
+ /**
80
+ * Returns the internal mail part code.
81
+ *
82
+ * @return the internal mail part code.
83
+ */
84
+ public function getMailPart()
85
+ {
86
+ return $this->mailPart;
87
+ }
88
+
89
+
90
+ /**
91
+ * Returns the line where the malicious token begins.
92
+ *
93
+ * @return the line where the malicious token begins.
94
+ */
95
+ public function getBeginLine()
96
+ {
97
+ return $this->beginLine;
98
+ }
99
+
100
+
101
+ /**
102
+ * Returns the line where the malicious token ends.
103
+ *
104
+ * @return the line where the malicious token ends.
105
+ */
106
+ public function getEndLine()
107
+ {
108
+ return $this->endLine;
109
+ }
110
+
111
+
112
+ /**
113
+ * Returns the column where the malicious token begins.
114
+ *
115
+ * @return the column where the malicious token begins.
116
+ */
117
+ public function getBeginColumn()
118
+ {
119
+ return $this->beginColumn;
120
+ }
121
+
122
+
123
+ /**
124
+ * Returns the column where the malicious token ends.
125
+ *
126
+ * @return the column where the malicious token ends.
127
+ */
128
+ public function getEndColumn()
129
+ {
130
+ return $this->endColumn;
131
+ }
132
+
133
+
134
+ /**
135
+ * Returns the error messages.
136
+ *
137
+ * @return the error messages.
138
+ */
139
+ public function getMsgArgs()
140
+ {
141
+ return $this->msgArgs;
142
+ }
143
+
144
+ }
lib/Inx/Api/TriggerMail/TriggerMailContent.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * The <code>TriggerMailContent</code> contains the personalized content of a trigger mailing for a specific recipient.
9
+ * The information that can be retrieved from the <code>TriggerMailContent</code> includes:
10
+ * <ul>
11
+ * <li><i>The content type</i>: {@link #getContentType()}
12
+ * <li><i>Plain/HTML text</i>: {@link #getPlainText()} and {@link #getHtmlText()}
13
+ * <li><i>The subject</i>: {@link #getSubject()}
14
+ * <li><i>The recipient address</i>: {@link #getRecipientAddress()}
15
+ * <li><i>Attachments</i>: {@link #getAttachments()}
16
+ * <li><i>Embedded images</i>: {@link #getEmbeddedImages()}
17
+ * <li><i>The sender address</i>: {@link #getSenderAddress()}
18
+ * <li><i>The bounce and reply addresses</i>: {@link #getBounceAddress()} and {@link #getReplyToAddress()}
19
+ * <li><i>The mail headers</i>: {@link #getHeader()} or {@link #getMultipleHeaders()}
20
+ * </ul>
21
+ * A <code>TriggerMailContent</code> object is created by a {@link TriggerMailingRenderer} using its <code>build</code>
22
+ * methods.
23
+ *
24
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailingRenderer#build(int)
25
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailingRenderer#build(int, int)
26
+ * @since API 1.10.0
27
+ * @author chge, 09.07.2012
28
+ */
29
+ interface Inx_Api_TriggerMail_TriggerMailContent
30
+ {
31
+ /**
32
+ * Returns the content type of this trigger mail.
33
+ *
34
+ * @return the content type of this trigger mail.
35
+ */
36
+ public function getContentType();
37
+
38
+
39
+ /**
40
+ * Returns the HTML text part of the mail, or <code>null</code> if the mail type is
41
+ * {@link TriggerMailingContentType#PLAIN_TEXT}.
42
+ *
43
+ * @return the HTML text part of the mail, if any.
44
+ */
45
+ public function getHtmlText();
46
+
47
+
48
+ /**
49
+ * Returns the plain text part of the mail, or <code>null</code> if the mail type is
50
+ * {@link TriggerMailingContentType#HTML_TEXT}.
51
+ *
52
+ * @return the plain text part of the email, if any.
53
+ */
54
+ public function getPlainText();
55
+
56
+
57
+ /**
58
+ * Returns the subject of the trigger mail.
59
+ *
60
+ * @return the subject of the trigger mail.
61
+ */
62
+ public function getSubject();
63
+
64
+
65
+ /**
66
+ * Returns the recipient address of the trigger mail.
67
+ *
68
+ * @return the recipient address of the trigger mail.
69
+ */
70
+ public function getRecipientAddress();
71
+
72
+
73
+ /**
74
+ * Returns the sender address of the trigger mail.
75
+ *
76
+ * @return the sender address of the trigger mail.
77
+ */
78
+ public function getSenderAddress();
79
+
80
+
81
+ /**
82
+ * Returns the reply address of the trigger mail. This address will be used for replies.
83
+ *
84
+ * @return the reply address of the trigger mail.
85
+ */
86
+ public function getReplyToAddress();
87
+
88
+
89
+ /**
90
+ * Returns the bounce address of the trigger mail. This address will be used for bounce messages.
91
+ *
92
+ * @return the bounce address of the trigger mail.
93
+ */
94
+ public function getBounceAddress();
95
+
96
+
97
+ /**
98
+ * Returns all regular attachments (files) of the trigger mail.
99
+ *
100
+ * @return all regular attachments of the trigger mail.
101
+ */
102
+ public function getAttachments();
103
+
104
+
105
+ /**
106
+ * Returns all embedded images of the trigger mail.
107
+ *
108
+ * @return all embedded images of the trigger mail.
109
+ */
110
+ public function getEmbeddedImages();
111
+
112
+
113
+ /**
114
+ * Returns the header informations of the trigger mail. The map contains the key/value-pair of the headers.
115
+ * <p>
116
+ * Note: This method allows header fields only to be defined once. If a header field is defined multiple times, the
117
+ * last value will be used. If you wish to define header fields multiple times, use the
118
+ * {@link #getMultipleHeaders()} method instead. Nonetheless, you should be aware that defining the same header
119
+ * field multiple times is discouraged by RFC 5322 as this is an obsolete behavior only permitted by legacy
120
+ * implementations.
121
+ *
122
+ * @return the header information of the trigger mail.
123
+ */
124
+ public function getHeader();
125
+
126
+
127
+ /**
128
+ * Returns the header information of the trigger mail. The list contains <code>HeaderField</code> objects
129
+ * encapsulating the key/value-pairs of the headers. This method allows for multiple defined header fields.
130
+ * <p>
131
+ * Note: You should be aware that defining the same header field multiple times is discouraged by RFC 5322 as this
132
+ * is an obsolete behavior only permitted by legacy implementations.
133
+ *
134
+ * @return the header information of the trigger mail.
135
+ * @since API 1.9.0
136
+ */
137
+ public function getMultipleHeaders();
138
+ }
lib/Inx/Api/TriggerMail/TriggerMailingConstants.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * The <code>TriggerMailingConstants</code> define some parameters for trigger mailings. The constants are used
9
+ * internally only.
10
+ *
11
+ * @author chge, 02.08.2012
12
+ */
13
+ interface Inx_Api_TriggerMail_TriggerMailingConstants
14
+ {
15
+ /**
16
+ * the array index of list type of trigger mailing business object
17
+ */
18
+ const INTERNAL_TRIGGER_MAILING_LIST_ID = 0;
19
+
20
+ const INTERNAL_TRIGGER_MAILING_CONTENT_TYPE = 1;
21
+
22
+ const INTERNAL_TRIGGER_MAILING_FEATURE_ID = 2;
23
+
24
+ const TRIGGER_MAILING_MAX_CHANGEDATTR_SIZE = 20;
25
+ }
lib/Inx/Api/TriggerMail/TriggerMailingContentType.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * The <code>TriggerMailingContentType</code> defines the content type of a trigger mailing.
9
+ *
10
+ * @author chge, 02.08.2012
11
+ */
12
+ final class Inx_Api_TriggerMail_TriggerMailingContentType
13
+ {
14
+ private static $HTML_TEXT = null;
15
+
16
+ private static $PLAIN_TEXT = null;
17
+
18
+ private static $MULTIPART = null;
19
+
20
+ private static $XML_XSLT_HTML_TEXT = null;
21
+
22
+ private static $XML_XSLT_PLAIN_TEXT = null;
23
+
24
+ private static $XML_XSLT_MULTIPART = null;
25
+
26
+ private static $SYSTEM = null;
27
+
28
+ private static $UNKNOWN = null;
29
+
30
+ /**
31
+ * Mail type indicating a HTML text mail. This trigger mail has only a HTML text part.
32
+ */
33
+ public static final function HTML_TEXT()
34
+ {
35
+ if(self::$HTML_TEXT === null)
36
+ self::$HTML_TEXT = new Inx_Api_TriggerMail_TriggerMailingContentType( 0 );
37
+
38
+ return self::$HTML_TEXT;
39
+ }
40
+
41
+ /**
42
+ * Mail type indicating a plain text mail. This trigger mail has only a plain text part.
43
+ */
44
+ public static final function PLAIN_TEXT()
45
+ {
46
+ if(self::$PLAIN_TEXT === null)
47
+ self::$PLAIN_TEXT = new Inx_Api_TriggerMail_TriggerMailingContentType( 1 );
48
+
49
+ return self::$PLAIN_TEXT;
50
+ }
51
+
52
+ /**
53
+ * Mail type indicating a multipart mail. This trigger mail has a HTML and a plain text part.
54
+ */
55
+ public static final function MULTIPART()
56
+ {
57
+ if(self::$MULTIPART === null)
58
+ self::$MULTIPART = new Inx_Api_TriggerMail_TriggerMailingContentType( 2 );
59
+
60
+ return self::$MULTIPART;
61
+ }
62
+
63
+ /**
64
+ * Mail type indicating a HTML text mail which uses a template defined in XML/XSLT. This trigger mail has only a
65
+ * HTML text part.
66
+ */
67
+ public static final function XML_XSLT_HTML_TEXT()
68
+ {
69
+ if(self::$XML_XSLT_HTML_TEXT === null)
70
+ self::$XML_XSLT_HTML_TEXT = new Inx_Api_TriggerMail_TriggerMailingContentType( 3 );
71
+
72
+ return self::$XML_XSLT_HTML_TEXT;
73
+ }
74
+
75
+ /**
76
+ * Mail type indicating a plain text mail which uses a template defined in XML/XSLT. This trigger mail has only a
77
+ * plain text part.
78
+ */
79
+ public static final function XML_XSLT_PLAIN_TEXT()
80
+ {
81
+ if(self::$XML_XSLT_PLAIN_TEXT === null)
82
+ self::$XML_XSLT_PLAIN_TEXT = new Inx_Api_TriggerMail_TriggerMailingContentType( 4 );
83
+
84
+ return self::$XML_XSLT_PLAIN_TEXT;
85
+ }
86
+
87
+ /**
88
+ * Mail type indicating a multipart mail which uses a template defined in XML/XSLT. This trigger mail has a HTML and
89
+ * a plain text part.
90
+ */
91
+ public static final function XML_XSLT_MULTIPART()
92
+ {
93
+ if(self::$XML_XSLT_MULTIPART === null)
94
+ self::$XML_XSLT_MULTIPART = new Inx_Api_TriggerMail_TriggerMailingContentType( 5 );
95
+
96
+ return self::$XML_XSLT_MULTIPART;
97
+ }
98
+
99
+ /**
100
+ * The default mail type used by the system.
101
+ */
102
+ public static final function SYSTEM()
103
+ {
104
+ if(self::$SYSTEM === null)
105
+ self::$SYSTEM = new Inx_Api_TriggerMail_TriggerMailingContentType( -1 );
106
+
107
+ return self::$SYSTEM;
108
+ }
109
+
110
+ /**
111
+ * Constant for an unknown content type. This type indicates a version mismatch between API and server.
112
+ */
113
+ public static final function UNKNOWN()
114
+ {
115
+ if(self::$UNKNOWN === null)
116
+ self::$UNKNOWN = new Inx_Api_TriggerMail_TriggerMailingContentType( -2 );
117
+
118
+ return self::$UNKNOWN;
119
+ }
120
+
121
+ private $id;
122
+
123
+
124
+ private function __construct( $iId )
125
+ {
126
+ $this->id = $iId;
127
+ }
128
+
129
+
130
+ /**
131
+ * Returns the ID of the <code>TriggerMailingContentType</code>. The ID is used for transmission purposes and should
132
+ * not be used inside client code.
133
+ *
134
+ * @return the ID of the <code>TriggerMailingContentType</code>.
135
+ */
136
+ public function getId()
137
+ {
138
+ return $this->id;
139
+ }
140
+
141
+
142
+ /**
143
+ * Returns the <code>TriggerMailingContentType</code> corresponding to the given ID. If the ID is unknown, the
144
+ * <code>UNKNOWN</code> content type will be returned. The ID is used for transmission purposes and should not be
145
+ * used inside client code.
146
+ *
147
+ * @param id the ID of the <code>TriggerMailingContentType</code> to retrieve.
148
+ * @return the <code>TriggerMailingContentType</code> corresponding to the given ID.
149
+ */
150
+ public static function byId( $iId )
151
+ {
152
+ foreach( self::values() as $type )
153
+ {
154
+ if( $type->getId() == $iId )
155
+ {
156
+ return $type;
157
+ }
158
+ }
159
+
160
+ return self::UNKNOWN();
161
+ }
162
+
163
+ public static function values()
164
+ {
165
+ return array(self::HTML_TEXT(), self::PLAIN_TEXT(), self::MULTIPART(), self::XML_XSLT_HTML_TEXT(),
166
+ self::XML_XSLT_PLAIN_TEXT(), self::XML_XSLT_MULTIPART(), self::SYSTEM(), self::UNKNOWN());
167
+ }
168
+ }
lib/Inx/Api/TriggerMail/TriggerMailingExceptionType.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * The <code>TriggerMailingExceptionType</code> defines the type or category of an exception that occurred while
9
+ * processing a request.
10
+ *
11
+ * @author chge, 02.08.2012
12
+ */
13
+ final class Inx_Api_TriggerMail_TriggerMailingExceptionType
14
+ {
15
+ private static $STATE = null;
16
+
17
+ private static $RECIPIENT_NOT_FOUND = null;
18
+
19
+ private static $MAILBUILD = null;
20
+
21
+ private static $MAILING_FEATURE_DISABLED = null;
22
+
23
+ private static $APPROVAL = null;
24
+
25
+ private static $UNKNOWN = null;
26
+
27
+
28
+ /**
29
+ * Type for {@link MailingStateException}.
30
+ */
31
+ public static final function STATE()
32
+ {
33
+ if(null === self::$STATE)
34
+ self::$STATE = new Inx_Api_TriggerMail_TriggerMailingExceptionType( 1000 );
35
+
36
+ return self::$STATE;
37
+ }
38
+
39
+ /**
40
+ * Type for {@link UnknownRecipientException} or an otherwise unknown recipient.
41
+ */
42
+ public static final function RECIPIENT_NOT_FOUND()
43
+ {
44
+ if(null === self::$RECIPIENT_NOT_FOUND)
45
+ self::$RECIPIENT_NOT_FOUND = new Inx_Api_TriggerMail_TriggerMailingExceptionType( 1001 );
46
+
47
+ return self::$RECIPIENT_NOT_FOUND;
48
+ }
49
+
50
+ /**
51
+ * Type for an error which occurred during the building process of a mailing.
52
+ */
53
+ public static final function MAILBUILD()
54
+ {
55
+ if(null === self::$MAILBUILD)
56
+ self::$MAILBUILD = new Inx_Api_TriggerMail_TriggerMailingExceptionType( 1002 );
57
+
58
+ return self::$MAILBUILD;
59
+ }
60
+
61
+ /**
62
+ * Type for missing mailing feature error.
63
+ */
64
+ public static final function MAILING_FEATURE_DISABLED()
65
+ {
66
+ if(null === self::$MAILING_FEATURE_DISABLED)
67
+ self::$MAILING_FEATURE_DISABLED = new Inx_Api_TriggerMail_TriggerMailingExceptionType( 1003 );
68
+
69
+ return self::$MAILING_FEATURE_DISABLED;
70
+ }
71
+
72
+ /**
73
+ * Type for an error which occurred during the approval process of a mailing.
74
+ */
75
+ public static final function APPROVAL()
76
+ {
77
+ if(null === self::$APPROVAL)
78
+ self::$APPROVAL = new Inx_Api_TriggerMail_TriggerMailingExceptionType( 1004 );
79
+
80
+ return self::$APPROVAL;
81
+ }
82
+
83
+ /**
84
+ * Type for an unknown error.
85
+ */
86
+ public static final function UNKNOWN()
87
+ {
88
+ if(null === self::$UNKNOWN)
89
+ self::$UNKNOWN = new Inx_Api_TriggerMail_TriggerMailingExceptionType( -1 );
90
+
91
+ return self::$UNKNOWN;
92
+ }
93
+
94
+ private $id;
95
+
96
+
97
+ private function __construct( $iId )
98
+ {
99
+ $this->id = $iId;
100
+ }
101
+
102
+
103
+ /**
104
+ * Returns the ID of the <code>TriggerMailingExceptionType</code>. The ID is used for transmission purposes and
105
+ * should not be used inside client code.
106
+ *
107
+ * @return the ID of the <code>TriggerMailingExceptionType</code>.
108
+ */
109
+ public function getId()
110
+ {
111
+ return $this->id;
112
+ }
113
+
114
+
115
+ /**
116
+ * Returns the <code>TriggerMailingExceptionType</code> corresponding to the given ID. If the ID is unknown, the
117
+ * UNKNOWN type will be used. The ID is used for transmission purposes and should not be used inside client code.
118
+ *
119
+ * @param id the ID of the <code>TriggerMailingExceptionType</code> to retrieve.
120
+ * @return the <code>TriggerState</code> TriggerMailingExceptionType to the given ID.
121
+ */
122
+ public static function byId( $iId )
123
+ {
124
+ foreach( self::values() as $type )
125
+ {
126
+ if( $type->getId() == $iId )
127
+ {
128
+ return $type;
129
+ }
130
+ }
131
+
132
+ return self::UNKNOWN();
133
+ }
134
+
135
+ public static function values()
136
+ {
137
+ return array(self::STATE(), self::RECIPIENT_NOT_FOUND(), self::MAILBUILD(), self::MAILING_FEATURE_DISABLED(),
138
+ self::APPROVAL(), self::UNKNOWN());
139
+ }
140
+ }
lib/Inx/Api/TriggerMail/TriggerMailingRenderer.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMail
5
+ */
6
+
7
+ /**
8
+ * The <code>TriggerMailingRenderer</code> is used to generate mail content using the API. The main use of the class
9
+ * will be to generate personalized previews of trigger mailings. The class can also be used to generate and send single
10
+ * trigger mails using a different mail sender. Be aware that in this case the mail sending rate would decrease
11
+ * enormously.
12
+ * <p>
13
+ * To preview a trigger mailing, take a <code>TriggerMailingRenderer</code> from the
14
+ * {@link com.inxmail.xpro.api.triggermailing.TriggerMailingManager TriggerMailingManager}. Each mailing needs to be
15
+ * parsed before building it. The following snippet shows how to build a trigger mail for a given recipient:
16
+ *
17
+ * <pre>
18
+ * TriggerMailingRenderer renderer = session.getTriggerMailingManager().createRenderer();
19
+ *
20
+ * renderer.parse( mailing.getId(), BuildMode.ALTERNATIVEVIEW_ACTIVE );
21
+ *
22
+ * TriggerMailContent content = renderer.build( recipientId );
23
+ * </pre>
24
+ * <p>
25
+ * <code>TriggerMailingRenderer</code> can handle the following different build modes:
26
+ * <ol>
27
+ * <li>{@link BuildMode#PREVIEW} - Trackable links will not trigger any events, unsubscription links will redirect but
28
+ * not unsubscribe anybody. Embedded images are replaced with http references to image resources on the Inxmail server.
29
+ * <li>{@link BuildMode#ALTERNATIVEVIEW_ACTIVE} - All links are fully functional. Embedded images are replaced with http
30
+ * references to image resources on the Inxmail server.
31
+ * <li>{@link BuildMode#ALTERNATIVEVIEW_INACTIVE} - All links are not functional. Embedded images are replaced with http
32
+ * references to image resources on the Inxmail server.
33
+ * <li>{@link BuildMode#NORMAL} - The mail is rendered, ready to be sent.
34
+ * <li>{@link BuildMode#ARCHIVE} - Trackable links will not trigger any events, unsubscription links will redirect but
35
+ * not unsubscribe anybody. Embedded images are replaced with http references to image resources on the Inxmail server.
36
+ * <li>{@link BuildMode#ALTERNATIVEVIEW_ACTIVE_SIMPLE_LINKS} - All links are fully functional but converted to simple
37
+ * links. Embedded images are replaced with http references to image resources on the Inxmail server.
38
+ * <li>{@link BuildMode#NEWSLETTER_SIMPLE_LINKS} - The same as above, but the function InInboxView returns true.
39
+ * </ol>
40
+ * <p>
41
+ * <strong>Note:</strong> A <code>TriggerMailingRenderer</code> object <strong>must</strong> be closed once it is not
42
+ * needed anymore to prevent memory leaks and other potentially harmful side effects.
43
+ *
44
+ * @see com.inxmail.xpro.api.triggermail.TriggerMailContent
45
+ * @since API 1.10.0
46
+ * @author chge, 09.07.2012
47
+ */
48
+ interface Inx_Api_TriggerMail_TriggerMailingRenderer
49
+ {
50
+ /**
51
+ * Prepares the trigger mailing for a preview. It checks the mail quality (syntax errors, references to orphaned
52
+ * elements, ... ).<br>
53
+ * Errors will be listed in the <code>ParseException</code><br>
54
+ * The mailingId is supposed to be valid (existing trigger mailing).<br>
55
+ *
56
+ * @param mailingId the id of the trigger mailing to be parsed.
57
+ * @param sendingId the id of the sending of the trigger mailing.
58
+ * @param buildMode the mode of the build. The mode <code>UNKNOWN</code> is illegal.
59
+ * @throws ParseException if any syntax error is present in the trigger mail.
60
+ * @throws APIException if the trigger mailing id is no longer valid.
61
+ * @throws IllegalArgumentException if the build mode is <code>UNKNOWN</code>.
62
+ */
63
+ public function parse($iMailingId, Inx_Api_TriggerMail_BuildMode $buildMode, $iSendingId = null);
64
+
65
+
66
+ /**
67
+ * Generates the personalized trigger mail content (recipient address, subject, HTML and/or plain text, ...) for the
68
+ * specified recipient with a specified mail type restriction.
69
+ *
70
+ * @param recipientId the id of the recipient for which the trigger mail shall be personalized.
71
+ * @param preferredMailType the mail type. <code>UNKNOWN</code> is not allowed.
72
+ * @return the personalized content of the trigger mail.
73
+ * @throws BuildException if the recipient could not be found, or the building failed.
74
+ * @throws IllegalArgumentException if the preferred mail type is <code>UNKNOWN</code>.
75
+ */
76
+ public function build( $iRecipientId, Inx_Api_TriggerMail_TriggerMailingContentType $preferredMailType = null );
77
+
78
+
79
+ /**
80
+ * Closes this <code>TriggerMailingRenderer</code> and releases any server resources associated with this object. A
81
+ * <code>TriggerMailingRenderer</code> object <strong>must</strong> be closed once it is not needed anymore to
82
+ * prevent memory leaks and other potentially harmful side effects.
83
+ */
84
+ public function close();
85
+ }
86
+
87
+ /**
88
+ * The <code>ParseResultCode</code> defines the result of the server side parsing process.
89
+ *
90
+ * @author chge, 02.08.2012
91
+ */
92
+ final class Inx_Api_TriggerMail_ParseResultCode
93
+ {
94
+ private static $PARSE_SUCCESSFUL = null;
95
+
96
+ private static $PARSE_EXCEPTION = null;
97
+
98
+ private static $MAILING_NOT_FOUND = null;
99
+
100
+ private static $UNKNOWN = null;
101
+
102
+ /**
103
+ * The mailing was successfully parsed.
104
+ */
105
+ public static final function PARSE_SUCCESSFUL()
106
+ {
107
+ if(null === self::$PARSE_SUCCESSFUL)
108
+ self::$PARSE_SUCCESSFUL = new Inx_Api_TriggerMail_ParseResultCode( 1 );
109
+
110
+ return self::$PARSE_SUCCESSFUL;
111
+ }
112
+
113
+ /**
114
+ * An exception occurred during the parsing process.
115
+ */
116
+ public static final function PARSE_EXCEPTION()
117
+ {
118
+ if(null === self::$PARSE_EXCEPTION)
119
+ self::$PARSE_EXCEPTION = new Inx_Api_TriggerMail_ParseResultCode( 2 );
120
+
121
+ return self::$PARSE_EXCEPTION;
122
+ }
123
+
124
+ /**
125
+ * The mailing could not be found (i.e. was deleted).
126
+ */
127
+ public static final function MAILING_NOT_FOUND()
128
+ {
129
+ if(null === self::$MAILING_NOT_FOUND)
130
+ self::$MAILING_NOT_FOUND = new Inx_Api_TriggerMail_ParseResultCode( 3 );
131
+
132
+ return self::$MAILING_NOT_FOUND;
133
+ }
134
+
135
+ /**
136
+ * The result is unknown. This indicates an unknown error.
137
+ */
138
+ public static final function UNKNOWN()
139
+ {
140
+ if(null == self::$UNKNOWN)
141
+ self::$UNKNOWN = new Inx_Api_TriggerMail_ParseResultCode( -1 );
142
+
143
+ return self::$UNKNOWN;
144
+ }
145
+
146
+ private $id;
147
+
148
+
149
+ private function __construct( $iId )
150
+ {
151
+ $this->id = $iId;
152
+ }
153
+
154
+
155
+ /**
156
+ * Returns the ID of the <code>ParseResultCode</code>. The ID is used for transmission purposes and should not
157
+ * be used inside client code.
158
+ *
159
+ * @return the ID of the <code>ParseResultCode</code>.
160
+ */
161
+ public function getId()
162
+ {
163
+ return $this->id;
164
+ }
165
+
166
+
167
+ /**
168
+ * Returns the <code>ParseResultCode</code> corresponding to the given ID. If the ID is unknown, the UNKNOWN
169
+ * code will be used. The ID is used for transmission purposes and should not be used inside client code.
170
+ *
171
+ * @param id the ID of the <code>ParseResultCode</code> to retrieve.
172
+ * @return the <code>ParseResultCode</code> corresponding to the given ID.
173
+ */
174
+ public static function byId( $iId )
175
+ {
176
+ foreach( self::values() as $result )
177
+ {
178
+ if( $result->getId() == $iId )
179
+ {
180
+ return $result;
181
+ }
182
+ }
183
+
184
+ return self::UNKNOWN();
185
+ }
186
+
187
+ public static function values()
188
+ {
189
+ return array(self::PARSE_SUCCESSFUL(), self::PARSE_EXCEPTION(), self::MAILING_NOT_FOUND(), self::UNKNOWN());
190
+ }
191
+ }
192
+
193
+
194
+ /**
195
+ * The <code>BuildResultCode</code> defines the result of the server side building process.
196
+ *
197
+ * @author chge, 02.08.2012
198
+ */
199
+ final class Inx_Api_TriggerMail_BuildResultCode
200
+ {
201
+ private static $BUILD_SUCCESSFUL = null;
202
+
203
+ private static $BUILD_EXCEPTION = null;
204
+
205
+ private static $UNKNOWN = null;
206
+
207
+ /**
208
+ * The mailing was successfully built.
209
+ */
210
+ public static final function BUILD_SUCCESSFUL()
211
+ {
212
+ if(null === self::$BUILD_SUCCESSFUL)
213
+ self::$BUILD_SUCCESSFUL = new Inx_Api_TriggerMail_BuildResultCode( 1 );
214
+
215
+ return self::$BUILD_SUCCESSFUL;
216
+ }
217
+
218
+ /**
219
+ * An exception occurred during the build of the mailing.
220
+ */
221
+ public static final function BUILD_EXCEPTION()
222
+ {
223
+ if(null === self::$BUILD_EXCEPTION)
224
+ self::$BUILD_EXCEPTION = new Inx_Api_TriggerMail_BuildResultCode( 2 );
225
+
226
+ return self::$BUILD_EXCEPTION;
227
+ }
228
+
229
+ /**
230
+ * The result is unknown. This indicates an unknown error.
231
+ */
232
+ public static final function UNKNOWN()
233
+ {
234
+ if(null === self::$UNKNOWN)
235
+ self::$UNKNOWN = new Inx_Api_TriggerMail_BuildResultCode( -1 );
236
+
237
+ return self::$UNKNOWN;
238
+ }
239
+
240
+ private $id;
241
+
242
+
243
+ private function __construct( $iId )
244
+ {
245
+ $this->id = $iId;
246
+ }
247
+
248
+
249
+ /**
250
+ * Returns the ID of the <code>BuildResultCode</code>. The ID is used for transmission purposes and should not
251
+ * be used inside client code.
252
+ *
253
+ * @return the ID of the <code>BuildResultCode</code>.
254
+ */
255
+ public function getId()
256
+ {
257
+ return $this->id;
258
+ }
259
+
260
+
261
+ /**
262
+ * Returns the <code>BuildResultCode</code> corresponding to the given ID. If the ID is unknown, the UNKNOWN
263
+ * code will be used. The ID is used for transmission purposes and should not be used inside client code.
264
+ *
265
+ * @param id the ID of the <code>BuildResultCode</code> to retrieve.
266
+ * @return the <code>BuildResultCode</code> corresponding to the given ID.
267
+ */
268
+ public static function byId( $iId )
269
+ {
270
+ foreach( self::values() as $result )
271
+ {
272
+ if( $result->getId() == $iId )
273
+ {
274
+ return $result;
275
+ }
276
+ }
277
+
278
+ return self::UNKNOWN();
279
+ }
280
+
281
+ public static function values()
282
+ {
283
+ return array(self::BUILD_SUCCESSFUL(), self::BUILD_EXCEPTION(), self::UNKNOWN());
284
+ }
285
+ }
lib/Inx/Api/TriggerMailing/Descriptor/ActionTriggerDescriptorBuilder.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_ActionTriggerDescriptorBuilder</i> is used to easily create action triggers.
9
+ * The following example shows how to create an action trigger descriptor:
10
+ *
11
+ * <pre>
12
+ * $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
13
+ * $descriptor = $factory->createActionTriggerDescriptorBuilder()->build();
14
+ * </pre>
15
+ *
16
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory::createActionTriggerDescriptorBuilder()
17
+ * @since API 1.10.0
18
+ * @author chge, 16.07.2012
19
+ */
20
+ interface Inx_Api_TriggerMailing_Descriptor_ActionTriggerDescriptorBuilder extends Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder
21
+ {
22
+
23
+ }
lib/Inx/Api/TriggerMailing/Descriptor/AnniversaryTriggerDescriptorBuilder.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder</i> is used to easily create anniversary
9
+ * triggers. The following settings are mandatory:
10
+ * <p>
11
+ * <ul>
12
+ * <li><b>The start date</b>: Defines the date at which the trigger will be fired for the first time.
13
+ * <li><b>The sending time</b>: Defines the time at which the trigger will be fired during each dispatch cycle.
14
+ * <li><b>The attribute ID</b>: Defines the attribute used to determine the relevant recipients.
15
+ * <li><b>The column modificator</b>: Defines how long after or before a specific date the trigger shall be fired.
16
+ * </ul>
17
+ * <p>
18
+ * Using only these settings the easiest possible anniversary trigger descriptor can be built using the following
19
+ * statements:
20
+ *
21
+ * <pre>
22
+ * $rmd = $session->createRecipientContext()->getMetaData();
23
+ * $birthdayId = $rmd->getUserAttribute( "Birthday" )->getId();
24
+ * $sendingTime = date('c', mktime(12, 30));
25
+ *
26
+ * $modificator = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
27
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::WAS_AGO(),
28
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::YEAR(), 50);
29
+ *
30
+ * $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
31
+ * $builder = $factory->createAnniversaryTriggerDescriptorBuilder();
32
+ * $builder->startDate( date('c') );
33
+ * $builder->sendingTime( $sendingTime );
34
+ * $builder->attribute( $birthdayId );
35
+ * $builder->columnModificator( $modificator );
36
+ * $descriptor = $builder->build();
37
+ * </pre>
38
+ * <p>
39
+ * There are also some optional settings which can be set:
40
+ * <p>
41
+ * <ul>
42
+ * <li><b>The end date</b>: Defines the date at which the trigger mailing will be dispatched for the last time.
43
+ * <li><b>The offset</b>: Defines the offset of the attribute. For example, how many days after a specific date the
44
+ * trigger mailing shall be dispatched to a recipient.
45
+ * <li><b>The attribute value setters</b>: Can be used to set recipient attribute values along with the dispatch of the
46
+ * trigger mailing.
47
+ * </ul>
48
+ * <p>
49
+ * Using all of these settings, the trigger descriptor could be built with the following statements:
50
+ *
51
+ * <pre>
52
+ * $rmd = $session->createRecipientContext()->getMetaData();
53
+ * $birthdayId = $rmd->getUserAttribute( "Birthday" )->getId();
54
+ * $counterId = $rmd->getUserAttribute( "Counter" )->getId();
55
+ * $endDate = date('c', strtotime('+1 year'));
56
+ * $sendingTime = date('c', mktime(12, 30));
57
+ *
58
+ * $modificator = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
59
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::WAS_AGO(),
60
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::YEAR(), 50);
61
+ *
62
+ * $offset = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
63
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::IS_IN(),
64
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::DAY(), 1);
65
+ *
66
+ * $cmdFactory = $session->getActionManager()->getCommandFactory();
67
+ * $cmd = $cmdFactory->createSetRelativeValueCmd( $counterId, "1" );
68
+ * $commands = array( $cmd );
69
+ *
70
+ * $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
71
+ * $descriptor = $factory->createAnniversaryTriggerDescriptorBuilder()->startDate( date('c') )
72
+ * ->sendingTime( $sendingTime )->endDate( $endDate )->attribute( $birthdayId )
73
+ * ->columnModificator( $modificator )->offset( $offset )->attributeValueSetters( $commands )
74
+ * ->build();
75
+ * </pre>
76
+ *
77
+ * The created trigger will fire one day before a recipients 50th birthday at 12:30 and will increase the Counter
78
+ * attribute. The trigger will be active from now on till the next year.
79
+ *
80
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory::createAnniversaryTriggerDescriptorBuilder()
81
+ * @since API 1.10.0
82
+ * @author chge, 16.07.2012
83
+ */
84
+ interface Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder
85
+ extends Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder
86
+ {
87
+ /**
88
+ * Sets the <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset</i> used to define the time span between the
89
+ * dispatch date and the date specified by the attribute. Be aware that the only legal offset type is WAS_AGO.
90
+ * For example: An anniversary trigger mailing can be sent out ten years after the date specified by the attribute.
91
+ * This setting is mandatory.
92
+ *
93
+ * @param Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset $columnModificator the <i>TimeTriggerOffset</i> used
94
+ * to define the time span between the dispatch date and the date specified by the attribute.
95
+ * @return Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder the builder.
96
+ * @throws Inx_Api_NullPointerException if the given offset is <i>null</i>.
97
+ * @throws Inx_Api_IllegalArgumentException if the offset type is not WAS_AGO.
98
+ */
99
+ public function columnModificator( Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset $columnModificator );
100
+ }
lib/Inx/Api/TriggerMailing/Descriptor/AttributeTriggerDescriptorBuilder.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder</i> is used to easily create attribute
9
+ * driven time triggers. The following settings are mandatory:
10
+ * <p>
11
+ * <ul>
12
+ * <li><b>The start date</b>: Defines the date at which the trigger will be fired for the first time.
13
+ * <li><b>The sending time</b>: Defines the time at shich the trigger will be fired during each dispatch cycle.
14
+ * <li><b>The attribute ID</b>: Defines the attribute used to determine the relevant recipients.
15
+ * </ul>
16
+ * <p>
17
+ * Using only these settings the easiest possible attribute trigger descriptor can be built using the following
18
+ * statements:
19
+ *
20
+ * <pre>
21
+ * $rmd = $session->createRecipientContext()->getMetaData();
22
+ * $birthdayId = $rmd->getUserAttribute( "Birthday" )->getId();
23
+ * $sendingTime = date('c', mktime(12, 30));
24
+ *
25
+ * $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
26
+ * $builder = $factory->createBirthdayTriggerDescriptorBuilder();
27
+ * $builder->startDate( date('c') );
28
+ * $builder->sendingTime( $sendingTime );
29
+ * $builder->attribute( $birthdayId );
30
+ * $descriptor = $builder->build();
31
+ * </pre>
32
+ * <p>
33
+ * There are also some optional settings which can be set:
34
+ * <p>
35
+ * <ul>
36
+ * <li><b>The end date</b>: Defines the date at which the trigger mailing will be dispatched for the last time.
37
+ * <li><b>The offset</b>: Defines the offset of the attribute. For example, how many days after a specific date the
38
+ * trigger mailing shall be dispatched to a recipient.
39
+ * <li><b>The attribute value setters</b>: Can be used to set recipient attribute values along with the dispatch of the
40
+ * trigger mailing.
41
+ * </ul>
42
+ * <p>
43
+ * Using all of these settings, the trigger descriptor could be built with the following statements:
44
+ *
45
+ * <pre>
46
+ * $rmd = $session->createRecipientContext()->getMetaData();
47
+ * $birthdayId = $rmd->getUserAttribute( "Geburtstag" )->getId();
48
+ * $counterId = $rmd->getUserAttribute( "Counter" )->getId();
49
+ *
50
+ * $endDate = date('c', strtotime('+1 year'));
51
+ * $sendingTime = date('c', mktime(12, 30));
52
+ *
53
+ * $offset = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
54
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::IS_IN(),
55
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::DAY(), 1 );
56
+ *
57
+ * $cmdFactory = $session->getActionManager()->getCommandFactory();
58
+ * $cmd = $cmdFactory->createSetRelativeValueCmd( $counterId, "1" );
59
+ * $commands = array( $cmd );
60
+ *
61
+ * $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
62
+ * $descriptor = $factory->createBirthdayTriggerDescriptorBuilder()->startDate( date('c') )
63
+ * ->sendingTime( $sendingTime )->endDate( $endDate )->attribute( $birthdayId )->offset( $offset )
64
+ * ->attributeValueSetters( $commands )->build();
65
+ * </pre>
66
+ *
67
+ * The created trigger will fire one day before a recipients birthday at 12:30 and will increase the Counter attribute.
68
+ * The trigger will be active from now on till the next year.
69
+ *
70
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory::createBirthdayTriggerDescriptorBuilder()
71
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory::createFollowUpTriggerDescriptorBuilder()
72
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory::createReminderTriggerDescriptorBuilder()
73
+ * @since API 1.10.0
74
+ * @author chge, 16.07.2012
75
+ */
76
+ interface Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder
77
+ extends Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder
78
+ {
79
+ /**
80
+ * Sets the ID of the recipient attribute used as basis of the trigger. This setting is mandatory.
81
+ *
82
+ * @param int $iAttributeId the ID of the recipient attribute used as basis of the trigger.
83
+ * @return Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder the builder.
84
+ */
85
+ public function attribute( $iAttributeId );
86
+
87
+
88
+ /**
89
+ * Sets the <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset</i> used to alter the dispatch date specified
90
+ * by the attribute. For example: Normally, birthday trigger mailings are sent on the birthday of the recipient.
91
+ * Using a <i>TimeTriggerOffset</i> you can send your congratulations before or after that date. This setting is
92
+ * optional.
93
+ * <p>
94
+ * There are some restrictions regarding the permitted offset types and units:
95
+ * <ul>
96
+ * <li><b>Birthday trigger mailing</b>: Only the DAY unit is permitted.
97
+ * <li><b>Reminder trigger mailing</b>: Only the DAY unit and the IS_IN type are permitted.
98
+ * <li><b>Follow-up trigger mailing</b>: Only the DAY unit and the WAS_AGO type are permitted.
99
+ * <li><b>Anniversary trigger mailing</b>: Only the DAY unit is permitted.
100
+ * </ul>
101
+ *
102
+ * @param Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset $offset the <i>TimeTriggerOffset</i> used to alter
103
+ * the dispatch date specified by the attribute.
104
+ * @return Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder the builder.
105
+ * @throws Inx_Api_IllegalArgumentException if the offset type or unit is illegal in combination with the trigger
106
+ * type at hand.
107
+ */
108
+ public function offset( Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset $offset = null );
109
+ }
lib/Inx/Api/TriggerMailing/Descriptor/DailyTriggerIntervalBuilder.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_DailyTriggerIntervalBuilder</i> is used to create a daily trigger interval.
9
+ * The only mandatory setting is the interval count. There are no optional settings.
10
+ * <p>
11
+ * The following snippet shows how to build a daily trigger interval which will fire the trigger every two days:
12
+ *
13
+ * <pre>
14
+ * $factory = $session->getTriggerMailingManager()->getTriggerIntervalBuilderFactory();
15
+ * $interval = $factory->getDailyIntervalBuilder()->intervalCount( 2 )->build();
16
+ * </pre>
17
+ *
18
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerInterval
19
+ * @since API 1.10.0
20
+ * @author chge, 17.07.2012
21
+ */
22
+ interface Inx_Api_TriggerMailing_Descriptor_DailyTriggerIntervalBuilder
23
+ extends Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder
24
+ {
25
+
26
+ }
lib/Inx/Api/TriggerMailing/Descriptor/HourlyTriggerIntervalBuilder.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_HourlyTriggerIntervalBuilder</i> is used to create a hourly trigger interval.
9
+ * The only mandatory setting is the interval count. There are no optional settings.
10
+ * <p>
11
+ * The following snippet shows how to build a hourly trigger interval which will fire the trigger every five hours:
12
+ *
13
+ * <pre>
14
+ * $factory = $session->getTriggerMailingManager()->getTriggerIntervalBuilderFactory();
15
+ * $interval = $factory->getHourlyIntervalBuilder()->intervalCount( 5 )->build();
16
+ * </pre>
17
+ *
18
+ * @see Inx:_Api_TriggerMailing_Descriptor_TriggerInterval
19
+ * @since API 1.10.0
20
+ * @author chge, 17.07.2012
21
+ */
22
+ interface Inx_Api_TriggerMailing_Descriptor_HourlyTriggerIntervalBuilder
23
+ extends Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder
24
+ {
25
+
26
+ }
lib/Inx/Api/TriggerMailing/Descriptor/IntervalTriggerDescriptorBuilder.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_IntervalTriggerDescriptorBuilder</i> is used to easily create interval
9
+ * triggers. The following settings are mandatory:
10
+ * <p>
11
+ * <ul>
12
+ * <li><b>The start date</b>: Defines the date at which the trigger will be fired for the first time.
13
+ * <li><b>The sending time</b>: Defines the time at which the trigger will be fired during each dispatch cycle.
14
+ * <li><b>The interval</b>: Defines the interval at which the trigger will be fired.
15
+ * </ul>
16
+ * <p>
17
+ * Using only these settings the easiest possible interval trigger descriptor can be built using the following
18
+ * statements:
19
+ *
20
+ * <pre>
21
+ * $intFactory = $session->getTriggerMailingManager()->getTriggerIntervalBuilderFactory();
22
+ * $intBuilder = $intFactory->getDailyIntervalBuilder();
23
+ * $intBuilder->intervalCount( 1 );
24
+ * $interval = $intBuilder->build();
25
+ * $sendingTime = date('c', mktime(12, 30));
26
+ *
27
+ * $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
28
+ * $builder = $factory->createIntervalTriggerDescriptorBuilder();
29
+ * $builder->startDate( date('c') );
30
+ * $builder->sendingTime( $sendingTime );
31
+ * $builder->interval( $interval );
32
+ * $descriptor = $builder->build();
33
+ * </pre>
34
+ * <p>
35
+ * There are also some optional settings which can be set:
36
+ * <p>
37
+ * <ul>
38
+ * <li><b>The end date</b>: Defines the date at which the trigger mailing will be dispatched for the last time.
39
+ * <li><b>The attribute value setters</b>: Can be used to set recipient attribute values along with the dispatch of the
40
+ * trigger mailing.
41
+ * </ul>
42
+ * <p>
43
+ * Using all of these settings, the trigger descriptor could be built with the following statements:
44
+ *
45
+ * <pre>
46
+ * $intFactory = $session->getTriggerMailingManager()->getTriggerIntervalBuilderFactory();
47
+ * $interval = $intFactory->getWeeklyIntervalBuilder()->intervalCount( 2 )->dispatchIntervals(
48
+ * array(Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval::MONDAY(),
49
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval::FRIDAY() ) )->build();
50
+ *
51
+ * $rmd = $session->createRecipientContext()->getMetaData();
52
+ * $counterId = $rmd->getUserAttribute( "Counter" )->getId();
53
+ * $endDate = date('c', strtotime('+1 year'));
54
+ * $sendingTime = date('c', mktime(12, 30));
55
+ *
56
+ * $cmdFactory = $session->getActionManager()->getCommandFactory();
57
+ * $cmd = $cmdFactory->createSetRelativeValueCmd( $counterId, "1" );
58
+ * $commands = array( $cmd );
59
+ *
60
+ * $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
61
+ * $descriptor = $factory->createIntervalTriggerDescriptorBuilder()->startDate( date('c') )
62
+ * ->sendingTime( $sendingTime )->endDate( $endDate )->interval( $interval )
63
+ * ->attributeValueSetters( $commands )->build();
64
+ * </pre>
65
+ *
66
+ * The created trigger will fire every two weeks on Monday and Friday at 12:30 and will increase the Counter attribute.
67
+ * The trigger will be active from now on till the next year.
68
+ *
69
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory::createIntervalTriggerDescriptorBuilder()
70
+ * @since API 1.10.0
71
+ * @author chge, 17.07.2012
72
+ */
73
+ interface Inx_Api_TriggerMailing_Descriptor_IntervalTriggerDescriptorBuilder
74
+ extends Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder
75
+ {
76
+ /**
77
+ * Sets the <i>Inx_Api_TriggerMailing_Descriptor_TriggerInterval</i> used to define the dispatch intervals of
78
+ * an interval trigger mailing. This setting is mandatory.
79
+ *
80
+ * @param Inx_Api_TriggerMailing_Descriptor_TriggerInterval interval the <i>TriggerInterval</i> used to define
81
+ * the dispatch intervals of an interval trigger mailing.
82
+ * @return Inx_Api_TriggerMailing_Descriptor_IntervalTriggerDescriptorBuilder the builder.
83
+ * @throws Inx_Api_NullPointerException if the given interval is <i>null</i>.
84
+ */
85
+ public function interval( Inx_Api_TriggerMailing_Descriptor_TriggerInterval $interval = null );
86
+ }
lib/Inx/Api/TriggerMailing/Descriptor/MonthlyTriggerIntervalBuilder.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_MonthlyTriggerIntervalBuilder</i> is used to create a monthly trigger interval.
9
+ * The following settings are mandatory:
10
+ * <p/>
11
+ * <ul>
12
+ * <li><b>The interval count</b>: Specifies how many times the trigger will be fired. The trigger will be fired every X
13
+ * months where X is the interval count. Do not confuse this setting with the day setting.</li>
14
+ * <li><b>The day</b>: Specifies the day, at which the trigger will be fired.</li>
15
+ * <li><b>The dispatch interval</b>: Specifies the basis for the day attribute. The following options are allowed:
16
+ * <ul>
17
+ * <li><i>LAST_DAY_OF_MONTH</i>: The trigger will be fired on the last day of the month. In this case, the day setting
18
+ * must be omitted or set to zero.</li>
19
+ * <li><i>SPECIFIC_DAY_OF_MONTH</i>: The trigger will be fired on the day of month specified by the day setting.</li>
20
+ * <li><i>SPECIFIC_DAY_BEFORE_END_OF_MONTH</i>: The trigger will be fired on the specified day before the end of the
21
+ * month. For example, using the value 2 for the day setting will cause the trigger to be fired to days before the end
22
+ * of the current month.</li>
23
+ * </ul>
24
+ * </li>
25
+ * </ul>
26
+ * The day setting is only optional when using the dispatch interval LAST_DAY_OF_MONTH. There are no other optional
27
+ * settings.
28
+ * <p/>
29
+ * The following snippet shows how to build a monthly trigger interval which will fire the trigger every two months,
30
+ * three days before the end of the month:
31
+ *
32
+ * <pre>
33
+ * $factory = $session->getTriggerMailingManager()->getTriggerIntervalBuilderFactory();
34
+ * $interval = $factory->getMonthlyIntervalBuilder()->intervalCount( 2 )->day( 3 )->dispatchInterval(
35
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval::SPECIFIC_DAY_BEFORE_END_OF_MONTH())
36
+ * ->build();
37
+ * </pre>
38
+ *
39
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerInterval
40
+ * @since API 1.10.0
41
+ * @author chge, 17.07.2012
42
+ */
43
+ interface Inx_Api_TriggerMailing_Descriptor_MonthlyTriggerIntervalBuilder
44
+ extends Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder
45
+ {
46
+ /**
47
+ * Sets the <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval</i> which determines the dispatch interval.
48
+ * This setting is mandatory. The following options are legal:
49
+ * <p/>
50
+ * <ul>
51
+ * <li><i>LAST_DAY_OF_MONTH</i>: The trigger will be fired on the last day of the month. In this case, the day
52
+ * setting must be omitted or set to zero.
53
+ * <li><i>SPECIFIC_DAY_OF_MONTH</i>: The trigger will be fired on the day of month specified by the day setting.
54
+ * <li><i>SPECIFIC_DAY_BEFORE_END_OF_MONTH</i>: The trigger will be fired on the specified day before the end of the
55
+ * month. For example, using the value 2 for the day setting will cause the trigger to be fired to days before the
56
+ * end of the current month.
57
+ * </ul>
58
+ *
59
+ * @param Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval $dispatchInterval the
60
+ * <i>TimeTriggerDispatchInterval</i>s which determines the dispatch interval.
61
+ * @return Inx_Api_TriggerMailing_Descriptor_MonthlyTriggerIntervalBuilder the builder.
62
+ * @throws Inx_Api_IllegalArgumentException if the dispatch interval is not one of the values listed above.
63
+ */
64
+ public function dispatchInterval( Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval $dispatchInterval );
65
+
66
+
67
+ /**
68
+ * Returns the day of the dispatch interval. This setting is only optional if the dispatch interval is
69
+ * LAST_DAY_OF_MONTH. In this case, the day setting must be omitted or set to zero. Do not confuse this setting with
70
+ * the interval count setting as they are used for different purposes. For example, to fire the trigger every two
71
+ * months on the first day of the month, you need the following settings:
72
+ * <p/>
73
+ * <ul>
74
+ * <li><b>Interval count</b>: 2
75
+ * <li><b>Dispatch interval</b>: SPECIFIC_DAY_OF_MONTH
76
+ * <li><b>Day</b>: 1
77
+ * </ul>
78
+ * <p/>
79
+ * Only values between 1 and 28 inclusively are legal.
80
+ *
81
+ * @param int $iDay the day of the dispatch interval.
82
+ * @return Inx_Api_TriggerMailing_Descriptor_MonthlyTriggerIntervalBuilder the builder.
83
+ * @throws Inx_Api_IllegalArgumentException if the value is smaller than 1 or bigger than 28.
84
+ */
85
+ public function day( $iDay );
86
+ }
lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerDescriptorBuilder.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder</i> builder is used to easily create time triggers.
9
+ * There are only two mandatory settings: the start date and the sending time which identify the date and time at which the
10
+ * trigger will be fired for the first time.
11
+ * <p>
12
+ * The following settings are optional:
13
+ * <p>
14
+ * <ul>
15
+ * <li><b>The end date</b>: Defines the date at which the trigger mailing will be dispatched for the last time.
16
+ * <li><b>The attribute value setters</b>: Can be used to set recipient attribute values along with the dispatch of the
17
+ * trigger mailing.
18
+ * </ul>
19
+ *
20
+ * @since API 1.10.0
21
+ * @author chge, 16.07.2012
22
+ */
23
+ interface Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder
24
+ extends Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder
25
+ {
26
+ /**
27
+ * Sets the date at which the trigger will be fired for the first time. This setting is mandatory. Be aware that the
28
+ * time component of the date will be disregarded. The sending time is specified separately by the <i>sendingTime</i>
29
+ * method. The time component of the specified date will be overwritten accordingly. Also, the seconds and milliseconds
30
+ * will be set to zero.
31
+ * <p>
32
+ * For example, consider the following two dates for start date and sending time:
33
+ * <ul>
34
+ * <li><b>Start date</b>: <i>2013-01-01T13:57:04+01:00</i>
35
+ * <li><b>Sending time</b>: <i>2012-07-05T12:30:42+01:00</i>
36
+ * </ul>
37
+ * The resulting start date for the trigger will be: <i>2013-01-01T12:30:00+01:00</i>
38
+ *
39
+ * @param string $sStartDate the date at which the trigger will be fired for the first time. The date has to be specified
40
+ * as ISO-8601 formatted date or datetime string.
41
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder the builder.
42
+ * @throws Inx_Api_NullPointerException if the given start date is <i>null</i>.
43
+ */
44
+ public function startDate( $sStartDate );
45
+
46
+
47
+ /**
48
+ * Sets the time at which the sending will be started during each dispatch cycle. This setting is mandatory. Be
49
+ * aware that the date component of the given date object will be disregarded. Also, the seconds and milliseconds
50
+ * will be set to zero. This setting will overwrite the time component of the start and end dates when the
51
+ * <i>TriggerDescriptor</i> is built.
52
+ *
53
+ * @param string $sSendingTime the time at which the sending will be started during each dispatch cycle. The date
54
+ * has to be specified as ISO-8601 formatted time or datetime string.
55
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder the builder.
56
+ * @throws Inx_Api_NullPointerException if the given sending time is <i>null</i>.
57
+ */
58
+ public function sendingTime( $sSendingTime );
59
+
60
+
61
+ /**
62
+ * Sets the date at which the trigger will be fired for the last time. This setting is optional. Be aware that the
63
+ * time component of the date will be disregarded. The sending time is specified separately by the <i>sendingTime</i>
64
+ * method. The time component of the specified date will be overwritten accordingly. Also, the seconds and milliseconds
65
+ * will be set to zero.
66
+ * <p>
67
+ * For example, consider the following two dates for end date and sending time:
68
+ * <ul>
69
+ * <li><b>End date</b>: <i>2015-01-01T13:57:04+01:00</i>
70
+ * <li><b>Sending time</b>: <i>2012-07-05T12:30:42+01:00</i>
71
+ * </ul>
72
+ * The resulting end date for the trigger will be: <i>2015-01-01T12:30:00+01:00</i>
73
+ *
74
+ * @param string $sEndDate the date at which the trigger will be fired for the last time. The date has to be specified
75
+ * as ISO-8601 formatted date or datetime string.
76
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder the builder.
77
+ */
78
+ public function endDate( $sEndDate );
79
+
80
+
81
+ /**
82
+ * Sets an array of <i>Inx_Api_Action_SetValueCommand</i>s which will be executed when dispatching the trigger
83
+ * mailings. Using this feature, it is possible to set the values of recipient attributes along with the dispatching
84
+ * of a trigger mailing to that same recipient. This setting is optional.
85
+ *
86
+ * @param array $commands an array of <i>Inx_Api_Action_SetValueCommand</i>s used to set recipient attributes during
87
+ * dispatch.
88
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder the builder.
89
+ */
90
+ public function attributeValueSetters( array $commands = null );
91
+ }
92
+
lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerDispatchInterval.php ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval</i> enumeration defines the possible
9
+ * interval types of interval trigger mailings.
10
+ * <p>
11
+ * A note for programmers who are not familiar with the concept of enumerations: Enumerations or enumerated types are basically
12
+ * a fixed set of named values. They are usually used to define a couple of legitimate values in a specific context and serve a
13
+ * purpose similar to integer constants.
14
+ * The advantage of enumerations is, that you cannot specify any "weird" values because every value has to be an instance of
15
+ * the enumerated type. It is also possible to associate data or even behaviour (methods) with the values.
16
+ * PHP does not support such a language feature like Java and C# do. In most languages the named values are a sort of constant
17
+ * whose value is an instance of the enumerated type. In PHP a constant cannot contain a reference type. Therefore, we
18
+ * implemented enumerations as classes with private constructor and methods which return the named values.
19
+ * Be aware that the objects returned by the static methods are always the same object. That way it is possible to use the
20
+ * identity operator (===) on these objects and use them comfortably in switch statements.
21
+ *
22
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerInterval::getDispatchIntervals()
23
+ * @since API 1.10.0
24
+ * @author chge, 16.07.2012
25
+ */
26
+ final class Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval
27
+ {
28
+ private static $LAST_DAY_OF_MONTH = null;
29
+
30
+ private static $SPECIFIC_DAY_OF_MONTH = null;
31
+
32
+ private static $SPECIFIC_DAY_BEFORE_END_OF_MONTH = null;
33
+
34
+ private static $MONDAY = null;
35
+
36
+ private static $TUESDAY = null;
37
+
38
+ private static $WEDNESDAY = null;
39
+
40
+ private static $THURSDAY = null;
41
+
42
+ private static $FRIDAY = null;
43
+
44
+ private static $SATURDAY = null;
45
+
46
+ private static $SUNDAY = null;
47
+
48
+ private static $DAILY = null;
49
+
50
+ private static $HOURLY = null;
51
+
52
+ private static $UNKNOWN = null;
53
+
54
+ /**
55
+ * Dispatch interval for time triggers which fire on the last day of each month.
56
+ *
57
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the last day of month
58
+ * <i>TimeTriggerDispatchInterval</i>.
59
+ */
60
+ public static final function LAST_DAY_OF_MONTH()
61
+ {
62
+ if(null === self::$LAST_DAY_OF_MONTH)
63
+ self::$LAST_DAY_OF_MONTH =
64
+ new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 1 );
65
+
66
+ return self::$LAST_DAY_OF_MONTH;
67
+ }
68
+
69
+ /**
70
+ * Dispatch interval for time triggers which fire on a specific day of each month.
71
+ *
72
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the specific day of month
73
+ * <i>TimeTriggerDispatchInterval</i>.
74
+ */
75
+ public static final function SPECIFIC_DAY_OF_MONTH()
76
+ {
77
+ if(null === self::$SPECIFIC_DAY_OF_MONTH)
78
+ self::$SPECIFIC_DAY_OF_MONTH=
79
+ new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 2 );
80
+
81
+ return self::$SPECIFIC_DAY_OF_MONTH;
82
+ }
83
+
84
+ /**
85
+ * Dispatch interval for time triggers which fire on a specific day before the end of each month.
86
+ *
87
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the specific day before end of month
88
+ * <i>TimeTriggerDispatchInterval</i>.
89
+ */
90
+ public static final function SPECIFIC_DAY_BEFORE_END_OF_MONTH()
91
+ {
92
+ if(null === self::$SPECIFIC_DAY_BEFORE_END_OF_MONTH)
93
+ self::$SPECIFIC_DAY_BEFORE_END_OF_MONTH =
94
+ new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 3 );
95
+
96
+ return self::$SPECIFIC_DAY_BEFORE_END_OF_MONTH;
97
+ }
98
+
99
+ /**
100
+ * Dispatch interval for time triggers which fire on every Monday.
101
+ *
102
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the monday <i>TimeTriggerDispatchInterval</i>.
103
+ */
104
+ public static final function MONDAY()
105
+ {
106
+ if(null === self::$MONDAY)
107
+ self::$MONDAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 4 );
108
+
109
+ return self::$MONDAY;
110
+ }
111
+
112
+ /**
113
+ * Dispatch interval for time triggers which fire on every Tuesday.
114
+ *
115
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the tuesday <i>TimeTriggerDispatchInterval</i>.
116
+ */
117
+ public static final function TUESDAY()
118
+ {
119
+ if(null === self::$TUESDAY)
120
+ self::$TUESDAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 5 );
121
+
122
+ return self::$TUESDAY;
123
+ }
124
+
125
+ /**
126
+ * Dispatch interval for time triggers which fire on every Wednesday.
127
+ *
128
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the wednesday <i>TimeTriggerDispatchInterval</i>.
129
+ */
130
+ public static final function WEDNESDAY()
131
+ {
132
+ if(null === self::$WEDNESDAY)
133
+ self::$WEDNESDAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 6 );
134
+
135
+ return self::$WEDNESDAY;
136
+ }
137
+
138
+ /**
139
+ * Dispatch interval for time triggers which fire on every Thursday.
140
+ *
141
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the thursday <i>TimeTriggerDispatchInterval</i>.
142
+ */
143
+ public static final function THURSDAY()
144
+ {
145
+ if(null === self::$THURSDAY)
146
+ self::$THURSDAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 7 );
147
+
148
+ return self::$THURSDAY;
149
+ }
150
+
151
+ /**
152
+ * Dispatch interval for time triggers which fire on every Friday.
153
+ *
154
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the friday <i>TimeTriggerDispatchInterval</i>.
155
+ */
156
+ public static final function FRIDAY()
157
+ {
158
+ if(null === self::$FRIDAY)
159
+ self::$FRIDAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 8 );
160
+
161
+ return self::$FRIDAY;
162
+ }
163
+
164
+ /**
165
+ * Dispatch interval for time triggers which fire on every Saturday.
166
+ *
167
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the saturday <i>TimeTriggerDispatchInterval</i>.
168
+ */
169
+ public static final function SATURDAY()
170
+ {
171
+ if(null === self::$SATURDAY)
172
+ self::$SATURDAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 9 );
173
+
174
+ return self::$SATURDAY;
175
+ }
176
+
177
+ /**
178
+ * Dispatch interval for time triggers which fire on every Sunday.
179
+ *
180
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the sunday <i>TimeTriggerDispatchInterval</i>.
181
+ */
182
+ public static final function SUNDAY()
183
+ {
184
+ if(null === self::$SUNDAY)
185
+ self::$SUNDAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 10 );
186
+
187
+ return self::$SUNDAY;
188
+ }
189
+
190
+ /**
191
+ * Dispatch interval for time triggers which fire on a daily basis.
192
+ *
193
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the daily <i>TimeTriggerDispatchInterval</i>.
194
+ */
195
+ public static final function DAILY()
196
+ {
197
+ if(null === self::$DAILY)
198
+ self::$DAILY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 11 );
199
+
200
+ return self::$DAILY;
201
+ }
202
+
203
+ /**
204
+ * Dispatch interval for time triggers which fire on a hourly basis.
205
+ *
206
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the hourly <i>TimeTriggerDispatchInterval</i>.
207
+ */
208
+ public static final function HOURLY()
209
+ {
210
+ if(null === self::$HOURLY)
211
+ self::$HOURLY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( 12 );
212
+
213
+ return self::$HOURLY;
214
+ }
215
+
216
+ /**
217
+ * Unknown dispatch interval. Indicates a version mismatch between API and server.
218
+ *
219
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the unknown <i>TimeTriggerDispatchInterval</i>.
220
+ */
221
+ public static final function UNKNOWN()
222
+ {
223
+ if(null === self::$UNKNOWN)
224
+ self::$UNKNOWN = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval( -1 );
225
+
226
+ return self::$UNKNOWN;
227
+ }
228
+
229
+ private $id;
230
+
231
+
232
+ private function __construct( $iId )
233
+ {
234
+ $this->id = $iId;
235
+ }
236
+
237
+
238
+ /**
239
+ * Returns the ID of the <i>TimeTriggerDispatchInterval</i>. The ID is used for transmission purposes and
240
+ * should not be used inside client code.
241
+ *
242
+ * @return int the ID of the <i>TimeTriggerDispatchInterval</i>.
243
+ */
244
+ public function getId()
245
+ {
246
+ return $this->id;
247
+ }
248
+
249
+
250
+ /**
251
+ * Returns the <i>TimeTriggerDispatchInterval</i> corresponding to the given ID. If the ID is unknown, the
252
+ * UNKNOWN interval will be used. The ID is used for transmission purposes and should not be used inside client
253
+ * code.
254
+ *
255
+ * @param int $iId the ID of the <i>TimeTriggerDispatchInterval</i> to retrieve.
256
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval the <i>TimeTriggerDispatchInterval</i>
257
+ * corresponding to the given ID.
258
+ */
259
+ public static function byId( $iId )
260
+ {
261
+ foreach( self::values() as $interval )
262
+ {
263
+ if( $interval->getId() == $iId )
264
+ {
265
+ return $interval;
266
+ }
267
+ }
268
+
269
+ return self::UNKNOWN();
270
+ }
271
+
272
+ /**
273
+ * Returns an array containing all available <i>TimeTriggerDispatchInterval</i>s including UNKNOWN.
274
+ *
275
+ * @return array an array containing all available <i>TimeTriggerDispatchInterval</i>s including UNKNOWN.
276
+ */
277
+ public static function values()
278
+ {
279
+ return array(self::LAST_DAY_OF_MONTH(), self::SPECIFIC_DAY_OF_MONTH(), self::SPECIFIC_DAY_BEFORE_END_OF_MONTH(),
280
+ self::MONDAY(), self::TUESDAY(), self::WEDNESDAY(), self::THURSDAY(), self::FRIDAY(), self::SATURDAY(),
281
+ self::SUNDAY(), self::DAILY(), self::HOURLY(), self::UNKNOWN());
282
+ }
283
+ }
284
+
lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerOffset.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset</i> is used to adjust the dispatch date of an
9
+ * attribute driven time trigger mailing. A <i>TimeTriggerOffset</i> consists of three parts:
10
+ * <ol>
11
+ * <li><b>The offset type</b>: Defines whether the offset is positive or negative.
12
+ * <li><b>The offset unit</b>: Defines the unit of the offset (e.g. day, week, month,...).
13
+ * <li><b>The offset value</b>: Defines the actual offset.
14
+ * </ol>
15
+ * <p>
16
+ * The following snippet shows how to create a tomorrow offset:
17
+ *
18
+ * <pre>
19
+ * $tomorrow = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
20
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::IS_IN(),
21
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::DAY(), 1 );
22
+ * </pre>
23
+ *
24
+ * @since API 1.10.0
25
+ * @author chge, 16.07.2012
26
+ */
27
+ final class Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset
28
+ {
29
+ private $type;
30
+
31
+ private $unit;
32
+
33
+ private $value;
34
+
35
+
36
+ /**
37
+ * Creates a new offset with the given type, unit and offset value. The value may not be negative.
38
+ * If all parameters are omitted, creates an offset which represents "now".
39
+ *
40
+ * @param Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType $type the offset type.
41
+ * @param Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit $unit the offset unit.
42
+ * @param int $iValue the actual offset value. May not be negative.
43
+ * @throws Inx_Api_IllegalArgumentException if the value is negative.
44
+ */
45
+ public function __construct(Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType $type = null,
46
+ Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit $unit = null, $iValue = null)
47
+ {
48
+ if(null !== $iValue && $iValue < 0)
49
+ throw new Inx_Api_IllegalArgumentException( "value may not be negative" );
50
+
51
+ $this->type = (null === $type) ? Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::IS_IN() : $type;
52
+ $this->unit = (null === $unit) ? Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::DAY() : $unit;
53
+ $this->value = (null === $iValue) ? 0 : $iValue;
54
+ }
55
+
56
+
57
+ /**
58
+ * Returns the offset type.
59
+ *
60
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType the offset type.
61
+ */
62
+ public function getType()
63
+ {
64
+ return $this->type;
65
+ }
66
+
67
+
68
+ /**
69
+ * Returns the offset unit.
70
+ *
71
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the offset unit.
72
+ */
73
+ public function getUnit()
74
+ {
75
+ return $this->unit;
76
+ }
77
+
78
+
79
+ /**
80
+ * Returns the actual offset value.
81
+ *
82
+ * @return int the offset value.
83
+ */
84
+ public function getValue()
85
+ {
86
+ return $this->value;
87
+ }
88
+
89
+
90
+ /**
91
+ * Compares this <i>TimeTriggerOffset</i> and the given object for equality. The two objects are considered
92
+ * equal if they are the same or are both <i>TimeTriggerOffset</i>s of the same type with the same unit and
93
+ * value.
94
+ *
95
+ * @param mixed $obj the object to be compared to this <i>TimeTriggerOffset</i> for equality.
96
+ * @return bool <i>true</i> if the the given object is equal to this <i>TimeTriggerOffset</i>, <i>false</i>
97
+ * otherwise.
98
+ */
99
+ public function equals( $obj )
100
+ {
101
+ if( $this === $obj )
102
+ {
103
+ return true;
104
+ }
105
+
106
+ if( null === $obj )
107
+ {
108
+ return false;
109
+ }
110
+
111
+ if(gettype($this) !== gettype($obj) )
112
+ {
113
+ return false;
114
+ }
115
+
116
+ if( $this->type !== $obj->getType() )
117
+ {
118
+ return false;
119
+ }
120
+
121
+ if( $this->unit !== $obj->getUnit() )
122
+ {
123
+ return false;
124
+ }
125
+
126
+ if( $this->value !== $obj->getValue() )
127
+ {
128
+ return false;
129
+ }
130
+
131
+ return true;
132
+ }
133
+ }
lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerOffsetType.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType</i> defines the possible types of
4
+ * <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset</i>s.
5
+ * <p>
6
+ * A note for programmers who are not familiar with the concept of enumerations: Enumerations or enumerated types are basically
7
+ * a fixed set of named values. They are usually used to define a couple of legitimate values in a specific context and serve a
8
+ * purpose similar to integer constants.
9
+ * The advantage of enumerations is, that you cannot specify any "weird" values because every value has to be an instance of
10
+ * the enumerated type. It is also possible to associate data or even behaviour (methods) with the values.
11
+ * PHP does not support such a language feature like Java and C# do. In most languages the named values are a sort of constant
12
+ * whose value is an instance of the enumerated type. In PHP a constant cannot contain a reference type. Therefore, we
13
+ * implemented enumerations as classes with private constructor and methods which return the named values.
14
+ * Be aware that the objects returned by the static methods are always the same object. That way it is possible to use the
15
+ * identity operator (===) on these objects and use them comfortably in switch statements.
16
+ *
17
+ * @since API 1.10.0
18
+ * @author chge, 16.07.2012
19
+ */
20
+ final class Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType
21
+ {
22
+ private static $IS_IN = null;
23
+
24
+ private static $WAS_AGO = null;
25
+
26
+ private static $UNKNOWN = null;
27
+
28
+ /**
29
+ * Constant for positive offsets.
30
+ *
31
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType the is in <i>TimeTriggerOffsetType</i>.
32
+ */
33
+ public static final function IS_IN()
34
+ {
35
+ if(null === self::$IS_IN)
36
+ self::$IS_IN = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType( 1 );
37
+
38
+ return self::$IS_IN;
39
+ }
40
+
41
+ /**
42
+ * Constant for negative offsets.
43
+ *
44
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType the was ago <i>TimeTriggerOffsetType</i>.
45
+ */
46
+ public static final function WAS_AGO()
47
+ {
48
+ if(null === self::$WAS_AGO)
49
+ self::$WAS_AGO = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType( 2 );
50
+
51
+ return self::$WAS_AGO;
52
+ }
53
+
54
+ /**
55
+ * Constant for an unknown offset type. Indicates a version mismatch between API and server.
56
+ *
57
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType the unknown <i>TimeTriggerOffsetType</i>.
58
+ */
59
+ public static final function UNKNOWN()
60
+ {
61
+ if(null === self::$UNKNOWN)
62
+ self::$UNKNOWN = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType( -1 );
63
+
64
+ return self::$UNKNOWN;
65
+ }
66
+
67
+ private $id;
68
+
69
+
70
+ private function __construct( $iId )
71
+ {
72
+ $this->id = $iId;
73
+ }
74
+
75
+
76
+ /**
77
+ * Returns the ID of the <i>TimeTriggerOffsetType</i>. The ID is used for transmission purposes and should
78
+ * not be used inside client code.
79
+ *
80
+ * @return int the ID of the <i>TimeTriggerOffsetType</i>.
81
+ */
82
+ public function getId()
83
+ {
84
+ return $this->id;
85
+ }
86
+
87
+
88
+ /**
89
+ * Returns the <i>TimeTriggerOffsetType</i> corresponding to the given ID. If the ID is unknown, the
90
+ * UNKNOWN type will be used. The ID is used for transmission purposes and should not be used inside client
91
+ * code.
92
+ *
93
+ * @param int $iId the ID of the <i>TimeTriggerOffsetType</i> to retrieve.
94
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType the <i>TimeTriggerOffsetType</i> corresponding
95
+ * to the given ID.
96
+ */
97
+ public static function byId( $iId )
98
+ {
99
+ foreach( self::values() as $type )
100
+ {
101
+ if( $type->getId() == $iId )
102
+ {
103
+ return $type;
104
+ }
105
+ }
106
+
107
+ return self::UNKNOWN();
108
+ }
109
+
110
+ /**
111
+ * Returns an array containing all available <i>TimeTriggerOffsetType</i>s including UNKNOWN.
112
+ *
113
+ * @return array an array containing all available <i>TimeTriggerOffsetType</i>s including UNKNOWN.
114
+ */
115
+ public static function values()
116
+ {
117
+ return array(self::IS_IN(), self::WAS_AGO(), self::UNKNOWN());
118
+ }
119
+ }
lib/Inx/Api/TriggerMailing/Descriptor/TimeTriggerUnit.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit</i> enumeration defines the time units which can be used
9
+ * with time triggers, including the minimum and maximum values. The <i>TimeTriggerUnit</i> is used in various aspects
10
+ * of time triggers, for example in offsets and intervals.
11
+ * <p>
12
+ * A note for programmers who are not familiar with the concept of enumerations: Enumerations or enumerated types are basically
13
+ * a fixed set of named values. They are usually used to define a couple of legitimate values in a specific context and serve a
14
+ * purpose similar to integer constants.
15
+ * The advantage of enumerations is, that you cannot specify any "weird" values because every value has to be an instance of
16
+ * the enumerated type. It is also possible to associate data or even behaviour (methods) with the values.
17
+ * PHP does not support such a language feature like Java and C# do. In most languages the named values are a sort of constant
18
+ * whose value is an instance of the enumerated type. In PHP a constant cannot contain a reference type. Therefore, we
19
+ * implemented enumerations as classes with private constructor and methods which return the named values.
20
+ * Be aware that the objects returned by the static methods are always the same object. That way it is possible to use the
21
+ * identity operator (===) on these objects and use them comfortably in switch statements.
22
+ *
23
+ * @since API 1.10.0
24
+ * @author chge, 16.07.2012
25
+ */
26
+ final class Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit
27
+ {
28
+ private static $DAY = null;
29
+
30
+ private static $MONTH = null;
31
+
32
+ private static $YEAR = null;
33
+
34
+ private static $WEEK = null;
35
+
36
+ private static $HOUR = null;
37
+
38
+ private static $UNKNOWN = null;
39
+
40
+ /**
41
+ * Time unit for daily fired time triggers and offsets. The values may range from 1 to 364 inclusively.
42
+ *
43
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the day <i>TimeTriggerUnit</i>.
44
+ */
45
+ public static final function DAY()
46
+ {
47
+ if(null === self::$DAY)
48
+ self::$DAY = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit( 1, 1, 364 );
49
+
50
+ return self::$DAY;
51
+ }
52
+
53
+ /**
54
+ * Time unit for monthly fired time triggers and offsets. The values may range from 1 to 12 inclusively.
55
+ *
56
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the month <i>TimeTriggerUnit</i>.
57
+ */
58
+ public static final function MONTH()
59
+ {
60
+ if(null === self::$MONTH)
61
+ self::$MONTH = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit( 2, 1, 12 );
62
+
63
+ return self::$MONTH;
64
+ }
65
+
66
+ /**
67
+ * Time unit for yearly fired time triggers and offsets. The values may range from 1 to 100 inclusively.
68
+ *
69
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the year <i>TimeTriggerUnit</i>.
70
+ */
71
+ public static final function YEAR()
72
+ {
73
+ if(null === self::$YEAR)
74
+ self::$YEAR = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit( 3, 1, 100 );
75
+
76
+ return self::$YEAR;
77
+ }
78
+
79
+ /**
80
+ * Time unit for weekly fired time triggers and offsets. The values may range from 1 to 51 inclusively.
81
+ *
82
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the week <i>TimeTriggerUnit</i>.
83
+ */
84
+ public static final function WEEK()
85
+ {
86
+ if(null === self::$WEEK)
87
+ self::$WEEK = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit( 4, 1, 51 );
88
+
89
+ return self::$WEEK;
90
+ }
91
+
92
+ /**
93
+ * Time unit for hourly fired time triggers and offsets. The values may range from 1 to 23 inclusively.
94
+ *
95
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the hour <i>TimeTriggerUnit</i>.
96
+ */
97
+ public static final function HOUR()
98
+ {
99
+ if(null === self::$HOUR)
100
+ self::$HOUR = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit( 5, 1, 23 );
101
+
102
+ return self::$HOUR;
103
+ }
104
+
105
+
106
+ /**
107
+ * Unknown time unit. Indicates a version mismatch between API and server.
108
+ *
109
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the unknown <i>TimeTriggerUnit</i>.
110
+ */
111
+ public static final function UNKNOWN()
112
+ {
113
+ if(null === self::$UNKNOWN)
114
+ self::$UNKNOWN = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit( -1, 0, 10000 );
115
+
116
+ return self::$UNKNOWN;
117
+ }
118
+
119
+ private $id;
120
+
121
+ private $minValue;
122
+
123
+ private $maxValue;
124
+
125
+
126
+ private function __construct( $iId, $iMinValue, $iMaxValue )
127
+ {
128
+ $this->id = $iId;
129
+ $this->minValue = $iMinValue;
130
+ $this->maxValue = $iMaxValue;
131
+ }
132
+
133
+
134
+ /**
135
+ * Returns the ID of the <i>TimeTriggerUnit</i>. The ID is used for transmission purposes and should not be
136
+ * used inside client code.
137
+ *
138
+ * @return int the ID of the <i>TimeTriggerUnit</i>.
139
+ */
140
+ public function getId()
141
+ {
142
+ return $this->id;
143
+ }
144
+
145
+
146
+ /**
147
+ * Returns the minimum value for this <i>TimeTriggerUnit</i> inclusively.
148
+ *
149
+ * @return int the minimum value.
150
+ */
151
+ public function getMinValue()
152
+ {
153
+ return $this->minValue;
154
+ }
155
+
156
+
157
+ /**
158
+ * Returns the maximum value for this <i>TimeTriggerUnit</i> inclusively.
159
+ *
160
+ * @return int the maximum value.
161
+ */
162
+ public function getMaxValue()
163
+ {
164
+ return $this->maxValue;
165
+ }
166
+
167
+
168
+ /**
169
+ * Returns the <i>TimeTriggerUnit</i> corresponding to the given ID. If the ID is unknown, the UNKNOWN unit
170
+ * will be used. The ID is used for transmission purposes and should not be used inside client code.
171
+ *
172
+ * @param int $iId the ID of the <i>TimeTriggerUniticode> to retrieve.
173
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the <i>TimeTriggerUnit</i> corresponding to the
174
+ * given ID.
175
+ */
176
+ public static function byId( $iId )
177
+ {
178
+ foreach( self::values() as $unit )
179
+ {
180
+ if( $unit->getId() == $iId )
181
+ {
182
+ return $unit;
183
+ }
184
+ }
185
+
186
+ return self::UNKNOWN();
187
+ }
188
+
189
+ /**
190
+ * Returns an array containing all available <i>TimeTriggerUnit</i>s including UNKNOWN.
191
+ *
192
+ * @return array an array containing all available <i>TimeTriggerUnit</i>s including UNKNOWN.
193
+ */
194
+ public static function values()
195
+ {
196
+ return array(self::DAY(), self::MONTH(), self::YEAR(), self::WEEK(), self::HOUR(), self::UNKNOWN());
197
+ }
198
+ }
199
+
lib/Inx/Api/TriggerMailing/Descriptor/TriggerDescriptor.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * An <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor</i> describes the trigger of an
4
+ * <i>Inx_Api_TriggerMailing_TriggerMailing</i>. The trigger defines when a <i>TriggerMailing</i> will be sent and
5
+ * which recipients will receive it. It therefore is the most important part of a <i>TriggerMailing</i>, controlling
6
+ * the whole dispatch process.
7
+ * <p>
8
+ * A <i>TriggerDescriptor</i> consists of a number of settings - some of which are optional depending on the
9
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerType</i>. The following settings are supported:
10
+ * <ul>
11
+ * <li><b>The <i>TriggerType</i>:</b> Defines what kind of trigger will be used (strictly mandatory).
12
+ * <li><b>The start date</b>: Defines the date at which the trigger mailing will be dispatched first (only optional for
13
+ * action triggers).
14
+ * <li><b>The end date</b>: Defines the date at which the trigger mailing will be dispatched last (generally optional).
15
+ * <li><b>The sending time</b>: Defines at which time the trigger mailing will be sent during each dispatch cycle (only
16
+ * optional for action triggers).
17
+ * <li><b>The attribute ID</b>: Defines the attribute used to determine the relevant recipients (mandatory for all
18
+ * attribute driven triggers).
19
+ * <li><b>The offset</b>: Defines the offset of the attribute. For example, how many days after a specific date the
20
+ * trigger mailing shall be dispatched to a recipient (generally optional).
21
+ * <li><b>The column modificator</b>: Defines how long after or before a specific date the trigger shall be fired (only
22
+ * mandatory for anniversary triggers).
23
+ * <li><b>An array of <i>SetValueCommand</i></b>s: Can be used to set recipient attribute values along with the
24
+ * dispatch of the trigger mailing (generally optional).
25
+ * <li><b>The <i>TriggerInterval</i></b>: Defines when the trigger mailing will be dispatched (only relevant for
26
+ * interval triggers).
27
+ * </ul>
28
+ * <p>
29
+ * It's rarely advisable to create a <i>TriggerDescriptor</i> directly as the state space is complex and can be
30
+ * confusing. Generally, it's reasonable to use an <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder</i> for
31
+ * this task which will guide you through the process of creating a <i>TriggerDescriptor</i> and complain about any missing
32
+ * settings and broken invariants.
33
+ * <p>
34
+ * For an example on how to create a <i>TriggerDescriptor</i> using a builder, see the
35
+ * <i>Inx_Api_TriggerMailing_TriggerMailingManager</i> documentation.
36
+ *
37
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getTriggerDescriptor()
38
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder
39
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager
40
+ * @since API 1.10.0
41
+ * @author chge, 16.07.2012
42
+ */
43
+ interface Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor
44
+ {
45
+ /**
46
+ * Returns the type of the trigger described by this <i>TriggerDescriptor</i>. This setting is strictly
47
+ * mandatory.
48
+ *
49
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the type of the trigger.
50
+ */
51
+ public function getType();
52
+
53
+
54
+ /**
55
+ * Returns the date when the trigger described by this <i>TriggerDescriptor</i> will be fired for the first
56
+ * time. This setting is mandatory for all time triggers. That is, it's mandatory for all but action triggers.
57
+ *
58
+ * @return string the date when the trigger will be fired for the first time. The date is formatted as
59
+ * ISO-8601 datetime string.
60
+ */
61
+ public function getStartDate();
62
+
63
+
64
+ /**
65
+ * Returns the time when the trigger described by this <i>TriggerDescriptor</i> will be fired during each
66
+ * dispatch cycle. This setting is mandatory for all time triggers. That is, it's mandatory for all but action
67
+ * triggers.
68
+ *
69
+ * @return string the time when the trigger will be fired during each dispatch cylce. The time is formatted as
70
+ * ISO-8601 datetime string.
71
+ */
72
+ public function getSendingTime();
73
+
74
+
75
+ /**
76
+ * Returns the date when the trigger described by this <i>TriggerDescriptor</i> will be fired for the last
77
+ * time. This setting is generally optional and only relevant for time trigger mailings.
78
+ *
79
+ * @return string the date when the trigger will be fired for the last time. The date is formatted as
80
+ * ISO-8601 datetime string.
81
+ */
82
+ public function getEndDate();
83
+
84
+
85
+ /**
86
+ * Returns an array of <i>Inx_Api_Action_SetValueCommand</i>s which will be executed when dispatching the trigger
87
+ * mailings. Using this feature, it is possible to set the values of recipient attributes along with the dispatching
88
+ * of a trigger mailing to that same recipient. This setting is generally optional and only relevant for time
89
+ * trigger mailings.
90
+ *
91
+ * @return array an array of <i>Inx_Api_Action_SetValueCommand</i>s used to set recipient attributes during dispatch.
92
+ */
93
+ public function getAttributeValueSetters();
94
+
95
+
96
+ /**
97
+ * Returns the ID of the recipient attribute used as basis of the trigger described by this <i>TriggerDescriptor</i>.
98
+ * This setting is only mandatory and relevant for all attribute driven triggers.
99
+ *
100
+ * @return int the ID of the recipient attribute used as basis of the trigger.
101
+ */
102
+ public function getAttributeId();
103
+
104
+
105
+ /**
106
+ * Returns the <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset</i> used to alter the dispatch date specified
107
+ * by the attribute. For example: Normally, birthday trigger mailings are sent on the birthday of the recipient.
108
+ * Using a <i>TimeTriggerOffset</i> you can send your congratulations before or after that date. This setting is
109
+ * generally optional and only relevant for time trigger mailings.
110
+ *
111
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset the <i>TimeTriggerOffset</i> used to alter the
112
+ * dispatch date specified by the attribute.
113
+ */
114
+ public function getOffset();
115
+
116
+
117
+ /**
118
+ * Returns the <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset</i> used to define the time span between the
119
+ * dispatch date and the date specified by the attribute. For example: An anniversary trigger mailing can be sent
120
+ * out ten years after the date specified by the attribute. This setting is only mandatory and relevant for
121
+ * anniversary triggers.
122
+ *
123
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset the <i>TimeTriggerOffset</i> used to define the time
124
+ * span between the dispatch date and the date specified by the attribute.
125
+ */
126
+ public function getColumnModificator();
127
+
128
+
129
+ /**
130
+ * Returns the <i>Inx_Api_TriggerMailing_Descriptor_TriggerInterval</i> used to define the dispatch intervals of an
131
+ * interval trigger mailing. This setting is only mandatory and relevant for interval triggers.
132
+ *
133
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerInterval the <i>TriggerInterval</i> used to define the dispatch
134
+ * intervals of an interval trigger mailing.
135
+ */
136
+ public function getInterval();
137
+ }
lib/Inx/Api/TriggerMailing/Descriptor/TriggerDescriptorBuilder.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder</i>s are used to easily create
9
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor</i>s. They provide some guidance and will complain about
10
+ * any missing settings and broken invariants. The different builders are created using the
11
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory</i>.
12
+ *
13
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory
14
+ * @since API 1.10.0
15
+ * @author chge, 16.07.2012
16
+ */
17
+ interface Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder
18
+ {
19
+ /**
20
+ * Creates the <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor</i> according to the settings. Before creating
21
+ * the descriptor, the <i>validate()</i> method will be called to check the settings for correctness.
22
+ *
23
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor the <i>TriggerDescriptor</i> as defined by the settings.
24
+ */
25
+ public function build();
26
+
27
+
28
+ /**
29
+ * Validates the settings for correctness. Any missing settings and broken invariants will trigger a certain kind of
30
+ * <i>Exception</i> like:
31
+ * <ul>
32
+ * <li><i>Inx_Api_NullPointerException</i>: A mandatory setting was configured with <i>null</i>.
33
+ * <li><i>Inx_Api_IllegalArgumentException</i>: A setting was configured with an illegal value.
34
+ * <li><i>Inx_Api_IllegalStateException</i>: An invariant was broken or a mandatory setting is missing.
35
+ * </ul>
36
+ *
37
+ * @throws Exception if the settings are incorrect.
38
+ */
39
+ public function validate();
40
+ }
41
+
lib/Inx/Api/TriggerMailing/Descriptor/TriggerDescriptorBuilderFactory.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory</i> is used to create the builders for the
9
+ * various trigger types. The trigger types differ in their mandatory and optional settings, including the allowed state
10
+ * space. The builders are designed to guide you through the process of creating trigger descriptors as easy as possible.
11
+ *
12
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder
13
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor
14
+ * @since API 1.10.0
15
+ * @author chge, 17.07.2012
16
+ */
17
+ interface Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory
18
+ {
19
+ /**
20
+ * Creates a builder which can be used to create action trigger descriptors.
21
+ *
22
+ * @return Inx_Api_TriggerMailing_Descriptor_ActionTriggerDescriptorBuilder a builder which can be used to create
23
+ * action trigger descriptors.
24
+ */
25
+ public function createActionTriggerDescriptorBuilder();
26
+
27
+
28
+ /**
29
+ * Creates a builder which can be used to create interval trigger descriptors.
30
+ *
31
+ * @return Inx_Api_TriggerMailing_Descriptor_IntervalTriggerDescriptorBuilder a builder which can be used to create
32
+ * interval trigger descriptors.
33
+ */
34
+ public function createIntervalTriggerDescriptorBuilder();
35
+
36
+
37
+ /**
38
+ * Creates a builder which can be used to create birthday trigger descriptors.
39
+ *
40
+ * @return Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder a builder which can be used to create
41
+ * birthday trigger descriptors.
42
+ */
43
+ public function createBirthdayTriggerDescriptorBuilder();
44
+
45
+
46
+ /**
47
+ * Creates a builder which can be used to create anniversary trigger descriptors.
48
+ *
49
+ * @return Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder a builder which can be used to create
50
+ * anniversary trigger descriptors.
51
+ */
52
+ public function createAnniversaryTriggerDescriptorBuilder();
53
+
54
+
55
+ /**
56
+ * Creates a builder which can be used to create reminder trigger descriptors.
57
+ *
58
+ * @return Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder a builder which can be used to create
59
+ * reminder trigger descriptors.
60
+ */
61
+ public function createReminderTriggerDescriptorBuilder();
62
+
63
+
64
+ /**
65
+ * Creates a builder which can be used to create follow-up trigger descriptors.
66
+ *
67
+ * @return Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder a builder which can be used to create
68
+ * follow-up trigger descriptors.
69
+ */
70
+ public function createFollowUpTriggerDescriptorBuilder();
71
+ }
lib/Inx/Api/TriggerMailing/Descriptor/TriggerInterval.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TriggerInterval</i> is the integral part of the interval trigger. It
9
+ * describes when the trigger will be fired using a combination of the following settings:
10
+ * <ul>
11
+ * <li><b>The interval unit</b>: Defines the unit of the interval (e.g. day, week, month,...).
12
+ * <li><b>The interval count</b>: Defines the how many times the trigger shall be fired (e.g. every X months).
13
+ * <li><b>The dispatch intervals</b>: Defines the dispatch intervals (e.g. daily, hourly, day in month,...).
14
+ * <li><b>The day</b>: Defines the day on which the trigger shall be fired. Only used in combination with monthly
15
+ * dispatch intervals.
16
+ * </ul>
17
+ * <p>
18
+ * It's rarely advisable to create a <i>TriggerInterval</i> directly as the state space is complex and can be
19
+ * confusing. Generally, it's reasonable to use an <i>Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder</i>
20
+ * for this task which will guide you through the process of creating a <i>TriggerInterval</i> and complain about
21
+ * any missing settings and broken invariants.
22
+ * <p>
23
+ * For an example on how to create a <i>TriggerInterval</i> using a builder, see the
24
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder</i> documentation.
25
+ *
26
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor::getInterval()
27
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder
28
+ * @since API 1.10.0
29
+ * @author chge, 16.07.2012
30
+ */
31
+ interface Inx_Api_TriggerMailing_Descriptor_TriggerInterval
32
+ {
33
+ /**
34
+ * Returns the interval unit.
35
+ *
36
+ * @return Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit the interval unit.
37
+ */
38
+ public function getIntervalUnit();
39
+
40
+
41
+ /**
42
+ * Returns the interval count. Do not confuse this setting with the day setting as they are used for different
43
+ * purposes. For example, to fire the trigger every two months on the first day of the month, you need the following
44
+ * settings:
45
+ * <ul>
46
+ * <li><b>Unit</b>: Month
47
+ * <li><b>Count</b>: 2
48
+ * <li><b>Dispatch intervals</b>: [SPECIFIC_DAY_OF_MONTH]
49
+ * <li><b>Day</b>: 1
50
+ * </ul>
51
+ *
52
+ * @return int the interval count.
53
+ */
54
+ public function getIntervalCount();
55
+
56
+
57
+ /**
58
+ * Returns the <i>set</i> (implemented as array) of <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval</i>s
59
+ * which determines the dispatch intervals. Which dispatch intervals are legal depends on the type of trigger interval you
60
+ * use. The builders clearly point out which combinations are legal.
61
+ *
62
+ * @return array the <i>set</i> of <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval</i>s which determines
63
+ * the dispatch intervals.
64
+ */
65
+ public function getDispatchIntervals();
66
+
67
+
68
+ /**
69
+ * Returns the day of the dispatch interval. Do not confuse this setting with the interval count setting as they are
70
+ * used for different purposes. For example, to fire the trigger every two months on the first day of the month, you
71
+ * need the following settings:
72
+ * <ul>
73
+ * <li><b>Unit</b>: Month
74
+ * <li><b>Count</b>: 2
75
+ * <li><b>Dispatch intervals</b>: [SPECIFIC_DAY_OF_MONTH]
76
+ * <li><b>Day</b>: 1
77
+ * </ul>
78
+ *
79
+ * @return int the day of the dispatch interval.
80
+ */
81
+ public function getDayInterval();
82
+ }
83
+
lib/Inx/Api/TriggerMailing/Descriptor/TriggerIntervalBuilder.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder</i>s are used to easily create
9
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerInterval</i>s. They provide some guidance and will complain about any missing
10
+ * settings and broken invariants. The different builders are created using the
11
+ * </i>Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilderFactory</i>.
12
+ *
13
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilderFactory
14
+ * @since API 1.10.0
15
+ * @author chge, 17.07.2012
16
+ */
17
+ interface Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder
18
+ {
19
+ /**
20
+ * Creates the <i>Inx_Api_TriggerMailing_Descriptor_TriggerInterval</i> according to the settings. Any missing
21
+ * settings and broken invariants will trigger a certain kind of <i>Exception</i> like:
22
+ * <ul>
23
+ * <li><i>Inx_Api_NullPointerException</i>: A mandatory setting was configured with <i>null</i>.
24
+ * <li><i>Inx_Api_IllegalArgumentException</i>: A setting was configured with an illegal value.
25
+ * <li><i>Inx_Api_IllegalStateException</i>: An invariant was broken or a mandatory setting is missing.
26
+ * </ul>
27
+ *
28
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerInterval the icode>TriggerInterval</i> as defined by
29
+ * the settings.
30
+ * @throws Exception if the settings are incorrect.
31
+ */
32
+ public function build();
33
+
34
+
35
+ /**
36
+ * Sets the interval count. The interval count is used to specify how many times the trigger will be fired. For
37
+ * example, when using a daily interval, the trigger is fired every X days where X is the interval count. This
38
+ * setting is mandatory for all builders.
39
+ * <p>
40
+ * The legal values for the interval count vary between the different interval types. They are defined by
41
+ * <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::getMinValue()</i> and
42
+ * <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::getMaxValue()</i>.
43
+ *
44
+ * @param int $iCount the interval count.
45
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder the builder.
46
+ * @throws Inx_Api_IllegalArgumentException if the interval count is out of legal bounds.
47
+ */
48
+ public function intervalCount( $iCount );
49
+ }
lib/Inx/Api/TriggerMailing/Descriptor/TriggerIntervalBuilderFactory.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilderFactory</i> is used to create the builders for the
9
+ * various interval types. The interval types differ in their mandatory settings, including the allowed state space.
10
+ * The builders are designed to guide you through the process of creating trigger intervals as easy as possible.
11
+ *
12
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder
13
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerInterval
14
+ * @since API 1.10.0
15
+ * @author chge, 17.07.2012
16
+ */
17
+ interface Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilderFactory
18
+ {
19
+ /**
20
+ * Creates a builder which can be used to create daily trigger intervals.
21
+ *
22
+ * @return Inx_Api_TriggerMailing_Descriptor_DailyTriggerIntervalBuilder a builder which can be used to create
23
+ * daily trigger intervals.
24
+ */
25
+ public function getDailyIntervalBuilder();
26
+
27
+
28
+ /**
29
+ * Creates a builder which can be used to create weekly trigger intervals.
30
+ *
31
+ * @return Inx_Api_TriggerMailing_Descriptor_WeeklyTriggerIntervalBuilder a builder which can be used to create
32
+ * weekly trigger intervals.
33
+ */
34
+ public function getWeeklyIntervalBuilder();
35
+
36
+
37
+ /**
38
+ * Creates a builder which can be used to create monthly trigger intervals.
39
+ *
40
+ * @return Inx_Api_TriggerMailing_Descriptor_MonthlyTriggerIntervalBuilder a builder which can be used to create
41
+ * monthly trigger intervals.
42
+ */
43
+ public function getMonthlyIntervalBuilder();
44
+
45
+
46
+ /**
47
+ * Creates a builder which can be used to create hourly trigger intervals.
48
+ *
49
+ * @return Inx_Api_TriggerMailing_Descriptor_HourlyTriggerIntervalBuilder a builder which can be used to
50
+ * create hourly trigger intervals.
51
+ */
52
+ public function getHourlyIntervalBuilder();
53
+ }
lib/Inx/Api/TriggerMailing/Descriptor/TriggerType.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_TriggerType</i> enumeration defines the different types of triggers. The
9
+ * trigger types can be divided into two categories:
10
+ * <p>
11
+ * <ol>
12
+ * <li><b>Time triggers</b>: Used for time controlled dispatch of trigger mailings.
13
+ * <li><b>Action triggers</b>: Used for action controlled dispatch of trigger mailings.
14
+ * </ol>
15
+ * Time trigger mailings are sent out on a regular basis. The following time triggers are available:
16
+ * <p>
17
+ * <ul>
18
+ * <li><b>Birthday</b>: A mailing of this type is sent to recipients on the annual recurrence of a specific date. A
19
+ * datetime attribute of the recipient acts as a baseline and the mailing is sent every year after this baseline. An
20
+ * offset can be specified to send the mailing some time before or after the annual recurrence. The condition is checked
21
+ * once a day. The birthday trigger is an attribute driven time trigger.
22
+ * <li><b>Anniversary</b>: A mailing of this type is sent to recipients on the recurrence of a specific date. A datetime
23
+ * attribute of the recipient acts as baseline and the mailing is sent after a user defined period of time (years,
24
+ * months or days) after this baseline. An offset can be specified to send the mailing some time before or after the
25
+ * recurrence. The condition is checked once a day. The anniversary trigger is an attribute driven time trigger.
26
+ * <li><b>Reminder</b>: A mailing of this type is sent to recipients on a specific date. A datetime attribute of the
27
+ * recipient defines that date. An offset can be specified to send the mailing some time before the date. The condition
28
+ * is checked once a day. The reminder trigger is an attribute driven time trigger.
29
+ * <li><b>Follow up</b>: A mailing of this type is sent to recipients on a specific date. A datetime attribute of the
30
+ * recipient defines that date. An offset can be specified to send the mailing some time after the date. The condition
31
+ * is checked once a day. The follow up trigger is an attribute driven time trigger.
32
+ * <li><b>Interval</b>: A mailing of this type is sent to all recipients of the associated list at a freely definable
33
+ * interval (i.e. hourly, daily, weekly,...). The interval is described by an
34
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerInterval</i> object. The interval trigger is a time trigger which is not
35
+ * related to a specific attribute.
36
+ * </ul>
37
+ * <p>
38
+ * Action trigger mailings, on the other hand, are only sent if the associated action is executed. Be aware that the
39
+ * action cannot be defined by the trigger descriptor. Instead, the action contains a command (an
40
+ * <i>Inx_Api_Action_SendMailCommand</i>) which will send the mailing.
41
+ * <p>
42
+ * A note for programmers who are not familiar with the concept of enumerations: Enumerations or enumerated types are basically
43
+ * a fixed set of named values. They are usually used to define a couple of legitimate values in a specific context and serve a
44
+ * purpose similar to integer constants.
45
+ * The advantage of enumerations is, that you cannot specify any "weird" values because every value has to be an instance of
46
+ * the enumerated type. It is also possible to associate data or even behaviour (methods) with the values.
47
+ * PHP does not support such a language feature like Java and C# do. In most languages the named values are a sort of constant
48
+ * whose value is an instance of the enumerated type. In PHP a constant cannot contain a reference type. Therefore, we
49
+ * implemented enumerations as classes with private constructor and methods which return the named values.
50
+ * Be aware that the objects returned by the static methods are always the same object. That way it is possible to use the
51
+ * identity operator (===) on these objects and use them comfortably in switch statements.
52
+ *
53
+ * @since API 1.10.0
54
+ * @author chge, 16.07.2012
55
+ */
56
+ final class Inx_Api_TriggerMailing_Descriptor_TriggerType
57
+ {
58
+ private static $ACTION_MAILING = null;
59
+
60
+ private static $TIME_TRIGGER_INTERVAL_MAILING = null;
61
+
62
+ private static $TIME_TRIGGER_BIRTHDAY_MAILING = null;
63
+
64
+ private static $TIME_TRIGGER_ANNIVERSARY_MAILING = null;
65
+
66
+ private static $TIME_TRIGGER_REMINDER_MAILING = null;
67
+
68
+ private static $TIME_TRIGGER_FOLLOW_UP_MAILING = null;
69
+
70
+ private static $UNKNOWN = null;
71
+
72
+ /**
73
+ * Type constant for action mailings. An action mailing is sent by the associated action using an
74
+ * <i>Inx_Api_Action_SendMailCommand</i>.
75
+ *
76
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the action <i>TriggerType</i>.
77
+ * @see Inx_Api_Action_SendMailCommand
78
+ */
79
+ public static final function ACTION_MAILING()
80
+ {
81
+ if(null === self::$ACTION_MAILING)
82
+ self::$ACTION_MAILING = new Inx_Api_TriggerMailing_Descriptor_TriggerType( 1 );
83
+
84
+ return self::$ACTION_MAILING;
85
+ }
86
+
87
+ /**
88
+ * Type constant for interval trigger mailings. An interval trigger mailing is sent to all recipients in the
89
+ * associated list at a freely definable interval (e.g. hourly, daily, weekly,...). The interval is described by a
90
+ * {@link TriggerInterval}. The interval trigger is a time trigger but no attribute driven trigger.
91
+ *
92
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the interval <i>TriggerType</i>.
93
+ * @see com.inxmail.xpro.api.triggermailing.descriptor.TriggerInterval
94
+ */
95
+ public static final function TIME_TRIGGER_INTERVAL_MAILING()
96
+ {
97
+ if(null === self::$TIME_TRIGGER_INTERVAL_MAILING)
98
+ self::$TIME_TRIGGER_INTERVAL_MAILING = new Inx_Api_TriggerMailing_Descriptor_TriggerType( 2 );
99
+
100
+ return self::$TIME_TRIGGER_INTERVAL_MAILING;
101
+ }
102
+
103
+ /**
104
+ * Type constant for birthday trigger mailings. A birthday trigger mailing is sent every day to recipients for which
105
+ * the day of the attribute matches the current day. The birthday trigger is an attribute driven time trigger.
106
+ *
107
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the birthday <i>TriggerType</i>.
108
+ */
109
+ public static final function TIME_TRIGGER_BIRTHDAY_MAILING()
110
+ {
111
+ if(null === self::$TIME_TRIGGER_BIRTHDAY_MAILING)
112
+ self::$TIME_TRIGGER_BIRTHDAY_MAILING = new Inx_Api_TriggerMailing_Descriptor_TriggerType( 3 );
113
+
114
+ return self::$TIME_TRIGGER_BIRTHDAY_MAILING;
115
+ }
116
+
117
+ /**
118
+ * Type constant for anniversary trigger mailings. An anniversary trigger mailing is sent every day to recipients
119
+ * for which the day of the attribute matches the current day and was a fixed number of years, months or days ago.
120
+ * The anniversary trigger is an attribute driven time trigger.
121
+ *
122
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the anniversary <i>TriggerType</i>.
123
+ */
124
+ public static final function TIME_TRIGGER_ANNIVERSARY_MAILING()
125
+ {
126
+ if(null === self::$TIME_TRIGGER_ANNIVERSARY_MAILING)
127
+ self::$TIME_TRIGGER_ANNIVERSARY_MAILING = new Inx_Api_TriggerMailing_Descriptor_TriggerType( 4 );
128
+
129
+ return self::$TIME_TRIGGER_ANNIVERSARY_MAILING;
130
+ }
131
+
132
+ /**
133
+ * Type constant for reminder trigger mailings. A reminder trigger mailing is sent every day to recipients for which
134
+ * the date in the attribute matches the current date (only positive offset). The reminder trigger is an attribute
135
+ * driven time trigger.
136
+ *
137
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the reminder <i>TriggerType</i>.
138
+ */
139
+ public static final function TIME_TRIGGER_REMINDER_MAILING()
140
+ {
141
+ if(null === self::$TIME_TRIGGER_REMINDER_MAILING)
142
+ self::$TIME_TRIGGER_REMINDER_MAILING = new Inx_Api_TriggerMailing_Descriptor_TriggerType( 5 );
143
+
144
+ return self::$TIME_TRIGGER_REMINDER_MAILING;
145
+ }
146
+
147
+ /**
148
+ * Type constant for follow up trigger mailing. A follow up trigger mailing is sent every day to recipients for
149
+ * which the date in the attribute matches the current date (only negative offset). the follow up trigger is an
150
+ * attribute driven time trigger.
151
+ *
152
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the follow-up <i>TriggerType</i>.
153
+ */
154
+ public static final function TIME_TRIGGER_FOLLOW_UP_MAILING()
155
+ {
156
+ if(null === self::$TIME_TRIGGER_FOLLOW_UP_MAILING)
157
+ self::$TIME_TRIGGER_FOLLOW_UP_MAILING = new Inx_Api_TriggerMailing_Descriptor_TriggerType( 6 );;
158
+
159
+ return self::$TIME_TRIGGER_FOLLOW_UP_MAILING;
160
+ }
161
+
162
+ /**
163
+ * Type constant for an unknown trigger type. Indicates a version mismatch between API and server.
164
+ *
165
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the unknown <i>TriggerType</i>.
166
+ */
167
+ public static final function UNKNOWN()
168
+ {
169
+ if(null === self::$UNKNOWN)
170
+ self::$UNKNOWN = new Inx_Api_TriggerMailing_Descriptor_TriggerType( 7 );
171
+
172
+ return self::$UNKNOWN;
173
+ }
174
+
175
+ private $id;
176
+
177
+
178
+ private function __construct( $iId )
179
+ {
180
+ $this->id = $iId;
181
+ }
182
+
183
+
184
+ /**
185
+ * Returns the ID of the <i>TriggerType</i>. The ID is used for transmission purposes and should not be used
186
+ * inside client code.
187
+ *
188
+ * @return int the ID of the <i>TriggerType</i>.
189
+ */
190
+ public function getTypeId()
191
+ {
192
+ return $this->id;
193
+ }
194
+
195
+
196
+ /**
197
+ * Returns a <i>bool</i> indicating whether the <i>TriggerType</i> is a time trigger type.
198
+ *
199
+ * @return <i>true</i> if the <i>TriggerType</i> is a time trigger type, <i>false</i> otherwise.
200
+ */
201
+ public function isTimeTriggerType()
202
+ {
203
+ return $this === self::TIME_TRIGGER_ANNIVERSARY_MAILING() || $this === self::TIME_TRIGGER_BIRTHDAY_MAILING()
204
+ || $this === self::TIME_TRIGGER_FOLLOW_UP_MAILING() || $this === self::TIME_TRIGGER_INTERVAL_MAILING()
205
+ || $this === self::TIME_TRIGGER_REMINDER_MAILING();
206
+ }
207
+
208
+
209
+ /**
210
+ * Returns a <i>bool</i> indicating whether the <i>TriggerType</i> is an attribute driven trigger type.
211
+ *
212
+ * @return <i>true</i> if the <i>TriggerType</i> is an attribute driven trigger type, icode>false</i>
213
+ * otherwise.
214
+ */
215
+ public function isAttributeTriggerType()
216
+ {
217
+ return $this === self::TIME_TRIGGER_ANNIVERSARY_MAILING() || $this === self::TIME_TRIGGER_BIRTHDAY_MAILING()
218
+ || $this === self::TIME_TRIGGER_FOLLOW_UP_MAILING() || $this === self::TIME_TRIGGER_REMINDER_MAILING();
219
+ }
220
+
221
+
222
+ /**
223
+ * Returns the <i>TriggerType</i> corresponding to the given ID. If the ID is unknown, the UNKNOWN type will
224
+ * be used. The ID is used for transmission purposes and should not be used inside client code.
225
+ *
226
+ * @param int $iId the ID of the <i>TriggerType</i> to retrieve.
227
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the <i>TriggerType</i> corresponding to the given ID.
228
+ */
229
+ public static function byTypeId( $iId )
230
+ {
231
+ foreach( self::values() as $type )
232
+ {
233
+ if( $type->getTypeId() == $iId )
234
+ {
235
+ return $type;
236
+ }
237
+ }
238
+
239
+ return self::UNKNOWN();
240
+ }
241
+
242
+ /**
243
+ * Returns an array containing all available <i>TriggerType</i>s including UNKNOWN.
244
+ *
245
+ * @return array an array containing all available <i>TriggerType</i>s including UNKNOWN.
246
+ */
247
+ public static function values()
248
+ {
249
+ return array(self::ACTION_MAILING(), self::TIME_TRIGGER_INTERVAL_MAILING(), self::TIME_TRIGGER_BIRTHDAY_MAILING(),
250
+ self::TIME_TRIGGER_ANNIVERSARY_MAILING(), self::TIME_TRIGGER_REMINDER_MAILING(),
251
+ self::TIME_TRIGGER_FOLLOW_UP_MAILING(), self::UNKNOWN());
252
+ }
253
+ }
lib/Inx/Api/TriggerMailing/Descriptor/WeeklyTriggerIntervalBuilder.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing_Descriptor
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_Descriptor_WeeklyTriggerIntervalBuilder</i> is used to create a weekly trigger interval.
9
+ * The following settings are mandatory:
10
+ * <p/>
11
+ * <ul>
12
+ * <li><b>The interval count</b>: Specifies how many times the trigger will be fired. The trigger will be fired every X
13
+ * weeks where X is the interval count.</li>
14
+ * <li><b>The dispatch intervals</b>: Specifies the days on which the trigger will be fired. The following options are
15
+ * allowed:
16
+ * <ul>
17
+ * <li><i>MONDAY</i>: The trigger will be fired on Mondays.</li>
18
+ * <li><i>TUESDAY</i>: The trigger will be fired on Tuesdays.</li>
19
+ * <li><i>WEDNESDAY</i>: The trigger will be fired on Wednesday.</li>
20
+ * <li><i>THURSDAY</i>: The trigger will be fired on Thursdays.</li>
21
+ * <li><i>FRIDAY</i>: The trigger will be fired on Fridays.</li>
22
+ * <li><i>SATURDAY</i>: The trigger will be fired on Saturdays.</li>
23
+ * <li><i>SUNDAY</i>: The trigger will be fired on Sundays.</li>
24
+ * </ul>
25
+ * </li>
26
+ * </ul>
27
+ * There are no optional settings.
28
+ * <p/>
29
+ * The following snippet shows how to build a weekly trigger interval which will fire the trigger every two weeks on
30
+ * Mondays and Fridays:
31
+ *
32
+ * <pre>
33
+ * $factory = $session->getTriggerMailingManager()->getTriggerIntervalBuilderFactory();
34
+ * $interval = $factory->getWeeklyIntervalBuilder()->intervalCount( 2 )->dispatchIntervals(
35
+ * array( Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval::MONDAY(),
36
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval::FRIDAY() ) )->build();
37
+ * </pre>
38
+ *
39
+ * @see Inx_Api_TriggerMailing_Descriptor_TriggerInterval
40
+ * @since API 1.10.0
41
+ * @author chge, 17.07.2012
42
+ */
43
+ interface Inx_Api_TriggerMailing_Descriptor_WeeklyTriggerIntervalBuilder
44
+ extends Inx_Api_TriggerMailing_Descriptor_TriggerIntervalBuilder
45
+ {
46
+ /**
47
+ * Sets the <i>set</i> (implemented as array) of <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval</i>s
48
+ * which determines the dispatch intervals. This setting is mandatory. The following options are legal:
49
+ * <p/>
50
+ * <ul>
51
+ * <li><i>MONDAY</i>: The trigger will be fired on Mondays.
52
+ * <li><i>TUESDAY</i>: The trigger will be fired on Tuesdays.
53
+ * <li><i>WEDNESDAY</i>: The trigger will be fired on Wednesday.
54
+ * <li><i>THURSDAY</i>: The trigger will be fired on Thursdays.
55
+ * <li><i>FRIDAY</i>: The trigger will be fired on Fridays.
56
+ * <li><i>SATURDAY</i>: The trigger will be fired on Saturdays.
57
+ * <li><i>SUNDAY</i>: The trigger will be fired on Sundays.
58
+ * </ul>
59
+ * <p/>
60
+ * The dispatch interval set can be easily created using the array function.
61
+ *
62
+ * @param array $dispatchIntervals the <i>set</i> of <i>Inx_Api_TriggerMailing_Descriptor_TimeTriggerDispatchInterval</i>s
63
+ * which determines the dispatch intervals.
64
+ * @return Inx_Api_TriggerMailing_Descriptor_WeeklyTriggerIntervalBuilder the builder.
65
+ * @throws Inx_Api_IllegalArgumentException if the dispatch intervals contain a value not listed above.
66
+ */
67
+ public function dispatchIntervals( array $dispatchIntervals );
68
+ }
lib/Inx/Api/TriggerMailing/FilterConcatenationType.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing
5
+ */
6
+
7
+ /**
8
+ * The <i>Inx_Api_TriggerMailing_FilterConcatenationType</i> enumeration defines the different ways in
9
+ * which filters (target groups) can be combined.
10
+ * <p>
11
+ * A note for programmers who are not familiar with the concept of enumerations: Enumerations or enumerated types are basically
12
+ * a fixed set of named values. They are usually used to define a couple of legitimate values in a specific context and serve a
13
+ * purpose similar to integer constants.
14
+ * The advantage of enumerations is, that you cannot specify any "weird" values because every value has to be an instance of
15
+ * the enumerated type. It is also possible to associate data or even behaviour (methods) with the values.
16
+ * PHP does not support such a language feature like Java and C# do. In most languages the named values are a sort of constant
17
+ * whose value is an instance of the enumerated type. In PHP a constant cannot contain a reference type. Therefore, we
18
+ * implemented enumerations as classes with private constructor and methods which return the named values.
19
+ * Be aware that the objects returned by the static methods are always the same object. That way it is possible to use the
20
+ * identity operator (===) on these objects and use them comfortably in switch statements.
21
+ *
22
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilterConcatinationType()
23
+ * @since API 1.10.0
24
+ * @author chge, 16.07.2012
25
+ */
26
+ final class Inx_Api_TriggerMailing_FilterConcatenationType
27
+ {
28
+ private static $FILTER_AND = null;
29
+
30
+ private static $FILTER_OR = null;
31
+
32
+ private static $FILTER_NOT_IN = null;
33
+
34
+ private static $UNKNOWN = null;
35
+
36
+ /**
37
+ * Filter constant for the AND operator. The AND operator requires a recipient to be a member of all filters (target
38
+ * groups) defined by <i>TriggerMailing::getFilderIds()</i>.
39
+ *
40
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilderIds()
41
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilterConcatinationType()
42
+ */
43
+ public static final function FILTER_AND()
44
+ {
45
+ if(null === self::$FILTER_AND)
46
+ self::$FILTER_AND = new Inx_Api_TriggerMailing_FilterConcatenationType( 1 );
47
+
48
+ return self::$FILTER_AND;
49
+ }
50
+
51
+ /**
52
+ * Filter constant for the OR operator. The OR operator requires a recipient to be a member of a least one filter
53
+ * (target group) defined by <i>TriggerMailing::getFilderIds()</i>.
54
+ *
55
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilderIds()
56
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilterConcatinationType()
57
+ */
58
+ public static final function FILTER_OR()
59
+ {
60
+ if(null === self::$FILTER_OR)
61
+ self::$FILTER_OR = new Inx_Api_TriggerMailing_FilterConcatenationType( 2 );
62
+
63
+ return self::$FILTER_OR;
64
+ }
65
+
66
+ /**
67
+ * Filter constant for the NOT IN operator. The NOT IN operator requires a recipient to not be a member of all
68
+ * filters (target groups) defined by <i>TriggerMailing::getFilderIds()</i>.
69
+ *
70
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilderIds()
71
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilterConcatinationType()
72
+ */
73
+ public static final function FILTER_NOT_IN()
74
+ {
75
+ if(null === self::$FILTER_NOT_IN)
76
+ self::$FILTER_NOT_IN = new Inx_Api_TriggerMailing_FilterConcatenationType( 3 );
77
+
78
+ return self::$FILTER_NOT_IN;
79
+ }
80
+
81
+ /**
82
+ * Filter constant for an unknown filter concatenation type. This type indicates a version mismatch between API and
83
+ * server.
84
+ *
85
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilderIds()
86
+ * @see Inx_Api_TriggerMailing_TriggerMailing::getFilterConcatinationType()
87
+ */
88
+ public static final function UNKNOWN()
89
+ {
90
+ if(null === self::$UNKNOWN)
91
+ self::$UNKNOWN = new Inx_Api_TriggerMailing_FilterConcatenationType( -1 );
92
+
93
+ return self::$UNKNOWN;
94
+ }
95
+
96
+ private $id;
97
+
98
+
99
+ private function __construct( $iId )
100
+ {
101
+ $this->id = $iId;
102
+ }
103
+
104
+
105
+ /**
106
+ * Returns the ID of the <i>FilterConcatenationTypeicode>. The ID is used for transmission purposes and should
107
+ * not be used inside client code.
108
+ *
109
+ * @return int the ID of the <i>FilterConcatenationType</i>.
110
+ */
111
+ public function getId()
112
+ {
113
+ return $this->id;
114
+ }
115
+
116
+
117
+ /**
118
+ * Returns the <i>FilterConcatenationType</i> corresponding to the given id. If the id is unknown, the
119
+ * <i>UNKNOWN</i> type will be returned. The ID is used for transmission purposes and should not be used
120
+ * inside client code.
121
+ *
122
+ * @param int $iId the ID of the <i>FilterConcatenationType</i> to retrieve.
123
+ * @return Inx_Api_TriggerMailing_FilterConcatenationType the <i>FilterConcatenationType</i> corresponding
124
+ * to the given ID.
125
+ */
126
+ public static function byId( $iId )
127
+ {
128
+ foreach( self::values() as $type )
129
+ {
130
+ if( $type->getId() == $iId )
131
+ {
132
+ return $type;
133
+ }
134
+ }
135
+
136
+ return self::UNKNOWN();
137
+ }
138
+
139
+ /**
140
+ * Returns an array containing all available <i>FilterConcatenationType</i>s including UNKNOWN.
141
+ *
142
+ * @return array an array containing all available <i>FilterConcatenationType</i>s including UNKNOWN.
143
+ */
144
+ public static function values()
145
+ {
146
+ return array(self::FILTER_AND(), self::FILTER_OR(), self::FILTER_NOT_IN(), self::UNKNOWN());
147
+ }
148
+ }
lib/Inx/Api/TriggerMailing/SendException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_TriggerMailing_SendException</i> is thrown when an error occurs while sending
9
+ * a trigger mailing.
10
+ *
11
+ * @since API 1.10.0
12
+ * @author chge, 16.07.2012
13
+ */
14
+ class Inx_Api_TriggerMailing_SendException extends Exception
15
+ {
16
+ }
lib/Inx/Api/TriggerMailing/StateFilter.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_TriggerMailing_StateFilter</i> is used to retrieve trigger mailings according to their state.
9
+ * The <i>StateFilter</i> combines two different state types:
10
+ * <ul>
11
+ * <li><b>The mailing state:</b> Used to retrieve mailings in one or more states.
12
+ * <li><b>The trigger state:</b> Used to retrieve mailings whose trigger is in a particular state.
13
+ * </ul>
14
+ * Neither type is mandatory to be set. It is possible to create a <i>StateFilter</i> that matches all mailing
15
+ * states and/or all trigger states. Omitting both states will result in an all matching <i>StateFilter</i>. This
16
+ * special filter is used to retrieve all trigger mailings of a specific list, disregarding their state, and can be
17
+ * obtained using the <i>TriggerMailingManager::createAllMatchingStateFilter()</i> method which will return a singleton.
18
+ * <p>
19
+ * For an example on how to use <i>StateFilter</i>s, see the <i>TriggerMailingManager</i> documentation.
20
+ *
21
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::selectByState( Inx_Api_List_ListContext $listContext,
22
+ * Inx_Api_TriggerMailing_StateFilter $stateFilter, Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null,
23
+ * $iOrderType = null, $sFilter = null )
24
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::createStateFilter( array $mailingStateFilter = null,
25
+ Inx_Api_TriggerMailing_TriggerState $triggerStateFilter = null )
26
+ * @see Inx_Api_TriggerMailing_TriggerMailingState
27
+ * @see Inx_Api_TriggerMailing_TriggerState
28
+ * @since API 1.10.0
29
+ * @author chge, 16.07.2012
30
+ */
31
+ interface Inx_Api_TriggerMailing_StateFilter
32
+ {
33
+ /**
34
+ * Returns the <i>Inx_Api_TriggerMailing_TriggerMailingState</i>s this <i>StateFilter</i> matches. May be <i>null</i>,
35
+ * indicating that this <i>StateFilter</i> matches any <i>TriggerMailingState</i>.
36
+ *
37
+ * @return array the <i>TriggerMailingState</i>s this <i>StateFilter</i> matches, or <i>null</i> if it
38
+ * matches any <i>TriggerMailingState</i>.
39
+ */
40
+ public function getMailingStateFilter();
41
+
42
+
43
+ /**
44
+ * Returns the <i>Inx_Api_TriggerMailing_TriggerState</i> this <i>StateFilter</i> matches. May be <i>nullitt>,
45
+ * indicating that this <i>StateFilter</i> matches any <i>TriggerState</i>.
46
+ *
47
+ * @return Inx_Api_TriggerMailing_TriggerState the <i>TriggerState</i> this <i>StateFilter</i> matches, or <i>null</i>
48
+ * if it matches any <i>TriggerState</i>.
49
+ */
50
+ public function getTriggerStateFilter();
51
+
52
+
53
+ /**
54
+ * Returns a <i>bool</i> indicating whether this <i>StateFilter</i> matches any mailing and trigger
55
+ * state. If it does, it is equivalent to the all matching <i>StateFilter</i> provided by
56
+ * <i>Inx_Api_TriggerMailing_TriggerMailingManager::createAllMatchingStateFilter()</i>.
57
+ *
58
+ * @return bool <i>true</i> if this <i>StateFilter</i> matches any state, <i>false</i> otherwise.
59
+ */
60
+ public function matchesAllStates();
61
+
62
+
63
+ /**
64
+ * Returns a <i>bool</i> indicating whether this <i>StateFilter</i> matches any <i>TriggerMailingState</i>.
65
+ *
66
+ * @return bool <i>true</i> if this <i>StateFilter</i> matches any <i>TriggerMailingState</i> state,
67
+ * <i>false</i> otherwise.
68
+ */
69
+ public function matchesAllMailingStates();
70
+
71
+
72
+ /**
73
+ * Returns a <i>bool</i> indicating whether this <i>StateFilter</i> matches any <i>TriggerState</i>.
74
+ *
75
+ * @return bool <i>true</i> if this <i>StateFilter</i> matches any <i>TriggerState</i> state,
76
+ * <i>false</i> otherwise.
77
+ */
78
+ public function matchesAllTriggerStates();
79
+ }
lib/Inx/Api/TriggerMailing/TriggerMailing.php ADDED
@@ -0,0 +1,623 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing
5
+ */
6
+
7
+ /**
8
+ * An <i>Inx_Api_TriggerMailing_TriggerMailing</i> is a special kind of mailing introduced with Inxmail Professional 4.2.
9
+ * The difference between a normal mailing and a trigger mailing is the way they are sent. Normal mailings are sent on
10
+ * demand while trigger mailings are sent when the trigger they are bound to is fired.
11
+ * <p>
12
+ * For example, a birthday trigger mailing is sent each day on which one ore more recipients birthday is. This feature
13
+ * can be combined with dynamic lists and target groups for full control over who receives which mailing.
14
+ * <p>
15
+ * Most trigger mailings are associated with a date or datetime attribute. The following trigger mailing types (see
16
+ * <i>Inx_Api_TriggerMailing_Descriptor_TriggerType</i>) are supported:
17
+ * <ul>
18
+ * <li><i>TIME_TRIGGER_BIRTHDAY_MAILING</i>: A mailing of this type is sent to recipients on the annual recurrence of a
19
+ * specific date. A datetime attribute of the recipient acts as a baseline and the mailing is sent every year after this
20
+ * baseline. An offset can be specified to send the mailing some time before or after the annual recurrence. The
21
+ * condition is checked once a day. The birthday trigger is an attribute driven time trigger.
22
+ * <li><i>TIME_TRIGGER_ANNIVERSARY_MAILING</i>: A mailing of this type is sent to recipients on the recurrence of a
23
+ * specific date. A datetime attribute of the recipient acts as baseline and the mailing is sent after a user defined
24
+ * period of time (years, months or days) after this baseline. An offset can be specified to send the mailing some time
25
+ * before or after the recurrence. The condition is checked once a day. The anniversary trigger is an attribute driven
26
+ * time trigger.
27
+ * <li><i>TIME_TRIGGER_REMINDER_MAILING</i>: A mailing of this type is sent to recipients on a specific date. A datetime
28
+ * attribute of the recipient defines that date. An offset can be specified to send the mailing some time before the date.
29
+ * The condition is checked once a day. The reminder trigger is an attribute driven time trigger.
30
+ * <li><i>TIME_TRIGGER_FOLLOW_UP_MAILING</i>: A mailing of this type is sent to recipients on a specific date. A datetime
31
+ * attribute of the recipient defines that date. An offset can be specified to send the mailing some time after the
32
+ * date. The condition is checked once a day. The follow up trigger is an attribute driven time trigger.
33
+ * <li><i>TIME_TRIGGER_INTERVAL_MAILING</i>: A mailing of this type is sent to all recipients of the associated list at a
34
+ * freely definable interval (i.e. hourly, daily, weekly,...). The interval is described by a {@link TriggerInterval} object.
35
+ * The interval trigger is a time trigger which is not related to a specific attribute.
36
+ * <li><I>ACTION_MAILING ACTION_MAILING</i>: This mailing type is triggered by an action.
37
+ * </ul>
38
+ * <p>
39
+ * A <i>TriggerMailing</i> object can be used to perform various tasks:
40
+ * <ul>
41
+ * <li>Retrieve and update trigger mailing meta information and content
42
+ * <li>Activate or deactivate the sending of the trigger mailing
43
+ * <li>Request the approval of a trigger mailing
44
+ * <li>Approve or revoke the approval for the trigger mailing
45
+ * </ul>
46
+ * <strong>Handling trigger mailing content and approval</strong>
47
+ * <p>
48
+ * For the most part, the content handling and approval process of trigger mailings is identical to that of normal
49
+ * mailings (see <i>Inx_Api_Mailing_Mailing</i>). There is only one difference regarding the approval process: instead of
50
+ * approving a mailing using the deprecated approval methods (especially approve()), a new method - approveImmediateley - was
51
+ * introduced to bypass the approval process. Given the API user has the necessary permissions, it can be used to approve a
52
+ * trigger mailing directly.
53
+ * <p>
54
+ * <strong>Controlling dispatch of trigger mailings</strong>
55
+ * <p>
56
+ * As mentioned earlier, trigger mailings cannot be simply sent to all recipients of the mailing list. Instead, you
57
+ * activate or deactivate the trigger of a trigger mailing, given the mailing is approved. The activation and
58
+ * deactivation of the trigger is as simple as calling the appropriate method:
59
+ * <ul>
60
+ * <li><i>activateSending()</i>: Activates the trigger of the trigger mailing.
61
+ * <li><i>deactivateSending($blStopActiveSending)</i>: Deactivates the trigger of the trigger mailing with the option to stop
62
+ * an active sending.
63
+ * </ul>
64
+ * <p>
65
+ * <strong>Note:</strong> For existing trigger mailings, always call <i>lock()</i> before updating it, and
66
+ * <i>unlock()</i> after committing changes!
67
+ * <p>
68
+ * For an example on how to retrieve and create trigger mailings, see the <i>Inx_Api_TriggerMailing_TriggerMailingManager</i>
69
+ * documentation.
70
+ * <p>
71
+ * For more information on the creation of <i>Inx_Api_Approval_Approver</i>s, see the
72
+ * <i>Inx_Api_Approval_ApproverManager</i> documentation.
73
+ *
74
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager
75
+ * @see Inx_Api_Mailing_Mailing
76
+ * @see Inx_Api_Mailing_ContentHandler
77
+ * @see Inx_Api_Approval_ApproverManager
78
+ * @since API 1.10.0
79
+ * @author chge, 12.07.2012
80
+ */
81
+ interface Inx_Api_TriggerMailing_TriggerMailing extends Inx_Api_BusinessObject
82
+ {
83
+ /**
84
+ * Sends this trigger mailing to the specified test address. The specified recipient will be used to personalize the
85
+ * email content, creating a preview of the trigger mailing.
86
+ *
87
+ * @param string $sTestAddress the email address to which the trigger mailing shall be sent.
88
+ * @param int $iRecipientId the recipient to personalize the email content for.
89
+ * @throws Inx_Api_TriggerMailing_SendException if the trigger mailing could not be sent.
90
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
91
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
92
+ */
93
+ public function sendTestMail( $sTestAddress, $iRecipientId );
94
+
95
+
96
+ /**
97
+ * Sends this trigger mailing to the specified test address. The specified test profile will be used to personalize
98
+ * the email content, creating a preview of the trigger mailing.
99
+ *
100
+ * @param string $sTestAddress the email address to which the trigger mailing shall be sent.
101
+ * @param int $iTestprofileId the test profile to personalize the email content for.
102
+ * @throws Inx_Api_TriggerMailing_SendException if the trigger mailing could not be sent.
103
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
104
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
105
+ */
106
+ public function sendTestMailWithTestprofile( $sTestAddress, $iTestprofileId );
107
+
108
+
109
+ /**
110
+ * Activates the sending of this trigger mailing. More correctly, the trigger of the trigger mailing will be
111
+ * activated, so the mailing is ready to be sent. Once the sending is activated, the trigger mailing can be sent
112
+ * during the next dispatch cycle.
113
+ *
114
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
115
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
116
+ */
117
+ public function activateSending();
118
+
119
+
120
+ /**
121
+ * Deactivates the sending of this trigger mailing. More correctly, the trigger of the trigger mailing will be
122
+ * deactivated, so the mailing can not be sent. The <i>bool</i> parameter is used to define the behaviour upon
123
+ * active sendings.
124
+ *
125
+ * @param bool $blStopActiveSending <i>true</i> if an active sending shall be interrupted, <i>false</i> if the
126
+ * sending may be finished first.
127
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
128
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
129
+ */
130
+ public function deactivateSending( $blStopActiveSending );
131
+
132
+
133
+ /**
134
+ * Approves this trigger mailing immediately, bypassing the normal approval process if necessary. The approval
135
+ * process can only be bypassed if the API user has the according right.
136
+ *
137
+ * @param string $sComment the comment for this approval.
138
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if the this trigger mailing is in an illegal state.
139
+ * @throws Inx_Api_DataException if this trigger mailing cannot be found on the server.
140
+ * @throws Inx_Api_UpdateException if the request cannot be completed.
141
+ */
142
+ public function approveImmediately( $sComment );
143
+
144
+
145
+ /**
146
+ * Approves this trigger mailing for activation.
147
+ * <p>
148
+ * The trigger mailing may only be approved if it is in the following state:
149
+ * <ul>
150
+ * <li>TriggerMailingState::APPROVAL_REQUESTED ( -> APPROVED )
151
+ * </ul>
152
+ * If the trigger mailing is in a state not listed here, a <i>TriggerMailingStateException</i> will be raised.
153
+ *
154
+ * @param int $iApproverId the id of the approver.
155
+ * @param string $sComment the comment of the approver.
156
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
157
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
158
+ * @throws Inx_Api_UpdateException if the request cannot be completed, for example because the approval process
159
+ * is not activated for the list or trigger mailing.
160
+ * @see self::requestIdenticalApproval( $sDeadline, array $approverIds, array $recipientIds, $blIsTestRecipient,
161
+ * $sLocale );
162
+ * @see self::requestEscalationApproval( $sEscalationDate, $sDeadline, array $approverIds, array $recipientIds,
163
+ * $blIsTestRecipient, $sLocale )
164
+ * @see Inx_Api_Approval_ApproverManager
165
+ */
166
+ public function approve( $iApproverId, $sComment );
167
+
168
+
169
+ /**
170
+ * Denies the approval of this trigger mailing.
171
+ * <p>
172
+ * The approval of the trigger mailing may only be denied if it is in the following state:
173
+ * <ul>
174
+ * <li>TriggerMailingState::APPROVAL_REQUESTED ( -> DRAFT )
175
+ * </ul>
176
+ * If the trigger mailing is in another state, a <i>TriggerMailingStateException</i> will be raised.
177
+ *
178
+ * @param int $iApproverId id of the approver
179
+ * @param string $sComment the comment of the approver.
180
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
181
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
182
+ * @throws Inx_Api_UpdateException if the request cannot be completed, for example because the approval process
183
+ * is not activated for the list or trigger mailing.
184
+ * @see self::requestIdenticalApproval( $sDeadline, array $approverIds, array $recipientIds, $blIsTestRecipient,
185
+ * $sLocale );
186
+ * @see self::requestEscalationApproval( $sEscalationDate, $sDeadline, array $approverIds, array $recipientIds,
187
+ * $blIsTestRecipient, $sLocale )
188
+ * @see Inx_Api_Approval_ApproverManager
189
+ */
190
+ public function denyApprove( $iApproverId, $sComment );
191
+
192
+
193
+ /**
194
+ * Requests escalating approval for this trigger mailing. At first sends the request only to the first approver. If
195
+ * the escalation date expires without the first approver having approved the trigger mailing, the request is sent
196
+ * to the second approver. If the deadline date expires without any of the approvers having approved the trigger
197
+ * mailing, the request will be cancelled. In order to approve it, the trigger mailing creator will have to request
198
+ * the approval again.
199
+ * <p>
200
+ * The approval of the trigger mailing may only be requested if it is in the following state:
201
+ * <ul>
202
+ * <li>TriggerMailingState::DRAFT ( -> APPROVAL_REQUESTED )
203
+ * </ul>
204
+ * If the trigger mailing is in another state, a <i>TriggerMailingStateException</i> will be raised.
205
+ *
206
+ * @param string $sEscalationDate the escalation date. If this datetime expires, the second approver will get involved.
207
+ * The date has to be specified as ISO-8601 formatted datetime string.
208
+ * @param string $sDeadline the deadline. If this datetime expires, the request will be cancelled. The date has to be
209
+ * specified as ISO-8601 formatted datetime string.
210
+ * @param array $approverIds the ids of the two approvers involved in the approval process. You must specify exactly two
211
+ * approvers.
212
+ * @param array $recipientIds the ids of the recipients used to generate a personalized preview of the mailing. You must
213
+ * specify at least one recipient.
214
+ * @param bool $blIsTestRecipient <i>true</i> if the recipientId array contains test recipients (test profiles),
215
+ * <i>false</i> if it contains regular recipients.
216
+ * @param string $sLocale the user local that will be used to localize the request message and approval page.
217
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
218
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
219
+ * @throws Inx_Api_UpdateException if the request cannot be completed, for example because the approval process is not
220
+ * activated for the list or trigger mailing.
221
+ */
222
+ public function requestEscalationApproval( $sEscalationDate, $sDeadline, array $approverIds, array $recipientIds,
223
+ $blIsTestRecipient, $sLocale );
224
+
225
+
226
+ /**
227
+ * Requests identical approval for this trigger mailing. Sends the request to both approvers simultaneously and
228
+ * requires both approvers to approve the trigger mailing. If the deadline date expires without one of the approvers
229
+ * having approved the trigger mailing (and the other not reacted), the request will be cancelled. In order to
230
+ * approve it, the trigger mailing creator will have to request the approval again.
231
+ * <p>
232
+ * The approval of the trigger mailing may only be requested if it is in the following state:
233
+ * <ul>
234
+ * <li>TriggerMailingState::DRAFT ( -> APPROVAL_REQUESTED )
235
+ * </ul>
236
+ * If the trigger mailing is in another state, a <i>TriggerMailingStateException</i> will be raised.
237
+ *
238
+ * @param string $sDeadline the deadline. If this datetime expires, the request will be cancelled if none of
239
+ * the approvers has approved the mailing.
240
+ * @param array $approverIds the ids of the two approvers involved in the approval process. You must specify
241
+ * exactly two approvers.
242
+ * @param array $recipientIds the ids of the recipients used to generate a personalized preview of the mailing.
243
+ * You must specify at least one recipient.
244
+ * @param bool $blIsTestRecipient <i>true</i> if the recipientId array contains test recipients (test profiles),
245
+ * <i>false</i> if it contains regular recipients.
246
+ * @param string $sLocale the user local that will be used to localize the request message and approval page.
247
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
248
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
249
+ * @throws Inx_Api_UpdateException if the request cannot be completed, for example because the approval process
250
+ * is not activated for the list or trigger mailing.
251
+ */
252
+ public function requestIdenticalApproval( $sDeadline, array $approverIds, array $recipientIds,
253
+ $blIsTestRecipient, $sLocale );
254
+
255
+
256
+ /**
257
+ * Revokes the approval for this trigger mailing.
258
+ * <p>
259
+ * The approval of the trigger mailing may only be revoked if it is in one of the following states:
260
+ * <ul>
261
+ * <li>TriggerMailingState::APPROVED ( -> DRAFT )
262
+ * <li>TriggerMailingState::APPROVAL_REQUESTED ( -> DRAFT )
263
+ * </ul>
264
+ * If the trigger mailing is in another state, a <i>TriggerMailingStateException</i> will be raised.
265
+ *
266
+ * @param string $sComment the reason why the approval request was revoked. May be omitted.
267
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
268
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
269
+ * @throws Inx_Api_UpdateException if the request cannot be completed, for example because the approval process
270
+ * is not activated for the list or trigger mailing.
271
+ */
272
+ public function revokeApproval( $sComment = null );
273
+
274
+
275
+ /**
276
+ * Locks this <i>TriggerMailing</i>, so it cannot be locked by another session.
277
+ * <p>
278
+ * <strong>Note:</strong> For existing trigger mailings, always call <i>lock()</i> before updating it, and
279
+ * <i>unlock()</i> after committing changes!
280
+ * <p>
281
+ * <strong>Updating existing trigger mailings without explicit locking is strongly discouraged.</strong>
282
+ *
283
+ * @throws Inx_Api_LockException if this trigger mailing is already locked by another session.
284
+ * @throws Inx_Api_TriggerMailing_TriggerMailingStateException if this trigger mailing is in an illegal state.
285
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
286
+ */
287
+ public function lock();
288
+
289
+
290
+ /**
291
+ * Releases the lock of this <i>TriggerMailing</i>.
292
+ *
293
+ * @param bool $blForceForeignLock <i>true</i> - release foreign and own locks, <i>false</i> - release only own
294
+ * locks (locks held by the current session). May be omitted, defaults to false.
295
+ * @return <i>true</i> if this trigger mailing was unlocked, <i>false</i> otherwise.
296
+ * @throws Inx_Api_DataException if this trigger mailing can not be found on the server.
297
+ */
298
+ public function unlock( $blForceForeignLock = false );
299
+
300
+
301
+ /**
302
+ * Returns the state of this trigger mailing. The state may be one of:
303
+ * <ul>
304
+ * <li><i>TriggerMailingState::DRAFT()</i>: The default state of a new trigger mailing.
305
+ * <li><i>TriggerMailingState::APPROVAL_REQUESTED()</i>: Approval has been requested for this trigger mailing.
306
+ * <li><i>TriggerMailingState::APPROVED()</i>: The trigger mailing has been approved.
307
+ * <li><i>TriggerMailingState::USED()</i>: The trigger mailing was activated at least once.
308
+ * <li><i>TriggerMailingState::UNKNOWN()</i>: The trigger mailing state is unknown. This indicates a version
309
+ * mismatch between API and server.
310
+ * </ul>
311
+ *
312
+ * @return Inx_Api_TriggerMailing_TriggerMailingState the state of this trigger mailing.
313
+ */
314
+ public function getMailingState();
315
+
316
+
317
+ /**
318
+ * Returns the state of the trigger of this trigger mailing. The state may be one of:
319
+ * <ul>
320
+ * <li><i>TriggerState::INACTIVE()</i>: The default state of a new time trigger mailing.
321
+ * <li><i>TriggerState::ACTIVE()</i>: The trigger of this trigger mailing is active.
322
+ * <li><i>TriggerState::UNSPECIFIED()</i>: This state is used when the trigger state can not be determined.
323
+ * This is the case for action trigger mailings.
324
+ * <li><i>TriggerState::UNKNOWN()</i>: The trigger state is unknown. This indicates a version mismatch between
325
+ * API and server.
326
+ * </ul>
327
+ *
328
+ * @return Inx_Api_TriggerMailing_TriggerState the state of the trigger of this trigger mailing.
329
+ */
330
+ public function getTriggerState();
331
+
332
+
333
+ /**
334
+ * Returns a <i>bool</i> indicating whether this trigger mailing is active.
335
+ *
336
+ * @return bool <i>true</i> if this trigger mailing is active, <i>false</i> otherwise.
337
+ */
338
+ public function isActive();
339
+
340
+
341
+ /**
342
+ * Checks if this trigger mailing is locked by a session, regardless of the lock owner.
343
+ *
344
+ * @return bool <i>true</i> if this trigger mailing is locked, <i>false</i> otherwise.
345
+ */
346
+ public function isLocked();
347
+
348
+
349
+ /**
350
+ * Returns the lock ticket. The lock ticket contains the following information:
351
+ * <ul>
352
+ * <li>Who locked the trigger mailing? - User id, name and IP address.
353
+ * <li>When was the lock created?
354
+ * <li>Did I create the lock?
355
+ * </ul>
356
+ *
357
+ * @return Inx_Api_LockTicket the lock ticket.
358
+ */
359
+ public function getLockTicket();
360
+
361
+
362
+ /**
363
+ * Returns the last modification datetime.
364
+ *
365
+ * @return string the last modification datetime. The date is returned as ISO-8601 formatted datetime string.
366
+ */
367
+ public function getModificationDatetime();
368
+
369
+
370
+ /**
371
+ * Returns the approval escalation datetime of this trigger mailing if the trigger mailing is in the state
372
+ * <i>TriggerMailingState::APPROVAL_REQUESTED</i> and the approval process is escalating. If the mailing
373
+ * state is not <i>APPROVAL_REQUESTED</i> or the approval process is identical, null may be returned.
374
+ *
375
+ * @see self::requestEscalationApproval( $sEscalationDate, $sDeadline, array $approverIds, array $recipientIds,
376
+ * $blIsTestRecipient, $sLocale )
377
+ * @return string the approval escalation datetime, or null. The date is returned as ISO-8601 formatted datetime
378
+ * string.
379
+ */
380
+ public function getEscalationDatetime();
381
+
382
+
383
+ /**
384
+ * Returns the approval deadline datetime of this trigger mailing if the trigger mailing is in the state
385
+ * <i>TriggerMailingState::APPROVAL_REQUESTED</i>. If the mailing state is not <i>APPROVAL_REQUESTED</i>, null
386
+ * may be returned.
387
+ *
388
+ * @see self::requestIdenticalApproval( $sDeadline, array $approverIds, array $recipientIds, $blIsTestRecipient,
389
+ * $sLocale );
390
+ * @see self::requestEscalationApproval( $sEscalationDate, $sDeadline, array $approverIds, array $recipientIds,
391
+ * $blIsTestRecipient, $sLocale )
392
+ * @return string the approval deadline datetime, or null. The date is returned as ISO-8601 formatted datetime
393
+ * string.
394
+ */
395
+ public function getDeadlineDatetime();
396
+
397
+
398
+ /**
399
+ * Returns the id of the list context this trigger mailing belongs to.
400
+ *
401
+ * @return int the id of the list context this trigger mailing belongs to.
402
+ */
403
+ public function getListContextId();
404
+
405
+
406
+ /**
407
+ * Returns the sender address of this trigger mailing.
408
+ *
409
+ * @return string the sender address of this trigger mailing.
410
+ */
411
+ public function getSenderAddress();
412
+
413
+
414
+ /**
415
+ * Returns the reply address of this trigger mailing.
416
+ *
417
+ * @return string the reply address of this trigger mailing.
418
+ */
419
+ public function getReplyToAddress();
420
+
421
+
422
+ /**
423
+ * Returns one of the sending filters (probably the first) of this trigger mailing.
424
+ * <p>
425
+ * For more information on <i>Filter</i>s, see the <i>Inx_Api_Filter_Filte</i> documentation.
426
+ *
427
+ * @return int one of the filter ids, 0 means that no filters are set.
428
+ * @see Inx_Api_Filter_Filter
429
+ */
430
+ public function getFilterId();
431
+
432
+
433
+ /**
434
+ * Sets the given filter as the only sending filter of this trigger mailing.
435
+ * <p>
436
+ * For more information on <i>Filter</i>s, see the <i>Inx_Api_Filter_Filter</i> documentation.
437
+ *
438
+ * @param int $iFilterId the filter id, 0 means that no filter is set.
439
+ * @see Inx_Api_Filter_Filter
440
+ */
441
+ public function updateFilterId( $iFilterId );
442
+
443
+
444
+ /**
445
+ * Returns the sending filters of this trigger mailing.
446
+ * <p>
447
+ * For more information on <i>Filter</i>s, see the <i>Inx_Api_Filter_Filter</i> documentation.
448
+ *
449
+ * @return array the filter ids, null means that no filter is set
450
+ * @see Inx_Api_Filter_Filter
451
+ */
452
+ public function getFilderIds();
453
+
454
+
455
+ /**
456
+ * Returns the sending filter concatenation type of this trigger mailing. May be one of the following:
457
+ * <ul>
458
+ * <li><i>FilterConcatenationType::AND()</i>,
459
+ * <li><i>FilterConcatenationType::OR()</i> or
460
+ * <li><i> FilterConcatenationType::NOT_IN()</i>
461
+ * </ul>
462
+ * <ul>
463
+ *
464
+ * @return Inx_Api_TriggerMailing_FilterConcatenationType the filter concatenation type, or <i>null</i> if
465
+ * none is set.
466
+ */
467
+ public function getFilterConcatinationType();
468
+
469
+
470
+ /**
471
+ * Sets the filters used as the sending filters of this trigger mailing, concatenated using the given
472
+ * concatenation type. The possible types are:
473
+ * <ul>
474
+ * <li><i>FilterConcatenationType::AND()</i>,
475
+ * <li><i>FilterConcatenationType::OR()</i> or
476
+ * <li><i> FilterConcatenationType::NOT_IN()</i>
477
+ * </ul>
478
+ * <p>
479
+ * For more information on <i>Filter</i>s, see the <i>Inx_Api_Filter_Filter</i> documentation.
480
+ *
481
+ * @param array $filterIds an array of the filter ids. May be null to use no filter at all.
482
+ * @param Inx_Api_TriggerMailing_FilterConcatenationType $oConcatinationType defines how the filters should be
483
+ * concatenated. The <i>UNKNOWN</i> type is illegal.
484
+ * @throws Inx_Api_IllegalArgumentException if the concatenation type is <i>UNKNOWN</i>.
485
+ * @see Inx_Api_Filter_Filter
486
+ */
487
+ public function updateFilterIds( array $filterIds, Inx_Api_TriggerMailing_FilterConcatenationType $oConcatinationType );
488
+
489
+
490
+ /**
491
+ * Returns the value of the X-Priority header. Allowed values are:
492
+ * <ul>
493
+ * <li><i>null</i> - not specified, the X-Priority header will not be set
494
+ * <li>5 - lowest priority
495
+ * <li>4 - low priority
496
+ * <li>3 - normal priority
497
+ * <li>2 - high priority
498
+ * <li>1 - highest priority
499
+ * </ul>
500
+ *
501
+ * @return int the value of the X-Priority header, or <i>null</i> if the priority is not set.
502
+ */
503
+ public function getPriority();
504
+
505
+
506
+ /**
507
+ * Sets the value of the X-Priority header. Allowed values are:
508
+ * <ul>
509
+ * <li><i>null</i> - not specified, the X-Priority header will not be set
510
+ * <li>5 - lowest priority
511
+ * <li>4 - low priority
512
+ * <li>3 - normal priority
513
+ * <li>2 - high priority
514
+ * <li>1 - highest priority
515
+ * </ul>
516
+ *
517
+ * @param int $iPriority the value of the X-Priority header, or <i>null</i> if the priority is not set.
518
+ */
519
+ public function updatePriority( $iPriority );
520
+
521
+
522
+ /**
523
+ * Returns the subject of this trigger mailing.
524
+ *
525
+ * @return string the subject of this trigger mailing.
526
+ */
527
+ public function getSubject();
528
+
529
+
530
+ /**
531
+ * Sets the subject of this trigger mailing.
532
+ *
533
+ * @param string $sSubject the subject of this trigger mailing.
534
+ */
535
+ public function updateSubject( $sSubject );
536
+
537
+
538
+ /**
539
+ * Returns the name of this trigger mailing.
540
+ *
541
+ * @return string the name of this trigger mailing.
542
+ */
543
+ public function getName();
544
+
545
+
546
+ /**
547
+ * Sets the name of this trigger mailing.
548
+ *
549
+ * @param string $sName the name of this trigger mailing.
550
+ */
551
+ public function updateName( $sName );
552
+
553
+
554
+ /**
555
+ * Returns the content handler, which contains the format-specific mail content.
556
+ *
557
+ * @return Inx_Api_Mailing_ContentHandler the content handler.
558
+ */
559
+ public function getContentHandler();
560
+
561
+
562
+ /**
563
+ * Creates a new content handler. Allowed classes are:
564
+ * <ul>
565
+ * <li>PlainTextContentHandler
566
+ * <li>HtmlTextContentHandler
567
+ * <li>MultiPartContentHandler
568
+ * <li>XsltMultiPartContentHandler
569
+ * <li>XsltHtmlTextContentHandler
570
+ * <li>XsltPlainTextContentHandler
571
+ * </ul>
572
+ *
573
+ * @param string $sContentHandlerClazz the <i>class name</i> of the content handler.
574
+ */
575
+ public function setContentHandler( $sContentHandlerClazz );
576
+
577
+
578
+ /**
579
+ * Returns the creation datetime of the trigger mailing.
580
+ *
581
+ * @return string the creation datetime. The date is returned as ISO-8601 formatted datetime string.
582
+ */
583
+ public function getCreationDatetime();
584
+
585
+
586
+ /**
587
+ * Returns the trigger descriptor of this trigger mailing. The trigger descriptor is used to define the mailing type
588
+ * and all settings regarding the trigger.
589
+ *
590
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor the trigger descriptor of this trigger mailing.
591
+ */
592
+ public function getTriggerDescriptor();
593
+
594
+
595
+ /**
596
+ * Updates the trigger descriptor of this trigger mailing. Be aware that the trigger type can not be changed.
597
+ *
598
+ * @param Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor $triggerDescriptor the updated trigger descriptor of
599
+ * this trigger mailing.
600
+ */
601
+ public function updateTriggerDescriptor( Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor $triggerDescriptor );
602
+
603
+
604
+ /**
605
+ * Returns the type of this trigger mailing. This is a shortcut for:
606
+ *
607
+ * <pre>
608
+ * getTriggerDescriptor()->getType()
609
+ * </pre>
610
+ *
611
+ * @return Inx_Api_TriggerMailing_Descriptor_TriggerType the type of this trigger mailing.
612
+ */
613
+ public function getTriggerType();
614
+
615
+
616
+ /**
617
+ * Returns the date of the next sending of this trigger mailing.
618
+ *
619
+ * @return string the date of the next sending of this trigger mailing. The date is returned as ISO-8601
620
+ * formatted datetime string.
621
+ */
622
+ public function getNextSending();
623
+ }
lib/Inx/Api/TriggerMailing/TriggerMailingAttribute.php ADDED
@@ -0,0 +1,476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing
5
+ */
6
+
7
+ /**
8
+ * The <i>TriggerMailingAttribute</i> enumeration defines the attributes of trigger mailings which are used for
9
+ * the ordering of result sets and to identify the error source of an <i>Inx_Api_UpdateException</i>.
10
+ * <p>
11
+ * To find out if an attribute may be used for ordering, call the <i>isOrderAttribute()</i> method.
12
+ *<p>
13
+ * A note for programmers who are not familiar with the concept of enumerations: Enumerations or enumerated types are basically
14
+ * a fixed set of named values. They are usually used to define a couple of legitimate values in a specific context and serve a
15
+ * purpose similar to integer constants.
16
+ * The advantage of enumerations is, that you cannot specify any "weird" values because every value has to be an instance of
17
+ * the enumerated type. It is also possible to associate data or even behaviour (methods) with the values.
18
+ * PHP does not support such a language feature like Java and C# do. In most languages the named values are a sort of constant
19
+ * whose value is an instance of the enumerated type. In PHP a constant cannot contain a reference type. Therefore, we
20
+ * implemented enumerations as classes with private constructor and methods which return the named values.
21
+ * Be aware that the objects returned by the static methods are always the same object. That way it is possible to use the
22
+ * identity operator (===) on these objects and use them comfortably in switch statements.
23
+ *
24
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::selectByState( Inx_Api_List_ListContext $listContext,
25
+ * Inx_Api_TriggerMailing_StateFilter $stateFilter, Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null,
26
+ * $iOrderType = null, $sFilter = null )
27
+ * @see Inx_Api_UpdateException::getErrorSource()
28
+ * @since API 1.10.0
29
+ * @author chge, 13.07.2012
30
+ */
31
+ final class Inx_Api_TriggerMailing_TriggerMailingAttribute
32
+ {
33
+ private static $INTERNAL_MAILING_LIST_ID = null;
34
+
35
+ private static $INTERNAL_MAILING_FEATURE_ID = null;
36
+
37
+ private static $INTERNAL_MAILING_CONTENT_MAIL_TYPE = null;
38
+
39
+ private static $SUBJECT = null;
40
+
41
+ private static $PLAIN_TEXT = null;
42
+
43
+ private static $HTML_TEXT = null;
44
+
45
+ private static $XML_CONTENT = null;
46
+
47
+ private static $PLAIN_TEXT_XSL = null;
48
+
49
+ private static $HTML_TEXT_XSL = null;
50
+
51
+ private static $FILTER_ID = null;
52
+
53
+ private static $SENDER_ADDRESS = null;
54
+
55
+ private static $RECIPIENT_ADDRESS = null;
56
+
57
+ private static $REPLY_TO_ADDRESS = null;
58
+
59
+ private static $PRIORITY = null;
60
+
61
+ private static $MODIFICATION_DATETIME = null;
62
+
63
+ private static $STYLE = null;
64
+
65
+ private static $ACTIVATION_DATETIME = null;
66
+
67
+ private static $SINGLE_SEND_COUNT = null;
68
+
69
+ private static $NAME = null;
70
+
71
+ private static $DESCRIPTOR = null;
72
+
73
+ private static $DEFAULT_ATTRIBUTE = null;
74
+
75
+ private static $UNKNOWN = null;
76
+
77
+ /**
78
+ * Constant for the mailing list id attribute. This constant is used internally only.
79
+ *
80
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the mailing list id attribute.
81
+ */
82
+ public static final function INTERNAL_MAILING_LIST_ID()
83
+ {
84
+ if(null === self::$INTERNAL_MAILING_LIST_ID)
85
+ self::$INTERNAL_MAILING_LIST_ID = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 0, false );
86
+
87
+ return self::$INTERNAL_MAILING_LIST_ID;
88
+ }
89
+
90
+ /**
91
+ * Constant for the mailing content (MIME) type attribute. This constant is used internally only.
92
+ *
93
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the mailing content type attribute.
94
+ */
95
+ public static final function INTERNAL_MAILING_CONTENT_MAIL_TYPE()
96
+ {
97
+ if(null === self::$INTERNAL_MAILING_CONTENT_MAIL_TYPE)
98
+ self::$INTERNAL_MAILING_CONTENT_MAIL_TYPE = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 1, false );
99
+
100
+ return self::$INTERNAL_MAILING_CONTENT_MAIL_TYPE;
101
+ }
102
+
103
+ /**
104
+ * Constant for the mailing feature id. This constant is used internally only.
105
+ *
106
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the mailing feature id attribute.
107
+ */
108
+ public static final function INTERNAL_MAILING_FEATURE_ID()
109
+ {
110
+ if(null === self::$INTERNAL_MAILING_FEATURE_ID)
111
+ self::$INTERNAL_MAILING_FEATURE_ID = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 2, false );
112
+
113
+ return self::$INTERNAL_MAILING_FEATURE_ID;
114
+ }
115
+
116
+ /**
117
+ * Constant for the subject attribute. Used for ordering by the <i>TriggerMailingManager</i>.
118
+ *
119
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the subject attribute.
120
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::selectByState( Inx_Api_List_ListContext $listContext,
121
+ * Inx_Api_TriggerMailing_StateFilter $stateFilter, Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null,
122
+ * $iOrderType = null, $sFilter = null )
123
+ */
124
+ public static final function SUBJECT()
125
+ {
126
+ if(null === self::$SUBJECT)
127
+ self::$SUBJECT = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 3, true );
128
+
129
+ return self::$SUBJECT;
130
+ }
131
+
132
+ /**
133
+ * Constant for the plain text attribute.
134
+ *
135
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the plain text attribute.
136
+ */
137
+ public static final function PLAIN_TEXT()
138
+ {
139
+ if(null === self::$PLAIN_TEXT)
140
+ self::$PLAIN_TEXT = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 4, false );
141
+
142
+ return self::$PLAIN_TEXT;
143
+ }
144
+
145
+ /**
146
+ * Constant for the HTML text attribute.
147
+ *
148
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the HTML text attribute.
149
+ */
150
+ public static final function HTML_TEXT()
151
+ {
152
+ if(null === self::$HTML_TEXT)
153
+ self::$HTML_TEXT = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 5, false );;
154
+
155
+ return self::$HTML_TEXT;
156
+ }
157
+
158
+ /**
159
+ * Constant for the XML content attribute.
160
+ *
161
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the XML content attribute.
162
+ */
163
+ public static final function XML_CONTENT()
164
+ {
165
+ if(null === self::$XML_CONTENT)
166
+ self::$XML_CONTENT = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 6, false );
167
+
168
+ return self::$XML_CONTENT;
169
+ }
170
+
171
+ /**
172
+ * Constant for the plain text style XML content attribute.
173
+ *
174
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the plain text style XML content attribute.
175
+ */
176
+ public static final function PLAIN_TEXT_XSL()
177
+ {
178
+ if(null === self::$PLAIN_TEXT_XSL)
179
+ self::$PLAIN_TEXT_XSL = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 7, false );
180
+
181
+ return self::$PLAIN_TEXT_XSL;
182
+ }
183
+
184
+ /**
185
+ * Constant for the HTML text style XML content attribute.
186
+ *
187
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the HTML text style XML content attribute.
188
+ */
189
+ public static final function HTML_TEXT_XSL()
190
+ {
191
+ if(null === self::$HTML_TEXT_XSL)
192
+ self::$HTML_TEXT_XSL = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 8, false );
193
+
194
+ return self::$HTML_TEXT_XSL;
195
+ }
196
+
197
+ /**
198
+ * Constant for the filter id attribute.
199
+ *
200
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the filter id attribute.
201
+ */
202
+ public static final function FILTER_ID()
203
+ {
204
+ if(null === self::$FILTER_ID)
205
+ self::$FILTER_ID = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 9, false );
206
+
207
+ return self::$FILTER_ID;
208
+ }
209
+
210
+ /**
211
+ * Constant for the sender address attribute.
212
+ *
213
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the sender address attribute.
214
+ */
215
+ public static final function SENDER_ADDRESS()
216
+ {
217
+ if(null === self::$SENDER_ADDRESS)
218
+ self::$SENDER_ADDRESS = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 10, false );
219
+
220
+ return self::$SENDER_ADDRESS;
221
+ }
222
+
223
+ /**
224
+ * Constant for the recipient address attribute.
225
+ *
226
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the recipient address attribute.
227
+ */
228
+ public static final function RECIPIENT_ADDRESS()
229
+ {
230
+ if(null === self::$RECIPIENT_ADDRESS)
231
+ self::$RECIPIENT_ADDRESS = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 11, false );
232
+
233
+ return self::$RECIPIENT_ADDRESS;
234
+ }
235
+
236
+ /**
237
+ * Constant for the reply address attribute.
238
+ *
239
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the reply address attribute.
240
+ */
241
+ public static final function REPLY_TO_ADDRESS()
242
+ {
243
+ if(null === self::$REPLY_TO_ADDRESS)
244
+ self::$REPLY_TO_ADDRESS = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 12, false );
245
+
246
+ return self::$REPLY_TO_ADDRESS;
247
+ }
248
+
249
+ /**
250
+ * Constant for the priority attribute.
251
+ *
252
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the priority attribute.
253
+ */
254
+ public static final function PRIORITY()
255
+ {
256
+ if(null === self::$PRIORITY)
257
+ self::$PRIORITY = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 13, false );
258
+
259
+ return self::$PRIORITY;
260
+ }
261
+
262
+ /**
263
+ * Constant for the modification datetime attribute. Used for ordering by the <i>TriggerMailingManager</i>.
264
+ *
265
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the modification datetime attribute.
266
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::selectByState( Inx_Api_List_ListContext $listContext,
267
+ * Inx_Api_TriggerMailing_StateFilter $stateFilter, Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null,
268
+ * $iOrderType = null, $sFilter = null )
269
+ */
270
+ public static final function MODIFICATION_DATETIME()
271
+ {
272
+ if(null === self::$MODIFICATION_DATETIME)
273
+ self::$MODIFICATION_DATETIME = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 14, true );
274
+
275
+ return self::$MODIFICATION_DATETIME;
276
+ }
277
+
278
+ /**
279
+ * Constant for the style attribute. Used by the <i>UpdateException</i> to identify the error source.
280
+ *
281
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the style attribute.
282
+ * @see Inx_Api_UpdateException::getErrorSource()
283
+ */
284
+ public static final function STYLE()
285
+ {
286
+ if(null === self::$STYLE)
287
+ self::$STYLE = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 15, false );
288
+
289
+ return self::$STYLE;
290
+ }
291
+
292
+ /**
293
+ * Constant for the activation datetime attribute. Used for ordering by the <i>TriggerMailingManager</i>
294
+ *
295
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the activation datetime attribute.
296
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::selectByState( Inx_Api_List_ListContext $listContext,
297
+ * Inx_Api_TriggerMailing_StateFilter $stateFilter, Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null,
298
+ * $iOrderType = null, $sFilter = null )
299
+ */
300
+ public static final function ACTIVATION_DATETIME()
301
+ {
302
+ if(null === self::$ACTIVATION_DATETIME)
303
+ self::$ACTIVATION_DATETIME = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 16, true );
304
+
305
+ return self::$ACTIVATION_DATETIME;
306
+ }
307
+
308
+ /**
309
+ * Constant for the single send count attribute. Used for ordering by the <i>TriggerMailingManager</i>
310
+ *
311
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the single send count attribute.
312
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::selectByState( Inx_Api_List_ListContext $listContext,
313
+ * Inx_Api_TriggerMailing_StateFilter $stateFilter, Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null,
314
+ * $iOrderType = null, $sFilter = null )
315
+ */
316
+ public static final function SINGLE_SEND_COUNT()
317
+ {
318
+ if(null === self::$SINGLE_SEND_COUNT)
319
+ self::$SINGLE_SEND_COUNT = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 17, true );
320
+
321
+ return self::$SINGLE_SEND_COUNT;
322
+ }
323
+
324
+ /**
325
+ * Constant for the name attribute. Used for ordering by the <i>TriggerMailingManager</i>
326
+ *
327
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the name attribute.
328
+ * @see Inx_Api_TriggerMailing_TriggerMailingManager::selectByState( Inx_Api_List_ListContext $listContext,
329
+ * Inx_Api_TriggerMailing_StateFilter $stateFilter, Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null,
330
+ * $iOrderType = null, $sFilter = null )
331
+ */
332
+ public static final function NAME()
333
+ {
334
+ if(null === self::$NAME)
335
+ self::$NAME = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 18, true );
336
+
337
+ return self::$NAME;
338
+ }
339
+
340
+ /**
341
+ * Constant for the trigger descriptor attribute. Used by the <i>UpdateException</i> to identify the error
342
+ * source.
343
+ *
344
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the descriptor attribute.
345
+ * @see Inx_Api_UpdateException::getErrorSource()
346
+ */
347
+ public static final function DESCRIPTOR()
348
+ {
349
+ if(null === self::$DESCRIPTOR)
350
+ self::$DESCRIPTOR = new Inx_Api_TriggerMailing_TriggerMailingAttribute( 19, false );
351
+
352
+ return self::$DESCRIPTOR;
353
+ }
354
+
355
+ /**
356
+ * The default attribute used for ordering and as error source if no specific attribute is known or given.
357
+ *
358
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the default attribute.
359
+ */
360
+ public static final function DEFAULT_ATTRIBUTE()
361
+ {
362
+ if(null === self::$DEFAULT_ATTRIBUTE)
363
+ self::$DEFAULT_ATTRIBUTE = new Inx_Api_TriggerMailing_TriggerMailingAttribute( -1, true );
364
+
365
+ return self::$DEFAULT_ATTRIBUTE;
366
+ }
367
+
368
+ /**
369
+ * Constant for an unknown attribute. This attribute indicates a version mismatch between API and server. It might
370
+ * be used by the <i>UpdateException</i> to identify the error source.
371
+ *
372
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the unknown attribute.
373
+ * @see Inx_Api_UpdateException::getErrorSource()
374
+ */
375
+ public static final function UNKNOWN()
376
+ {
377
+ if(null === self::$UNKNOWN)
378
+ self::$UNKNOWN = new Inx_Api_TriggerMailing_TriggerMailingAttribute( -2, false );
379
+
380
+ return self::$UNKNOWN;
381
+ }
382
+
383
+ private $id;
384
+
385
+ private $isOrderAttribute;
386
+
387
+
388
+ private function __construct( $iId, $blIsOrderAttribute )
389
+ {
390
+ $this->id = $iId;
391
+ $this->isOrderAttribute = $blIsOrderAttribute;
392
+ }
393
+
394
+
395
+ /**
396
+ * Returns the ID of the <i>TriggerMailingAttribute</i>. The ID is used for transmission purposes and should
397
+ * not be used inside client code.
398
+ *
399
+ * @return int the ID of the <i>TriggerMailingAttribute</i>.
400
+ */
401
+ public function getId()
402
+ {
403
+ return $this->id;
404
+ }
405
+
406
+
407
+ /**
408
+ * Returns a <i>bool</i> indicating if this <i>TriggerMailingAttribute</i> can be used for ordering
409
+ * of result sets.
410
+ *
411
+ * @return bool <i>true</i> if this attribute can be used for ordering, <i>false</i> otherwise.
412
+ */
413
+ public function isOrderAttribute()
414
+ {
415
+ return $this->isOrderAttribute;
416
+ }
417
+
418
+
419
+ /**
420
+ * Returns the <i>TriggerMailingAttribute</i> corresponding to the given id. If the id is unknown, the
421
+ * <i>UNKNOWN</i> attribute will be returned. The ID is used for transmission purposes and should not be used
422
+ * inside client code.
423
+ *
424
+ * @param int $iId the ID of the <i>TriggerMailingAttribute</i> to retrieve.
425
+ * @return Inx_Api_TriggerMailing_TriggerMailingAttribute the <i>TriggerMailingAttribute</i> corresponding to
426
+ * the given ID.
427
+ */
428
+ public static function byId( $iId )
429
+ {
430
+ foreach( self::values() as $attribute )
431
+ {
432
+ if( $attribute->getId() == $iId )
433
+ {
434
+ return $attribute;
435
+ }
436
+ }
437
+
438
+ return self::UNKNOWN();
439
+ }
440
+
441
+
442
+ /**
443
+ * Returns an array of the <i>TriggerMailingAttribute</i>s which can be used for ordering.
444
+ *
445
+ * @return array an array of the <i>TriggerMailingAttribute</i>s which can be used for ordering.
446
+ */
447
+ public static function getOrderAttributes()
448
+ {
449
+ $result = array();
450
+
451
+ foreach( self::values() as $attribute )
452
+ {
453
+ if( $attribute->isOrderAttribute() )
454
+ {
455
+ $result[] = $attribute;
456
+ }
457
+ }
458
+
459
+ return $result;
460
+ }
461
+
462
+ /**
463
+ * Returns an array containing all available <i>TriggerMailingAttribute</i>s including UNKNOWN.
464
+ *
465
+ * @return array an array containing all available <i>TriggerMailingAttribute</i>s including UNKNOWN.
466
+ */
467
+ public static function values()
468
+ {
469
+ return array(self::INTERNAL_MAILING_LIST_ID(), self::INTERNAL_MAILING_CONTENT_MAIL_TYPE(),
470
+ self::INTERNAL_MAILING_FEATURE_ID(), self:: SUBJECT(), self::PLAIN_TEXT(), self::HTML_TEXT(),
471
+ self::XML_CONTENT(), self::PLAIN_TEXT_XSL(), self::HTML_TEXT_XSL(), self::FILTER_ID(),
472
+ self::SENDER_ADDRESS(), self::RECIPIENT_ADDRESS(), self::REPLY_TO_ADDRESS(), self::PRIORITY(),
473
+ self::MODIFICATION_DATETIME(), self::STYLE(), self::ACTIVATION_DATETIME(), self::SINGLE_SEND_COUNT(),
474
+ self::NAME(), self::DESCRIPTOR(), self::DEFAULT_ATTRIBUTE(), self::UNKNOWN());
475
+ }
476
+ }
lib/Inx/Api/TriggerMailing/TriggerMailingManager.php ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Inxmail
4
+ * @subpackage TriggerMailing
5
+ */
6
+
7
+ /**
8
+ * The <i>TriggerMailingManager</i> manages all trigger mailings. The <i>TriggerMailingManager</i> can be
9
+ * used to perform the following tasks:
10
+ * <ul>
11
+ * <li>Retrieve mailings
12
+ * <li>Create mailings
13
+ * <li>Clone mailings
14
+ * <li>Create a renderer to generate a preview of the mailing
15
+ * </ul>
16
+ * Be aware that this manager is not able to manage normal mailings. Normal mailings are managed by the
17
+ * <i>Inx_Api_Mailing_MailingManager</i>.
18
+ * <p>
19
+ * <strong>Mailing retrieval</strong>
20
+ * <p>
21
+ * There are several ways to retrieve trigger mailings. The simplest way is to call <i>selectAll()</i> which will
22
+ * retrieve all trigger mailings. To retrieve a single trigger mailing, use the <i>get(int)</i> method. To
23
+ * retrieve all trigger mailings of a specific list use one of the <i>selectByState(...)</i> methods. Using this
24
+ * type of method gives you the ability to define search filters, like the trigger mailing state. It is also possible to
25
+ * order the result.
26
+ * <p>
27
+ * The following snippet shows how to retrieve all trigger mailings of a specific list, which are either in the
28
+ * <code>DRAFT</code> or the <code>APPROVAL_REQUESTED</code> state and print out their names:
29
+ *
30
+ * <pre>
31
+ * $triggerMailingMgr = $session->getTriggerMailingManager();
32
+ * $mailingStateFilter = array( Inx_Api_TriggerMailing_TriggerMailingState::DRAFT(),
33
+ * Inx_Api_TriggerMailing_TriggerMailingState::APPROVAL_REQUESTED() );
34
+ * $stateFilter = $triggerMailingMgr->createMailingStateFilter( $mailingStateFilter );
35
+ * $set = $triggerMailingMgr->selectByState( $listContext, $stateFilter );
36
+ *
37
+ * for( $i = 0; $i &lt; $set-&gt;size(); $i++ )
38
+ * {
39
+ * $tm = $set->get( $i );
40
+ * echo $tm->getName() . '&lt;br&gt;';
41
+ * }
42
+ *
43
+ * $set->close();
44
+ * </pre>
45
+ *
46
+ * To retrieve all mailings of a specific list, disregarding their state, use the all matching state filter which can be
47
+ * created using the <i>createAllMatchingStateFilter()</i> method. This filter produces the same result as a state
48
+ * filter with all states.
49
+ * <p>
50
+ * If needed, it is possible to create much more complex select statements than the one above. This can be accomplished
51
+ * using filter expressions. The following snippet extends the previous select statement with a filter that restricts
52
+ * the result to mailings which were modified during the last hour. The result is also ordered by the mailing name:
53
+ *
54
+ * <pre>
55
+ * $triggerMailingMgr = $session->getTriggerMailingManager();
56
+ *
57
+ * $filterDate = date('d.m.Y H:i:s', strtotime('-1 hour'));
58
+ * $filter = 'Attribute(' . Inx_Api_TriggerMailing_TriggerMailingAttribute::MODIFICATION_DATETIME()->getId()
59
+ * . ') > #' . $filterDate . '#';
60
+ *
61
+ * $mailingStateFilter = array( Inx_Api_TriggerMailing_TriggerMailingState::DRAFT(),
62
+ * Inx_Api_TriggerMailing_TriggerMailingState::APPROVAL_REQUESTED() );
63
+ * $stateFilter = $triggerMailingMgr->createMailingStateFilter( $mailingStateFilter );
64
+ *
65
+ * $set = $triggerMailingMgr->selectByState( $listContext, $stateFilter,
66
+ * Inx_Api_TriggerMailing_TriggerMailingAttribute::NAME(), Inx_Api_Order::ASC, $filter );
67
+ *
68
+ * for( $i = 0; $i &lt; $set-&gt;size(); $i++ )
69
+ * {
70
+ * $tm = $set->get( $i );
71
+ * echo $tm->getName() . '&lt;br&gt;';
72
+ * }
73
+ *
74
+ * $set->close();
75
+ * </pre>
76
+ * <p>
77
+ * <strong>Mailing creation and editing</strong>
78
+ * <p>
79
+ * Creating a trigger mailing can be a bit tricky as there are many settings needed to set up a trigger descriptor.
80
+ * There are several builders which will help you with creating a valid trigger descriptor. The following snippet
81
+ * exemplary shows how to create an anniversary trigger mailing:
82
+ *
83
+ * <pre>
84
+ * $optInDate = $session->createRecipientContext()->getMetaData()->getSubscriptionAttribute(
85
+ * $listContext )->getId();
86
+ * $startDate = date('c');
87
+ * $sendingTime = date('c', mktime(12, 30));
88
+ *
89
+ * $triggerMailingMgr = $session->getTriggerMailingManager();
90
+ * $descriptor = $triggerMailingMgr->getTriggerDescriptorBuilderFactory()
91
+ * ->createAnniversaryTriggerDescriptorBuilder()->startDate( $startDate )->sendingTime( $sendingTime )
92
+ * ->attribute( $optInDate )->columnModificator(
93
+ * new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
94
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::WAS_AGO(),
95
+ * Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::YEAR(), 1 ) )->build();
96
+ *
97
+ * $mailing = $triggerMailingMgr->createTriggerMailing( $listContext, $descriptor );
98
+ * $mailing->updateName( 'One year anniversary' );
99
+ * $mailing->updateSubject( "Thank's for staying with us!" );
100
+ * $mailing->commitUpdate();
101
+ * </pre>
102
+ *
103
+ * The created anniversary mailing will be sent to recipients that have been member of the specified list for one year.
104
+ * The descriptor in this example is set up with minimal information. If you wish to, you can configure even more
105
+ * aspects of the trigger. You could, for example, add commands to set recipient attributes along with sending the
106
+ * mailing. The available options vary from builder to builder, documented for each builder interface, including
107
+ * information on which settings are mandatory and which are optional.
108
+ * <p>
109
+ * <strong>Note:</strong> For existing trigger mailings, always call <i>lock()</i> before updating it, and
110
+ * <i>unlock()</i> after committing changes!
111
+ * <p>
112
+ * The following snippet shows how to edit an existing trigger mailing:
113
+ *
114
+ * <pre>
115
+ * $triggerMailingMgr = $session->getTriggerMailingManager();
116
+ * $mailing = $triggerMailingMgr->get( $iMailingId );
117
+ *
118
+ * try
119
+ * {
120
+ * $mailing->lock();
121
+ * $mailing->updateSubject( 'New Subject' );
122
+ * $mailing->commitUpdate();
123
+ * $mailing->unlock();
124
+ * }
125
+ * catch( Inx_Api_LockException $x )
126
+ * {
127
+ * // someone else has locked this mailing
128
+ * }
129
+ * </pre>
130
+ * <p>
131
+ * It is not necessary to repeatedly create almost identical mailings. This can be accomplished a lot easier using the
132
+ * <i>clone()</i> method.
133
+ * <p>
134
+ * The following snippet shows how to clone a mailing and put the clone in the specified list:
135
+ *
136
+ * <pre>
137
+ * $triggerMailingMgr = $session->getTriggerMailingManager();
138
+ * $triggerMailingMgr->cloneMailing( $iMailingId, $listContext );
139
+ * </pre>
140
+ * <p>
141
+ * <strong>Preview generation</strong>
142
+ * <p>
143
+ * To create a preview of a trigger mailing, an <i>Inx_Api_TriggerMail_TriggerMailingRenderer</i> is needed. A renderer
144
+ * can be obtained using the <i>createRenderer()</i> method.
145
+ * <p>
146
+ * The following snippet shows how to create a <i>TriggerMailingRenderer</i> and generate a preview of the trigger
147
+ * mailing:
148
+ *
149
+ * <pre>
150
+ * $triggerMailingMgr = $session->getTriggerMailingManager();
151
+ * $renderer = $triggerMailingMgr->createRenderer();
152
+ * $renderer->parse( $iMailingId, Inx_Api_TriggerMail_BuildMode::PREVIEW() );
153
+ * $preview = $renderer->build( $iRecipientId );
154
+ *
155
+ * echo $preview->getHtmlText() . '<br>';
156
+ * </pre>
157
+ * <p>
158
+ * For more information on <i>TriggerMailing</i>s, see the <i>Inx_Api_TriggerMailing_TriggerMailing</i> documentation.
159
+ * <p>
160
+ * Note: To use trigger mailings, the following API user right is required: <i>Inx_Api_UserRights::MAILING_FEATURE_USE</i>
161
+ *
162
+ * @see Inx_Api_TriggerMailing_TriggerMailing
163
+ * @since API 1.10.0
164
+ * @author chge, 12.07.2012
165
+ */
166
+ interface Inx_Api_TriggerMailing_TriggerMailingManager extends Inx_Api_BOManager
167
+ {
168
+ /**
169
+ * Returns a <code>BOResultSet</code> containing all trigger mailings of the specified list, that pass the specified
170
+ * state filter and filter expression. The result will be ordered by the given attribute using the specified order
171
+ * type.
172
+ * <p>
173
+ * The stateFilter parameter can be created using one of the following methods:
174
+ * <ul>
175
+ * <li><i>createMailingStateFilter</i>: matches a set of mailing states.
176
+ * <li><i>createTriggerStateFilter</i>: matches a specific trigger state.
177
+ * <li><i>createStateFilter</i>: matches a set of mailing states and a specific trigger state. Both filters must
178
+ * be passed.
179
+ * <li><i>createAllMatchingStateFilter()</i>: matches any mailing and trigger state. Note: this is a singleton.
180
+ * </ul>
181
+ * <p>
182
+ * To retrieve all trigger mailings of a list, disregarding their state, use the all matching state filter.
183
+ * <p>
184
+ * The filter parameter is a boolean expression on a single trigger mailing attribute. The expression syntax is
185
+ * almost identical to the one used by <i>Inx_Api_Filter_Filter::updateStatement( $sStmt )</i> with two exceptions:
186
+ * <ol>
187
+ * <li>The filter is not matching recipient attributes, but trigger mailing attributes. To define the mailing
188
+ * attribute to match, use the following pattern:
189
+ * <i>'Attribute(' . Inx_Api_TriggerMailing_TriggerMailingAttribute::XYZ()->getId() . ')'</i>
190
+ * <li>The filter may only match one column. The operators AND and OR are not allowed.
191
+ * </ol>
192
+ * <p>
193
+ * The orderAttribute parameter is the attribute used to order the result. Allowed attributes are:
194
+ * <ul>
195
+ * <li><i>Inx_Api_TriggerMailing_TriggerMailingAttribute::SUBJECT()</i>: the subject of the trigger mailing - alphabetical order.
196
+ * <li><i>Inx_Api_TriggerMailing_TriggerMailingAttribute::NAME()</i>: the name of the trigger mailing - alphabetical order.
197
+ * <li><I>Inx_Api_TriggerMailing_TriggerMailingAttribute::MODIFICATION_DATETIME()</i>: the datetime of the last modification of
198
+ * the trigger mailing - chronological order.
199
+ * <li><i>Inx_Api_TriggerMailing_TriggerMailingAttribute::ACTIVATION_DATETIME()</i>: the datetime of the first activation of the
200
+ * trigger mailing - chronological order.
201
+ * <li><i>Inx_Api_TriggerMailing_TriggerMailingAttribute::SINGLE_SEND_COUNT()</i>: the number of recipients to which the trigger
202
+ * mailing was sent till now - numerical order.
203
+ * <li><i>Inx_Api_TriggerMailing_TriggerMailingAttribute::DEFAULT()</i>: the default order attribute - unspecified order.
204
+ * </ul>
205
+ * To check if an attribute can be used as order attribute, use the
206
+ * <i>Inx_Api_TriggerMailing_TriggerMailingAttribute::isOrderAttribute()</i> method.
207
+ *
208
+ * @param Inx_Api_List_ListContext $listContext the list which contains the trigger mailings to be retrieved.
209
+ * @param Inx_Api_TriggerMailing_StateFilter $stateFilter the state filter condition.
210
+ * @param Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute the attribute used to order the result. May be omitted.
211
+ * @param int $iOrderType the order direction; one of <i>Inx_Api_Order::ASC</i> and <I>Inx_Api_Order::DESC</i>. May be omitted.
212
+ * @param string $sFilter the filter expression. May be omitted.
213
+ * @return Inx_Api_BOResultSet a <i>BOResultSet</i> containing all trigger mailings of the specified list, that pass the specified
214
+ * state filter and filter expression.
215
+ * @throws Inx_Api_FilterStmtException if the given filter statement could not be parsed.
216
+ * @throws Inx_Api_IllegalArgumentException if the given order attribute is invalid.
217
+ */
218
+ public function selectByState( Inx_Api_List_ListContext $listContext, Inx_Api_TriggerMailing_StateFilter $stateFilter,
219
+ Inx_Api_TriggerMailing_TriggerMailingAttribute $orderAttribute = null, $iOrderType = null, $sFilter = null );
220
+
221
+
222
+ /**
223
+ * Creates a new trigger mailing in the specified list using the given trigger descriptor. To create a trigger
224
+ * descriptor, use one of the builders provided by the <i>Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilderFactory</i>,
225
+ * which can be obtained using the <i>getTriggerDescriptorBuilderFactory()</i> method.
226
+ *
227
+ * @param Inx_Api_List_ListContext $listContext the list that will be containing the trigger mailing.
228
+ * @param Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor $descriptor the descriptor for the trigger.
229
+ * @return Inx_Api_TriggerMailing_TriggerMailing a new <i>TriggerMailing</i>.
230
+ */
231
+ public function createTriggerMailing( Inx_Api_List_ListContext $listContext,
232
+ Inx_Api_TriggerMailing_Descriptor_TriggerDescriptor $descriptor );
233
+
234
+
235
+ /**
236
+ * Creates a new <i>Inx_Api_TriggerMail_TriggerMailingRenderer</i> which can be used to render a <i>TriggerMailing</i>.
237
+ *
238
+ * @return Inx_Api_TriggerMail_TriggerMailingRenderer a new <i>TriggerMailingRenderer</i>.
239
+ */
240
+ public function createRenderer();
241
+
242
+
243
+ /**
244
+ * Creates a new <i>Inx_Api_TriggerMail_TriggerMailingRenderer</i> which can be used to render a <i>TriggerMailing</i>
245
+ * personalized with a test recipient instead of an ordinary recipient.
246
+ *
247
+ * @return Inx_Api_TriggerMail_TriggerMailingRenderer a new <i>TriggerMailingRenderer</i> for test recipients.
248
+ */
249
+ public function createRendererForTestrecipient();
250
+
251
+
252
+ /**
253
+ * Copies a <i>TriggerMailing</i> to the specified list.
254
+ *
255
+ * @param int $iMailingId the id of the trigger mailing to be cloned.
256
+ * @param Inx_Api_List_ListContext $lc the list to which the trigger mailing should be cloned.
257
+ * @return Inx_Api_TriggerMailing_TriggerMailing the new <i>TriggerMailing</i> which is a clone of the specified
258
+ * <i>TriggerMailing</i>.
259
+ * @throws Inx_Api_DataException