From: Roland Häder Date: Sat, 22 Aug 2009 00:47:17 +0000 (+0000) Subject: NPE catched, double->single converted: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1ba00542fd9835dffde8c340cc5d8c5cb1c91659;p=shipsimu.git NPE catched, double->single converted: - NPE in ShipSimuMember class catched - Double quotes to single quotes converted in templates - Output of current points amount added --- diff --git a/application/ship-simu/main/user/extended/class_ShipSimuMember.php b/application/ship-simu/main/user/extended/class_ShipSimuMember.php index fa2c0d9..f0ccd90 100644 --- a/application/ship-simu/main/user/extended/class_ShipSimuMember.php +++ b/application/ship-simu/main/user/extended/class_ShipSimuMember.php @@ -166,8 +166,16 @@ class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember, Booka * @return void */ public function bookAmountDirectly (Requestable $requestInstance) { - // Get the points class from registry - $pointsInstance = Registry::getRegistry()->getInstance('points'); + // Init points instance + $pointsInstance = null; + + try { + // Get the points class from registry + $pointsInstance = Registry::getRegistry()->getInstance('points'); + } catch (NullPointerException $e) { + // Instance not found in registry + // @TODO We should log this later + } // Is the points instance null? if (is_null($pointsInstance)) { diff --git a/application/ship-simu/templates/de/code/block_persona_data.ctp b/application/ship-simu/templates/de/code/block_persona_data.ctp index db011d4..73b0d73 100644 --- a/application/ship-simu/templates/de/code/block_persona_data.ctp +++ b/application/ship-simu/templates/de/code/block_persona_data.ctp @@ -16,6 +16,9 @@ $helperInstance->flushContent();
Spielerstatus: {?block_user_status?}
+
+ {?currency?}: {?block_points?} +
{?profile?}
diff --git a/application/ship-simu/templates/de/code/login_main.ctp b/application/ship-simu/templates/de/code/login_main.ctp index fb4771b..56adbab 100644 --- a/application/ship-simu/templates/de/code/login_main.ctp +++ b/application/ship-simu/templates/de/code/login_main.ctp @@ -7,16 +7,17 @@ $blockInstance = ObjectFactory::createObjectByConfiguredName('web_block_helper', array($this, 'persona_data')); // Set the data source instance which must exist in registry -$blockInstance->prefetchValueInstance('user'); +$blockInstance->prefetchValueInstance('user', 'user_points'); // Assign fields with template variables $blockInstance->assignField('username'); -$blockInstance->assignFieldWithFilter('user_status', "user_status_translator"); +$blockInstance->assignFieldWithFilter('user_status', 'user_status_translator'); +$blockInstance->assignFieldWithFilter('points', 'format_number'); // Shall we include registration date? if ($blockInstance->ifIncludeRegistrationStamp()) { // Then assign it as well! - $blockInstance->assignFieldWithFilter('registered', 'formatTimestamp'); + $blockInstance->assignFieldWithFilter('registered', 'format_timestamp'); } // END - if // Flush the content out to a template variable @@ -35,28 +36,28 @@ $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"); + $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"); + $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"); + $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"); + $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