application/ship-simu/main/menu/class_ShipSimuLoginMenu.php -text
application/ship-simu/main/menu/class_ShipSimuLogoutMenu.php -text
application/ship-simu/main/menu/class_ShipSimuRegisterMenu.php -text
+application/ship-simu/main/menu/government/.htaccess -text
+application/ship-simu/main/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php -text
application/ship-simu/main/parts/.htaccess -text
application/ship-simu/main/parts/class_BaseShipPart.php -text
application/ship-simu/main/parts/maschineroom/.htaccess -text
application/ship-simu/templates/de/code/emergency_exit.ctp -text
application/ship-simu/templates/de/code/footer.ctp -text
application/ship-simu/templates/de/code/footer_msg.ctp -text
+application/ship-simu/templates/de/code/government_failed_main.ctp -text
application/ship-simu/templates/de/code/header.ctp -text
application/ship-simu/templates/de/code/header_extras_hook.ctp -text
application/ship-simu/templates/de/code/home.ctp -text
*/
public function buildMasterTemplateName () {
// Get short name and add suffix
- $masterTemplateName = str_replace("-", "", $this->getAppShortName()) . "_main";
+ $masterTemplateName = str_replace('-', '', $this->getAppShortName()) . '_main';
// Return it
return $masterTemplateName;
// Create a new request object
$requestInstance = ObjectFactory::createObjectByName('HttpRequest');
- // Default response is HTTP (HTML page) and type is "Web"
- $response = "http";
- $responseType = "web";
+ // Default response is HTTP (HTML page) and type is 'Web'
+ $response = 'http';
+ $responseType = 'web';
// Do we have another response?
if ($requestInstance->isRequestElementSet('request')) {
public function handleFatalMessages (array $messageList) {
// Walk through all messages
foreach ($messageList as $message) {
- print("MSG:".$message."<br />\n");
+ print("MSG:" . $message . "<br />\n");
} // END - if
}
// CFG: LOGIN-AREA-LOGOUT-ACTION
$cfg->setConfigEntry('login_area_logout_action', "index.php?app={?app_short_name?}&page=login_area&action=logout");
+// CFG: GOVERNMENT-FAILED-LOGOUT-ACTION
+$cfg->setConfigEntry('government_failed_logout_action', "index.php?app={?app_short_name?}&page=login_area&action=logout");
+
// CFG: LOGIN-AREA-PROFILE-ACTION
$cfg->setConfigEntry('login_area_profile_action', "index.php?app={?app_short_name?}&page=login_area&action=profile");
+// CFG: GOVERNMENT-FAILED-PROFILE-ACTION
+$cfg->setConfigEntry('government_failed_profile_action', "index.php?app={?app_short_name?}&page=login_area&action=profile");
+
// CFG: LOGIN-AREA-COMPANY-ACTION
$cfg->setConfigEntry('login_area_company_action', "index.php?app={?app_short_name?}&page=login_area");
+// CFG: GOVERNMENT-FAILED-COMPANY-ACTION
+$cfg->setConfigEntry('government_failed_company_action', "index.php?app={?app_short_name?}&page=login_area");
+
// CFG: LOGIN-AREA-LIST-COMPANIES-ACTION
$cfg->setConfigEntry('login_area_list_companies_action', "index.php?app={?app_short_name?}&page=login_area");
// CFG: LOGIN-AREA-MENU-CLASS
$cfg->setConfigEntry('login_area_menu_class', "ShipSimuLoginAreaMenu");
+// CFG: GOVERNMENT-FAILED-AREA-MENU-CLASS
+$cfg->setConfigEntry('government_failed_area_menu_class', "ShipSimuGovernmentFailedAreaMenu");
+
// [EOF]
?>
$templateInstance->assignVariable('refill_done', $requestInstance->getRequestElement('type'));
$templateInstance->assignVariable('amount' , $requestInstance->getRequestElement('amount'));
- // This method does currently redirect if all goes right
+ // This method does currently redirect if all goes right. Booking is done in filters
$responseInstance->redirectToConfiguredUrl('refill_page_done');
}
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
// Which login type do we have?
switch ($this->getConfigInstance()->getConfigEntry('login_type')) {
- case "username": // Login via username
+ case 'username': // Login via username
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter'));
break;
- case "email": // Login via email
+ case 'email': // Login via email
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter'));
break;
* @todo 0% done
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- $this->partialStub("Unfinished method.");
+ // Get the action instance from registry
+ $actionInstance = Registry::getRegistry()->getInstance('action');
+
+ // Do we have an action here?
+ if ($actionInstance instanceof PerformableAction) {
+ // Execute the action (shall not output anything, see below why)
+ $actionInstance->execute($requestInstance, $responseInstance);
+ } // END - if
+
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Assign all the application's data with template variables
+ $templateInstance->assignApplicationData($appInstance);
+
+ // Load the master template
+ $masterTemplate = $appInstance->buildMasterTemplateName();
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load main template
+ $templateInstance->loadCodeTemplate('government_failed_main');
+
+ // Assign the main template with the master template as a content ... ;)
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('government_failed_main', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($requestInstance->getRequestElement('page') . '_' . $requestInstance->getRequestElement('failed') . '_title'));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('government_failed_area_menu_class', array($appInstance));
+
+ // ... and all variables. This should be merged together in a pattern
+ // to make things easier. A cache mechanism should be added between
+ // these two calls to cache compiled templates.
+ $templateInstance->compileVariables();
+
+ // Get the content back from the template engine and put it in response class
+ $templateInstance->transferToResponse($responseInstance);
}
/**
* @todo 0% done
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- $this->partialStub("Unfinished method.");
+ // Get the action instance from registry
+ $actionInstance = Registry::getRegistry()->getInstance('action');
+
+ // Do we have an action here?
+ if ($actionInstance instanceof PerformableAction) {
+ // Execute the action (shall not output anything, see below why)
+ $actionInstance->execute($requestInstance, $responseInstance);
+ } // END - if
+
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Assign all the application's data with template variables
+ $templateInstance->assignApplicationData($appInstance);
+
+ // Load the master template
+ $masterTemplate = $appInstance->buildMasterTemplateName();
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load main template
+ $templateInstance->loadCodeTemplate('government_failed_main');
+
+ // Assign the main template with the master template as a content ... ;)
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('government_failed_main', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($requestInstance->getRequestElement('page') . '_' . $requestInstance->getRequestElement('failed') . '_title'));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('government_failed_area_menu_class', array($appInstance));
+
+ // ... and all variables. This should be merged together in a pattern
+ // to make things easier. A cache mechanism should be added between
+ // these two calls to cache compiled templates.
+ $templateInstance->compileVariables();
+
+ // Get the content back from the template engine and put it in response class
+ $templateInstance->transferToResponse($responseInstance);
}
/**
* @todo 0% done
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- $this->partialStub("Unfinished method.");
+ $this->partialStub('Unfinished method.');
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ShipSimuGovernmentFailedAreaMenu extends BaseMenu implements RenderableMenu {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $menuInstance An instance of this class
+ */
+ public final static function createShipSimuGovernmentFailedAreaMenu () {
+ // Get a new instance
+ $menuInstance = new ShipSimuGovernmentFailedAreaMenu();
+
+ // Return the prepared instance
+ return $menuInstance;
+ }
+}
+
+// [EOF]
+?>
$updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
// And add our both entries
- $updateInstance->addCriteria("last_activity", date("Y-m-d H:i:s", time()));
- $updateInstance->addCriteria("last_action", $lastAction);
+ $updateInstance->addCriteria('last_activity', date('Y-m-d H:i:s', time()));
+ $updateInstance->addCriteria('last_action', $lastAction);
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);
}
/**
- * Books the given 'amount' in the request instance on the users "points
- * account"
+ * Books the given 'amount' in the request instance on the users 'points
+ * account'
*
* @param $requestInstance An instance of a Requestable class
* @return void
--- /dev/null
+<?php
+///////////////////////////////
+// Assign personal user data //
+///////////////////////////////
+
+// Get a new instance for personal data
+$blockInstance = ObjectFactory::createObjectByConfiguredName('web_block_helper', array($this, 'persona_data'));
+
+// Set the data source instance which must exist in registry
+$blockInstance->prefetchValueInstance('user');
+
+// Assign fields with template variables
+$blockInstance->assignField('username');
+$blockInstance->assignFieldWithFilter('user_status', "user_status_translator");
+
+// Shall we include registration date?
+if ($blockInstance->ifIncludeRegistrationStamp()) {
+ // Then assign it as well!
+ $blockInstance->assignFieldWithFilter('registered', 'formatTimestamp');
+} // END - if
+
+// Flush the content out to a template variable
+$blockInstance->flushContent();
+
+//////////////////////////////////////
+// Assign the shipping company data //
+//////////////////////////////////////
+
+// Get a new instance for personal data
+$blockInstance = ObjectFactory::createObjectByConfiguredName('web_block_helper', array($this, 'company_data'));
+
+// Set the data source instance
+$blockInstance->prefetchValueInstance('company', 'user');
+
+// Assign the company name
+if ($blockInstance->getValueInstance()->ifUserIsFounder()) {
+ // User is the founder of the company
+ $blockInstance->assignMessageField('company_status', "user_is_company_founder");
+ $blockInstance->assignLinkFieldWithAction('company' , "company_overview");
+ $blockInstance->assignMessageField('company', "link_text_company_overview");
+ $blockInstance->assignMessageField('company_title', "link_title_company_overview");
+} elseif ($blockInstance->getValueInstance()->ifUserIsOwner()) {
+ // User owns the company
+ $blockInstance->assignMessageField('company_status', "user_is_company_owner");
+ $blockInstance->assignLinkFieldWithAction('company' , "company_overview");
+ $blockInstance->assignMessageField('company', "link_text_company_overview");
+ $blockInstance->assignMessageField('company_title', "link_title_company_overview");
+} elseif ($blockInstance->getValueInstance()->ifUserIsEmployee()) {
+ // User is employed in company
+ $blockInstance->assignMessageField('company_status', "user_is_employed_in_company");
+ $blockInstance->assignLinkFieldWithAction('company' , "employee_overview");
+ $blockInstance->assignMessageField('company', "link_text_employee_overview");
+ $blockInstance->assignMessageField('company_title', "link_title_employee_overview");
+} else {
+ // No company participation!
+ $blockInstance->assignMessageField('company_status', "user_not_assigned_company");
+ $blockInstance->assignLinkFieldWithAction('company' , "company");
+ $blockInstance->assignMessageField('company', "link_text_company");
+ $blockInstance->assignMessageField('company_title', "link_title_company");
+}
+
+// Flush the content out to a template variable
+$blockInstance->flushContent();
+
+// Get helper instance
+$linkInstance = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'logout'));
+
+// Add action
+$linkInstance->addActionLinkById('logout', 'logout');
+
+// Flush the content
+$linkInstance->flushContent();
+
+// [EOC]
+?>
+<div id="content_header">
+ Willkommen zum Staat in <span class=\"app_name\">{?app_full_name?}</span>!
+</div>
+
+<div id="content_body">
+ {?government_failed_content?}
+</div>
+
+<div id="persona_data" title="Informationen zu Deinem Spieleaccount">
+ <div id="persona_header">
+ Account-Infos:
+ </div>
+
+ <div id="persona_body">
+ {?persona_data?}
+ </div>
+
+ <div id="logout">
+ {?logout?}
+ </div>
+</div>
+
+<div id="company_data" title="Informationen zu der aktuell ausgewählten Reederei">
+ <div id="company_header">
+ Reederei-Infos:
+ </div>
+
+ <div id="company_body">
+ {?company_data?}
+ </div>
+</div>
// [EOC]
?>
<div id="content_header">
- Willkommen im Loginbereich von <span class=\"app_name\">{?app_full_name?}</span>!
+ Willkommen im Loginbereich von <span class=\"app_name\">{?app_full_name?}</span>!
</div>
<div id="content_body">