Passed
Push — master ( bc7ecd...4efa95 )
by Stefan
07:48
created

Divs::div_federation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * *****************************************************************************
4
 * Contributions to this work were made on behalf of the GÉANT project, a 
5
 * project that has received funding from the European Union’s Framework 
6
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
7
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
8
 * 691567 (GN4-1) and No. 731122 (GN4-2).
9
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
10
 * of the copyright in all material which was developed by a member of the GÉANT
11
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
12
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
13
 * UK as a branch of GÉANT Vereniging.
14
 * 
15
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
16
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
17
 *
18
 * License: see the web/copyright.inc.php file in the file structure or
19
 *          <base_url>/copyright.php after deploying the software
20
 */
21
22
namespace web\skins\modern;
23
use web\lib\user;
24
25
require_once "Menu.php";
26
27
/**
28
 * This class delivers various <div> elements for the front page.
29
 * 
30
 * @author Tomasz Wolniewicz <[email protected]>
31
 */
32
class Divs {
33
34
    /**
35
     * The Gui object we are working with.
36
     * 
37
     * @var user\Gui
38
     */
39
    private $Gui;
40
41
    public function __construct(user\Gui $Gui) {
42
        $this->Gui = $Gui;
43
    }
44
45
    public function div_heading($visibility = 'all') {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_heading" is not in camel caps format
Loading history...
46
        $selectedLang = $this->Gui->langObject->getLang();
47
        $menu = new Menu($visibility, $selectedLang);
48
        $retval = "<div id='heading'>";
49
        $location = $this->Gui->skinObject->findResourceUrl("IMAGES", "consortium_logo.png");
50
        if ($location !== FALSE) {
51
            $retval .= "<div id='cat_logo'>
52
            <a href='".CONFIG_CONFASSISTANT['CONSORTIUM']['homepage']."'><img id='logo_img' src='$location' alt='Consortium Logo'/></a>
53
            <span>Configuration Assistant Tool</span>
54
            </div>";
55
        }
56
        $retval .= "<div id='motd'>" . (isset(CONFIG['APPEARANCE']['MOTD']) ? CONFIG['APPEARANCE']['MOTD'] : '&nbsp') . "</div>";
57
        $loc2 = $this->Gui->skinObject->findResourceUrl("IMAGES", "icons/menu.png");
58
        if ($loc2 !== FALSE) {
59
            $retval .= "<img id='hamburger' src='$loc2' alt='Menu'/>";
60
        }
61
        $retval .= "<div id='menu_top'>";
62
        if ($visibility === 'start') {
63
            $retval .= $menu->printMinimalMenu();
64
        } else {
65
            $retval .= $menu->printMenu();
66
        }
67
        $retval .= "</div></div>\n";
68
        return $retval;
69
    }
70
71
    public function div_user_welcome() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_user_welcome" is not in camel caps format
Loading history...
72
        $retval = "
73
<div id='user_welcome'> <!-- this information is shown just before the download -->
74
    <strong>" . $this->Gui->textTemplates->templates[user\WELCOME_ABOARD_PAGEHEADING] . "</strong>
75
    <p>
76
    <span id='download_info'>
77
    <!-- the empty href is dynamically exchanged with the actual path by jQuery at runtime -->
78
        " . $this->Gui->textTemplates->templates[user\WELCOME_ABOARD_DOWNLOAD] . "
79
    </span>
80
    <p>" . $this->Gui->textTemplates->templates[user\WELCOME_ABOARD_HEADING] . "
81
    <br/>
82
    <br/>";
83
        switch (CONFIG_CONFASSISTANT['CONSORTIUM']['name']) {
84
            case "eduroam": $retval .= $this->Gui->textTemplates->templates[user\EDUROAM_WELCOME_ADVERTISING];
85
                break;
86
            default:
87
        }
88
        $retval .= "
89
    </p>
90
    <p>" . $this->Gui->textTemplates->templates[user\WELCOME_ABOARD_USAGE] . "
91
    <p>" . $this->Gui->textTemplates->templates[user\WELCOME_ABOARD_PROBLEMS] . "
92
    </p>
93
    <p>
94
    <a href='javascript:back_to_downloads()'><strong>" . $this->Gui->textTemplates->templates[user\WELCOME_ABOARD_BACKTODOWNLOADS] . "</strong></a>
95
    </p>
96
</div> <!-- id='user_welcomer_page' -->
97
";
98
        return $retval;
99
    }
