contenido\classes\class.newsletter.php
\Newsletter
- Parent(s)
- \Item
- Author
- Timo A. Hummel
- Copyright
- four for business 2003
- Version
- 0.1
Properties

array $_arrInFilters = array('urlencode', 'conHtmlSpecialChars', 'addslashes')array('urlencode', 'conHtmlSpecialChars', 'addslashes')Details- Type
- array
- Access
- private
- Inherited_from
- \Item::$$_arrInFilters

array $_arrOutFilters = array('stripslashes', 'htmldecode', 'urldecode')array('stripslashes', 'htmldecode', 'urldecode')Details- Type
- array
- Access
- private
- Inherited_from
- \Item::$$_arrOutFilters

$_metaObject- Type
- n/a
- Inherited_from
- \Item::$$_metaObject

string $oldPrimaryKey- Type
- string
- Access
- private
- Inherited_from
- \Item::$$oldPrimaryKey

array $values- Type
- array
- Access
- private
- Inherited_from
- \Item::$$values

boolean $virginIf true, the object is virgin and no operations on it except load-Functions are allowed.
- Type
- boolean
- Access
- private
- Inherited_from
- \Item::$$virgin
Methods

Item(string $table = "", string $primaryKey = "", $lifetime = 10) : void| Name | Type | Description |
|---|---|---|
| $table | string | The table to use as information source |
| $primaryKey | string | The primary key to use |
| $lifetime |

_deChunkHTTPBody( $sHeader, $sBody, $sEOL = "\r\n") : void| Name | Type | Description |
|---|---|---|
| $sHeader | ||
| $sBody | ||
| $sEOL |

_inFilter(mixed $data) : mixedFilters the passed data using the functions defines in the _arrInFilters array.
Inherited from: \Item::_inFilter()| Name | Type | Description |
|---|---|---|
| $data | mixed | Data to filter |
| Type | Description |
|---|---|
| mixed | Filtered data |
- Access
- private
- See
- \setFilters

_onLoad() : \noneFunction which is called whenever an item is loaded. Inherited classes should override this function if desired.
| Type | Description |
|---|---|
| \none |

_outFilter(mixed $data) : mixedFilters the passed data using the functions defines in the _arrOutFilters array.
Inherited from: \Item::_outFilter()| Name | Type | Description |
|---|---|---|
| $data | mixed | Data to filter |
| Type | Description |
|---|---|
| mixed | Filtered data |
- Access
- private
- See
- \setFilters

_replaceTag(string $sCode, bool $bIsHTML, string $sField, string $sData) : voidReplaces newsletter tag (e.g.
MAIL_NAME) with data. If code is just text using str_replace; if it is HTML by using regular expressions
| Name | Type | Description |
|---|---|---|
| $sCode | string | sCode Code, where the tags will be replaced (by reference) |
| $bIsHTML | bool | bIsHTML Is code HTML? |
| $sField | string | sField Field name, without MAIL_ (e.g. just "name") |
| $sData | string | sData Data |
- Access
- private

_setMetaObject( $objectname) : void| Name | Type | Description |
|---|---|---|
| $objectname |

deleteProperty(string $type, string $name) : voiddeleteProperty ($type, $name) Deletes a custom property
Inherited from: \Item::deleteProperty()| Name | Type | Description |
|---|---|---|
| $type | string | Specifies the type |
| $name | string | Specifies the name |

get(string $field) : mixed| Name | Type | Description |
|---|---|---|
| $field | string | Specifies the field to retrieve |
| Type | Description |
|---|---|
| mixed | Value of the field |

getField(string $field) : mixed| Name | Type | Description |
|---|---|---|
| $field | string | Specifies the field to retrieve |
| Type | Description |
|---|---|
| mixed | Value of the field |

getHTMLMessage() : stringIf newsletter is HTML newsletter and necessary data available returns final HTML message
| Type | Description |
|---|---|
| string | HTML message |

getProperty(string $type, string $name) : boolean| Name | Type | Description |
|---|---|---|
| $type | string | Specifies the type |
| $name | string | Specifies the name |
| Type | Description |
|---|---|
| boolean | Value of the given property |

loadBy(string $field, string $value, bool $bSafe = true) : boolloadBy ($field, $value) Loads an item by colum/field from the database
Inherited from: \Item::loadBy()| Name | Type | Description |
|---|---|---|
| $field | string | Specifies the field |
| $value | string | Specifies the value |
| $bSafe | bool | use inFilter or not |
| Type | Description |
|---|---|
| bool | True if the load was successful |

