| 1 | <?php |
|---|
| 2 | require_once(WCF_DIR.'lib/system/event/EventListener.class.php'); |
|---|
| 3 | |
|---|
| 4 | /** |
|---|
| 5 | * Zeigt dem Gruppenleiter einen Hinweis bei Bewerbung eines Users in einer Gruppe |
|---|
| 6 | * |
|---|
| 7 | * @author Markus Gerdelmann |
|---|
| 8 | * @package de.mdman.application.register |
|---|
| 9 | */ |
|---|
| 10 | class ApplicationRegisterListener implements EventListener { |
|---|
| 11 | public $templateName = 'applicationRegister'; |
|---|
| 12 | public $count = 0; |
|---|
| 13 | |
|---|
| 14 | /** |
|---|
| 15 | * Gets a list of all applications. Hier werden alle UNBEARBEITETEN Bewerbungen aus der Datenbank geladen |
|---|
| 16 | */ |
|---|
| 17 | public function execute($eventObj, $className, $eventName) { |
|---|
| 18 | $sql = "SELECT wcf".WCF_N."_group_application.* FROM wcf".WCF_N."_group_application |
|---|
| 19 | LEFT JOIN wcf".WCF_N."_group_application_notification |
|---|
| 20 | ON wcf".WCF_N."_group_application.applicationID = wcf".WCF_N."_group_application_notification.applicationID |
|---|
| 21 | AND wcf".WCF_N."_group_application_notification.userID = ".WCF::getUser()->userID." |
|---|
| 22 | WHERE wcf".WCF_N."_group_application_notification.applicationID IS NULL |
|---|
| 23 | AND wcf".WCF_N."_group_application.groupID IN ( |
|---|
| 24 | SELECT groupID |
|---|
| 25 | FROM wcf".WCF_N."_group_leader |
|---|
| 26 | WHERE userID = ".WCF::getUser()->userID." |
|---|
| 27 | ) |
|---|
| 28 | AND wcf".WCF_N."_group_application.applicationStatus = 0 |
|---|
| 29 | "; |
|---|
| 30 | |
|---|
| 31 | $res = WCF::getDB()->sendQuery($sql); |
|---|
| 32 | $count = WCF::getDB()->countRows($res); |
|---|
| 33 | |
|---|
| 34 | if ($count >= 1){ |
|---|
| 35 | //Hier werden die Variablen im Template registriert |
|---|
| 36 | WCF::getTPL()->assign(array( |
|---|
| 37 | 'count' => $count, |
|---|
| 38 | )); |
|---|
| 39 | //Hier wird das Template in dem Platzhalter userMessages integriert. |
|---|
| 40 | if (strpos(WCF::getTPL()->get('userMessages'), WCF::getTPL()->fetch('applicationRegister')) === false) { |
|---|
| 41 | WCF::getTPL()->append('userMessages', WCF::getTPL()->fetch('applicationRegister')); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | } |
|---|
| 49 | ?> |
|---|