Browse code

Add device showcase module

Benjamin Roth authored on05/01/2016 15:52:24
Showing23 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+order deny,allow
2
+allow from all
0 3
\ No newline at end of file
1 4
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+.mod_clientsProjectDevices .layout_default.device {
2
+  position: relative;
3
+  display: inline-block; }
4
+  .mod_clientsProjectDevices .layout_default.device .screenshot {
5
+    position: absolute;
6
+    vertical-align: middle; }
7
+  .mod_clientsProjectDevices .layout_default.device.phone .screenshot {
8
+    top: 8.8%;
9
+    left: 4.854%; }
10
+  .mod_clientsProjectDevices .layout_default.device.desktop .screenshot {
11
+    top: 4.901%;
12
+    left: 4.202%; }
13
+  .mod_clientsProjectDevices .layout_default.device.tablet .screenshot {
14
+    top: 11%;
15
+    left: 6.737%; }
16
+
17
+/*# sourceMappingURL=devices.css.map */
0 18
new file mode 100644
... ...
@@ -0,0 +1,35 @@
1
+.mod_clientsProjectDevices {
2
+  .layout_default.device {
3
+    position: relative;
4
+    display: inline-block;
5
+
6
+    .screenshot {
7
+      position: absolute;
8
+      vertical-align: middle;
9
+    }
10
+
11
+    &.phone {
12
+
13
+      .screenshot {
14
+        top: 8.8%;
15
+        left: 4.854%;
16
+      }
17
+    }
18
+
19
+    &.desktop {
20
+
21
+      .screenshot {
22
+        top: 4.901%;
23
+        left: 4.202%;
24
+      }
25
+    }
26
+
27
+    &.tablet {
28
+
29
+      .screenshot {
30
+        top: 11%;
31
+        left: 6.737%;
32
+      }
33
+    }
34
+  }
35
+}
0 36
\ No newline at end of file
1 37
new file mode 100644
2 38
Binary files /dev/null and b/assets/images/Nexus_6.png differ
3 39
new file mode 100644
4 40
Binary files /dev/null and b/assets/images/desktop.png differ
5 41
new file mode 100644
6 42
Binary files /dev/null and b/assets/images/smartphone.png differ
7 43
new file mode 100644
8 44
Binary files /dev/null and b/assets/images/tablet.png differ
... ...
@@ -28,6 +28,15 @@ class tl_module_esm_clients extends \Backend
28 28
 		return $this->getTemplateGroup('_clientsShowcase_');
29 29
 	}
30 30
 
31
+	/**
32
+	 * Return all device presentation templates as array
33
+	 * @return array
34
+	 */
35
+	public function getProjectDevicesTemplates()
36
+	{
37
+		return $this->getTemplateGroup('_project_devices_');
38
+	}
39
+
31 40
 	public function getClients()
32 41
 	{
33 42
 		$arrClients = array();
... ...
@@ -36,8 +36,9 @@ ClassLoader::addClasses(array
36 36
 	'eSM_clients\EsmClientsSettingsModel' => 'system/modules/eSM_clients/models/EsmClientsSettingsModel.php',
37 37
 
38 38
 	// Modules
39
-	'eSM_clients\ModuleClientsShowcase' => 'system/modules/eSM_clients/modules/ModuleClientsShowcase.php',
40
-	'eSM_clients\ModuleClientsProject' => 'system/modules/eSM_clients/modules/ModuleClientsProject.php',
39
+	'eSM_clients\ModuleClientsShowcase'       => 'system/modules/eSM_clients/modules/ModuleClientsShowcase.php',
40
+	'eSM_clients\ModuleClientsProject'        => 'system/modules/eSM_clients/modules/ModuleClientsProject.php',
41
+	'eSM_clients\ModuleClientsProjectDevices' => 'system/modules/eSM_clients/modules/ModuleClientsProjectDevices.php',
41 42
 
42 43
 ));
43 44
 
... ...
@@ -48,6 +49,8 @@ TemplateLoader::addFiles(array
48 49
 (
49 50
 	'_clientsShowcase_default'      => 'system/modules/eSM_clients/templates/modules/inc',
50 51
 	'mod_clientsShowcase'           => 'system/modules/eSM_clients/templates/modules',
51
-	'mod_clientsProject'            => 'system/modules/eSM_clients/templates/modules',
52
-	'be_clientsShowcase_sorting'    => 'system/modules/eSM_clients/templates/backend',
52
+    'mod_clientsProject'            => 'system/modules/eSM_clients/templates/modules',
53
+    '_project_devices_default'      => 'system/modules/eSM_clients/templates/modules/inc',
54
+    'mod_clientsProjectDevices'     => 'system/modules/eSM_clients/templates/modules',
55
+    'be_clientsShowcase_sorting'    => 'system/modules/eSM_clients/templates/backend',
53 56
 ));
