Commit a66d226d3ee39af0dc3d84c8f43d44b768a9e804

Authored by nbm
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,61 +84,28 @@ class User extends KTEntity {
84 return $default->users_table; 84 return $default->users_table;
85 } 85 }
86 86
87 - /** Get the user's login name */  
88 function getUserName() { return $this->sUserName; } 87 function getUserName() { return $this->sUserName; }
89 - /** Set the user's login name */  
90 function setUserName($sNewValue) { $this->sUserName = $sNewValue; } 88 function setUserName($sNewValue) { $this->sUserName = $sNewValue; }
91 -  
92 - /** Set the user's password */  
93 function setPassword($sNewValue) { $this->sPassword = $sNewValue; $this->bPasswordChanged = true; } 89 function setPassword($sNewValue) { $this->sPassword = $sNewValue; $this->bPasswordChanged = true; }
94 - /** Get the user's maximum disk quota */  
95 function getQuotaMax() { return $this->iQuotaMax; } 90 function getQuotaMax() { return $this->iQuotaMax; }
96 - /** Set the user's maximum disk quota */  
97 function setQuotaMax($iNewValue) { $this->iQuotaMax = $iNewValue; } 91 function setQuotaMax($iNewValue) { $this->iQuotaMax = $iNewValue; }
98 -  
99 - /** Set the user's name */  
100 function setName($sNewValue) { $this->sName = $sNewValue; } 92 function setName($sNewValue) { $this->sName = $sNewValue; }
101 - /** gets the user's name */  
102 function getName() { return $this->sName; } 93 function getName() { return $this->sName; }
103 -  
104 - /** Get the user's currrently used quota */  
105 function getQuotaCurrent() { return $this->iQuotaCurrent; } 94 function getQuotaCurrent() { return $this->iQuotaCurrent; }
106 -  
107 - /** Get the user's email address */  
108 function getEmail() { return $this->sEmail; } 95 function getEmail() { return $this->sEmail; }
109 - /** Set the user's email address */  
110 function setEmail($sNewValue) { $this->sEmail = $sNewValue; } 96 function setEmail($sNewValue) { $this->sEmail = $sNewValue; }
111 -  
112 - /** Get the user's mobile phone number */  
113 function getMobile() { return $this->sMobile; } 97 function getMobile() { return $this->sMobile; }
114 - /** Set the user's mobile phone number */  
115 function setMobile($sNewValue) { $this->sMobile = $sNewValue; } 98 function setMobile($sNewValue) { $this->sMobile = $sNewValue; }
116 -  
117 - /** Get the user's email notification status */  
118 function getEmailNotification() { return $this->bEmailNotification; } 99 function getEmailNotification() { return $this->bEmailNotification; }
119 - /** Set the user's email notification status */  
120 function setEmailNotification($bNewValue) { $this->bEmailNotification = KTUtil::anyToBool($bNewValue); } 100 function setEmailNotification($bNewValue) { $this->bEmailNotification = KTUtil::anyToBool($bNewValue); }
121 -  
122 - /** Get the user's SMS (mobile phone) notification status */  
123 function getSmsNotification() { return $this->bSmsNotification; } 101 function getSmsNotification() { return $this->bSmsNotification; }
124 - /** Set the user's SMS (mobile phone) notification status */  
125 function setSmsNotification($bNewValue) { $this->bSmsNotification = $bNewValue; } 102 function setSmsNotification($bNewValue) { $this->bSmsNotification = $bNewValue; }
126 -  
127 - /** Get the user's LDAP distinguished name */  
128 function getLdapDn() { return $this->sLdapDn; } 103 function getLdapDn() { return $this->sLdapDn; }
129 - /** Set the user's LDAP distinguished name */  
130 function setLdapDn($sNewValue) { $this->sLdapDn = $sNewValue; } 104 function setLdapDn($sNewValue) { $this->sLdapDn = $sNewValue; }
131 -  
132 - /** Get the user's maximum number of concurrent sessions */  
133 function getMaxSessions() { return $this->iMaxSessions; } 105 function getMaxSessions() { return $this->iMaxSessions; }
134 - /** Set the user's maximum number of concurrent sessions */  
135 function setMaxSessions($iNewValue) { $this->iMaxSessions = $iNewValue; } 106 function setMaxSessions($iNewValue) { $this->iMaxSessions = $iNewValue; }
136 -  
137 - /** Get the primary key for the language preferred by the user */  
138 function getLanguageID() { return $this->iLanguageIDID; } 107 function getLanguageID() { return $this->iLanguageIDID; }
139 - /** Set the primary key of the language preferred by the user */  
140 function setLanguageID($iNewValue) { $this->iLanguageIDID = $iNewValue; } 108 function setLanguageID($iNewValue) { $this->iLanguageIDID = $iNewValue; }
141 -  
142 function getAuthenticationSourceId() { return $this->iAuthenticationSourceId; } 109 function getAuthenticationSourceId() { return $this->iAuthenticationSourceId; }
143 function setAuthenticationSourceId($iNewValue) { $this->iAuthenticationSourceId = $iNewValue; } 110 function setAuthenticationSourceId($iNewValue) { $this->iAuthenticationSourceId = $iNewValue; }
144 function getAuthenticationDetails() { return $this->sAuthenticationDetails; } 111 function getAuthenticationDetails() { return $this->sAuthenticationDetails; }
@@ -214,6 +181,21 @@ class User extends KTEntity { @@ -214,6 +181,21 @@ class User extends KTEntity {
214 return KTEntityUtil::getList(User::_table(), 'User', $sWhereClause); 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 * Static function 200 * Static function
219 * Return the unitIDs of the specified user 201 * Return the unitIDs of the specified user