<commit_before><table width="100%"  border="0" cellpadding="8" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
        <td>
<?php echo $html->script('ricobase');
echo $html->script('ricoeffects');
echo $html->script('ricoanimation');
echo $html->script('ricopanelcontainer');
echo $html->script('ricoaccordion');
echo empty($params['data']['Evaluation']['id']) ? null : $html->hidden('Evaluation/id'); ?>
<!-- Render Event Info table -->
    <?php
    $params = array('controller'=>'evaluations', 'event'=>$event);
    echo $this->element('evaluations/view_event_info', $params);
    ?>

<table width="95%" border="0" align="center" cellpadding="4" cellspacing="2">
    <tr>
        <td colspan="3"><?php echo $html->image('icons/instructions.gif',array('alt'=>'instructions'));?>
            <b> Summary:</b>(
            <a href="<?php echo $this->webroot.$this->theme?>evaluations/viewEvaluationResults/<?php echo $event['Event']['id']?>/<?php echo $event['group_id']?>/Basic"><?php __('Basic')?></a>
            |
            <a href="<?php echo $this->webroot.$this->theme?>evaluations/viewEvaluationResults/<?php echo $event['Event']['id']?>/<?php echo $event['group_id']?>/Detail" ><?php __('Detail')?></a>
            )
            <BR>
            <BR> <?php echo '<font size = "1" face = "arial" color = "red" >*Numerics in red denotes late submission penalty.</font>';?>
        </td>
    </tr>
    <?php $i = 0;
    if (!$allMembersCompleted) {?>
    <tr>
        <td colspan="3">
            <font color="red"><?php __('These people have yet to submit their evaluations:')?> <br>
            <?php foreach($inCompletedMembers as $row): $user = $row['User']; ?>
                &nbsp;-&nbsp; <?php echo $user['first_name'].' '.$user['last_name'];
                if($row['Role']['role_id']==4) //label roles for clarity
                    echo ' (TA)';
                else
                    echo ' (student)';?><br>
            <?php endforeach; ?>
            </font>
        </td>
    </tr>
    <?php } ?>
</table>

<div id='rubric_result'>