... ...
@@ -27,6 +27,52 @@ array_insert($GLOBALS['BE_MOD'], 1, array
27 27
 
28 28
 $GLOBALS['FE_MOD']['esalesClients'] = array
29 29
 (
30
-	'clientsShowcase' => 'ModuleClientsShowcase',
31
-	'clientsProject'  => 'ModuleClientsProject'
30
+	'clientsShowcase'        => 'ModuleClientsShowcase',
31
+	'clientsProject'         => 'ModuleClientsProject',
32
+	'clientsProjectDevices'  => 'ModuleClientsProjectDevices'
33
+);
34
+
35
+
36
+/**
37
+ * Devices
38
+ */
39
+
40
+$GLOBALS['eSM_clients']['devices'] = array
41
+(
42
+	'phone' => array
43
+	(
44
+		'devicemask' => array
45
+		(
46
+			'imageSRC' => 'system/modules/eSM_clients/assets/images/Nexus_6.png',
47
+			'ratio'    => 0.75
48
+		),
49
+		'screen'     => array
50
+		(
51
+			'ratio' => array('x'=>0.911, 'y'=>0.759)
52
+		)
53
+	),
54
+	'desktop' => array
55
+	(
56
+		'devicemask' => array
57
+		(
58
+			'imageSRC' => 'system/modules/eSM_clients/assets/images/desktop.png',
59
+			'ratio'    => 1.00
60
+		),
61
+		'screen'     => array
62
+		(
63
+			'ratio' => array('x'=>0.919, 'y'=>0.622)
64
+		)
65
+	),
66
+	'tablet' => array
67
+	(
68
+		'devicemask' => array
69
+		(
70
+			'imageSRC' => 'system/modules/eSM_clients/assets/images/tablet.png',
71
+			'ratio'    => 0.75
72
+		),
73
+		'screen'     => array
74
+		(
75
+			'ratio' => array('x'=>0.865, 'y'=>0.779)
76
+		)
77
+	)
32 78
 );
33 79
\ No newline at end of file
... ...
@@ -110,7 +110,7 @@ $GLOBALS['TL_DCA']['tl_esm_clients_projects'] = array
110 110
 	// Palettes
111 111
 	'palettes' => array
112 112
 	(
113
-		'default'                     => '{title_legend},title,alias;{categorize_legend},type;{details_legend},text,projectUrl,services,features,tech;{images_legend},gallerySRC;{invisible_legend:hide},invisible,start,stop'
113
+		'default'                     => '{title_legend},title,alias;{categorize_legend},type;{details_legend},text,projectUrl,services,features,tech;{images_legend},gallerySRC,desktopSRC,phoneSRC,tabletSRC;{invisible_legend:hide},invisible,start,stop'
114 114
 	),
115 115
 
116 116
 	// Fields
... ...
@@ -194,7 +194,7 @@ $GLOBALS['TL_DCA']['tl_esm_clients_projects'] = array
194 194
 			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['features'],
195 195
 			'inputType'               => 'listWizard',
196 196
 			'exclude'                 => true,
197
-			'eval'                    => array('mandatory'=>true),
197
+			'eval'                    => array('mandatory'=>false),
198 198
 			'sql'                     => "text NULL"
199 199
 		),
200 200
 		'tech' => array
... ...
@@ -242,6 +242,30 @@ $GLOBALS['TL_DCA']['tl_esm_clients_projects'] = array
242 242
 			'inputType'               => 'text',
243 243
 			'eval'                    => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
244 244
 			'sql'                     => "varchar(10) NOT NULL default ''"
245
-		)
245
+		),
246
+		'desktopSRC' => array
247
+		(
248
+			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['desktopSRC'],
249
+			'exclude'                 => true,
250
+			'inputType'               => 'fileTree',
251
+			'eval'                    => array('fieldType'=>'radio', 'filesOnly'=>true, 'extensions'=>\Config::get('validImageTypes')),
252
+			'sql'                     => "binary(16) NULL"
253
+		),
254
+		'phoneSRC' => array
255
+		(
256
+			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['phoneSRC'],
257
+			'exclude'                 => true,
258
+			'inputType'               => 'fileTree',
259
+			'eval'                    => array('fieldType'=>'radio', 'filesOnly'=>true, 'extensions'=>\Config::get('validImageTypes')),
260
+			'sql'                     => "binary(16) NULL"
261
+		),
262
+		'tabletSRC' => array
263
+		(
264
+			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tabletSRC'],
265
+			'exclude'                 => true,
266
+			'inputType'               => 'fileTree',
267
+			'eval'                    => array('fieldType'=>'radio', 'filesOnly'=>true, 'extensions'=>\Config::get('validImageTypes')),
268
+			'sql'                     => "binary(16) NULL"
269
+		),
246 270
 	)
247 271
 );
248 272
\ No newline at end of file
... ...
@@ -18,6 +18,7 @@
18 18
  */
19 19
 $GLOBALS['TL_DCA']['tl_module']['palettes']['clientsShowcase']    = '{title_legend},name,headline,type;{config_legend},esm_numberOfItems,perPage;{reference_legend},jumpTo;{template_legend:hide},customTpl,esm_clientsShowcase_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
20 20
 $GLOBALS['TL_DCA']['tl_module']['palettes']['clientsProject']    = '{title_legend},name,headline,type;{image_legend},imgSize,fullsize;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
21
+$GLOBALS['TL_DCA']['tl_module']['palettes']['clientsProjectDevices']    = '{title_legend},name,headline,type;{devices_legend},esm_clients_devices;{settings_legend},esm_clients_devices_dimensions;{template_legend:hide},customTpl,esm_clients_devices_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
21 22
 
22 23
 