100
101
    public function div_silverbullet() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_silverbullet" is not in camel caps format
Loading history...
102
        $retval = "
103
<div id='silverbullet'>"
104
    . $this->Gui->textTemplates->templates[user\SB_GO_AWAY] . 
105
    "</div>
106
    ";
107
        return $retval;
108
    }
109
110
    public function div_top_welcome() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_top_welcome" is not in camel caps format
Loading history...
111
        return "
112
<div id='welcome_top1'>
113
    " . $this->Gui->textTemplates->templates[user\HEADING_TOPLEVEL_GREET] . "
114
</div>
115
<div id='top_invite'>
116
    " . $this->Gui->textTemplates->templates[user\HEADING_TOPLEVEL_PURPOSE] . "
117
</div>";
118
    }
119
120
    public function div_roller() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_roller" is not in camel caps format
Loading history...
121
        $retval = "
122
<div id='roller'>
123
    <div id='slides'>
124
        <span id='line1'>" . $this->Gui->textTemplates->templates[user\FRONTPAGE_ROLLER_EASY] . "</span>
125
        <span id='line2'></span>
126
        <span id='line3'></span>
127
        <span id='line4'>";
128
        
129
        if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL") {
130
            $retval .= $this->Gui->textTemplates->templates[user\FRONTPAGE_ROLLER_CUSTOMBUILT];
131
        } elseif (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
132
            $retval .= $this->Gui->textTemplates->templates[user\SB_FRONTPAGE_ROLLER_CUSTOMBUILT];
133
        }
134
                
135
        $retval .= "</span>
136
        <span id='line5'>";
137
        if (!empty(CONFIG_CONFASSISTANT['CONSORTIUM']['signer_name'])) {
138
            $retval .= $this->Gui->textTemplates->templates[user\FRONTPAGE_ROLLER_SIGNEDBY];
139
        }
140
        $retval .= "
141
        </span>
142
    </div>";
143
        $rollLocation = $this->Gui->skinObject->findResourceUrl("IMAGES", "empty.png");
144
        if ($rollLocation !== FALSE) {
145
            $retval .= "<div id = 'img_roll'>
146
                <img id='img_roll_0' src='$rollLocation' alt='Rollover 0'/> <img id='img_roll_1' src='$rollLocation' alt='Rollover 1'/>
147
            </div>";
148
        }
149
        $retval .= "</div>";
150
        return $retval;
151
    }
152
153
    public function div_main_button() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_main_button" is not in camel caps format
Loading history...
154
        $retval = "
155
<div id='user_button_td'>
156
  <span id='signin'>
157
     <button class='large_button signin signin_large' id='user_button1'>
158
        <span id='user_button'>";
159
        if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL") {
160
            $retval .= $this->Gui->textTemplates->templates[user\FRONTPAGE_BIGDOWNLOADBUTTON];
161
        } elseif (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
162
            $retval .= $this->Gui->textTemplates->templates[user\SB_FRONTPAGE_BIGDOWNLOADBUTTON];
163
        }
164
        
165
        $retval .= "
166
        </span>
167
     </button>
168
  </span>
169
  <span style='padding-left:50px'>&nbsp;</span>
170
</div>";
171
        return $retval;
172
    }
173
174
    public function div_profiles() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_profiles" is not in camel caps format
Loading history...
175
        return "
