Exemple #1
0
} catch (PDOException $e) {
    echo $e->getMessage();
}
if ($dbh) {
    $id = $_REQUEST['id'];
    //either AssignmentId or HITId
    $operation = $_REQUEST['operation'];
    // echo $operation;
    // $assignmentInfo = turk_easyHitToAssn($hitId);
    // $assignmentId = $assignmentInfo["Assignment"]["AssignmentId"];
    if ($operation == "Approve") {
        $mt = turk_easyApprove($id);
        //AssignmentId
    } else {
        if ($operation == "Reject") {
            $mt = turk_easyReject($id);
            //AssignmentId
        } else {
            if ($operation == "Bonus") {
                if (isset($_REQUEST['reason'])) {
                    $reason = $_REQUEST['reason'];
                } else {
                    $reason = "Did extra work.";
                }
                $mt = turk_easyBonus($_REQUEST['workerId'], $id, $_REQUEST['amount'], $reason);
                // print_r($mt);
            } else {
                if ($operation == "Dispose") {
                    $mt = turk_easyDispose($id);
                    //HITId
                    // Remove from DB
Exemple #2
0
        foreach ($tempArray as $hitId) {
            if (!in_array($hitId->HITId, $hitIDs)) {
                if (($key = array_search($hitId, $tempArray)) !== false) {
                    unset($tempArray[$key]);
                }
            }
        }
    }
}
if (isset($_REQUEST['action'])) {
    switch ($_REQUEST['action']) {
        case 'Approve':
            turk_easyApprove($_REQUEST['assignment_id']);
            break;
        case 'Reject':
            turk_easyReject($_REQUEST['assignment_id']);
            break;
        case 'dispose':
            //echo "disposing hit: ".$_REQUEST['hit_id'];
            turk_easyDispose($_REQUEST['hit_id']);
            break;
        case 'approveAndDisposeAll':
            $hits = turk50_getAllReviewableHits();
            checkHITs($hits);
            if ($hits) {
                foreach ($hits as $hit) {
                    $data = turk_easyHitToAssn($hit->HITId);
                    $assign = $data['Assignment']['AssignmentId'];
                    turk_easyApprove($assign);
                    echo "<p>Just Approved and Disposed HIT: " . $hit->HITId . "</p>";
                    turk_easyDispose($hit->HITId);