Modules/Groupware/Email/Account/Model/Account.php
\Conjoon_Modules_Groupware_Email_Account_Model_Account
Table data gateway. Models the table <tt>groupware_email_accounts</tt>.
- Parent(s)
- \Conjoon_BeanContext_Decoratable < ?\Zend_Db_Table
- Author
- Thorsten Suckow-Homberg
- Category
- Model
- Uses
- \Conjoon_Db_Table
Properties

string
$_name= ''groupware_email_accounts''
The name of the table in the underlying datastore this class represents.
'groupware_email_accounts'Details- Type
- string

string
$_primary= ''id''
The name of the column that denotes the primary key for this table
'id'Details- Type
- string

String
$_tblPrefix= '""'
""Details- Type
- String
- Inherited_from
- \Conjoon_Db_Table::$$_tblPrefix
Methods

__construct(
string | array $config
=
array(), \unknown_type $definition
=
null
)
:
void__construct() - For concrete implementation of Conjoon_Db_Table
Inherited from: \Conjoon_Db_Table::__construct()This constructor automatically prepends the prefix as defined using setTablePrefix() to this table's name.
| Name | Type | Description |
|---|---|---|
| $config | string | array | string can reference a Zend_Registry key for a db adapter OR it can refernece the name of a table |
| $definition | \unknown_type |

_removeInformationForAccountIf(
$accountId, $userId
)
:
void| Name | Type | Description |
|---|---|---|
| $accountId | ||
| $userId |

addAccount(
integer $userId, array $data
)
:
integerAdds an account for the specified user with the specified data.
| Name | Type | Description |
|---|---|---|
| $userId | integer | The userid this account will belong to |
| $data | array | an assoc array with keys as fields and values as data to add Will also take the default folder of the user and copy them so emails for this account will also be stored in this folders. |
| Type | Description |
|---|---|
| integer | 0 if the data wasn't added, otherwise the id of the newly added row |

deleteAccount(
integer $accountId, integer $userId
)
:
integerSets the is_deleted flag of the account to "0", which basically means that this account is not active anymore. However, in order for older email items to still work properly, folder mappings have to remain, until no item for this account is found in the database. After that, the account may be removed entirely.
| Name | Type | Description |
|---|---|---|
| $accountId | integer | |
| $userId | integer |
| Type | Description |
|---|---|
| integer | The number of accounts deleted. |

getAccount(
$accountId, int $userId
)
:
\Zend_Db_Table_RowsetReturns the account with the specified id for the specified user
| Name | Type | Description |
|---|---|---|
| $accountId | ||
| $userId | int | The id of the user to whom the specified account belongs |
| Type | Description |
|---|---|
| \Zend_Db_Table_Rowset |

getAccountWithNameForUser(
string $name, int $userId
)
:
arrayReturns the accounts with the specified name for the specified user Returns an empty array if no accounts with this name could be found.
| Name | Type | Description |
|---|---|---|
| $name | string | The name of the accounts to query |
| $userId | int | The id of the user to whom the specified accounts belongs |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Conjoon_Argument_Exception |

getAccountsForUser(
int $id
)
:
\Zend_Db_Table_RowsetReturns all email accounts for the specified user-id.
Note, that the field 'user_id' won't be available in the returned array.
| Name | Type | Description |
|---|---|---|
| $id | int | The id of the user to get the email accounts for |
| Type | Description |
|---|---|
| \Zend_Db_Table_Rowset |

getEmailAddressesForUser(
int $id
)
:
arrayReturns all email addresses which are configured for a user.
This takes also reply-addresses into account.
| Name | Type | Description |
|---|---|---|
| $id | int | The id of the user to get the email addresses for |
| Type | Description |
|---|---|
| array | A numeric array with all email addresses found in the accounts from the user |

getStandardAccountIdForUser(
$userId
)
:
integerReturns the id of the standard account for this user. If no standard account could be found, any other account id will be returned.
If no account was found, 0 will be returned.
| Name | Type | Description |
|---|---|---|
| $userId |
| Type | Description |
|---|---|
| integer |

removeAsDeletedFlaggedAccounts(
integer $userId
)
:
arrayRemoves any account which is flagged as "is_deleted=1" along with its informations, if there are no items for this account in the related folders anymore.
| Name | Type | Description |
|---|---|---|
| $userId | integer |
| Type | Description |
|---|---|
| array | An array with the deleted account ids |

updateAccount(
integer $id, array $data
)
:
integerUpdates an account with the specified data.
| Name | Type | Description |
|---|---|---|
| $id | integer | The id of the account to update |
| $data | array | an assoc array with keys as fields and values as data to update |
| Type | Description |
|---|---|
| integer | The number of rows updated. If any input error happened, -1 will be returned. 0 will be returned, if the data was not changed, i.e. if the row equaled to teh data tried to update. 1 will be returned if any changes to the data has been made. |