176
<div id='profiles'> <!-- this is the profile selection filled during run time -->
177
    <div id='profiles_h' class='sub_h'>" . $this->Gui->textTemplates->templates[user\PROFILE_SELECTION] . "
178
    </div>" .
179
"<select id='profile_list'></select><div id='profile_desc' class='profile_desc'></div>" .
180
                "</div>";
181
    }
182
183
    public function div_pagetitle($mainText, $extraText = '') {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_pagetitle" is not in camel caps format
Loading history...
184
        return "
185
<div id='institution_name'>
186
    <span id='inst_name_span'>$mainText</span> <div id='inst_extra_text'>$extraText</div> 
187
</div>";
188
    }
189
    
190
191
    public function div_institution($selectButton = TRUE) {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_institution" is not in camel caps format
Loading history...
192
        $retval = "<div id='institution_name'>
193
    <span id='inst_name_span'></span> <div id='inst_extra_text'></div><!-- this will be filled with the IdP name -->" .
194
                ($selectButton ? "<a  id='select_another' class='signin' href=\"\">" . $this->Gui->textTemplates->templates[user\INSTITUTION_SELECTION] . "</a>" : "") .
195
                "</div>";
196
        $retval .= $this->emptyImage('idp_logo', 'IdP Logo');
197
        return $retval;
198
    }
199
    
200
    public function div_federation() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_federation" is not in camel caps format
Loading history...
201
        $retval = $this->emptyImage('fed_logo', 'Federation Logo');
202
        return $retval;
203
    }
204
205
    public function div_otherinstallers() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_otherinstallers" is not in camel caps format
Loading history...
206
        $retval = "
207
<div class='sub_h'>
208
    <div id='other_installers'>" . $this->Gui->textTemplates->templates[user\DOWNLOAD_CHOOSE] . "
209
         <table id='device_list' style='padding:0px;'>";
210
211
        foreach ($this->Gui->listDevices(isset($_REQUEST['hidden']) ? $_REQUEST['hidden'] : 0) as $group => $deviceGroup) {
212
            $groupIndex = count($deviceGroup);
213
            $deviceIndex = 0;
214
215
            $imgTag = "";
216
            $imgLocation = $this->Gui->skinObject->findResourceUrl("IMAGES", "vendorlogo/" . $group . ".png");
217
            if ($imgLocation !== FALSE) {
218
                $imgTag = '<img src="' . $imgLocation . '" alt="' . $group . ' Device" title="' . $group . ' Device">';
219
            }
220
            $retval .= '<tbody><tr><td class="vendor" rowspan="' . $groupIndex . '">' . $imgTag . '</td>';
221
            foreach ($deviceGroup as $d => $D) {
222
                if ($deviceIndex) {
223
                    $retval .= '<tr>';
224
                }
225
                $retval .= "<td><button id='" . $d . "'>" . $D['display'] . "</button>"
226
                        . "<div class='device_info' id='info_" . $d . "'></div></td>"
227
                        . "<td><button class='more_info_b' id='info_b_" . $d . "'>i</button></td></tr>\n";
228
                $deviceIndex++;
229
            }
230
            $retval .= "</tbody>";
231
        }
232
        
233
        $retval .= "    
234
        </table>
235
    </div>
236
</div>";
237
        return $retval;
238
    }
