NPE catched, double->single converted:
authorRoland Häder <roland@mxchange.org>
Sat, 22 Aug 2009 00:47:17 +0000 (00:47 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 22 Aug 2009 00:47:17 +0000 (00:47 +0000)
- NPE in ShipSimuMember class catched
- Double quotes to single quotes converted in templates
- Output of current points amount added

application/ship-simu/main/user/extended/class_ShipSimuMember.php
application/ship-simu/templates/de/code/block_persona_data.ctp
application/ship-simu/templates/de/code/login_main.ctp

index fa2c0d9..f0ccd90 100644 (file)
@@ -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)) {
index db011d4..73b0d73 100644 (file)
@@ -16,6 +16,9 @@ $helperInstance->flushContent();
 <div class="user_status_div">
        Spielerstatus: <span id="user_status">{?block_user_status?}</span>
 </div>
+<div class="user_status_div">
+       {?currency?}: <span id="user_points">{?block_points?}</span>
+</div>
 <div class="user_profile_div">
        {?profile?}
 </div>
index fb4771b..56adbab 100644 (file)
@@ -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