Changeset 298
- Timestamp:
- 03/08/08 20:20:34 (5 years ago)
- Location:
- application.register
- Files:
-
- 5 modified
-
files/lib/action/DisableApplicationRegisterNotificationsAction.class.php (modified) (1 diff)
-
files/lib/system/event/listener/ApplicationRegisterListener.class.php (modified) (3 diffs)
-
files/lib/system/event/listener/UserGroupAdministrateMailListener.class.php (modified) (1 diff)
-
files/lib/system/event/listener/UserGroupApplyMailListener.class.php (modified) (3 diffs)
-
install.sql (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
application.register/files/lib/action/DisableApplicationRegisterNotificationsAction.class.php
r296 r298 5 5 * UnterdrÃŒckt die Info-Box fÃŒr das Bewerbungshinweis Benutzergruppen - PlugIn durch einen Eintrag in die Datenbank. 6 6 * 7 * @author Markus Gerdelmann 8 * @copyright 2007/2008 MDMAN 9 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> 10 * @package de.mdman.application.register 7 * @author Markus Gerdelmann, Torben Brodt 8 * @package de.mdman.application.register 9 * @license GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 11 10 */ 12 13 11 class DisableApplicationRegisterNotificationsAction extends AbstractAction { 14 12 13 /** 14 * @see AbstractAction::execute() 15 */ 15 16 public function execute() { 16 parent::execute();17 parent::execute(); 17 18 18 $sql = "SELECT FROM wcf".WCF_N."_group_application applicationID, userID 19 WHERE userID = ".WCF::getUser()->userID.""; 20 $res = WCF::getDB()->sendQuery($sql); 21 while ($row = WCF::getDB()->fetchArray($res)){ 22 $daten[]=$row; 23 } 24 25 while ($daten){ 26 $sql = "INSERT INTO wcf".WCF_N."_group_application_notification 27 SET userID = ".$daten["userID"].", 28 applicationID = ".$daten["applicationID"].", 29 disableNotifications = '1' 30 "; 19 $sql = "DELETE FROM wcf".WCF_N."_group_application_notification 20 WHERE userID = ".WCF::getUser()->userID; 31 21 WCF::getDB()->sendQuery($sql); 32 }33 22 } 34 23 } -
application.register/files/lib/system/event/listener/ApplicationRegisterListener.class.php
r296 r298 1 1 <?php 2 // WCF include 2 3 require_once(WCF_DIR.'lib/system/event/EventListener.class.php'); 3 4 … … 5 6 * Zeigt dem Gruppenleiter einen Hinweis bei Bewerbung eines Users in einer Gruppe 6 7 * 7 * @author Markus Gerdelmann 8 * @author Markus Gerdelmann, Torben Brodt 8 9 * @package de.mdman.application.register 10 * @license GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 9 11 */ 10 12 class ApplicationRegisterListener implements EventListener { 11 13 protected static $check = false; 14 12 15 public $templateName = 'applicationRegister'; 13 16 public $count = 0; … … 17 20 */ 18 21 public function execute($eventObj, $className, $eventName) { 19 if(self::$check ) return;22 if(self::$check || WCF::getUser()->userID == 0) return; 20 23 self::$check = true; 21 24 22 $sql = "SELECT usergroup.*, application.*, user.username, application_notification 23 FROM wcf".WCF_N."_group_application application 24 LEFT JOIN wcf".WCF_N."_group usergroup 25 ON (usergroup.groupID = application.groupID) 26 LEFT JOIN wcf".WCF_N."_user user 27 ON (user.userID = application.userID) 28 WHERE application.groupID IN ( 25 $sql = "SELECT COUNT(*) AS c 26 FROM wcf".WCF_N."_group_application_notification 27 NATURAL JOIN wcf".WCF_N."_group_application application 28 WHERE application.groupID IN ( 29 29 SELECT groupID 30 30 FROM wcf".WCF_N."_group_leader 31 31 WHERE userID = ".WCF::getUser()->userID." 32 32 ) 33 AND (application_notification.disableNotification != '1' 34 AND application_notification.userID = ".WCF::getDB()->userID." 35 ) 36 AND application.applicationStatus = '0' 37 "; 33 AND notification.userID = ".WCF::getUser()->userID." 34 AND application.applicationStatus = 0"; 38 35 39 $res = WCF::getDB()->sendQuery($sql); 40 $count = WCF::getDB()->countRows($res); 36 $row = WCF::getDB()->getFirstRow($sql); 41 37 42 if ( $count >= 1){43 //Hier werden die Variablen im Template registriert38 if (intval($row['c']) > 0){ 39 //Hier werden die Variablen im Template registriert 44 40 WCF::getTPL()->assign(array( 45 'count' => $count, 46 )); 47 //Hier wird das Template in dem Platzhalter userMessages integriert. 41 'count' => $row['c'] 42 )); 43 44 //Hier wird das Template in dem Platzhalter userMessages integriert. 48 45 WCF::getTPL()->append('userMessages', WCF::getTPL()->fetch('applicationRegister')); 49 46 } 50 51 47 } 52 53 48 } 54 49 ?> -
application.register/files/lib/system/event/listener/UserGroupAdministrateMailListener.class.php
r292 r298 6 6 * more options to groupleaders 7 7 * 8 * @author Torben Brodt9 * @package de. easy-coding.wcf.groupapplymail8 * @author Markus Gerdelmann, Torben Brodt 9 * @package de.mdman.application.register 10 10 * @license GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 11 11 */ -
application.register/files/lib/system/event/listener/UserGroupApplyMailListener.class.php
r292 r298 4 4 5 5 /** 6 * sends emails to group leaders 6 * sends emails to group leaders and places a display notification 7 7 * 8 * @author Torben Brodt9 * @package de. easy-coding.wcf.groupapplymail8 * @author Markus Gerdelmann, Torben Brodt 9 * @package de.mdman.application.register 10 10 * @license GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 11 11 */ 12 12 class UserGroupApplyMailListener implements EventListener { 13 protected $this->eventObj; 13 14 14 15 /** … … 16 17 */ 17 18 public function execute($eventObj, $className, $eventName) { 19 $this->eventObj = $eventObj; 20 21 // requires 18 22 require_once(WCF_DIR.'lib/data/mail/Mail.class.php'); 19 23 require_once(WCF_DIR.'lib/system/language/Language.class.php'); 20 24 21 25 // send notifications 22 $languages = array(); 23 $languages[WCF::getLanguage()->getLanguageID()] = WCF::getLanguage(); 24 $languages[0] = WCF::getLanguage(); 25 $sql = "SELECT user.* 26 FROM wcf".WCF_N."_groupapplymail 26 $sql = "SELECT user.*, 27 displayNotification, 28 emailNotification 29 FROM wcf".WCF_N."_group_application_mail 27 30 NATURAL JOIN wcf".WCF_N."_user user 28 WHERE groupID = ".intval($ eventObj->group->groupID)."31 WHERE groupID = ".intval($this->eventObj->group->groupID)." 29 32 AND emailNotification = 1"; 30 33 $result = WCF::getDB()->sendQuery($sql); 31 34 while ($row = WCF::getDB()->fetchArray($result)) { 32 35 if ($row['userID'] == WCF::getUser()->userID) { 33 //continue;36 continue; 34 37 } 35 38 36 // get language 37 if (!isset($languages[$row['languageID']])) { 38 $languages[$row['languageID']] = new Language($row['languageID']); 39 if($row['displayNotification']) { 40 $this->display($row); 39 41 } 40 41 // enable language 42 $languages[$row['languageID']]->setLocale(); 43 44 // send mail 45 $subjectData = array( 46 '$author' => WCF::getUser()->username, 47 '$group' => $eventObj->group, 48 'PAGE_TITLE' => PAGE_TITLE 49 ); 50 $messageData = array( 51 '$author' => WCF::getUser()->username, 52 '$group' => $eventObj->group, 53 'PAGE_TITLE' => PAGE_TITLE, 54 '$pageurl' => FileUtil::addTrailingSlash(PAGE_URL), 55 '$recipient' => $row['username'], 56 '$reason' => isset($eventObj->reason) ? $eventObj->reason : '' 57 ); 58 59 $mail = new Mail(array($row['username'] => $row['email']), $languages[$row['languageID']]->get('wcf.groupapplymail.mail.subject.'.$eventObj->group->groupType, $subjectData), $languages[$row['languageID']]->get('wcf.groupapplymail.mail.body.'.$eventObj->group->groupType, $messageData)); 60 $mail->send(); 42 if($row['emailNotification']) { 43 $this->email($row); 44 } 61 45 } 62 46 … … 64 48 WCF::getLanguage()->setLocale(); 65 49 } 50 51 /** 52 * 53 */ 54 protected function display($row) { 55 $sql = "INSERT INTO wcf".WCF_N."_group_application_notification 56 (applicationID, userID) 57 VALUES (".$this->eventObj->applicationID.", ".$row['userID'].")"; 58 WCF::getDB()->sendQuery($sql); 59 } 60 61 /** 62 * 63 */ 64 protected function email($row) { 65 $languages = array(); 66 $languages[WCF::getLanguage()->getLanguageID()] = WCF::getLanguage(); 67 $languages[0] = WCF::getLanguage(); 68 69 // get language 70 if (!isset($languages[$row['languageID']])) { 71 $languages[$row['languageID']] = new Language($row['languageID']); 72 } 73 74 // enable language 75 $languages[$row['languageID']]->setLocale(); 76 77 // send mail 78 $subjectData = array( 79 '$author' => WCF::getUser()->username, 80 '$group' => $this->eventObj->group, 81 'PAGE_TITLE' => PAGE_TITLE 82 ); 83 $messageData = array( 84 '$author' => WCF::getUser()->username, 85 '$group' => $this->eventObj->group, 86 'PAGE_TITLE' => PAGE_TITLE, 87 '$pageurl' => FileUtil::addTrailingSlash(PAGE_URL), 88 '$recipient' => $row['username'], 89 '$reason' => isset($this->eventObj->reason) ? $this->eventObj->reason : '' 90 ); 91 92 $mail = new Mail(array($row['username'] => $row['email']), $languages[$row['languageID']]->get('wcf.groupapplymail.mail.subject.'.$this->eventObj->group->groupType, $subjectData), $languages[$row['languageID']]->get('wcf.groupapplymail.mail.body.'.$this->eventObj->group->groupType, $messageData)); 93 $mail->send(); 94 } 66 95 } 67 96 ?> -
application.register/install.sql
r295 r298 1 2 1 DROP TABLE IF EXISTS wcf1_group_application_mail; 3 2 CREATE TABLE IF NOT EXISTS wcf1_group_application_mail ( 4 3 userID int(10) unsigned NOT NULL, … … 9 8 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 10 9 10 DROP TABLE IF EXISTS wcf1_group_application_notification; 11 11 CREATE TABLE IF NOT EXISTS wcf1_group_application_notification ( 12 12 applicationID int(11) unsigned NOT NULL, 13 13 userID int(10) unsigned NOT NULL, 14 disableNotification TINYINT(1) unsigned NOT NULL,15 14 PRIMARY KEY (applicationID,userID) 16 15 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
