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

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 
0026 $this->headTitle('Mods', 'SET');
0027 $model = new Default_Model_ProjectClone();
0028 $credits = $model->fetchMods();
0029 ?>
0030 
0031 <style type="text/css">
0032         img.reporterimage
0033         {
0034                 width: 80px;
0035                 height: 80px;
0036                 border: 1px solid #dbdbdb;
0037                 -webkit-border-radius: 999px;
0038                 -moz-border-radius: 999px;
0039                 border-radius: 999px;
0040                 -webkit-background-clip: padding-box;
0041                 -moz-background-clip: padding;
0042                 background-clip: padding-box;
0043         }
0044 
0045         .mini-card{
0046             width: 70%;
0047             
0048         }
0049         .u-wrap{
0050             position: relative;
0051         }
0052         div.header{
0053             font-weight: bold;
0054             height: 30px;
0055             background-color: #ccc; 
0056         }
0057 </style>
0058 <div class="tooltip_templates" style="display: none">
0059     <span id="tooltip_content">
0060         <i class="fa fa-spinner"></i>
0061     </span>
0062 </div>
0063 
0064  <div id="report-product-clone" class="modal report-product-clone" tabindex="-1" role="dialog">
0065     <div class="modal-dialog modal-sm">
0066         <div class="modal-content">
0067             <div class="modal-header">
0068                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
0069                             aria-hidden="true">&times;</span></button>
0070                             <h2 class="modal-title">Flag Modification</h2>
0071             </div>
0072             <form id="product-report-clone" class="full-width partialjson" action="/credits/edit/"
0073                   data-target="#report-product-clone-message">
0074                 <input type="hidden" name="id" value="">
0075                 <div id="report-product-clone-message" class="message" style="padding: 20px">
0076                     <div>                            
0077                         <label class="form-label">Project ID:  </label><br/>
0078                         <input name="p" id="clonePId" readonly/><br/><br/>     
0079                         
0080                         <label class="form-label">Origianl Link:  </label><br/>
0081                         <input name="l" id="externalLink"/><br/><br/> 
0082 
0083                         <br/><br/>
0084                         
0085                         <label class="form-label">Additional message: </label>
0086                         <br/>
0087                        <textarea class="" id="report-text" name="t"  rows="3" style="width: 440px;"></textarea>                                                     
0088                     </div>
0089                     <div class="modal-footer">
0090                         <button type="submit" class="small">
0091                             <span class="glyphicon glyphicon-share-alt"></span> Flag Modification
0092                         </button>
0093                     </div>
0094                 </div>
0095             </form>
0096         </div>
0097     </div>
0098 </div>
0099 
0100 <main id="explore-content">
0101     <section class="wrapper" id="products-wrapper">
0102         <div class="container-fluid">
0103             <div class="row">
0104                 <div class="sidebar-left col-md-1"></div>
0105                 <div class="content col-md-10">
0106                 <h2>
0107                      List of Mods
0108                 </h2>
0109                 <?php if(count($credits)>0)
0110                 {
0111                     ?>
0112                  <div class="col-lg-10 col-md-10 col-sm-10 col-xs-10" style="padding: 10px 0;">
0113                     
0114                                 <div class="col-lg-1 "></div>
0115                                 <div class="col-lg-3 center" >Original Link</div>
0116                                 <div class="col-lg-3 center">Clone</div>
0117                                 <div class="col-lg-3 center">Text</div>
0118                                 <div class="col-lg-2 col-md-2 center">Reported by</div>
0119                                 <div class="col-lg-1 "></div>
0120                  
0121                 </div>
0122                 <?php } ?>
0123                     <?php
0124                     $helperPrintDate = new Default_View_Helper_PrintDate();
0125                     $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl();
0126                     $helperImage = new Default_View_Helper_Image();
0127                     $helpMemberUrl = new Default_View_Helper_BuildMemberUrl();
0128 
0129                     $this->rownum = (1 + (($this->page - 1) * 10));
0130                     $pageLimit = 10;    
0131                     $paginator = Zend_Paginator::factory($credits);
0132                     $paginator->setItemCountPerPage($pageLimit);
0133                     $paginator->setCurrentPageNumber($this->page);                    
0134                     $this->products = $paginator;
0135                     if ($paginator->count() == 0) {
0136                         echo '<div class="alert alert-success" role="alert"><p class="text-success">Congratulations. No more Mods in sight. (For the moment)</p></div>';
0137                     }
0138                     foreach ($this->products as $this->product) {                        
0139                         ?>
0140 
0141                         <div class="col-lg-10 col-md-10 col-sm-10 col-xs-10" style="border-top: 1px solid #ccc;font-size: 12px;padding: 10px 0;">
0142 
0143 
0144                             <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
0145                                 <div class="rownum">
0146                                     <?= intval($this->rownum) ?>.
0147                                 </div>
0148                             </div>
0149                             <div class="col-lg-3 ">
0150                             <?php   echo $this->product->external_link ; ?>
0151                             </div>
0152 
0153                             <div class="explore-product-details col-lg-3">      
0154                                 <?php if($this->product->title): ?>                              
0155                                       <div class="mini-card">
0156                                             <div class="u-wrap">
0157                                                 <a href="<?= $this->buildProductUrl($this->product->project_id, '', null, true); ?>">
0158                                                     <figure>
0159                                                         <img src="<?php echo $this->Image($this->product->image_small, array('width' => 101, 'height' => 81)); ?>"
0160                                                              class="explore-product-image" width="101" height="81" />
0161                                                     </figure>
0162                                                     <div class="u-content">
0163                                                         <h3><?php echo $this->product->title; ?></h3>
0164                                                         <span class="productCategory"> <?php echo $this->product->catTitle; ?> </span>
0165 
0166                                                         <span class="productCategory" style="width: 100%; float: left;">
0167                                                             <?= $helperPrintDate->printDate($this->product->changed_at) ?>
0168                                                         </span>
0169                                                     </div>
0170                                                 </a>
0171                                                                                           
0172                                                 
0173                                                 <?php
0174                                                 $this->widgetRating = new stdClass();
0175                                                 $this->widgetRating->project_id = $this->product->project_id;
0176                                                 $this->widgetRating->laplace_score =$this->product->laplace_score;
0177                                                 $this->widgetRating->count_likes = 0;
0178                                                 $this->widgetRating->count_dislikes = 0;
0179                                                 echo $this->render('partials/widgetRating.phtml'); ?>
0180                                             </div>
0181                                       </div>
0182                                   <?php endif; ?>
0183                             </div>
0184                             <div class="col-lg-3">
0185                                     
0186                                     <?php  echo $this->product->text ; ?>
0187                             </div>
0188                             
0189 
0190                             <div class="col-lg-1 col-md-1 col-sm-1">
0191                                 <figure>                                   
0192                                         <a href="<?=$helpMemberUrl->buildMemberUrl($this->product->reporter_username)?>">    <img class="reporterimage tooltipuser" data-tooltip-content="#tooltip_content" data-user="<?=$this->product->reported_by?>" 
0193                                                     src="<?php echo $this->Image($this->product->reporter_profile_image_url,array('width' => 50, 'height' => 50)); ?>" 
0194                                                 />                                       
0195                                         </a>
0196                                 </figure>
0197                                 <span><?=$this->product->reporter_username?></span>
0198                             </div>    
0199 
0200 
0201 
0202                         </div><!-- END .explore-product -->
0203                         <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 small text-right"
0204                              style="border-top: 1px solid #ccc;font-size: 12px;padding: 10px 0;">
0205                             
0206                               <a  href="/credits/delete?id=<?= $this->product->project_clone_id?>"
0207                                class="delete-this btn btn-danger" data-title="Do you really want to delete this ?" >delete
0208                               </a>
0209 
0210                               <a  href="/credits/valid?id=<?= $this->product->project_clone_id?>"
0211                                class="delete-this btn btn-danger" data-title="Do you really want to validate this ?">validate
0212                               </a>
0213 
0214                               <a 
0215                                           class="btn btn-default eventmodal" 
0216                                           data-p="<?=$this->product->project_id?>"
0217                                           data-t="<?=$this->product->text?>"
0218                                           data-l="<?=$this->product->external_link?>"
0219                                           data-id="<?=$this->product->project_clone_id?>">
0220                                            edit 
0221                               </a>
0222                             
0223                         </div>
0224                         <?php
0225                         $this->rownum++;
0226                     }
0227                     ?>
0228                 </div>
0229                 <div class="sidebar-right col-md-1"></div>
0230             </div>
0231              <?php if(count($credits)>0)
0232                 {
0233                     ?>
0234             <section class="explore-footer text-center">
0235                 <?php echo $this->paginationControl($this->products, 'Sliding',
0236                     'partials/paginationControlWithoutAjax.phtml',
0237                     array('params' => $this->filters, 'dom_target' => 'section#products-wrapper')); ?>
0238             </section>
0239             <?php } ?>
0240         </div>
0241     </section>
0242 </main>
0243 
0244 <script>
0245     $('.delete-this').on('click', function (event) {
0246         event.stopPropagation();
0247         var popupText = $(this).attr('data-title');
0248         var result = confirm(popupText);
0249         if (result) {
0250             var target = $(this).attr('href');
0251             $.ajax({
0252                 url: target,
0253                 success: function (results) {
0254                     location.reload();
0255                     //alert('Deleted successfully');
0256                 },
0257                 error: function () {
0258                     alert('Service is temporarily unavailable.');
0259                 }
0260             });
0261         }
0262 
0263         return false;
0264     });
0265 
0266     $('body').on('click', 'a.eventmodal', function (event) {
0267              event.stopPropagation();
0268              $('#report-product-clone').modal('toggle');           
0269              console.log($(this));
0270              $('#report-product-clone').find('input[name="id"]').val($(this).attr('data-id'));
0271              $('#report-product-clone').find('input[name="p"]').val($(this).attr('data-p'));
0272              $('#report-product-clone').find('input[name="l"]').val($(this).attr('data-l'));
0273              $('#report-product-clone').find('textarea[name="t"]').text($(this).attr('data-t'));            
0274     })
0275 
0276     $("#report-product-clone").on("hidden.bs.modal", function () {
0277         location.reload();
0278     });
0279 </script>
0280 
0281 <?php $this->inlineScript()->appendScript(
0282     '    $(document).ready(function(){                                             
0283                 TooltipUser.setup("tooltipuser","right");            
0284                   PartialJson.setup();           
0285             });
0286         ');