23 24
 /**
... ...
@@ -42,4 +43,37 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['esm_clientsShowcase_template'] = arra
42 43
 	'options_callback'        => array('tl_module_esm_clients', 'getClientsShowcaseTemplates'),
43 44
 	'eval'                    => array('tl_class'=>'w50'),
44 45
 	'sql'                     => "varchar(32) NOT NULL default ''"
46
+);
47
+
48
+$GLOBALS['TL_DCA']['tl_module']['fields']['esm_clients_devices_template'] = array
49
+(
50
+	'label'                   => &$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices_template'],
51
+	'default'                 => '_project_devices_default',
52
+	'exclude'                 => true,
53
+	'inputType'               => 'select',
54
+	'options_callback'        => array('tl_module_esm_clients', 'getProjectDevicesTemplates'),
55
+	'eval'                    => array('tl_class'=>'w50'),
56
+	'sql'                     => "varchar(32) NOT NULL default ''"
57
+);
58
+
59
+$GLOBALS['TL_DCA']['tl_module']['fields']['esm_clients_devices'] = array
60
+(
61
+	'label'                   => &$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices'],
62
+	'exclude'                 => true,
63
+	'inputType'               => 'checkbox',
64
+	'options'                 => array('desktop','smartphone','tablet'),
65
+	'reference'               => &$GLOBALS['TL_LANG']['ESM_CLIENTS']['REF']['devices'],
66
+	'eval'                    => array('mandatory'=>true, 'multiple'=>true),
67
+	'sql'                     => "varchar(128) NOT NULL default ''"
68
+);
69
+
70
+$GLOBALS['TL_DCA']['tl_module']['fields']['esm_clients_devices_dimensions'] = array
71
+(
72
+	'label'                   => &$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices_dimensions'],
73
+	'exclude'                 => true,
74
+	'inputType'               => 'imageSize',
75
+	'options'                 => array('proportional'),
76
+	'reference'               => &$GLOBALS['TL_LANG']['MSC'],
77
+	'eval'                    => array('rgxp'=>'natural', 'includeBlankOption'=>true, 'nospace'=>true, 'tl_class'=>'w50'),
78
+	'sql'                     => "varchar(64) NOT NULL default ''"
45 79
 );
46 80
\ No newline at end of file
... ...
@@ -13,7 +13,7 @@
13 13
 /**
14 14
  * Headings
15 15
  */
16
-$GLOBALS['TL_LANG']['ESM_CLIENTS']['project_text'] = 'Besonderheiten';
16
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['project_text'] = 'Projektinfo';
17 17
 $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_link'] = 'Projekt ansehen';
18 18
 $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_services'] = 'Unsere Leistungen';
19 19
 $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_features'] = 'Features';
... ...
@@ -22,4 +22,14 @@ $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_tech'] = 'Systeme';
22 22
 /**
23 23
  * Backend
24 24
  */
25
-$GLOBALS['TL_LANG']['ESM_CLIENTS']['sortorder'] = 'Sortierung im Frontend';
26 25
\ No newline at end of file
26
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['sortorder'] = 'Sortierung im Frontend';
27
+
28
+/**
29
+ * References
30
+ */
31
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['REF']['devices'] = array
32
+(
33
+	'desktop'    => 'Desktop',
34
+	'smartphone' => 'Smartphone',
35
+	'tablet'     => 'Tablet'
36
+);
27 37
\ No newline at end of file
... ...
@@ -24,4 +24,6 @@ $GLOBALS['TL_LANG']['FMD']['esalesClients'][0] = 'eSales Media - Kunden';
24 24
 $GLOBALS['TL_LANG']['FMD']['clientsShowcase'][0] = 'Kundenliste mit Projekten';
25 25
 $GLOBALS['TL_LANG']['FMD']['clientsShowcase'][1] = 'Zeigt eine Liste mit Kunden an, welche Projekte zugewiesen haben.';
26 26
 $GLOBALS['TL_LANG']['FMD']['clientsProject'][0] = 'Projektdetails';
27
-$GLOBALS['TL_LANG']['FMD']['clientsProject'][1] = 'Zeigt die Details zu einem Kundenprojekt';
28 27
\ No newline at end of file
28
+$GLOBALS['TL_LANG']['FMD']['clientsProject'][1] = 'Zeigt die Details zu einem Kundenprojekt';
29
+$GLOBALS['TL_LANG']['FMD']['clientsProjectDevices'][0] = 'Projekt-Device-Mockups';
30
+$GLOBALS['TL_LANG']['FMD']['clientsProjectDevices'][1] = 'Zeigt Geräte-Mockups mit Screenshots';
29 31
\ No newline at end of file
... ...
@@ -29,6 +29,12 @@ $GLOBALS['TL_LANG']['tl_esm_clients_projects']['tech'][0] = 'Technologie';
29 29
 $GLOBALS['TL_LANG']['tl_esm_clients_projects']['tech'][1] = 'Die bei dem Projekt eingesetzte Technologie';
30 30
 $GLOBALS['TL_LANG']['tl_esm_clients_projects']['gallerySRC'][0] = 'Screenshots';
31 31
 $GLOBALS['TL_LANG']['tl_esm_clients_projects']['gallerySRC'][1] = 'Screenshots/Schaubilder zum Projekt.';
32
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['desktopSRC'][0] = 'Desktop-Screenshot';
33
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['desktopSRC'][1] = 'Desktop Screenshot zum Projekt.';
34
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['phoneSRC'][0] = 'Smartphone-Screenshot';
35
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['phoneSRC'][1] = 'Smartphone Screenshot zum Projekt.';
36
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tabletSRC'][0] = 'Tablet-Screenshot';
37
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tabletSRC'][1] = 'Table Screenshot zum Projekt.';
32 38
 $GLOBALS['TL_LANG']['tl_esm_clients_projects']['invisible'][0] = 'Unsichtbar';
