Пример #1
0
function postMaxMenteesPerMentor($newMax)
{
    global $_USER;
    if (!userIsAdmin($_USER['uid'])) {
        $GLOBALS["_PLATFORM"]->sandboxHeader("HTTP/1.1 401 Unauthorized");
        return;
    }
    if (!ctype_digit($newMax)) {
        $GLOBALS["_PLATFORM"]->sandboxHeader("HTTP/1.1 404 Bad Request");
        return;
    }
    $minMaxMenteesPerMentor = calcMinMaxMenteesPerMentor();
    if ($newMax < $minMaxMenteesPerMentor) {
        $GLOBALS["_PLATFORM"]->sandboxHeader("HTTP/1.1 409 Conflict");
        print "The new maximum must be greater than {$minMaxMenteesPerMentor}.";
        return;
    }
    print setMaxMenteesPerMentor($newMax);
}
Пример #2
0
function updateMaxMenteesPerMentor()
{
    include_once "mentor_maximum.php";
    $currentValue = retrieveMaxMenteesPerMentor();
    $minValue = calcMinMaxMenteesPerMentor();
    if ($currentValue < $minValue) {
        setMaxMenteesPerMentor($minValue);
    }
}