Beispiel #1
0
function expireHit($hitId)
{
    global $dbh;
    turk_easyExpireHit($hitId);
    sleep(0.25);
    //Give the HIT a moment to expire
    $mt = turk_easyDispose($hitId);
    sleep(0.25);
    //Give the HIT a moment to dispose
}
Beispiel #2
0
    }
    $hitsFromTurk = array();
    foreach ($reviewableHits as $hit) {
        array_push($hitsFromTurk, $hit->HITId);
    }
    if (is_array($hitsFromTurk)) {
        foreach ($hitsForTask as $hit) {
            if (in_array($hit["hit_Id"], $hitsFromTurk)) {
                array_push($resultHitIds, $hit["hit_Id"]);
            }
        }
    }
    foreach ($resultHitIds as $hitId) {
        // print_r(turk_easyHitToAssn($hitId));
        // echo "</br></br>";
        $hitInfo = turk_easyHitToAssn($hitId);
        if ($hitInfo["TotalNumResults"] <= 0) {
            $mt = turk_easyDispose($hitId);
            // sleep(.25);
            if ($mt->FinalData["Request"]["IsValid"] == "True") {
                $sql = "DELETE FROM hits WHERE hit_Id = :hit_Id";
                $sth = $dbh->prepare($sql);
                $sth->execute(array(':hit_Id' => $hitId));
            }
        } else {
            array_push($resultHits, $hitInfo);
        }
    }
    echo json_encode($resultHits);
} else {
}
Beispiel #3
0
 } 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
                 echo $mt->FinalData['Request']['IsValid'];
                 if ($mt->FinalData['Request']['IsValid']) {
                     echo "delete from db";
                     $sql = "DELETE FROM hits WHERE hit_Id = :hit_Id";
                     $sth = $dbh->prepare($sql);
                     $sth->execute(array(':hit_Id' => $id));
                 }
             }
         }
     }
 }
 if ($mt->FinalData['Request']['IsValid'] == "True") {
     echo "True";
Beispiel #4
0
            }
            break;
        case 'expireAll':
            $msg = 'All asssignable hits expired and disposed of.';
            $array = turk50_searchAllHits();
            if (isset($hitTitle) && isset($num)) {
                foreach ($array as $hit) {
                    if ($hit->Title != $hitTitle) {
                        unset($array[$num]);
                    }
                }
            }
            foreach ($array as $hit) {
                if ($hit->HITStatus == 'Assignable' && (isset($hitTitle) && $hit->Title == $hitTitle || !isset($hitTitle))) {
                    turk_easyExpireHit($hit->HITId);
                    turk_easyDispose($hit->HITId);
                }
            }
            break;
        default:
            break;
    }
    //die('action performed.');
}
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
	<title> Overview - What was that?</title>
	<!-- 
<script type="text/javascript" src="scripts/jquery-1.6.1"></script>
Beispiel #5
0
function expireHit($hitId)
{
    global $dbh, $debug, $numAssignableHits, $SANDBOX;
    turk_easyExpireHit($hitId);
    sleep(0.25);
    //Give the HIT a moment to expire
    $mt = turk_easyDispose($hitId);
    sleep(0.25);
    //Give the HIT a moment to dispose
    return $mt;
}