33 39
 $GLOBALS['TL_LANG']['tl_esm_clients_projects']['invisible'][1] = 'Den Eintrag im Frontend verstecken.';
34 40
 $GLOBALS['TL_LANG']['tl_esm_clients_projects']['start'][0] = 'Anzeigen ab';
... ...
@@ -17,11 +17,18 @@ $GLOBALS['TL_LANG']['tl_module']['esm_numberOfItems'][0] = 'Gesamtzahl der Eleme
17 17
 $GLOBALS['TL_LANG']['tl_module']['esm_numberOfItems'][1] = 'Hier können Sie die Gesamtzahl der Elemente begrenzen. Geben Sie 0 ein, um alle anzuzeigen.';
18 18
 $GLOBALS['TL_LANG']['tl_module']['esm_clientsShowcase_template'][0] = 'Showcase-Template';
19 19
 $GLOBALS['TL_LANG']['tl_module']['esm_clientsShowcase_template'][1] = 'Hier können Sie das Showcase-Template überschreiben.';
20
+$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices_template'][0] = 'Devices-Template';
21
+$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices_template'][1] = 'Hier können Sie das Devices-Template auswählen.';
22
+$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices'][0] = 'Devices';
23
+$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices'][1] = 'Hier können Sie bestimmen, welche Devices angezeigt werden, insofern Screenshots dafür im Projekt hinterlegt wurden.';
24
+$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices_dimensions'][0] = 'Maximalgröße';
25
+$GLOBALS['TL_LANG']['tl_module']['esm_clients_devices_dimensions'][1] = 'Die Maximalgröße des Device-Mockups';
20 26
 
21 27
 /**
22 28
  * Legends
23 29
  */
24
-//$GLOBALS['TL_LANG']['tl_module']['title_legend'] = 'Titel';
30
+$GLOBALS['TL_LANG']['tl_module']['devices_legend'] = 'Geräte';
31
+$GLOBALS['TL_LANG']['tl_module']['settings_legend'] = 'Einstellungen';
25 32
 
26 33
 /**
27 34
  * References
... ...
@@ -33,16 +33,35 @@ class EsmClientsModel extends \Model
33 33
 	 */
34 34
 	protected static $strTable = 'tl_esm_clients';
35 35
 
36
+	/**
37
+	 * @return \Model\Collection|null
38
+	 */
39
+	public static function countReferenceClients()
40
+	{
41
+		$t1 = static::$strTable;
42
+		$t2 = $t1.'_projects';
43
+
44
+		$Result = \Database::getInstance()->execute("SELECT COUNT($t1.id) AS 'totalcount' FROM $t1 WHERE invisible='' AND EXISTS (SELECT 1 FROM $t2 WHERE $t2.pid = $t1.id AND invisible = '' GROUP BY $t2.pid)");
45
+
46
+		if ($Result->numRows)
47
+		{
48
+			return $Result->totalcount;
49
+		}
50
+
51
+		return 0;
52
+	}
36 53
 
37 54
 	/**
38 55
 	 * @return \Model\Collection|null
39 56
 	 */
