Example #1
0
function update_characteristic($id, $level, $shortName, $description, $programSpecifier)
{
    $updates = array();
    if (!is_null($level)) {
        if ($level == "") {
            page_fail_on_field(BAD_REQUEST, 'level', 'must specify organizational level');
        }
        $updates['level'] = "s:{$level}";
    }
    if (!is_null($shortName)) {
        if ($shortName == "") {
            page_fail_on_field(BAD_REQUEST, 'short_name', 'must specify short name');
        }
        $updates['short_name'] = "s:{$shortName}";
    }
    if (!is_null($description)) {
        if ($description == "") {
            page_fail_on_field(BAD_REQUEST, 'description', 'must specify description');
        }
        $updates['description'] = "s:{$description}";
    }
    if (!is_null($programSpecifier) && $programSpecifier != "") {
        $updates['program_specifier'] = "s:{$programSpecifier}";
    }
    generic_update('abet_characteristic', $id, $updates);
    echo "{\"success\":true}";
}
Example #2
0
function update_course($id, $title, $courseNumber, $coordinator, $instructor, $description, $textbook, $creditHours)
{
    $updates = array();
    if (!is_null($title)) {
        if ($title == "") {
            page_fail_on_field(BAD_REQUEST, 'title', 'must specify title');
        }
        $updates['title'] = "s:{$title}";
    }
    if (!is_null($courseNumber)) {
        if ($courseNumber == "") {
            page_fail_on_field(BAD_REQUEST, 'course_number', 'must specify course number');
        }
        $updates['course_number'] = "s:{$courseNumber}";
    }
    if (!is_null($coordinator)) {
        if ($coordinator == "") {
            page_fail_on_field(BAD_REQUEST, 'coordinator', 'must specify coordinator');
        }
        $updates['fk_coordinator'] = "i:{$coordinator}";
    }
    if (!is_null($instructor)) {
        if ($instructor == "") {
            page_fail_on_field(BAD_REQUEST, 'instructor', 'must specify instructor');
        }
        $updates['instructor'] = "s:{$instructor}";
    }
    if (!is_null($description)) {
        if ($description == "") {
            page_fail_on_field(BAD_REQUEST, 'description', 'must specify description');
        }
        $updates['description'] = "s:{$description}";
    }
    if (!is_null($textbook)) {
        if ($textbook == "") {
            page_fail_on_field(BAD_REQUEST, 'textbook', 'must specify textbook');
        }
        $updates['textbook'] = "s:{$textbook}";
    }
    if (!is_null($creditHours)) {
        if ($creditHours == "") {
            page_fail_on_field(BAD_REQUEST, 'creditHours', 'must specify credit hours');
        }
        $updates['credit_hours'] = "s:{$creditHours}";
    }
    generic_update('course', $id, $updates);
    echo "{\"success\":true}";
}
Example #3
0
function update_rubric($obj)
{
    global $RUBRIC;
    global $RUBRIC_DESCRIPTION;
    global $RUBRIC_RESULTS;
    global $COMPETENCY;
    if (!array_key_exists('id', $obj)) {
        page_fail(BAD_REQUEST);
    }
    $id = $obj['id'];
    // verify access to object
    if (!abet_is_admin_authenticated() && !check_assessment_access($_SESSION[id], $id, 'assessment_worksheet')) {
        page_fail(UNAUTHORIZED);
    }
    list($rId, $rdId, $rrId) = grab_rubric_ids($id);
    // update 'rubric'
    $updates = array();
    if (array_key_exists('name', $obj)) {
        $updates['name'] = "s:{$obj['name']}";
    }
    if (array_key_exists('threshold', $obj)) {
        $updates['threshold'] = "d:{$obj['threshold']}";
    }
    if (array_key_exists('threshold_desc', $obj)) {
        $updates['threshold_desc'] = "s:{$obj['threshold_desc']}";
    }
    generic_update('rubric', $rId, $updates);
    // update 'rubric_description'
    $updates = array();
    if (array_key_exists('outstanding_desc', $obj)) {
        $updates['outstanding_desc'] = "s:{$obj['outstanding_desc']}";
    }
    if (array_key_exists('expected_desc', $obj)) {
        $updates['expected_desc'] = "s:{$obj['expected_desc']}";
    }
    if (array_key_exists('marginal_desc', $obj)) {
        $updates['marginal_desc'] = "s:{$obj['marginal_desc']}";
    }
    if (array_key_exists('unacceptable_desc', $obj)) {
        $updates['unacceptable_desc'] = "s:{$obj['unacceptable_desc']}";
    }
    generic_update('rubric_description', $rdId, $updates);
    // update 'rubric_results'
    $updates = array();
    if (array_key_exists('total_students', $obj)) {
        $updates['total_students'] = "i:{$obj['total_students']}";
    }
    generic_update('rubric_results', $rrId, $updates);
    // update each competency
    if (array_key_exists('competency', $obj)) {
        foreach ($obj['competency'] as $comp) {
            if (!array_key_exists('id', $comp)) {
                continue;
            }
            $id = $comp['id'];
            // check access to competency result entity (silently fail if denied)
            if (!abet_is_admin_authenticated() && !check_competency_result_access($_SESSION['id'], $id, $found)) {
                continue;
            }
            $updates = array();
            if (array_key_exists('description', $comp)) {
                $updates['competency_desc'] = "s:{$comp['description']}";
            }
            if (array_key_exists('outstanding_tally', $comp)) {
                $updates['outstanding_tally'] = "s:{$comp['outstanding_tally']}";
            }
            if (array_key_exists('expected_tally', $comp)) {
                $updates['expected_tally'] = "s:{$comp['expected_tally']}";
            }
            if (array_key_exists('marginal_tally', $comp)) {
                $updates['marginal_tally'] = "s:{$comp['marginal_tally']}";
            }
            if (array_key_exists('unacceptable_tally', $comp)) {
                $updates['unacceptable_tally'] = "s:{$comp['unacceptable_tally']}";
            }
            if (array_key_exists('pass_fail_type', $comp)) {
                $updates['pass_fail_type'] = $comp['pass_fail_type'] ? "l:1" : "l:0";
            }
            if (array_key_exists('comment', $comp)) {
                $updates['comment'] = "s:{$comp['comment']}";
            }
            generic_update('competency_results', $id, $updates);
        }
    }
    return "{\"success\":true}";
}