2 // Get form helper instance
3 $helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', array($this, 'city_map'));
5 // Prefetch user instance
6 $helperInstance->prefetchValueInstance('user');
8 // Get manager instance
9 $managerInstance = ManagerFactory::createManagerByType('city');
11 // Now set the extra instance
12 $helperInstance->setExtraInstance($managerInstance);
15 $userInstance = Registry::getRegistry()->getInstance('user');
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ädte grü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ünde deine erste Stadt.");
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');
32 if ($helperInstance->ifFormSecuredWithCaptcha()) {
33 $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.");
34 $helperInstance->addCaptcha();
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äter auch weitere Städte anlegen, fange aber erstmal klein an.");
43 // Flush the finished form
44 $helperInstance->flushContent();
47 $helperInstance->addFormGroup('city_created', "Deine Stadt {?block_city_name?}:");
49 // Assign all data fields
50 $helperInstance->assignField('city_name');
52 // A city has already been created, so render it
53 $managerInstance->renderCityMap($helperInstance);
55 // Flush the finished form
56 $helperInstance->flushContent();
61 <div id="city_map_frame">
62 <div id="city_map_header">
66 <div id="city_map_form">