File indexing completed on 2024-12-29 05:24:44

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  * Created: 31.05.2017
0023  */
0024 ?>
0025 <main id="explore-content">
0026     <section class="wrapper" id="products-wrapper">
0027         <div class="container-fluid">
0028             <div class="row">
0029                 <div class="sidebar-left col-md-2"></div>
0030                 <div class="content col-md-8">
0031                     <h1>List of Misuse-Reports</h1>
0032                     
0033                     
0034                     <?php
0035                     $helperPrintDate = new Default_View_Helper_PrintDate();
0036                     $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl();
0037                     $helperImage = new Default_View_Helper_Image();
0038                     $helpMemberUrl = new Default_View_Helper_BuildMemberUrl();
0039 
0040                     $this->rownum = (1 + (($this->page - 1) * 10));
0041                     $pageLimit = 10;
0042 
0043                     $modelMisuse = new Default_Model_Misuse();
0044                     $candidateProducts = $modelMisuse->fetchMisuseCandidate();
0045 
0046                     $paginator = Zend_Paginator::factory($candidateProducts);
0047                     $paginator->setItemCountPerPage($pageLimit);
0048                     $paginator->setCurrentPageNumber($this->page);
0049                     //$paginator->setTotalItemCount(count($candidateProducts));
0050 
0051                     $this->products = $paginator;
0052                     if ($paginator->count() == 0) {
0053                         echo '<div class="alert alert-success" role="alert"><p class="text-success">Congratulations. No more Misuse Projects in sight. (For the moment)</p></div>';
0054                     }
0055                     foreach ($this->products as $this->product) {
0056                         $updateTime = $helperPrintDate->printDate($this->product['changed_at']);
0057                         $reportTime = $helperPrintDate->printDate($this->product['report_created_at']);
0058                         ?>
0059                         <div class="explore-product col-lg-10 col-md-10 col-sm-10 col-xs-10"
0060                              style="border-top: 1px solid #ccc;font-size: 12px;padding: 10px 0;">
0061                             <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
0062                                 <div class="rownum">
0063                                     <?= intval($this->rownum) ?>.
0064                                 </div>
0065                             </div>
0066                             <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 explore-product-imgcolumn">
0067                                 <figure>
0068                                     <a href="<?= $helperBuildProductUrl->buildProductUrl($this->product['project_id'],
0069                                         ''); ?>">
0070                                         <div class="text-center">
0071                                             <img src="<?php echo $helperImage->Image($this->product['image_small'],
0072                                                 array('width' => 167, 'height' => 167)); ?>"
0073                                                  class="explore-product-image" style="max-width:95%;"/>
0074                                         </div>
0075                                     </a>
0076                                 </figure>
0077                             </div>
0078                             <div class="explore-product-details col-lg-6 col-md-6 col-sm-6 col-xs-6">
0079                                 <h3>
0080                                     <?php
0081                                     $version = Default_Model_HtmlPurify::purify($this->product['version']);
0082                                     ?>
0083                                     <a href="<?= $helperBuildProductUrl->buildProductUrl($this->product['project_id'],
0084                                         ''); ?>"><?php echo $this->product['title']; ?> <span
0085                                                 style="font-size: smaller; padding-left: 20px"><?php echo $version ?> </span></a>
0086                                 </h3>
0087 
0088                                 <b style="display: block; margin-bottom: 5px"><?php echo $this->product['cat_title'] ?></b>
0089                                 <b style="display: block; margin-bottom: 5px" class="small">by 
0090                                     <a href="<?php echo $helpMemberUrl->buildMemberUrl($this->product['username']) ?>"><?php echo $this->product['username'] ?></a></b>
0091                                 <?php
0092                                 if (false === empty($this->product['package_names'])) {
0093                                     $list_packages = explode(',', $this->product['package_names']);
0094                                     $resultString = "";
0095                                     foreach ($list_packages as $item) {
0096                                         $resultString = $resultString . ' <span class="packagetypeos" > ' . stripslashes($item) . '</span>';
0097                                     }
0098                                     echo $resultString;
0099                                 }
0100                                 
0101                                 /*$helperPackageTypes = new Default_View_Helper_FetchProjectPackageTypes();
0102                                 $type = $helperPackageTypes->FetchProjectPackageTypes($this->product['project_id']);
0103                                 if (!empty($type)) {
0104                                     ?>
0105                                     <?= $type ?>
0106                                 <?php } */
0107                                 ?>
0108 
0109                                 <div class="productInfo">
0110                                     <?php
0111                                     $count_plingers = $this->product['count_plingers'];
0112                                     $count_comments = $this->product['count_comments'];
0113                                     echo ($count_plingers > 0 ? '<span class="cntSupporters">' . $count_plingers
0114                                             . ' supporter' : '') . ($count_plingers > 1 ? 's' : '') . ($count_plingers
0115                                         > 0 ? '</span>' : '');
0116                                     echo ($count_comments > 0 ? '<span class="cntComments">' . $count_comments
0117                                             . ' comment' : '') . ($count_comments > 1 ? 's' : '') . ($count_comments > 0
0118                                             ? '</span>' : '');
0119                                     ?>
0120                                 </div>
0121                                 
0122                                 <div style=" width: 100px; padding-top: 10px;">
0123                                 
0124                                     <!-- RATING -->
0125                                     <?php
0126                                     $this->widgetRating = new stdClass();
0127                                     $this->widgetRating->project_id = $this->product['project_id'];
0128                                     $this->widgetRating->laplace_score = $this->product['laplace_score'];
0129                                     $this->widgetRating->count_likes = $this->product['count_likes'];
0130                                     $this->widgetRating->count_dislikes = $this->product['count_dislikes'];
0131                                     // it is a trial
0132                                     include APPLICATION_PATH . '/modules/default/views/scripts/partials/widgetRating.phtml';
0133                                     //echo $this->render('partials/widgetRating.phtml'); ?>
0134                                     <!-- /RATING -->
0135 
0136                                 </div>
0137                                 <div class="collected">
0138                                     <span><?php echo $updateTime ?></span>
0139                                 </div>
0140                             </div>
0141                             
0142                             <div class="explore-product-plings col-lg-3 col-md-3 col-sm-3 col-xs-3">
0143                                 
0144                                 <div class="reportInfo">
0145                                     <b>Reported by 
0146                                         <?php if(isset($this->product['report_member_id'])) { ?>
0147                                         <a href="<?php echo $helpMemberUrl->buildMemberUrl($this->product['report_username']) ?>"><?php echo $this->product['report_username'] ?></a> 
0148                                         <?php } else { ?>
0149                                         unknown
0150                                         <?php } ?>
0151                                             
0152                                         <?php echo $reportTime ?></b>
0153                                 </div>
0154                                 
0155                                 <div class="reportInfo" style="padding-top: 5px;">
0156                                     <b>Report-Text:</b><br><span><?php echo $this->product['report_text']; ?></span>
0157                                     
0158                                 </div>
0159 
0160                             </div>
0161                         </div><!-- END .explore-product -->
0162                         
0163                         <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 small text-right"
0164                              style="border-top: 1px solid #ccc;font-size: 12px;padding: 10px 0;">
0165                             
0166                             <?php /*
0167                             <a href="/backend/project/delete?project_id=<?= $this->product['project_id'] ?>"
0168                                class="delete-this" data-title="Delete this product?">delete product</a>
0169                             <hr/>
0170                             <a href="/backend/user/delete?member_id=<?= $this->product['member_id'] ?>"
0171                                class="delete-this" data-title="Delete this member and all his products and comments?">delete
0172                                 user</a>
0173                             <hr/>
0174                             */ ?>
0175                             
0176                             <a href="/backend/reportproducts/validatereport?r=<?= $this->product['report_id'] ?>"
0177                                class="delete-this" data-title="Mark report as valid?">validate report</a>
0178                             <hr/>
0179                             <a href="/backend/reportproducts/deletereport?r=<?= $this->product['report_id'] ?>"
0180                                class="delete-this" data-title="Mark report as deleted?">delete report</a>
0181                         </div>
0182                         <?php
0183                         $this->rownum++;
0184                     }
0185                     ?>
0186                 </div>
0187                 <div class="sidebar-right col-md-2"></div>
0188             </div>
0189             <section class="explore-footer text-center">
0190                 <?php echo $this->paginationControl($this->products, 'Sliding',
0191                     'partials/paginationControlWithoutAjax.phtml',
0192                     array('params' => $this->filters, 'dom_target' => 'section#products-wrapper')); ?>
0193             </section>
0194         </div>
0195     </section>
0196 </main>
0197 
0198 <script>
0199     $('.delete-this').on('click', function (event) {
0200         event.stopPropagation();
0201         var popupText = $(this).attr('data-title');
0202         var result = confirm(popupText);
0203         if (result) {
0204             var target = $(this).attr('href');
0205             $.ajax({
0206                 url: target,
0207                 success: function (results) {
0208                     location.reload();
0209                     //alert('Deleted successfully');
0210                 },
0211                 error: function () {
0212                     alert('Service is temporarily unavailable.');
0213                 }
0214             });
0215         }
0216 
0217         return false;
0218     });
0219 </script>