root/contributed_modules/modules/extaudio/page.extaudio.php

Revision 6042, 4.3 kB (checked in by Nick_Lewis, 4 years ago)

New External Audio Module for paging to Public Address Systems

Line 
1 <?php
2 //Copyright (C) ATL Telecom Ltd 2008 Nick Lewis
3 //
4 //This program is free software; you can redistribute it and/or
5 //modify it under the terms of the GNU General Public License
6 //as published by the Free Software Foundation; either version 2
7 //of the License, or (at your option) any later version.
8 //
9 //This program is distributed in the hope that it will be useful,
10 //but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //GNU General Public License for more details.
13
14 $action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
15
16
17 //if submitting form, update database
18 if ($action == 'edit') {
19   $extaudiofields = array(
20             array($_REQUEST['lineoutvol'],'lineoutvol'),
21             array($_REQUEST['pagingvol'],'pagingvol'),
22             array($_REQUEST['capturevol'],'capturevol'),
23             array($_REQUEST['muzakvol'],'muzakvol')
24             );
25
26   $compiled = $db->prepare('UPDATE extaudio SET value = ? WHERE variable = ?');
27   $result = $db->executeMultiple($compiled,$extaudiofields);
28   if(DB::IsError($result)) {
29     echo $action.'<br>';
30     die($result->getMessage());
31   }
32
33   //indicate 'need reload' link in header.php
34   needreload();
35 }
36
37 //get all rows relating to selected account
38 $sql = "SELECT * FROM extaudio";
39 $extaudiorows = $db->getAll($sql);
40 if(DB::IsError($extaudiorows)) {
41 die($extaudiorows->getMessage());
42 }
43
44 //create a set of variables that match the items in extaudio[0]
45 foreach ($extaudiorows as $extaudio) {
46   ${trim($extaudio[0])} = $extaudio[1];
47 }
48
49 ?>
50
51 <form name="extaudio" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return general_onsubmit();">
52 <input type="hidden" name="display" value="extaudio"/>
53 <input type="hidden" name="action" value="edit"/>
54
55 <h5><?php echo _("External Audio Settings")?></h5>
56 <p>
57   <a href=# class="info"><?php echo _("Master line-out volume (%) ")?><span><br>
58 <?php echo _("0% - 100%: The volume of the output relative to the maximum volume")?><br>
59 <?php echo _("Used for setting master volume for music and paging to a public address system")?><br>
60   </span></a>
61   <input type="text" size="2" name="lineoutvol" value="<?php  echo htmlspecialchars($lineoutvol)?>"/>
62 </p>
63 <ul>
64 <li>
65   <a href=# class="info"><?php echo _("Line-out paging volume (%) ")?><span><br>
66 <?php echo _("0% - 100%: The volume of the paging relative to the maximum volume")?><br>
67 <?php echo _("Used for setting paging volume to a public address system")?><br>
68   </span></a>
69   <input type="text" size="2" name="pagingvol" value="<?php  echo htmlspecialchars($pagingvol)?>"/>
70 </li>
71 <li>
72   <a href=# class="info"><?php echo _("Line-out music volume (%) ")?><span><br>
73 <?php echo _("0% - 100%: The volume of the passthrough music relative to the maximum volume")?><br>
74 <?php echo _("Used for setting passthrough music volume to a public address system")?><br>
75   </span></a>
76   <input type="text" size="2" name="muzakvol" value="<?php  echo htmlspecialchars($muzakvol)?>"/>
77 </li>
78 </ul>
79 <p>
80   <a href=# class="info"><?php echo _("Music-on-Hold capture volume (%) ")?><span><br>
81 <?php echo _("0% - 100%: The volume of the music-on-hold capture relative to the maximum volume")?><br>
82 <?php echo _("Used for setting volume of music-on-hold captured from external input")?><br>
83   </span></a>
84   <input type="text" size="2" name="capturevol" value="<?php  echo htmlspecialchars($capturevol)?>"/>
85 </p>
86 <h6>
87   <input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>">
88 </h6>
89 <script language="javascript">
90 <!--
91
92 var theForm = document.extaudio;
93
94 function general_onsubmit() {
95   var msgInvalidPercent = "<?php echo _('Please enter an whole number percentage between 0 and 100'); ?>";
96
97   defaultEmptyOK = false;
98   if (!isInteger(theForm.lineoutvol.value) || (theForm.lineoutvol.value > 100) || (theForm.lineoutvol.value < 0))
99     return warnInvalid(theForm.lineoutvol, msgInvalidPercent);
100   if (!isInteger(theForm.pagingvol.value) || (theForm.pagingvol.value > 100) || (theForm.pagingvol.value < 0))
101     return warnInvalid(theForm.pagingvol, msgInvalidPercent);
102   if (!isInteger(theForm.muzakvol.value) || (theForm.muzakvol.value > 100) || (theForm.muzakvol.value < 0))
103     return warnInvalid(theForm.muzakvol, msgInvalidPercent);
104   if (!isInteger(theForm.capturevol.value) || (theForm.capturevol.value > 100) || (theForm.capturevol.value < 0))
105     return warnInvalid(theForm.capturevol, msgInvalidPercent);
106
107   return true;
108 }
109
110 //-->
111 </script>
112 </form>
Note: See TracBrowser for help on using the browser.