Exemplo n.º 1
0
    $prs = $db->GetAll($sql);
    foreach ($prs as $pr) {
        $pqid = $pr['qid'];
        $pdes = $pr['description'];
        $sql = "SELECT count(*) as rem\r\n\t\t\tFROM forms\r\n\t\t\tWHERE qid = '{$pqid}'\r\n\t\t\tAND done = 0";
        $remain = $db->GetOne($sql);
        $sql = "SELECT q.description as qu, v.description as ve,f.qid,f.assigned_vid as vid , count( * ) AS c, count( * ) / ( SUM( TIMESTAMPDIFF(\r\n\t\t\tSECOND , f.assigned, f.completed ) ) /3600 ) AS CPH, (\r\n\t\t\t(\r\n\t\t\t\r\n\t\t\tSELECT count( pid )\r\n\t\t\tFROM pages\r\n\t\t\tWHERE qid = f.qid\r\n\t\t\t) * count( * )\r\n\t\t\t) / ( SUM( TIMESTAMPDIFF(\r\n\t\t\tSECOND , f.assigned, f.completed ) ) /3600 ) AS PPH\r\n\t\t\tFROM forms AS f\r\n\t\t\tJOIN questionnaires as q on (f.qid = q.qid)\r\n\t\t\tJOIN verifiers as v on (v.vid = f.assigned_vid)\r\n\t\t\tWHERE f.qid = '{$pqid}'\r\n\t\t\tGROUP BY f.qid, f.assigned_vid\r\n\t\t\tORDER BY CPH DESC";
        $prss = $db->GetAll($sql);
        print "<h3>{$pdes}</h3>";
        xhtml_table($prss, array('ve', 'c', 'CPH', 'PPH'), array(T_("Operator"), T_("Completed Forms"), T_("Completions Per Hour"), T_("Pages Per Hour")), "tclass", array("vid" => $vid));
        print "<p>" . T_("Remain to verify") . ": {$remain}</p>";
    }
    xhtml_foot();
    exit;
}
$qid_desc = get_qid_description($fid);
$qid = $qid_desc['qid'];
$description = $qid_desc['description'];
if (!isset($_SESSION['boxes'])) {
    //nothing yet known about this form
    $sql = "SELECT b.bid as bid, b.tlx as tlx, b.tly as tly, b.brx as brx, b.bry as bry, b.pid as pid, bg.btid as btid, b.bgid as bgid, {$fid} as fid, bg.sortorder as sortorder, fb.filled, c.val as val\r\n\t\tFROM boxes AS b\r\n\t\tJOIN boxgroupstype as bg ON (bg.bgid = b.bgid AND bg.btid > 0 AND bg.btid != 5)\r\n    JOIN pages as p ON (p.pid = b.pid AND p.qid = '{$qid}')\r\n    LEFT JOIN formboxes as fb ON (fb.bid = b.bid AND fb.fid = '{$fid}')\r\n\t\tLEFT JOIN formboxverifychar AS c ON (c.fid = '{$fid}' AND c.vid = 0 AND c.bid = b.bid)\r\n\t\tORDER BY bg.sortorder ASC";
    $sql2 = "SELECT b.bgid,0 as done,b.pid,bg.varname,bg.btid\r\n\t\tFROM boxes as b, boxgroupstype as bg, pages as p\r\n\t\tWHERE p.pid = b.pid\r\n\t\tAND bg.bgid = b.bgid\r\n\t\tAND p.qid = '{$qid}' \r\n\t\tAND bg.btid > 0\r\n\t\tAND bg.btid != 5\r\n\t\tGROUP BY bg.bgid\r\n\t\tORDER BY bg.sortorder ASC";
    $sql3 = "SELECT b.pid,b.bgid,0 as done, fp.width, fp.height, fp.fid\r\n\t\tFROM boxes as b\r\n\t\tJOIN pages as p ON (p.qid = '{$qid}' AND b.pid = p.pid)\r\n\t\tJOIN boxgroupstype as bg ON (bg.bgid = b.bgid)\r\n\t\tLEFT JOIN formpages as fp ON (fp.fid = '{$fid}' AND fp.pid = p.pid)\r\n\t\tGROUP BY b.pid\r\n\t\tORDER BY bg.sortorder ASC";
    $a = $db->GetAssoc($sql);
    if (empty($a)) {
        xhtml_head(T_("Verify: No more work"), true, false, false, "onload='document.form1.assign.focus();'");
        print "<p>" . T_("NO MORE WORK") . "</p>";
        print "<form name=\"form1\" action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\"><input type=\"submit\" name=\"assign\" value=\"" . T_("Check for more work") . "\"/></form>";
        //print "<p><a href=\"" . $_SERVER['PHP_SELF'] . "?assign=assign\">" . T_("Check for more work") . "</a></p>";
        unset($_SESSION['boxgroups']);
        unset($_SESSION['pages']);
Exemplo n.º 2
0
function detect_differences()
{
    global $db;
    $sql = "SELECT fid\n\t\tFROM worklog\n\t\tGROUP BY fid\n\t\tHAVING COUNT(*) = 2";
    $r = $db->GetAll($sql);
    foreach ($r as $f) {
        $fid = $f['fid'];
        print "{$fid}: <br/>";
        $sql = "SELECT vid \n\t\t\tFROM worklog\n\t\t\tWHERE fid = {$fid}";
        $vids = $db->GetAll($sql);
        $vid1 = $vids[0]['vid'];
        $vid2 = $vids[1]['vid'];
        $q = get_qid_description($fid);
        $qid = $q['qid'];
        $sql = "SELECT b.bid AS bid\n\t\t\tFROM boxes AS b\n\t\t\tJOIN boxgroupstype as bg ON (bg.bgid = b.bgid)\n\t\t\tJOIN pages as p ON (p.pid = b.pid)\n\t\t\tLEFT JOIN formboxverifychar AS c2 ON c2.fid = '{$fid}'\n\t\t\tAND c2.vid = '{$vid1}'\n\t\t\tAND c2.bid = b.bid\n\t\t\tLEFT JOIN formboxverifychar AS c ON c.fid = '{$fid}'\n\t\t\tAND c.vid = '{$vid2}'\n\t\t\tAND c.bid = b.bid\n\t\t\tWHERE (bg.btid  =1  or bg.btid = 2)\n\t\t\tAND p.qid = '{$qid}'\n\t\t\tAND c.val != c2.val";
        $diffs = $db->GetAll($sql);
        foreach ($diffs as $diff) {
            print_r($diff);
            print "<br/>";
        }
    }
}