Company stubs now finished, output of 'company_status' added
authorRoland Häder <roland@mxchange.org>
Sat, 28 Jun 2008 15:46:07 +0000 (15:46 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 28 Jun 2008 15:46:07 +0000 (15:46 +0000)
.gitattributes
application/ship-simu/main/companies/class_ShippingCompany.php
application/ship-simu/templates/de/code/block_company_data.ctp [new file with mode: 0644]
application/ship-simu/templates/de/code/block_persona_data.ctp
application/ship-simu/templates/de/code/login_main.ctp
inc/classes/main/helper/web/blocks/class_WebBlockHelper.php

index 9598bc1..ba30777 100644 (file)
@@ -136,6 +136,7 @@ application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php -text
 application/ship-simu/starter.php -text
 application/ship-simu/templates/.htaccess -text
 application/ship-simu/templates/de/.htaccess -text
+application/ship-simu/templates/de/code/block_company_data.ctp -text
 application/ship-simu/templates/de/code/block_persona_data.ctp -text
 application/ship-simu/templates/de/code/captch_graphic_code.ctp -text
 application/ship-simu/templates/de/code/footer.ctp -text
index e3bd591..841be84 100644 (file)
@@ -138,6 +138,72 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                return $participates;
        }
 
+       /**
+        * Checks wether the current user in registry is the company founder
+        *
+        * @return      $isFounder      Wether the current user is the company founder
+        */
+       public function ifUserIsFounder () {
+               // Default is not the founder
+               $isFounder = false;
+
+               // Get result instance
+               $resultInstance = $this->getResultInstance();
+
+               // Is it set?
+               if ($resultInstance instanceof SearchableResult) {
+                       // Result found so analyse it
+                       $this->partialStub("Check if user is company founder.");
+               } // END - if
+
+               // Return result
+               return $isFounder;
+       }
+
+       /**
+        * Checks wether the current user in registry is the company owner
+        *
+        * @return      $isOwner        Wether the current user is the company owner
+        */
+       public function ifUserIsOwner () {
+               // Default is not the owner
+               $isOwner = false;
+
+               // Get result instance
+               $resultInstance = $this->getResultInstance();
+
+               // Is it set?
+               if ($resultInstance instanceof SearchableResult) {
+                       // Result found so analyse it
+                       $this->partialStub("Check if user is company owner.");
+               } // END - if
+
+               // Return result
+               return $isOwner;
+       }
+
+       /**
+        * Checks wether the current user in registry is an employee in this company
+        *
+        * @return      $isOwner        Wether the current user is an employee in this company
+        */
+       public function ifUserIsEmployee () {
+               // Default is no employee
+               $isEmployee = false;
+
+               // Get result instance
+               $resultInstance = $this->getResultInstance();
+
+               // Is it set?
+               if ($resultInstance instanceof SearchableResult) {
+                       // Result found so he is employee
+                       $isEmployee = true;
+               } // END - if
+
+               // Return result
+               return $isEmployee;
+       }
+
        //----------------------------------------------------------------------------
        // From here is very old code which needs to be translated and changed heavily
        //----------------------------------------------------------------------------
diff --git a/application/ship-simu/templates/de/code/block_company_data.ctp b/application/ship-simu/templates/de/code/block_company_data.ctp
new file mode 100644 (file)
index 0000000..7a6037e
--- /dev/null
@@ -0,0 +1,7 @@
+<div class="gamer_name_div">
+       Firmenstatus: <span class="company_status">{?company_status?}</span>
+</div>
+<div class="gamer_profile_div">
+       <a href="$config[base_url]/index.php?app=ship-simu&amp;page=login_area&amp;action={?company_link_action?}"
+        title="{?company_link_title?}">{?company_link_text?}</a>
+</div>
index 02a84d9..6b01149 100644 (file)
@@ -6,7 +6,7 @@ $helperInstance = WebLinkHelper::createWebLinkHelper($this, 'profile_link');
 $helperInstance->prefetchValueInstance('user');
 
 // Flush the content out
-$helperInstance->flushContent();
+//$helperInstance->flushContent();
 
 // End of PHP commands
 ?>
index 97fbbd3..3b8ef41 100644 (file)
@@ -34,20 +34,28 @@ $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->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_stats', "user_is_company_owner");
+       $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_stats', "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_stats', "user_not_assigned_company");
+       $blockInstance->assignMessageField('company_status', "user_not_assigned_company");
        $blockInstance->assignLinkFieldWithAction('company_link' , "found_new_company");
+       $blockInstance->assignMessageField('company_link_text', "link_text_new_company");
+       $blockInstance->assignMessageField('company_link_title', "link_title_new_company");
 }
 
 // Flush the content out to a template variable
index a71b36d..d8a33eb 100644 (file)
@@ -91,6 +91,32 @@ class WebBlockHelper extends BaseWebHelper implements HelpableTemplate {
        }
 
        /**
+        * Assignes a template variable with a message from a given message id
+        *
+        * @param       $templateVariable       Template variable to assign
+        * @param       $messageId                      Message id to load an assign
+        * @return      void
+        */
+       public function assignMessageField ($templateVariable, $messageId) {
+               // Get message
+               $message = $this->getLanguageInstance()->getMessage($messageId);
+
+               // And assign it
+               $this->getTemplateInstance()->assignVariable($templateVariable, $message);
+       }
+
+       /**
+        * Assigns a link field with a given value
+        *
+        * @param       $linkField              "Link field" (variable) to assign
+        * @param       $actionValue    Action value to assign
+        * @return      void
+        */
+       public function assignLinkFieldWithAction ($linkField, $actionValue) {
+               $this->getTemplateInstance()->assignVariable($linkField . '_action', $actionValue);
+       }
+
+       /**
         * Flush the content out,e g. to a template variable
         *
         * @return      void