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 
0023 ?>
0024 
0025 <div class="messages">
0026     <?php foreach (Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger')
0027                        ->getCurrentMessages() as $message) : ?>
0028         <p><?php echo $this->escape($message); ?></p>
0029     <?php endforeach; ?>
0030 </div>
0031 <div id="TableContainer"></div>
0032 
0033 
0034 <script type="text/javascript">
0035     $(document).ready(function () {
0036         $('#TableContainer').jtable({
0037             jqueryuiTheme: true,
0038             paging: true,
0039             sorting: true,
0040             defaultSorting: 'order asc',
0041             title: 'Table of Sponsors',
0042             actions: {
0043                 listAction: '/backend/sponsor/list',
0044                 createAction: '/backend/sponsor/create',
0045                 updateAction: function (postData) {
0046                     return $.Deferred(function ($dfd) {
0047                         $.ajax({
0048                             url: '/backend/sponsor/update',
0049                             type: 'POST',
0050                             dataType: 'json',
0051                             data: postData,
0052                             success: function (data) {
0053                                 $dfd.resolve(data);
0054                                 $('#TableContainer').jtable('reload');
0055                             },
0056                             error: function () {
0057                                 $dfd.reject();
0058                             }
0059                         });
0060                     });
0061                 },
0062                 deleteAction: '/backend/sponsor/delete'
0063             },
0064             fields: {
0065                 sponsor_id: {
0066                     key: true,
0067                     create: false,
0068                     edit: false,
0069                     list: true,
0070                     title: 'Id',
0071                     width: '5%',
0072                 },
0073                 name: {
0074                     title: 'Sponsor Name',
0075                     width: '10%',
0076                     list: true,
0077                     create: true
0078                 },
0079                 fullname: {
0080                     title: 'Full Name',
0081                     width: '10%',
0082                     list: true,
0083                     create: true
0084                 },
0085                 description: {
0086                     title: 'Description',
0087                     width: '20%',
0088                     list: true,
0089                     create: true
0090                 },
0091                 amount: {
0092                     title: 'Sponsoring-Amount per month',
0093                     width: '15%',
0094                     list: true,
0095                     create: true
0096                 },
0097                 begin_at: {
0098                     title: 'Begin',
0099                     width: '10%',
0100                     list: true,
0101                     create: true
0102                 },
0103                 end_at: {
0104                     title: 'End',
0105                     width: '10%',
0106                     list: true,
0107                     create: true
0108                 },
0109                 is_active: {
0110                     title: 'Is active',
0111                     width: '5%',
0112                     type: 'checkbox',
0113                     values: { '0': 'No', '1': 'Yes' },
0114                     defaultValue: '1',
0115                 }
0116             }
0117 
0118             
0119         });
0120 
0121         $('#TableContainer').jtable('load');
0122     });
0123 </script>