<?
function panel_rating($class_name='report_quiz_personal_rating',$options=[])
{
    include_once(_DIR_EXT.'/quiz/'.$class_name.'.php');

    $filter=[
             'question_count'=>10,
             'question_limit'=>10,
    ];
    if (_sizeof($options['filter'])) $filter=array_merge($filter,$options['filter']);
if ($options['cur_section_id']) $filter['theme_id']=$options['cur_section_id'] ;

//    damp_array($filter,1,-1);

    $filter['question_order']=1;
    $report1 = new $class_name(['filter'=>$filter]);
    $report1->no_view_title=1;
    $report1->view_panel_info=0;

    $filter['question_order']=0;
    $report2 = new $class_name(['filter'=>$filter]);
    $report2->no_view_title=1;
    $report2->view_panel_info=0;

    $report1->view_as_HTML(['template_name'=>'half_view_HTML']);
    $report2->view_as_HTML(['template_name'=>'half_view_HTML']);
    ?>
    <script type="text/javascript">
        $j(document).ready(function() {
            $j('#rating_tables').loadingIndicator();

            $j('.new_window').on('click',function()
            { //  var newWin=window.open($j(this).attr('href'),$j(this).attr('title'),'status=1,dependent=1,width=1920,height=1070,left=1920,top=0, resizable=1, scrollbars=yes') ;
                var newWin=window.open($j(this).attr('href'),$j(this).attr('title'),'status=1,dependent=1,width='+LS_popup_window_width+',height='+LS_popup_window_height+',left=0,top=0, resizable=1, scrollbars=yes') ;
                //var newWin=window.open($j(this).attr('href'),'main_window') ;
                newWin.focus() ;
                return(false) ;
            })  ;

            function evenTables() {
                let fstTable = $j('#rating_tables table').eq(0); // первая таблица
                let secTable = $j('#rating_tables table').eq(1); // вторая таблица
                let source,dest;

                if (fstTable.length>=secTable.length) {
                    source = fstTable;
                    dest = secTable;
                } else {
                    source = secTable;
                    dest = fstTable;
                }
                source.find('tr>td:first-child').each(function(ind, el) {
                    let firstHeight = $j(el).outerHeight(true);
                    let secondHeight = dest.find('tr:nth-child(' + (ind+2) + ')>td:first-child').outerHeight(true);

                    if (firstHeight>=secondHeight) {
                        dest.find('tr:nth-child(' + (ind+2) + ')>td:first-child').outerHeight(firstHeight);
                    } else {
                        $j(el).outerHeight(secondHeight)
                    }
                });
            }
            evenTables();
        });
    </script>
    <?
}
?>