<?php
$rowspan = count($groupMembers) + 3;
$numerical_index = 1;  //use numbers instead of words; get users to refer to the legend
$color = array("", "#FF3366","#ff66ff","#66ccff","#66ff66","#ff3333","#00ccff","#ffff33");
$membersAry = array();  //used to format result
$groupAve = 0;
$groupAverage = array_fill(1, $rubric['Rubric']['criteria'], 0);
?>
<!-- summary table -->
<?php echo '<table width="100%" border="0" align="center" cellpadding="4" cellspacing="2" class="outer-table">'; ?>
    <tr>
        <td width="25%" valign="middle" class="result-header-td"><?php __('Student Name:')?></td>
		<?php echo '<td width="75%" rowspan="'.$rowspan.'" class="inner-table-cell"><div class="scrollbar"><table class="inner-table"><tr class="result-header-td">';
            for ($i = 1; $i <= $rubric['Rubric']["criteria"]; $i++) {
                echo "<td width='200' class='inner-table-cell'>";
                echo '<strong><font color="' . $color[ $i % sizeof($color) ] . '">' . $numerical_index . ". </font></strong>";
                echo "(" .$rubricCriteria[$i-1]['multiplier']. ")";
                echo "</td>";
                $numerical_index++;
            }

        echo '<td width="250" class="inner-table-cell">'.__("Total:( /", true).number_format($rubric['Rubric']['total_marks'], 2).')' ?></td>
    </tr>
    <?php
    $aveScoreSum = 0;
    //This section will display the evaluatees' name
    //as display the average scores their peers gave them
    //for various criteria
    $questionSum = array_fill(0, $rubric['Rubric']['criteria'], 0);
    if ($groupMembersNoTutors) {
        foreach ($groupMembersNoTutors as $member) {
            $membersAry[$member['User']['id']] = $member;
            echo '<tr class="result-cell">';
            if (isset($memberScoreSummary[$member['User']['id']]['received_ave_score'])) {
                $avgScore = $memberScoreSummary[$member['User']['id']]['received_ave_score'];
                $penalty = number_format(($penalties[$member['User']['id']] / 100) * $avgScore, 2);
                $penalty_percent = $penalties[$member['User']['id']] / 100;
                $questionIndex = 0; 
                foreach ($scoreRecords[$member['User']['id']]['rubric_criteria_ave'] AS $criteriaAveIndex => $criteriaAveGrade) {
                    $scaledQuestionGrade = $criteriaAveGrade * (1 - $penalty_percent);
                    $groupAverage[$criteriaAveIndex] += $scaledQuestionGrade;
                    $deduction = $criteriaAveGrade * $penalty_percent;
                    $questionSum[$questionIndex] += $scaledQuestionGrade;
                    $questionIndex++;
                    $penalty > 0 ? $stringAddOn = ' - '."<font color=\"red\">".number_format($deduction, 2).
                        "</font> = ".number_format($scaledQuestionGrade, 2).'</td>' :
                        $stringAddOn = '';
                    echo '<td class="result-cell">' . number_format($criteriaAveGrade, 2).$stringAddOn;
                }
            } else {
                for ($i = 1; $i <= $rubric['Rubric']["criteria"]; $i++) {
                    echo "<td class='result-cell'>-</td>";
                }
            }
		// for calculating average percentage per question (ratio)
        $ratio = 0;
        for ($i = 0; $i < $rubric['Rubric']["criteria"]; $i++) {
            if (!empty($scoreRecords[$member['User']['id']]['rubric_criteria_ave']))
                $ratio += $scoreRecords[$member['User']['id']]['rubric_criteria_ave'][$i+1] / $rubricCriteria[$i]['multiplier'];
        }
        $avgPerQues[$member['User']['id']] = $ratio /  $rubric['Rubric']['criteria'];
        //totals section
        echo '<td class="total-cell">';
        if (isset($memberScoreSummary[$member['User']['id']]['received_ave_score'])) {
            $finalAvgScore = $avgScore - $penalty;
            $penalty > 0 ? $stringAddOn = ' - '."<font color=\"red\">".$penalty."</font> = ".number_format($finalAvgScore, 2) :
                $stringAddOn = '';
            $aveScoreSum += $finalAvgScore; 
            echo number_format($avgScore, 2).$stringAddOn;
            $receviedAvePercent = $finalAvgScore / $rubric['Rubric']['total_marks'] * 100;
            echo ' ('.number_format($receviedAvePercent) . '%)';
            $membersAry[$member['User']['id']]['received_ave_score'] = $memberScoreSummary[$member['User']['id']]['received_ave_score'];
            $membersAry[$member['User']['id']]['received_ave_score_%'] = $receviedAvePercent;
        } else {
            echo '-';
        }
        echo "</td>";
        echo "</tr>";
        //end scores
        }

        //averages
        echo '<tr class="tablesummary">';
        $questionIndex = 0;      
        foreach ($groupAverage AS $sum) {
            echo '<td class="total-cell">' . number_format($sum / count($groupMembers), 2). "</td>";
        }
        echo "<td><b>";
        $groupAve = number_format($aveScoreSum / count($groupMembers), 2);
        echo $groupAve;
        echo ' ('.number_format($groupAve / $rubric['Rubric']['total_marks'] * 100) . '%)';
      
        echo "</b></td>";
    }	?>
    </tr></table></td></tr>
    <?php
    if ($groupMembersNoTutors) {
        foreach ($groupMembersNoTutors as $member) {
            echo '<tr class="tablecell2" cellpadding="4" cellspacing="2" >';
            $membersAry[$member['User']['id']]['member'] = $member;
            echo '<td width="25%" class="group-members">' . $member['User']['first_name'] . ' ' . $member['User']['last_name'] . '</td></tr>' . "\n";
        }
    }
    echo '<tr class="tablesummary"><td class="group-members"><b>';
    echo __("Group Average: ", true);
    echo "</b></td></tr>";
    ?>

    <tr class="tablecell2" align="center"><td colspan="<?php echo $rubric['Rubric']["criteria"] +2; ?>">
        <form name="evalForm" id="evalForm" method="POST" action="<?php echo $html->url('markEventReviewed') ?>">
            <input type="hidden" name="event_id" value="<?php echo $event['Event']['id']?>" />
            <input type="hidden" name="group_id" value="<?php echo $event['group_id']?>" />
            <input type="hidden" name="course_id" value="<?php echo $courseId; ?>" />
            <input type="hidden" name="group_event_id" value="<?php echo $event['group_event_id']?>" />
            <input type="hidden" name="display_format" value="Detail" />

      	<?php
            if ($event['group_event_marked'] == "reviewed") {
                echo "<input class=\"reviewed\" type=\"submit\" name=\"mark_not_reviewed\" value=\" ".__('Mark Peer Evaluations as Not Reviewed', true)."\" />";
            } else {
                echo "<input class=\"reviewed\" type=\"submit\" name=\"mark_reviewed\" value=\" ".__('Mark Peer Evaluations as Reviewed', true)."\" />";
            }
        ?>
        </form></td>
    </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="2">
    <tr>
        <td align="center">
<div id="accordion"><commit_msg>fixed the unaligned table for rubric results<commit_after><table width="100%"  border="0" cellpadding="8" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
        <td>