40
-	public static function getReferenceClients()
57
+	public static function getReferenceClients($intLimit=0, $intOffset=0)
41 58
 	{
42 59
 		$t1 = static::$strTable;
43 60
 		$t2 = $t1.'_projects';
44 61
 
45
-		$Result = \Database::getInstance()->execute("SELECT $t1.id FROM $t1 WHERE invisible='' AND EXISTS (SELECT 1 FROM $t2 WHERE $t2.pid = $t1.id AND invisible = '' GROUP BY $t2.pid) ORDER BY $t1.sorting");
62
+		$Result = \Database::getInstance()->prepare("SELECT $t1.id FROM $t1 WHERE invisible='' AND EXISTS (SELECT 1 FROM $t2 WHERE $t2.pid = $t1.id AND invisible = '' GROUP BY $t2.pid) ORDER BY $t1.sorting")
63
+		->limit($intLimit,$intOffset)
64
+		->execute();
46 65
 
47 66
 		$arrIds = $Result->fetchEach('id');
48 67
 
49 68
new file mode 100644
... ...
@@ -0,0 +1,174 @@
1
+<?php
2
+
3
+/**
4
+ * Clients for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_clients
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+*/
12
+
13
+
14
+/**
15
+ * Run in a custom namespace, so the class can be replaced
16
+ */
17
+namespace eSM_clients;
18
+
19
+
20
+/**
21
+ * Shows a list of clients which have active projects
22
+ *
23
+ * @package   Modules
24
+ * @author    Benjamin Roth <http://www.esales-media.de>
25
+ * @copyright eSales Media 2014
26
+ */
27
+class ModuleClientsProjectDevices extends \Module
28
+{
29
+	/**
30
+	 * Template
31
+	 * @var string
32
+	 */
33
+	protected $strTemplate = 'mod_clientsProjectDevices';
34
+
35
+	protected $objProject = null;
36
+
37
+	protected $arrSRCs = array();
38
+	protected $referenceHeight;
39
+
40
+
41
+	public function generate()
42
+	{
43
+		if (TL_MODE == 'BE')
44
+		{
45
+			$objTemplate = new \BackendTemplate('be_wildcard');
46
+
47
+			$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['clientsProjectDevices'][0]) . ' ###';
48
+			$objTemplate->title = $this->headline;
49
+			$objTemplate->id = $this->id;
50
+			$objTemplate->link = $this->name;
51
+			$objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
52
+
53
+			return $objTemplate->parse();
54
+		}
55
+
56
+		// Set the item from the auto_item parameter
57
+		if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item']))
58
+		{
59
+			\Input::setGet('items', \Input::get('auto_item'));
60
+		}
61
+
62
+		$this->objProject = EsmClientsProjectsModel::findByIdOrAlias($_GET['items']);
63
+
64
+		if ($this->objProject === null)
65
+		{
66
+			global $objPage;
67
+			$objHandler = new $GLOBALS['TL_PTY']['error_404']();
68
+			$objHandler->generate($objPage->id);
69
+		}
70
+
71
+		// Selected devices
72
+		$this->esm_clients_devices = deserialize($this->esm_clients_devices, true);
73
+
74
+		// Collect device images
75
+		if ($this->objProject->desktopSRC != '' && in_array('desktop', $this->esm_clients_devices))
76
+		{
77
+			$this->arrSRCs['desktop'] = $this->objProject->desktopSRC;
78
+		}
79
+
80
+		if ($this->objProject->phoneSRC != '' && in_array('smartphone', $this->esm_clients_devices))
81
+		{
82
+			$this->arrSRCs['phone'] = $this->objProject->phoneSRC;
83
+		}
84
+
85
+		if ($this->objProject->tabletSRC != '' && in_array('tablet', $this->esm_clients_devices))
86
+		{
87
+			$this->arrSRCs['tablet'] = $this->objProject->tabletSRC;
88
+		}
89
+
90
+		// Don't show module if no device screen is available
91
+		if (!count($this->arrSRCs))
92
+		{
93
+			return '';
94
+		}
95
+
96
+		// Load CSS
97
+		$GLOBALS['TL_CSS'][] = 'system/modules/eSM_clients/assets/css/devices.css||static';
98
+
99
+
100
+		return parent::generate();
101
+	}
102
+
103
+	/**
104
+	 * Compile the current element
105
+	 */
106
+	protected function compile()
107
+	{
108
+		global $objPage;
109
+
110
+		$this->esm_clients_devices_dimensions = deserialize($this->esm_clients_devices_dimensions);
111
+		if ($this->esm_clients_devices_dimensions[1])
112
+		{
113
+			$this->referenceHeight = $this->esm_clients_devices_dimensions[1];
114
+			$this->Template->referenceHeight = $this->referenceHeight;
115
+		}
116
+
117
+		// Add images
118
+		$arrDeviceScreenshots = array();
119
+		foreach ($this->arrSRCs as $devicetype => $source)
120
+		{
121
+			$objModel = \FilesModel::findByUuid($source);
122
+
123
+			if ($objModel === null)
124
+			{
125
+				if (!\Validator::isUuid($source))
126
+				{
127
+					$this->Template->text = '<p class="error">'.$GLOBALS['TL_LANG']['ERR']['version2format'].'</p>';
128
+				}
129
+			}
130
+			elseif (is_file(TL_ROOT . '/' . $objModel->path))
131
+			{
132
+				// Calculate devicemask height
133
+				if (isset($GLOBALS['eSM_clients']['devices'][$devicetype]))
134
+				{
135
+					$objDevicemask = new \File($GLOBALS['eSM_clients']['devices'][$devicetype]['devicemask']['imageSRC'], true);
136
+					if ($objDevicemask->isImage)
137
+					{
138
+						$intDeviceHeight = round($this->referenceHeight * $GLOBALS['eSM_clients']['devices'][$devicetype]['devicemask']['ratio']);
139
+						$objDevicemaskImage = \Image::create($objDevicemask,array('',$intDeviceHeight,'proportional'));
140
+						$objDevicemask = new \File($objDevicemaskImage->executeResize()->getResizedPath(),true);
141
+					}
142
+				}
143
+
144
+				$objFile = new \File($objModel->path,true);
145
+				if ($objFile->isImage)
146
+				{
147
+					$arrMeta = \Frontend::getMetaData($objModel->meta, $objPage->language);
148
+					$arrImage = array
149
+					(
150
+						'id'        => $objModel->id,
151
+						'uuid'      => $objModel->uuid,
152
+						'name'      => $objFile->basename,
153
+						'singleSRC' => $objModel->path,
154
+						'alt'       => $arrMeta['title'],
155
+						'imageUrl'  => $arrMeta['link'],
156
+						'caption'   => $arrMeta['caption'],
157
+						'size'      => serialize(array($objDevicemask->width*$GLOBALS['eSM_clients']['devices'][$devicetype]['screen']['ratio']['x'],$objDevicemask->height*$GLOBALS['eSM_clients']['devices'][$devicetype]['screen']['ratio']['y'],'center_top')),
158
+					);
159
+					$objImage = new \stdClass();
160
+					$this->addImageToTemplate($objImage, $arrImage);
161
+					$arrDeviceScreenshots[$devicetype] = array
162
+					(
163
+						'device'     => $objDevicemask->path,
164
+						'screenshot' => $objImage
165
+					);
166
+				}
167
+			}
168
+		}
169
+
170
+		// Add images to Template
171
+		$this->Template->screenshots = $arrDeviceScreenshots;
172
+
173
+	}
174
+}
... ...
@@ -26,164 +26,219 @@ namespace eSM_clients;
26 26
  */
