Changeset 104

Show
Ignore:
Timestamp:
11/21/07 21:53:19 (5 years ago)
Author:
d0nut
Message:

donation system changed

Location:
donation
Files:
1 added
11 modified
1 copied
6 moved

Legend:

Unmodified
Added
Removed
  • donation/eventlistener.xml

    r81 r104  
    44        <import>         
    55                <eventlistener> 
    6                         <eventclassname>DonationForm</eventclassname> 
     6                        <eventclassname>DonationAddForm</eventclassname> 
    77                        <eventname>assignVariables</eventname> 
    8                         <listenerclassfile>lib/system/event/listener/DonationFormBankListener.class.php</listenerclassfile> 
     8                        <listenerclassfile>lib/system/event/listener/DonationAddFormBankListener.class.php</listenerclassfile> 
    99                </eventlistener> 
    1010                <!-- admin --> 
  • donation/files/lib/acp/form/DonationAddForm.php

    r88 r104  
    108108                                FROM            wcf".WCF_N."_donation 
    109109                                WHERE           donationID = ".$this->donationID; 
     110 
    110111                        $row = WCF::getDB()->getFirstRow($sql); 
    111112                        $this->system = $row['system']; 
  • donation/files/lib/form/DonationForm.class.php

    r84 r104  
    77 * @author      Torben Brodt 
    88 * @package     de.easy-coding.wcf.donation 
    9  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> 
     9 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1010 */ 
    1111class DonationForm extends AbstractForm { 
  • donation/files/lib/system/event/listener/DonationAddFormBankListener.class.php

    r86 r104  
    88 * @author      Torben Brodt 
    99 * @package     de.easy-coding.wcf.donation 
    10  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> 
     10 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1111 */ 
    12 class DonationFormBankListener implements EventListener { 
     12class DonationAddFormBankListener implements EventListener { 
     13        protected $system = 'bank'; 
     14        protected $prefix = 'donation_bank_'; 
     15        protected $eventObj; 
    1316 
    1417        /** 
     
    1619         */ 
    1720        public function execute($eventObj, $className, $eventName) { 
    18                 $arr = array(); 
    19                 $keys = array( 
    20                                 'donation_bank_accountholder', 
    21                                 'donation_bank_accountnr', 
    22                                 'donation_bank_bankcode', 
    23                                 'donation_bank_financialinstitution', 
    24                                 'donation_bank_iban', 
    25                                 'donation_bank_swift' 
    26                         ); 
    27                          
    28                 foreach($keys as $key) { 
    29                         $lang = WCF::getLanguage()->get('wcf.acp.option.'.$key); 
    30                         $val = strtoupper($key); 
    31                         $val = constant($val); 
    32                         if(!empty($val)) { 
    33                                 $arr[$lang] = $val; 
    34                         } 
     21                $this->eventObj = $eventObj; 
     22                 
     23                if($this->eventObj->system != $this->system) { 
     24                        return; 
    3525                } 
    3626 
    37                 $var = DONATION_BANK_ENABLE; 
    38                 if(!empty($var)) { 
    39                         WCF::getTPL()->assign(array( 
     27                switch($eventName) { 
     28                        case 'assignVariables': 
     29                                $this->assignVariables(); 
     30                        break; 
     31                } 
     32        } 
     33 
     34        /** 
     35         * @see Page::assignVariables() 
     36         */ 
     37        protected function assignVariables() { 
     38                switch($this->eventObj->step) { 
     39                        case 1: 
     40                                WCF::getTPL()->assign(array( 
     41                                        'donation_system' => $this->system, 
    4042                                        'donation_icon' => '', 
    41                                         'donation_title' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.bank'), 
    42                                         'donation_fields' => $arr 
     43                                        'donation_title' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.bank') 
     44                                        'donation_description' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.bank.description') 
    4345                                )); 
    4446 
    45                         WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     47                                WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     48                        break; 
    4649                } 
    4750        } 
  • donation/files/lib/system/event/listener/DonationOptionFormListener.class.php

    r78 r104  
    88 * @author      Torben Brodt 
    99 * @package     de.easy-coding.wcf.donation 
    10  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> 
     10 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1111 */ 
    1212class DonationOptionFormListener implements EventListener { 
  • donation/optionals/de.easy-coding.wcf.donation.code/eventlistener.xml

    r91 r104  
    44        <import> 
    55                <eventlistener> 
    6                         <eventclassname>DonationForm</eventclassname> 
     6                        <eventclassname>DonationAddForm</eventclassname> 
    77                        <eventname>assignVariables</eventname> 
    8                         <listenerclassfile>lib/system/event/listener/DonationFormCodeListener.class.php</listenerclassfile> 
     8                        <listenerclassfile>lib/system/event/listener/DonationAddFormCodeListener.class.php</listenerclassfile> 
     9                </eventlistener> 
     10                <eventlistener> 
     11                        <eventclassname>DonationAddForm</eventclassname> 
     12                        <eventname>validate</eventname> 
     13                        <listenerclassfile>lib/system/event/listener/DonationAddFormCodeListener.class.php</listenerclassfile> 
     14                </eventlistener> 
     15                <eventlistener> 
     16                        <eventclassname>DonationAddForm</eventclassname> 
     17                        <eventname>readFormParameters</eventname> 
     18                        <listenerclassfile>lib/system/event/listener/DonationAddFormCodeListener.class.php</listenerclassfile> 
     19                </eventlistener> 
     20                <eventlistener> 
     21                        <eventclassname>DonationAddForm</eventclassname> 
     22                        <eventname>save</eventname> 
     23                        <listenerclassfile>lib/system/event/listener/DonationAddFormCodeListener.class.php</listenerclassfile> 
    924                </eventlistener> 
    1025        </import> 
  • donation/optionals/de.easy-coding.wcf.donation.code/files/lib/system/event/listener/DonationAddFormCodeListener.class.php

    r91 r104  
    77 * 
    88 * @author      Torben Brodt 
    9  * @package     de.easy-coding.wcf.donation.code 
     9 * @package     de.easy-coding.wcf.code 
    1010 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1111 */ 
    12 class DonationFormCodeListener implements EventListener { 
     12class DonationAddFormBankCode implements EventListener { 
     13        protected $system = 'code'; 
     14        protected $prefix = 'donation_code_'; 
     15        protected $eventObj; 
     16         
     17        //data 
     18        protected $code, $message; 
    1319 
    1420        /** 
     
    1622         */ 
    1723        public function execute($eventObj, $className, $eventName) { 
    18                 $var = DONATION_GOOGLECHECKOUT_HTML; 
    19                 if(!empty($var)) { 
    20                         WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donationCode')); 
     24                $this->eventObj = $eventObj; 
     25                 
     26                if($this->eventObj->system != $this->system) { 
     27                        return; 
     28                } 
     29 
     30                switch($eventName) { 
     31                        case 'readFormParameters': 
     32                                $this->readFormParameters(); 
     33                        break; 
     34                        case 'assignVariables': 
     35                                $this->assignVariables(); 
     36                        break; 
     37                        case 'validate': 
     38                                $this->validate(); 
     39                        break; 
     40                        case 'save': 
     41                                $this->save(); 
     42                        break; 
     43                } 
     44        } 
     45         
     46        /** 
     47         * validates code 
     48         * @param code 
     49         */ 
     50        protected function validateCode($code) { 
     51                $sql = "SELECT          COUNT(*) AS c 
     52                        FROM            wcf".WCF_N."_donation_code 
     53                        WHERE           code = ".escapeString($this->code)." 
     54                        AND             userID = 0; "; 
     55 
     56                $row = WCF::getDB()->getFirstRow($sql); 
     57                return empty($row['c']) ? false : true;  
     58        } 
     59 
     60        /** 
     61         * @see Form::readFormParameters() 
     62         */ 
     63        protected function readFormParameters() { 
     64                switch($this->eventObj->step) { 
     65                        case 1: 
     66                                if(isset($_POST[$this->prefix.'code'])) $this->code = $_POST[$this->prefix.'code']; 
     67                        break; 
     68                        case 2: 
     69                                if(isset($_POST[$this->prefix.'message'])) $this->message = $_POST[$this->prefix.'message']; 
     70                        break; 
     71                } 
     72        } 
     73         
     74        /** 
     75         * @see Form::validate() 
     76         */ 
     77        protected function validate() { 
     78                switch($this->eventObj->step) { 
     79                        case 1: 
     80                                if(!$this->validateCode($this->code)) { 
     81                                        // TODO: exception 
     82                                } 
     83 
     84                        break; 
     85                        case 2: 
     86                                if(!$this->validateCode($this->code)) { 
     87                                        // TODO: exception 
     88                                } 
     89                                 
     90                                 
     91                                //EventListener::fireEvent($this->eventObj, 'save'); TODO: EventListener 
     92                        break; 
     93                } 
     94        } 
     95         
     96        /** 
     97         * @see Form::save() 
     98         */ 
     99        protected function save() { 
     100                $sql = "UPDATE          wcf".WCF_N."_donation 
     101                        SET 
     102                                        userID = ".WCF::getUser()->userID." 
     103                        WHERE           userID = 0 
     104                        AND             code = '".escapeString($this->message)."'; "; 
     105                WCF::getDB()->sendQuery($sql); 
     106 
     107                $sql = "INSERT INTO     wcf".WCF_N."_donation 
     108                        ( 
     109                                        system, 
     110                                        timestamp, 
     111                                        userID, 
     112                                        username, 
     113                                        amount, 
     114                                        message 
     115                        ) VALUES ( 
     116                                        'code', 
     117                                        ".time()." 
     118                                        ".WCF::getUser()->userID.", 
     119                                        '".WCF::getUser()->username."', 
     120                                        0.0, 
     121                                        '".escapeString($this->message)."' 
     122                        );"; 
     123 
     124                WCF::getDB()->sendQuery($sql); 
     125        } 
     126         
     127        /** 
     128         * @see Page::assignVariables() 
     129         */ 
     130        protected function assignVariables() { 
     131                switch($this->eventObj->step) { 
     132                        case 0: 
     133                                WCF::getTPL()->assign(array( 
     134                                        'donation_system' => $this->system, 
     135                                        'donation_icon' => RELATIVE_WCF_DIR.'icon/donation_code.png', 
     136                                        'donation_title' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.code'), 
     137                                        'donation_desrciption' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.code.description') 
     138                                )); 
     139 
     140                                WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     141                        break; 
     142                        case 1: 
     143                        case 2: 
     144                                WCF::getTPL()->append('donationSystemContainer', WCF::getTPL()->fetch('donationCode')); 
     145                        break; 
    21146                } 
    22147        } 
  • donation/optionals/de.easy-coding.wcf.donation.googlecheckout/eventlistener.xml

    r61 r104  
    44        <import> 
    55                <eventlistener> 
    6                         <eventclassname>DonationForm</eventclassname> 
     6                        <eventclassname>DonationAddForm</eventclassname> 
    77                        <eventname>assignVariables</eventname> 
    8                         <listenerclassfile>lib/system/event/listener/DonationFormGoogleCheckoutListener.class.php</listenerclassfile> 
     8                        <listenerclassfile>lib/system/event/listener/DonationAddFormGoogleCheckoutListener.class.php</listenerclassfile> 
    99                </eventlistener> 
    1010        </import> 
  • donation/optionals/de.easy-coding.wcf.donation.googlecheckout/files/lib/system/cronjob/DonationGoogleCheckoutCronjob.class.php

    r78 r104  
    1010 * @author      Torben Brodt 
    1111 * @package     de.easy-coding.wcf.donation.googlecheckout 
    12  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> 
     12 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1313 */ 
    1414class DonationGoogleCheckoutCronjob implements Cronjob { 
  • donation/optionals/de.easy-coding.wcf.donation.googlecheckout/files/lib/system/event/listener/DonationAddFormGoogleCheckoutListener.class.php

    r78 r104  
    44 
    55/** 
    6  * Adds google checkout for donation 
     6 * Adds google checkout information for donation 
    77 * 
    88 * @author      Torben Brodt 
    99 * @package     de.easy-coding.wcf.donation.googlecheckout 
    10  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> 
     10 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1111 */ 
    12 class DonationFormGoogleCheckoutListener implements EventListener { 
     12class DonationAddFormGoogleCheckoutListener implements EventListener { 
     13        protected $system = 'googlecheckout'; 
     14        protected $prefix = 'donation_googlecheckout_'; 
     15        protected $eventObj; 
     16         
     17        //data 
     18        protected $amount, $message; 
    1319 
    1420        /** 
     
    1622         */ 
    1723        public function execute($eventObj, $className, $eventName) { 
    18                 $var = DONATION_GOOGLECHECKOUT_HTML; 
    19                 if(!empty($var)) { 
    20                         WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donationGoogleCheckout')); 
     24                $this->eventObj = $eventObj; 
     25                 
     26                if($this->eventObj->system != $this->system) { 
     27                        return; 
     28                } 
     29 
     30                switch($eventName) { 
     31                        case 'assignVariables': 
     32                                $this->assignVariables(); 
     33                        break; 
     34                } 
     35        } 
     36         
     37        /** 
     38         * @see Page::assignVariables() 
     39         */ 
     40        protected function assignVariables() { 
     41                switch($this->eventObj->step) { 
     42                        case 0: 
     43                                WCF::getTPL()->assign(array( 
     44                                        'donation_system' => $this->system, 
     45                                        'donation_icon' => RELATIVE_WCF_DIR.'icon/donation_googlecheckout.png', 
     46                                        'donation_title' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.googlecheckout'), 
     47                                        'donation_description' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.googlecheckout.description') 
     48                                )); 
     49 
     50                                WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     51                        break; 
     52                        case 1: 
     53                                WCF::getTPL()->append('donationSystemContainer', WCF::getTPL()->fetch('donationGoogleCheckout')); 
     54                        break; 
    2155                } 
    2256        } 
  • donation/optionals/de.easy-coding.wcf.donation.paypal/eventlistener.xml

    r61 r104  
    44        <import> 
    55                <eventlistener> 
    6                         <eventclassname>DonationForm</eventclassname> 
     6                        <eventclassname>DonationAddForm</eventclassname> 
    77                        <eventname>assignVariables</eventname> 
    8                         <listenerclassfile>lib/system/event/listener/DonationFormPayPalListener.class.php</listenerclassfile> 
     8                        <listenerclassfile>lib/system/event/listener/DonationAddFormPayPalListener.class.php</listenerclassfile> 
     9                </eventlistener> 
     10                <eventlistener> 
     11                        <eventclassname>DonationAddForm</eventclassname> 
     12                        <eventname>validate</eventname> 
     13                        <listenerclassfile>lib/system/event/listener/DonationAddFormPayPalListener.class.php</listenerclassfile> 
     14                </eventlistener> 
     15                <eventlistener> 
     16                        <eventclassname>DonationAddForm</eventclassname> 
     17                        <eventname>readFormParameters</eventname> 
     18                        <listenerclassfile>lib/system/event/listener/DonationAddFormPayPalListener.class.php</listenerclassfile> 
     19                </eventlistener> 
     20                <eventlistener> 
     21                        <eventclassname>DonationAddForm</eventclassname> 
     22                        <eventname>save</eventname> 
     23                        <listenerclassfile>lib/system/event/listener/DonationAddFormPayPalListener.class.php</listenerclassfile> 
    924                </eventlistener> 
    1025        </import> 
  • donation/optionals/de.easy-coding.wcf.donation.paypal/files/lib/system/cronjob/DonationPayPalCronjob.class.php

    r78 r104  
    1010 * @author      Torben Brodt 
    1111 * @package     de.easy-coding.wcf.donation.paypal 
    12  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> 
     12 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1313 */ 
    1414class DonationPayPalCronjob implements Cronjob { 
  • donation/optionals/de.easy-coding.wcf.donation.paypal/files/lib/system/event/listener/DonationAddFormPayPalListener.class.php

    r78 r104  
    44 
    55/** 
    6  * Adds paypal form for donation 
     6 * Adds paypal information for donation 
    77 * 
    88 * @author      Torben Brodt 
    99 * @package     de.easy-coding.wcf.donation.paypal 
    10  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> 
     10 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1111 */ 
    12 class DonationFormPayPalListener implements EventListener { 
     12class DonationAddFormPayPalListener implements EventListener { 
     13        protected $system = 'paypal'; 
     14        protected $prefix = 'donation_paypal_'; 
     15        protected $eventObj; 
     16         
     17        //data 
     18        protected $amount, $message; 
    1319 
    1420        /** 
     
    1622         */ 
    1723        public function execute($eventObj, $className, $eventName) { 
    18                 $var = DONATION_PAYPAL_HTML; 
    19                 if(!empty($var)) { 
    20                         WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donationPayPal')); 
     24                $this->eventObj = $eventObj; 
     25                 
     26                if($this->eventObj->system != $this->system) { 
     27                        return; 
     28                } 
     29 
     30                switch($eventName) { 
     31                        case 'readFormParameters': 
     32                                $this->readFormParameters(); 
     33                        break; 
     34                        case 'assignVariables': 
     35                                $this->assignVariables(); 
     36                        break; 
     37                        case 'validate': 
     38                                $this->validate(); 
     39                        break; 
     40                        case 'save': 
     41                                $this->save(); 
     42                        break; 
     43                } 
     44        } 
     45 
     46        /** 
     47         * @see Form::readFormParameters() 
     48         */ 
     49        protected function readFormParameters() { 
     50                //TODO: get information from paypal 
     51        } 
     52         
     53        /** 
     54         * @see Form::validate() 
     55         */ 
     56        protected function validate() { 
     57                //TODO: did we get an answer from paypal? submission finished? 
     58        } 
     59         
     60        /** 
     61         * @see Form::save() 
     62         */ 
     63        protected function save() { 
     64                $sql = "INSERT INTO     wcf".WCF_N."_donation 
     65                        ( 
     66                                        system, 
     67                                        timestamp, 
     68                                        userID, 
     69                                        username, 
     70                                        amount, 
     71                                        message 
     72                        ) VALUES ( 
     73                                        'paypal', 
     74                                        ".time()." 
     75                                        ".WCF::getUser()->userID.", 
     76                                        '".WCF::getUser()->username."', 
     77                                        ".floatval($this->amount).", 
     78                                        '".escapeString($this->message)."' 
     79                        );"; 
     80 
     81                WCF::getDB()->sendQuery($sql); 
     82        } 
     83         
     84        /** 
     85         * @see Page::assignVariables() 
     86         */ 
     87        protected function assignVariables() { 
     88                switch($this->eventObj->step) { 
     89                        case 0: 
     90                                WCF::getTPL()->assign(array( 
     91                                        'donation_system' => $this->system, 
     92                                        'donation_icon' => RELATIVE_WCF_DIR.'icon/donation_paypal.png', 
     93                                        'donation_title' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.paypal'), 
     94                                        'donation_description' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.paypal.description') 
     95                                )); 
     96 
     97                                WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     98                        break; 
     99                        case 1: 
     100                                WCF::getTPL()->append('donationSystemContainer', WCF::getTPL()->fetch('donationPayPal')); 
     101                        break; 
    21102                } 
    22103        } 
  • donation/optionals/de.easy-coding.wcf.donation.phone/eventlistener.xml

    r90 r104  
    44        <import> 
    55                <eventlistener> 
    6                         <eventclassname>DonationForm</eventclassname> 
     6                        <eventclassname>DonationAddForm</eventclassname> 
    77                        <eventname>assignVariables</eventname> 
    8                         <listenerclassfile>lib/system/event/listener/DonationFormPhoneListener.class.php</listenerclassfile> 
     8                        <listenerclassfile>lib/system/event/listener/DonationAddFormPhoneListener.class.php</listenerclassfile> 
    99                </eventlistener> 
    1010        </import> 
  • donation/optionals/de.easy-coding.wcf.donation.phone/files/lib/system/event/listener/DonationAddFormPhoneListener.class.php

    r82 r104  
    1010 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 
    1111 */ 
    12 class DonationFormPhoneListener implements EventListener { 
     12class DonationAddFormPhoneListener implements EventListener { 
     13        protected $system = 'phone'; 
     14        protected $prefix = 'donation_phone_'; 
     15        protected $eventObj; 
    1316 
    1417        /** 
     
    1619         */ 
    1720        public function execute($eventObj, $className, $eventName) { 
    18                 $icons = explode("\n", StringUtil::unifyNewlines(DONATION_PHONE_ICON)); 
    19                 $numbers = explode("\n", StringUtil::unifyNewlines(DONATION_PHONE_NUMBER)); 
    20                 $prices = explode("\n", StringUtil::unifyNewlines(DONATION_PHONE_PRICE)); 
     21                $this->eventObj = $eventObj; 
    2122                 
    22                 $count = count($icons);  
    23                 for($i=0; $i<$count; $i++) { 
    24                         $left = $icons[$i]; 
    25                         $right = $numbers[$i].'<br/>'.$price; 
    26  
    27                         $arr[$left] = $right; 
     23                if($this->eventObj->system != $this->system) { 
     24                        return; 
    2825                } 
    2926 
    30                 $var = DONATION_PHONE_ENABLE; 
    31                 if(!empty($var)) { 
    32                         WCF::getTPL()->assign( 
     27                switch($eventName) { 
     28                        case 'assignVariables': 
     29                                $this->assignVariables(); 
     30                        break; 
     31                } 
     32        } 
     33 
     34        /** 
     35         * @see Page::assignVariables() 
     36         */ 
     37        protected function assignVariables() { 
     38                switch($this->eventObj->step) { 
     39                        case 1: 
     40                                WCF::getTPL()->assign(array( 
     41                                        'donation_system' => $this->system, 
    3342                                        'donation_icon' => '', 
    34                                         'donation_title' => WCF::getLanguage()->get('wcf.acp.option.category.donation.plugins.phone'), 
    35                                         'donation_fields' => $arr 
    36                                 ); 
     43                                        'donation_title' => WCF::getLanguage()->get('wcf.donation.category.donation.plugins.phone'), 
     44                                        'donation_description' => WCF::getLanguage()->get('wcf.donation.category.donation.plugins.phone.description') 
     45                                )); 
    3746 
    38                         WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     47                                WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     48                        break; 
    3949                } 
    4050        } 
  • donation/optionals/de.easy-coding.wcf.donation.wishlist/eventlistener.xml

    r91 r104  
    44        <import> 
    55                <eventlistener> 
    6                         <eventclassname>DonationForm</eventclassname> 
     6                        <eventclassname>DonationAddForm</eventclassname> 
    77                        <eventname>assignVariables</eventname> 
    8                         <listenerclassfile>lib/system/event/listener/DonationFormCodeListener.class.php</listenerclassfile> 
     8                        <listenerclassfile>lib/system/event/listener/DonationAddFormWishlistListener.class.php</listenerclassfile> 
    99                </eventlistener> 
    1010        </import> 
  • donation/optionals/de.easy-coding.wcf.donation.wishlist/files/lib/system/event/listener/DonationAddFormWishlistListener.class.php

    r91 r104  
    1111 */ 
    1212class DonationFormWishlistListener implements EventListener { 
     13        protected $system = 'wishlist'; 
     14        protected $prefix = 'donation_wishlist_'; 
     15        protected $eventObj; 
    1316 
    1417        /** 
     
    1619         */ 
    1720        public function execute($eventObj, $className, $eventName) { 
    18                 $var = DONATION_GOOGLECHECKOUT_HTML; 
    19                 if(!empty($var)) { 
    20                         WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donationWishlist')); 
     21                $this->eventObj = $eventObj; 
     22                 
     23                if($this->eventObj->system != $this->system) { 
     24                        return; 
     25                } 
     26 
     27                switch($eventName) { 
     28                        case 'assignVariables': 
     29                                $this->assignVariables(); 
     30                        break; 
     31                } 
     32        } 
     33 
     34        /** 
     35         * @see Page::assignVariables() 
     36         */ 
     37        protected function assignVariables() { 
     38                switch($this->eventObj->step) { 
     39                        case 1: 
     40                                WCF::getTPL()->assign(array( 
     41                                        'donation_system' => $this->system, 
     42                                        'donation_icon' => '', 
     43                                        'donation_title' => WCF::getLanguage()->get('wcf.donation.category.donation.plugins.wishlist'), 
     44                                        'donation_description' => WCF::getLanguage()->get('wcf.donation.category.donation.plugins.wishlist.description') 
     45                                )); 
     46 
     47                                WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container')); 
     48                        break; 
    2149                } 
    2250        }