<?php echo $html->script('ricobase');
echo $html->script('ricoeffects');
echo $html->script('ricoanimation');
echo $html->script('ricopanelcontainer');
echo $html->script('ricoaccordion');
echo empty($params['data']['Evaluation']['id']) ? null : $html->hidden('Evaluation/id'); ?>
<!-- Render Event Info table -->
    <?php
    $params = array('controller'=>'evaluations', 'event'=>$event);
    echo $this->element('evaluations/view_event_info', $params);
    ?>

<table width="95%" border="0" align="center" cellpadding="4" cellspacing="2">
    <tr>
        <td colspan="3"><?php echo $html->image('icons/instructions.gif',array('alt'=>'instructions'));?>
            <b> Summary:</b>(
            <a href="<?php echo $this->webroot.$this->theme?>evaluations/viewEvaluationResults/<?php echo $event['Event']['id']?>/<?php echo $event['group_id']?>/Basic"><?php __('Basic')?></a>
            |
            <a href="<?php echo $this->webroot.$this->theme?>evaluations/viewEvaluationResults/<?php echo $event['Event']['id']?>/<?php echo $event['group_id']?>/Detail" ><?php __('Detail')?></a>
            )
            <BR>
            <BR> <?php echo '<font size = "1" face = "arial" color = "red" >*Numerics in red denotes late submission penalty.</font>';?>
        </td>
    </tr>
    <?php $i = 0;
    if (!$allMembersCompleted) {?>
    <tr>
        <td colspan="3">
            <font color="red"><?php __('These people have yet to submit their evaluations:')?> <br>
            <?php foreach($inCompletedMembers as $row): $user = $row['User']; ?>
                &nbsp;-&nbsp; <?php echo $user['first_name'].' '.$user['last_name'];
                if($row['Role']['role_id']==4) //label roles for clarity
                    echo ' (TA)';
                else
                    echo ' (student)';?><br>
            <?php endforeach; ?>
            </font>
        </td>
    </tr>
    <?php } ?>
</table>

<div id='rubric_result'>

