{combine_script id='jquery.dataTables' load='footer' path='themes/default/js/plugins/jquery.dataTables.js'} {html_style} .sorting { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_both.png) no-repeat center right; cursor:pointer; } .sorting_asc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc.png) no-repeat center right; } .sorting_desc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc.png) no-repeat center right; } .sorting, .sorting_asc, .sorting_desc { padding: 3px 18px 3px 10px; } .sorting_asc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc_disabled.png) no-repeat center right; } .sorting_desc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc_disabled.png) no-repeat center right; } .dtBar { text-align:left; padding: 10px 0 10px 20px } .dtBar DIV{ display:inline; padding-right: 5px; } .dataTables_paginate A { padding-left: 3px; } .ui-tooltip { padding: 8px; position: absolute; z-index: 9999; max-width: {3*$TN_WIDTH}px; -webkit-box-shadow: 0 0 5px #aaa; box-shadow: 0 0 5px #aaa; } body .ui-tooltip { border-width: 2px; } {/html_style} {footer_script} $(document).ready(function() { $('h1').append("{$NB_ELEMENTS}") }); {/footer_script}
{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} {combine_script id='jquery.confirm' load='footer' require='jquery' path='themes/default/js/plugins/jquery-confirm.min.js'} {combine_css path="themes/default/js/plugins/jquery-confirm.min.css"} {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} {combine_script id='jquery.geoip' load='async' path='admin/themes/default/js/jquery.geoip.js'} {footer_script} jQuery('#rateTable').dataTable({ dom : '<"dtBar"filp>rt<"dtBar"ilp>', pageLength: 100, lengthMenu: [ [25, 50, 100, 500, -1], [25, 50, 100, 500, "All"]], sorting: [], //[[1,'desc']], autoWidth: false, sortClasses: false, columnDefs: [ { aTargets: ["dtc_user"], sType: "string", sClass: null }, { aTargets: ["dtc_date"], asSorting: ["desc","asc"], sType: "string", sClass: null }, { aTargets: ["dtc_stat"], asSorting: ["desc","asc"], bSearchable: false, sType: "numeric", sClass: null }, { aTargets: ["dtc_rate"], asSorting: ["desc","asc"], bSearchable: false, sType: "html", sClass: null }, { aTargets: ["dtc_del"], bSortable: false, bSearchable: false, sType: "string", sClass: null } ] }); var oTable = jQuery('#rateTable').DataTable(); function uidFromCell(cell){ var tr = cell; while ( tr.nodeName != "TR") tr = tr.parentNode; return $(tr).data("usr"); } {* -----DELETE----- *} $(document).ready( function(){ $("#rateTable").on( "click", ".del", function(e) { e.preventDefault(); const title_msg = '{'Are you sure you want to delete the ratings of the user "%s"?'|@translate|@escape:'javascript'}'; const confirm_msg = '{"Yes, I am sure"|@translate}'; const cancel_msg = "{"No, I have changed my mind"|@translate}"; let usr_name = $(this).closest("tr").find(".usr").html(); $.confirm({ title: title_msg.replace("%s", usr_name), buttons: { confirm: { text: confirm_msg, btnClass: 'btn-red', action: function () { var cell = e.target.parentNode, tr = cell; while ( tr.nodeName != "TR") tr = tr.parentNode; tr = jQuery(tr).fadeTo(1000, 0.4); var data=uidFromCell(cell); (new PwgWS('{$ROOT_URL|@escape:javascript}')).callService( 'pwg.rates.delete', { user_id:data.uid, anonymous_id:data.aid}, { method: 'POST', onFailure: function(num, text) { tr.stop(); tr.fadeTo(0,1); alert(num + " " + text); }, onSuccess: function(result){ if (result) oTable.row(tr[0]).remove().draw(); else alert(result); } } ); } }, cancel: { text: cancel_msg } }, ...jConfirm_confirm_options }); }); }); {/footer_script}| {'Username'|@translate} | {'Last'|@translate} | {'Number of rates'|@translate} | {'Average rate'|@translate} | {'Variation'|@translate} | {'Consensus deviation'|@translate|@replace:' ':' '} |
{'Consensus deviation'|@translate|@replace:' ':' '} {$CONSENSUS_TOP_NUMBER} |
{foreach from=$available_rates item=rate}
{$rate} | {/foreach}|
|---|---|---|---|---|---|---|---|---|
| {$user} | {$rating.last_date} | {$rating.count} | {$rating.avg|@number_format:2} | {$rating.cv|@number_format:3} | {$rating.cd|@number_format:3} | {if !empty($rating.cdtop)}{$rating.cdtop|@number_format:3}{/if} | {foreach from=$rating.rates item=rates key=rate}{if !empty($rates)}
{capture assign=rate_over}{foreach $rates as $rate_arr}{if $rate_arr@index>29}{break}{/if} |
{/foreach}