27 27
 class ModuleClientsShowcase extends \Module
28 28
 {
29
-	/**
30
-	 * Template
31
-	 * @var string
32
-	 */
33
-	protected $strTemplate = 'mod_clientsShowcase';
34
-
35
-	/**
36
-	 * URL
37
-	 * @var string
38
-	 */
39
-	protected $strLink;
40
-
41
-
42
-	public function generate()
43
-	{
44
-		if (TL_MODE == 'BE')
45
-		{
46
-			$objTemplate = new \BackendTemplate('be_wildcard');
47
-
48
-			$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['clientsShowcase'][0]) . ' ###';
49
-			$objTemplate->title = $this->headline;
50
-			$objTemplate->id = $this->id;
51
-			$objTemplate->link = $this->name;
52
-			$objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
53
-
54
-			return $objTemplate->parse();
55
-		}
56
-
57
-		$this->strUrl = preg_replace('/\?.*$/', '', \Environment::get('request'));
58
-		$this->strLink = $this->strUrl;
59
-
60
-		return parent::generate();
61
-	}
62
-
63
-	/**
64
-	 * Compile the current element
65
-	 */
66
-	protected function compile()
67
-	{
68
-		global $objPage;
69
-
70
-		$Clients = EsmClientsModel::getReferenceClients();
71
-
72
-		$strItems = '';
73
-
74
-		foreach ($Clients as $client)
75
-		{
76
-//			dump($client);
77
-			// Load client template
78
-			$objClientTemplate = new \FrontendTemplate($this->esm_clientsShowcase_template);
79
-
80
-			// Set template data
81
-			$objClientTemplate->title = $client->title;
82
-			$objClientTemplate->text = $client->text;
83
-			$objClientTemplate->color = deserialize($client->basecolor);
84
-			$objClientTemplate->branchId = $client->branch;
85
-
86
-			// Branche
87
-			$Branch = $client->getRelated('branch');
88
-			if (!is_null($Branch))
89
-			{
90
-				$objClientTemplate->branch = $Branch->title;
91
-			}
92
-
93
-			// Neutral logo
94
-			$objNeutralLogo = \FilesModel::findByUuid($client->logo_neutral);
95
-
96
-			if (is_file(TL_ROOT . '/' . $objNeutralLogo->path))
97
-			{
98
-				$objFile = new \File($objNeutralLogo->path, true);
99
-				$arrSize = $objFile->imageSize;
100
-				$arrMeta = $this->getMetaData($objNeutralLogo->meta, $objPage->language);
101
-				if (empty($arrMeta))
102
-				{
103
-					if ($objPage->rootFallbackLanguage !== null)
104
-					{
105
-						$arrMeta = $this->getMetaData($objNeutralLogo->meta, $objPage->rootFallbackLanguage);
106
-					}
107
-				}
108
-				if ($arrMeta['title'] == '')
109
-				{
110
-					$arrMeta['title'] = specialchars($objFile->basename);
111
-				}
112
-				$objClientTemplate->logo_neutral = array
113
-				(
114
-					'src'         => $objNeutralLogo->path,
115
-					'width'       => $arrSize[0],
116
-					'height'      => $arrSize[1],
117
-					'attributes'  => $arrSize[3] . ' alt="' . $arrMeta['title'] . '"',
118
-					'meta'        => $arrMeta
119
-				);
120
-
121
-			}
122
-
123
-			// Original logo
124
-			$objOriginalLogo = \FilesModel::findByUuid($client->logo_original);
125
-
126
-			if (is_file(TL_ROOT . '/' . $objOriginalLogo->path))
127
-			{
128
-				$objFile = new \File($objOriginalLogo->path, true);
129
-				$arrSize = $objFile->imageSize;
130
-				$arrMeta = $this->getMetaData($objOriginalLogo->meta, $objPage->language);
131
-				if (empty($arrMeta))
132
-				{
133
-					if ($objPage->rootFallbackLanguage !== null)
134
-					{
135
-						$arrMeta = $this->getMetaData($objOriginalLogo->meta, $objPage->rootFallbackLanguage);
136
-					}
137
-				}
138
-				if ($arrMeta['title'] == '')
139
-				{
140
-					$arrMeta['title'] = specialchars($objFile->basename);
141
-				}
142
-				$objClientTemplate->logo_original = array
143
-				(
144
-					'src'         => $objOriginalLogo->path,
145
-					'width'       => $arrSize[0],
146
-					'height'      => $arrSize[1],
147
-					'attributes'  => $arrSize[3] . ' alt="' . $arrMeta['title'] . '"',
148
-					'meta'        => $arrMeta
149
-				);
150
-
151
-			}
152
-
153
-			// Get client projects
154
-			$Projects = $client->getProjects();
155
-
156
-			$arrProjects = array();
157
-			foreach($Projects as $project)
158
-			{
159
-
160
-				$arrRow = $project->row();
161
-
162
-				if ($this->jumpTo > 0)
163
-				{
164
-					$objTarget = \PageModel::findByPk($this->jumpTo);
165
-
166
-					if ($objTarget !== null)
167
-					{
168
-						$strJumpTo = ampersand($this->generateFrontendUrl($objTarget->row(), ((\Config::get('useAutoItem') && !\Config::get('disableAlias')) ?  '/%s' : '/items/%s')));
169
-						$strJumpTo = sprintf($strJumpTo,(!\Config::get('disableAlias') && $project->alias != '') ? $project->alias : $project->id);
170
-
171
-						$arrRow['link'] = $strJumpTo;
172
-					}
173
-				}
174
-
175
-				$arrProjects[] = $arrRow;
176
-			}
177
-
178
-			$objClientTemplate->projects = $arrProjects;
179
-
180
-
181
-			// Render Template
182
-			$strItems .= $objClientTemplate->parse();
183
-		}
184
-
185
-		$this->Template->items = $strItems;
186
-	}
29
+    /**
30
+     * Template
31
+     * @var string
32
+     */
33
+    protected $strTemplate = 'mod_clientsShowcase';
34
+
35
+    /**
36
+     * URL
37
+     * @var string
38
+     */
39
+    protected $strLink;
40
+
41
+
42
+    public function generate()
43
+    {
44
+        if (TL_MODE == 'BE')
45
+        {
46
+            $objTemplate = new \BackendTemplate('be_wildcard');
47
+
48
+            $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['clientsShowcase'][0]) . ' ###';
49
+            $objTemplate->title = $this->headline;
50
+            $objTemplate->id = $this->id;
51
+            $objTemplate->link = $this->name;
52
+            $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
53
+
54
+            return $objTemplate->parse();
55
+        }
56
+
57
+        $this->strUrl = preg_replace('/\?.*$/', '', \Environment::get('request'));
58
+        $this->strLink = $this->strUrl;
59
+
60
+        return parent::generate();
61
+    }
62
+
63
+    /**
64
+     * Compile the current element
65
+     */
66
+    protected function compile()
67
+    {
68
+        /** @var \PageModel $objPage */
69
+        global $objPage;
70
+
71
+        $limit = null;
72
+        $offset = 0;
73
+
74
+        // Maximum number of items
75
+        if ($this->esm_numberOfItems > 0)
76
+        {
77
+            $limit = $this->esm_numberOfItems;
78
+        }
79
+
80
+        // Get the total number of items
81
+        $intTotal = EsmClientsModel::countReferenceClients();
82
+
83
+        if ($intTotal < 1)
84
+        {
85
+            return;
86
+        }
87
+
88
+        $total = $intTotal - $offset;
89
+
90
+        // Split the results
91
+        if ($this->perPage > 0 && (!isset($limit) || $this->esm_numberOfItems > $this->perPage))
92
+        {
93
+            // Adjust the overall limit
94
+            if (isset($limit))
95
+            {
96
+                $total = min($limit, $total);
97
+            }
98
+
99
+            // Get the current page
100
+            $id = 'page_cs' . $this->id;
101
+            $page = (\Input::get($id) !== null) ? \Input::get($id) : 1;
102
+
103
+            // Do not index or cache the page if the page number is outside the range
104
+            if ($page < 1 || $page > max(ceil($total/$this->perPage), 1))
105
+            {
106
+                /** @var \PageError404 $objHandler */
107
+                $objHandler = new $GLOBALS['TL_PTY']['error_404']();
108
+                $objHandler->generate($objPage->id);
109
+            }
110
+
111
+            // Set limit and offset
112
+            $limit = $this->perPage;
113
+            $offset += (max($page, 1) - 1) * $this->perPage;
114
+
115
+            // Overall limit
116
+            if ($offset + $limit > $total)
117
+            {
118
+                $limit = $total - $offset;
119
+            }
120
+
121
+            // Add the pagination menu
122
+            $objPagination = new \Pagination($total, $this->perPage, \Config::get('maxPaginationLinks'), $id);
123
+            $this->Template->pagination = $objPagination->generate("\n  ");
124
+        }
125
+
126
+        $Clients = EsmClientsModel::getReferenceClients(($limit ?: 0), $offset);
127
+
128
+        $strItems = '';
129
+
130
+        foreach ($Clients as $client)
131
+        {
132
+            // Load client template
133
+            $objClientTemplate = new \FrontendTemplate($this->esm_clientsShowcase_template);
134
+
135
+            // Set template data
136
+            $objClientTemplate->title = $client->title;
137
+            $objClientTemplate->text = $client->text;
138
+            $objClientTemplate->color = deserialize($client->basecolor);
139
+            $objClientTemplate->branchId = $client->branch;
140
+
141
+            // Branche
142
+            $Branch = $client->getRelated('branch');
143
+            if (!is_null($Branch))
144
+            {
145
+                $objClientTemplate->branch = $Branch->title;
146
+            }
147
+
148
+            // Neutral logo
149
+            $objNeutralLogo = \FilesModel::findByUuid($client->logo_neutral);
150
+
151
+            if (is_file(TL_ROOT . '/' . $objNeutralLogo->path))
152
+            {
153
+                $objFile = new \File($objNeutralLogo->path, true);
154
+                $arrSize = $objFile->imageSize;
155
+                $arrMeta = $this->getMetaData($objNeutralLogo->meta, $objPage->language);
156
+                if (empty($arrMeta))
157
+                {
158
+                    if ($objPage->rootFallbackLanguage !== null)
159
+                    {
160
+                        $arrMeta = $this->getMetaData($objNeutralLogo->meta, $objPage->rootFallbackLanguage);
161
+                    }
162
+                }
163
+                if ($arrMeta['title'] == '')
164
+                {
165
+                    $arrMeta['title'] = specialchars($objFile->basename);
166
+                }
167
+                $objClientTemplate->logo_neutral = array
168
+                (
169
+                    'src'         => $objNeutralLogo->path,
170
+                    'width'       => $arrSize[0],
171
+                    'height'      => $arrSize[1],
172
+                    'attributes'  => $arrSize[3] . ' alt="' . $arrMeta['title'] . '"',
173
+                    'meta'        => $arrMeta
174
+                );
175
+
176
+            }
177
+
178
+            // Original logo
179
+            $objOriginalLogo = \FilesModel::findByUuid($client->logo_original);
180
+
181
+            if (is_file(TL_ROOT . '/' . $objOriginalLogo->path))
182
+            {
183
+                $objFile = new \File($objOriginalLogo->path, true);
184
+                $arrSize = $objFile->imageSize;
185
+                $arrMeta = $this->getMetaData($objOriginalLogo->meta, $objPage->language);
186
+                if (empty($arrMeta))
187
+                {
188
+                    if ($objPage->rootFallbackLanguage !== null)
189
+                    {
190
+                        $arrMeta = $this->getMetaData($objOriginalLogo->meta, $objPage->rootFallbackLanguage);
191
+                    }
192
+                }
193
+                if ($arrMeta['title'] == '')
194
+                {
195
+                    $arrMeta['title'] = specialchars($objFile->basename);
196
+                }
197
+                $objClientTemplate->logo_original = array
198
+                (
199
+                    'src'         => $objOriginalLogo->path,
200
+                    'width'       => $arrSize[0],
201
+                    'height'      => $arrSize[1],
202
+                    'attributes'  => $arrSize[3] . ' alt="' . $arrMeta['title'] . '"',
203
+                    'meta'        => $arrMeta
204
+                );
205
+
206
+            }
207
+
208
+            // Get client projects
209
+            $Projects = $client->getProjects();
210
+
211
+            $arrProjects = array();
212
+            foreach($Projects as $project)
213
+            {
214
+
215
+                $arrRow = $project->row();
216
+
217
+                if ($this->jumpTo > 0)
218
+                {
219
+                    $objTarget = \PageModel::findByPk($this->jumpTo);
220
+
221
+                    if ($objTarget !== null)
222
+                    {
223
+                        $strJumpTo = ampersand($this->generateFrontendUrl($objTarget->row(), ((\Config::get('useAutoItem') && !\Config::get('disableAlias')) ?  '/%s' : '/items/%s')));
224
+                        $strJumpTo = sprintf($strJumpTo,(!\Config::get('disableAlias') && $project->alias != '') ? $project->alias : $project->id);
225
+
226
+                        $arrRow['link'] = $strJumpTo;
227
+                    }
228
+                }
229
+
230
+                $arrProjects[] = $arrRow;
231
+            }
232
+
233
+            $objClientTemplate->projects = $arrProjects;
234
+
235
+
236
+            // Render Template
237
+            $strItems .= $objClientTemplate->parse();
238
+        }
239
+
240
+        $this->Template->items = $strItems;
241
+    }
187 242
 
