| 1 | <?php |
|---|
| 2 | // WCF includes |
|---|
| 3 | require_once(WCF_DIR.'lib/system/event/EventListener.class.php'); |
|---|
| 4 | |
|---|
| 5 | /** |
|---|
| 6 | * more options to groupleaders |
|---|
| 7 | * |
|---|
| 8 | * @author Markus Gerdelmann, Torben Brodt |
|---|
| 9 | * @package de.mdman.application.register |
|---|
| 10 | * @license GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> |
|---|
| 11 | */ |
|---|
| 12 | class UserGroupAdministrateMailListener implements EventListener { |
|---|
| 13 | protected $eventObj; |
|---|
| 14 | protected $className; |
|---|
| 15 | |
|---|
| 16 | //data |
|---|
| 17 | protected $displayNotification=0, $emailNotification=0; |
|---|
| 18 | |
|---|
| 19 | /** |
|---|
| 20 | * @see EventListener::execute() |
|---|
| 21 | */ |
|---|
| 22 | public function execute($eventObj, $className, $eventName) { |
|---|
| 23 | $this->eventObj = $eventObj; |
|---|
| 24 | $this->className = $className; |
|---|
| 25 | |
|---|
| 26 | switch ($eventName) { |
|---|
| 27 | case 'readData': |
|---|
| 28 | $this->readData(); |
|---|
| 29 | break; |
|---|
| 30 | case 'assignVariables': |
|---|
| 31 | $this->assignVariables(); |
|---|
| 32 | break; |
|---|
| 33 | } |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | /** |
|---|
| 37 | * reads data |
|---|
| 38 | */ |
|---|
| 39 | protected function readData() { |
|---|
| 40 | $sql = "SELECT displayNotification, |
|---|
| 41 | emailNotification |
|---|
| 42 | FROM wcf".WCF_N."_group_application_mail |
|---|
| 43 | WHERE groupID = ".intval($this->eventObj->groupID)." |
|---|
| 44 | AND userID = ".WCF::getUser()->userID; |
|---|
| 45 | $row = WCF::getDB()->getFirstRow($sql); |
|---|
| 46 | if($row) { |
|---|
| 47 | $this->displayNotification = intval($row['displayNotification']); |
|---|
| 48 | $this->emailNotification = intval($row['emailNotification']); |
|---|
| 49 | } |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | /** |
|---|
| 53 | * assigns variables |
|---|
| 54 | */ |
|---|
| 55 | protected function assignVariables() { |
|---|
| 56 | WCF::getTPL()->assign(array( |
|---|
| 57 | 'groupID' => $this->eventObj->groupID, |
|---|
| 58 | 'display' => $this->displayNotification, |
|---|
| 59 | 'email' => $this->emailNotification, |
|---|
| 60 | 'groupType' => $this->eventObj->group->groupType |
|---|
| 61 | )); |
|---|
| 62 | WCF::getTPL()->append('additionalFields1', WCF::getTPL()->fetch('userGroupApplyMail')); |
|---|
| 63 | } |
|---|
| 64 | } |
|---|
| 65 | ?> |
|---|