コード例 #1
0
ファイル: casestatus.php プロジェクト: ddrmoscow/queXS
/**
 * Generate the case status report
 *
 * @param mixed  $questionnaire_id The quesitonnaire, if specified
 * @param string $sample_id        The sample, if speified
 * @param mixed  $outcome_id           THe outcome id, if specified
 * 
 * @return false if empty otherwise true if table drawn
 * @author Adam Zammit <*****@*****.**>
 * @since  2012-10-02
 */
function case_status_report($questionnaire_id = false, $sample_id = false, $outcome_id = false)
{
    global $db;
    $q = "";
    if ($questionnaire_id !== false) {
        $q = "AND c.questionnaire_id = {$questionnaire_id}";
    }
    $s = "";
    if ($sample_id !== false) {
        $s = "AND s.import_id = '{$sample_id}'";
    }
    $o = "";
    if ($outcome_id !== false) {
        $o = "AND c.current_outcome_id = {$outcome_id}";
    }
    $sql = "SELECT \tCONCAT('<a href=\\'supervisor.php?case_id=', c.case_id, '\\'>', c.case_id, '</a>') as case_id,\r\n\t\t\to.description as outcomes,\r\n\t\t\tsi.description as samples, s.Time_zone_name as timezone, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'" . TIME_FORMAT . "') as time, (SELECT COUNT(*) FROM `call` WHERE `call`.case_id = c.case_id) as nrcalls, (SELECT COUNT(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) as nrattempts, \t\r\n\t\t\tCASE WHEN ca.end IS NULL THEN '" . TQ_("Available") . "'\r\n\t\t\t\tWHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Available") . "'\r\n\t\t\t\tELSE CONCAT(ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60),'&emsp;" . TQ_("minutes") . "')\r\n\t\t\tEND AS availableinmin,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('')\r\n\t\t\tELSE CONCAT('<span class=\\'text-info\\'>', oq.firstName,' ',oq.lastName,'</span>')\r\n\t\t\tEND AS assignedoperator,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('')\r\n\t\t\tELSE CONCAT(' &emsp; ', cq.sortorder ,'&emsp;')\r\n\t\t\tEND AS ordr,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('<span data-toggle=\\'tooltip\\' title=\\'" . TQ_("Not assigned, select to assign") . "\\'><input  type=\\'checkbox\\' name=\\'c', c.case_id, '\\' value=\\'', c.case_id, '\\' /></span>')\r\n\t\t\tELSE CONCAT('<a href=\"?questionnaire_id={$questionnaire_id}&amp;sample_import_id={$sample_id}&amp;unassign=', cq.case_queue_id, '\" data-toggle=\\'tooltip\\' title=\\'" . TQ_("Click to unassign") . "\\'><i class=\\'fa fa-trash-o fa-lg text-danger\\'></i></a>')\r\n\t\t\tEND AS flag\t\r\n\t\tFROM `case` as c\r\n\t\tJOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1)\r\n\t\tJOIN outcome as o ON (o.outcome_id = c.current_outcome_id AND o.outcome_type_id = 1)\r\n\t\tJOIN sample as s ON (s.sample_id = c.sample_id {$s})\r\n\t\tJOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1)\r\n\t\tJOIN questionnaire_sample as qs ON (qs.questionnaire_id = {$questionnaire_id} AND qs.sample_import_id = s.import_id)\r\n\t\tLEFT JOIN `call` as ca ON (ca.call_id = c.last_call_id)\r\n\t\tLEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_id)\r\n\t\tLEFT JOIN case_queue as cq ON (cq.case_id = c.case_id)\r\n\t\tLEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id)\r\n\t\tLEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id  = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)\r\n\t\tLEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id  and c.questionnaire_id = qsqr.questionnaire_id)\r\n\t\tWHERE c.current_operator_id IS NULL {$q} {$o}\r\n\t\tAND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )\r\n\t\tAND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)\r\n\t\tGROUP BY c.case_id ORDER BY c.case_id ASC";
    print "<form method=\"post\" action=\"?questionnaire_id={$questionnaire_id}&sample_import_id={$sample_id}\">";
    $rs2 = $db->GetAll($sql);
    translate_array($rs2, array("outcomes"));
    $datacol = array('case_id', 'samples', 'timezone', 'time', 'nrattempts', 'nrcalls', 'outcomes', 'availableinmin', 'assignedoperator', 'ordr', 'flag');
    $headers = array(T_("Case id"), T_("Sample"), T_("Timezone"), T_("Time NOW"), T_("Call attempts"), T_("Calls"), T_("Outcome"), T_("Available in"), T_("Assigned to"), T_("Order"), "<i class='fa fa-check-square-o fa-lg'></i>");
    if (isset($_GET['sample_import_id'])) {
        unset($datacol[1]);
        unset($headers[1]);
    }
    xhtml_table($rs2, $datacol, $headers, "tclass", false, false, "bs-table");
    $sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected\r\n\t\tFROM operator\r\n\t\tWHERE enabled = 1";
    $rs3 = $db->GetAll($sql);
    print "<h4 class='col-sm-offset-5 pull-left text-right control-label'>" . T_("Assign selected cases to") . "&ensp;" . T_("operator") . "&ensp;:&emsp;</h4> ";
    display_chooser($rs3, "operator_id", "operator_id", true, false, false, true, false, true, "pull-left");
    print "&emsp;<button class='btn btn-default' type='submit' data-toggle='tooltip' title='" . T_("Assign cases to operator queue") . "'><i class='fa fa-link fa-lg text-primary'></i>&emsp;" . T_("Assign") . "</button>";
    print "</form></br>";
    return true;
}
コード例 #2
0
ファイル: callhistory.php プロジェクト: ddrmoscow/queXS
     header("Pragma: no-cache");
     // HTTP/1.0
     echo T_("Date") . "," . T_("Start time") . "," . T_("End time") . "," . T_("Case ID") . "," . T_("Questionnaire") . "," . T_("Sample") . "," . T_("Phone number") . "," . T_("Operator") . "," . T_("Outcome") . "," . T_("Case notes") . "," . T_("Respondent") . "\n";
     while ($r = $rs->FetchRow()) {
         translate_array($r, array("descr"));
         echo $r['start_date'] . "," . $r['start_time'] . "," . $r['end'] . "," . $r['case_id'] . "," . $r['qd'] . "," . $r['spl'] . "," . $r['cpi'] . "," . $r['opname'] . "," . $r['descr'] . "," . $r['casenotes'] . "," . $r['firstName'] . "\n";
     }
     exit;
 } else {
     xhtml_head(T_("Call History List"), true, $css, $js_head);
     echo "<div class='form-group col-sm-2'><a href='' onclick='history.back();return false;' class='btn btn-default'><i class='fa fa-chevron-left fa-lg text-primary'></i>&emsp;" . T_("Go back") . "</a></div>";
     $rs = $rs->GetArray();
     if (count($rs) == 0) {
         print "<div class='alert alert-info col-sm-6'><h3>" . T_("NO Call history records for Your query") . "</h3></div>";
     } else {
         translate_array($rs, array("descr"));
         $datacol = array("start_date", "start_time", "end", "case_id", "qd", "spl", "cpi", "opname", "descr", "casenotes", "firstName");
         $headers = array(T_("Date"), T_("Start time"), T_("End time"), T_("Case ID"), T_("Questionnaire"), T_("Sample"), T_("Phone number"), T_("Operator"), T_("Outcome"), T_("Case notes"), T_("Respondent"));
         if (isset($_GET['questionnaire_id'])) {
             $sql = "SELECT description FROM `questionnaire` WHERE `questionnaire_id` = {$qid} ";
             $dq = $db->GetOne($sql);
             print "<h3><small>" . T_("Questionnaire") . "&emsp;ID: {$qid}</small>&emsp;" . $dq . "</h3>";
             unset($datacol[4]);
             unset($headers[4]);
         }
         if (isset($_GET['sample_import_id'])) {
             $sql = "SELECT description FROM `sample_import` WHERE `sample_import_id` = {$sid} ";
             $ds = $db->GetOne($sql);
             print "<h3><small>" . T_("Sample") . "&emsp;ID: {$sid}</small>&emsp;" . $ds . "</h3>";
             unset($datacol[5]);
             unset($headers[5]);
コード例 #3
0
ファイル: shifttemplate.php プロジェクト: ddrmoscow/queXS
}
/**
 * Display warning if timezone data not installed
 *
 */
//print "<h1>" . T_("Set default shift times") . "</h1>";
print "<div class='well'><t>" . T_("Enter standard shift start and end times for each day of the week in local time") . "</t></div>";
/**
 * Begin displaying currently loaded shifts
 */
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT('{$year}',' ','{$woy}',' ',day_of_week -1),'%x %v %w'), '%W') AS dt,day_of_week,start,end\r\n\tFROM shift_template";
$shifts = $db->GetAll($sql);
translate_array($shifts, array("dt"));
$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT({$year},' ',{$woy},' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected \r\n\tFROM day_of_week";
$daysofweek = $db->GetAll($sql);
translate_array($daysofweek, array("description"));
?>
	<div class="panel-body col-sm-4"><form method="post" action="" class="form-horizontal">
	<table class="table-hover table-condensed " id="shifts"><thead class="text-center highlight">
<?php 
print "<tr ><th >" . T_("Day") . "</th><th  >" . T_("Start") . "</th><th >" . T_("End") . "</th></tr></thead><tbody>";
$count = 0;
foreach ($shifts as $shift) {
    print "<tr id='row-{$count}'><td>";
    // class='row_to_clone' /* these are not the rows to clone...*/
    display_chooser($daysofweek, "day[{$count}]", false, true, false, false, false, array("description", $shift['dt']));
    print "</td>\r\n\t\t<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"start[{$count}]\" type=\"text\" value=\"{$shift['start']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>\r\n\t\t<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"end[{$count}]\" type=\"text\" value=\"{$shift['end']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td></tr>";
    $count++;
}
print "<tr  class='row_to_clone' id='row-{$count}'><td>";
display_chooser($daysofweek, "day[{$count}]", false, true, false, false, false, false);
コード例 #4
0
ファイル: importkeywordcode.php プロジェクト: ddrmoscow/queXC
            p(T_("Failed to import. Could not determine corresponding code for:"), "h1");
            print "<pre>";
            print_r($outcome);
            print "</pre>";
        }
    } else {
        p(T_("Failed to import codes") . " - " . T_("Error uploading file"), "h1");
    }
}
p(T_("The CSV file must have 2 fields: code,keywords"), "p");
p(T_("No fields may be blank"), "p");
p(T_("Do not include a header line as this will be imported as a code/keyword pair"), "p");
//Select a code group to export data from
$sql = "SELECT code_group_id as value,description, ''  AS selected\r\n\tFROM code_group";
$rs2 = $db->GetAll($sql);
translate_array($rs2, array("description"));
print "</div>";
?>
<form enctype="multipart/form-data" action="" method="post">
<p><input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /></p>
<p><?php 
echo T_("Choose the CSV code keywords file to upload:");
?>
<input name="datafile" type="file" /></p>
<p><?php 
echo T_("Description for this code keywords file:");
?>
<input name="description" type="text" /></p>
<p><?php 
echo T_("What coding scheme does this list apply to?");
display_chooser($rs2, 'code_group_id', 'code_group_id', false, false, false, false);
コード例 #5
0
ファイル: addshift.php プロジェクト: ddrmoscow/queXS
    }
    print "</h4>";
    print "<h4>" . T_("Select week") . ":&emsp;";
    for ($i = 1; $i <= 53; $i++) {
        if ($i == $woy) {
            print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>{$i}</b></span>";
        } else {
            print "<a href=\"?woy={$i}&amp;year={$year}&amp;questionnaire_id={$questionnaire_id}\"> {$i} </a> ";
        }
    }
    print "</h4>";
    $sql = "SELECT shift_id, dt, dta,start,end\r\n\t\tFROM (\r\n\t\t\t(\r\n\t\t\tSELECT shift_id, DATE_FORMAT( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , '%W %d %m %Y' ) AS dt,\r\n\t\t\t\tDATE( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS dta,\r\n\t\t\t\tTIME( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS start,\r\n\t\t\t\tTIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end\r\n\t\t\tFROM shift AS s, operator AS o\r\n\t\t\tWHERE WEEK( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , 3 ) = '{$woy}'\r\n\t\t\t\tAND YEAR( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) = '{$year}'\r\n\t\t\t\tAND o.operator_id = '{$operator_id}'\r\n\t\t\t\tAND s.questionnaire_id = '{$questionnaire_id}'\r\n\t\t\t) \r\n\t\tUNION (\r\n\t\t\tSELECT NULL AS shift_id,\r\n\t\t\t\tDATE_FORMAT( STR_TO_DATE( CONCAT( '{$year}', ' ', '{$woy}', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W %d %m %Y' ) AS dt,\r\n\t\t       \t\tSTR_TO_DATE( CONCAT( '{$year}', ' ', '{$woy}', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta,\r\n\t\t\t\tstart,end\r\n\t\t\tFROM shift_template\r\n\t\t\t) \r\n\t\t) AS sb\r\n\t\tGROUP BY dta,start,end";
    $shifts = $db->GetAll($sql);
    $sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT({$year}, ' ',{$woy},' ',day_of_week - 1),'%x %v %w'), '%W %d %m %Y') as dt,\r\n\t\t       DATE_FORMAT(STR_TO_DATE(CONCAT({$year}, ' ',{$woy},' ',day_of_week - 1),'%x %v %w'), '%W') as dtd,\r\n\t\t       DATE_FORMAT(STR_TO_DATE(CONCAT({$year}, ' ',{$woy},' ',day_of_week - 1),'%x %v %w'), '%d %m %Y') as dto,\r\n\t\t       day_of_week - 1 as value\r\n\t\tFROM day_of_week \r\n\t\tGROUP BY value";
    $daysofweek = $db->GetAll($sql);
    translate_array($daysofweek, array("dtd"));
    foreach ($daysofweek as $key => $val) {
        $daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto'];
    }
    ?>
		<form method="post" action="" class="panel-body">
		<table class="table-bordered table-condensed table-hover">
	<?php 
    print "<thead><tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th>&ensp;<th>" . T_("End") . "</th><th>" . T_("Use shift?") . "</th></tr></thead>";
    $count = 1;
    foreach ($shifts as $shift) {
        $checked = "";
        $shift_id = "";
        $prefix = "";
        if (!empty($shift['shift_id'])) {
            $checked = "checked=\"checked\"";
コード例 #6
0
ファイル: progress.php プロジェクト: ddrmoscow/queXC
    $work_id = intval($_GET['del']);
    $db->StartTrans();
    //Delete all work that is dependend on this, including this:
    delete_work($work_id);
    $db->CompleteTrans();
}
xhtml_head(T_("Work remaining"), true, array("../css/table.css"), array("../js/display.js"));
$data_id = 0;
if (isset($_GET['data_id'])) {
    $data_id = intval($_GET['data_id']);
}
//Select a data file
$sql = "SELECT data_id as value,description, CASE WHEN data_id = '{$data_id}' THEN 'selected=\\'selected\\'' ELSE '' END AS selected\r\n\tFROM data";
print "<div>" . T_("Select data file: ");
display_chooser($db->GetAll($sql), 'data_id', 'data_id');
print "</div>";
//List work to do for this data_id
$sql = "SELECT count(*) as count, d.description as datad, p.description as processd, c.name, o.description as odes, CONCAT('<a href=\\'?del=',w.work_id,'\\'>" . T_("Delete") . "</a>') as dele\r\n\tFROM `work` AS w\r\n\tLEFT JOIN work_parent AS wp ON ( wp.work_id = w.work_id )\r\n\tJOIN `process` AS p ON ( p.process_id = w.process_id )\r\n\tJOIN `column` AS c ON ( c.column_id = w.column_id )\r\n\tJOIN `data` AS d ON ( d.data_id = c.data_id)\r\n\tJOIN cell AS ce ON ( ce.column_id = w.column_id )\r\n\tLEFT JOIN work_unit AS wu2 ON ( wu2.cell_id = ce.cell_id AND wu2.work_id = wp.parent_work_id AND wu2.completed IS NOT NULL )\r\n\tLEFT JOIN work_unit AS wu ON ( wu.cell_id = ce.cell_id AND wu.process_id = w.process_id AND w.work_id = wu.work_id )\r\n\tLEFT JOIN code_group AS cg ON ( cg.code_group_id = p.code_group_id )\r\n\tLEFT JOIN operator AS o ON (w.operator_id = o.operator_id)\r\n\tWHERE wu.cell_id IS NULL\r\n\tAND (wp.work_id IS NULL OR wu2.cell_id IS NOT NULL)";
if ($data_id != 0) {
    $sql .= " AND c.data_id = '{$data_id}' ";
}
$sql .= " GROUP BY c.data_id,p.process_id,w.work_id ";
$rs = $db->GetAll($sql);
print "<div>" . T_("Work remaining") . "</div>";
if (empty($rs)) {
    print "<p>" . T_("No work remaining") . " <a href='markcolumns.php?data_id={$data_id}'>" . T_("Create work") . "</a></p>";
} else {
    translate_array($rs, array("processd"));
    xhtml_table($rs, array('count', 'name', 'datad', 'processd', 'odes', 'dele'), array(T_("Rows to do"), T_("Column"), T_("Data file"), T_("Process to apply"), T_("For specific operator?"), T_("Delete work")));
}
xhtml_foot();
コード例 #7
0
ファイル: rs_project_intro.php プロジェクト: ddrmoscow/queXS
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_project_intro\r\n\tFROM questionnaire\r\n\tWHERE questionnaire_id = '{$questionnaire_id}'";
$r = $db->GetRow($sql);
if (!empty($r['rs_project_intro'])) {
    print "<div class='rstext well rs'>" . template_replace($r['rs_project_intro'], $operator_id, $case_id) . "</div>";
}
print "<div class=' '>\r\n\t\t<div class='col-lg-2'><p><a class='btn btn-default' href=\"rs_intro.php\" >" . T_("Go Back") . "</a></p></div>";
if ($questionnaire_id) {
    //filter displayed outcomes
    $outcomes = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q WHERE q.questionnaire_id = {$questionnaire_id}");
    //
    $outcomes = explode(",", $outcomes);
    $des = $db->GetAll("SELECT description FROM outcome WHERE outcome_id IN (8,17,30)");
    translate_array($des, array("description"));
    print "<div class='col-lg-6'>\r\n\t\t\t\t<p><h4 class=''>" . T_("End call with outcome:") . "</h4></p>";
    if (in_array(8, $outcomes)) {
        print "<p><a class='btn btn-primary' ";
        if (ALTERNATE_INTERFACE) {
            print "href=\"javascript:parent.location.href = 'index_interface2.php?outcome=8&amp;endcase=endcase'\">";
        } else {
            print "href=\"javascript:parent.poptastic('call.php?defaultoutcome=29');\">";
        }
        print $des[0]['description'] . "</a></p>";
    }
    if (in_array(17, $outcomes)) {
        print "<p><a class='btn btn-primary' ";
        if (ALTERNATE_INTERFACE) {
            print "href=\"javascript:parent.location.href = 'index_interface2.php?outcome=17&amp;endcase=endcase'\">";
        } else {
コード例 #8
0
            print "<input type='hidden' value='create' id='new' name='new'/>";
        }
        print "<div class='clearfix'></div><br/><br/>\r\n\t\t\t\t<div class='col-lg-2'><a href='?'  class='btn btn-default pull-left'><i class='fa fa-ban fa-lg'></i>&emsp;" . T_("Cancel edit") . "</a></div>";
        print "<div class='col-lg-2'>\r\n\t\t\t\t\t<button type='submit' class='btn btn-primary btn-block'><i class='fa fa-floppy-o fa-lg'></i>&emsp;" . T_("Save changes") . "</button>\r\n\t\t\t\t\t</div>";
        print "<div class='col-lg-2'><a href='' class='btn btn-default pull-right'  toggle='confirmation' data-placement='left' data-href='?delete=delete&amp;appointment_id={$appointment_id}&amp;case_id={$case_id}' ><i class='fa fa-trash fa-lg text-danger'></i>&emsp;" . T_("Delete this appointment") . "</a></div>";
        print "</form>";
    }
} else {
    $operator_id = get_operator_id();
    $subtitle = T_("Appointments");
    xhtml_head(T_("Display Appointments"), true, $css, $js_head, false, 30);
    print "<h3>" . T_("All appointments (with times displayed in your time zone)") . "</h3>";
    $sql = "SELECT q.description, si.description as smpl, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end,CONCAT(r.firstName, ' ', r.lastName) as resp, IFNULL(ou.description,'" . TQ_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, \r\n\tCONCAT('<a href=\\'supervisor.php?case_id=', c.case_id, '\\'>', c.case_id, '</a>') as case_id, \r\n\tCONCAT('&emsp;<a href=\\'\\'><i class=\\'fa fa-trash-o fa-lg text-danger\\' toggle=\\'confirmation\\' data-placement=\\'left\\' data-href=\\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\\'  ></i></a>&emsp;') as link, \r\n\tCONCAT('&emsp;<a href=\\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\\'><i class=\\'fa fa-pencil-square-o fa-lg\\' ></i></a>&emsp;') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho \r\n\tFROM appointment as a \r\n\tJOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc, `sample` as s, sample_import as si) on (c.sample_id = s.sample_id and  a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id =  oo.operator_id and si.sample_import_id = s.import_id) \r\n\tLEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id) \r\n\tLEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id \r\n\tLEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id  = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)\r\n\tLEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id  and c.questionnaire_id = qsqr.questionnaire_id)\r\n\tWHERE q.enabled=1 AND si.enabled=1 AND a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id IN (19,20,21,22)\r\n\tAND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1)\r\n\tAND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)\r\n\tGROUP BY c.case_id ORDER BY a.start ASC";
    $rs = $db->GetAll($sql);
    if (!empty($rs)) {
        translate_array($rs, array("outcome"));
        xhtml_table($rs, array("description", "smpl", "case_id", "start", "end", "edit", "makerName", "witho", "resp", "outcome", "callerName", "link"), array(T_("Questionnaire"), T_("Sample"), T_("Case ID"), T_("Start"), T_("End"), "&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;", T_("Created by"), T_("Appointment with"), T_("Respondent"), T_("Current outcome"), T_("Operator who called"), "&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"), "tclass", false, false, "bs-table");
    } else {
        print "<h4 class='well text-info'>" . T_("No future appointments") . "</h4>";
    }
    print "<h3 style='color:red'>" . T_("Missed appointments (with times displayed in your time zone)") . "</h3>";
    $sql = "SELECT q.description, si.description as smpl, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end, CONCAT(r.firstName, ' ', r.lastName) as resp, \r\n\tCONCAT('<a href=\\'supervisor.php?case_id=', c.case_id, '\\'>', c.case_id, '</a>') as case_id, \r\n\tCONCAT('&emsp;<a href=\\'\\'><i class=\\'fa fa-trash-o fa-lg text-danger\\' toggle=\\'confirmation\\' data-placement=\\'left\\' data-href=\\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\\'  ></i></a>&emsp;') as link, \r\n\tCONCAT('&emsp;<a href=\\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\\'><i class=\\'fa fa-pencil-square-o fa-lg\\' ></i></a>&emsp;') as edit \r\n\tFROM appointment as a \r\n\tJOIN (`case` as c, respondent as r, questionnaire as q, `sample` as s, sample_import as si) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and s.sample_id = c.sample_id and s.import_id= si.sample_import_id) \r\n\tLEFT JOIN (`call` as ca) ON (ca.call_id = a.completed_call_id)\r\n\tLEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id  = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)\r\n\tLEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id  and c.questionnaire_id = qsqr.questionnaire_id)\r\n\tWHERE q.enabled=1 AND si.enabled=1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id IN (19,20,21,22)\r\n\tAND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )\r\n\tAND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)\r\n\tGROUP BY c.case_id\r\n\tORDER BY a.start ASC";
    $rs = $db->GetAll($sql);
    if (!empty($rs)) {
        xhtml_table($rs, array("description", "smpl", "case_id", "start", "end", "edit", "resp", "link"), array(T_("Questionnaire"), T_("Sample"), T_("Case ID"), T_("Start"), T_("End"), "&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;", T_("Respondent"), "&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"), "tclass", false, false, "bs-table");
    } else {
        print "<h4 class='well text-info'>" . T_("No missed appointments") . "</h4>";
    }
}
xhtml_foot($js_foot);
?>
コード例 #9
0
ファイル: workhistory.php プロジェクト: ddrmoscow/queXC
 */
