~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to modules/video.module.php

  • Committer: Dan Garner
  • Date: 2015-03-26 14:08:33 UTC
  • Revision ID: git-v1:70d14044444f8dc5d602b99890d59dea46d9470c
Moved web servable files to web folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/*
 
3
 * Xibo - Digital Signage - http://www.xibo.org.uk
 
4
 * Copyright (C) 2006,2007,2008 Daniel Garner and James Packer
 
5
 *
 
6
 * This file is part of Xibo.
 
7
 *
 
8
 * Xibo is free software: you can redistribute it and/or modify
 
9
 * it under the terms of the GNU Affero General Public License as published by
 
10
 * the Free Software Foundation, either version 3 of the License, or
 
11
 * any later version.
 
12
 *
 
13
 * Xibo is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 * GNU Affero General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Affero General Public License
 
19
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 
20
 */
 
21
use Xibo\Helper\ApplicationState;
 
22
 
 
23
class video extends Module
 
24
{
 
25
    /**
 
26
     * Return the Edit Form as HTML
 
27
     */
 
28
    public function EditForm()
 
29
    {
 
30
        $response = $this->getState();
 
31
        $formFields = array();
 
32
        $formFields[] = FormManager::AddCheckbox('loop', __('Loop?'),
 
33
            $this->GetOption('loop', 0), __('Should the video loop if it finishes before the provided duration?'),
 
34
            'l', 'loop-fields');
 
35
 
 
36
        $formFields[] = FormManager::AddCheckbox('mute', __('Mute?'),
 
37
            $this->GetOption('mute', 1), __('Should the video be muted?'),
 
38
            'm', 'mute-fields');
 
39
 
 
40
        $response->AddFieldAction('duration', 'init', '0', array('.loop-fields' => array('display' => 'none')));
 
41
        $response->AddFieldAction('duration', 'change', '0', array('.loop-fields' => array('display' => 'none')));
 
42
        $response->AddFieldAction('duration', 'init', '0', array('.loop-fields' => array('display' => 'block')), 'not');
 
43
        $response->AddFieldAction('duration', 'change', '0', array('.loop-fields' => array('display' => 'block')), 'not');
 
44
 
 
45
        // Standard Edit Form
 
46
        $this->baseEditForm($formFields, $response);
 
47
    }
 
48
 
 
49
    /**
 
50
     * Edit Media in the Database
 
51
     */
 
52
    public function EditMedia()
 
53
    {
 
54
        // Set the properties specific to this module
 
55
        $this->SetOption('loop', \Kit::GetParam('loop', _POST, _CHECKBOX));
 
56
        $this->SetOption('mute', \Kit::GetParam('mute', _POST, _CHECKBOX));
 
57
 
 
58
        parent::EditMedia();
 
59
    }
 
60
 
 
61
    /**
 
62
     * Preview code for a module
 
63
     * @param int $width
 
64
     * @param int $height
 
65
     * @param int $scaleOverride The Scale Override
 
66
     * @return string The Rendered Content
 
67
     */
 
68
    public function Preview($width, $height, $scaleOverride = 0)
 
69
    {
 
70
        // Videos are never previewed in the browser.
 
71
        return $this->previewIcon();
 
72
    }
 
73
 
 
74
    /**
 
75
     * Get Resource
 
76
     * @param int $displayId
 
77
     * @return mixed
 
78
     */
 
79
    public function GetResource($displayId = 0)
 
80
    {
 
81
        $this->ReturnFile();
 
82
        exit();
 
83
    }
 
84
 
 
85
    /**
 
86
     * Is this module valid
 
87
     * @return int
 
88
     */
 
89
    public function IsValid()
 
90
    {
 
91
        // Yes
 
92
        return 1;
 
93
    }
 
94
}