Renamed 'ship-simu' to 'shipsimu' + added 'core' and symlink to core/inc
[shipsimu.git] / application / shipsimu / main / commands / web / government / class_WebShipsimuGovernmentStartupCommand.php
1 <?php
2 /**
3  * A command for a failed startup request. This may happen when the user
4  * "knows" the correct URL but government refuses to pay.
5  *
6  * @author              Roland Haeder <webmaster@shipsimu.org>
7  * @version             0.0.0
8  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
9  * @license             GNU GPL 3.0 or any newer version
10  * @link                http://www.shipsimu.org
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 class WebShipsimuGovernmentStartupCommand extends BaseCommand implements Commandable {
26         /**
27          * Protected constructor
28          *
29          * @return      void
30          */
31         protected function __construct () {
32                 // Call parent constructor
33                 parent::__construct(__CLASS__);
34         }
35
36         /**
37          * Creates an instance of this class
38          *
39          * @param       $resolverInstance       An instance of a command resolver class
40          * @return      $commandInstance        An instance a prepared command class
41          */
42         public static final function createWebShipsimuGovernmentStartupCommand (CommandResolver $resolverInstance) {
43                 // Get new instance
44                 $commandInstance = new WebShipsimuGovernmentStartupCommand();
45
46                 // Set the application instance
47                 $commandInstance->setResolverInstance($resolverInstance);
48
49                 // Return the prepared instance
50                 return $commandInstance;
51         }
52
53         /**
54          * Executes the given command with given request and response objects
55          *
56          * @param       $requestInstance        An instance of a class with an Requestable interface
57          * @param       $responseInstance       An instance of a class with an Responseable interface
58          * @return      void
59          * @todo        0% done
60          */
61         public function execute (Requestable $requestInstance, Responseable $responseInstance) {
62                 // Get a wrapper instance
63                 $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class');
64
65                 // Register the startup help
66                 $wrapperInstance->registerStartupHelpByRequest($requestInstance);
67         }
68
69         /**
70          * Adds extra filters to the given controller instance
71          *
72          * @param       $controllerInstance             A controller instance
73          * @param       $requestInstance                An instance of a class with an Requestable interface
74          * @return      void
75          * @todo        Maybe we need some filters here?
76          */
77         public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
78                 // Add user auth filter (we don't need an update of the user here because it will be redirected)
79                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
80
81                 // Add user status filter here
82                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
83
84                 // Check if government can pay startup help
85                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_startup_help_filter'));
86
87                 // Verify password
88                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter'));
89
90                 // Verify CAPTCHA code
91                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_government_verifier_filter'));
92         }
93 }
94
95 // [EOF]
96 ?>