]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/templates/de/code/login_main.ctp
All helper are now configurable
[shipsimu.git] / application / ship-simu / templates / de / code / login_main.ctp
index 3326c51f4405e4c7f7c2bcca1cd686d4b1ed8eeb..e8b0044f1db2669d0d6bce6351226024dbccb557 100644 (file)
@@ -4,13 +4,14 @@
 ///////////////////////////////
 
 // Get a new instance for personal data
-$blockInstance = WebBlockHelper::createWebBlockHelper($this, 'persona_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()) {
@@ -26,16 +27,50 @@ $blockInstance->flushContent();
 //////////////////////////////////////
 
 // Get a new instance for personal data
-$blockInstance = WebBlockHelper::createWebBlockHelper($this, 'company_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_link' , "company_overview");
+       $blockInstance->assignMessageField('company_link_text', "link_text_company_overview");
+       $blockInstance->assignMessageField('company_link_title', "link_title_company_overview");
+} elseif ($blockInstance->getValueInstance()->ifUserIsOwner()) {
+       // User owns the company
+       $blockInstance->assignMessageField('company_status', "user_is_company_owner");
+       $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview");
+       $blockInstance->assignMessageField('company_link_text', "link_text_company_overview");
+       $blockInstance->assignMessageField('company_link_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_link' , "employee_overview");
+       $blockInstance->assignMessageField('company_link_text', "link_text_employee_overview");
+       $blockInstance->assignMessageField('company_link_title', "link_title_employee_overview");
+} else {
+       // No company participation!
+       $blockInstance->assignMessageField('company_status', "user_not_assigned_company");
+       $blockInstance->assignLinkFieldWithAction('company_link' , "company");
+       $blockInstance->assignMessageField('company_link_text', "link_text_company");
+       $blockInstance->assignMessageField('company_link_title', "link_title_company");
+}
 
-// Get the user instance 
-$userInstance = Registry::getRegistry()->getInstance('user');
+// Flush the content out to a template variable
+$blockInstance->flushContent();
 
-// Get a shipping company instance ready
-$companyInstance = ObjectFactory::createObjectByConfiguredName('company_class', array($userInstance));
+// Get helper instance
+$linkInstance = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'logout_action_link', 'index.php?app={?app_short_name?}&page=login_area'));
 
-// Flush the content out to a template variable
-//$blockInstance->flushContent();
+// Add action
+$linkInstance->addLinkGroup('logout', "");
+$linkInstance->addActionLink('logout', "Ausloggen");
+
+// Flush the content
+$linkInstance->flushContent();
 
 // End of all PHP commands
 ?>
@@ -57,8 +92,7 @@ $companyInstance = ObjectFactory::createObjectByConfiguredName('company_class',
        </div>
 
        <div id="logout_link">
-               [<a href="$config[base_url]/index.php?app=ship-simu&amp;page=login_area&amp;action=logout"
-                title="Aus dem Spiel ausloggen">Ausloggen</a>]
+               {?logout_action_link?}
        </div>
 </div>