forked from terminal42/contao-pageimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModuleBackgroundImage.php
66 lines (51 loc) · 1.62 KB
/
ModuleBackgroundImage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* pageimage Extension for Contao Open Source CMS
*
* @copyright Copyright (c) 2009-2014, terminal42 gmbh
* @author terminal42 gmbh <[email protected]>
* @license http://opensource.org/licenses/lgpl-3.0.html LGPL
* @link http://github.com/terminal42/contao-pageimage
*/
class ModuleBackgroundImage extends ModulePageImage
{
/**
* Template
* @var string
*/
protected $strTemplate = 'mod_background_image';
public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### BACKGROUND IMAGE ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=modules&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$strBuffer = parent::generate();
if ($strBuffer == '') {
return '';
} elseif ($this->Template->useCss) {
$GLOBALS['TL_HEAD'][] = $strBuffer;
} else {
$GLOBALS['TL_BODY'][] = $strBuffer;
}
}
protected function compile()
{
parent::compile();
$support = array(
'ie' => 9,
'chrome' => 3,
'firefox' => 4,
'opera' => 10,
'safari' => 5
);
$agent = \Environment::get('agent');
$this->Template->useCss = (isset($support[$agent->browser]) && $agent->version >= $support[$agent->browser]);
}
}