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

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 <div class="messages">
0024     <?php foreach (Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger')
0025                        ->getCurrentMessages() as $message) : ?>
0026         <p><?php echo $this->escape($message); ?></p>
0027     <?php endforeach; ?>
0028 </div>
0029 <div class="filtering">
0030     <style>
0031         #QuickImageLinks {
0032             text-align: center;
0033         }
0034 
0035         #QuickImageLinks img {
0036             border: none;
0037             margin: 0px;
0038             padding: 0px;
0039         }
0040 
0041         .child-opener-image {
0042             cursor: pointer;
0043         }
0044 
0045         .child-opener-image {
0046             opacity: 0.5;
0047         }
0048 
0049         .child-opener-image:hover {
0050             opacity: 0.8;
0051         }
0052 
0053         .child-opener-image-column {
0054             text-align: center;
0055         }
0056 
0057         .jtable-dialog-form {
0058             min-width: 640px;
0059         }
0060 
0061         .jtable-dialog-form input[type="text"] {
0062             min-width: 450px;
0063         }
0064 
0065         .jtable-dialog-form textarea {
0066             min-width: 450px;
0067         }
0068 
0069     </style>
0070     <form>
0071         Title: <input type="text" name="filter_title" id="filter_title"/>
0072         Project ID: <input type="text" name="filter_project_id" id="filter_project_id"/>
0073         Member ID: <input type="text" name="filter_member_id" id="filter_member_id"/><br/>
0074         <span style="margin-right: 0.9em;">claimable: <input type="checkbox" name="filter_claimable"
0075                                                              id="filter_claimable" value="1"/></span>
0076         <span style="margin-right: 0.9em;">show Project Pages: <input type="checkbox" name="filter_project_page"
0077                                                                       id="filter_project_page" value="1"
0078                                                                       checked="checked"/></span>
0079         <span style="margin-right: 0.9em;">show About.me: <input type="checkbox" name="filter_personal_page"
0080                                                                  id="filter_personal_page" value="0"/></span>
0081         <span style="margin-right: 0.9em;">show Updates: <input type="checkbox" name="filter_updates"
0082                                                                 id="filter_updates" value="2"/></span>
0083 
0084         <div style="display:inline-block; text-align: right;width: 95%;">
0085             <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button>
0086             <button type="reset" id="RemoveFilterButton"><?= $this->translate('Remove filter'); ?></button>
0087         </div>
0088     </form>
0089 </div>
0090 <div id="TableContainer"></div>
0091 <div id="dialog-form" title="Member Info"></div>
0092 <script type="text/javascript">
0093     $(document).ready(function () {
0094 
0095         $("#dialog-form").dialog({
0096             autoOpen: false,
0097             //height: 350,
0098             width: 600,
0099             modal: true,
0100             buttons: {
0101                 Close: function () {
0102                     $(this).dialog("close");
0103                 }
0104             }
0105         });
0106 
0107 
0108         $('#TableContainer').jtable({
0109             jqueryuiTheme: true,
0110             paging: true,
0111             sorting: true,
0112             defaultSorting: 'mail asc',
0113             title: 'Table of products',
0114             actions: {
0115                 listAction: '/backend/project/list',
0116                 createAction: '/backend/project/create',
0117                 updateAction: '/backend/project/update',
0118                 deleteAction: '/backend/project/delete'
0119             },
0120             fields: {
0121                 project_id: {
0122                     title: 'project_id',
0123                     key: true,
0124                     create: false,
0125                     edit: false,
0126                     list: true,
0127                     width: '5%'
0128                 },
0129                 member_id: {
0130                     title: 'member_id',
0131                     width: '5%',
0132                     list: true,
0133                     create: true,
0134                     edit: false,
0135                     display: function (data) {
0136                         if (data.record.member_id) {
0137                             return data.record.member_id
0138                                 + ' <a role="button" title="show member info" class="btn btn-info btn-xs member-info pull-right" style="color:white;"  data-record="' + data.record.member_id + '"><span>info</span></a>'
0139                                 ;
0140                         }
0141                     }
0142                 },
0143                 content_type: {
0144                     title: 'content_type',
0145                     list: false,
0146                     edit: false,
0147                     create: true
0148                 },
0149                 project_category_id: {
0150                     title: 'category_id',
0151                     width: '5%',
0152                     edit: true,
0153                     create: true,
0154                     sorting: false, //This column is not sortable!
0155                     options: function (data) {
0156                         return '/backend/categories/tree';
0157                     }
0158                 },
0159                 status: {
0160                     title: 'status',
0161                     width: '7%',
0162                     edit: false,
0163                     display: function (data) {
0164                         if (data.record.status) {
0165                             if (data.record.status == 100) {
0166                                 btn_title = 'deactivate';
0167                             } else {
0168                                 btn_title = 'activate';
0169                             }
0170                             return data.record.status
0171                                 + ' <a role="button" title="' + btn_title + ' product" class="btn btn-warning btn-xs toggle-status pull-right" style="color:white;"  data-record="' + data.record.project_id + '"><span>' + btn_title + '</span></a>'
0172                                 ;
0173                         }
0174                     },
0175                     sorting: false //This column is not sortable!
0176                 },
0177                 pid: {
0178                     title: 'belongs to',
0179                     list: true,
0180                     edit: false,
0181                     create: true,
0182                     width: '5%'
0183                 },
0184                 type_id: {
0185                     title: 'type_id',
0186                     list: false,
0187                     edit: false,
0188                     create: false
0189                 },
0190                 title: {
0191                     title: 'title',
0192                     width: '20%',
0193                     list: true,
0194                     display: function (data) {
0195                         if (data.record.title) {
0196                             return data.record.title + ' <a href="/p/' + data.record.project_id + '/" class="btn btn-info btn-xs pull-right" role="button" style="color: white" target="_blank">show</a>';
0197                         }
0198                     }
0199 
0200                 },
0201                 description: {
0202                     title: 'description',
0203                     type: 'textarea',
0204                     list: false
0205                 },
0206                 image_big: {
0207                     title: 'image_big',
0208                     list: false
0209                 },
0210                 image_small: {
0211                     title: 'image_small',
0212                     list: false
0213                 },
0214                 content_url: {
0215                     title: 'content_url',
0216                     list: false
0217                 },
0218                 created_at: {
0219                     title: 'Created',
0220                     width: '10%',
0221                     type: 'date',
0222                     create: false,
0223                     edit: false
0224                 },
0225                 changed_at: {
0226                     title: 'Changed',
0227                     width: '10%',
0228                     type: 'date',
0229                     create: false,
0230                     edit: false,
0231                     list: false
0232                 },
0233                 deleted_at: {
0234                     title: 'Deleted',
0235                     width: '10%',
0236                     type: 'date',
0237                     create: false,
0238                     edit: false,
0239                     list: false
0240                 },
0241                 creator_id: {
0242                     title: 'creator_id',
0243                     width: '5%',
0244                     edit: false
0245                 },
0246                 facebook_code: {
0247                     title: 'facebook_code',
0248                     list: false
0249                 },
0250                 twitter_code: {
0251                     title: 'twitter_code',
0252                     list: false
0253                 },
0254                 google_code: {
0255                     title: 'google_code',
0256                     list: false
0257                 },
0258                 link_1: {
0259                     title: 'link_1',
0260                     list: false
0261                 },
0262                 embed_code: {
0263                     title: 'embed_code',
0264                     list: false
0265                 },
0266                 ppload_collection_id: {
0267                     title: 'ppload_collection_id',
0268                     list: false,
0269                     edit: false,
0270                     create: false
0271                 },
0272                 validated: {
0273                     title: 'validated',
0274                     width: '5%',
0275                     list: true,
0276                     edit: false,
0277                     create: false
0278                 },
0279                 validated_at: {
0280                     title: 'validated_at',
0281                     type: 'date',
0282                     list: false,
0283                     edit: false,
0284                     create: false
0285                 },
0286                 featured: {
0287                     title: 'featured',
0288                     list: false,
0289                     edit: false,
0290                     create: false
0291                 },
0292                 amount: {
0293                     title: 'amount',
0294                     list: false,
0295                     sorting: false //This column is not sortable!
0296                 },
0297                 claimed_by_member: {
0298                     title: 'claimed_by',
0299                     list: false,
0300                     edit: false,
0301                     create: false
0302                 },
0303                 claimable: {
0304                     title: 'claimable',
0305                     width: '5%',
0306                     list: true,
0307                     edit: true,
0308                     options: {'1': 'Yes', '0': 'No'},
0309                     defaultValue: '0',
0310                     create: false
0311                 }
0312             }
0313         });
0314 
0315         $('body').on("click", 'a.toggle-status', function (event) {
0316             event.preventDefault();
0317             event.stopImmediatePropagation();
0318 
0319             if (!confirm('This will toggle the active option for this product. Do you wish to proceed?')) {
0320                 return;
0321             }
0322 
0323             var elementRecord = $(this).data("record");
0324 
0325             jQuery.ajax({
0326                 data: {'project_id': elementRecord},
0327                 url: '/backend/project/togglestatus/',
0328                 type: 'post',
0329                 error: function () {
0330                     alert("<span class='error'>Service is temporarily unavailable. Our engineers are working quickly to resolve this issue. <br/>Find out why you may have encountered this error.</span>");
0331                     return false;
0332                 },
0333                 success: function (results) {
0334                     $('#TableContainer').jtable('reload');
0335                     return false;
0336                 }
0337             });
0338 
0339             return false;
0340         });
0341 
0342         $('body').on("click", 'a.member-info', function (event) {
0343             event.preventDefault();
0344             event.stopImmediatePropagation();
0345 
0346             var elementRecord = $(this).data("record");
0347 
0348             jQuery.ajax({
0349                 data: {'member_id': elementRecord},
0350                 url: '/backend/user/memberinfo/',
0351                 type: 'post',
0352                 error: function () {
0353                     alert("<span class='error'>Service is temporarily unavailable. Our engineers are working quickly to resolve this issue. <br/>Find out why you may have encountered this error.</span>");
0354                     return false;
0355                 },
0356                 success: function (results) {
0357                     $('#dialog-form').html(results.ViewRecord).dialog('open');
0358                     return false;
0359                 }
0360             });
0361 
0362             return false;
0363         });
0364 
0365 
0366         //Re-load records when user click 'load records' button.
0367         $('#LoadRecordsButton').click(function (e) {
0368             e.preventDefault();
0369             $('#TableContainer').jtable('load', {
0370                 filter_title: $('#filter_title').val(),
0371                 filter_project_id: $('#filter_project_id').val(),
0372                 filter_member_id: $('#filter_member_id').val(),
0373                 filter_claimable: $('#filter_claimable:checked').val(),
0374                 filter_project_page: $('#filter_project_page:checked').val(),
0375                 filter_personal_page: $('#filter_personal_page:checked').val(),
0376                 filter_updates: $('#filter_updates:checked').val()
0377 
0378             });
0379         });
0380 
0381         //Re-load records when user click 'remove filter' button.
0382         $('#RemoveFilterButton').click(function (e) {
0383             e.preventDefault();
0384             $('#TableContainer').jtable('load', {
0385                 filter_title: null,
0386                 filter_project_id: null,
0387                 filter_member_id: null,
0388                 filter_claimable: null,
0389                 filter_project_page: null,
0390                 filter_personal_page: null,
0391                 filter_updates: null
0392             });
0393         });
0394 
0395         $('#TableContainer').jtable('load', {
0396             filter_title: $('#filter_title').val(),
0397             filter_project_id: $('#filter_project_id').val(),
0398             filter_member_id: $('#filter_member_id').val(),
0399             filter_claimable: $('#filter_claimable:checked').val(),
0400             filter_project_page: $('#filter_project_page:checked').val(),
0401             filter_personal_page: $('#filter_personal_page:checked').val(),
0402             filter_updates: $('#filter_updates:checked').val()
0403 
0404         });
0405     });
0406 </script>