コード例 #1
0
ファイル: getAssignment.php プロジェクト: anandvc/LegionTools
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
include '_db.php';
include '../../Overview/turk/turk_functions.php';
include "../../amtKeys.php";
include "../../isSandbox.php";
$SANDBOX = false;
// $data = turk_easyHitToAssn('3NZ1E5QA6Z154BHKXXFZI5J21CWB5U‏');
// print_r($data);
print_r(turk_easyApprove('3KB8R4ZV1E756S4Y5W3SAL5CCJNGBK'));
コード例 #2
0
ファイル: reviewHits.php プロジェクト: anandvc/LegionTools
            			}
            		break;*/
        /*case 'approveAll':
        			$hits = turk_easyGetReviewable();
        			foreach($hits as $hit){
        				turk_easyApprove($hit);
        				echo("<p>Just Approved HIT: ".$hit."</p>");
        			}
        		break;*/
        case 'bonus':
            $mt = turk_easyBonus($_REQUEST['worker_id'], $_REQUEST['assignment_id'], $_REQUEST['bonus'], $_REQUEST['reason']);
            //turk_debug($mt);
            break;
        case 'bonusAndApprove':
            $mt = turk_easyBonus($_REQUEST['worker_id'], $_REQUEST['assignment_id'], $_REQUEST['bonus'], $_REQUEST['reason']);
            turk_easyApprove($_REQUEST['assignment_id']);
            //turk_debug($mt);
            break;
    }
}
?>
		<form method='post'>
			<input type='submit' name='action' value='disposeAll' />
		</form>
		
		<form method='post'>
			<input type='submit' name='action' value='approveAndDisposeAll' />
		</form>

		<table>
		<?php 
コード例 #3
0
ファイル: processHIT.php プロジェクト: anandvc/LegionTools
include "../../amtKeys.php";
include "../../isSandbox.php";
try {
    $dbh = getDatabaseHandle();
} 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 {
コード例 #4
0
    // 		if(in_array($hit["hit_Id"], $hitsFromTurk)){
    // 			array_push($resultHitIds, $hit["hit_Id"]);
    // 		}
    // 	}
    // }
    foreach ($hitsFromTurk as $hitId) {
        // print_r(turk_easyHitToAssn($hitId));
        $hitInfo = turk_easyHitToAssn($hitId);
        print_r($hitInfo);
        if ($hitInfo["TotalNumResults"] == 1) {
            turk_easyApprove($hitInfo["Assignment"]["AssignmentId"]);
        } else {
            if ($hitInfo["TotalNumResults"] > 1) {
                for ($i = 0; $i < $hitInfo["TotalNumResults"]; $i++) {
                    $assignmentId = $hitInfo["Assignment"][$i]["AssignmentId"];
                    turk_easyApprove($assignmentId);
                }
            }
        }
        echo "</br></br>";
        $mt = turk_easyDispose($hitId);
        print_r($mt);
        sleep(0.1);
        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));
        }
    }
    // echo json_encode($resultHits);
}