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