/**
  * @param $item
  * @param array $attributes
  * @return string
  */
 private function build_type_column($item, $attributes = array())
 {
     return GradebookUtils::build_type_icon_tag($item->get_icon_name(), $attributes);
 }
}
$sql = 'SELECT * FROM ' . $table_evaluation . ' WHERE category_id = ' . $my_selectcat;
$result = Database::query($sql);
$evaluations = Database::store_result($result);
foreach ($evaluations as $evaluationRow) {
    $item_weight = $evaluationRow['weight'];
    //$item_weight = $masked_total*$item_weight/$original_total;
    //update only if value changed
    if (isset($_POST['evaluation'][$evaluationRow['id']])) {
        //$new_weight = trim($_POST['evaluation'][$evaluationRow['id']]*$original_total/$masked_total);
        $new_weight = trim($_POST['evaluation'][$evaluationRow['id']]);
        GradebookUtils::updateEvaluationWeight($evaluationRow['id'], $new_weight);
        $item_weight = $new_weight;
    }
    $output .= '<tr>
                <td>' . GradebookUtils::build_type_icon_tag('evalnotempty') . '</td>
                <td>' . $evaluationRow['name'] . ' ' . Display::label(get_lang('Evaluation')) . '</td>';
    $output .= '<td>
                    <input type="hidden" name="eval_' . $evaluationRow['id'] . '" value="' . $evaluationRow['name'] . '" />
                    <input type="text" size="10" name="evaluation[' . $evaluationRow['id'] . ']" value="' . $item_weight . '"/>
                </td></tr>';
}
$my_api_cidreq = api_get_cidreq();
if ($my_api_cidreq == '') {
    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
}
$currentUrl = api_get_self() . '?' . api_get_cidreq() . '&selectcat=' . $my_selectcat;
$form = new FormValidator('auto_weight', 'post', $currentUrl);
$form->addHeader(get_lang('AutoWeight'));
$form->addLabel(null, get_lang('AutoWeightExplanation'));
$form->addButtonUpdate(get_lang('AutoWeight'));
 /**
  * @param $item
  * @return string
  */
 private function build_type_column($item)
 {
     return GradebookUtils::build_type_icon_tag($item->get_icon_name());
 }