188 243
 
189 244
 }
190 245
new file mode 100644
... ...
@@ -0,0 +1,9 @@
1
+<?php $this->block('content'); ?>
2
+<?php //$this->dumpTemplateVars(); ?>
3
+<div class="layout_default device <?php echo $this->devicetype; ?>">
4
+  <div class="devicemask"><img src="<?php echo $this->pictures['device']; ?>" alt="<?php echo $this->devicetype; ?>"/></div>
5
+  <div class="screenshot">
6
+    <?php $this->insert('picture_default', $this->pictures['screenshot']->picture); ?>
7
+  </div>
8
+</div>
9
+<?php $this->endblock(); ?>
0 10
\ No newline at end of file
... ...
@@ -61,7 +61,7 @@
61 61
 			</ul>
62 62
 		<?php endif; ?>
63 63
 
64
-		<?php if (count($this->features)): ?>
64
+		<?php if (count($this->features) && $this->features[0]): ?>
65 65
 			<h3><?php echo $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_features']; ?></h3>
66 66
 			<ul class="list_features ikon-ul">
67 67
 				<?php foreach ($this->features as $feature): ?>
68 68
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+<?php $this->extend('block_searchable'); ?>
2
+
3
+<?php $this->block('content'); ?>
4
+
5
+<style>
6
+  .mod_clientsProjectDevices .devices {
7
+    height: <?= $this->referenceHeight ?>px;
8
+  }
9
+</style>
10
+
11
+<section class="devices cf">
12
+<?php foreach($this->screenshots as $deviceType=>$screenshot): ?>
13
+  <?php $this->insert($this->esm_clients_devices_template, array('devicetype'=>$deviceType, 'pictures'=>$screenshot)); ?>
14
+<?php endforeach; ?>
15
+</section>
16
+
17
+<?php $this->endblock(); ?>
0 18
\ No newline at end of file
... ...
@@ -1,9 +1,10 @@
1
-<?php $this->extend('block_searchable'); ?>
1
+<?= $this->extend('block_searchable') ?>
2 2
 
3
-<?php $this->block('content'); ?>
3
+<?= $this->block('content') ?>
4 4
 
5
-<div class="clients eqh">
6
-<?php echo $this->items; ?>
5
+<div class="clients eqh block">
6
+<?= $this->items ?>
7 7
 </div>
8
+<?= $this->pagination ?>
8 9
 
9
-<?php $this->endblock(); ?>
10 10
\ No newline at end of file
11
+<?= $this->endblock() ?>
11 12
\ No newline at end of file