Links in all templates reworked, Primera API (see www.primusportal.de for details...
[shipsimu.git] / application / ship-simu / templates / de / code / login_main.ctp
1 <?php
2 ///////////////////////////////
3 // Assign personal user data //
4 ///////////////////////////////
5
6 // Get a new instance for personal data
7 $blockInstance = WebBlockHelper::createWebBlockHelper($this, 'persona_data');
8
9 // Set the data source instance which must exist in registry
10 $blockInstance->prefetchValueInstance('user');
11
12 // Assign fields with template variables
13 $blockInstance->assignField('username');
14 $blockInstance->assignFieldWithFilter('user_status', "user_status_translator");
15
16 // Shall we include registration date?
17 if ($blockInstance->ifIncludeRegistrationStamp()) {
18         // Then assign it as well!
19         $blockInstance->assignFieldWithFilter('registered', 'formatTimestamp');
20 } // END - if
21
22 // Flush the content out to a template variable
23 $blockInstance->flushContent();
24
25 //////////////////////////////////////
26 // Assign the shipping company data //
27 //////////////////////////////////////
28
29 // Get a new instance for personal data
30 $blockInstance = WebBlockHelper::createWebBlockHelper($this, 'company_data');
31
32 // Set the data source instance
33 $blockInstance->prefetchValueInstance('company', 'user');
34
35 // Assign the company name
36 if ($blockInstance->getValueInstance()->ifUserIsFounder()) {
37         // User is the founder of the company
38         $blockInstance->assignMessageField('company_status', "user_is_company_founder");
39         $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview");
40         $blockInstance->assignMessageField('company_link_text', "link_text_company_overview");
41         $blockInstance->assignMessageField('company_link_title', "link_title_company_overview");
42 } elseif ($blockInstance->getValueInstance()->ifUserIsOwner()) {
43         // User owns the company
44         $blockInstance->assignMessageField('company_status', "user_is_company_owner");
45         $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview");
46         $blockInstance->assignMessageField('company_link_text', "link_text_company_overview");
47         $blockInstance->assignMessageField('company_link_title', "link_title_company_overview");
48 } elseif ($blockInstance->getValueInstance()->ifUserIsEmployee()) {
49         // User is employed in company
50         $blockInstance->assignMessageField('company_status', "user_is_employed_in_company");
51         $blockInstance->assignLinkFieldWithAction('company_link' , "employee_overview");
52         $blockInstance->assignMessageField('company_link_text', "link_text_employee_overview");
53         $blockInstance->assignMessageField('company_link_title', "link_title_employee_overview");
54 } else {
55         // No company participation!
56         $blockInstance->assignMessageField('company_status', "user_not_assigned_company");
57         $blockInstance->assignLinkFieldWithAction('company_link' , "company");
58         $blockInstance->assignMessageField('company_link_text', "link_text_company");
59         $blockInstance->assignMessageField('company_link_title', "link_title_company");
60 }
61
62 // Flush the content out to a template variable
63 $blockInstance->flushContent();
64
65 // Get helper instance
66 $helper = WebLinkHelper::createWebLinkHelper($this, 'logout_action_link', 'index.php?app=ship-simu&amp;page=login_area');
67
68 // Add action
69 $helper->addActionLink('logout', "Ausloggen");
70
71 // Flush the content
72 $helper->flushContent();
73
74 // End of all PHP commands
75 ?>
76 <div id="content_header">
77         Willkommen im Loginbereich  von {?app_full_name?}!
78 </div>
79
80 <div id="content_body">
81         {?login_content?}
82 </div>
83
84 <div id="persona_data" title="Informationen zu Deinem Spieleaccount">
85         <div id="persona_header">
86                 Account-Infos:
87         </div>
88
89         <div id="persona_body">
90                 {?persona_data?}
91         </div>
92
93         <div id="logout_link">
94                 {?logout_action_link?}
95         </div>
96 </div>
97
98 <div id="company_data" title="Informationen zu der aktuell ausgew&auml;hlten Reederei">
99         <div id="company_header">
100                 Reederei-Infos:
101         </div>
102
103         <div id="company_body">
104                 {?company_data?}
105         </div>
106 </div>