~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Entity/DisplayProfile.php

  • Committer: Dan Garner
  • Date: 2015-08-11 09:29:02 UTC
  • mto: This revision was merged to the branch mainline in revision 453.
  • Revision ID: git-v1:a86fb4369b7395c13367577d23b14c0ab4528c1a
Transitions fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
namespace Xibo\Entity;
10
10
 
11
11
use Respect\Validation\Validator as v;
12
 
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
13
 
use Xibo\Event\DisplayProfileLoadedEvent;
14
 
use Xibo\Exception\InvalidArgumentException;
15
 
use Xibo\Factory\CommandFactory;
16
 
use Xibo\Service\ConfigServiceInterface;
17
 
use Xibo\Service\LogServiceInterface;
18
 
use Xibo\Storage\StorageServiceInterface;
19
 
 
 
12
use Xibo\Helper\Log;
 
13
use Xibo\Helper\Theme;
 
14
use Xibo\Storage\PDOConnect;
20
15
 
21
16
/**
22
17
 * Class DisplayProfile
24
19
 *
25
20
 * @SWG\Definition()
26
21
 */
27
 
class DisplayProfile implements \JsonSerializable
 
22
class DisplayProfile
28
23
{
29
24
    use EntityTrait;
30
25
 
76
71
     */
77
72
    public $configTabs;
78
73
 
79
 
    /**
80
 
     * Commands associated with this profile.
81
 
     * @var array[Command]
82
 
     */
83
 
    public $commands = [];
84
 
 
85
 
    /** @var  string the client type */
86
 
    private $clientType;
87
 
 
88
 
    /**
89
 
     * @var ConfigServiceInterface
90
 
     */
91
 
    private $configService;
92
 
 
93
 
    /** @var EventDispatcherInterface  */
94
 
    private $dispatcher;
95
 
 
96
 
    /**
97
 
     * @var CommandFactory
98
 
     */
99
 
    private $commandFactory;
100
 
 
101
 
    /**
102
 
     * Entity constructor.
103
 
     * @param StorageServiceInterface $store
104
 
     * @param LogServiceInterface $log
105
 
     * @param ConfigServiceInterface $config
106
 
     * @param EventDispatcherInterface $dispatcher
107
 
     * @param CommandFactory $commandFactory
108
 
     */
109
 
    public function __construct($store, $log, $config, $dispatcher, $commandFactory)
110
 
    {
111
 
        $this->setCommonDependencies($store, $log);
112
 
 
113
 
        $this->configService = $config;
114
 
        $this->dispatcher = $dispatcher;
115
 
        $this->commandFactory = $commandFactory;
116
 
    }
117
 
 
118
 
    /**
119
 
     * Get Id
120
 
     * @return int
121
 
     */
122
74
    public function getId()
123
75
    {
124
76
        return $this->displayProfileId;
125
77
    }
126
78
 
127
 
    /**
128
 
     * @return int
129
 
     */
130
79
    public function getOwnerId()
131
80
    {
132
81
        return $this->userId;
133
82
    }
134
83
 
135
 
    /**
136
 
     * @param $clientType
137
 
     */
138
 
    public function setClientType($clientType)
139
 
    {
140
 
        $this->clientType = $clientType;
141
 
    }
142
 
 
143
 
    /**
144
 
     * Get the client type
145
 
     * @return string
146
 
     */
147
 
    public function getClientType()
148
 
    {
149
 
        return (empty($this->clientType)) ? $this->type : $this->clientType;
150
 
    }
151
 
 
152
 
    /**
153
 
     * Assign Command
154
 
     * @param Command $command
155
 
     */
156
 
    public function assignCommand($command)
157
 
    {
158
 
        $this->load();
159
 
 
160
 
        $assigned = false;
161
 
 
162
 
        foreach ($this->commands as $alreadyAssigned) {
163
 
            /* @var Command $alreadyAssigned */
164
 
            if ($alreadyAssigned->getId() == $command->getId()) {
165
 
                $alreadyAssigned->commandString = $command->commandString;
166
 
                $alreadyAssigned->validationString = $command->validationString;
167
 
                $assigned = true;
168
 
                break;
169
 
            }
170
 
        }
171
 
 
172
 
        if (!$assigned)
173
 
            $this->commands[] = $command;
174
 
    }
175
 
 
176
 
    /**
177
 
     * Unassign Command
178
 
     * @param Command $command
179
 
     */
180
 
    public function unassignCommand($command)
181
 
    {
182
 
        $this->load();
183
 
 
184
 
        $this->commands = array_udiff($this->commands, [$command], function ($a, $b) {
185
 
           /**
186
 
            * @var Command $a
187
 
            * @var Command $b
188
 
            */
189
 
            return $a->getId() - $b->getId();
190
 
        });
191
 
    }
192
 
 
193
 
    /**
194
 
     * Load
195
 
     */
196
84
    public function load()
197
85
    {
198
 
        if ($this->loaded)
199
 
            return;
200
 
 
201
86
        $this->config = json_decode($this->config, true);
202
 
        $this->getLog()->debug('Config loaded [%d]: %s', count($this->config), json_encode($this->config, JSON_PRETTY_PRINT));
 
87
        Log::debug('Config loaded [%d]: %s', count($this->config), json_encode($this->config, JSON_PRETTY_PRINT));
203
88
 
204
89
        $this->configDefault = $this->loadFromFile();
205
 
 
206
 
        if (array_key_exists($this->type, $this->configDefault)) {
207
 
            $this->configTabs = $this->configDefault[$this->type]['tabs'];
208
 
            $this->configDefault = $this->configDefault[$this->type]['settings'];
209
 
        } else {
210
 
            $this->getLog()->debug('Unknown type for Display Profile: ' . $this->type);
211
 
            $this->configTabs = $this->configDefault['unknown']['tabs'];
212
 
            $this->configDefault = $this->configDefault['unknown']['settings'];
213
 
        }
214
 
 
215
 
        // We've loaded a profile
216
 
        // dispatch an event with a reference to this object, allowing subscribers to modify the config before we
217
 
        // continue further.
218
 
        $this->dispatcher->dispatch(DisplayProfileLoadedEvent::NAME, new DisplayProfileLoadedEvent($this));
 
90
        $this->configTabs = $this->configDefault[$this->type]['tabs'];
 
91
        $this->configDefault = $this->configDefault[$this->type]['settings'];
219
92
 
220
93
        // Just populate the values with the defaults if the values aren't set already
221
94
        for ($i = 0; $i < count($this->configDefault); $i++) {
226
99
        for ($i = 0; $i < count($this->configDefault); $i++) {
227
100
            // Does this setting exist in our store?
228
101
            for ($j = 0; $j < count($this->config); $j++) {
229
 
                // If we have found our default config setting
230
 
                if ($this->configDefault[$i]['name'] == $this->config[$j]['name']) {
231
 
                    // Override the the default with our setting
 
102
                if ($this->config[$j]['name'] == $this->config[$i]['name']) {
 
103
                    $this->config[$i]['value'] = $this->config[$j]['value'];
232
104
                    $this->configDefault[$i]['value'] = $this->config[$j]['value'];
233
105
                    break;
234
106
                }
235
107
            }
236
108
        }
237
 
 
238
 
        // Load any commands
239
 
        $this->commands = $this->commandFactory->getByDisplayProfileId($this->displayProfileId);
240
 
 
241
 
        // We are loaded
242
 
        $this->loaded = true;
243
109
    }
244
110
 
245
111
    /**
247
113
     */
248
114
    public function validate()
249
115
    {
250
 
        if (!v::stringType()->notEmpty()->validate($this->name))
251
 
            throw new InvalidArgumentException(__('Missing name'), 'name');
 
116
        if (!v::string()->notEmpty()->validate($this->name))
 
117
            throw new \InvalidArgumentException(__('Missing name'));
252
118
 
253
 
        if (!v::stringType()->notEmpty()->validate($this->type))
254
 
            throw new InvalidArgumentException(__('Missing type'), 'type');
 
119
        if (!v::string()->notEmpty()->validate($this->type))
 
120
            throw new \InvalidArgumentException(__('Missing type'));
255
121
 
256
122
        // Check there is only 1 default (including this one)
257
 
        $sql = '
258
 
          SELECT COUNT(*) AS cnt
259
 
            FROM `displayprofile`
260
 
           WHERE `type` = :type
261
 
            AND isdefault = 1
262
 
        ';
263
 
 
264
 
        $params = ['type' => $this->type];
265
 
 
266
 
        if ($this->displayProfileId != 0) {
267
 
            $sql .= ' AND displayprofileid <> :displayProfileId ';
268
 
            $params['displayProfileId'] = $this->displayProfileId;
269
 
        }
270
 
 
271
 
        $count = $this->getStore()->select($sql, $params);
 
123
        $count = PDOConnect::select('SELECT COUNT(*) AS cnt FROM `displayprofile` WHERE type = :type AND isdefault = 1 AND displayprofileid <> :displayProfileId', [
 
124
            'type' => $this->type,
 
125
            'displayProfileId' => $this->displayProfileId
 
126
        ]);
272
127
 
273
128
        if ($count[0]['cnt'] + $this->isDefault > 1)
274
 
            throw new InvalidArgumentException(__('Only 1 default per display type is allowed.'), 'isDefault');
 
129
            throw new \InvalidArgumentException(__('Only 1 default per display type is allowed.'));
275
130
    }
276
131
 
277
132
    /**
287
142
            $this->add();
288
143
        else
289
144
            $this->edit();
290
 
 
291
 
        $this->manageAssignments();
292
145
    }
293
146
 
294
 
    /**
295
 
     * Delete
296
 
     */
297
147
    public function delete()
298
148
    {
299
 
        $this->commands = [];
300
 
        $this->manageAssignments();
301
 
 
302
 
        $this->getStore()->update('DELETE FROM `displayprofile` WHERE displayprofileid = :displayProfileId', ['displayProfileId' => $this->displayProfileId]);
303
 
    }
304
 
 
305
 
    /**
306
 
     * Manage Assignments
307
 
     */
308
 
    private function manageAssignments()
309
 
    {
310
 
        $this->getLog()->debug('Managing Assignment for Display Profile: %d. %d commands.', $this->displayProfileId, count($this->commands));
311
 
 
312
 
        // Link
313
 
        foreach ($this->commands as $command) {
314
 
            /* @var Command $command */
315
 
            $this->getStore()->update('
316
 
              INSERT INTO `lkcommanddisplayprofile` (`commandId`, `displayProfileId`, `commandString`, `validationString`) VALUES
317
 
                (:commandId, :displayProfileId, :commandString, :validationString) ON DUPLICATE KEY UPDATE commandString = :commandString2, validationString = :validationString2
318
 
            ', [
319
 
                'commandId' => $command->commandId,
320
 
                'displayProfileId' => $this->displayProfileId,
321
 
                'commandString' => $command->commandString,
322
 
                'validationString' => $command->validationString,
323
 
                'commandString2' => $command->commandString,
324
 
                'validationString2' => $command->validationString
325
 
            ]);
326
 
        }
327
 
 
328
 
        // Unlink
329
 
        $params = ['displayProfileId' => $this->displayProfileId];
330
 
 
331
 
        $sql = 'DELETE FROM `lkcommanddisplayprofile` WHERE `displayProfileId` = :displayProfileId AND `commandId` NOT IN (0';
332
 
 
333
 
        $i = 0;
334
 
        foreach ($this->commands as $command) {
335
 
            /* @var Command $command */
336
 
            $i++;
337
 
            $sql .= ',:commandId' . $i;
338
 
            $params['commandId' . $i] = $command->commandId;
339
 
        }
340
 
 
341
 
        $sql .= ')';
342
 
 
343
 
        $this->getStore()->update($sql, $params);
 
149
        PDOConnect::update('DELETE FROM `displayprofile` WHERE displayprofileid = :displayProfileId', ['displayProfileId' => $this->displayProfileId]);
344
150
    }
345
151
 
346
152
    private function add()
347
153
    {
348
 
        $this->displayProfileId = $this->getStore()->insert('
 
154
        $this->displayProfileId = PDOConnect::insert('
349
155
            INSERT INTO `displayprofile` (`name`, type, config, isdefault, userid)
350
156
              VALUES (:name, :type, :config, :isDefault, :userId)
351
157
        ', [
352
158
            'name' => $this->name,
353
159
            'type' => $this->type,
354
160
            'config' => ($this->config == '') ? '[]' : json_encode($this->config),
355
 
            'isDefault' => $this->isDefault,
356
 
            'userId' => $this->userId
 
161
            'isdefault' => $this->isDefault,
 
162
            'userid' => $this->userId
357
163
        ]);
358
164
    }
359
165
 
360
166
    private function edit()
361
167
    {
362
 
        $this->getStore()->update('
 
168
        PDOConnect::update('
363
169
          UPDATE `displayprofile`
364
170
            SET `name` = :name, type = :type, config = :config, isdefault = :isDefault
365
171
           WHERE displayprofileid = :displayProfileId', [
374
180
    /**
375
181
     * @return array
376
182
     */
377
 
    public function getProfileConfig()
 
183
    public function getConfig()
378
184
    {
379
185
        return $this->configDefault;
380
186
    }
385
191
    private function loadFromFile()
386
192
    {
387
193
        return array(
388
 
            'unknown' => [
389
 
                'synonym' => 'unknown',
390
 
                'tabs' => [],
391
 
                'settings' => []
392
 
            ],
393
194
            'windows' => array(
394
195
                'synonym' => 'dotnetclient',
395
196
                'tabs' => array(
402
203
                    array(
403
204
                        'name' => 'CollectInterval',
404
205
                        'tabId' => 'general',
405
 
                        'title' => __('Collect interval'),
 
206
                        'title' => __('Collection Interval (seconds)'),
406
207
                        'type' => 'int',
407
 
                        'fieldType' => 'dropdown',
408
 
                        'options' => array(
409
 
                            array('id' => 60, 'value' => __('1 minute')),
410
 
                            array('id' => 300, 'value' => __('5 minutes')),
411
 
                            array('id' => 600, 'value' => __('10 minutes')),
412
 
                            array('id' => 900, 'value' => __('15 minutes')),
413
 
                            array('id' => 1800, 'value' => __('30 minutes')),
414
 
                            array('id' => 3600, 'value' => __('1 hour')),
415
 
                            array('id' => 14400, 'value' => __('4 hours')),
416
 
                            array('id' => 43200, 'value' => __('12 hours')),
417
 
                            array('id' => 86400, 'value' => __('24 hours'))
418
 
                        ),
 
208
                        'fieldType' => 'number',
419
209
                        'default' => 900,
420
 
                        'helpText' => __('How often should the Player check for new content.'),
 
210
                        'helpText' => __('The number of seconds between connections to the CMS.'),
421
211
                        'validation' => 'numeric',
422
212
                        'enabled' => true,
423
213
                        'groupClass' => NULL
428
218
                        'title' => __('Download Window Start Time'),
429
219
                        'type' => 'string',
430
220
                        'fieldType' => 'timePicker',
431
 
                        'default' => '00:00',
 
221
                        'default' => 0,
432
222
                        'helpText' => __('The start of the time window to connect to the CMS and download updates.'),
433
223
                        'enabled' => true,
434
224
                        'groupClass' => NULL
439
229
                        'title' => __('Download Window End Time'),
440
230
                        'type' => 'string',
441
231
                        'fieldType' => 'timePicker',
442
 
                        'default' => '00:00',
 
232
                        'default' => 0,
443
233
                        'helpText' => __('The end of the time window to connect to the CMS and download updates.'),
444
234
                        'enabled' => true,
445
235
                        'groupClass' => NULL
461
251
                        'title' => __('Enable stats reporting?'),
462
252
                        'type' => 'checkbox',
463
253
                        'fieldType' => 'checkbox',
464
 
                        'default' => $this->configService->GetSetting('DISPLAY_PROFILE_STATS_DEFAULT', 0),
 
254
                        'default' => 1,
465
255
                        'helpText' => __('Should the application send proof of play stats to the CMS.'),
466
256
                        'enabled' => true,
467
257
                        'groupClass' => NULL
468
258
                    ),
469
259
                    array(
470
 
                        'name' => 'XmrNetworkAddress',
471
 
                        'tabId' => 'general',
472
 
                        'title' => __('XMR Public Address'),
473
 
                        'type' => 'string',
474
 
                        'fieldType' => 'text',
475
 
                        'default' => '',
476
 
                        'helpText' => __('Please enter the public address for XMR.'),
477
 
                        'enabled' => true,
478
 
                        'groupClass' => NULL
479
 
                    ),
480
 
                    array(
481
260
                        'name' => 'SizeX',
482
261
                        'tabId' => 'location',
483
262
                        'title' => __('Width'),
556
335
                            array('id' => 'off', 'value' => 'Off')
557
336
                        ),
558
337
                        'default' => 'error',
559
 
                        'helpText' => __('The logging level that should be recorded by the Player.'),
 
338
                        'helpText' => __('The position of the cursor when the client starts up.'),
560
339
                        'enabled' => true,
561
340
                        'groupClass' => NULL
562
341
                    ),
589
368
                        'type' => 'string',
590
369
                        'fieldType' => 'dropdown',
591
370
                        'options' => array(
592
 
                            array('id' => 'Unchanged', 'value' => __('Unchanged')),
593
 
                            array('id' => 'Top Left', 'value' => __('Top Left')),
594
 
                            array('id' => 'Top Right', 'value' => __('Top Right')),
595
 
                            array('id' => 'Bottom Left', 'value' => __('Bottom Left')),
596
 
                            array('id' => 'Bottom Right', 'value' => __('Bottom Right')),
 
371
                            array('id' => 'Top Left', 'value' => 'Top Left'),
 
372
                            array('id' => 'Top Right', 'value' => 'Top Right'),
 
373
                            array('id' => 'Bottom Left', 'value' => 'Bottom Left'),
 
374
                            array('id' => 'Bottom Right', 'value' => 'Bottom Right'),
597
375
                        ),
598
 
                        'default' => 'Unchanged',
 
376
                        'default' => 'Bottom Right',
599
377
                        'helpText' => __('The position of the cursor when the client starts up.'),
600
378
                        'enabled' => true,
601
379
                        'groupClass' => NULL
618
396
                        'type' => 'int',
619
397
                        'fieldType' => 'text',
620
398
                        'default' => 10,
621
 
                        'helpText' => __('If an empty layout is detected how long (in seconds) should it remain on screen? Must be greater than 1.'),
 
399
                        'helpText' => __('If an empty layout is detected how long should it remain on screen. Must be greater then 1.'),
622
400
                        'validation' => 'number',
623
401
                        'enabled' => true,
624
402
                        'groupClass' => NULL
685
463
                        'type' => 'checkbox',
686
464
                        'fieldType' => 'checkbox',
687
465
                        'default' => 0,
688
 
                        'helpText' => __('[No longer supported in 1.8+ players!] CEF is Chrome Embedded and offers up to date web rendering. If unselected the default Internet Explorer control will be used. The Player software will need to be restarted after making this change.'),
 
466
                        'helpText' => __('CEF is Chrome Embedded and offers up to date web rendering. If unselected the default Internet Explorer control will be used. The Player software will need to be restarted after making this change.'),
689
467
                        'enabled' => true,
690
468
                        'groupClass' => NULL
691
469
                    ),
697
475
                        'fieldType' => 'checkbox',
698
476
                        'default' => 0,
699
477
                        'helpText' => __('When enabled the client will send the current layout to the CMS each time it changes. Warning: This is bandwidth intensive and should be disabled unless on a LAN.'),
700
 
                        'enabled' => ($this->configService->GetSetting('DISPLAY_PROFILE_CURRENT_LAYOUT_STATUS_ENABLED', 0) == 1),
 
478
                        'enabled' => Theme::getConfig('client_sendCurrentLayoutAsStatusUpdate_enabled', true),
701
479
                        'groupClass' => NULL
702
480
                    ),
703
481
                    array(
708
486
                        'fieldType' => 'number',
709
487
                        'default' => 0,
710
488
                        'helpText' => __('The duration between status screen shots in minutes. 0 to disable. Warning: This is bandwidth intensive.'),
711
 
                        'enabled' => ($this->configService->GetSetting('DISPLAY_PROFILE_SCREENSHOT_INTERVAL_ENABLED', 0) == 1),
712
 
                        'groupClass' => NULL
713
 
                    ),
714
 
                    array(
715
 
                        'name' => 'ScreenShotSize',
716
 
                        'tabId' => 'advanced',
717
 
                        'title' => __('Screen Shot Size'),
718
 
                        'type' => 'int',
719
 
                        'fieldType' => 'number',
720
 
                        'default' => $this->configService->GetSetting('DISPLAY_PROFILE_SCREENSHOT_SIZE_DEFAULT', 200),
721
 
                        'helpText' => __('The size of the largest dimension. Empty or 0 means the screen size.'),
722
 
                        'enabled' => true,
 
489
                        'enabled' => Theme::getConfig('client_screenShotRequestInterval_enabled', true),
723
490
                        'groupClass' => NULL
724
491
                    ),
725
492
                    array(
732
499
                        'helpText' => __('The number of log files to upload concurrently. The lower the number the longer it will take, but the better for memory usage.'),
733
500
                        'enabled' => true,
734
501
                        'groupClass' => NULL
735
 
                    ),
736
 
                    array(
737
 
                        'name' => 'EmbeddedServerPort',
738
 
                        'tabId' => 'advanced',
739
 
                        'title' => __('Embedded Web Server Port'),
740
 
                        'type' => 'int',
741
 
                        'fieldType' => 'number',
742
 
                        'default' => 9696,
743
 
                        'helpText' => __('The port number to use for the embedded web server on the Player. Only change this if there is a port conflict reported on the status screen.'),
744
 
                        'enabled' => true,
745
 
                        'groupClass' => NULL
746
 
                    ),
747
 
                    array(
748
 
                        'name' => 'PreventSleep',
749
 
                        'tabId' => 'advanced',
750
 
                        'title' => __('Prevent Sleep?'),
751
 
                        'type' => 'checkbox',
752
 
                        'fieldType' => 'checkbox',
753
 
                        'default' => 1,
754
 
                        'helpText' => __('Stop the player PC power management from Sleeping the PC'),
755
 
                        'enabled' => true,
756
 
                        'groupClass' => NULL
757
502
                    )
758
503
                )
759
504
            ),
801
546
                            array('id' => 1800, 'value' => __('30 minutes')),
802
547
                            array('id' => 3600, 'value' => __('1 hour')),
803
548
                            array('id' => 14400, 'value' => __('4 hours')),
804
 
                            array('id' => 43200, 'value' => __('12 hours')),
805
 
                            array('id' => 86400, 'value' => __('24 hours'))
 
549
                            array('id' => 43200, 'value' => __('12 hours'))
806
550
                        ),
807
551
                        'default' => 300,
808
552
                        'helpText' => __('How often should the Player check for new content.'),
816
560
                        'title' => __('Download Window Start Time'),
817
561
                        'type' => 'string',
818
562
                        'fieldType' => 'timePicker',
819
 
                        'default' => '00:00',
 
563
                        'default' => 0,
820
564
                        'helpText' => __('The start of the time window to connect to the CMS and download updates.'),
821
565
                        'enabled' => true,
822
566
                        'groupClass' => NULL
827
571
                        'title' => __('Download Window End Time'),
828
572
                        'type' => 'string',
829
573
                        'fieldType' => 'timePicker',
830
 
                        'default' => '00:00',
 
574
                        'default' => 0,
831
575
                        'helpText' => __('The end of the time window to connect to the CMS and download updates.'),
832
576
                        'enabled' => true,
833
577
                        'groupClass' => NULL
834
578
                    ),
835
579
                    array(
836
 
                        'name' => 'xmrNetworkAddress',
837
 
                        'tabId' => 'general',
838
 
                        'title' => __('XMR Public Address'),
839
 
                        'type' => 'string',
840
 
                        'fieldType' => 'text',
841
 
                        'default' => '',
842
 
                        'helpText' => __('Please enter the public address for XMR.'),
843
 
                        'enabled' => true,
844
 
                        'groupClass' => NULL
845
 
                    ),
846
 
                    array(
847
 
                        'name' => 'statsEnabled',
848
 
                        'tabId' => 'general',
849
 
                        'title' => __('Enable stats reporting?'),
850
 
                        'type' => 'checkbox',
851
 
                        'fieldType' => 'checkbox',
852
 
                        'default' => $this->configService->GetSetting('DISPLAY_PROFILE_STATS_DEFAULT', 0),
853
 
                        'helpText' => __('Should the application send proof of play stats to the CMS.'),
854
 
                        'enabled' => true,
855
 
                        'groupClass' => NULL
856
 
                    ),
857
 
                    array(
858
580
                        'name' => 'orientation',
859
581
                        'tabId' => 'location',
860
582
                        'title' => __('Orientation'),
905
627
                        'groupClass' => NULL
906
628
                    ),
907
629
                    array(
908
 
                        'name' => 'useSurfaceVideoView',
909
 
                        'tabId' => 'trouble',
910
 
                        'title' => __('Use a SurfaceView for Video Rendering?'),
911
 
                        'type' => 'checkbox',
912
 
                        'fieldType' => 'checkbox',
913
 
                        'default' => 1,
914
 
                        'helpText' => __('If the device is having trouble playing video, it may be useful to switch to a Surface View for Video Rendering.'),
915
 
                        'enabled' => true,
916
 
                        'groupClass' => NULL
917
 
                    ),
918
 
                    array(
919
 
                        'name' => 'logLevel',
920
 
                        'tabId' => 'trouble',
921
 
                        'title' => __('Log Level'),
922
 
                        'type' => 'string',
923
 
                        'fieldType' => 'dropdown',
924
 
                        'options' => array(
925
 
                            array('id' => 'audit', 'value' => 'Audit'),
926
 
                            array('id' => 'error', 'value' => 'Error'),
927
 
                            array('id' => 'off', 'value' => 'Off')
928
 
                        ),
929
 
                        'default' => 'error',
930
 
                        'helpText' => __('The logging level that should be recorded by the Player.'),
931
 
                        'enabled' => true,
932
 
                        'groupClass' => NULL
933
 
                    ),
934
 
                    array(
935
630
                        'name' => 'startOnBoot',
936
631
                        'tabId' => 'advanced',
937
632
                        'title' => __('Start during device start up?'),
1000
695
                        'fieldType' => 'checkbox',
1001
696
                        'default' => 0,
1002
697
                        'helpText' => __('When enabled the client will send the current layout to the CMS each time it changes. Warning: This is bandwidth intensive and should be disabled unless on a LAN.'),
1003
 
                        'enabled' => ($this->configService->GetSetting('DISPLAY_PROFILE_CURRENT_LAYOUT_STATUS_ENABLED', 0) == 1),
 
698
                        'enabled' => Theme::getConfig('client_sendCurrentLayoutAsStatusUpdate_enabled', true),
1004
699
                        'groupClass' => NULL
1005
700
                    ),
1006
701
                    array(
1011
706
                        'fieldType' => 'number',
1012
707
                        'default' => 0,
1013
708
                        'helpText' => __('The duration between status screen shots in minutes. 0 to disable. Warning: This is bandwidth intensive.'),
1014
 
                        'enabled' => ($this->configService->GetSetting('DISPLAY_PROFILE_SCREENSHOT_INTERVAL_ENABLED', 0) == 1),
 
709
                        'enabled' => Theme::getConfig('client_screenShotRequestInterval_enabled', true),
1015
710
                        'groupClass' => NULL
1016
711
                    ),
1017
712
                    array(
1037
732
                        'groupClass' => NULL
1038
733
                    ),
1039
734
                    array(
1040
 
                        'name' => 'screenShotSize',
1041
 
                        'tabId' => 'advanced',
1042
 
                        'title' => __('Screen Shot Size'),
1043
 
                        'type' => 'int',
1044
 
                        'fieldType' => 'number',
1045
 
                        'default' => $this->configService->GetSetting('DISPLAY_PROFILE_SCREENSHOT_SIZE_DEFAULT', 200),
1046
 
                        'helpText' => __('The size of the largest dimension. Empty or 0 means the screen size.'),
1047
 
                        'enabled' => true,
1048
 
                        'groupClass' => NULL
1049
 
                    ),
1050
 
                    array(
1051
735
                        'name' => 'updateStartWindow',
1052
736
                        'tabId' => 'advanced',
1053
737
                        'title' => __('Update Window Start Time'),
1054
738
                        'type' => 'string',
1055
739
                        'fieldType' => 'timePicker',
1056
 
                        'default' => '00:00',
 
740
                        'default' => 0,
1057
741
                        'helpText' => __('The start of the time window to install application updates.'),
1058
742
                        'enabled' => true,
1059
743
                        'groupClass' => NULL
1064
748
                        'title' => __('Update Window End Time'),
1065
749
                        'type' => 'string',
1066
750
                        'fieldType' => 'timePicker',
1067
 
                        'default' => '00:00',
 
751
                        'default' => 0,
1068
752
                        'helpText' => __('The end of the time window to install application updates.'),
1069
753
                        'enabled' => true,
1070
754
                        'groupClass' => NULL
1071
755
                    ),
1072
 
                    array(
1073
 
                        'name' => 'webViewPluginState',
1074
 
                        'tabId' => 'advanced',
1075
 
                        'title' => __('WebView Plugin State'),
1076
 
                        'type' => 'string',
1077
 
                        'fieldType' => 'dropdown',
1078
 
                        'options' => array(
1079
 
                            array('id' => 'OFF', 'value' => __('Off')),
1080
 
                            array('id' => 'DEMAND', 'value' => __('On Demand')),
1081
 
                            array('id' => 'ON', 'value' => __('On'))
1082
 
                        ),
1083
 
                        'default' => 'DEMAND',
1084
 
                        'helpText' => __('What plugin state should be used when starting a web view.'),
1085
 
                        'enabled' => true,
1086
 
                        'groupClass' => NULL
1087
 
                    ),
1088
 
                    array(
1089
 
                        'name' => 'hardwareAccelerateWebViewMode',
1090
 
                        'tabId' => 'advanced',
1091
 
                        'title' => __('Hardware Accelerate Web Content'),
1092
 
                        'type' => 'string',
1093
 
                        'fieldType' => 'dropdown',
1094
 
                        'options' => array(
1095
 
                            array('id' => '0', 'value' => __('Off')),
1096
 
                            array('id' => '2', 'value' => __('Off when transparent')),
1097
 
                            array('id' => '1', 'value' => __('On'))
1098
 
                        ),
1099
 
                        'default' => '2',
1100
 
                        'helpText' => __('Mode for hardware acceleration of web based content.'),
1101
 
                        'enabled' => true,
1102
 
                        'groupClass' => NULL
1103
 
                    ),
1104
 
                    array(
1105
 
                        'name' => 'timeSyncFromCms',
1106
 
                        'tabId' => 'advanced',
1107
 
                        'title' => __('Use CMS time?'),
1108
 
                        'type' => 'checkbox',
1109
 
                        'fieldType' => 'checkbox',
1110
 
                        'default' => 0,
1111
 
                        'helpText' => __('Set the device time using the CMS. Only available on rooted devices or system signed players.'),
1112
 
                        'enabled' => true,
1113
 
                        'groupClass' => NULL
1114
 
                    ),
1115
 
                    array(
1116
 
                        'name' => 'webCacheEnabled',
1117
 
                        'tabId' => 'advanced',
1118
 
                        'title' => __('Enable caching of Web Resources?'),
1119
 
                        'type' => 'checkbox',
1120
 
                        'fieldType' => 'checkbox',
1121
 
                        'default' => 0,
1122
 
                        'helpText' => __('The standard browser cache will be used - we recommend this is switched off unless specifically required. Effects Web Page and Embedded.'),
1123
 
                        'enabled' => true,
1124
 
                        'groupClass' => NULL
1125
 
                    ),
1126
 
                    array(
1127
 
                        'name' => 'serverPort',
1128
 
                        'tabId' => 'advanced',
1129
 
                        'title' => __('Embedded Web Server Port'),
1130
 
                        'type' => 'int',
1131
 
                        'fieldType' => 'number',
1132
 
                        'default' => 9696,
1133
 
                        'helpText' => __('The port number to use for the embedded web server on the Player. Only change this if there is a port conflict reported on the status screen.'),
1134
 
                        'enabled' => true,
1135
 
                        'groupClass' => NULL
1136
 
                    ),
1137
 
                    array(
1138
 
                        'name' => 'installWithLoadedLinkLibraries',
1139
 
                        'tabId' => 'advanced',
1140
 
                        'title' => __('Load Link Libraries for APK Update'),
1141
 
                        'type' => 'checkbox',
1142
 
                        'fieldType' => 'checkbox',
1143
 
                        'default' => 1,
1144
 
                        'helpText' => __('Should the update command include dynamic link libraries? Only change this if your updates are failing.'),
1145
 
                        'enabled' => true,
1146
 
                        'groupClass' => NULL
1147
 
                    )
1148
756
                )
1149
 
            ),