loadByPrimaryKey(string $value) : boolloadByPrimaryKey ($value) Loads an item by ID from the database
Inherited from: \Item::loadByPrimaryKey()| Name | Type | Description |
|---|---|---|
| $value | string | Specifies the primary key value |
| Type | Description |
|---|---|
| bool | True if the load was successful |

send( $idcatart, $destination = "other", $to = "", $iChunkSize = 0, $iChunk = 0, $sEncoding = "iso-8859-1") : void| Name | Type | Description |
|---|---|---|
| $idcatart | integer specifies id of the 'BlackBox'-acrticle containing the 'BlackBox'-module for management | |
| $destination | string specifies, who will receive the newsletter ("all", "default" = defaultgroup, "selection" = selected groups, "single" = one recepient [e.g. Welcome-Newsletter]) | |
| $to | array specifies, which group of recipients shall receive the newsletter ("all", "default" = defaultgroup, "4,5,6" = group IDs) | |
| $iChunkSize | integer specifies size of chunks when sending in chunks, 0 = don't send in chunks | |
| $iChunk | integer specifies current chunk number when sending in chunks result array array of recipient names/e-mails | |
| $sEncoding |
- Deprecated
- >V4.6.15 - 21.05.2007 Sends a newsletter

sendDirect(integer $iIDCatArt, integer $iIDNewsRcp = false, integer $iIDNewsGroup = false, array $aSendRcps, string $sEncoding = "iso-8859-1") : voidSends test newsletter directly to specified recipients (single or group)
Note: Sending in chunks not supported! Only usable for tests and only a few recipients.
| Name | Type | Description |
|---|---|---|
| $iIDCatArt | integer | idcatart of newsletter handler article |
| $iIDNewsRcp | integer | If specified, newsletter recipient id, ignored, if group specified |
| $iIDNewsGroup | integer | If specified, newsletter recipient group id |
| $aSendRcps | array | As reference: Filled with a list of succesfull recipients |
| $sEncoding | string | Message (and header) encoding, e.g. iso-8859-1 |

sendEMail(integer $iIDCatArt, string $sEMail, string $sName = "", $bSimulatePlugins = true, string $sEncoding = "iso-8859-1") : voidSends test newsletter directly to specified email address
| Name | Type | Description |
|---|---|---|
| $iIDCatArt | integer | idcatart of newsletter handler article |
| $sEMail | string | Recipient email address |
| $sName | string | Optional: Recipient name |
| $bSimulatePlugins | ||
| $sEncoding | string | Message (and header) encoding, e.g. iso-8859-1 |

set(string $field, string $value, $safe = true) : void| Name | Type | Description |
|---|---|---|
| $field | string | Specifies the field to set |
| $value | string | Specifies the value to set |
| $safe |

setField(string $field, string $value, boolean $safe = true) : voidsetField($field, $value) Sets the value of a specific field
Inherited from: \Item::setField()| Name | Type | Description |
|---|---|---|
| $field | string | Specifies the field to set |
| $value | string | Specifies the value to set |
| $safe | boolean | Speficies if we should translate characters |

setFilters(array $arrInFilters = array(), array $arrOutFilters = array()) : voidDefine the filter functions used when data is being stored or retrieved from the database.
Inherited from: \Item::setFilters()Examples:
$obj->setFilters(array('addslashes'), array('stripslashes')); $obj->setFilters(array('htmlencode', 'addslashes'), array('stripslashes', 'htmlencode'));
| Name | Type | Description |
|---|---|---|
| $arrInFilters | array | inFilters array with function names |
| $arrOutFilters | array | outFilters array with function names |

setProperty(string $type, string $name, string $value) : voidsetProperty ($type, $name, $value) Sets a custom property
Inherited from: \Item::setProperty()| Name | Type | Description |
|---|---|---|
| $type | string | Specifies the type |
| $name | string | Specifies the name |
| $value | string | Specifies the value |
\NewsletterCollection
- Parent(s)
- \ItemCollection
- Author
- Timo A. Hummel
- Copyright
- four for business 2003
- Version
- 0.1
Properties

array $_forwardJoinPartnersForward join partners for this data object
- Type
- array
- Access
- private
- Inherited_from
- \ItemCollection::$$_forwardJoinPartners