239
240
    public function div_guess_os($operatingSystem) {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_guess_os" is not in camel caps format
Loading history...
241
        $vendorlogo = $this->Gui->skinObject->findResourceUrl("IMAGES", "vendorlogo/" . $operatingSystem['group'] . ".png");
242
        $vendorstyle = "";
243
        if ($vendorlogo !== FALSE) {
244
            $vendorstyle = "style='background-image:url(\"" . $vendorlogo . "\")'";
245
        }
246
        $deleteIcon = $this->Gui->skinObject->findResourceUrl("IMAGES", "icons/delete_32.png");
247
        $deleteImg = "";
248
        if ($deleteIcon !== FALSE) {
249
            $deleteImg = "<img id='cross_icon_" . $operatingSystem['device'] . "' src='$deleteIcon' >";
250
        }
251
        return "
252
<div class='sub_h' id='guess_os'>
253
    <!-- table browser -->
254
    <table id='browser'>
255
        <tr>
256
            <td>
257
                <button class='large_button guess_os' $vendorstyle id='g_" . $operatingSystem['device'] . "'>
258
                    $deleteImg
259
                    <div class='download_button_text_1' id='download_button_header_" . $operatingSystem['device'] . "'> " . $this->Gui->textTemplates->templates[user\DOWNLOAD_MESSAGE] . "
260
                    </div>
261
                    <div class='download_button_text'>" .
262
                $operatingSystem['display'] . "
263
                    </div>
264
                </button>
265
                <div class='device_info' id='info_g_" . $operatingSystem['device'] . "'></div>
266
          </td>
267
          <td style='vertical-align:top'>
268
               <button class='more_info_b large_button' id='g_info_b_" . $operatingSystem['device'] . "'>i</button>
269
          </td>
270
      </tr>
271
    </table> <!-- id='browser' -->
272
    <div class='sub_h'>
273
       <a href='javascript:other_installers()'>" . $this->Gui->textTemplates->templates[user\DOWNLOAD_CHOOSE] . "</a>
274
    </div>
275
</div> <!-- id='guess_os' -->";
276
    }
277
278
    public function div_footer() {
0 ignored issues
show
Coding Style introduced by
Method name "Divs::div_footer" is not in camel caps format
Loading history...
279
        $retval = "
280
<div class='footer' id='footer'>
281
    <table>
282
        <tr>
283
            <td>" .
284
                $this->Gui->CAT_COPYRIGHT
285
                . "
286
            </td>";
287
            
288
        if (!empty(CONFIG['APPEARANCE']['privacy_notice_url'])) {
289
            $retval .= "<td><a href='".CONFIG['APPEARANCE']['privacy_notice_url']."'>" . sprintf(_("%s Privacy Notice"),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . "</a></td>";
290
        }
291
        $retval .= "<td>";
292
        if (CONFIG_CONFASSISTANT['CONSORTIUM']['name'] == "eduroam" && isset(CONFIG_CONFASSISTANT['CONSORTIUM']['deployment-voodoo']) && CONFIG_CONFASSISTANT['CONSORTIUM']['deployment-voodoo'] == "Operations Team") {
293
            $geant = $this->Gui->skinObject->findResourceUrl("IMAGES", "dante.png");
294
            $eu = $this->Gui->skinObject->findResourceUrl("IMAGES", "eu.png");
295
            if ($geant !== FALSE && $eu !== FALSE) {
296
                $retval .= "<span id='logos'><img src='$geant' alt='GEANT' style='height:23px;width:47px'/>
297
              <img src='$eu' alt='EU' style='height:23px;width:27px;border-width:0px;'/></span>";
298
            }
299
            $retval .= "<span id='eu_text' style='text-align:right; padding-left: 60px; display: block; '><a href='http://ec.europa.eu/dgs/connect/index_en.htm' style='text-decoration:none; vertical-align:top; text-align:right'>European Commission Communications Networks, Content and Technology</a></span>";
300
        } else {
301
            $retval .= "&nbsp;";
302
        }
303
304
        $retval .= "
305
            </td>
306
        </tr>
307
    </table>
308
</div>";
309
        return $retval;
310
    }
311
312
    private function emptyImage($id, $alt) {
313
        $empty = $this->Gui->skinObject->findResourceUrl("IMAGES", "empty.png");
314
        $retval = '';
315
        if ($empty !== FALSE) {
316
            $retval = "<div>
317
    <img id='$id' src='$empty' alt='$alt'/>
318
 </div>";
319
        }
320
        return $retval;
321
    }
322
323
}
324