$eval->set_course_code(api_get_course_id()); $eval->set_category_id($values['hid_category_id']); $parent_cat = Category::load($values['hid_category_id']); $global_weight = $cat[0]->get_weight(); //$values['weight'] = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight(); $values['weight'] = $values['weight_mask']; $eval->set_weight($values['weight']); $eval->set_max($values['max']); if (empty($values['visible'])) { $visible = 0; } else { $visible = 1; } $eval->set_visible($visible); $eval->add(); if ($eval->get_course_code() == null) { if ($values['adduser'] == 1) { //Disabling code when course code is null see issue #2705 //header('Location: gradebook_add_user.php?selecteval=' . $eval->get_id()); exit; } else { header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id() . '&' . api_get_cidreq()); exit; } } else { $val_addresult = isset($values['addresult']) ? $values['addresult'] : null; if ($val_addresult == 1) { header('Location: gradebook_add_result.php?selecteval=' . $eval->get_id() . '&' . api_get_cidreq()); exit; } else { header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id() . '&' . api_get_cidreq());
/** * Builds the course or platform admin icons to edit an evaluation * @param Evaluation $eval evaluation object * @param int $selectcat id of selected category */ public static function build_edit_icons_eval($eval, $selectcat) { $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); $is_locked = $eval->is_locked(); $eval->get_course_code(); $cat = new Category(); $message_eval = $cat->show_message_resource_delete($eval->get_course_code()); if ($message_eval === false && api_is_allowed_to_edit(null, true)) { $visibility_icon = $eval->is_visible() == 0 ? 'invisible' : 'visible'; $visibility_command = $eval->is_visible() == 0 ? 'set_visible' : 'set_invisible'; if ($is_locked && !api_is_platform_admin()) { $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); } else { $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; } $modify_icons .= ' <a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session=' . $eval->getSessionId() . ' ">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; if (api_is_allowed_to_edit(null, true)) { $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '">' . Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; } if ($is_locked && !api_is_platform_admin()) { $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); } else { $modify_icons .= ' <a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; } return $modify_icons; } }
/** * Builds the course or platform admin icons to edit an evaluation * @param Evaluation $eval evaluation object * @param int $selectcat id of selected category */ public static function build_edit_icons_eval($eval, $selectcat) { $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); $is_locked = $eval->is_locked(); $eval->get_course_code(); $cat = new Category(); $message_eval = $cat->show_message_resource_delete($eval->get_course_code()); if ($message_eval === false && api_is_allowed_to_edit(null, true)) { $visibility_icon = $eval->is_visible() == 0 ? 'invisible' : 'visible'; $visibility_command = $eval->is_visible() == 0 ? 'set_visible' : 'set_invisible'; if ($is_locked && !api_is_platform_admin()) { $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); } else { $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; } $modify_icons .= ' <a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session=' . $eval->getSessionId() . ' ">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; if (api_is_allowed_to_edit(null, true)) { $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '">' . Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; } /* if ($locked_status == 0){ $modify_icons .= " <a href=\"javascript:if (confirm('".addslashes(get_lang('AreYouSureToLockedTheEvaluation'))."')) { location.href='".api_get_self().'?lockedeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq='.$eval->get_course_code()."'; }\">".Display::return_icon('unlock.png',get_lang('LockEvaluation'), array(), ICON_SIZE_SMALL)."</a>"; } else { if (api_is_platform_admin()){ $modify_icons .= " <a href=\"javascript:if (confirm('".addslashes(get_lang('AreYouSureToUnLockedTheEvaluation'))."')) { location.href='".api_get_self().'?lockedeval=' . $eval->get_id() . '&typelocked=&selectcat=' . $selectcat . ' &cidReq='.$eval->get_course_code()."';\">".Display::return_icon('lock.png',get_lang('UnLockEvaluation'), array(), ICON_SIZE_SMALL)."</a>"; } else { $modify_icons .= ' <img src="../img/locked_na.png" border="0" title="' . get_lang('TheEvaluationIsLocked') . '" alt="" />'; } } */ if ($is_locked && !api_is_platform_admin()) { $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); } else { $modify_icons .= ' <a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; } return $modify_icons; } }