source: extensions/piwigo_videojs/admin/admin_config.php @ 24710

Last change on this file since 24710 was 24676, checked in by ddtddt, 11 years ago

[extensions] - piwigo_videojs - add file for translate

File size: 3.3 KB
Line 
1<?php
2/***********************************************
3* File      :   admin_config.php
4* Project   :   piwigo-videojs
5* Descr     :   Generate the admin panel
6*
7* Created   :   24.06.2012
8*
9* Copyright 2012-2013 <xbgmsharp@gmail.com>
10*
11*
12* This program is free software: you can redistribute it and/or modify
13* it under the terms of the GNU General Public License as published by
14* the Free Software Foundation, either version 3 of the License, or
15* (at your option) any later version.
16*
17* This program is distributed in the hope that it will be useful,
18* but WITHOUT ANY WARRANTY; without even the implied warranty of
19* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20* GNU General Public License for more details.
21*
22* You should have received a copy of the GNU General Public License
23* along with this program.  If not, see <http://www.gnu.org/licenses/>.
24*
25************************************************/
26
27// Check whether we are indeed included by Piwigo.
28if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
29
30// Load parameter
31$customcss = $conf['vjs_customcss'] ? $conf['vjs_customcss'] : '';
32
33// Available skins
34$available_skins = array(
35        'vjs-default-skin' => 'default',
36        'vjs-darkfunk-skin' => 'darkfunk',
37        'vjs-redsheen-skin' => 'redsheen',
38);
39
40// Available preload value
41$available_preload = array(
42        'auto' => 'Auto',
43        'none' => 'None',
44);
45
46// Available width value
47$available_width = array(
48        '480' => 'EDTV: (720x480) ie: 480p',
49        '720' => 'HDReady: (1280x720) ie: 720p',
50        '1080' => 'FullHD: (1920x1080) ie: 1080p',
51);
52
53// Update conf if submitted in admin site
54if (isset($_POST['submit']) && !empty($_POST['vjs_skin']))
55{
56        // keep the value in the admin form
57        $conf['vjs_conf'] = array(
58                'skin'          => $_POST['vjs_skin'],
59                'max_width'     => $_POST['vjs_max_width'],
60                'preload'       => $_POST['vjs_preload'],
61                'controls'      => get_boolean($_POST['vjs_controls']),
62                'autoplay'      => get_boolean($_POST['vjs_autoplay']),
63                'loop'          => get_boolean($_POST['vjs_loop']),
64        );
65        $customcss = $_POST['vjs_customcss'];
66
67        // Update config to DB
68        conf_update_param('vjs_conf', serialize($conf['vjs_conf']));
69        $query = "UPDATE ". CONFIG_TABLE ." SET value='". $_POST['vjs_customcss'] ."' WHERE param='vjs_customcss'";
70        pwg_query($query);
71
72        // the prefilter changes, we must delete compiled templatess
73        $template->delete_compiled_templates();
74
75        array_push($page['infos'], l10n('Your configuration settings are saved'));
76}
77
78/* Get statistics */
79// All videos with supported extensions by VideoJS
80$query = "SELECT COUNT(*) FROM ".IMAGES_TABLE." WHERE ".SQL_VIDEOS.";";
81list($nb_videos) = pwg_db_fetch_array( pwg_query($query) );
82
83// All videos with supported extensions by VideoJS and thumb
84$query = "SELECT COUNT(*) FROM ".IMAGES_TABLE." WHERE `representative_ext` IS NOT NULL AND ".SQL_VIDEOS.";";
85list($nb_videos_thumb) = pwg_db_fetch_array( pwg_query($query) );
86
87// send value to template
88$template->assign($conf['vjs_conf']);
89$template->assign(
90        array(
91            'AVAILABLE_SKINS'       => $available_skins,
92            'AVAILABLE_PRELOAD'     => $available_preload,
93            'AVAILABLE_WIDTH'       => $available_width,
94            'CUSTOM_CSS'            => htmlspecialchars($customcss),
95            'NB_VIDEOS'             => $nb_videos,
96            'NB_VIDEOS_THUMB'       => $nb_videos_thumb,
97        )
98);
99
100?>
Note: See TracBrowser for help on using the repository browser.