More stubs added, code "made" generic:
[shipsimu.git] / application / ship-simu / templates / de / code / login_main.ctp
index 3326c51f4405e4c7f7c2bcca1cd686d4b1ed8eeb..97fbbd368877a2753b94388be19643fe46c0041b 100644 (file)
@@ -28,14 +28,30 @@ $blockInstance->flushContent();
 // Get a new instance for personal data
 $blockInstance = WebBlockHelper::createWebBlockHelper($this, 'company_data');
 
-// Get the user instance 
-$userInstance = Registry::getRegistry()->getInstance('user');
-
-// Get a shipping company instance ready
-$companyInstance = ObjectFactory::createObjectByConfiguredName('company_class', array($userInstance));
+// 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_stats', "user_is_company_founder");
+       $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview");
+} elseif ($blockInstance->getValueInstance()->ifUserIsOwner()) {
+       // User owns the company
+       $blockInstance->assignMessageField('company_stats', "user_is_company_owner");
+       $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview");
+} elseif ($blockInstance->getValueInstance()->ifUserIsEmployee()) {
+       // User is employed in company
+       $blockInstance->assignMessageField('company_stats', "user_is_employed_in_company");
+       $blockInstance->assignLinkFieldWithAction('company_link' , "employee_overview");
+} else {
+       // No company participation!
+       $blockInstance->assignMessageField('company_stats', "user_not_assigned_company");
+       $blockInstance->assignLinkFieldWithAction('company_link' , "found_new_company");
+}
 
 // Flush the content out to a template variable
-//$blockInstance->flushContent();
+$blockInstance->flushContent();
 
 // End of all PHP commands
 ?>