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('Clones', 'SET');
0027 $model = new Default_Model_ProjectClone();
0028 $credits = $model->fetchCredits();
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">This product is based on:</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">ID of the Clone on opendesktop:  </label><br/>
0078                         <input name="p" id="clonePId"/><br/><br/>     
0079                         <br/><br/>
0080                         <label class="form-label">Additional message: </label>
0081                         <br/>
0082                        <textarea class="" id="report-text" name="t"  rows="3" style="width: 440px;"></textarea>                                                     
0083                     </div>
0084                     <div class="modal-footer">
0085                         <button type="submit" class="small">
0086                             <span class="glyphicon glyphicon-share-alt"></span> add credits
0087                         </button>
0088                     </div>
0089                 </div>
0090             </form>
0091         </div>
0092     </div>
0093 </div>
0094 
0095 <main id="explore-content">
0096     <section class="wrapper" id="products-wrapper">
0097         <div class="container-fluid">
0098             <div class="row">
0099                 <div class="sidebar-left col-md-1"></div>
0100                 <div class="content col-md-10">
0101                 <h2>
0102                      List of clones
0103                 </h2>
0104                 <?php if(count($credits)>0)
0105                 {
0106                     ?>
0107                  <div class="col-lg-10 col-md-10 col-sm-10 col-xs-10" style="padding: 10px 0;">
0108                     
0109                                 <div class="col-lg-1 "></div>
0110                                 <div class="col-lg-3 center" >Original</div>
0111                                 <div class="col-lg-3 center">Clone</div>
0112                                 <div class="col-lg-3 center">Text</div>
0113                                 <div class="col-lg-2 col-md-2 center">Reported by</div>
0114                                 <div class="col-lg-1 "></div>
0115                  
0116                 </div>
0117                 <?php } ?>
0118                     <?php
0119                     $helperPrintDate = new Default_View_Helper_PrintDate();
0120                     $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl();
0121                     $helperImage = new Default_View_Helper_Image();
0122                     $helpMemberUrl = new Default_View_Helper_BuildMemberUrl();
0123 
0124                     $this->rownum = (1 + (($this->page - 1) * 10));
0125                     $pageLimit = 10;    
0126                     $paginator = Zend_Paginator::factory($credits);
0127                     $paginator->setItemCountPerPage($pageLimit);
0128                     $paginator->setCurrentPageNumber($this->page);                    
0129                     $this->products = $paginator;
0130                     if ($paginator->count() == 0) {
0131                         echo '<div class="alert alert-success" role="alert"><p class="text-success">Congratulations. No more SPAM in sight. (For the moment)</p></div>';
0132                     }
0133                     foreach ($this->products as $this->product) {                        
0134                         ?>
0135 
0136                         <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;">
0137 
0138 
0139                             <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
0140                                 <div class="rownum">
0141                                     <?= intval($this->rownum) ?>.
0142                                 </div>
0143                             </div>
0144                             <div class="col-lg-3 ">
0145                                         <?php if($this->product->project_id_parent!=null && $this->product->parent_title!=null ) { ?>
0146 
0147                                         <div class="mini-card">
0148                                               <div class="u-wrap">
0149                                                   <a href="<?= $this->buildProductUrl($this->product->project_id_parent, '', null, true); ?>">
0150                                                       <figure>
0151                                                           <img src="<?php echo $this->Image($this->product->parent_image_small, array('width' => 101, 'height' => 81)); ?>"
0152                                                                class="explore-product-image" width="101" height="81" />
0153                                                       </figure>
0154                                                       <div class="u-content">
0155                                                           <h3><?php echo $this->product->parent_title; ?></h3>
0156                                                           <span class="productCategory"> <?php echo $this->product->parent_catTitle; ?> </span>
0157 
0158                                                           <span class="productCategory" style="width: 100%; float: left;">
0159                                                               <?= $helperPrintDate->printDate($this->product->parent_changed_at) ?>
0160                                                           </span>
0161                                                       </div>
0162                                                   </a>
0163                                                                                             
0164                                                   
0165                                                   <?php
0166                                                   $this->widgetRating = new stdClass();
0167                                                   $this->widgetRating->project_id = $this->product->project_id_parent;
0168                                                   $this->widgetRating->laplace_score =$this->product->parent_laplace_score;
0169                                                   $this->widgetRating->count_likes = 0;
0170                                                   $this->widgetRating->count_dislikes = 0;
0171                                                   echo $this->render('partials/widgetRating.phtml'); ?>
0172                                               </div>
0173                                         </div>
0174                                     <?php }else{
0175 
0176                                                
0177 
0178                                         } ?>
0179                             </div>
0180 
0181                             <div class="explore-product-details col-lg-3">      
0182                                 <?php if($this->product->title): ?>                              
0183                                       <div class="mini-card">
0184                                             <div class="u-wrap">
0185                                                 <a href="<?= $this->buildProductUrl($this->product->project_id, '', null, true); ?>">
0186                                                     <figure>
0187                                                         <img src="<?php echo $this->Image($this->product->image_small, array('width' => 101, 'height' => 81)); ?>"
0188                                                              class="explore-product-image" width="101" height="81" />
0189                                                     </figure>
0190                                                     <div class="u-content">
0191                                                         <h3><?php echo $this->product->title; ?></h3>
0192                                                         <span class="productCategory"> <?php echo $this->product->catTitle; ?> </span>
0193 
0194                                                         <span class="productCategory" style="width: 100%; float: left;">
0195                                                             <?= $helperPrintDate->printDate($this->product->changed_at) ?>
0196                                                         </span>
0197                                                     </div>
0198                                                 </a>
0199                                                                                           
0200                                                 
0201                                                 <?php
0202                                                 $this->widgetRating = new stdClass();
0203                                                 $this->widgetRating->project_id = $this->product->project_id;
0204                                                 $this->widgetRating->laplace_score =$this->product->laplace_score;
0205                                                 $this->widgetRating->count_likes = 0;
0206                                                 $this->widgetRating->count_dislikes = 0;
0207                                                 echo $this->render('partials/widgetRating.phtml'); ?>
0208                                             </div>
0209                                       </div>
0210                                   <?php endif; ?>
0211                             </div>
0212                             <div class="col-lg-3">
0213                                     <?php   echo $this->product->external_link ; ?>
0214                                     <?php  echo $this->product->text ; ?>
0215                             </div>
0216                             
0217 
0218                             <div class="col-lg-1 col-md-1 col-sm-1">
0219                                 <figure>                                   
0220                                         <a href="<?=$helpMemberUrl->buildMemberUrl($this->product->reporter_username)?>">    <img class="reporterimage tooltipuser" data-tooltip-content="#tooltip_content" data-user="<?=$this->product->reported_by?>" 
0221                                                     src="<?php echo $this->Image($this->product->reporter_profile_image_url,array('width' => 50, 'height' => 50)); ?>" 
0222                                                 />                                       
0223                                         </a>
0224                                 </figure>
0225                                 <span><?=$this->product->reporter_username?></span>
0226                             </div>    
0227 
0228 
0229 
0230                         </div><!-- END .explore-product -->
0231                         <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 small text-right"
0232                              style="border-top: 1px solid #ccc;font-size: 12px;padding: 10px 0;">
0233                             
0234                               <a  href="/credits/delete?id=<?= $this->product->project_clone_id?>"
0235                                class="delete-this btn btn-danger" data-title="Do you really want to delete this ?" >delete
0236                               </a>
0237 
0238                               <a  href="/credits/valid?id=<?= $this->product->project_clone_id?>"
0239                                class="delete-this btn btn-danger" data-title="Do you really want to validate this ?">validate
0240                               </a>
0241 
0242                               <a 
0243                                           class="btn btn-default eventmodal" 
0244                                           data-p="<?=$this->product->project_id?>"
0245                                           data-t="<?=$this->product->text?>"
0246                                           data-l="<?=$this->product->external_link?>"
0247                                           data-id="<?=$this->product->project_clone_id?>">
0248                                            edit 
0249                               </a>
0250                             
0251                         </div>
0252                         <?php
0253                         $this->rownum++;
0254                     }
0255                     ?>
0256                 </div>
0257                 <div class="sidebar-right col-md-1"></div>
0258             </div>
0259              <?php if(count($credits)>0)
0260                 {
0261                     ?>
0262             <section class="explore-footer text-center">
0263                 <?php echo $this->paginationControl($this->products, 'Sliding',
0264                     'partials/paginationControlWithoutAjax.phtml',
0265                     array('params' => $this->filters, 'dom_target' => 'section#products-wrapper')); ?>
0266             </section>
0267             <?php } ?>
0268         </div>
0269     </section>
0270 </main>
0271 
0272 <script>
0273     $('.delete-this').on('click', function (event) {
0274         event.stopPropagation();
0275         var popupText = $(this).attr('data-title');
0276         var result = confirm(popupText);
0277         if (result) {
0278             var target = $(this).attr('href');
0279             $.ajax({
0280                 url: target,
0281                 success: function (results) {
0282                     location.reload();
0283                     //alert('Deleted successfully');
0284                 },
0285                 error: function () {
0286                     alert('Service is temporarily unavailable.');
0287                 }
0288             });
0289         }
0290 
0291         return false;
0292     });
0293 
0294     $('body').on('click', 'a.eventmodal', function (event) {
0295              event.stopPropagation();
0296              $('#report-product-clone').modal('toggle');           
0297              console.log($(this));
0298              $('#report-product-clone').find('input[name="id"]').val($(this).attr('data-id'));
0299              $('#report-product-clone').find('input[name="p"]').val($(this).attr('data-p'));
0300              $('#report-product-clone').find('input[name="l"]').val($(this).attr('data-l'));
0301              $('#report-product-clone').find('textarea[name="t"]').text($(this).attr('data-t'));            
0302     })
0303 
0304     $("#report-product-clone").on("hidden.bs.modal", function () {
0305         location.reload();
0306     });
0307 </script>
0308 
0309 <?php $this->inlineScript()->appendScript(
0310     '    $(document).ready(function(){                                             
0311                 TooltipUser.setup("tooltipuser","right");            
0312                   PartialJson.setup();           
0313             });
0314         ');