/**
 * Configuration file
 */
include "config.inc.php";
/**
 * XHTML functions
 */
include "functions/functions.xhtml.php";
/**
 * Work functions
 */
include "functions/functions.work.php";
$operator_id = get_operator_id();
if (isset($_GET['redo'])) {
    redo(intval($_GET['redo']));
}
xhtml_head(T_("Work History"), true, array("css/table.css"));
if ($operator_id != false) {
    $sql = "SELECT wu.work_unit_id,(CASE WHEN DATE(wu.completed) = DATE(NOW()) THEN CONCAT('" . T_("Today") . " ',DATE_FORMAT(wu.completed,'%H:%i:%s')) ELSE wu.completed END) as completed,c.name, CONCAT('<a href=\\'?redo=',wu.work_unit_id,'\\'>" . T_("Redo") . "</a>') as redo,\r\n\t\t\t(SELECT CASE WHEN CHAR_LENGTH(TRIM(data)) < " . WORK_HISTORY_STRING_LENGTH . " THEN data ELSE CONCAT(SUBSTR(data,1,(" . (WORK_HISTORY_STRING_LENGTH - 3) . ")),'...') END FROM cell_revision WHERE cell_id = wu.cell_id ORDER BY cell_revision_id DESC LIMIT 1) as data, p.description\r\n\t\tFROM work_unit as wu, work as w, `column` as c,process as p\r\n\t\tWHERE wu.operator_id = '{$operator_id}'\r\n\t\tAND w.work_id = wu.work_id\r\n\t\tAND c.column_id = w.column_id\r\n\t\tAND p.process_id = wu.process_id\r\n\t\tAND completed IS NOT NULL\r\n\t\tORDER BY completed DESC\r\n\t\tLIMIT " . WORK_HISTORY_LIMIT;
    $work = $db->GetAll($sql);
    if (empty($work)) {
        print "<p>" . T_("No work history") . "</p>";
    } else {
        translate_array($work, array("description"));
        xhtml_table($work, array('completed', 'name', 'data', 'description', 'redo'), array(T_("Date"), T_("Column"), T_("Data"), T_("Process"), T_("Redo?")));
    }
} else {
    print "<p>" . T_("No operator") . "</p>";
}
xhtml_foot();
コード例 #10
0
ファイル: createprocess.php プロジェクト: ddrmoscow/queXC
print "<div>" . T_("Select code group: ");
$rs2 = $db->GetAll($sql);
translate_array($rs2, array("description"));
display_chooser($rs2, 'code_group_id', 'code_group_id');
print "</div>";
if ($code_group_id != 0) {
    print "<form action='' method='post'><div><input type='hidden' name='code_group_id' value='{$code_group_id}'/></div>";
    //Parent process (if any)
    $sql = "SELECT process_id as value, description, '' AS selected\r\n\t\tFROM process";
    print "<div>" . T_("Select parent process (if any): ");
    $rs2 = $db->GetAll($sql);
    translate_array($rs2, array("description"));
    display_chooser($rs2, 'process_id', 'process_id', true, false, false);
    print "</div>";
    print "<div><input type='checkbox' name='autolabel' id='autolabel'/><label for='autolabel'>" . T_("Automatically assign a code if the code label exactly matches the data?") . "</label></div>";
    print "<div><input type='checkbox' name='autovalue' id='autovalue'/><label for='autovalue'>" . T_("Automatically assign a code if the code value exactly matches the data?") . "</label></div>";
    print "<div><input type='checkbox' name='autokeyword' id='autokeyword'/><label for='autokeyword'>" . T_("Automatically assign a code if there is a matching code keyword in the database?") . "</label></div>";
    print "<div><input type='checkbox' name='template' id='template'/><label for='template'>" . T_("Use the code group as a template? (Create a new, editable code group for each work unit that this is assigned to)") . "</label></div>";
    print "<div><input type='checkbox' name='exclusive' id='exclusive'/><label for='exclusive'>" . T_("Should this process only be run by operator(s) that have not worked on the prior process (exclusive)?") . "</label></div>";
    print "<div>" . T_("Name for process using this code: ");
    print "<input type='text' name='description'/>";
    print "</div>";
    print "<p><input type='submit' name='submit' value='" . T_("Create new process") . "'/></p></form>";
}
//List existing processes
$sql = "SELECT p.process_id,p.description as pdes,c.description as cdes\r\n\tFROM process as p\r\n\tLEFT JOIN code_group AS c ON (c.code_group_id = p.code_group_id)";
p(T_("Existing processes"), 'h2');
$rs2 = $db->GetAll($sql);
translate_array($rs2, array("pdes", "cdes"));
xhtml_table($rs2, array('process_id', 'pdes', 'cdes'), array(T_("Process ID"), T_("Process"), T_("Code Group")));
xhtml_foot();
コード例 #11
0
ファイル: set_outcomes.php プロジェクト: ddrmoscow/queXS
    $row = array("outcome_id", "description", "select", "type", "delay", "contacted", "tryanother", "tryagain", "eligible", "require_note");
    $hdr = array(T_("Outcome ID"), T_("Description"), T_("Set default") . "&nbsp;?", T_("Outcome type"), T_("Delay, min"), T_("Contacted") . "&nbsp;?", T_("Try another") . "&nbsp;?", T_("Try again") . "&nbsp;?", T_("Eligible") . "&nbsp;?", T_("Require note") . "&nbsp;?");
    if ($_SESSION['user'] === "admin") {
        $row[] = "delete";
        $hdr[] = T_("Delete") . "&nbsp;?";
    }
    $hid = "default";
    $value = "";
    $h = "default";
    $v = "";
    $abtn = T_("Add custom Outcome");
    $sbtn = T_("Update default outcomes");
    $class = "tclass";
}
if (isset($rs) && !empty($rs)) {
    translate_array($rs, array("description", "type"));
    for ($i = 0; $i < count($rs); $i++) {
        foreach ($rs[$i] as $key => $val) {
            if ($key == "type") {
                $rs[$i]['type'] = preg_replace("#\\s*\\(.+#m", '', $val);
                // cut description in bracets for 'outcome_type'
            }
        }
    }
    if (isset($msg_ok)) {
        print "<div class='alert alert-success'>" . $msg_ok . "</div>";
    }
    if (isset($msg_err)) {
        print "<div class='alert alert-danger'>" . $msg_err . "</div>";
    }
    ?>