File indexing completed on 2025-05-04 05:29:03

0001 <?php 
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 $modelStores = new Default_Model_DbTable_ConfigStore();
0023 $hostnames = $modelStores->fetchHostnamesForJTable();
0024 $selectOptions = '';
0025 foreach ($hostnames as $element) {
0026     $selectOptions .= '<option value='.$element['Value'].'>'.$element['DisplayText'].'</option>';
0027 }
0028 ?>
0029 <div class="messages">
0030     <?php foreach (Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger')
0031                        ->getCurrentMessages() as $message) : ?>
0032         <p><?php echo $this->escape($message); ?></p>
0033     <?php endforeach; ?>
0034 </div>
0035 <div class="filtering well" style="width: 95%;">
0036     <form>
0037         <span style="margin-right: 0.9em;">filter hostname: <select name="filter_hostname" id="filter_hostname" required="required">
0038                 <?php echo $selectOptions ?>
0039             </select></span>
0040         <div style="display:inline-block; text-align: right;width: 100%;">
0041             <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button>
0042             <button type="reset" id="RemoveFilterButton"><?= $this->translate('Remove filter'); ?></button>
0043         </div>
0044     </form>
0045     <script type="text/javascript">
0046         //Re-load records when user click 'load records' button.
0047         $('#LoadRecordsButton').click(function (e) {
0048             e.preventDefault();
0049             $('#TableContainer').jtable('load', {
0050                 filter_hostname: $('#filter_hostname').val()
0051             });
0052         });
0053 
0054         //Re-load records when user click 'remove filter' button.
0055         $('#RemoveFilterButton').click(function (e) {
0056             e.preventDefault();
0057             $('#TableContainer').jtable('load', {
0058                 filter_hostname: null,
0059             });
0060         });
0061     </script>
0062 </div>
0063 <div id="TableContainer"></div>
0064 <script type="text/javascript">
0065     $(document).ready(function () {
0066         $('#TableContainer').jtable({
0067             jqueryuiTheme: true,
0068             paging: true,
0069             sorting: true,
0070             defaultSorting: 'store_id asc, order asc',
0071             title: 'Table of category configuration for stores',
0072             actions: {
0073                 listAction: '/backend/vstorecategories/list',
0074                 createAction: '/backend/vstorecategories/create',
0075                 updateAction: '/backend/vstorecategories/update',
0076                 deleteAction: '/backend/vstorecategories/delete'
0077             },
0078             fields: {
0079                 store_category_id: {
0080                     key: true,
0081                     create: false,
0082                     edit: false,
0083                     list: false
0084                 },
0085                 store_id: {
0086                     title: 'store',
0087                     width: '10%',
0088                     list: true,
0089                     create: true,
0090                     options: function (data) {
0091                         if (data.source == 'edit') {
0092                             data.clearCache();
0093                             return '/backend/store/hostnames';
0094                         }
0095                         return '/backend/store/hostnames';
0096                     }
0097                 },
0098                 v_category_id: {
0099                     title: 'V Category Id',
0100                     width: '10%',
0101                     list: true,
0102                     create: true,
0103                     options: function (data) {
0104                         if (data.source == 'edit') {
0105                             data.clearCache();
0106                             return '/backend/vcategories/tree?c=-1';
0107                         }
0108                         return '/backend/vcategories/tree?c=-1';
0109                     }
0110                 },
0111                 order: {
0112                     title: 'display order',
0113                     width: '10%',
0114                     list: true,
0115                     create: true,
0116                     edit: true
0117                 }
0118             }
0119         });
0120 
0121         $('#TableContainer').jtable('load');
0122     });
0123 </script>