| 1 | <?php |
|---|
| 2 | // WCF include |
|---|
| 3 | require_once(WCF_DIR.'lib/system/event/EventListener.class.php'); |
|---|
| 4 | |
|---|
| 5 | /** |
|---|
| 6 | * Zeigt dem Gruppenleiter einen Hinweis bei Bewerbung eines Users in einer Gruppe |
|---|
| 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 ApplicationRegisterListener implements EventListener { |
|---|
| 13 | protected static $check = false; |
|---|
| 14 | |
|---|
| 15 | public $templateName = 'applicationRegister'; |
|---|
| 16 | public $count = 0; |
|---|
| 17 | |
|---|
| 18 | /** |
|---|
| 19 | * Gets a list of all applications. Hier werden alle UNBEARBEITETEN Bewerbungen aus der Datenbank geladen |
|---|
| 20 | */ |
|---|
| 21 | public function execute($eventObj, $className, $eventName) { |
|---|
| 22 | if(self::$check || WCF::getUser()->userID == 0) return; |
|---|
| 23 | self::$check = true; |
|---|
| 24 | |
|---|
| 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 | SELECT groupID |
|---|
| 30 | FROM wcf".WCF_N."_group_leader |
|---|
| 31 | WHERE userID = ".WCF::getUser()->userID." |
|---|
| 32 | ) |
|---|
| 33 | AND notification.userID = ".WCF::getUser()->userID." |
|---|
| 34 | AND application.applicationStatus = 0"; |
|---|
| 35 | |
|---|
| 36 | $row = WCF::getDB()->getFirstRow($sql); |
|---|
| 37 | |
|---|
| 38 | if (intval($row['c']) > 0){ |
|---|
| 39 | //Hier werden die Variablen im Template registriert |
|---|
| 40 | WCF::getTPL()->assign(array( |
|---|
| 41 | 'count' => $row['c'] |
|---|
| 42 | )); |
|---|
| 43 | |
|---|
| 44 | //Hier wird das Template in dem Platzhalter userMessages integriert. |
|---|
| 45 | WCF::getTPL()->append('userMessages', WCF::getTPL()->fetch('applicationRegister')); |
|---|
| 46 | } |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | ?> |
|---|