2 // Import framework stuff
3 use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
5 // Get form helper instance
6 $helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', array($this, 'city_map'));
8 // Prefetch user instance
9 $helperInstance->prefetchValueInstance('user');
11 // Get manager instance
12 $managerInstance = ManagerFactory::createManagerByType('city');
14 // Now set the extra instance
15 $helperInstance->setExtraInstance($managerInstance);
18 $userInstance = Registry::getRegistry()->getInstance('user');
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ädte grü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ünde deine erste Stadt.");
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');
35 if ($helperInstance->ifFormSecuredWithCaptcha()) {
36 $helperInstance->addFormGroup('captcha_user', "Die virtuelle Beantragung von Starthilfe ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du die Starthilfe beantragen kannst.");
37 $helperInstance->addCaptcha();
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äter auch weitere Städte anlegen, fange aber erstmal klein an.");
46 // Flush the finished form
47 $helperInstance->flushContent();
50 $helperInstance->addFormGroup('city_created', "Deine Stadt {?block_city_name?}:");
52 // Assign all data fields
53 $helperInstance->assignField('city_name');
55 // A city has already been created, so render it
56 $managerInstance->renderCityMap($helperInstance);
58 // Flush the finished form
59 $helperInstance->flushContent();
64 <div id="city_map_frame">
65 <div id="city_map_header">
69 <div id="city_map_form">