]> git.mxchange.org Git - city.git/blob - application/city/templates/code/action_city_login_city_map.ctp
Continued:
[city.git] / application / city / templates / code / action_city_login_city_map.ctp
1 <?php
2 // Import framework stuff
3 use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
4
5 // Get form helper instance
6 $helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', array($this, 'city_map'));
7
8 // Prefetch user instance
9 $helperInstance->prefetchValueInstance('user');
10
11 // Get manager instance
12 $managerInstance = ManagerFactory::createManagerByType('city');
13
14 // Now set the extra instance
15 $helperInstance->setExtraInstance($managerInstance);
16
17 // Get user instance
18 $userInstance = Registry::getRegistry()->getInstance('user');
19
20 // Is a city already founded?
21 if ($userInstance->isGuest()) {
22         // Guests are not allowed to found cities
23         $helperInstance->addFormNote('guest', "Du musst dich beim Spiel {?app_full_name?} anmelden, dann kannst du erst St&auml;dte gr&uuml;nden.");
24 } elseif (!$managerInstance->isCityAlreadyFounded()) {
25         // No, then generate form:
26         // Add group for city creation (first city only)
27         $helperInstance->addFormGroup('city_create', "Gr&uuml;nde deine erste Stadt.");
28
29         // City name input field
30         $helperInstance->addFormSubGroup('city_name', "Bitte gebe den Namen der Stadt ein.");
31         $helperInstance->addFieldLabel('city_name', "Dein Stadtname:");
32         $helperInstance->addInputTextField('city_name');
33
34         // CAPTCHA enabled?
35         if ($helperInstance->ifFormSecuredWithCaptcha()) {
36                 $helperInstance->addFormGroup('captcha_user', "Die virtuelle Beantragung von Starthilfe ist durch ein CAPTCHA gesch&uuml;tzt. Bitte wiederhole den angezeigten Code, damit du die Starthilfe beantragen kannst.");
37                 $helperInstance->addCaptcha();
38         } // END - if
39
40         // Final notices
41         $helperInstance->addFormGroup('buttons', "Soll so die Stadt angelegt werden?");
42         $helperInstance->addInputResetButton("Alles nochmal eingeben");
43         $helperInstance->addInputSubmitButton("Stadt anlegen");
44         $helperInstance->addFormNote('more_cities', "Du kannst sp&auml;ter auch weitere St&auml;dte anlegen, fange aber erstmal klein an.");
45
46         // Flush the finished form
47         $helperInstance->flushContent();
48 } else {
49         // Add notice
50         $helperInstance->addFormGroup('city_created', "Deine Stadt {?block_city_name?}:");
51
52         // Assign all data fields
53         $helperInstance->assignField('city_name');
54
55         // A city has already been created, so render it
56         $managerInstance->renderCityMap($helperInstance);
57
58         // Flush the finished form
59         $helperInstance->flushContent();
60 }
61
62 // [EOC]
63 ?>
64 <div id="city_map_frame">
65         <div id="city_map_header">
66                 Stadtkarte
67         </div>
68
69         <div id="city_map_form">
70                 {?city_map?}
71         </div>
72 </div>