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 $helperPrintDate = new Default_View_Helper_PrintDate(); 0026 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); 0027 $helperImage = new Default_View_Helper_Image(); 0028 $helpMemberUrl = new Default_View_Helper_BuildMemberUrl(); 0029 0030 $isadmin = 0; 0031 if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') { 0032 $isadmin = 1; 0033 } 0034 ?> 0035 0036 <link href="/theme/backend/lib/jquery-ui/themes/smoothness/jquery-ui.min.css" rel="stylesheet"> 0037 <link href="/theme/backend/lib/jtable/themes/jqueryui/jtable_jqueryui.min.css" rel="stylesheet"> 0038 <script src="/theme/backend/lib/jquery-ui/jquery-ui.min.js"></script> 0039 <script src="/theme/backend/lib/jtable/jquery.jtable.min.js"></script> 0040 0041 <style type="text/css"> 0042 img.pimage{ 0043 float: left; 0044 } 0045 div.ptitle{ 0046 margin-left: 140px; 0047 font-size: 13px; 0048 font-weight: bold; 0049 } 0050 div.jtable-main-container table.jtable tbody > tr > td{ 0051 vertical-align: top; 0052 border-left:0px; 0053 border-right:0px; 0054 font-size: small; 0055 } 0056 div.jtable-main-container table.jtable{ 0057 border: 0px; 0058 } 0059 div.jtable-main-container table.jtable th{ 0060 border: 0px; 0061 background: none; 0062 font-weight: bold; 0063 } 0064 0065 #products-wrapper{ 0066 padding-bottom: 20px; 0067 } 0068 0069 0070 #explore-content .ui-state-default 0071 { 0072 background: none; 0073 border: 0px; 0074 0075 } 0076 0077 0078 #explore-content div.jtable-main-container table.jtable .rating{ 0079 width:80px; 0080 margin-left:140px; 0081 padding-top:20px; 0082 } 0083 #explore-content div.jtable-main-container table.jtable .tooltipuser{ 0084 color: #2673b0; 0085 cursor: pointer; 0086 } 0087 0088 a.imghistory{ 0089 0090 } 0091 0092 0093 0094 </style> 0095 <main id="explore-content"> 0096 <section class="wrapper" id="products-wrapper" > 0097 <h1> 0098 Get hot new stuff excluded 0099 </h1> 0100 0101 <form style="margin-top: 20px; margin-bottom: 20px"> 0102 0103 Member : 0104 <?php 0105 $md = new Default_Model_ProjectModeration(); 0106 $mlist = $md->getMembers(); 0107 0108 ?> 0109 <select name = "filter_member_id" id="filter_member_id" > 0110 <?php 0111 echo '<option value=""></option>'; 0112 foreach ($mlist as $m) { 0113 echo '<option value="'.$m['member_id'].'"">'.$m['username'].'</option>'; 0114 } 0115 ?> 0116 </select> 0117 0118 0119 <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button> 0120 0121 0122 </form> 0123 </div> 0124 <div id="TableContainer"></div> 0125 </section> 0126 0127 </main> 0128 <div class="tooltip_templates" style="display: none"> 0129 <span id="tooltip_content"> 0130 <i class="fa fa-spinner"></i> 0131 </span> 0132 </div> 0133 <script type="text/javascript"> 0134 $(document).ready(function () { 0135 0136 var isadmin = <?php echo $isadmin;?>; 0137 0138 $("#dialog-form").dialog({ 0139 autoOpen: false, 0140 //height: 350, 0141 width: 600, 0142 modal: true, 0143 buttons: { 0144 Close: function () { 0145 $(this).dialog("close"); 0146 } 0147 } 0148 }); 0149 0150 var actions; 0151 if(isadmin==1) 0152 { 0153 actions = { 0154 listAction: '/moderation/list' , 0155 updateAction: '/moderation/update' 0156 } 0157 }else{ 0158 actions = { 0159 listAction: '/moderation/list' 0160 0161 } 0162 } 0163 0164 0165 $('#TableContainer').jtable({ 0166 jqueryuiTheme: true, 0167 paging: true, 0168 sorting: true, 0169 actions: actions, 0170 recordsLoaded: function (event, data) { 0171 TooltipUser.setup("tooltipuser","right"); 0172 }, 0173 fields: { 0174 project_id: { 0175 title: 'project_id', 0176 key: true, 0177 create: false, 0178 edit: false, 0179 list: false 0180 }, 0181 title: { 0182 title: 'Project ', 0183 create: false, 0184 edit: false, 0185 list: true, 0186 width:'15%', 0187 display: function (data) { 0188 if (data.record.image_small) { 0189 var html = ' <a href="/p/' + data.record.project_id + '/" target="_blank"><img class="pimage" src='+data.record.image_small+' /></a><div class="ptitle">'+data.record.title+'</div>' ; 0190 var red = 200; 0191 var blue = 200; 0192 var d = 200; 0193 var green =200; 0194 var sc = data.record.laplace_score; 0195 if(sc == 0) sc = 50; 0196 0197 0198 if(sc>50) { 0199 red=(d-((sc-50)*4)).toString(16); 0200 green=(d).toString(16); 0201 blue=(d-((sc-50)*4)).toString(16); 0202 }else if(sc<51) { 0203 red=(d).toString(16); 0204 green=(d-((50-sc)*4)).toString(16); 0205 blue=(d-((50-sc)*4)).toString(16); 0206 } 0207 0208 0209 var color = red+green+blue; 0210 var t= '<div class="rating" >'+ 0211 '<div class="rating-text">'+ 0212 '<small class="center-block text-center">Score '+data.record.laplace_score+'%'+ 0213 '</small>'+ 0214 '</div>'+ 0215 '<div class="progress" style="margin-bottom: 0;height:12px;background-color: transparent; box-shadow: none; padding:2px;">'+ 0216 '<div class="progress-bar" style="background-color: #'+color+';width: '+data.record.laplace_score+'%;">'+ 0217 '</div>'+ 0218 '<div class="progress-bar" style="background-color:#eeeeee;width: '+(100 -data.record.laplace_score)+'%;">'+ 0219 '</div>'+ 0220 '</div>'+ 0221 '</div>'; 0222 html = html+t; 0223 0224 return html; 0225 } 0226 } 0227 }, 0228 0229 cat_title:{ 0230 title: 'Category', 0231 width:'5%', 0232 list:true, 0233 edit: false 0234 }, 0235 username:{ 0236 title: 'Creator', 0237 width:'5%', 0238 list:true, 0239 edit: false, 0240 display:function(data){ 0241 var html = '<a class="tooltipuser" data-tooltip-content="#tooltip_content" data-user="'+data.record.member_id+'" >'+data.record.username+'</a>'; 0242 return html; 0243 } 0244 }, 0245 project_created_at: { 0246 title: 'Created at', 0247 type: 'date', 0248 width:'5%', 0249 edit: false, 0250 list: true 0251 }, 0252 project_changed_at: { 0253 title: 'Changed at', 0254 type: 'date', 0255 width:'5%', 0256 edit: false, 0257 list: true 0258 }, 0259 created_at: { 0260 title: 'Excluded at', 0261 type: 'date', 0262 width:'5%', 0263 edit: false, 0264 list: true 0265 }, 0266 exclude_member_name: { 0267 title: 'Excluded by', 0268 width:'5%', 0269 edit: false, 0270 list: true, 0271 display:function(data){ 0272 var html = '<a class="tooltipuser" data-tooltip-content="#tooltip_content" data-user="'+data.record.created_by+'" >'+data.record.exclude_member_name+'</a>'; 0273 return html; 0274 } 0275 }, 0276 note: { 0277 title: 'Reason', 0278 type: 'textarea', 0279 list: true 0280 /*, 0281 display:function(data){ 0282 return data.record.note+'<a class="imghistory" data-projectid="'+data.record.project_id+'"> <i class="fa fa-history"></i></a>'; 0283 } 0284 */ 0285 }, 0286 value: { 0287 title: '', 0288 type:'checkbox', 0289 list: false, 0290 values: {'1': 'ghns excluded', '0': 'insert to ghns'} 0291 } 0292 } 0293 }); 0294 0295 $('body').on("click", 'a.toggle-status', function (event) { 0296 event.preventDefault(); 0297 event.stopImmediatePropagation(); 0298 0299 if (!confirm('This will toggle the active option for this product. Do you wish to proceed?')) { 0300 return; 0301 } 0302 0303 var elementRecord = $(this).data("record"); 0304 0305 jQuery.ajax({ 0306 data: {'project_id': elementRecord}, 0307 url: '/backend/project/togglestatus/', 0308 type: 'post', 0309 error: function () { 0310 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>"); 0311 return false; 0312 }, 0313 success: function (results) { 0314 $('#TableContainer').jtable('reload'); 0315 return false; 0316 } 0317 }); 0318 0319 return false; 0320 }); 0321 0322 $('body').on("click", 'a.member-info', function (event) { 0323 event.preventDefault(); 0324 event.stopImmediatePropagation(); 0325 0326 var elementRecord = $(this).data("record"); 0327 0328 jQuery.ajax({ 0329 data: {'member_id': elementRecord}, 0330 url: '/backend/user/memberinfo/', 0331 type: 'post', 0332 error: function () { 0333 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>"); 0334 return false; 0335 }, 0336 success: function (results) { 0337 $('#dialog-form').html(results.ViewRecord).dialog('open'); 0338 return false; 0339 } 0340 }); 0341 0342 return false; 0343 }); 0344 0345 0346 //Re-load records when user click 'load records' button. 0347 $('#LoadRecordsButton').click(function (e) { 0348 e.preventDefault(); 0349 $('#TableContainer').jtable('load', { 0350 filter_member_id: $('#filter_member_id').val(), 0351 },function(){ 0352 //TooltipUser.setup("tooltipuser","right"); 0353 }); 0354 }); 0355 0356 //Re-load records when user click 'remove filter' button. 0357 $('#RemoveFilterButton').click(function (e) { 0358 e.preventDefault(); 0359 $("#filter_member_id option[value='']").attr('selected', true) 0360 $('#TableContainer').jtable('load', { 0361 filter_member_id: null, 0362 }); 0363 }); 0364 0365 // $('#TableContainer').jtable('load', { 0366 // filter_member_id: $('#filter_member_id').val() 0367 // }); 0368 0369 $('#TableContainer').jtable('load', { 0370 filter_member_id: $('#filter_member_id').val() 0371 },function(){ 0372 //TooltipUser.setup("tooltipuser","right"); 0373 }); 0374 0375 $('body').on("click", 'a.imghistory', function (event) { 0376 event.preventDefault(); 0377 event.stopImmediatePropagation(); 0378 console.log(this); 0379 console.log($(this).attr('data-projectid')); 0380 0381 return false; 0382 }); 0383 0384 0385 0386 0387 0388 }); 0389 </script> 0390 0391