1150
 
            'lg' => [
1151
 
                'synonym' => 'xiboforwebos',
1152
 
                'tabs' => [
1153
 
                    ['id' => 'general', 'name' => __('General')],
1154
 
                    ['id' => 'timers', 'name' => __('On/Off Time')],
1155
 
                    ['id' => 'pictureOptions', 'name' => __('Picture')],
1156
 
                    ['id' => 'lockOptions', 'name' => __('Lock')],
1157
 
                    ['id' => 'advanced', 'name' => __('Advanced')],
1158
 
                ],
1159
 
                'settings' => [
1160
 
                    [
1161
 
                        'name' => 'emailAddress',
1162
 
                        'tabId' => 'general',
1163
 
                        'title' => __('Email Address'),
1164
 
                        'type' => 'string',
1165
 
                        'fieldType' => 'text',
1166
 
                        'default' => '',
1167
 
                        'helpText' => __('The email address will be used to license this client. This is the email address you provided when you purchased the licence.'),
1168
 
                        'enabled' => true,
1169
 
                        'groupClass' => NULL
1170
 
                    ],
1171
 
                    [
1172
 
                        'name' => 'collectInterval',
1173
 
                        'tabId' => 'general',
1174
 
                        'title' => __('Collect interval'),
1175
 
                        'type' => 'int',
1176
 
                        'fieldType' => 'dropdown',
1177
 
                        'options' => array(
1178
 
                            array('id' => 60, 'value' => __('1 minute')),
1179
 
                            array('id' => 300, 'value' => __('5 minutes')),
1180
 
                            array('id' => 600, 'value' => __('10 minutes')),
1181
 
                            array('id' => 1800, 'value' => __('30 minutes')),
1182
 
                            array('id' => 3600, 'value' => __('1 hour')),
1183
 
                            array('id' => 14400, 'value' => __('4 hours')),
1184
 
                            array('id' => 43200, 'value' => __('12 hours')),
1185
 
                            array('id' => 86400, 'value' => __('24 hours'))
1186
 
                        ),
1187
 
                        'default' => 300,
1188
 
                        'helpText' => __('How often should the Player check for new content.'),
1189
 
                        'validation' => 'numeric',
1190
 
                        'enabled' => true,
1191
 
                        'groupClass' => NULL
1192
 
                    ],
1193
 
                    [
1194
 
                        'name' => 'xmrNetworkAddress',
1195
 
                        'tabId' => 'general',
1196
 
                        'title' => __('XMR Public Address'),
1197
 
                        'type' => 'string',
1198
 
                        'fieldType' => 'text',
1199
 
                        'default' => '',
1200
 
                        'helpText' => __('Please enter the public address for XMR.'),
1201
 
                        'enabled' => true,
1202
 
                        'groupClass' => NULL
1203
 
                    ],
1204
 
                    [
1205
 
                        'name' => 'statsEnabled',
1206
 
                        'tabId' => 'general',
1207
 
                        'title' => __('Enable stats reporting?'),
1208
 
                        'type' => 'checkbox',
1209
 
                        'fieldType' => 'checkbox',
1210
 
                        'default' => $this->configService->GetSetting('DISPLAY_PROFILE_STATS_DEFAULT', 0),
1211
 
                        'helpText' => __('Should the application send proof of play stats to the CMS.'),
1212
 
                        'enabled' => true,
1213
 
                        'groupClass' => NULL
1214
 
                    ],
1215
 
                    [
1216
 
                        'name' => 'orientation',
1217
 
                        'tabId' => 'general',
1218
 
                        'title' => __('Orientation'),
1219
 
                        'type' => 'int',
1220
 
                        'fieldType' => 'dropdown',
1221
 
                        'options' => array(
1222
 
                            array('id' => 0, 'value' => __('Landscape')),
1223
 
                            array('id' => 1, 'value' => __('Portrait')),
1224
 
                            array('id' => 8, 'value' => __('Reverse Landscape')),
1225
 
                            array('id' => 9, 'value' => __('Reverse Portrait'))
1226
 
                        ),
1227
 
                        'default' => 0,
1228
 
                        'helpText' => __('Set the orientation of the device.'),
1229
 
                        'enabled' => true,
1230
 
                        'groupClass' => NULL
1231
 
                    ],
1232
 
                    [
1233
 
                        'name' => 'downloadStartWindow',
1234
 
                        'tabId' => 'general',
1235
 
                        'title' => __('Download Window Start Time'),
1236
 
                        'type' => 'string',
1237
 
                        'fieldType' => 'timePicker',
1238
 
                        'default' => '00:00',
1239
 
                        'helpText' => __('The start of the time window to connect to the CMS and download updates.'),
1240
 
                        'enabled' => true,
1241
 
                        'groupClass' => NULL
1242
 
                    ],
1243
 
                    [
1244
 
                        'name' => 'downloadEndWindow',
1245
 
                        'tabId' => 'general',
1246
 
                        'title' => __('Download Window End Time'),
1247
 
                        'type' => 'string',
1248
 
                        'fieldType' => 'timePicker',
1249
 
                        'default' => '00:00',
1250
 
                        'helpText' => __('The end of the time window to connect to the CMS and download updates.'),
1251
 
                        'enabled' => true,
1252
 
                        'groupClass' => NULL
1253
 
                    ],
1254
 
                    [
1255
 
                        'name' => 'actionBarMode',
1256
 
                        'tabId' => 'advanced',
1257
 
                        'title' => __('Action Bar Mode'),
1258
 
                        'type' => 'int',
1259
 
                        'fieldType' => 'dropdown',
1260
 
                        'options' => array(
1261
 
                            array('id' => 0, 'value' => 'Hide'),
1262
 
                            array('id' => 1, 'value' => 'Timed')
1263
 
                        ),
1264
 
                        'default' => 1,
1265
 
                        'helpText' => __('How should the action bar behave?'),
1266
 
                        'enabled' => true,
1267
 
                        'groupClass' => NULL
1268
 
                    ],
1269
 
                    [
1270
 
                        'name' => 'actionBarDisplayDuration',
1271
 
                        'tabId' => 'advanced',
1272
 
                        'title' => __('Action Bar Display Duration'),
1273
 
                        'type' => 'int',
1274
 
                        'fieldType' => 'text',
1275
 
                        'default' => 30,
1276
 
                        'helpText' => __('How long should the Action Bar be shown for, in seconds?'),
1277
 
                        'validation' => 'numeric',
1278
 
                        'enabled' => true,
1279
 
                        'groupClass' => NULL
1280
 
                    ],
1281
 
                    [
1282
 
                        'name' => 'screenShotSize',
1283
 
                        'tabId' => 'advanced',
1284
 
                        'title' => __('Screen Shot Size'),
1285
 
                        'type' => 'int',
1286
 
                        'fieldType' => 'dropdown',
1287
 
                        'options' => [
1288
 
                            ['id' => 1, 'value' => 'Thumbnail'],
1289
 
                            ['id' => 2, 'value' => 'HD'],
1290
 
                            ['id' => 3, 'value' => 'FHD'],
1291
 
                        ],
1292
 
                        'default' => 1,
1293
 
                        'helpText' => __('The size of the screenshot to return when requested.'),
1294
 
                        'enabled' => true,
1295
 
                        'groupClass' => NULL
1296
 
                    ],
1297
 
                    [
1298
 
                        'name' => 'mediaInventoryTimer',
1299
 
                        'tabId' => 'advanced',
1300
 
                        'title' => __('Send progress while downloading'),
1301
 
                        'type' => 'int',
1302
 
                        'fieldType' => 'text',
1303
 
                        'default' => 0,
1304
 
                        'helpText' => __('How often, in minutes, should the Display send its download progress while it is downloading new content?'),
1305
 
                        'validation' => 'numeric',
1306
 
                        'enabled' => true,
1307
 
                        'groupClass' => NULL
1308
 
                    ],
1309
 
                    [
1310
 
                        'name' => 'logLevel',
1311
 
                        'tabId' => 'advanced',
1312
 
                        'title' => __('Log Level'),
1313
 
                        'type' => 'string',
1314
 
                        'fieldType' => 'dropdown',
1315
 
                        'options' => [
1316
 
                            ['id' => 'audit', 'value' => 'Audit'],
1317
 
                            ['id' => 'error', 'value' => 'Error'],
1318
 
                            ['id' => 'off', 'value' => 'Off']
1319
 
                        ],
1320
 
                        'default' => 'error',
1321
 
                        'helpText' => __('The logging level that should be recorded by the Player.'),
1322
 
                        'enabled' => true,
1323
 
                        'groupClass' => NULL
1324
 
                    ],
1325
 
                    [
1326
 
                        'name' => 'timers',
1327
 
                        'tabId' => 'timers',
1328
 
                        'title' => __('On/Off Timers'),
1329
 
                        'type' => 'string',
1330
 
                        'fieldType' => 'text',
1331
 
                        'default' => '{}',
1332
 
                        'helpText' => __('A JSON object indicating the on/off timers to set'),
1333
 
                        'enabled' => true,
1334
 
                        'groupClass' => NULL
1335
 
                    ],
1336
 
                    [
1337
 
                        'name' => 'pictureOptions',
1338
 
                        'tabId' => 'pictureOptions',
1339
 
                        'title' => __('Picture Options'),
1340
 
                        'type' => 'string',
1341
 
                        'fieldType' => 'text',
1342
 
                        'default' => '{}',
1343
 
                        'helpText' => __('A JSON object indicating the picture options to set'),
1344
 
                        'enabled' => true,
1345
 
                        'groupClass' => NULL
1346
 
                    ],
1347
 
                    [
1348
 
                        'name' => 'lockOptions',
1349
 
                        'tabId' => 'lockOptions',
1350
 
                        'title' => __('Lock Options'),
1351
 
                        'type' => 'string',
1352
 
                        'fieldType' => 'text',
1353
 
                        'default' => '{}',
1354
 
                        'helpText' => __('A JSON object indicating the lock options to set'),
1355
 
                        'enabled' => true,
1356
 
                        'groupClass' => NULL
1357
 
                    ]
1358
 
                ]
1359
 
            ]
 
757
            )
1360
758
        );
1361
759
    }
1362
760
}
 
 
b'\\ No newline at end of file'