| 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 | * @copyright 2009 Markus Gerdelmann |
|---|
| 9 | * @package de.mdman.application.register |
|---|
| 10 | */ |
|---|
| 11 | class ApplicationRegisterListener implements EventListener { |
|---|
| 12 | public $templateName = 'applicationRegister'; |
|---|
| 13 | public $count = 0; |
|---|
| 14 | |
|---|
| 15 | /** |
|---|
| 16 | * Gets a list of all applications. Hier werden alle UNBEARBEITETEN Bewerbungen aus der Datenbank geladen |
|---|
| 17 | */ |
|---|
| 18 | public function execute($eventObj, $className, $eventName) { |
|---|
| 19 | |
|---|
| 20 | if (APPLICATION_INFO_ENABLE == 1) { |
|---|
| 21 | |
|---|
| 22 | $sql = "SELECT wcf".WCF_N."_group_application.* FROM wcf".WCF_N."_group_application |
|---|
| 23 | LEFT JOIN wcf".WCF_N."_group_application_notification |
|---|
| 24 | ON wcf".WCF_N."_group_application.applicationID = wcf".WCF_N."_group_application_notification.applicationID |
|---|
| 25 | AND wcf".WCF_N."_group_application_notification.userID = ".WCF::getUser()->userID." |
|---|
| 26 | WHERE wcf".WCF_N."_group_application_notification.applicationID IS NULL |
|---|
| 27 | AND wcf".WCF_N."_group_application.groupID IN ( |
|---|
| 28 | SELECT groupID |
|---|
| 29 | FROM wcf".WCF_N."_group_leader |
|---|
| 30 | WHERE userID = ".WCF::getUser()->userID." |
|---|
| 31 | ) |
|---|
| 32 | AND wcf".WCF_N."_group_application.applicationStatus = 0 |
|---|
| 33 | "; |
|---|
| 34 | |
|---|
| 35 | $res = WCF::getDB()->sendQuery($sql); |
|---|
| 36 | $count = WCF::getDB()->countRows($res); |
|---|
| 37 | |
|---|
| 38 | if ($count >= 1){ |
|---|
| 39 | //Hier werden die Variablen im Template registriert |
|---|
| 40 | WCF::getTPL()->assign(array( |
|---|
| 41 | 'count' => $count, |
|---|
| 42 | )); |
|---|
| 43 | //Hier wird das Template in dem Platzhalter userMessages integriert. |
|---|
| 44 | if(!defined("APPLICATION_REGISTER_TPL")) { |
|---|
| 45 | WCF::getTPL()->append('userMessages', WCF::getTPL()->fetch('applicationRegister')); |
|---|
| 46 | define("APPLICATION_REGISTER_TPL",1); |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | } |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | ?> |
|---|