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 <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     <form>
0031         Member Id: <input type="text" name="filter_member_id" id="filter_member_id"/>
0032         First Name: <input type="text" name="filter_firstname" id="filter_firstname"/>
0033         Last Name: <input type="text" name="filter_lastname" id="filter_lastname"/>
0034         Username: <input type="text" name="filter_username" id="filter_username"/>
0035         e-mail: <input type="text" name="filter_mail" id="filter_mail"/>
0036         <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button>
0037         <button type="reset" id="RemoveFilterButton"><?= $this->translate('Remove filter'); ?></button>
0038     </form>
0039 </div>
0040 <div id="TableContainer"></div>
0041 <div id="dialog-form" title=""></div>
0042 <script type="text/javascript">
0043     $("#dialog-form").dialog({
0044         autoOpen: false,
0045         //height: 350,
0046         width: 600,
0047         modal: true,
0048         buttons: {
0049             Close: function () {
0050                 $(this).dialog("close");
0051             },
0052             Save: function () {
0053                 $('#dialog-form form').submit();
0054                 $(this).dialog("close");
0055             }
0056         }
0057     });
0058 </script>
0059 <script type="text/javascript">
0060     $(document).ready(function () {
0061         $('#TableContainer').jtable({
0062             jqueryuiTheme: true,
0063             paging: true,
0064             sorting: true,
0065             defaultSorting: 'mail asc',
0066             title: 'Table of user',
0067             actions: {
0068                 listAction: '/backend/user/list',
0069                 createAction: '/backend/user/create',
0070                 updateAction: '/backend/user/update'/*,
0071                 deleteAction: '/backend/user/delete'*/
0072             },
0073             fields: {
0074                 member_id: {
0075                     title: 'MemberId',
0076                     key: true,
0077                     create: false,
0078                     edit: false,
0079                     list: true
0080                 },
0081                 uuid: {
0082                     title: 'UUID',
0083                     width: '10%',
0084                     list: false,
0085                     create: false
0086                 },
0087                 password: {
0088                     title: 'Password',
0089                     list: false,
0090                     edit: false,
0091                     create: false,
0092                     type: 'password'
0093                 },
0094                 roleId: {
0095                     title: 'Role',
0096                     width: '5%',
0097                     sorting: false //This column is not sortable!
0098                 },
0099                 type: {
0100                     title: 'Type',
0101                     width: '5%',
0102                     sorting: false //This column is not sortable!
0103                 },
0104                 firstname: {
0105                     title: 'firstname',
0106                     width: '5%'
0107                 },
0108                 lastname: {
0109                     title: 'lastname',
0110                     width: '5%'
0111                 },
0112                 street: {
0113                     title: 'street',
0114                     list: false
0115                 },
0116                 zip: {
0117                     title: 'zip',
0118                     list: false
0119                 },
0120                 city: {
0121                     title: 'city',
0122                     list: false
0123                 },
0124                 phone: {
0125                     title: 'phone',
0126                     list: false
0127                 },
0128                 mail: {
0129                     title: 'mail',
0130                     width: '5%',
0131                     list: true
0132                 },
0133                 lastonline: {
0134                     title: 'lastonline',
0135                     type: 'date',
0136                     list: false
0137                 },
0138                 is_deleted: {
0139                     title: 'Deleted',
0140                     width: '5%',
0141                     list: true
0142                 },
0143                 verificationVal: {
0144                     title: 'Verification Value',
0145                     list: false
0146                 },
0147                 mail_checked: {
0148                     title: 'mail_checked',
0149                     list: false
0150                 },
0151                 created_at: {
0152                     title: 'Created',
0153                     width: '10%',
0154                     type: 'date',
0155                     create: false,
0156                     edit: false
0157                 },
0158                 changed_at: {
0159                     title: 'Changed',
0160                     width: '10%',
0161                     type: 'date',
0162                     create: false,
0163                     edit: false
0164                 },
0165                 deleted_at: {
0166                     title: 'Deleted',
0167                     width: '10%',
0168                     type: 'date',
0169                     create: false,
0170                     edit: false
0171                 },
0172                 biography: {
0173                     title: 'biography',
0174                     type: 'textarea',
0175                     list: false
0176                 },
0177                 avatar: {
0178                     title: 'avatar',
0179                     list: false
0180                 },
0181                 username: {
0182                     title: 'username',
0183                     width: '5%',
0184                     list: true
0185                 },
0186                 agb: {
0187                     title: 'agb',
0188                     list: false
0189                 },
0190                 country: {
0191                     title: 'country',
0192                     list: false
0193                 },
0194                 newsletter: {
0195                     title: 'newsletter',
0196                     list: false
0197                 },
0198                 is_active: {
0199                     title: 'Active',
0200                     width: '5%',
0201                     list: true,
0202                     sorting: false //This column is not sortable!
0203                 },
0204                 paypal_mail: {
0205                     title: 'paypal_mail',
0206                     width: '5%',
0207                     list: true
0208                 },
0209                 paypal_valid_status: {
0210                     title: 'paypal_valid_status',
0211                     width: '5%',
0212                     //options: {'': '', '0': '0 - New', '100': '100 - Valid', '500': '500 - Invalid', '501': '501 - Can only receive money from homepage', '502': '502 - Can not receive personal payments', '503': '503 - This recipient is currently unable to receive money'},
0213                     <?php 
0214                         $optionString = "'':'',";
0215                         $paypalValidStatusModel = new Default_Model_DbTable_PaypalValidStatus();
0216                         $list = $paypalValidStatusModel->getStatiForSelectList();
0217                         foreach ($list as $key => $value) {
0218                             $optionString.= "'".$key."':'".$key." - ".$value."',";
0219                         }
0220                         echo "options: {" . $optionString . "},";
0221                     ?>
0222                     
0223                     optionsSorting: 'text',
0224                     list: true
0225                 },
0226                 wallet_address: {
0227                     title: 'wallet_address',
0228                     width: '5%',
0229                     list: true
0230                 },
0231                 main_project_id: {
0232                     title: 'main_project_id',
0233                     list: false
0234                 },
0235                 profile_image_url: {
0236                     title: 'profile_image_url',
0237                     list: false
0238                 },
0239                 login_method: {
0240                     title: 'login_method',
0241                     list: false
0242                 },
0243                 social_username: {
0244                     title: 'social_username',
0245                     list: false
0246                 },
0247                 social_user_id: {
0248                     title: 'social_user_id',
0249                     list: false
0250                 },
0251                 gravatar_email: {
0252                     title: 'gravatar_email',
0253                     list: false
0254                 },
0255                 profile_img_src: {
0256                     title: 'profile_img_src',
0257                     list: false
0258                 },
0259                 facebook_username: {
0260                     title: 'facebook_username',
0261                     list: false
0262                 },
0263                 twitter_username: {
0264                     title: 'twitter_username',
0265                     list: false
0266                 },
0267                 link_facebook: {
0268                     title: 'link_facebook',
0269                     list: false
0270                 },
0271                 link_twitter: {
0272                     title: 'link_twitter',
0273                     list: false
0274                 },
0275                 link_website: {
0276                     title: 'link_website',
0277                     list: false
0278                 },
0279                 link_google: {
0280                     title: 'link_google',
0281                     list: false
0282                 },
0283                 validated_at: {
0284                     title: 'validated_at',
0285                     type: 'date',
0286                     create: false,
0287                     edit: false,
0288                     list: false
0289                 },
0290                 validated: {
0291                     title: 'validated',
0292                     list: false
0293                 },
0294                 exportUser: {
0295                     title: '',
0296                     width: '1%',
0297                     sorting: false,
0298                     create: false,
0299                     edit: false,
0300                     list: true,
0301                     display: function (data) {
0302                         if (data.record) {
0303                             return '<a role="button" title="export user data" class="btn btn-primary btn-xs export-user" style="color:white;" data-record="' + data.record.member_id + '"><span class="glyphicon glyphicon-export" aria-hidden="true"></span></a>';
0304                         }
0305                     }
0306                 },
0307                 reactivateUser: {
0308                     title: '',
0309                     width: '1%',
0310                     sorting: false,
0311                     create: false,
0312                     edit: false,
0313                     list: true,
0314                     display: function (data) {
0315                         if (data.record.is_deleted == 1) {
0316                             return '<a role="button" title="Reactivate User" class="btn btn-primary btn-xs reactivate-user" style="color:white;" data-record="' + data.record.member_id + '"><span class="glyphicon glyphicon-step-backward" aria-hidden="true"></span></a>';
0317                         } else {
0318                             return '<a role="button" title="Delete User" class="btn btn-primary btn-xs deactivate-user" style="color:white;" data-record="' + data.record.member_id + '"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>';
0319                         }
0320                     }
0321                 }
0322             }
0323         });
0324 
0325         //Re-load records when user click 'load records' button.
0326         $('#LoadRecordsButton').click(function (e) {
0327             e.preventDefault();
0328             $('#TableContainer').jtable('load', {
0329                 filter_member_id: $('#filter_member_id').val(),
0330                 filter_firstname: $('#filter_firstname').val(),
0331                 filter_lastname: $('#filter_lastname').val(),
0332                 filter_username: $('#filter_username').val(),
0333                 filter_mail: $('#filter_mail').val()
0334             });
0335         });
0336 
0337         //Re-load records when user click 'remove filter' button.
0338         $('#RemoveFilterButton').click(function (e) {
0339             e.preventDefault();
0340             $('#TableContainer').jtable('load', {
0341                 filter_member_id: null,
0342                 filter_firstname: null,
0343                 filter_lastname: null,
0344                 filter_username: null,
0345                 filter_mail: null
0346             });
0347         });
0348 
0349         $('body').on("click", 'a.export-user', function (event) {
0350             event.preventDefault();
0351             event.stopImmediatePropagation();
0352 
0353             var elementRecord = $(this).data("record");
0354 
0355             jQuery.ajax({
0356                 data: {'c': elementRecord},
0357                 url: '/backend/user/export/',
0358                 type: 'post',
0359                 error: function (jqXHR, textStatus, errorThrown) {
0360                     console.log(jqXHR);
0361                     console.log("-------");
0362                     console.log(textStatus);
0363                     console.log("-------");
0364                     console.log(errorThrown);
0365                     if (jqXHR.responseText) {
0366                         $('#dialog-form').empty().html(jqXHR.responseText).dialog('open');
0367                     } else {
0368                         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>");
0369                     }
0370                     return false;
0371                 },
0372                 success: function (results) {
0373                     $('#dialog-form').empty().html(results.Message).dialog('open');
0374                     return false;
0375                 }
0376             });
0377 
0378             return false;
0379         });
0380         
0381         $('body').on("click", 'a.reactivate-user', function (event) {
0382             event.preventDefault();
0383             event.stopImmediatePropagation();
0384 
0385             var elementRecord = $(this).data("record");
0386 
0387             jQuery.ajax({
0388                 data: {'c': elementRecord},
0389                 url: '/backend/user/reactivate/',
0390                 type: 'post',
0391                 error: function (jqXHR, textStatus, errorThrown) {
0392                     console.log(jqXHR);
0393                     console.log("-------");
0394                     console.log(textStatus);
0395                     console.log("-------");
0396                     console.log(errorThrown);
0397                     if (jqXHR.responseText) {
0398                         $('#dialog-form').empty().html(jqXHR.responseText).dialog('open');
0399                     } else {
0400                         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>");
0401                     }
0402                     return false;
0403                 },
0404                 success: function (results) {
0405                     $('#TableContainer').jtable('load', {
0406                         filter_member_id: $('#filter_member_id').val(),
0407                         filter_firstname: $('#filter_firstname').val(),
0408                         filter_lastname: $('#filter_lastname').val(),
0409                         filter_username: $('#filter_username').val(),
0410                         filter_mail: $('#filter_mail').val()
0411                     });
0412                     return false;
0413                 }
0414             });
0415 
0416             return false;
0417         });
0418         
0419         $('body').on("click", 'a.deactivate-user', function (event) {
0420             event.preventDefault();
0421             event.stopImmediatePropagation();
0422 
0423             var elementRecord = $(this).data("record");
0424 
0425             jQuery.ajax({
0426                 data: {'c': elementRecord},
0427                 url: '/backend/user/delete/',
0428                 type: 'post',
0429                 error: function (jqXHR, textStatus, errorThrown) {
0430                     console.log(jqXHR);
0431                     console.log("-------");
0432                     console.log(textStatus);
0433                     console.log("-------");
0434                     console.log(errorThrown);
0435                     if (jqXHR.responseText) {
0436                         $('#dialog-form').empty().html(jqXHR.responseText).dialog('open');
0437                     } else {
0438                         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>");
0439                     }
0440                     return false;
0441                 },
0442                 success: function (results) {
0443                     $('#TableContainer').jtable('load', {
0444                         filter_member_id: $('#filter_member_id').val(),
0445                         filter_firstname: $('#filter_firstname').val(),
0446                         filter_lastname: $('#filter_lastname').val(),
0447                         filter_username: $('#filter_username').val(),
0448                         filter_mail: $('#filter_mail').val()
0449                     });
0450                     return false;
0451                 }
0452             });
0453 
0454             return false;
0455         });
0456 
0457         $('#TableContainer').jtable('load');
0458     });
0459 </script>