Commit a66d226d3ee39af0dc3d84c8f43d44b768a9e804
1 parent
ff18f093
Implement getEmailUsers, which returns all users with email
notifications enabled and an email address set. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4733 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
15 additions
and
33 deletions
lib/users/User.inc
| ... | ... | @@ -84,61 +84,28 @@ class User extends KTEntity { |
| 84 | 84 | return $default->users_table; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - /** Get the user's login name */ | |
| 88 | 87 | function getUserName() { return $this->sUserName; } |
| 89 | - /** Set the user's login name */ | |
| 90 | 88 | function setUserName($sNewValue) { $this->sUserName = $sNewValue; } |
| 91 | - | |
| 92 | - /** Set the user's password */ | |
| 93 | 89 | function setPassword($sNewValue) { $this->sPassword = $sNewValue; $this->bPasswordChanged = true; } |
| 94 | - /** Get the user's maximum disk quota */ | |
| 95 | 90 | function getQuotaMax() { return $this->iQuotaMax; } |
| 96 | - /** Set the user's maximum disk quota */ | |
| 97 | 91 | function setQuotaMax($iNewValue) { $this->iQuotaMax = $iNewValue; } |
| 98 | - | |
| 99 | - /** Set the user's name */ | |
| 100 | 92 | function setName($sNewValue) { $this->sName = $sNewValue; } |
| 101 | - /** gets the user's name */ | |
| 102 | 93 | function getName() { return $this->sName; } |
| 103 | - | |
| 104 | - /** Get the user's currrently used quota */ | |
| 105 | 94 | function getQuotaCurrent() { return $this->iQuotaCurrent; } |
| 106 | - | |
| 107 | - /** Get the user's email address */ | |
| 108 | 95 | function getEmail() { return $this->sEmail; } |
| 109 | - /** Set the user's email address */ | |
| 110 | 96 | function setEmail($sNewValue) { $this->sEmail = $sNewValue; } |
| 111 | - | |
| 112 | - /** Get the user's mobile phone number */ | |
| 113 | 97 | function getMobile() { return $this->sMobile; } |
| 114 | - /** Set the user's mobile phone number */ | |
| 115 | 98 | function setMobile($sNewValue) { $this->sMobile = $sNewValue; } |
| 116 | - | |
| 117 | - /** Get the user's email notification status */ | |
| 118 | 99 | function getEmailNotification() { return $this->bEmailNotification; } |
| 119 | - /** Set the user's email notification status */ | |
| 120 | 100 | function setEmailNotification($bNewValue) { $this->bEmailNotification = KTUtil::anyToBool($bNewValue); } |
| 121 | - | |
| 122 | - /** Get the user's SMS (mobile phone) notification status */ | |
| 123 | 101 | function getSmsNotification() { return $this->bSmsNotification; } |
| 124 | - /** Set the user's SMS (mobile phone) notification status */ | |
| 125 | 102 | function setSmsNotification($bNewValue) { $this->bSmsNotification = $bNewValue; } |
| 126 | - | |
| 127 | - /** Get the user's LDAP distinguished name */ | |
| 128 | 103 | function getLdapDn() { return $this->sLdapDn; } |
| 129 | - /** Set the user's LDAP distinguished name */ | |
| 130 | 104 | function setLdapDn($sNewValue) { $this->sLdapDn = $sNewValue; } |
| 131 | - | |
| 132 | - /** Get the user's maximum number of concurrent sessions */ | |
| 133 | 105 | function getMaxSessions() { return $this->iMaxSessions; } |
| 134 | - /** Set the user's maximum number of concurrent sessions */ | |
| 135 | 106 | function setMaxSessions($iNewValue) { $this->iMaxSessions = $iNewValue; } |
| 136 | - | |
| 137 | - /** Get the primary key for the language preferred by the user */ | |
| 138 | 107 | function getLanguageID() { return $this->iLanguageIDID; } |
| 139 | - /** Set the primary key of the language preferred by the user */ | |
| 140 | 108 | function setLanguageID($iNewValue) { $this->iLanguageIDID = $iNewValue; } |
| 141 | - | |
| 142 | 109 | function getAuthenticationSourceId() { return $this->iAuthenticationSourceId; } |
| 143 | 110 | function setAuthenticationSourceId($iNewValue) { $this->iAuthenticationSourceId = $iNewValue; } |
| 144 | 111 | function getAuthenticationDetails() { return $this->sAuthenticationDetails; } |
| ... | ... | @@ -214,6 +181,21 @@ class User extends KTEntity { |
| 214 | 181 | return KTEntityUtil::getList(User::_table(), 'User', $sWhereClause); |
| 215 | 182 | } |
| 216 | 183 | |
| 184 | + function getEmailUsers() { | |
| 185 | + $aEnabledUsers = KTEntityUtil::getByDict('User', array( | |
| 186 | + 'email_notification' => true, | |
| 187 | + ), array( | |
| 188 | + 'multi' => true, | |
| 189 | + )); | |
| 190 | + $aUsers = array(); | |
| 191 | + foreach ($aEnabledUsers as $oUser) { | |
| 192 | + if ($oUser->getEmail()) { | |
| 193 | + $aUsers[] = $oUser; | |
| 194 | + } | |
| 195 | + } | |
| 196 | + return $aUsers; | |
| 197 | + } | |
| 198 | + | |
| 217 | 199 | /** |
| 218 | 200 | * Static function |
| 219 | 201 | * Return the unitIDs of the specified user | ... | ... |