array $_groupConditions- Type
- array
- Access
- private
- Inherited_from
- \ItemCollection::$$_groupConditions

array $_innerGroupConditions = array()array()Details- Type
- array
- Access
- private
- Inherited_from
- \ItemCollection::$$_innerGroupConditions

array $_resultFields = array()array()Details- Type
- array
- Access
- private
- Inherited_from
- \ItemCollection::$$_resultFields

array $_whereRestriction- Type
- array
- Access
- private
- Inherited_from
- \ItemCollection::$$_whereRestriction

string $table- Type
- string
- Access
- private
- Inherited_from
- \ItemCollection::$$table
Methods

ItemCollection(string $table, $primaryKey, $lifetime = 10) : voidConstructor Function Note: Default lifetime is 10 seconds.
Inherited from: \ItemCollection::ItemCollection()| Name | Type | Description |
|---|---|---|
| $table | string | The table to use as information source |
| $primaryKey | ||
| $lifetime |

_buildGroupWhereStatements() : arrayBuilds a where statement out of the setGroupWhere calls
| Type | Description |
|---|---|
| array | with all where statements |

_buildWhereStatements() : arrayBuilds a where statement out of the setWhere calls
| Type | Description |
|---|---|
| array | with all where statements |

_fetchJoinTables(\none $ignore_root) : arrayFetches all tables which will be joined later on.
The returned array has the following format:
array( array(fields), array(tables), array(joins), array(wheres) );
Notes: The table is the table name which needs to be added to the FROM clause The join statement which is inserted after the master table The where statement is combined with all other where statements The fields to select from
| Name | Type | Description |
|---|---|---|
| $ignore_root | \none |
| Type | Description |
|---|---|
| array | see above |

_findReverseJoinPartner( $parentclass, $classname) : void| Name | Type | Description |
|---|---|---|
| $parentclass | ||
| $classname |

_initializeDriver( $bForceInit = false) : void_initializeDriver: Initializes the driver to use with GenericDB.
Inherited from: \ItemCollection::_initializeDriver()| Name | Type | Description |
|---|---|---|
| $bForceInit | boolean If true, forces the driver to initialize, even if it already exists. |

_recursiveStructuredFetch( $objects, $array) : void| Name | Type | Description |
|---|---|---|
| $objects | ||
| $array |

_setItemClass(string $classname) : \none_setItemClass: private method to set the accompanying item object.
Inherited from: \ItemCollection::_setItemClass()| Name | Type | Description |
|---|---|---|
| $classname | string | specifies the classname |
| Type | Description |
|---|---|
| \none |

_setJoinPartner(string $foreignCollectionClass) : \none_setJoinPartner: Defines the reverse links for this table.
Inherited from: \ItemCollection::_setJoinPartner()Important: The class specified by $foreignCollectionClass needs to be a collection class and has to exist Define all links in the constructor of your object
| Name | Type | Description |
|---|---|---|
| $foreignCollectionClass | string | Specifies the foreign class to use |
| Type | Description |
|---|---|
| \none |

addResultField( $field) : void| Name | Type | Description |
|---|---|---|
| $field |

deleteWhere( $field, $restriction, $operator = "=") : voiddeleteWhere ($field, $restriction, $operator)
Inherited from: \ItemCollection::deleteWhere()Restricts a query with a where clause
| Name | Type | Description |
|---|---|---|
| $field | ||
| $restriction | ||
| $operator |

deleteWhereGroup( $group, $field, $restriction, $operator = "=") : voiddeleteWhereGroup ($group, $field, $restriction, $operator)
Inherited from: \ItemCollection::deleteWhereGroup()Restricts a query with a where clause, groupable
| Name | Type | Description |
|---|---|---|
| $group | ||
| $field | ||
| $restriction | ||
| $operator |

duplicate( $iItemID) : voidDuplicates the newsletter specified by $itemID
| Name | Type | Description |
|---|---|---|
| $iItemID |

exists(integer $id) : boolean| Name | Type | Description |
|---|---|---|
| $id | integer | The id to check for |
| Type | Description |
|---|---|
| boolean | true if object exists, false if not |

fetchArray( $key, $fields) : arrayfetchArray() Fetches an array of fields from the database.
Inherited from: \ItemCollection::fetchArray()Example: $i = $object->fetchArray("idartlang", array("idlang", "name"));
could result in: $i[5] = array("idlang" => 5, "name" => "My Article");
Important: If you don't pass an array for fields, the function doesn't create an array.
| Name | Type | Description |
|---|---|---|
| $key | string Name of the field to use for the key | |
| $fields | mixed String or array |
| Type | Description |
|---|---|
| array | Resulting array |