<?php
$rowspan = count($groupMembers) + 3;
$numerical_index = 1;  //use numbers instead of words; get users to refer to the legend
$color = array("", "#FF3366","#ff66ff","#66ccff","#66ff66","#ff3333","#00ccff","#ffff33");
$membersAry = array();  //used to format result
$groupAve = 0;
$groupAverage = array_fill(1, $rubric['Rubric']['criteria'], 0);
?>
<!-- summary table -->
<?php echo '<table width="100%" border="0" align="center" cellpadding="4" cellspacing="2" class="outer-table">'; ?>
    <tr>
        <td width="25%" valign="middle" class="result-header-td"><?php __('Student Name:')?></td>
		<?php echo '<td width="75%" rowspan="'.$rowspan.'" class="inner-table-cell"><div class="scrollbar"><table class="inner-table"><tr class="result-header-td">';
            for ($i = 1; $i <= $rubric['Rubric']["criteria"]; $i++) {
                echo "<td width='200' class='inner-table-cell'>";
                echo '<strong><font color="' . $color[ $i % sizeof($color) ] . '">' . $numerical_index . ". </font></strong>";
                echo "(" .$rubricCriteria[$i-1]['multiplier']. ")";
                echo "</td>";
                $numerical_index++;
            }

        echo '<td width="250" class="inner-table-cell">'.__("Total:( /", true).number_format($rubric['Rubric']['total_marks'], 2).')' ?></td>
    </tr>
    <?php
    $aveScoreSum = 0;
    //This section will display the evaluatees' name
    //as display the average scores their peers gave them
    //for various criteria
    $questionSum = array_fill(0, $rubric['Rubric']['criteria'], 0);
    if ($groupMembersNoTutors) {
        foreach ($groupMembersNoTutors as $member) {
            $membersAry[$member['User']['id']] = $member;
            echo '<tr class="result-cell">';
            if (isset($memberScoreSummary[$member['User']['id']]['received_ave_score'])) {
                $avgScore = $memberScoreSummary[$member['User']['id']]['received_ave_score'];
                $penalty = number_format(($penalties[$member['User']['id']] / 100) * $avgScore, 2);
                $penalty_percent = $penalties[$member['User']['id']] / 100;
                $questionIndex = 0; 
                foreach ($scoreRecords[$member['User']['id']]['rubric_criteria_ave'] AS $criteriaAveIndex => $criteriaAveGrade) {
                    $scaledQuestionGrade = $criteriaAveGrade * (1 - $penalty_percent);
                    $groupAverage[$criteriaAveIndex] += $scaledQuestionGrade;
                    $deduction = $criteriaAveGrade * $penalty_percent;
                    $questionSum[$questionIndex] += $scaledQuestionGrade;
                    $questionIndex++;
                    $penalty > 0 ? $stringAddOn = ' - '."<font color=\"red\">".number_format($deduction, 2).
                        "</font> = ".number_format($scaledQuestionGrade, 2).'</td>' :
                        $stringAddOn = '';
                    echo '<td class="result-cell">' . number_format($criteriaAveGrade, 2).$stringAddOn;
                }
            } else {
                for ($i = 1; $i <= $rubric['Rubric']["criteria"]; $i++) {
                    echo "<td class='result-cell'>-</td>";
                }
            }
		// for calculating average percentage per question (ratio)
        $ratio = 0;
        for ($i = 0; $i < $rubric['Rubric']["criteria"]; $i++) {
            if (!empty($scoreRecords[$member['User']['id']]['rubric_criteria_ave']))
                $ratio += $scoreRecords[$member['User']['id']]['rubric_criteria_ave'][$i+1] / $rubricCriteria[$i]['multiplier'];
        }
        $avgPerQues[$member['User']['id']] = $ratio /  $rubric['Rubric']['criteria'];
        //totals section
        echo '<td class="total-cell">';
        if (isset($memberScoreSummary[$member['User']['id']]['received_ave_score'])) {
            $finalAvgScore = $avgScore - $penalty;
            $penalty > 0 ? $stringAddOn = ' - '."<font color=\"red\">".$penalty."</font> = ".number_format($finalAvgScore, 2) :
                $stringAddOn = '';
            $aveScoreSum += $finalAvgScore; 
            echo number_format($avgScore, 2).$stringAddOn;
            $receviedAvePercent = $finalAvgScore / $rubric['Rubric']['total_marks'] * 100;
            echo ' ('.number_format($receviedAvePercent) . '%)';
            $membersAry[$member['User']['id']]['received_ave_score'] = $memberScoreSummary[$member['User']['id']]['received_ave_score'];
            $membersAry[$member['User']['id']]['received_ave_score_%'] = $receviedAvePercent;
        } else {
            echo '-';
        }
        echo "</td>";
        echo "</tr>";
        //end scores
        }

        //averages
        echo '<tr class="tablesummary">';
        $questionIndex = 0;      
        foreach ($groupAverage AS $sum) {
            echo '<td class="total-cell">' . number_format($sum / count($groupMembers), 2). "</td>";
        }
        echo "<td><b>";
        $groupAve = number_format($aveScoreSum / count($groupMembers), 2);
        echo $groupAve;
        echo ' ('.number_format($groupAve / $rubric['Rubric']['total_marks'] * 100) . '%)';
      
        echo "</b></td>";
    }	?>
    </tr></table></td></tr>
    <?php
    if ($groupMembersNoTutors) {
        foreach ($groupMembersNoTutors as $member) {
            echo '<tr class="tablecell2" cellpadding="4" cellspacing="2" >';
            $membersAry[$member['User']['id']]['member'] = $member;
            echo '<td width="25%" class="group-members">' . $member['User']['first_name'] . ' ' . $member['User']['last_name'] . '</td></tr>' . "\n";
        }
    }
    echo '<tr class="tablesummary"><td class="group-members"><b>';
    echo __("Group Average: ", true);
    echo "</b></td></tr><tr><td> </td></tr>";
    ?>
    <tr><td>  </td></tr>
    <tr class="tablecell2" align="center"><td colspan="<?php echo $rubric['Rubric']["criteria"] +2; ?>">
        <form name="evalForm" id="evalForm" method="POST" action="<?php echo $html->url('markEventReviewed') ?>">
            <input type="hidden" name="event_id" value="<?php echo $event['Event']['id']?>" />
            <input type="hidden" name="group_id" value="<?php echo $event['group_id']?>" />
            <input type="hidden" name="course_id" value="<?php echo $courseId; ?>" />
            <input type="hidden" name="group_event_id" value="<?php echo $event['group_event_id']?>" />
            <input type="hidden" name="display_format" value="Detail" />

      	<?php
            if ($event['group_event_marked'] == "reviewed") {
                echo "<input class=\"reviewed\" type=\"submit\" name=\"mark_not_reviewed\" value=\" ".__('Mark Peer Evaluations as Not Reviewed', true)."\" />";
            } else {
                echo "<input class=\"reviewed\" type=\"submit\" name=\"mark_reviewed\" value=\" ".__('Mark Peer Evaluations as Reviewed', true)."\" />";
            }
        ?>
        </form></td>
    </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="2">
    <tr>
        <td align="center">
<div id="accordion">
{'fraction_non_alphanumeric': 0.2123182018510357, 'fraction_numerical': 0.011568973115910092, 'mean_word_length': 2.7490706319702602, 'pattern_counts': {'":': 0, '<': 275, '<?xml version=': 0, '>': 307, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5628018', 'n_tokens_mistral': 5787, 'n_tokens_neox': 5465, 'n_words': 1074}