fetchObject( $class) : void| Name | Type | Description |
|---|---|---|
| $class |

fetchTable( $fields = array(), $objects = array()) : void| Name | Type | Description |
|---|---|---|
| $fields | ||
| $objects |

flexSelect(string $distinct = "", string $from = "", string $where = "", string $group_by = "", string $order_by = "", string $limit = "") : arrayflexSelect ($distinct = "", $from = "", $where = "", $group_by = "", $order_by = "", $limit = "") Selects all entries from the database and returns them as DBObject-objects to the user.
Inherited from: \ItemCollection::flexSelect()Objects are loaded using their primary key.
| Name | Type | Description |
|---|---|---|
| $distinct | string | Specifies if distinct will be added to the SQL statement ($distinct !== "" -> DISTINCT) |
| $from | string | Specifies the additional from clause (e.g. "con_news_groups AS groups, con_news_groupmembers AS groupmembers"). |
| $where | string | Specifies the where clause. |
| $group_by | string | Specifies the group by clause. |
| $order_by | string | Specifies the order by clause. |
| $limit | string | Specifies the limit by clause. |
| Type | Description |
|---|---|
| array | Array of DBObject-Objects |
- Author
- HerrB

link( $foreignClass) : voidsets the query to use foreign tables in the resultset
Inherited from: \ItemCollection::link()| Name | Type | Description |
|---|---|---|
| $foreignClass |

loadItem( $iItemID) : objectLoads an item by its ID (primary key)
Needs to be overridden by the extension class.
| Name | Type | Description |
|---|---|---|
| $iItemID |
| Type | Description |
|---|---|
| object | The newly created object |

queryAndFetchStructured(\objects $objects) : arrayfetchStructured Returns an array of arrays
Inherited from: \ItemCollection::queryAndFetchStructured()| Name | Type | Description |
|---|---|---|
| $objects | \objects | array with the correct order of the objects |
| Type | Description |
|---|---|
| array | result |

removeResultField( $field) : void| Name | Type | Description |
|---|---|---|
| $field |

select(string $where = "", string $group_by = "", string $order_by = "", string $limit = "") : arrayselect ($where = "", $group_by = "", $order_by = "", $limit = "") Selects all entries from the database and returns them as DBObject-objects to the user.
Inherited from: \ItemCollection::select()Objects are loaded using their primary key.
| Name | Type | Description |
|---|---|---|
| $where | string | Specifies the where clause. |
| $group_by | string | Specifies the group by clause. |
| $order_by | string | Specifies the order by clause. |
| $limit | string | Specifies the limit by clause. |
| Type | Description |
|---|---|
| array | Array of DBObject-Objects |

setEncoding( $sEncoding) : void| Name | Type | Description |
|---|---|---|
| $sEncoding |

setGroupCondition( $group1, $group2, $condition = "AND") : voidsetGroupCondition ($group1, $group2, $condition)
Inherited from: \ItemCollection::setGroupCondition()Defines how groups are linked to each other
| Name | Type | Description |
|---|---|---|
| $group1 | ||
| $group2 | ||
| $condition |

setInnerGroupCondition( $group, $condition = "AND") : voidsetInnerGroupCondition ($group, $condition)
Inherited from: \ItemCollection::setInnerGroupCondition()Defines how relations in one group are linked each together
| Name | Type | Description |
|---|---|---|
| $group | ||
| $condition |

setLimit( $iRowStart, $iRowCount) : void| Name | Type | Description |
|---|---|---|
| $iRowStart | ||
| $iRowCount |

setOrder( $order) : void| Name | Type | Description |
|---|---|---|
| $order |

setWhere( $field, $restriction, $operator = "=") : voidRestricts a query with a where clause
| Name | Type | Description |
|---|---|---|
| $field | ||
| $restriction | ||
| $operator |

setWhereGroup( $group, $field, $restriction, $operator = "=") : voidsetWhereGroup ($group, $field, $restriction, $operator)
Inherited from: \ItemCollection::setWhereGroup()Restricts a query with a where clause, groupable
| Name | Type | Description |
|---|---|---|
| $group | ||
| $field | ||
| $restriction | ||
| $operator |