mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
updated file links for easier Bootstrap, Jquery, Jquery-UI and Font-awesome updates
from */bootstrap-3.3.2/* to */bootstrap/* from /js/jquery-2.1.3.min.js to /include/jquery/jquery.min.js from /jquery-ui/js/jquery-1.4.2.min.js to /jquery/jquery-1.4.2.min.js from /jquery-ui/js/jquery-ui-1.8.2.custom.min.js to /jquery-ui/jquery-ui.min.js from /jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css to /jquery-ui/jquery-ui.min.css switch from /font-awesome-4.3.0/ folder to /font-awesome/ , updated links from */font-awesome-4.3.0/* to */font-awesome/* !!! files with childnap.js require jquery-1.4.2 -> need to check if jquery-2.1.4 will work instead of jquery-1.4.2 !!!
This commit is contained in:
@@ -1,278 +1,278 @@
|
||||
<?php
|
||||
/**
|
||||
* Add and modify shifts by questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include ("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include ("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
/**
|
||||
* Add shifts to the DB based on the shift_template table
|
||||
*/
|
||||
|
||||
|
||||
if (isset($_POST['year'])) $year = bigintval($_POST['year']); else $year = "YEAR(NOW())";
|
||||
if (isset($_POST['woy'])) $woy = bigintval($_POST['woy']); else $woy = "WEEK(NOW(), 3)";
|
||||
if (isset($_POST['qid'])) $questionnaire_id = bigintval($_POST['qid']); else $questionnaire_id = false;
|
||||
if (isset($_GET['year'])) $year = bigintval($_GET['year']);
|
||||
if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']);
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
$y = $db->GetRow("SELECT $year as y");
|
||||
$year = $y['y'];
|
||||
$y = $db->GetRow("SELECT $woy as y");
|
||||
$woy = $y['y'];
|
||||
|
||||
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
if (!$operator_id)
|
||||
{
|
||||
xhtml_head(T_("Add shifts"));
|
||||
print "<p>" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "</p>";
|
||||
xhtml_foot();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
//process
|
||||
//update or delete existing shifts
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (substr($key,0,5) == "start")
|
||||
{
|
||||
$num = bigintval(substr($key,6));
|
||||
if (isset($_POST["use_$num"]))
|
||||
{
|
||||
$sql = "UPDATE shift as s, operator as o
|
||||
SET s.start = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["start_$num"] . "'), o.Time_zone_name, 'UTC'),
|
||||
s.end = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["end_$num"] . "'), o.Time_zone_name, 'UTC')
|
||||
WHERE o.operator_id = '$operator_id'
|
||||
AND shift_id = '$num'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "DELETE FROM shift
|
||||
WHERE shift_id = '$num'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
//insert new shifts
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (substr($key,0,7) == "NEW_use")
|
||||
{
|
||||
if ($val == "on")
|
||||
{
|
||||
$num = bigintval(substr($key,8));
|
||||
$sql = "INSERT INTO shift (shift_id,questionnaire_id,start,end)
|
||||
SELECT NULL,'$questionnaire_id', CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_start_$num"] . "'), Time_zone_name, 'UTC') , CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_end_$num"] . "'), Time_zone_name, 'UTC')
|
||||
FROM operator
|
||||
WHERE operator_id = '$operator_id'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Shift management"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/clockpicker/dist/bootstrap-clockpicker.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/clockpicker/dist/bootstrap-clockpicker.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js"));
|
||||
//"../css/shifts.css",
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM','UTC') as t";
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='warning'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
/**
|
||||
* display years including current selected year
|
||||
* display weeks of year including current selected week of year
|
||||
* find if there are already shifts defined for this week of year / year and display them as selected, else show from template
|
||||
* when submitted, add checked shifts, and delete unchecked shifts if they exist
|
||||
*
|
||||
* @todo Use javascript to add shifts if necessarry outside the template
|
||||
*/
|
||||
|
||||
print "<h3 class='col-sm-4'>" . T_("Add shifts in your Time Zone") . "</h3>";
|
||||
|
||||
|
||||
print "<p class='well col-sm-8'>" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "</p>";
|
||||
|
||||
print "<div class='clearfix form-group'><h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control");
|
||||
print "</div><div class='panel-body'>";
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
print "<h4>" . T_("Select year") . ":  ";
|
||||
for ($i = $year - 1; $i < $year + 4; $i++)
|
||||
{
|
||||
if ($i == $year)
|
||||
print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>";
|
||||
else
|
||||
print "<a href=\"?year=$i&woy=$woy&questionnaire_id=$questionnaire_id\"> $i </a> ";
|
||||
}
|
||||
print "</h4>";
|
||||
|
||||
|
||||
print "<h4>" . T_("Select week") . ": ";
|
||||
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&year=$year&questionnaire_id=$questionnaire_id\"> $i </a> ";
|
||||
}
|
||||
print "</h4>";
|
||||
|
||||
$sql = "SELECT shift_id, dt, dta,start,end
|
||||
FROM (
|
||||
(
|
||||
SELECT shift_id, DATE_FORMAT( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , '%W %d %m %Y' ) AS dt,
|
||||
DATE( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS dta,
|
||||
TIME( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS start,
|
||||
TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end
|
||||
FROM shift AS s, operator AS o
|
||||
WHERE WEEK( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , 3 ) = '$woy'
|
||||
AND YEAR( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) = '$year'
|
||||
AND o.operator_id = '$operator_id'
|
||||
AND s.questionnaire_id = '$questionnaire_id'
|
||||
)
|
||||
UNION (
|
||||
SELECT NULL AS shift_id,
|
||||
DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W %d %m %Y' ) AS dt,
|
||||
STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta,
|
||||
start,end
|
||||
FROM shift_template
|
||||
)
|
||||
) AS sb
|
||||
GROUP 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,
|
||||
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as dtd,
|
||||
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%d %m %Y') as dto,
|
||||
day_of_week - 1 as value
|
||||
FROM day_of_week
|
||||
GROUP 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> <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\""; $shift_id = $shift['shift_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$shift_id = $count;
|
||||
$prefix = "NEW_";
|
||||
}
|
||||
print "<tr><td>";
|
||||
display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt']));
|
||||
print "</td><td><div class=\"input-group clockpicker\"><input readonly size=\"8\" name=\"" . $prefix ."start_$shift_id\" maxlength=\"8\" type=\"time\" value=\"{$shift['start']}\" class=\"form-control \"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td><td><div class=\"input-group clockpicker\"><input readonly name=\"" . $prefix ."end_$shift_id\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\" class=\"form-control\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td><td class=\"text-center\"><input name=\"" . $prefix ."use_$shift_id\" type=\"checkbox\" class=\"form-control fa\" data-toggle=\"toggle\" data-size=\"\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " $checked/></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
<!--<tr><td/><td/><td/><td>Select all</td></tr>-->
|
||||
</table></br>
|
||||
<!--<p><input type="submit" name="addshift" value="Add Shift"/></p>-->
|
||||
<input type="submit" name="submit" value="<?php echo T_("Save changes"); ?>" class="btn btn-primary"/>
|
||||
<input type="hidden" name="year" value="<?php echo $year; ?>"/>
|
||||
<input type="hidden" name="woy" value="<?php echo $woy; ?>"/>
|
||||
<input type="hidden" name="qid" value="<?php echo $questionnaire_id; ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
print "</div>";
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Add and modify shifts by questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include ("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include ("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
/**
|
||||
* Add shifts to the DB based on the shift_template table
|
||||
*/
|
||||
|
||||
|
||||
if (isset($_POST['year'])) $year = bigintval($_POST['year']); else $year = "YEAR(NOW())";
|
||||
if (isset($_POST['woy'])) $woy = bigintval($_POST['woy']); else $woy = "WEEK(NOW(), 3)";
|
||||
if (isset($_POST['qid'])) $questionnaire_id = bigintval($_POST['qid']); else $questionnaire_id = false;
|
||||
if (isset($_GET['year'])) $year = bigintval($_GET['year']);
|
||||
if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']);
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
$y = $db->GetRow("SELECT $year as y");
|
||||
$year = $y['y'];
|
||||
$y = $db->GetRow("SELECT $woy as y");
|
||||
$woy = $y['y'];
|
||||
|
||||
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
if (!$operator_id)
|
||||
{
|
||||
xhtml_head(T_("Add shifts"));
|
||||
print "<p>" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "</p>";
|
||||
xhtml_foot();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
//process
|
||||
//update or delete existing shifts
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (substr($key,0,5) == "start")
|
||||
{
|
||||
$num = bigintval(substr($key,6));
|
||||
if (isset($_POST["use_$num"]))
|
||||
{
|
||||
$sql = "UPDATE shift as s, operator as o
|
||||
SET s.start = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["start_$num"] . "'), o.Time_zone_name, 'UTC'),
|
||||
s.end = CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["dow_$num"]}),'%x %v %w'),' ','" . $_POST["end_$num"] . "'), o.Time_zone_name, 'UTC')
|
||||
WHERE o.operator_id = '$operator_id'
|
||||
AND shift_id = '$num'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "DELETE FROM shift
|
||||
WHERE shift_id = '$num'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
//insert new shifts
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (substr($key,0,7) == "NEW_use")
|
||||
{
|
||||
if ($val == "on")
|
||||
{
|
||||
$num = bigintval(substr($key,8));
|
||||
$sql = "INSERT INTO shift (shift_id,questionnaire_id,start,end)
|
||||
SELECT NULL,'$questionnaire_id', CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_start_$num"] . "'), Time_zone_name, 'UTC') , CONVERT_TZ(CONCAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ', {$_POST["NEW_dow_$num"]}),'%x %v %w'),' ','" . $_POST["NEW_end_$num"] . "'), Time_zone_name, 'UTC')
|
||||
FROM operator
|
||||
WHERE operator_id = '$operator_id'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Shift management"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/clockpicker/dist/bootstrap-clockpicker.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/bootstrap/js/bootstrap.min.js","../include/clockpicker/dist/bootstrap-clockpicker.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js"));
|
||||
//"../css/shifts.css",
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM','UTC') as t";
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='warning'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
/**
|
||||
* display years including current selected year
|
||||
* display weeks of year including current selected week of year
|
||||
* find if there are already shifts defined for this week of year / year and display them as selected, else show from template
|
||||
* when submitted, add checked shifts, and delete unchecked shifts if they exist
|
||||
*
|
||||
* @todo Use javascript to add shifts if necessarry outside the template
|
||||
*/
|
||||
|
||||
print "<h3 class='col-sm-4'>" . T_("Add shifts in your Time Zone") . "</h3>";
|
||||
|
||||
|
||||
print "<p class='well col-sm-8'>" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "</p>";
|
||||
|
||||
print "<div class='clearfix form-group'><h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control");
|
||||
print "</div><div class='panel-body'>";
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
print "<h4>" . T_("Select year") . ":  ";
|
||||
for ($i = $year - 1; $i < $year + 4; $i++)
|
||||
{
|
||||
if ($i == $year)
|
||||
print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>";
|
||||
else
|
||||
print "<a href=\"?year=$i&woy=$woy&questionnaire_id=$questionnaire_id\"> $i </a> ";
|
||||
}
|
||||
print "</h4>";
|
||||
|
||||
|
||||
print "<h4>" . T_("Select week") . ": ";
|
||||
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&year=$year&questionnaire_id=$questionnaire_id\"> $i </a> ";
|
||||
}
|
||||
print "</h4>";
|
||||
|
||||
$sql = "SELECT shift_id, dt, dta,start,end
|
||||
FROM (
|
||||
(
|
||||
SELECT shift_id, DATE_FORMAT( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , '%W %d %m %Y' ) AS dt,
|
||||
DATE( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS dta,
|
||||
TIME( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) AS start,
|
||||
TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end
|
||||
FROM shift AS s, operator AS o
|
||||
WHERE WEEK( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , 3 ) = '$woy'
|
||||
AND YEAR( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) = '$year'
|
||||
AND o.operator_id = '$operator_id'
|
||||
AND s.questionnaire_id = '$questionnaire_id'
|
||||
)
|
||||
UNION (
|
||||
SELECT NULL AS shift_id,
|
||||
DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W %d %m %Y' ) AS dt,
|
||||
STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta,
|
||||
start,end
|
||||
FROM shift_template
|
||||
)
|
||||
) AS sb
|
||||
GROUP 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,
|
||||
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as dtd,
|
||||
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%d %m %Y') as dto,
|
||||
day_of_week - 1 as value
|
||||
FROM day_of_week
|
||||
GROUP 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> <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\""; $shift_id = $shift['shift_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$shift_id = $count;
|
||||
$prefix = "NEW_";
|
||||
}
|
||||
print "<tr><td>";
|
||||
display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt']));
|
||||
print "</td><td><div class=\"input-group clockpicker\"><input readonly size=\"8\" name=\"" . $prefix ."start_$shift_id\" maxlength=\"8\" type=\"time\" value=\"{$shift['start']}\" class=\"form-control \"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td><td><div class=\"input-group clockpicker\"><input readonly name=\"" . $prefix ."end_$shift_id\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$shift['end']}\" class=\"form-control\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td><td class=\"text-center\"><input name=\"" . $prefix ."use_$shift_id\" type=\"checkbox\" class=\"form-control fa\" data-toggle=\"toggle\" data-size=\"\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " $checked/></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
<!--<tr><td/><td/><td/><td>Select all</td></tr>-->
|
||||
</table></br>
|
||||
<!--<p><input type="submit" name="addshift" value="Add Shift"/></p>-->
|
||||
<input type="submit" name="submit" value="<?php echo T_("Save changes"); ?>" class="btn btn-primary"/>
|
||||
<input type="hidden" name="year" value="<?php echo $year; ?>"/>
|
||||
<input type="hidden" name="woy" value="<?php echo $woy; ?>"/>
|
||||
<input type="hidden" name="qid" value="<?php echo $questionnaire_id; ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
print "</div>";
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,282 +1,282 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign sample(s) to a questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
|
||||
"../js/window.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/bootstrap-confirmation.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sid = bigintval($_GET['sample']);
|
||||
$cm = bigintval($_GET['call_max']);
|
||||
$cam = bigintval($_GET['call_attempt_max']);
|
||||
$am = bigintval($_GET['answering_machine_messages']);
|
||||
$selecttype = 0;
|
||||
if (isset($_GET['selecttype'])) $selecttype = 1;
|
||||
$an = 0;
|
||||
if (isset($_GET['allownew'])) $an = 1;
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages,allow_new)
|
||||
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_POST['edit']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
$questionnaire_id = bigintval($_POST['questionnaire_id']);
|
||||
$sid = bigintval($_POST['sample_import_id']);
|
||||
$cm = bigintval($_POST['call_max']);
|
||||
$cam = bigintval($_POST['call_attempt_max']);
|
||||
$am = bigintval($_POST['answering_machine_messages']);
|
||||
$selecttype = 0;
|
||||
if (isset($_POST['selecttype'])) $selecttype = 1;
|
||||
$an = 0;
|
||||
if (isset($_POST['allownew'])) $an = 1;
|
||||
|
||||
$sql = "UPDATE questionnaire_sample
|
||||
SET call_max = '$cm',
|
||||
call_attempt_max = '$cam',
|
||||
random_select = '$selecttype',
|
||||
answering_machine_messages = '$am',
|
||||
allow_new = '$an'
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sid'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
{
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sid = bigintval($_GET['rsid']);
|
||||
|
||||
if (isset($_GET['edit']))
|
||||
{
|
||||
$subtitle = T_("Edit assignment parameters");
|
||||
xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
$sql = "SELECT si.description as description,
|
||||
qr.description as qdescription,
|
||||
q.call_max,
|
||||
q.call_attempt_max,
|
||||
q.random_select,
|
||||
q.answering_machine_messages,
|
||||
q.allow_new
|
||||
FROM questionnaire_sample as q, sample_import as si, questionnaire as qr
|
||||
WHERE q.sample_import_id = si.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'
|
||||
AND si.sample_import_id = '$sid'
|
||||
AND qr.questionnaire_id = q.questionnaire_id";
|
||||
|
||||
$qs = $db->GetRow($sql);
|
||||
|
||||
//print "<h1>" . T_("Edit sample details") . "<h1>";
|
||||
print " <p><a href='?questionnaire_id=$questionnaire_id' class='btn btn-default '><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a></p>
|
||||
<h2 class='col-sm-6'>" . T_("Questionnaire") . ": <span class='text-primary'>" . $qs['qdescription'] . "</span></h2>
|
||||
<h2 class='col-sm-6'>" . T_("Sample") . ": <span class='text-primary'>" . $qs['description'] . "</span></h2>
|
||||
<div class='panel-body form-group'>";
|
||||
|
||||
$allownew = $selected ="";
|
||||
if ($qs['random_select'] == 1)
|
||||
$selected = "checked=\"checked\"";
|
||||
if ($qs['allow_new'] == 1)
|
||||
$allownew = "checked=\"checked\"";
|
||||
?>
|
||||
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post" class="form-horizontal">
|
||||
|
||||
<label for="call_max" class="control-label col-sm-4"><?php echo T_("Max calls");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_max" id="call_max" value="<?php echo $qs['call_max'];?>" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
<label for="call_attempt_max" class="control-label col-sm-4"><?php echo T_("Max call attempts");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_attempt_max" id="call_attempt_max" value="<?php echo $qs['call_attempt_max'];?>" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
<label for="answering_machine_messages" class="control-label col-sm-4"><?php echo T_("Number of answering machine messages to leave per case");?></label>
|
||||
<div class="col-sm-1"> <input type="number" min="0" max="20" style="width:6em;" name="answering_machine_messages" id="answering_machine_messages" value="<?php echo $qs['answering_machine_messages'];?>" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Never");?></label><br/><br/>
|
||||
<label for="selecttype" class="control-label col-sm-4"><?php echo T_("Select from sample randomly?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "selecttype" name="selecttype" <?php echo $selected;?> data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div>
|
||||
<label class="control-label text-info"><?php echo T_("No") ." = ". T_("Sequentially");?></label><br/><br/>
|
||||
<label for="allownew" class="control-label col-sm-4"><?php echo T_("Allow new numbers to be drawn?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "allownew" name="allownew" <?php echo $allownew;?> class="col-sm-1" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div><br/><br/><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sid); ?>"/>
|
||||
<div class="col-sm-offset-4 col-sm-3"><button type="submit" name="edit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> <?php echo T_("Save changes");?></button></div>
|
||||
</form></div>
|
||||
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
die();
|
||||
}
|
||||
else
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$sql = "DELETE FROM questionnaire_sample
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sid'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$subtitle = T_("List & Add Sample");
|
||||
xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
print "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left'><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
print "<h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id,false, "pull-left", "form-control");
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
|
||||
print "<div class='clearfix '></div><div class='panel-body'>
|
||||
<h3 class='text-primary'>". T_("Samples selected for this questionnaire") .":</h3>";
|
||||
|
||||
$sql = "SELECT si.description as description,
|
||||
CASE WHEN q.call_max = 0 THEN '". TQ_("Unlimited") ."' ELSE q.call_max END as call_max,
|
||||
CASE WHEN q.call_attempt_max = 0 THEN '". TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max,
|
||||
CASE WHEN q.random_select = 0 THEN '". TQ_("Sequential") ."' ELSE '". TQ_("Random") . "' END as random_select,
|
||||
CASE WHEN q.answering_machine_messages = 0 THEN '". TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages,
|
||||
CASE WHEN q.allow_new = 0 THEN '". TQ_("No") ."' ELSE '".TQ_("Yes")."' END as allow_new,
|
||||
CONCAT('<a href=\"?edit=edit&questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\" data-toggle=\'tooltip\' title=\'". TQ_("Edit") ."\' class=\'btn center-block\'><i class=\'fa fa-pencil-square-o fa-lg\'></i></a>') as edit,
|
||||
CONCAT('<a href=\'\' data-toggle=\'confirmation\' data-placement=\'top\' data-href=\"?questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\" class=\'btn center-block\'><i class=\'fa fa-chain-broken fa-lg\' data-toggle=\'tooltip\' title=\'". TQ_("Click to unassign") ."\'></i></a>') as unassign
|
||||
FROM questionnaire_sample as q, sample_import as si
|
||||
WHERE q.sample_import_id = si.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample")));
|
||||
else
|
||||
print "<div class='alert text-danger'><h4>". T_("No samples selected for this questionnaire") ."</h4></div>";
|
||||
|
||||
$sql = "SELECT si.sample_import_id,si.description
|
||||
FROM sample_import as si
|
||||
LEFT JOIN questionnaire_sample as q ON (q.questionnaire_id = '$questionnaire_id' AND q.sample_import_id = si.sample_import_id)
|
||||
WHERE q.questionnaire_id is NULL
|
||||
AND si.enabled = 1";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
print"</div>";
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='clearfix '></div>";
|
||||
print "<div class='panel-body form-group'><h3 class='text-primary'>" . T_("Add a sample to this questionnaire:") . "</h3>";
|
||||
?>
|
||||
<form action="" method="get" class="form-horizontal">
|
||||
<label for="sample" class="control-label col-sm-4"><?php echo T_("Select sample:");?></label>
|
||||
<div class="col-sm-3"><select name="sample" id="sample" class="form-control " >
|
||||
<?php foreach($qs as $q) { print "<option value=\"{$q['sample_import_id']}\">{$q['description']}</option>"; } ?> </select></div><br/><br/>
|
||||
|
||||
<label for="call_max" class="control-label col-sm-4"><?php echo T_("Max calls");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_max" id="call_max" value="0" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
|
||||
<label for="call_attempt_max" class="control-label col-sm-4"><?php echo T_("Max call attempts");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_attempt_max" id="call_attempt_max" value="0" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
|
||||
<label for="answering_machine_messages" class="control-label col-sm-4"><?php echo T_("Number of answering machine messages to leave per case");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="answering_machine_messages" id="answering_machine_messages" value="0" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Never");?></label><br/><br/>
|
||||
|
||||
<label for="selecttype" class="control-label col-sm-4"><?php echo T_("Select from sample randomly?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "selecttype" name="selecttype" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div>
|
||||
<label class="control-label text-info"><?php echo T_("No") ." = ". T_("Sequentially");?></label><br/><br/>
|
||||
|
||||
<label for="allownew" class="control-label col-sm-4"><?php echo T_("Allow new numbers to be drawn?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "allownew" name="allownew" checked="checked" class="col-sm-1" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div><br/><br/><br/>
|
||||
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id);?>"/>
|
||||
|
||||
<div class="col-sm-offset-4 col-sm-3"><button type="submit" name="add_sample" class="btn btn-primary"><i class="fa fa-plus-circle fa-lg"></i> <?php echo T_("Add sample");?></button></div>
|
||||
|
||||
</form></div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('[data-toggle="confirmation"]').confirmation()
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Assign sample(s) to a questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
|
||||
"../js/window.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/bootstrap-confirmation.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sid = bigintval($_GET['sample']);
|
||||
$cm = bigintval($_GET['call_max']);
|
||||
$cam = bigintval($_GET['call_attempt_max']);
|
||||
$am = bigintval($_GET['answering_machine_messages']);
|
||||
$selecttype = 0;
|
||||
if (isset($_GET['selecttype'])) $selecttype = 1;
|
||||
$an = 0;
|
||||
if (isset($_GET['allownew'])) $an = 1;
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages,allow_new)
|
||||
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_POST['edit']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
$questionnaire_id = bigintval($_POST['questionnaire_id']);
|
||||
$sid = bigintval($_POST['sample_import_id']);
|
||||
$cm = bigintval($_POST['call_max']);
|
||||
$cam = bigintval($_POST['call_attempt_max']);
|
||||
$am = bigintval($_POST['answering_machine_messages']);
|
||||
$selecttype = 0;
|
||||
if (isset($_POST['selecttype'])) $selecttype = 1;
|
||||
$an = 0;
|
||||
if (isset($_POST['allownew'])) $an = 1;
|
||||
|
||||
$sql = "UPDATE questionnaire_sample
|
||||
SET call_max = '$cm',
|
||||
call_attempt_max = '$cam',
|
||||
random_select = '$selecttype',
|
||||
answering_machine_messages = '$am',
|
||||
allow_new = '$an'
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sid'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
{
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sid = bigintval($_GET['rsid']);
|
||||
|
||||
if (isset($_GET['edit']))
|
||||
{
|
||||
$subtitle = T_("Edit assignment parameters");
|
||||
xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
$sql = "SELECT si.description as description,
|
||||
qr.description as qdescription,
|
||||
q.call_max,
|
||||
q.call_attempt_max,
|
||||
q.random_select,
|
||||
q.answering_machine_messages,
|
||||
q.allow_new
|
||||
FROM questionnaire_sample as q, sample_import as si, questionnaire as qr
|
||||
WHERE q.sample_import_id = si.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'
|
||||
AND si.sample_import_id = '$sid'
|
||||
AND qr.questionnaire_id = q.questionnaire_id";
|
||||
|
||||
$qs = $db->GetRow($sql);
|
||||
|
||||
//print "<h1>" . T_("Edit sample details") . "<h1>";
|
||||
print " <p><a href='?questionnaire_id=$questionnaire_id' class='btn btn-default '><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a></p>
|
||||
<h2 class='col-sm-6'>" . T_("Questionnaire") . ": <span class='text-primary'>" . $qs['qdescription'] . "</span></h2>
|
||||
<h2 class='col-sm-6'>" . T_("Sample") . ": <span class='text-primary'>" . $qs['description'] . "</span></h2>
|
||||
<div class='panel-body form-group'>";
|
||||
|
||||
$allownew = $selected ="";
|
||||
if ($qs['random_select'] == 1)
|
||||
$selected = "checked=\"checked\"";
|
||||
if ($qs['allow_new'] == 1)
|
||||
$allownew = "checked=\"checked\"";
|
||||
?>
|
||||
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post" class="form-horizontal">
|
||||
|
||||
<label for="call_max" class="control-label col-sm-4"><?php echo T_("Max calls");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_max" id="call_max" value="<?php echo $qs['call_max'];?>" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
<label for="call_attempt_max" class="control-label col-sm-4"><?php echo T_("Max call attempts");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_attempt_max" id="call_attempt_max" value="<?php echo $qs['call_attempt_max'];?>" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
<label for="answering_machine_messages" class="control-label col-sm-4"><?php echo T_("Number of answering machine messages to leave per case");?></label>
|
||||
<div class="col-sm-1"> <input type="number" min="0" max="20" style="width:6em;" name="answering_machine_messages" id="answering_machine_messages" value="<?php echo $qs['answering_machine_messages'];?>" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Never");?></label><br/><br/>
|
||||
<label for="selecttype" class="control-label col-sm-4"><?php echo T_("Select from sample randomly?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "selecttype" name="selecttype" <?php echo $selected;?> data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div>
|
||||
<label class="control-label text-info"><?php echo T_("No") ." = ". T_("Sequentially");?></label><br/><br/>
|
||||
<label for="allownew" class="control-label col-sm-4"><?php echo T_("Allow new numbers to be drawn?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "allownew" name="allownew" <?php echo $allownew;?> class="col-sm-1" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div><br/><br/><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sid); ?>"/>
|
||||
<div class="col-sm-offset-4 col-sm-3"><button type="submit" name="edit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> <?php echo T_("Save changes");?></button></div>
|
||||
</form></div>
|
||||
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
die();
|
||||
}
|
||||
else
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$sql = "DELETE FROM questionnaire_sample
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sid'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$subtitle = T_("List & Add Sample");
|
||||
xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
print "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left'><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
print "<h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id,false, "pull-left", "form-control");
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
|
||||
print "<div class='clearfix '></div><div class='panel-body'>
|
||||
<h3 class='text-primary'>". T_("Samples selected for this questionnaire") .":</h3>";
|
||||
|
||||
$sql = "SELECT si.description as description,
|
||||
CASE WHEN q.call_max = 0 THEN '". TQ_("Unlimited") ."' ELSE q.call_max END as call_max,
|
||||
CASE WHEN q.call_attempt_max = 0 THEN '". TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max,
|
||||
CASE WHEN q.random_select = 0 THEN '". TQ_("Sequential") ."' ELSE '". TQ_("Random") . "' END as random_select,
|
||||
CASE WHEN q.answering_machine_messages = 0 THEN '". TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages,
|
||||
CASE WHEN q.allow_new = 0 THEN '". TQ_("No") ."' ELSE '".TQ_("Yes")."' END as allow_new,
|
||||
CONCAT('<a href=\"?edit=edit&questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\" data-toggle=\'tooltip\' title=\'". TQ_("Edit") ."\' class=\'btn center-block\'><i class=\'fa fa-pencil-square-o fa-lg\'></i></a>') as edit,
|
||||
CONCAT('<a href=\'\' data-toggle=\'confirmation\' data-placement=\'top\' data-href=\"?questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\" class=\'btn center-block\'><i class=\'fa fa-chain-broken fa-lg\' data-toggle=\'tooltip\' title=\'". TQ_("Click to unassign") ."\'></i></a>') as unassign
|
||||
FROM questionnaire_sample as q, sample_import as si
|
||||
WHERE q.sample_import_id = si.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample")));
|
||||
else
|
||||
print "<div class='alert text-danger'><h4>". T_("No samples selected for this questionnaire") ."</h4></div>";
|
||||
|
||||
$sql = "SELECT si.sample_import_id,si.description
|
||||
FROM sample_import as si
|
||||
LEFT JOIN questionnaire_sample as q ON (q.questionnaire_id = '$questionnaire_id' AND q.sample_import_id = si.sample_import_id)
|
||||
WHERE q.questionnaire_id is NULL
|
||||
AND si.enabled = 1";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
print"</div>";
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='clearfix '></div>";
|
||||
print "<div class='panel-body form-group'><h3 class='text-primary'>" . T_("Add a sample to this questionnaire:") . "</h3>";
|
||||
?>
|
||||
<form action="" method="get" class="form-horizontal">
|
||||
<label for="sample" class="control-label col-sm-4"><?php echo T_("Select sample:");?></label>
|
||||
<div class="col-sm-3"><select name="sample" id="sample" class="form-control " >
|
||||
<?php foreach($qs as $q) { print "<option value=\"{$q['sample_import_id']}\">{$q['description']}</option>"; } ?> </select></div><br/><br/>
|
||||
|
||||
<label for="call_max" class="control-label col-sm-4"><?php echo T_("Max calls");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_max" id="call_max" value="0" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
|
||||
<label for="call_attempt_max" class="control-label col-sm-4"><?php echo T_("Max call attempts");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="call_attempt_max" id="call_attempt_max" value="0" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Unlimited");?></label><br/><br/>
|
||||
|
||||
<label for="answering_machine_messages" class="control-label col-sm-4"><?php echo T_("Number of answering machine messages to leave per case");?></label>
|
||||
<div class="col-sm-1"><input type="number" min="0" max="20" style="width:6em;" name="answering_machine_messages" id="answering_machine_messages" value="0" class="form-control"/></div>
|
||||
<label class="control-label text-info"><?php echo "0 = " . T_("Never");?></label><br/><br/>
|
||||
|
||||
<label for="selecttype" class="control-label col-sm-4"><?php echo T_("Select from sample randomly?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "selecttype" name="selecttype" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div>
|
||||
<label class="control-label text-info"><?php echo T_("No") ." = ". T_("Sequentially");?></label><br/><br/>
|
||||
|
||||
<label for="allownew" class="control-label col-sm-4"><?php echo T_("Allow new numbers to be drawn?");?></label>
|
||||
<div class="col-sm-1"><input type="checkbox" id = "allownew" name="allownew" checked="checked" class="col-sm-1" data-toggle="toggle" data-size="small" data-on="<?php echo T_("Yes");?>" data-off="<?php echo T_("No");?>" data-width="85"/></div><br/><br/><br/>
|
||||
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id);?>"/>
|
||||
|
||||
<div class="col-sm-offset-4 col-sm-3"><button type="submit" name="add_sample" class="btn btn-primary"><i class="fa fa-plus-circle fa-lg"></i> <?php echo T_("Add sample");?></button></div>
|
||||
|
||||
</form></div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('[data-toggle="confirmation"]').confirmation()
|
||||
</script>
|
||||
|
||||
@@ -1,313 +1,313 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign availability groups to a questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
//"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/window.js",
|
||||
//"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
//block availability
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['av_availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['av_availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_availability(questionnaire_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$availability_group')";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['av_ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['av_ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_availability
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
//block call_attempts
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['ca_availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['ca_availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$availability_group')";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['ca_ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['ca_ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_timeslot
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
//block call_attempts by sample
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$availability_group = bigintval($_GET['qs_availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample_timeslot (questionnaire_id,sample_import_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$sample_import_id','$availability_group')";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$availability_group = bigintval($_GET['qs_ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_sample_timeslot
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sample_import_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
xhtml_head(T_("Assign Time slots"),true,$css,$js_head);//false,array("../js/window.js")
|
||||
|
||||
print "<div class='clearfix form-group'><h3 class='col-sm-6 text-right text-uppercase'>" . T_("Select a questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control");
|
||||
print "</div>";
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
|
||||
//page questionnaireavailability.php
|
||||
print "<div class=col-sm-4><h2>" . T_("Time slot groups") . "</h2>";
|
||||
print "<div class='well'>" . T_("Assigning an availability group to a questionnaire will allow interviewers to select from those groups to restrict calls to a particular case to the times within the group") ."</div>";
|
||||
|
||||
$sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&av_ravailability_group=', a.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
|
||||
FROM questionnaire_availability as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
print "</br></br></br><div class='panel-body'>";
|
||||
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h4 class='alert text-danger'>" . T_("There are no time slots groups selected for this questionnaire") . "</h4>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h4>" . T_("Time slots groups selected for this questionnaire") . "</h4>";
|
||||
xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
|
||||
}
|
||||
print "</div>";
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_availability as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='panel-body'>";
|
||||
//print "<h3>" . T_("Add time slot to this questionnaire:") . "</h3>";
|
||||
print "<form action='' method='get'><div class='pull-left'><select class='form-control ' name='av_availability_group' id='av_availability_group'>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
print "</select></div>
|
||||
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
|
||||
 <input type='submit' class='btn btn-default' name='add_av_availability' value='" . T_("Add time slot group") . "'/>
|
||||
</form></div>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
|
||||
//page questionnairecatimeslots.php
|
||||
print "<div class=col-sm-4><h2>" . T_("Call attempt time slots") . "</h2>";
|
||||
print "<div class='well'>" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."</div>";
|
||||
|
||||
$sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&ca_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
|
||||
|
||||
FROM questionnaire_timeslot as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
print "</br><div class='panel-body'>";
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire") . "</h4>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h4>" . T_("Call attempt time slots selected for this questionnaire") . "</h4>";
|
||||
xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_timeslot as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='panel-body'>";
|
||||
//print "<h3>" . T_("Add a call attempt time slot to this questionnaire:") . "</h3>";
|
||||
print "<form action='' method='get'><div class='pull-left'><select class='form-control ' name='ca_availability_group' id='ca_availability_group'>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
print "</select></div>
|
||||
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
|
||||
 <input type='submit' class='btn btn-default' name='add_ca_availability' value='" . TQ_("Add call attempt time slot") . "'/>
|
||||
</form></div>";
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
//page questionnairetimeslosample.php
|
||||
print "<div class=col-sm-4><h2>" . T_("Call attempt time slots for sample") . "</h2>";
|
||||
print "<div class='well'>" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."</div>";
|
||||
|
||||
print "<h3 class='pull-left'>" . T_("Sample") . ": </h3>";
|
||||
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id,false, "form-inline", "form-control");
|
||||
|
||||
if ($sample_import_id !== false)
|
||||
{
|
||||
$sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?sample_import_id=$sample_import_id&questionnaire_id=$questionnaire_id&qs_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
|
||||
FROM questionnaire_sample_timeslot as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'
|
||||
AND q.sample_import_id = '$sample_import_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire sample") . "</h4>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h4>" . T_("Call attempt time slots selected for this sample") . ":</h4>";
|
||||
xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
|
||||
}
|
||||
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_sample_timeslot as q ON (q.sample_import_id = '$sample_import_id' AND q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='panel-body'>";
|
||||
//print "<h3>" . T_("Add a call attempt time slot to this questionnaire sample:") . "</h3>";
|
||||
print "<form action='' method='get'><div class='pull-left'><select class='form-control ' name='qs_availability_group' id='qs_availability_group'>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
print "</select></div>
|
||||
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
|
||||
<input type='hidden' name='sample_import_id' value='$sample_import_id'/>
|
||||
 <input type='submit' name='add_qs_availability' class='btn btn-default' value='" . T_("Add call attempt time slot for sample") . "'/>
|
||||
</form></div>";
|
||||
}
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Assign availability groups to a questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
//"../include/font-awesome/css/font-awesome.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/window.js",
|
||||
//"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
//block availability
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['av_availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['av_availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_availability(questionnaire_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$availability_group')";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['av_ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['av_ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_availability
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
//block call_attempts
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['ca_availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['ca_availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$availability_group')";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['ca_ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['ca_ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_timeslot
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
//block call_attempts by sample
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$availability_group = bigintval($_GET['qs_availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample_timeslot (questionnaire_id,sample_import_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$sample_import_id','$availability_group')";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$availability_group = bigintval($_GET['qs_ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_sample_timeslot
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sample_import_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
xhtml_head(T_("Assign Time slots"),true,$css,$js_head);//false,array("../js/window.js")
|
||||
|
||||
print "<div class='clearfix form-group'><h3 class='col-sm-6 text-right text-uppercase'>" . T_("Select a questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control");
|
||||
print "</div>";
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
|
||||
//page questionnaireavailability.php
|
||||
print "<div class=col-sm-4><h2>" . T_("Time slot groups") . "</h2>";
|
||||
print "<div class='well'>" . T_("Assigning an availability group to a questionnaire will allow interviewers to select from those groups to restrict calls to a particular case to the times within the group") ."</div>";
|
||||
|
||||
$sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&av_ravailability_group=', a.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
|
||||
FROM questionnaire_availability as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
print "</br></br></br><div class='panel-body'>";
|
||||
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h4 class='alert text-danger'>" . T_("There are no time slots groups selected for this questionnaire") . "</h4>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h4>" . T_("Time slots groups selected for this questionnaire") . "</h4>";
|
||||
xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
|
||||
}
|
||||
print "</div>";
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_availability as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='panel-body'>";
|
||||
//print "<h3>" . T_("Add time slot to this questionnaire:") . "</h3>";
|
||||
print "<form action='' method='get'><div class='pull-left'><select class='form-control ' name='av_availability_group' id='av_availability_group'>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
print "</select></div>
|
||||
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
|
||||
 <input type='submit' class='btn btn-default' name='add_av_availability' value='" . T_("Add time slot group") . "'/>
|
||||
</form></div>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
|
||||
//page questionnairecatimeslots.php
|
||||
print "<div class=col-sm-4><h2>" . T_("Call attempt time slots") . "</h2>";
|
||||
print "<div class='well'>" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."</div>";
|
||||
|
||||
$sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&ca_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
|
||||
|
||||
FROM questionnaire_timeslot as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
print "</br><div class='panel-body'>";
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire") . "</h4>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h4>" . T_("Call attempt time slots selected for this questionnaire") . "</h4>";
|
||||
xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_timeslot as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='panel-body'>";
|
||||
//print "<h3>" . T_("Add a call attempt time slot to this questionnaire:") . "</h3>";
|
||||
print "<form action='' method='get'><div class='pull-left'><select class='form-control ' name='ca_availability_group' id='ca_availability_group'>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
print "</select></div>
|
||||
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
|
||||
 <input type='submit' class='btn btn-default' name='add_ca_availability' value='" . TQ_("Add call attempt time slot") . "'/>
|
||||
</form></div>";
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
//page questionnairetimeslosample.php
|
||||
print "<div class=col-sm-4><h2>" . T_("Call attempt time slots for sample") . "</h2>";
|
||||
print "<div class='well'>" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."</div>";
|
||||
|
||||
print "<h3 class='pull-left'>" . T_("Sample") . ": </h3>";
|
||||
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id,false, "form-inline", "form-control");
|
||||
|
||||
if ($sample_import_id !== false)
|
||||
{
|
||||
$sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?sample_import_id=$sample_import_id&questionnaire_id=$questionnaire_id&qs_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
|
||||
FROM questionnaire_sample_timeslot as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'
|
||||
AND q.sample_import_id = '$sample_import_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire sample") . "</h4>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h4>" . T_("Call attempt time slots selected for this sample") . ":</h4>";
|
||||
xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
|
||||
}
|
||||
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_sample_timeslot as q ON (q.sample_import_id = '$sample_import_id' AND q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
print "<div class='panel-body'>";
|
||||
//print "<h3>" . T_("Add a call attempt time slot to this questionnaire sample:") . "</h3>";
|
||||
print "<form action='' method='get'><div class='pull-left'><select class='form-control ' name='qs_availability_group' id='qs_availability_group'>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
print "</select></div>
|
||||
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
|
||||
<input type='hidden' name='sample_import_id' value='$sample_import_id'/>
|
||||
 <input type='submit' name='add_qs_availability' class='btn btn-default' value='" . T_("Add call attempt time slot for sample") . "'/>
|
||||
</form></div>";
|
||||
}
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
|
||||
@@ -1,190 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
* Modify availability within this availability group
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../js/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
if (isset($_GET['availability_group']))
|
||||
$availability_group = intval($_GET['availability_group']);
|
||||
else if (isset($_POST['availability_group']))
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
else
|
||||
die(T_("No time slot group set"));
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id)
|
||||
VALUES ('$val',$start,$end,$availability_group)";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE availability_group
|
||||
SET description = " . $db->qstr($_POST['description']) . "
|
||||
WHERE availability_group_id= $availability_group";
|
||||
$db->Execute($sql);
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify time slots"),true,$css,$js_head);//,true,array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
print "<div><a class='btn btn-default' href='availabilitygroup.php'>" . T_("Go back") . "</a></div><br/>";
|
||||
|
||||
|
||||
$sql = "SELECT description
|
||||
FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$description = $rs['description'];
|
||||
|
||||
print "<h3>" . T_("Time slot") . " : <span class = 'text-primary '>" . $rs['description'] . "</span></h3>";
|
||||
|
||||
/**
|
||||
* Begin displaying currently loaded restriction times
|
||||
*/
|
||||
|
||||
$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
|
||||
FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$availabilitys = $db->GetAll($sql);
|
||||
translate_array($availabilitys,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
|
||||
FROM day_of_week";
|
||||
|
||||
$daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
||||
<p><label class="control-label"for="description"><?php echo T_("Edit Time slot group name"); ?>: </label><input class="form-control" type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<table class="table-hover table-condensed "><thead class="highlight">
|
||||
<?php
|
||||
|
||||
print "<div class='well text-info'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
||||
|
||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
||||
$count = 0;
|
||||
foreach($availabilitys as $availability)
|
||||
{
|
||||
print "<tr id='row-$count' ><td>";//class='row_to_clone'
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt']));
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$availability['start']}\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$availability['end']}\"/></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
print "<tr class='row_to_clone' id='row-$count'><td>";
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"08:00:00\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"20:00:00\"/></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-primary" type="submit" name="submit" value="<?php echo T_("Save changes to time slot group"); ?>"/>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form><br/><br/>
|
||||
<form method="post" action="availabilitygroup.php">
|
||||
<input class="btn btn-danger pull-right" type="submit" name="subdel" value="<?php echo T_("Delete this time slot group"); ?>"/>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Modify availability within this availability group
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
"../js/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
if (isset($_GET['availability_group']))
|
||||
$availability_group = intval($_GET['availability_group']);
|
||||
else if (isset($_POST['availability_group']))
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
else
|
||||
die(T_("No time slot group set"));
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id)
|
||||
VALUES ('$val',$start,$end,$availability_group)";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE availability_group
|
||||
SET description = " . $db->qstr($_POST['description']) . "
|
||||
WHERE availability_group_id= $availability_group";
|
||||
$db->Execute($sql);
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify time slots"),true,$css,$js_head);//,true,array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
print "<div><a class='btn btn-default' href='availabilitygroup.php'>" . T_("Go back") . "</a></div><br/>";
|
||||
|
||||
|
||||
$sql = "SELECT description
|
||||
FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$description = $rs['description'];
|
||||
|
||||
print "<h3>" . T_("Time slot") . " : <span class = 'text-primary '>" . $rs['description'] . "</span></h3>";
|
||||
|
||||
/**
|
||||
* Begin displaying currently loaded restriction times
|
||||
*/
|
||||
|
||||
$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
|
||||
FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$availabilitys = $db->GetAll($sql);
|
||||
translate_array($availabilitys,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
|
||||
FROM day_of_week";
|
||||
|
||||
$daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
||||
<p><label class="control-label"for="description"><?php echo T_("Edit Time slot group name"); ?>: </label><input class="form-control" type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<table class="table-hover table-condensed "><thead class="highlight">
|
||||
<?php
|
||||
|
||||
print "<div class='well text-info'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
||||
|
||||
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
|
||||
$count = 0;
|
||||
foreach($availabilitys as $availability)
|
||||
{
|
||||
print "<tr id='row-$count' ><td>";//class='row_to_clone'
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt']));
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$availability['start']}\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"{$availability['end']}\"/></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
print "<tr class='row_to_clone' id='row-$count'><td>";
|
||||
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
|
||||
print "</td><td><input class=\"form-control clockpicker\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"08:00:00\"/></td><td><input class=\"form-control clockpicker\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"20:00:00\"/></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-primary" type="submit" name="submit" value="<?php echo T_("Save changes to time slot group"); ?>"/>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form><br/><br/>
|
||||
<form method="post" action="availabilitygroup.php">
|
||||
<input class="btn btn-danger pull-right" type="submit" name="subdel" value="<?php echo T_("Delete this time slot group"); ?>"/>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,141 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* List and create availability groups
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (2011)
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Limesurvey functions
|
||||
*/
|
||||
include("../functions/functions.limesurvey.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Time slots"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
if (isset($_POST['subdel']))
|
||||
{
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
else if (isset($_POST['availability_group']))
|
||||
{
|
||||
$availability_group = $db->qstr($_POST['availability_group']);
|
||||
|
||||
$sql = "INSERT INTO `availability_group` (availability_group_id,description)
|
||||
VALUES (NULL,$availability_group)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
//view groups
|
||||
$sql = "SELECT availability_group_id,description,
|
||||
CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link
|
||||
FROM availability_group";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "<div class='well'>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</div>";
|
||||
|
||||
if (empty($rs))
|
||||
print "<div class='alert alert-danger'>" . T_("No time slots") . "</div>";
|
||||
else{
|
||||
print "<div class='panel-body col-sm-6'>";
|
||||
xhtml_table($rs,array("availability_group_id","description","link"),array(T_("ID"),T_("Time slot name"),T_("Modify")),"table table-hover");
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
//add a time slot (ex- availablity group)
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="?">
|
||||
<h3><?php echo T_("Add new time slot")," :";?></h3>
|
||||
<p><input type="text" class="textclass form-control" name="availability_group" id="availability_group" placeholder="<?php echo T_("Enter")," ",T_("new")," ",T_("Time slot name"); ?>"/></p>
|
||||
<p><input class="submitclass btn btn-default" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/></p>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* List and create availability groups
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (2011)
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Limesurvey functions
|
||||
*/
|
||||
include("../functions/functions.limesurvey.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Time slots"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
if (isset($_POST['subdel']))
|
||||
{
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_availability
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM availability_group
|
||||
WHERE availability_group_id = $availability_group";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
else if (isset($_POST['availability_group']))
|
||||
{
|
||||
$availability_group = $db->qstr($_POST['availability_group']);
|
||||
|
||||
$sql = "INSERT INTO `availability_group` (availability_group_id,description)
|
||||
VALUES (NULL,$availability_group)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
//view groups
|
||||
$sql = "SELECT availability_group_id,description,
|
||||
CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link
|
||||
FROM availability_group";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "<div class='well'>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</div>";
|
||||
|
||||
if (empty($rs))
|
||||
print "<div class='alert alert-danger'>" . T_("No time slots") . "</div>";
|
||||
else{
|
||||
print "<div class='panel-body col-sm-6'>";
|
||||
xhtml_table($rs,array("availability_group_id","description","link"),array(T_("ID"),T_("Time slot name"),T_("Modify")),"table table-hover");
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
//add a time slot (ex- availablity group)
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="?">
|
||||
<h3><?php echo T_("Add new time slot")," :";?></h3>
|
||||
<p><input type="text" class="textclass form-control" name="availability_group" id="availability_group" placeholder="<?php echo T_("Enter")," ",T_("new")," ",T_("Time slot name"); ?>"/></p>
|
||||
<p><input class="submitclass btn btn-default" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/></p>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
|
||||
@@ -1,289 +1,289 @@
|
||||
<?php
|
||||
/**
|
||||
* Generate bulk appointments from a Headered CSV file
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research (ACSPRI) 2012
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Database functions
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Validate that an uploaded CSV file contains a caseid, starttime and endtime column and generate
|
||||
* an array containing the details for confirming on screen or updating the database
|
||||
*
|
||||
* @param string $tmpfname File name of uploaded CSV file
|
||||
*
|
||||
* @return bool|array False if invalid otherwise an array of arrays containing caseid,starttime,endtime and note
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @since 2012-11-02
|
||||
*/
|
||||
function validate_bulk_appointment($tmpfname)
|
||||
{
|
||||
$handle = fopen($tmpfname, "r");
|
||||
$row = 1;
|
||||
$cols = array("caseid" => -1,"starttime" => -1,"endtime" => -1);
|
||||
$index = array();
|
||||
$optcols = array("note" => -1);
|
||||
|
||||
$todo = array();
|
||||
|
||||
while (($data = fgetcsv($handle)) !== FALSE)
|
||||
{
|
||||
//data contains an array of elements in the csv
|
||||
//selected contains an indexed array of elements to import with the type attached
|
||||
|
||||
|
||||
if ($row == 1) //validate
|
||||
{
|
||||
$colcount = 0;
|
||||
$ic = 0;
|
||||
foreach($data as $col)
|
||||
{
|
||||
if (array_key_exists(strtolower($col),$cols))
|
||||
{
|
||||
$cols[strtolower($col)] = $ic;
|
||||
$colcount++;
|
||||
}
|
||||
if (array_key_exists(strtolower($col),$optcols))
|
||||
{
|
||||
$optcols[strtolower($col)] = $ic;
|
||||
}
|
||||
$ic++;
|
||||
}
|
||||
if ($colcount != 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$note = "";
|
||||
if (isset($data[$optcols['note']]))
|
||||
$note = $data[$optcols['note']];
|
||||
|
||||
$sd = getdate(strtotime($data[$cols['starttime']]));
|
||||
$s = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
||||
|
||||
$sd = getdate(strtotime($data[$cols['endtime']]));
|
||||
$e = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
||||
|
||||
$todor = array($data[$cols['caseid']],$s,$e,$note);
|
||||
|
||||
$todo[] = $todor;
|
||||
}
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
|
||||
return $todo;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['tmpfname']))
|
||||
{
|
||||
$subtitle = T_("Result");
|
||||
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle);
|
||||
$todo = validate_bulk_appointment($_POST['tmpfname']);
|
||||
|
||||
if (is_array($todo))
|
||||
{
|
||||
$res = array();
|
||||
foreach($todo as $r)
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
//check the current case id exists and outcome is not final
|
||||
$sql = "SELECT c.case_id
|
||||
FROM `case` as c, `outcome` as o
|
||||
WHERE c.current_outcome_id = o.outcome_id
|
||||
AND o.outcome_type_id != 4
|
||||
AND c.case_id = {$r[0]}
|
||||
AND c.current_operator_id IS NULL";
|
||||
|
||||
$caseid = $db->GetOne($sql);
|
||||
|
||||
if (!empty($caseid))
|
||||
{
|
||||
//insert an appointment in respondent time
|
||||
$sql = "SELECT respondent_id
|
||||
FROM respondent
|
||||
WHERE case_id = {$r[0]}";
|
||||
|
||||
$rid = $db->GetOne($sql);
|
||||
|
||||
$sql = "SELECT contact_phone_id
|
||||
FROM contact_phone
|
||||
WHERE case_id = {$r[0]}
|
||||
ORDER BY priority ASC";
|
||||
|
||||
$cid = $db->GetOne($sql);
|
||||
|
||||
$oid = get_operator_id();
|
||||
|
||||
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end)
|
||||
VALUES (NULL,{$r[0]},$oid,$rid,CONVERT_TZ(NOW(),'System','UTC'),CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$call_attempt_id = $db->Insert_ID();
|
||||
|
||||
$sql = "INSERT INTO appointment (case_id,contact_phone_id,`start`,`end`,respondent_id,call_attempt_id)
|
||||
SELECT {$r[0]},$cid,CONVERT_TZ('{$r[1]}',Time_zone_name,'UTC'),CONVERT_TZ('{$r[2]}',Time_zone_name,'UTC'),$rid,$call_attempt_id
|
||||
FROM respondent
|
||||
WHERE respondent_id = $rid";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$aid = $db->Insert_ID();
|
||||
|
||||
//change the outcome to unspecified appointment, other
|
||||
$sql = "UPDATE `case`
|
||||
SET current_outcome_id = 22
|
||||
WHERE case_id = {$r[0]}";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//add a note if not blank
|
||||
if (!empty($r[3]))
|
||||
{
|
||||
$note = $db->qstr($r[3]);
|
||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,datetime)
|
||||
VALUES ({$r[0]},$oid,$note,CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
$cnote = T_("Added appointment") . " <a href='displayappointments?case_id={$r[0]}&appointment_id=$aid'>$aid</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cnote = T_("No such case id, or case set to a final outcome, or case currently assigned to an operator");
|
||||
}
|
||||
|
||||
$res[] = array("<a href='supervisor.php?case_id=" . $r[0] . "'>" . $r[0] . "</a>",$cnote);
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
xhtml_table($res,array(0,1),array(T_("Case id"),T_("Result")));
|
||||
}
|
||||
xhtml_foot();
|
||||
}
|
||||
else if (isset($_POST['import_file']))
|
||||
{
|
||||
//file has been submitted
|
||||
$subtitle = T_("Check data to submit");
|
||||
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle);
|
||||
?>
|
||||
<form action="" method="post" >
|
||||
<?php
|
||||
|
||||
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
|
||||
|
||||
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
|
||||
|
||||
$todo = validate_bulk_appointment($tmpfname);
|
||||
|
||||
if (is_array($todo) && !empty($todo)) {
|
||||
|
||||
print "<p class='well'>" . T_("Please check the case id's, appointment start and end times and notes are correct before accepting below") . "</p>";
|
||||
$todoh = array(T_("Case id"), T_("Start time"), T_("End time"), T_("Note"));
|
||||
xhtml_table($todo,array(0,1,2,3),$todoh);
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="tmpfname" value="<?php echo $tmpfname; ?>" />
|
||||
<input type="submit" name="import_file" value="<?php echo T_("Accept and generate bulk appointments"); ?>" class="btn btn-primary"/>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
print "<p class='well text-danger'>" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."</p>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//need to supply file to upload
|
||||
$subtitle = T_("Import: Select file to upload");
|
||||
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/font-awesome-4.3.0/css/font-awesome.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../js/bootstrap-filestyle.min.js"),false,false,false,$subtitle );
|
||||
|
||||
$ua = $_SERVER['HTTP_USER_AGENT'];
|
||||
if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv";
|
||||
|
||||
?>
|
||||
|
||||
<p class="well"><?php echo T_("Provide a headered CSV file containing at least 3 columns - caseid, starttime and endtime. </br> Optionally you can include a note column to attach a note to the case in addition to setting an appointment. </br>Only cases that have temporary (non final) outcomes will have appointments generated, and the outcome of the case will be updated to an appointment outcome."); ?><p>
|
||||
|
||||
<div class="panel-body">
|
||||
<h5><u><?php echo T_("Example CSV file:"); ?></u></h5>
|
||||
<table class="table-bordered table-condensed form-group">
|
||||
<tr><th>caseid</th><th>starttime</th><th>endtime</th><th>note</th></tr>
|
||||
<tr><td>1</td><td>2012-08-15 11:00:00</td><td>2012-08-15 13:00:00</td><td>Appointment automatically generated</td></tr>
|
||||
<tr><td>2</td><td>2012-08-15 12:00:00</td><td>2012-08-15 14:00:00</td><td>Appointment automatically generated</td></tr>
|
||||
<tr><td>3</td><td>2012-08-15 13:00:00</td><td>2012-08-15 15:00:00</td><td>Appointment automatically generated</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
|
||||
|
||||
<h4 class="pull-left" ><?php echo T_("Select bulk appointment CSV file to upload"); ?>: </h4>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<input name="file" class="filestyle" type="file" required data-buttonBefore="true" data-iconName="fa fa-folder-open fa-lg text-primary " data-buttonText="<?php echo T_("Select file"); ?>" type="file" accept="<?php echo $csv; ?>"/> 
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" name="import_file" value=""><i class='fa fa-upload fa-lg'></i> <?php echo T_("Upload file"); ?></button>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Generate bulk appointments from a Headered CSV file
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research (ACSPRI) 2012
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Database functions
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Validate that an uploaded CSV file contains a caseid, starttime and endtime column and generate
|
||||
* an array containing the details for confirming on screen or updating the database
|
||||
*
|
||||
* @param string $tmpfname File name of uploaded CSV file
|
||||
*
|
||||
* @return bool|array False if invalid otherwise an array of arrays containing caseid,starttime,endtime and note
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @since 2012-11-02
|
||||
*/
|
||||
function validate_bulk_appointment($tmpfname)
|
||||
{
|
||||
$handle = fopen($tmpfname, "r");
|
||||
$row = 1;
|
||||
$cols = array("caseid" => -1,"starttime" => -1,"endtime" => -1);
|
||||
$index = array();
|
||||
$optcols = array("note" => -1);
|
||||
|
||||
$todo = array();
|
||||
|
||||
while (($data = fgetcsv($handle)) !== FALSE)
|
||||
{
|
||||
//data contains an array of elements in the csv
|
||||
//selected contains an indexed array of elements to import with the type attached
|
||||
|
||||
|
||||
if ($row == 1) //validate
|
||||
{
|
||||
$colcount = 0;
|
||||
$ic = 0;
|
||||
foreach($data as $col)
|
||||
{
|
||||
if (array_key_exists(strtolower($col),$cols))
|
||||
{
|
||||
$cols[strtolower($col)] = $ic;
|
||||
$colcount++;
|
||||
}
|
||||
if (array_key_exists(strtolower($col),$optcols))
|
||||
{
|
||||
$optcols[strtolower($col)] = $ic;
|
||||
}
|
||||
$ic++;
|
||||
}
|
||||
if ($colcount != 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$note = "";
|
||||
if (isset($data[$optcols['note']]))
|
||||
$note = $data[$optcols['note']];
|
||||
|
||||
$sd = getdate(strtotime($data[$cols['starttime']]));
|
||||
$s = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
||||
|
||||
$sd = getdate(strtotime($data[$cols['endtime']]));
|
||||
$e = $sd['year'] . "-" . str_pad($sd['mon'],2,"0", STR_PAD_LEFT) . "-" . str_pad($sd['mday'],2,"0",STR_PAD_LEFT) . " " . str_pad($sd['hours'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['minutes'],2,"0",STR_PAD_LEFT) . ":" . str_pad($sd['seconds'],2,"0",STR_PAD_LEFT);
|
||||
|
||||
$todor = array($data[$cols['caseid']],$s,$e,$note);
|
||||
|
||||
$todo[] = $todor;
|
||||
}
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
|
||||
return $todo;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['tmpfname']))
|
||||
{
|
||||
$subtitle = T_("Result");
|
||||
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle);
|
||||
$todo = validate_bulk_appointment($_POST['tmpfname']);
|
||||
|
||||
if (is_array($todo))
|
||||
{
|
||||
$res = array();
|
||||
foreach($todo as $r)
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
//check the current case id exists and outcome is not final
|
||||
$sql = "SELECT c.case_id
|
||||
FROM `case` as c, `outcome` as o
|
||||
WHERE c.current_outcome_id = o.outcome_id
|
||||
AND o.outcome_type_id != 4
|
||||
AND c.case_id = {$r[0]}
|
||||
AND c.current_operator_id IS NULL";
|
||||
|
||||
$caseid = $db->GetOne($sql);
|
||||
|
||||
if (!empty($caseid))
|
||||
{
|
||||
//insert an appointment in respondent time
|
||||
$sql = "SELECT respondent_id
|
||||
FROM respondent
|
||||
WHERE case_id = {$r[0]}";
|
||||
|
||||
$rid = $db->GetOne($sql);
|
||||
|
||||
$sql = "SELECT contact_phone_id
|
||||
FROM contact_phone
|
||||
WHERE case_id = {$r[0]}
|
||||
ORDER BY priority ASC";
|
||||
|
||||
$cid = $db->GetOne($sql);
|
||||
|
||||
$oid = get_operator_id();
|
||||
|
||||
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end)
|
||||
VALUES (NULL,{$r[0]},$oid,$rid,CONVERT_TZ(NOW(),'System','UTC'),CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$call_attempt_id = $db->Insert_ID();
|
||||
|
||||
$sql = "INSERT INTO appointment (case_id,contact_phone_id,`start`,`end`,respondent_id,call_attempt_id)
|
||||
SELECT {$r[0]},$cid,CONVERT_TZ('{$r[1]}',Time_zone_name,'UTC'),CONVERT_TZ('{$r[2]}',Time_zone_name,'UTC'),$rid,$call_attempt_id
|
||||
FROM respondent
|
||||
WHERE respondent_id = $rid";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$aid = $db->Insert_ID();
|
||||
|
||||
//change the outcome to unspecified appointment, other
|
||||
$sql = "UPDATE `case`
|
||||
SET current_outcome_id = 22
|
||||
WHERE case_id = {$r[0]}";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//add a note if not blank
|
||||
if (!empty($r[3]))
|
||||
{
|
||||
$note = $db->qstr($r[3]);
|
||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,datetime)
|
||||
VALUES ({$r[0]},$oid,$note,CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
$cnote = T_("Added appointment") . " <a href='displayappointments?case_id={$r[0]}&appointment_id=$aid'>$aid</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cnote = T_("No such case id, or case set to a final outcome, or case currently assigned to an operator");
|
||||
}
|
||||
|
||||
$res[] = array("<a href='supervisor.php?case_id=" . $r[0] . "'>" . $r[0] . "</a>",$cnote);
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
xhtml_table($res,array(0,1),array(T_("Case id"),T_("Result")));
|
||||
}
|
||||
xhtml_foot();
|
||||
}
|
||||
else if (isset($_POST['import_file']))
|
||||
{
|
||||
//file has been submitted
|
||||
$subtitle = T_("Check data to submit");
|
||||
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle);
|
||||
?>
|
||||
<form action="" method="post" >
|
||||
<?php
|
||||
|
||||
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
|
||||
|
||||
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
|
||||
|
||||
$todo = validate_bulk_appointment($tmpfname);
|
||||
|
||||
if (is_array($todo) && !empty($todo)) {
|
||||
|
||||
print "<p class='well'>" . T_("Please check the case id's, appointment start and end times and notes are correct before accepting below") . "</p>";
|
||||
$todoh = array(T_("Case id"), T_("Start time"), T_("End time"), T_("Note"));
|
||||
xhtml_table($todo,array(0,1,2,3),$todoh);
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="tmpfname" value="<?php echo $tmpfname; ?>" />
|
||||
<input type="submit" name="import_file" value="<?php echo T_("Accept and generate bulk appointments"); ?>" class="btn btn-primary"/>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
print "<p class='well text-danger'>" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."</p>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//need to supply file to upload
|
||||
$subtitle = T_("Import: Select file to upload");
|
||||
xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/font-awesome/css/font-awesome.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../js/bootstrap-filestyle.min.js"),false,false,false,$subtitle );
|
||||
|
||||
$ua = $_SERVER['HTTP_USER_AGENT'];
|
||||
if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv";
|
||||
|
||||
?>
|
||||
|
||||
<p class="well"><?php echo T_("Provide a headered CSV file containing at least 3 columns - caseid, starttime and endtime. </br> Optionally you can include a note column to attach a note to the case in addition to setting an appointment. </br>Only cases that have temporary (non final) outcomes will have appointments generated, and the outcome of the case will be updated to an appointment outcome."); ?><p>
|
||||
|
||||
<div class="panel-body">
|
||||
<h5><u><?php echo T_("Example CSV file:"); ?></u></h5>
|
||||
<table class="table-bordered table-condensed form-group">
|
||||
<tr><th>caseid</th><th>starttime</th><th>endtime</th><th>note</th></tr>
|
||||
<tr><td>1</td><td>2012-08-15 11:00:00</td><td>2012-08-15 13:00:00</td><td>Appointment automatically generated</td></tr>
|
||||
<tr><td>2</td><td>2012-08-15 12:00:00</td><td>2012-08-15 14:00:00</td><td>Appointment automatically generated</td></tr>
|
||||
<tr><td>3</td><td>2012-08-15 13:00:00</td><td>2012-08-15 15:00:00</td><td>Appointment automatically generated</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
|
||||
|
||||
<h4 class="pull-left" ><?php echo T_("Select bulk appointment CSV file to upload"); ?>: </h4>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<input name="file" class="filestyle" type="file" required data-buttonBefore="true" data-iconName="fa fa-folder-open fa-lg text-primary " data-buttonText="<?php echo T_("Select file"); ?>" type="file" accept="<?php echo $csv; ?>"/> 
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" name="import_file" value=""><i class='fa fa-upload fa-lg'></i> <?php echo T_("Upload file"); ?></button>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,181 +1,181 @@
|
||||
<?php
|
||||
/**
|
||||
* Display a list of calls and outcomes for all calls
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage user
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/bs-data-table/css/jquery.bdt.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/bs-data-table/js/vendor/jquery.sortelements.js",
|
||||
"../include/bs-data-table/js/jquery.bdt.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
//List the case call history
|
||||
$operator_id = get_operator_id();
|
||||
/*
|
||||
Modified Call history list to have more information more suitable way with filtering, soring, paging and submenu for Cse history with asterisk records....
|
||||
Need to be linked with cdr records from asterisk!! for monitoring (requires addtional field for call_attempt table to request and store asterisk UniqueID as a reference to CDR .wav file list at /var/spool/asterisk/monitor/ )
|
||||
*/
|
||||
|
||||
if ($operator_id)
|
||||
{
|
||||
if (isset($_GET['questionnaire_id'])) $qid = $_GET['questionnaire_id'];
|
||||
if (isset($_GET['sample_import_id'])) $sid = $_GET['sample_import_id'];
|
||||
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".DATE_FORMAT."') as start_date, DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as start_time, DATE_FORMAT(CONVERT_TZ(c.end,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as end, o.description as descr, (CONCAT(r.firstName,' ',r.lastName)) as firstName, opp.firstName as opname,
|
||||
(SELECT GROUP_CONCAT(cn1.note SEPARATOR '</br>¶ ' ) FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes,";
|
||||
|
||||
if (isset($_GET['csv'])) $sql .= " c.case_id ";
|
||||
else $sql .= " CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') ";
|
||||
|
||||
$sql .= " as case_id, q.description as qd , contact_phone.phone as cpi, sample_import.description as spl
|
||||
FROM `call` as c
|
||||
JOIN (operator as op, respondent as r) on (op.operator_id = '$operator_id' and r.respondent_id = c.respondent_id)";
|
||||
if ($qid) $quest = "$qid and q.questionnaire_id= $qid"; else $quest = "q.questionnaire_id";
|
||||
if ($sid) $samimpid = "$sid and sample_import.sample_import_id=$sid"; else $samimpid = "sample_import.sample_import_id";
|
||||
|
||||
$sql .= "
|
||||
JOIN (`case` as ca, questionnaire as q) ON (ca.case_id = c.case_id AND ca.questionnaire_id = $quest)
|
||||
LEFT JOIN (outcome as o) on (c.outcome_id = o.outcome_id)
|
||||
LEFT JOIN (operator as opp) on (opp.operator_id = c.operator_id),
|
||||
contact_phone, sample_import, sample
|
||||
WHERE c.contact_phone_id = contact_phone.contact_phone_id AND sample.import_id = $samimpid
|
||||
AND sample.sample_id = ca.sample_id
|
||||
ORDER BY c.start DESC";
|
||||
|
||||
if (!isset($_GET['csv']))
|
||||
$sql .= " LIMIT 500";
|
||||
else $sql .= " LIMIT 5000";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
if (empty($rs))
|
||||
{
|
||||
print "<div class='alert alert-warning col-sm-6'><p>" . T_("No calls ever made") . "</p></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_GET['csv']))
|
||||
{
|
||||
$qds = str_replace(' ','_',$_GET['dq']); $smpds = str_replace(' ','_',$_GET['ds']);
|
||||
$fn = "callhistory-" . $qds . $smpds . date("_d-M-Y_H-i") . ".csv";
|
||||
|
||||
header("Content-Type: text/csv");
|
||||
header("Content-Disposition: attachment; filename=$fn");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
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("des"));
|
||||
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> " . 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("des"));
|
||||
|
||||
$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") . " ID: $qid</small> " . $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") . " ID: $sid</small> " . $ds . "</h3>";
|
||||
unset($datacol[5]); unset($headers[5]); }
|
||||
|
||||
print " <a href='?csv=csv&questionnaire_id=$qid&dq=" . $dq . "&sample_import_id=$sid&ds=" . $ds . "' class='btn btn-default pull-right'><i class='fa fa-download fa-lg text-primary'></i> " . T_("Download Call History List") . "</a>
|
||||
"; //<a href='../../admin/config.php' target='_blank' class='btn btn-default col-sm-offset-6 '><i class='fa fa-link fa-lg text-primary'></i> " . T_("Go to Call History Report") . "</a>
|
||||
|
||||
xhtml_table($rs,$datacol,$headers,"tclass",false,false,"bs-table");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<div class='alert alert-warning col-sm-6'>" . T_("No operator") . "</div>";
|
||||
}
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('#bs-table').bdt();
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Display a list of calls and outcomes for all calls
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage user
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/bs-data-table/css/jquery.bdt.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/bs-data-table/js/vendor/jquery.sortelements.js",
|
||||
"../include/bs-data-table/js/jquery.bdt.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
//List the case call history
|
||||
$operator_id = get_operator_id();
|
||||
/*
|
||||
Modified Call history list to have more information more suitable way with filtering, soring, paging and submenu for Cse history with asterisk records....
|
||||
Need to be linked with cdr records from asterisk!! for monitoring (requires addtional field for call_attempt table to request and store asterisk UniqueID as a reference to CDR .wav file list at /var/spool/asterisk/monitor/ )
|
||||
*/
|
||||
|
||||
if ($operator_id)
|
||||
{
|
||||
if (isset($_GET['questionnaire_id'])) $qid = $_GET['questionnaire_id'];
|
||||
if (isset($_GET['sample_import_id'])) $sid = $_GET['sample_import_id'];
|
||||
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".DATE_FORMAT."') as start_date, DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as start_time, DATE_FORMAT(CONVERT_TZ(c.end,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as end, o.description as descr, (CONCAT(r.firstName,' ',r.lastName)) as firstName, opp.firstName as opname,
|
||||
(SELECT GROUP_CONCAT(cn1.note SEPARATOR '</br>¶ ' ) FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes,";
|
||||
|
||||
if (isset($_GET['csv'])) $sql .= " c.case_id ";
|
||||
else $sql .= " CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') ";
|
||||
|
||||
$sql .= " as case_id, q.description as qd , contact_phone.phone as cpi, sample_import.description as spl
|
||||
FROM `call` as c
|
||||
JOIN (operator as op, respondent as r) on (op.operator_id = '$operator_id' and r.respondent_id = c.respondent_id)";
|
||||
if ($qid) $quest = "$qid and q.questionnaire_id= $qid"; else $quest = "q.questionnaire_id";
|
||||
if ($sid) $samimpid = "$sid and sample_import.sample_import_id=$sid"; else $samimpid = "sample_import.sample_import_id";
|
||||
|
||||
$sql .= "
|
||||
JOIN (`case` as ca, questionnaire as q) ON (ca.case_id = c.case_id AND ca.questionnaire_id = $quest)
|
||||
LEFT JOIN (outcome as o) on (c.outcome_id = o.outcome_id)
|
||||
LEFT JOIN (operator as opp) on (opp.operator_id = c.operator_id),
|
||||
contact_phone, sample_import, sample
|
||||
WHERE c.contact_phone_id = contact_phone.contact_phone_id AND sample.import_id = $samimpid
|
||||
AND sample.sample_id = ca.sample_id
|
||||
ORDER BY c.start DESC";
|
||||
|
||||
if (!isset($_GET['csv']))
|
||||
$sql .= " LIMIT 500";
|
||||
else $sql .= " LIMIT 5000";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
if (empty($rs))
|
||||
{
|
||||
print "<div class='alert alert-warning col-sm-6'><p>" . T_("No calls ever made") . "</p></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_GET['csv']))
|
||||
{
|
||||
$qds = str_replace(' ','_',$_GET['dq']); $smpds = str_replace(' ','_',$_GET['ds']);
|
||||
$fn = "callhistory-" . $qds . $smpds . date("_d-M-Y_H-i") . ".csv";
|
||||
|
||||
header("Content-Type: text/csv");
|
||||
header("Content-Disposition: attachment; filename=$fn");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
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("des"));
|
||||
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> " . 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("des"));
|
||||
|
||||
$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") . " ID: $qid</small> " . $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") . " ID: $sid</small> " . $ds . "</h3>";
|
||||
unset($datacol[5]); unset($headers[5]); }
|
||||
|
||||
print " <a href='?csv=csv&questionnaire_id=$qid&dq=" . $dq . "&sample_import_id=$sid&ds=" . $ds . "' class='btn btn-default pull-right'><i class='fa fa-download fa-lg text-primary'></i> " . T_("Download Call History List") . "</a>
|
||||
"; //<a href='../../admin/config.php' target='_blank' class='btn btn-default col-sm-offset-6 '><i class='fa fa-link fa-lg text-primary'></i> " . T_("Go to Call History Report") . "</a>
|
||||
|
||||
xhtml_table($rs,$datacol,$headers,"tclass",false,false,"bs-table");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<div class='alert alert-warning col-sm-6'>" . T_("No operator") . "</div>";
|
||||
}
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('#bs-table').bdt();
|
||||
</script>
|
||||
|
||||
@@ -1,163 +1,163 @@
|
||||
<?php
|
||||
/**
|
||||
* Modify the call restriction times
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
//"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../js/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM call_restrict
|
||||
WHERE 1";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO call_restrict (day_of_week,start,end)
|
||||
VALUES ('$val',$start,$end)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Set call restriction times"),true,$css,$js_head);//,array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
print "<div class='well'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
||||
|
||||
/**
|
||||
* Begin displaying currently loaded restriction times
|
||||
*/
|
||||
|
||||
$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
|
||||
FROM call_restrict";
|
||||
|
||||
$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
|
||||
FROM day_of_week";
|
||||
|
||||
$daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
||||
<table class="table-hover table-condensed " id="restrict"><thead class="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><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$shift['start']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" 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);
|
||||
print "</td><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"08:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"20:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Modify the call restriction times
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
//"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
"../js/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM call_restrict
|
||||
WHERE 1";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO call_restrict (day_of_week,start,end)
|
||||
VALUES ('$val',$start,$end)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Set call restriction times"),true,$css,$js_head);//,array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
|
||||
print "<div class='well'>" . T_("Enter the start and end times for each day of the week to restrict calls within") . "</div>";
|
||||
|
||||
/**
|
||||
* Begin displaying currently loaded restriction times
|
||||
*/
|
||||
|
||||
$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
|
||||
FROM call_restrict";
|
||||
|
||||
$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
|
||||
FROM day_of_week";
|
||||
|
||||
$daysofweek = $db->GetAll($sql);
|
||||
translate_array($daysofweek,array("description"));
|
||||
|
||||
?>
|
||||
<div class=" panel-body col-sm-4"><form method="post" action="">
|
||||
<table class="table-hover table-condensed " id="restrict"><thead class="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><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"{$shift['start']}\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" 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);
|
||||
print "</td><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" name=\"start[$count]\" maxlength=\"8\" type=\"text\" value=\"08:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" name=\"end[$count]\" type=\"text\" size=\"8\" maxlength=\"8\" value=\"20:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,121 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* Display a list of cases for a questionnaire based on the current outcome
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2012
|
||||
* @package queXS
|
||||
* @subpackage user
|
||||
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
xhtml_head(T_("Cases by outcome"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"));
|
||||
|
||||
print "<div class='col-sm-3'><a onclick='history.back();return false;' href='' class='btn btn-default'> " . T_("Go back") . " </a></div>";
|
||||
|
||||
//List the cases by outcome
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
if ($operator_id)
|
||||
{
|
||||
//get the outcome and the questionnaire
|
||||
$outcome_id = intval($_GET['outcome_id']);
|
||||
$questionnaire_id = intval($_GET['questionnaire_id']);
|
||||
$sql = "SELECT o.description, q.description as qd
|
||||
FROM `outcome` as o, questionnaire as q
|
||||
WHERE o.outcome_id = '$outcome_id'
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs)){
|
||||
print "<h2 class=' '>" . T_("Project") . ": <span class='text-primary'>{$rs['qd']}</span></h2>";
|
||||
if($sample_import_id=intval($_GET['sample_import_id'])){
|
||||
$sql = "SELECT si.description as sd
|
||||
FROM `sample_import` as si
|
||||
WHERE si.sample_import_id = '$sample_import_id' ;";
|
||||
$sd = $db->GetRow($sql);
|
||||
print "<h3>". T_("Sample:") ." <span class='text-primary'>" . T_($sd['sd']) . "</span></h3>";
|
||||
$sid = "AND s.import_id= '$sample_import_id'";
|
||||
}
|
||||
else{$sid = " ";};
|
||||
|
||||
if($oper_id= intval($_GET['oper_id'])){
|
||||
$sql = "SELECT CONCAT(op.firstname, op.lastname) as opname
|
||||
FROM `operator` as op
|
||||
WHERE op.operator_id = '$oper_id' ;";
|
||||
$on = $db->GetRow($sql);
|
||||
print "<h3>". T_("Operator") ." : " . T_($on['opname']) . "</h3> oper_id = $oper_id ";
|
||||
$opn = "AND c.current_operator_id= '$oper_id'";
|
||||
}
|
||||
else{$opn = " ";};
|
||||
|
||||
print "<h3 class=' '>". T_("Current outcome:") ." <span class='text-primary'>" . T_($rs['description']) . "</span></h3>";
|
||||
|
||||
$sql = "SELECT CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id
|
||||
FROM `case` as c
|
||||
LEFT JOIN `sample` as s ON ( s.sample_id = c.sample_id )
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.current_outcome_id = '$outcome_id'
|
||||
$sid
|
||||
$opn
|
||||
LIMIT 500";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
print "<div class='panel-body col-sm-4' style='max-height:750px; overflow:auto;'>";
|
||||
if (empty($rs))
|
||||
print "<p>" . T_("No cases with this outcome") . "</p>";
|
||||
else
|
||||
{
|
||||
xhtml_table($rs,array("case_id"),array(T_("Case ID")));
|
||||
}
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("Error with input") . "</p>";
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No operator") . "</p>";
|
||||
print "</div>";
|
||||
|
||||
xhtml_foot();
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Display a list of cases for a questionnaire based on the current outcome
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2012
|
||||
* @package queXS
|
||||
* @subpackage user
|
||||
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
xhtml_head(T_("Cases by outcome"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"));
|
||||
|
||||
print "<div class='col-sm-3'><a onclick='history.back();return false;' href='' class='btn btn-default'> " . T_("Go back") . " </a></div>";
|
||||
|
||||
//List the cases by outcome
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
if ($operator_id)
|
||||
{
|
||||
//get the outcome and the questionnaire
|
||||
$outcome_id = intval($_GET['outcome_id']);
|
||||
$questionnaire_id = intval($_GET['questionnaire_id']);
|
||||
$sql = "SELECT o.description, q.description as qd
|
||||
FROM `outcome` as o, questionnaire as q
|
||||
WHERE o.outcome_id = '$outcome_id'
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs)){
|
||||
print "<h2 class=' '>" . T_("Project") . ": <span class='text-primary'>{$rs['qd']}</span></h2>";
|
||||
if($sample_import_id=intval($_GET['sample_import_id'])){
|
||||
$sql = "SELECT si.description as sd
|
||||
FROM `sample_import` as si
|
||||
WHERE si.sample_import_id = '$sample_import_id' ;";
|
||||
$sd = $db->GetRow($sql);
|
||||
print "<h3>". T_("Sample:") ." <span class='text-primary'>" . T_($sd['sd']) . "</span></h3>";
|
||||
$sid = "AND s.import_id= '$sample_import_id'";
|
||||
}
|
||||
else{$sid = " ";};
|
||||
|
||||
if($oper_id= intval($_GET['oper_id'])){
|
||||
$sql = "SELECT CONCAT(op.firstname, op.lastname) as opname
|
||||
FROM `operator` as op
|
||||
WHERE op.operator_id = '$oper_id' ;";
|
||||
$on = $db->GetRow($sql);
|
||||
print "<h3>". T_("Operator") ." : " . T_($on['opname']) . "</h3> oper_id = $oper_id ";
|
||||
$opn = "AND c.current_operator_id= '$oper_id'";
|
||||
}
|
||||
else{$opn = " ";};
|
||||
|
||||
print "<h3 class=' '>". T_("Current outcome:") ." <span class='text-primary'>" . T_($rs['description']) . "</span></h3>";
|
||||
|
||||
$sql = "SELECT CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id
|
||||
FROM `case` as c
|
||||
LEFT JOIN `sample` as s ON ( s.sample_id = c.sample_id )
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.current_outcome_id = '$outcome_id'
|
||||
$sid
|
||||
$opn
|
||||
LIMIT 500";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
print "<div class='panel-body col-sm-4' style='max-height:750px; overflow:auto;'>";
|
||||
if (empty($rs))
|
||||
print "<p>" . T_("No cases with this outcome") . "</p>";
|
||||
else
|
||||
{
|
||||
xhtml_table($rs,array("case_id"),array(T_("Case ID")));
|
||||
}
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("Error with input") . "</p>";
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No operator") . "</p>";
|
||||
print "</div>";
|
||||
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
@@ -1,254 +1,252 @@
|
||||
<?php /**
|
||||
* Display a list of cases including status. Allow for assigning to operators in a queue
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/bs-data-table/css/jquery.bdt.css",
|
||||
//"../include/iCheck/skins/square/blue.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/bs-data-table/js/vendor/jquery.sortelements.js",
|
||||
"../include/bs-data-table/js/jquery.bdt.js",
|
||||
"../include/iCheck/icheck.min.js",
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
/**
|
||||
* 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 <adam.zammit@acspri.org.au>
|
||||
* @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 CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
o.description as outcomes,
|
||||
si.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,
|
||||
CASE WHEN ca.end IS NULL THEN '" . TQ_("Available") . "'
|
||||
WHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Available") . "'
|
||||
ELSE CONCAT(ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60),' " . TQ_("minutes") . "')
|
||||
END AS availableinmin,
|
||||
CASE WHEN oq.operator_id IS NULL THEN
|
||||
CONCAT('')
|
||||
ELSE CONCAT('<span class=\'text-info\'>', oq.firstName,' ',oq.lastName,'</span>')
|
||||
END AS assignedoperator,
|
||||
CASE WHEN oq.operator_id IS NULL THEN
|
||||
CONCAT('')
|
||||
ELSE CONCAT('   ', cq.sortorder ,' ')
|
||||
END AS ordr,
|
||||
CASE WHEN oq.operator_id IS NULL THEN
|
||||
CONCAT('<span data-toggle=\'tooltip\' title=\'" . TQ_("Not assigned, select to assign") . "\'><input type=\'checkbox\' name=\'c', c.case_id, '\' value=\'', c.case_id, '\' /></span>')
|
||||
ELSE CONCAT('<a href=\"?questionnaire_id=$questionnaire_id&sample_import_id=$sample_id&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>')
|
||||
END AS flag
|
||||
FROM `case` as c
|
||||
JOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1)
|
||||
JOIN outcome as o ON (o.outcome_id = c.current_outcome_id AND o.outcome_type_id = 1)
|
||||
JOIN sample as s ON (s.sample_id = c.sample_id $s)
|
||||
JOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1)
|
||||
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = $questionnaire_id AND qs.sample_import_id = s.import_id)
|
||||
LEFT JOIN `call` as ca ON (ca.call_id = c.last_call_id)
|
||||
LEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_id)
|
||||
LEFT JOIN case_queue as cq ON (cq.case_id = c.case_id)
|
||||
LEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id)
|
||||
WHERE c.current_operator_id IS NULL $q $o
|
||||
ORDER BY c.case_id ASC";
|
||||
|
||||
// print $sql;
|
||||
|
||||
print ("<form method=\"post\" action=\"?questionnaire_id=$questionnaire_id&sample_import_id=$sample_id\">");
|
||||
|
||||
$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($db->GetAll($sql),$datacol,$headers,"tclass",false,false,"bs-table");
|
||||
|
||||
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected
|
||||
FROM operator
|
||||
WHERE enabled = 1";
|
||||
|
||||
$rs3 = $db->GetAll($sql);
|
||||
|
||||
print "<h4 class='col-sm-offset-5 pull-left text-right control-label'>" . T_("Assign selected cases to") . " " . T_("operator") . " : </h4> ";
|
||||
display_chooser($rs3, "operator_id", "operator_id",true,false,false,true,false,true,"pull-left");
|
||||
|
||||
print " <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> " . T_("Assign") . "</button>";
|
||||
print "</form></br>";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isset($_POST['operator_id']) && !empty($_POST['operator_id']))
|
||||
{
|
||||
$operator_id = intval($_POST['operator_id']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "SELECT MAX(sortorder)
|
||||
FROM case_queue
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$sortorder = $db->GetOne($sql);
|
||||
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
$sortorder++;
|
||||
|
||||
if (substr($key,0,1) == "c")
|
||||
{
|
||||
$sql = "INSERT INTO case_queue (case_id,operator_id,sortorder)
|
||||
VALUES ('" . bigintval($val) . "', '$operator_id', '$sortorder')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
if (isset($_GET['unassign']))
|
||||
{
|
||||
$case_queue_id = bigintval($_GET['unassign']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "SELECT operator_id
|
||||
FROM case_queue
|
||||
WHERE case_queue_id = '$case_queue_id'";
|
||||
|
||||
$operator_id = $db->GetOne($sql);
|
||||
|
||||
$sql = "DELETE FROM case_queue
|
||||
WHERE case_queue_id = '$case_queue_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "SELECT case_queue_id
|
||||
FROM case_queue
|
||||
WHERE operator_id = '$operator_id'
|
||||
ORDER BY sortorder ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$sortorder = 1;
|
||||
foreach($rs as $r)
|
||||
{
|
||||
$sql = "UPDATE case_queue
|
||||
SET sortorder = '$sortorder'
|
||||
WHERE case_queue_id = '{$r['case_queue_id']}'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sortorder++;
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Case status and assignment"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i> " . T_("Go back") . "</a>
|
||||
<i class='fa fa-question-circle fa-3x text-primary pull-right btn' data-toggle='modal' data-target='.inform'></i>";
|
||||
?>
|
||||
<div class="modal fade inform" id="inform" tabindex="-1" role="dialog" aria-labelledby="inform" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title"><small class="text-info"><?php echo T_("INFORMATION");?></small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php echo T_("List cases by questionnaire and sample with the ability to assign them to be called next in a queue by a particular operator. <br/>If you assign cases to an operator, it will override the normal scheduling process and call them as soon as the operator is available.");?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info" data-dismiss="modal"><?php echo T_("OK");?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id']) && !empty($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$outcome_id = false;
|
||||
|
||||
print "<div class='form-group '><h3 class=' col-sm-2 text-right'>" . T_("Questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id, false, "pull-left", "form-control");
|
||||
|
||||
|
||||
if ($questionnaire_id){
|
||||
print "<h3 class=' col-sm-2 text-right'>" . T_("Sample") . ":</h3>";
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id,false, "pull-left", "form-control");
|
||||
print "</div>
|
||||
<div class='clearfix'></div>";
|
||||
|
||||
case_status_report($questionnaire_id,$sample_import_id,$outcome_id);
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('#bs-table').bdt();
|
||||
$('input').iCheck({
|
||||
//checkboxClass: 'icheckbox_square-blue',
|
||||
//increaseArea: '30%'
|
||||
checkboxClass: 'fa fa-lg ', // text-primary
|
||||
checkedCheckboxClass: 'fa-check-square-o text-primary',
|
||||
uncheckedCheckboxClass: 'fa-square-o'
|
||||
});
|
||||
</script>
|
||||
<?php /**
|
||||
* Display a list of cases including status. Allow for assigning to operators in a queue
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/bs-data-table/css/jquery.bdt.css",
|
||||
//"../include/iCheck/skins/square/blue.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/bs-data-table/js/vendor/jquery.sortelements.js",
|
||||
"../include/bs-data-table/js/jquery.bdt.js",
|
||||
"../include/iCheck/icheck.min.js",
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
/**
|
||||
* 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 <adam.zammit@acspri.org.au>
|
||||
* @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 CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
o.description as outcomes,
|
||||
si.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,
|
||||
CASE WHEN ca.end IS NULL THEN '" . TQ_("Available") . "'
|
||||
WHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Available") . "'
|
||||
ELSE CONCAT(ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60),' " . TQ_("minutes") . "')
|
||||
END AS availableinmin,
|
||||
CASE WHEN oq.operator_id IS NULL THEN
|
||||
CONCAT('')
|
||||
ELSE CONCAT('<span class=\'text-info\'>', oq.firstName,' ',oq.lastName,'</span>')
|
||||
END AS assignedoperator,
|
||||
CASE WHEN oq.operator_id IS NULL THEN
|
||||
CONCAT('')
|
||||
ELSE CONCAT('   ', cq.sortorder ,' ')
|
||||
END AS ordr,
|
||||
CASE WHEN oq.operator_id IS NULL THEN
|
||||
CONCAT('<span data-toggle=\'tooltip\' title=\'" . TQ_("Not assigned, select to assign") . "\'><input type=\'checkbox\' name=\'c', c.case_id, '\' value=\'', c.case_id, '\' /></span>')
|
||||
ELSE CONCAT('<a href=\"?questionnaire_id=$questionnaire_id&sample_import_id=$sample_id&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>')
|
||||
END AS flag
|
||||
FROM `case` as c
|
||||
JOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1)
|
||||
JOIN outcome as o ON (o.outcome_id = c.current_outcome_id AND o.outcome_type_id = 1)
|
||||
JOIN sample as s ON (s.sample_id = c.sample_id $s)
|
||||
JOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1)
|
||||
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = $questionnaire_id AND qs.sample_import_id = s.import_id)
|
||||
LEFT JOIN `call` as ca ON (ca.call_id = c.last_call_id)
|
||||
LEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_id)
|
||||
LEFT JOIN case_queue as cq ON (cq.case_id = c.case_id)
|
||||
LEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id)
|
||||
WHERE c.current_operator_id IS NULL $q $o
|
||||
ORDER BY c.case_id ASC";
|
||||
|
||||
// print $sql;
|
||||
|
||||
print ("<form method=\"post\" action=\"?questionnaire_id=$questionnaire_id&sample_import_id=$sample_id\">");
|
||||
|
||||
$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($db->GetAll($sql),$datacol,$headers,"tclass",false,false,"bs-table");
|
||||
|
||||
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected
|
||||
FROM operator
|
||||
WHERE enabled = 1";
|
||||
|
||||
$rs3 = $db->GetAll($sql);
|
||||
|
||||
print "<h4 class='col-sm-offset-5 pull-left text-right control-label'>" . T_("Assign selected cases to") . " " . T_("operator") . " : </h4> ";
|
||||
display_chooser($rs3, "operator_id", "operator_id",true,false,false,true,false,true,"pull-left");
|
||||
|
||||
print " <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> " . T_("Assign") . "</button>";
|
||||
print "</form></br>";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isset($_POST['operator_id']) && !empty($_POST['operator_id']))
|
||||
{
|
||||
$operator_id = intval($_POST['operator_id']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "SELECT MAX(sortorder)
|
||||
FROM case_queue
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$sortorder = $db->GetOne($sql);
|
||||
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
$sortorder++;
|
||||
|
||||
if (substr($key,0,1) == "c")
|
||||
{
|
||||
$sql = "INSERT INTO case_queue (case_id,operator_id,sortorder)
|
||||
VALUES ('" . bigintval($val) . "', '$operator_id', '$sortorder')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
if (isset($_GET['unassign']))
|
||||
{
|
||||
$case_queue_id = bigintval($_GET['unassign']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "SELECT operator_id
|
||||
FROM case_queue
|
||||
WHERE case_queue_id = '$case_queue_id'";
|
||||
|
||||
$operator_id = $db->GetOne($sql);
|
||||
|
||||
$sql = "DELETE FROM case_queue
|
||||
WHERE case_queue_id = '$case_queue_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "SELECT case_queue_id
|
||||
FROM case_queue
|
||||
WHERE operator_id = '$operator_id'
|
||||
ORDER BY sortorder ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$sortorder = 1;
|
||||
foreach($rs as $r)
|
||||
{
|
||||
$sql = "UPDATE case_queue
|
||||
SET sortorder = '$sortorder'
|
||||
WHERE case_queue_id = '{$r['case_queue_id']}'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
$sortorder++;
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Case status and assignment"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i> " . T_("Go back") . "</a>
|
||||
<i class='fa fa-question-circle fa-3x text-primary pull-right btn' data-toggle='modal' data-target='.inform'></i>";
|
||||
?>
|
||||
<div class="modal fade inform" id="inform" tabindex="-1" role="dialog" aria-labelledby="inform" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title"><small class="text-info"><?php echo T_("INFORMATION");?></small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php echo T_("List cases by questionnaire and sample with the ability to assign them to be called next in a queue by a particular operator. <br/>If you assign cases to an operator, it will override the normal scheduling process and call them as soon as the operator is available.");?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info" data-dismiss="modal"><?php echo T_("OK");?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id']) && !empty($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$outcome_id = false;
|
||||
|
||||
print "<div class='form-group '><h3 class=' col-sm-2 text-right'>" . T_("Questionnaire") . ":</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id, false, "pull-left", "form-control");
|
||||
if ($questionnaire_id){
|
||||
print "<h3 class=' col-sm-2 text-right'>" . T_("Sample") . ":</h3>";
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id,false, "pull-left", "form-control");
|
||||
print "</div>
|
||||
<div class='clearfix'></div>";
|
||||
|
||||
case_status_report($questionnaire_id,$sample_import_id,$outcome_id);
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('#bs-table').bdt();
|
||||
$('input').iCheck({
|
||||
//checkboxClass: 'icheckbox_square-blue',
|
||||
//increaseArea: '30%'
|
||||
checkboxClass: 'fa fa-lg ', // text-primary
|
||||
checkedCheckboxClass: 'fa-check-square-o text-primary',
|
||||
uncheckedCheckboxClass: 'fa-square-o'
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Set information about this centre for diplay to operators
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* CKEditor
|
||||
*/
|
||||
include("../include/ckeditor/ckeditor.php");
|
||||
|
||||
global $db;
|
||||
|
||||
$CKEditor = new CKEditor();
|
||||
$CKEditor->basePath = "../include/ckeditor/";
|
||||
|
||||
if (isset($_POST['information']))
|
||||
{
|
||||
set_setting("information",$_POST['information']);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Set centre information"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
?>
|
||||
<form action="" method="post" class="panel-body">
|
||||
<!-- <label for="information"><?php //echo T_("Set centre information: "); ?></label> -->
|
||||
<?php echo $CKEditor->editor("information",get_setting("information")); ?>
|
||||
<br/><input class="btn btn-primary" type="submit" name="update" value="<?php echo T_("Update centre information"); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Set information about this centre for diplay to operators
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* CKEditor
|
||||
*/
|
||||
include("../include/ckeditor/ckeditor.php");
|
||||
|
||||
global $db;
|
||||
|
||||
$CKEditor = new CKEditor();
|
||||
$CKEditor->basePath = "../include/ckeditor/";
|
||||
|
||||
if (isset($_POST['information']))
|
||||
{
|
||||
set_setting("information",$_POST['information']);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Set centre information"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
?>
|
||||
<form action="" method="post" class="panel-body">
|
||||
<!-- <label for="information"><?php //echo T_("Set centre information: "); ?></label> -->
|
||||
<?php echo $CKEditor->editor("information",get_setting("information")); ?>
|
||||
<br/><input class="btn btn-primary" type="submit" name="update" value="<?php echo T_("Update centre information"); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
@@ -1,274 +1,274 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign clients to questionnaires in a checkbox matrix
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Return if an client has already been assigned to this questionnaire
|
||||
*
|
||||
* @param int $client Client id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
* @return int 1 if assigned otherwise 0
|
||||
*
|
||||
*/
|
||||
function vq($client_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT client_id,questionnaire_id
|
||||
FROM client_questionnaire
|
||||
WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$vq = $db->Execute($sql);
|
||||
|
||||
if ($vq)
|
||||
return $vq->RecordCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an client to a questionnaire
|
||||
*
|
||||
* @param int $client_id Client id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqi($client_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "INSERT INTO
|
||||
client_questionnaire (client_id,questionnaire_id)
|
||||
VALUES('$client_id','$questionnaire_id')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unassign an client from a questionnaire
|
||||
*
|
||||
* @param int $client_id Client id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqd($client_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "DELETE FROM
|
||||
client_questionnaire
|
||||
WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE
|
||||
FROM client_questionnaire
|
||||
WHERE questionnaire_id IN (
|
||||
SELECT questionnaire_id
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach ($_POST as $g => $v)
|
||||
{
|
||||
$a = explode("_",$g);
|
||||
if ($a[0] == "cb")
|
||||
vqi($a[2],$a[1]);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT questionnaire_id,description
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1
|
||||
ORDER by questionnaire_id ASC";
|
||||
|
||||
$questionnaires = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username
|
||||
FROM client
|
||||
ORDER by client_id ASC";
|
||||
|
||||
$clients = $db->GetAll($sql);
|
||||
|
||||
|
||||
xhtml_head(T_("Assign clients to questionnaires"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/iCheck/icheck.min.js"));
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
print "questionnaire_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$s .= "'{$q['questionnaire_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
print "client_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($clients as $q)
|
||||
{
|
||||
$s .= "'{$q['client_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
?>
|
||||
|
||||
var QidOn = 0;
|
||||
var VidOn = 0;
|
||||
|
||||
function checkQid(q)
|
||||
{
|
||||
|
||||
for (y in client_id)
|
||||
{
|
||||
v = client_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (QidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (QidOn == 0)
|
||||
QidOn = 1;
|
||||
else
|
||||
QidOn = 0;
|
||||
}
|
||||
|
||||
|
||||
function checkVid(v)
|
||||
{
|
||||
|
||||
for (y in questionnaire_id)
|
||||
{
|
||||
q = questionnaire_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (VidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (VidOn == 0)
|
||||
VidOn = 1;
|
||||
else
|
||||
VidOn = 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||
|
||||
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Client") . " </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
|
||||
}
|
||||
print "</tr></thead>";
|
||||
|
||||
|
||||
foreach($clients as $v)
|
||||
{
|
||||
print "<tr class=''>
|
||||
<th> {$v['username']} </th>
|
||||
<th> <a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a> </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$checked = "";
|
||||
if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"checked\"";
|
||||
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" $checked></input></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></form>";
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Assign clients to questionnaires in a checkbox matrix
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Return if an client has already been assigned to this questionnaire
|
||||
*
|
||||
* @param int $client Client id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
* @return int 1 if assigned otherwise 0
|
||||
*
|
||||
*/
|
||||
function vq($client_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT client_id,questionnaire_id
|
||||
FROM client_questionnaire
|
||||
WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$vq = $db->Execute($sql);
|
||||
|
||||
if ($vq)
|
||||
return $vq->RecordCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an client to a questionnaire
|
||||
*
|
||||
* @param int $client_id Client id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqi($client_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "INSERT INTO
|
||||
client_questionnaire (client_id,questionnaire_id)
|
||||
VALUES('$client_id','$questionnaire_id')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unassign an client from a questionnaire
|
||||
*
|
||||
* @param int $client_id Client id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqd($client_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "DELETE FROM
|
||||
client_questionnaire
|
||||
WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE
|
||||
FROM client_questionnaire
|
||||
WHERE questionnaire_id IN (
|
||||
SELECT questionnaire_id
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach ($_POST as $g => $v)
|
||||
{
|
||||
$a = explode("_",$g);
|
||||
if ($a[0] == "cb")
|
||||
vqi($a[2],$a[1]);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT questionnaire_id,description
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1
|
||||
ORDER by questionnaire_id ASC";
|
||||
|
||||
$questionnaires = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username
|
||||
FROM client
|
||||
ORDER by client_id ASC";
|
||||
|
||||
$clients = $db->GetAll($sql);
|
||||
|
||||
|
||||
xhtml_head(T_("Assign clients to questionnaires"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/iCheck/icheck.min.js"));
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
print "questionnaire_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$s .= "'{$q['questionnaire_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
print "client_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($clients as $q)
|
||||
{
|
||||
$s .= "'{$q['client_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
?>
|
||||
|
||||
var QidOn = 0;
|
||||
var VidOn = 0;
|
||||
|
||||
function checkQid(q)
|
||||
{
|
||||
|
||||
for (y in client_id)
|
||||
{
|
||||
v = client_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (QidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (QidOn == 0)
|
||||
QidOn = 1;
|
||||
else
|
||||
QidOn = 0;
|
||||
}
|
||||
|
||||
|
||||
function checkVid(v)
|
||||
{
|
||||
|
||||
for (y in questionnaire_id)
|
||||
{
|
||||
q = questionnaire_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (VidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (VidOn == 0)
|
||||
VidOn = 1;
|
||||
else
|
||||
VidOn = 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||
|
||||
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Client") . " </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
|
||||
}
|
||||
print "</tr></thead>";
|
||||
|
||||
|
||||
foreach($clients as $v)
|
||||
{
|
||||
print "<tr class=''>
|
||||
<th> {$v['username']} </th>
|
||||
<th> <a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a> </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$checked = "";
|
||||
if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"checked\"";
|
||||
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" $checked></input></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></form>";
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,179 +1,179 @@
|
||||
<?php
|
||||
/**
|
||||
* Create a client and link to a webserver username for authentication
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
* @todo Make timezone a drop down list
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
global $db;
|
||||
|
||||
$a = false;
|
||||
|
||||
if (isset($_POST['client']))
|
||||
{
|
||||
$client = $db->qstr($_POST['client'],get_magic_quotes_gpc());
|
||||
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
|
||||
$lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc());
|
||||
$time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
|
||||
|
||||
if (!empty($_POST['client']))
|
||||
{
|
||||
$sql = "INSERT INTO client
|
||||
(`client_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`)
|
||||
VALUES (NULL , $client, $firstname , $lastname, $time_zone_name);";
|
||||
|
||||
if ($db->Execute($sql))
|
||||
{
|
||||
if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false)
|
||||
{
|
||||
//Get password and add it to the configured htpassword
|
||||
include_once("../functions/functions.htpasswd.php");
|
||||
$htp = New Htpasswd(HTPASSWD_PATH);
|
||||
$htg = New Htgroup(HTGROUP_PATH);
|
||||
|
||||
$htp->addUser($_POST['client'],$_POST['password']);
|
||||
$htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT);
|
||||
}
|
||||
|
||||
$a = T_("Added: $client");
|
||||
}
|
||||
else
|
||||
$a = T_("Could not add") . " " . $client . ". " . T_("There may already be a client of this name");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Add a client"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"));
|
||||
|
||||
$sql = "SELECT Time_zone_name as value, Time_zone_name as description
|
||||
FROM timezone_template";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
|
||||
if ($a)
|
||||
{
|
||||
?>
|
||||
<div class='alert alert-info'><?php echo $a; ?></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.addclient.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.addclient.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="well">
|
||||
<p><?php echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> <a href="clientquestionnaire.php"><?php echo T_("Assign client to Questionnaire"); ?></a> <?php echo T_("tool."); ?></p>
|
||||
<p><?php echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p></div>
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal" name="addclient" >
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the username of a client to add:"); ?></label>
|
||||
<input name="client" type="text" class="form-control pull-left" required size="40" />
|
||||
</div>
|
||||
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the password of a client to add:"); ?></label>
|
||||
<input name="password" type="text" class="form-control pull-left" size="40" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" />
|
||||
<div class="form-inline">  
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("Password with");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the first name of a client to add:"); ?></label>
|
||||
<input name="firstname" type="text" class="form-control pull-left" size="40" />
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the surname of a client to add:"); ?></label>
|
||||
<input name="lastname" type="text" class="form-control pull-left" size="40"/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a></label>";
|
||||
display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"pull-left"); ?>
|
||||
</div>
|
||||
<input type="submit" value="<?php echo T_("Add a client"); ?>" class="btn btn-primary col-sm-offset-3 col-sm-3"/>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Create a client and link to a webserver username for authentication
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
* @todo Make timezone a drop down list
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
global $db;
|
||||
|
||||
$a = false;
|
||||
|
||||
if (isset($_POST['client']))
|
||||
{
|
||||
$client = $db->qstr($_POST['client'],get_magic_quotes_gpc());
|
||||
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
|
||||
$lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc());
|
||||
$time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
|
||||
|
||||
if (!empty($_POST['client']))
|
||||
{
|
||||
$sql = "INSERT INTO client
|
||||
(`client_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`)
|
||||
VALUES (NULL , $client, $firstname , $lastname, $time_zone_name);";
|
||||
|
||||
if ($db->Execute($sql))
|
||||
{
|
||||
if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false)
|
||||
{
|
||||
//Get password and add it to the configured htpassword
|
||||
include_once("../functions/functions.htpasswd.php");
|
||||
$htp = New Htpasswd(HTPASSWD_PATH);
|
||||
$htg = New Htgroup(HTGROUP_PATH);
|
||||
|
||||
$htp->addUser($_POST['client'],$_POST['password']);
|
||||
$htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT);
|
||||
}
|
||||
|
||||
$a = T_("Added: $client");
|
||||
}
|
||||
else
|
||||
$a = T_("Could not add") . " " . $client . ". " . T_("There may already be a client of this name");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Add a client"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"));
|
||||
|
||||
$sql = "SELECT Time_zone_name as value, Time_zone_name as description
|
||||
FROM timezone_template";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
|
||||
if ($a)
|
||||
{
|
||||
?>
|
||||
<div class='alert alert-info'><?php echo $a; ?></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.addclient.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.addclient.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="well">
|
||||
<p><?php echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> <a href="clientquestionnaire.php"><?php echo T_("Assign client to Questionnaire"); ?></a> <?php echo T_("tool."); ?></p>
|
||||
<p><?php echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?></p></div>
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal" name="addclient" >
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the username of a client to add:"); ?></label>
|
||||
<input name="client" type="text" class="form-control pull-left" required size="40" />
|
||||
</div>
|
||||
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the password of a client to add:"); ?></label>
|
||||
<input name="password" type="text" class="form-control pull-left" size="40" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" />
|
||||
<div class="form-inline">  
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("Password with");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the first name of a client to add:"); ?></label>
|
||||
<input name="firstname" type="text" class="form-control pull-left" size="40" />
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Enter the surname of a client to add:"); ?></label>
|
||||
<input name="lastname" type="text" class="form-control pull-left" size="40"/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a></label>";
|
||||
display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"pull-left"); ?>
|
||||
</div>
|
||||
<input type="submit" value="<?php echo T_("Add a client"); ?>" class="btn btn-primary col-sm-offset-3 col-sm-3"/>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
@@ -1,242 +1,242 @@
|
||||
<?php /**
|
||||
* Output data as a fixed width ASCII file
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
if (isset($_GET['key']) || isset($_GET['sample']))
|
||||
{
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
$sql = "SELECT sivr.var as value, sivr.var_id as var_id
|
||||
FROM `sample_import_var_restrict` as sivr
|
||||
WHERE sivr.sample_import_id = $sample_import_id";
|
||||
|
||||
$svars = $db->GetAll($sql);
|
||||
|
||||
$fn = "key_";
|
||||
if (isset($_GET['sample'])) $fn = "sample_";
|
||||
|
||||
$fn .= T_("ALL") . "_Qid=" . $questionnaire_id . "_Sid=" . $sample_import_id .".csv";
|
||||
|
||||
header("Content-Type: text/csv");
|
||||
header("Content-Disposition: attachment; filename=$fn");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
echo("token,".T_("Case ID")."");
|
||||
foreach($svars as $s)
|
||||
{
|
||||
echo("," . $s['value']);
|
||||
}
|
||||
|
||||
if (isset($_GET['sample']))
|
||||
{
|
||||
echo(",".T_("Current Outcome").",".T_("Number of call attempts").",".T_("Number of calls").",".T_("Case notes").",".T_("Total interview time over all calls (mins)").",".T_("Interview time for last call (mins)").",".T_("Last number dialled").",".T_("DATE/TIME Last number dialled").",".T_("Operator username for last call").",".T_("Shift report").", AAPOR");
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
$sql = "SELECT c.token,c.case_id ";
|
||||
|
||||
if (isset($_GET['sample'])) $sql .= ", o.description,
|
||||
(SELECT COUNT(ca.call_attempt_id) FROM `call_attempt` as ca WHERE ca.case_id = c.case_id ) as callattempts,
|
||||
(SELECT COUNT(cl.call_id) FROM `call` as cl WHERE cl.case_id = c.case_id ) as calls,
|
||||
(SELECT GROUP_CONCAT(cn1.note SEPARATOR '|') FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes,
|
||||
(SELECT ROUND(SUM( TIMESTAMPDIFF(SECOND , cl2.start,IFNULL(cl2.end,CONVERT_TZ(NOW(),'System','UTC'))))/60,2) FROM `call_attempt` as cl2 WHERE cl2.case_id = c.case_id) as interviewtimec,
|
||||
(SELECT ROUND(TIMESTAMPDIFF(SECOND , cl3.start,IFNULL(cl3.end,CONVERT_TZ(NOW(),'System','UTC')))/60,2) FROM `call_attempt` as cl3 WHERE cl3.case_id = c.case_id ORDER BY cl3.call_attempt_id DESC LIMIT 1) as interviewtimel,
|
||||
(SELECT cp1.phone FROM `call` as cl4, `contact_phone` as cp1 WHERE cl4.call_id = c.last_call_id AND cp1.contact_phone_id = cl4.contact_phone_id ) as lastnumber,
|
||||
(SELECT cl55.start FROM `call` as cl55 WHERE cl55.call_id = c.last_call_id ) as lastcallstart,
|
||||
(SELECT op1.username FROM `call` as cl5, `operator` as op1 WHERE cl5.call_id = c.last_call_id AND op1.operator_id = cl5.operator_id) as operatoru,
|
||||
(SELECT GROUP_CONCAT(DISTINCT sr1.report SEPARATOR '|') FROM `call` as cl6, `shift` as sh1, `shift_report` as sr1 WHERE cl6.case_id = c.case_id AND sr1.shift_id = sh1.shift_id AND sh1.questionnaire_id = c.questionnaire_id AND cl6.start >= sh1.start AND cl6.end < sh1.end GROUP BY sr1.shift_id) as shiftr,
|
||||
o.aapor_id ";
|
||||
|
||||
$i = 0;
|
||||
foreach ($svars as $s)
|
||||
{
|
||||
$sql .= ", sv$i.val as v$i";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql .= " FROM sample ";
|
||||
|
||||
//left join if getting whole sample file
|
||||
if (isset($_GET['sample'])) $sql .= "LEFT ";
|
||||
|
||||
$sql .= "JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id' AND c.sample_id = `sample`.sample_id) ";
|
||||
|
||||
if (isset($_GET['sample'])) $sql .= " LEFT JOIN `outcome` as o ON (o.outcome_id = c.current_outcome_id)";
|
||||
|
||||
$i = 0;
|
||||
foreach ($svars as $s)
|
||||
{
|
||||
$sql .= " LEFT JOIN sample_var AS sv$i ON (sv$i.sample_id = `sample`.sample_id AND sv$i.var_id = '{$s['var_id']}') ";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql .= " WHERE `sample`.import_id = '$sample_import_id'";
|
||||
|
||||
$list = $db->GetAll($sql);
|
||||
|
||||
if (!empty($list))
|
||||
{
|
||||
foreach($list as $l)
|
||||
{
|
||||
echo $l['token'] . "," . $l['case_id'];
|
||||
$i = 0;
|
||||
foreach ($svars as $s)
|
||||
{
|
||||
echo "," . str_replace(","," ",$l["v$i"]);
|
||||
$i++;
|
||||
}
|
||||
if (isset($_GET['sample']))
|
||||
{
|
||||
echo "," . str_replace(","," ",$l['description']) . "," .$l['callattempts']."," .$l['calls']."," .$l['casenotes'].",".$l['interviewtimec'].",".$l['interviewtimel'].",".$l['lastnumber'].",".$l['lastcallstart'].",".$l['operatoru'].",".$l['shiftr'].",". $l['aapor_id'];
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['sample_var'])){
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$varid = intval($_GET['sample_var']);
|
||||
|
||||
$sql = "SELECT c.token, c.case_id, sv.val, sivr.var
|
||||
FROM `case` as c, `sample_import_var_restrict` as sivr, `sample_var` as sv
|
||||
WHERE c.questionnaire_id = $questionnaire_id
|
||||
AND sivr.sample_import_id = $sample_import_id
|
||||
AND c.sample_id = sv.sample_id
|
||||
AND sivr.var_id = sv.var_id
|
||||
AND sivr.var_id = $varid";
|
||||
|
||||
$list = $db->GetAll($sql);
|
||||
$sample_var = $list[0]['var'];
|
||||
|
||||
$fn = "key-" . $sample_var . "_Qid=$questionnaire_id" . "_Sid=" . $sample_import_id .".csv";
|
||||
|
||||
header("Content-Type: text/csv");
|
||||
header("Content-Disposition: attachment; filename=$fn");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
echo("token,caseid,$sample_var\n");
|
||||
|
||||
if (!empty($list))
|
||||
{
|
||||
foreach($list as $l)
|
||||
{
|
||||
echo $l['token'] . "," . $l['case_id'] . "," . $l['val'] . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Data output"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
|
||||
print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a questionnaire") . ": </h3>";
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
display_questionnaire_chooser($questionnaire_id,false,"form-inline col-sm-3 pull-left", "form-control");
|
||||
|
||||
if ($questionnaire_id)
|
||||
{
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = $questionnaire_id";
|
||||
|
||||
$ls = $db->GetRow($sql);
|
||||
$lsid = $ls['lime_sid'];
|
||||
|
||||
print " <a href='" . LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid' class='btn btn-default fa btn-lime'>". T_("Download data for this questionnaire via Limesurvey") . "</a></div>";
|
||||
|
||||
print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a sample") . ": </h3>";
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id,false,"form-inline col-sm-3 pull-left", "form-control");
|
||||
|
||||
if ($sample_import_id)
|
||||
{
|
||||
print " <a href='" .LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid&quexsfilterinc=$questionnaire_id:$sample_import_id' class='btn btn-default fa btn-lime'>" . T_("Download data for this sample via Limesurvey") . "</a></div>";
|
||||
//get sample vars
|
||||
$sql = "SELECT sivr.var_id as value, sivr.var as description
|
||||
FROM `sample_import_var_restrict` as sivr
|
||||
WHERE sivr.sample_import_id = $sample_import_id";
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
//download a key file linking the caseid to the sample
|
||||
print "<div class='form-group '><h3 class='col-sm-4 text-right'>" . T_("Download key file: select sample var") . ": </h3>";
|
||||
|
||||
display_chooser($rs,"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-inline col-sm-3 pull-left");
|
||||
|
||||
print "</div><div class=' col-sm-4'>";
|
||||
|
||||
//download complete key file
|
||||
print "<a href='?key=key&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete key file") . "</a></br></br>";
|
||||
|
||||
//download complete sample file with outcomes
|
||||
print "<a href='?sample=sample&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete sample file with current outcomes") . "</a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<?php /**
|
||||
* Output data as a fixed width ASCII file
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
if (isset($_GET['key']) || isset($_GET['sample']))
|
||||
{
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
$sql = "SELECT sivr.var as value, sivr.var_id as var_id
|
||||
FROM `sample_import_var_restrict` as sivr
|
||||
WHERE sivr.sample_import_id = $sample_import_id";
|
||||
|
||||
$svars = $db->GetAll($sql);
|
||||
|
||||
$fn = "key_";
|
||||
if (isset($_GET['sample'])) $fn = "sample_";
|
||||
|
||||
$fn .= T_("ALL") . "_Qid=" . $questionnaire_id . "_Sid=" . $sample_import_id .".csv";
|
||||
|
||||
header("Content-Type: text/csv");
|
||||
header("Content-Disposition: attachment; filename=$fn");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
echo("token,".T_("Case ID")."");
|
||||
foreach($svars as $s)
|
||||
{
|
||||
echo("," . $s['value']);
|
||||
}
|
||||
|
||||
if (isset($_GET['sample']))
|
||||
{
|
||||
echo(",".T_("Current Outcome").",".T_("Number of call attempts").",".T_("Number of calls").",".T_("Case notes").",".T_("Total interview time over all calls (mins)").",".T_("Interview time for last call (mins)").",".T_("Last number dialled").",".T_("DATE/TIME Last number dialled").",".T_("Operator username for last call").",".T_("Shift report").", AAPOR");
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
$sql = "SELECT c.token,c.case_id ";
|
||||
|
||||
if (isset($_GET['sample'])) $sql .= ", o.description,
|
||||
(SELECT COUNT(ca.call_attempt_id) FROM `call_attempt` as ca WHERE ca.case_id = c.case_id ) as callattempts,
|
||||
(SELECT COUNT(cl.call_id) FROM `call` as cl WHERE cl.case_id = c.case_id ) as calls,
|
||||
(SELECT GROUP_CONCAT(cn1.note SEPARATOR '|') FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes,
|
||||
(SELECT ROUND(SUM( TIMESTAMPDIFF(SECOND , cl2.start,IFNULL(cl2.end,CONVERT_TZ(NOW(),'System','UTC'))))/60,2) FROM `call_attempt` as cl2 WHERE cl2.case_id = c.case_id) as interviewtimec,
|
||||
(SELECT ROUND(TIMESTAMPDIFF(SECOND , cl3.start,IFNULL(cl3.end,CONVERT_TZ(NOW(),'System','UTC')))/60,2) FROM `call_attempt` as cl3 WHERE cl3.case_id = c.case_id ORDER BY cl3.call_attempt_id DESC LIMIT 1) as interviewtimel,
|
||||
(SELECT cp1.phone FROM `call` as cl4, `contact_phone` as cp1 WHERE cl4.call_id = c.last_call_id AND cp1.contact_phone_id = cl4.contact_phone_id ) as lastnumber,
|
||||
(SELECT cl55.start FROM `call` as cl55 WHERE cl55.call_id = c.last_call_id ) as lastcallstart,
|
||||
(SELECT op1.username FROM `call` as cl5, `operator` as op1 WHERE cl5.call_id = c.last_call_id AND op1.operator_id = cl5.operator_id) as operatoru,
|
||||
(SELECT GROUP_CONCAT(DISTINCT sr1.report SEPARATOR '|') FROM `call` as cl6, `shift` as sh1, `shift_report` as sr1 WHERE cl6.case_id = c.case_id AND sr1.shift_id = sh1.shift_id AND sh1.questionnaire_id = c.questionnaire_id AND cl6.start >= sh1.start AND cl6.end < sh1.end GROUP BY sr1.shift_id) as shiftr,
|
||||
o.aapor_id ";
|
||||
|
||||
$i = 0;
|
||||
foreach ($svars as $s)
|
||||
{
|
||||
$sql .= ", sv$i.val as v$i";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql .= " FROM sample ";
|
||||
|
||||
//left join if getting whole sample file
|
||||
if (isset($_GET['sample'])) $sql .= "LEFT ";
|
||||
|
||||
$sql .= "JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id' AND c.sample_id = `sample`.sample_id) ";
|
||||
|
||||
if (isset($_GET['sample'])) $sql .= " LEFT JOIN `outcome` as o ON (o.outcome_id = c.current_outcome_id)";
|
||||
|
||||
$i = 0;
|
||||
foreach ($svars as $s)
|
||||
{
|
||||
$sql .= " LEFT JOIN sample_var AS sv$i ON (sv$i.sample_id = `sample`.sample_id AND sv$i.var_id = '{$s['var_id']}') ";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql .= " WHERE `sample`.import_id = '$sample_import_id'";
|
||||
|
||||
$list = $db->GetAll($sql);
|
||||
|
||||
if (!empty($list))
|
||||
{
|
||||
foreach($list as $l)
|
||||
{
|
||||
echo $l['token'] . "," . $l['case_id'];
|
||||
$i = 0;
|
||||
foreach ($svars as $s)
|
||||
{
|
||||
echo "," . str_replace(","," ",$l["v$i"]);
|
||||
$i++;
|
||||
}
|
||||
if (isset($_GET['sample']))
|
||||
{
|
||||
echo "," . str_replace(","," ",$l['description']) . "," .$l['callattempts']."," .$l['calls']."," .$l['casenotes'].",".$l['interviewtimec'].",".$l['interviewtimel'].",".$l['lastnumber'].",".$l['lastcallstart'].",".$l['operatoru'].",".$l['shiftr'].",". $l['aapor_id'];
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['sample_var'])){
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$varid = intval($_GET['sample_var']);
|
||||
|
||||
$sql = "SELECT c.token, c.case_id, sv.val, sivr.var
|
||||
FROM `case` as c, `sample_import_var_restrict` as sivr, `sample_var` as sv
|
||||
WHERE c.questionnaire_id = $questionnaire_id
|
||||
AND sivr.sample_import_id = $sample_import_id
|
||||
AND c.sample_id = sv.sample_id
|
||||
AND sivr.var_id = sv.var_id
|
||||
AND sivr.var_id = $varid";
|
||||
|
||||
$list = $db->GetAll($sql);
|
||||
$sample_var = $list[0]['var'];
|
||||
|
||||
$fn = "key-" . $sample_var . "_Qid=$questionnaire_id" . "_Sid=" . $sample_import_id .".csv";
|
||||
|
||||
header("Content-Type: text/csv");
|
||||
header("Content-Disposition: attachment; filename=$fn");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
echo("token,caseid,$sample_var\n");
|
||||
|
||||
if (!empty($list))
|
||||
{
|
||||
foreach($list as $l)
|
||||
{
|
||||
echo $l['token'] . "," . $l['case_id'] . "," . $l['val'] . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Data output"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
|
||||
print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a questionnaire") . ": </h3>";
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
display_questionnaire_chooser($questionnaire_id,false,"form-inline col-sm-3 pull-left", "form-control");
|
||||
|
||||
if ($questionnaire_id)
|
||||
{
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = $questionnaire_id";
|
||||
|
||||
$ls = $db->GetRow($sql);
|
||||
$lsid = $ls['lime_sid'];
|
||||
|
||||
print " <a href='" . LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid' class='btn btn-default fa btn-lime'>". T_("Download data for this questionnaire via Limesurvey") . "</a></div>";
|
||||
|
||||
print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a sample") . ": </h3>";
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id,false,"form-inline col-sm-3 pull-left", "form-control");
|
||||
|
||||
if ($sample_import_id)
|
||||
{
|
||||
print " <a href='" .LIME_URL . "admin/admin.php?action=exportresults&sid=$lsid&quexsfilterinc=$questionnaire_id:$sample_import_id' class='btn btn-default fa btn-lime'>" . T_("Download data for this sample via Limesurvey") . "</a></div>";
|
||||
//get sample vars
|
||||
$sql = "SELECT sivr.var_id as value, sivr.var as description
|
||||
FROM `sample_import_var_restrict` as sivr
|
||||
WHERE sivr.sample_import_id = $sample_import_id";
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
//download a key file linking the caseid to the sample
|
||||
print "<div class='form-group '><h3 class='col-sm-4 text-right'>" . T_("Download key file: select sample var") . ": </h3>";
|
||||
|
||||
display_chooser($rs,"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-inline col-sm-3 pull-left");
|
||||
|
||||
print "</div><div class=' col-sm-4'>";
|
||||
|
||||
//download complete key file
|
||||
print "<a href='?key=key&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete key file") . "</a></br></br>";
|
||||
|
||||
//download complete sample file with outcomes
|
||||
print "<a href='?sample=sample&questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete sample file with current outcomes") . "</a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,279 +1,279 @@
|
||||
<?php /**
|
||||
* Display appointments
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include ("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include ("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Calendar functions
|
||||
*/
|
||||
include ("../functions/functions.calendar.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css",
|
||||
"../include/timepicker/jquery-ui.min.css",
|
||||
"../include/timepicker/jquery-ui-timepicker-addon.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../include/timepicker/jquery-ui.min.js",
|
||||
//"../include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js",
|
||||
"../include/timepicker/jquery-ui-timepicker-addon.js",
|
||||
"../include/timepicker/jquery-ui-timepicker-ru.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/bootstrap-confirmation.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
//create new or update appointment
|
||||
if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update']))
|
||||
{
|
||||
$start = $db->qstr($_GET['start']);
|
||||
$end = $db->qstr($_GET['end']);
|
||||
$contact_phone_id = bigintval($_GET['contact_phone_id']);
|
||||
$respondent_id = bigintval($_GET['respondent_id']);
|
||||
$require_operator_id = "NULL";
|
||||
if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']);
|
||||
|
||||
if ($_GET['new'] == 'create'){
|
||||
$case_id = bigintval($_GET['case_id']);
|
||||
$operator_id = get_operator_id();
|
||||
if ($operator_id == false) die();
|
||||
$sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '$respondent_id'";
|
||||
$respondent_tz = $db->GetOne($sql);
|
||||
|
||||
// create a call attempt
|
||||
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end)
|
||||
VALUES (NULL,$case_id,$operator_id,$respondent_id,CONVERT_TZ(NOW(),@@session.time_zone,'UTC'),CONVERT_TZ(NOW(),@@session.time_zone,'UTC'))";
|
||||
$db->Execute($sql);
|
||||
|
||||
$call_attempt_id = $db->Insert_ID();
|
||||
|
||||
$sql = "INSERT INTO `appointment` (appointment_id,case_id,contact_phone_id,call_attempt_id,start,end,require_operator_id,respondent_id,completed_call_id)
|
||||
VALUES(NULL,$case_id,$contact_phone_id,$call_attempt_id,CONVERT_TZ($start,'$respondent_tz','UTC'),CONVERT_TZ($end,'$respondent_tz','UTC'),$require_operator_id,$respondent_id,NULL)";
|
||||
$db->Execute($sql);
|
||||
|
||||
$appointment_id = $db->Insert_ID();
|
||||
|
||||
$_GET['appointment_id'] = $appointment_id;
|
||||
$appointment_id = bigintval($_GET['appointment_id']);
|
||||
|
||||
} else {
|
||||
|
||||
$appointment_id = bigintval($_GET['appointment_id']);
|
||||
|
||||
//Edit this appointment in the database
|
||||
$sql = "UPDATE appointment as a, respondent as r
|
||||
SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id, a.require_operator_id = $require_operator_id
|
||||
WHERE a.appointment_id = $appointment_id
|
||||
AND r.respondent_id = $respondent_id";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
unset ($_GET['start'],$_GET['end'],$_GET['appointment_id'],$_GET['case_id'],$_GET['new'],$_GET['update']);
|
||||
}
|
||||
|
||||
|
||||
if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(($_GET['new'] == 'new') && isset($_GET['case_id'])))
|
||||
{
|
||||
$appointment_id = bigintval($_GET['appointment_id']);
|
||||
$case_id = bigintval($_GET['case_id']);
|
||||
|
||||
if (isset($_GET['delete']))
|
||||
{
|
||||
$sql = "DELETE FROM appointment
|
||||
WHERE appointment_id = '$appointment_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
xhtml_head(T_("Now modify case outcome"),true,$css,$js_head);
|
||||
|
||||
print "<div class='col-sm-6'><p class='well'>" . T_("The appointment has been deleted. Now you must modify the case outcome") . "</p>
|
||||
<a href='supervisor.php?case_id=$case_id' class='btn btn-default'>" . T_("Modify case outcome") . "</a></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
//Display an edit form
|
||||
|
||||
if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID " . $appointment_id;}
|
||||
|
||||
xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle);
|
||||
$lang = DEFAULT_LOCALE;
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate, CONVERT_TZ(s.end,'UTC',r.Time_zone_name) as enddate FROM `shift` as s, `case` as c, `respondent` as r WHERE s.questionnaire_id = c.questionnaire_id AND c.case_id = $case_id AND r.case_id = c.case_id ORDER BY s.end DESC LIMIT 1";
|
||||
$rs = $db->GetRow($sql); $startdate = $rs['startdate'];$enddate = $rs['enddate'];
|
||||
|
||||
print "<script type='text/javascript'>
|
||||
$(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end');
|
||||
$.timepicker.datetimeRange(
|
||||
startDateTextBox,endDateTextBox,{
|
||||
minInterval: (1000*60*15), // 15min
|
||||
numberOfMonths: 2,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
timeFormat: 'HH:mm:ss',
|
||||
showSecond: false,
|
||||
regional: '$lang',
|
||||
hourMin: 9,
|
||||
hourMax: 21,
|
||||
stepMinute: 5,
|
||||
hourGrid: 2,
|
||||
minuteGrid: 10,
|
||||
minDate: '$startdate',
|
||||
maxDate: '$enddate',
|
||||
});});</script>";
|
||||
|
||||
if ($_GET['new'] =='new'){
|
||||
$start = $startdate;
|
||||
$end = $enddate;
|
||||
$rtz = $_GET['rtz'];
|
||||
}
|
||||
if (isset($_GET['appointment_id'])) {
|
||||
|
||||
$sql = "SELECT a.contact_phone_id,a.call_attempt_id, CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as `start`, CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as `end`, a.respondent_id, a.require_operator_id, r.Time_zone_name as rtz
|
||||
FROM `appointment` as a, respondent as r
|
||||
WHERE a.appointment_id = '$appointment_id'
|
||||
AND a.case_id = '$case_id'
|
||||
AND r.respondent_id = a.respondent_id";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs)){
|
||||
$respondent_id = $rs['respondent_id'];
|
||||
$contact_phone_id = $rs['contact_phone_id'];
|
||||
$require_operator_id = $rs['require_operator_id'];
|
||||
$start = $rs['start'];
|
||||
$end = $rs['end'];
|
||||
$rtz = $rs['rtz'];
|
||||
}
|
||||
}
|
||||
print "<form action='?' method='get' class='form-horizontal'>";
|
||||
print "<label class='pull-left text-right control-label col-sm-2' for='respondent_id'>" . T_("Respondent") . "</label>";
|
||||
|
||||
display_chooser($db->GetAll("SELECT respondent_id as value, CONCAT(firstName,' ',lastName) as description,
|
||||
CASE when respondent_id = '$respondent_id' THEN 'selected=\'selected\'' ELSE '' END as selected
|
||||
FROM respondent
|
||||
WHERE case_id = '$case_id'"),"respondent_id","respondent_id",false,false,false,true,false,true,"pull-left");
|
||||
|
||||
print "<br/><br/><label for='contact_phone_id' class='pull-left text-right control-label col-sm-2'>" . T_("Contact phone") . "</label>";
|
||||
display_chooser($db->GetAll("SELECT contact_phone_id as value, phone as description,
|
||||
CASE when contact_phone_id = '$contact_phone_id' THEN 'selected=\'selected\'' ELSE '' END as selected
|
||||
FROM contact_phone
|
||||
WHERE case_id = '$case_id'"),
|
||||
"contact_phone_id","contact_phone_id",false,false,false,true,false,true,"pull-left");
|
||||
|
||||
print "<div class='clearfix'></div></br><div class='alert alert-info col-sm-6 '>". T_("ATTENTION! Keep in mind that you're setting 'Start' & 'End' appoinment times in RESPONDENT LOCAL TIME !!!") . "</div><div class='clearfix'></div>";
|
||||
date_default_timezone_set($rtz);
|
||||
print "<label class='text-right col-sm-2 control-label'>" . T_("Respondent TimeZone") . ":</label>
|
||||
<h4 class='col-sm-2 text-danger text-uppercase fa-lg'>" . $rtz . "</h4>
|
||||
<label class=''>" . T_("Respondent Time") . ": <b class='fa fa-2x '>" . date("H:i:s") . "</b></label>";
|
||||
|
||||
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='start'>" . T_("Start time") . "</label>
|
||||
<div class='pull-left'><input class='form-control' type='text' value='$start' id='start' name='start'/></div>";
|
||||
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='end'>" . T_("End time") . "</label>
|
||||
<div class='pull-left'><input class='form-control' type='text' value='$end' id='end' name='end'/></div>";
|
||||
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='require_operator_id'>" . T_("Appointment with") . "</label>";
|
||||
$ops = $db->GetAll("SELECT o.operator_id as value,
|
||||
CONCAT(o.firstName, ' ', o.lastName) as description,
|
||||
CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected
|
||||
FROM operator as o");
|
||||
$selected = "selected=\'selected\'";
|
||||
foreach($ops as $o)
|
||||
{
|
||||
if (!empty($o['selected']))
|
||||
{
|
||||
$selected = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected));
|
||||
display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,true,false,true,"pull-left");
|
||||
print "<input type='hidden' value='$appointment_id' id='appointment_id' name='appointment_id'/><input type='hidden' value='update' id='update' name='update'/>";
|
||||
|
||||
if ($_GET['new'] == 'new') { print "<input type='hidden' value='create' id='new' name='new'/><input type='hidden' value='$case_id' id='case_id' name='case_id'/>";}
|
||||
|
||||
print "<div class='clearfix'></div><br/><br/>
|
||||
<div class='col-sm-2'><a href='' onclick='history.back();return false;' class='btn btn-default pull-left'><i class='fa fa-ban fa-lg'></i> " . T_("Cancel edit") . "</a></div>";
|
||||
|
||||
print "<div class='col-sm-2'><button type='submit' class='btn btn-primary btn-block'><i class='fa fa-floppy-o fa-lg'></i> " . T_("Save changes") . "</button></div>";
|
||||
|
||||
print "<div class='col-sm-2'><a href='' class='btn btn-default pull-right' toggle='confirmation' data-placement='left' data-href='?delete=delete&appointment_id=$appointment_id&case_id=$case_id' ><i class='fa fa-trash fa-lg text-danger'></i> " . 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); //array("../css/table.css")
|
||||
print "<h3>" . T_("All appointments (with times displayed in your time zone)") . "</h3>";
|
||||
|
||||
$sql = "SELECT q.description, 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,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
CONCAT(' <a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\' ></i></a> ') as link,
|
||||
CONCAT(' <a href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a> ') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho
|
||||
FROM appointment as a
|
||||
JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc) on (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)
|
||||
LEFT 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)
|
||||
LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id
|
||||
WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
|
||||
ORDER BY a.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
if (!empty($rs)) {
|
||||
translate_array($rs,array("outcome"));
|
||||
xhtml_table($rs,array("description","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"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, 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,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
CONCAT(' <a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\' ></i></a> ') as link,
|
||||
CONCAT(' <a href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a> ') as edit
|
||||
FROM appointment as a
|
||||
JOIN (`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)
|
||||
LEFT JOIN (`call` as ca) ON (ca.call_id = a.completed_call_id)
|
||||
WHERE q.enabled=1 AND si.enabled = 1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL
|
||||
GROUP BY c.case_id
|
||||
ORDER BY a.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
if (!empty($rs)) {
|
||||
xhtml_table($rs,array("description","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Respondent")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"tclass",false,false,"bs-table");
|
||||
|
||||
} else print "<h4 class='well text-info'>" . T_("No appointments missed") . "</h4>";
|
||||
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('[toggle="confirmation"]').confirmation()
|
||||
</script>
|
||||
<?php /**
|
||||
* Display appointments
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include ("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include ("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Calendar functions
|
||||
*/
|
||||
include ("../functions/functions.calendar.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/jquery-ui/jquery-ui.min.css",
|
||||
"../include/timepicker/jquery-ui.min.css",
|
||||
"../include/timepicker/jquery-ui-timepicker-addon.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
"../include/timepicker/jquery-ui.min.js",
|
||||
//"../include/jquery-ui/jquery-ui.min.js",
|
||||
"../include/timepicker/jquery-ui-timepicker-addon.js",
|
||||
"../include/timepicker/jquery-ui-timepicker-ru.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/bootstrap-confirmation.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
//create new or update appointment
|
||||
if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update']))
|
||||
{
|
||||
$start = $db->qstr($_GET['start']);
|
||||
$end = $db->qstr($_GET['end']);
|
||||
$contact_phone_id = bigintval($_GET['contact_phone_id']);
|
||||
$respondent_id = bigintval($_GET['respondent_id']);
|
||||
$require_operator_id = "NULL";
|
||||
if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']);
|
||||
|
||||
if ($_GET['new'] == 'create'){
|
||||
$case_id = bigintval($_GET['case_id']);
|
||||
$operator_id = get_operator_id();
|
||||
if ($operator_id == false) die();
|
||||
$sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '$respondent_id'";
|
||||
$respondent_tz = $db->GetOne($sql);
|
||||
|
||||
// create a call attempt
|
||||
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end)
|
||||
VALUES (NULL,$case_id,$operator_id,$respondent_id,CONVERT_TZ(NOW(),@@session.time_zone,'UTC'),CONVERT_TZ(NOW(),@@session.time_zone,'UTC'))";
|
||||
$db->Execute($sql);
|
||||
|
||||
$call_attempt_id = $db->Insert_ID();
|
||||
|
||||
$sql = "INSERT INTO `appointment` (appointment_id,case_id,contact_phone_id,call_attempt_id,start,end,require_operator_id,respondent_id,completed_call_id)
|
||||
VALUES(NULL,$case_id,$contact_phone_id,$call_attempt_id,CONVERT_TZ($start,'$respondent_tz','UTC'),CONVERT_TZ($end,'$respondent_tz','UTC'),$require_operator_id,$respondent_id,NULL)";
|
||||
$db->Execute($sql);
|
||||
|
||||
$appointment_id = $db->Insert_ID();
|
||||
|
||||
$_GET['appointment_id'] = $appointment_id;
|
||||
$appointment_id = bigintval($_GET['appointment_id']);
|
||||
|
||||
} else {
|
||||
|
||||
$appointment_id = bigintval($_GET['appointment_id']);
|
||||
|
||||
//Edit this appointment in the database
|
||||
$sql = "UPDATE appointment as a, respondent as r
|
||||
SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id, a.require_operator_id = $require_operator_id
|
||||
WHERE a.appointment_id = $appointment_id
|
||||
AND r.respondent_id = $respondent_id";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
unset ($_GET['start'],$_GET['end'],$_GET['appointment_id'],$_GET['case_id'],$_GET['new'],$_GET['update']);
|
||||
}
|
||||
|
||||
|
||||
if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(($_GET['new'] == 'new') && isset($_GET['case_id'])))
|
||||
{
|
||||
$appointment_id = bigintval($_GET['appointment_id']);
|
||||
$case_id = bigintval($_GET['case_id']);
|
||||
|
||||
if (isset($_GET['delete']))
|
||||
{
|
||||
$sql = "DELETE FROM appointment
|
||||
WHERE appointment_id = '$appointment_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
xhtml_head(T_("Now modify case outcome"),true,$css,$js_head);
|
||||
|
||||
print "<div class='col-sm-6'><p class='well'>" . T_("The appointment has been deleted. Now you must modify the case outcome") . "</p>
|
||||
<a href='supervisor.php?case_id=$case_id' class='btn btn-default'>" . T_("Modify case outcome") . "</a></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
//Display an edit form
|
||||
|
||||
if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID " . $appointment_id;}
|
||||
|
||||
xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle);
|
||||
$lang = DEFAULT_LOCALE;
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate, CONVERT_TZ(s.end,'UTC',r.Time_zone_name) as enddate FROM `shift` as s, `case` as c, `respondent` as r WHERE s.questionnaire_id = c.questionnaire_id AND c.case_id = $case_id AND r.case_id = c.case_id ORDER BY s.end DESC LIMIT 1";
|
||||
$rs = $db->GetRow($sql); $startdate = $rs['startdate'];$enddate = $rs['enddate'];
|
||||
|
||||
print "<script type='text/javascript'>
|
||||
$(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end');
|
||||
$.timepicker.datetimeRange(
|
||||
startDateTextBox,endDateTextBox,{
|
||||
minInterval: (1000*60*15), // 15min
|
||||
numberOfMonths: 2,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
timeFormat: 'HH:mm:ss',
|
||||
showSecond: false,
|
||||
regional: '$lang',
|
||||
hourMin: 9,
|
||||
hourMax: 21,
|
||||
stepMinute: 5,
|
||||
hourGrid: 2,
|
||||
minuteGrid: 10,
|
||||
minDate: '$startdate',
|
||||
maxDate: '$enddate',
|
||||
});});</script>";
|
||||
|
||||
if ($_GET['new'] =='new'){
|
||||
$start = $startdate;
|
||||
$end = $enddate;
|
||||
$rtz = $_GET['rtz'];
|
||||
}
|
||||
if (isset($_GET['appointment_id'])) {
|
||||
|
||||
$sql = "SELECT a.contact_phone_id,a.call_attempt_id, CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as `start`, CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as `end`, a.respondent_id, a.require_operator_id, r.Time_zone_name as rtz
|
||||
FROM `appointment` as a, respondent as r
|
||||
WHERE a.appointment_id = '$appointment_id'
|
||||
AND a.case_id = '$case_id'
|
||||
AND r.respondent_id = a.respondent_id";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs)){
|
||||
$respondent_id = $rs['respondent_id'];
|
||||
$contact_phone_id = $rs['contact_phone_id'];
|
||||
$require_operator_id = $rs['require_operator_id'];
|
||||
$start = $rs['start'];
|
||||
$end = $rs['end'];
|
||||
$rtz = $rs['rtz'];
|
||||
}
|
||||
}
|
||||
print "<form action='?' method='get' class='form-horizontal'>";
|
||||
print "<label class='pull-left text-right control-label col-sm-2' for='respondent_id'>" . T_("Respondent") . "</label>";
|
||||
|
||||
display_chooser($db->GetAll("SELECT respondent_id as value, CONCAT(firstName,' ',lastName) as description,
|
||||
CASE when respondent_id = '$respondent_id' THEN 'selected=\'selected\'' ELSE '' END as selected
|
||||
FROM respondent
|
||||
WHERE case_id = '$case_id'"),"respondent_id","respondent_id",false,false,false,true,false,true,"pull-left");
|
||||
|
||||
print "<br/><br/><label for='contact_phone_id' class='pull-left text-right control-label col-sm-2'>" . T_("Contact phone") . "</label>";
|
||||
display_chooser($db->GetAll("SELECT contact_phone_id as value, phone as description,
|
||||
CASE when contact_phone_id = '$contact_phone_id' THEN 'selected=\'selected\'' ELSE '' END as selected
|
||||
FROM contact_phone
|
||||
WHERE case_id = '$case_id'"),
|
||||
"contact_phone_id","contact_phone_id",false,false,false,true,false,true,"pull-left");
|
||||
|
||||
print "<div class='clearfix'></div></br><div class='alert alert-info col-sm-6 '>". T_("ATTENTION! Keep in mind that you're setting 'Start' & 'End' appoinment times in RESPONDENT LOCAL TIME !!!") . "</div><div class='clearfix'></div>";
|
||||
date_default_timezone_set($rtz);
|
||||
print "<label class='text-right col-sm-2 control-label'>" . T_("Respondent TimeZone") . ":</label>
|
||||
<h4 class='col-sm-2 text-danger text-uppercase fa-lg'>" . $rtz . "</h4>
|
||||
<label class=''>" . T_("Respondent Time") . ": <b class='fa fa-2x '>" . date("H:i:s") . "</b></label>";
|
||||
|
||||
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='start'>" . T_("Start time") . "</label>
|
||||
<div class='pull-left'><input class='form-control' type='text' value='$start' id='start' name='start'/></div>";
|
||||
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='end'>" . T_("End time") . "</label>
|
||||
<div class='pull-left'><input class='form-control' type='text' value='$end' id='end' name='end'/></div>";
|
||||
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='require_operator_id'>" . T_("Appointment with") . "</label>";
|
||||
$ops = $db->GetAll("SELECT o.operator_id as value,
|
||||
CONCAT(o.firstName, ' ', o.lastName) as description,
|
||||
CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected
|
||||
FROM operator as o");
|
||||
$selected = "selected=\'selected\'";
|
||||
foreach($ops as $o)
|
||||
{
|
||||
if (!empty($o['selected']))
|
||||
{
|
||||
$selected = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected));
|
||||
display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,true,false,true,"pull-left");
|
||||
print "<input type='hidden' value='$appointment_id' id='appointment_id' name='appointment_id'/><input type='hidden' value='update' id='update' name='update'/>";
|
||||
|
||||
if ($_GET['new'] == 'new') { print "<input type='hidden' value='create' id='new' name='new'/><input type='hidden' value='$case_id' id='case_id' name='case_id'/>";}
|
||||
|
||||
print "<div class='clearfix'></div><br/><br/>
|
||||
<div class='col-sm-2'><a href='' onclick='history.back();return false;' class='btn btn-default pull-left'><i class='fa fa-ban fa-lg'></i> " . T_("Cancel edit") . "</a></div>";
|
||||
|
||||
print "<div class='col-sm-2'><button type='submit' class='btn btn-primary btn-block'><i class='fa fa-floppy-o fa-lg'></i> " . T_("Save changes") . "</button></div>";
|
||||
|
||||
print "<div class='col-sm-2'><a href='' class='btn btn-default pull-right' toggle='confirmation' data-placement='left' data-href='?delete=delete&appointment_id=$appointment_id&case_id=$case_id' ><i class='fa fa-trash fa-lg text-danger'></i> " . 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); //array("../css/table.css")
|
||||
print "<h3>" . T_("All appointments (with times displayed in your time zone)") . "</h3>";
|
||||
|
||||
$sql = "SELECT q.description, 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,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
CONCAT(' <a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\' ></i></a> ') as link,
|
||||
CONCAT(' <a href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a> ') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho
|
||||
FROM appointment as a
|
||||
JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc) on (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)
|
||||
LEFT 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)
|
||||
LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id
|
||||
WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
|
||||
ORDER BY a.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
if (!empty($rs)) {
|
||||
translate_array($rs,array("outcome"));
|
||||
xhtml_table($rs,array("description","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"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, 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,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
CONCAT(' <a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\' ></i></a> ') as link,
|
||||
CONCAT(' <a href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a> ') as edit
|
||||
FROM appointment as a
|
||||
JOIN (`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)
|
||||
LEFT JOIN (`call` as ca) ON (ca.call_id = a.completed_call_id)
|
||||
WHERE q.enabled=1 AND si.enabled = 1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL
|
||||
GROUP BY c.case_id
|
||||
ORDER BY a.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
if (!empty($rs)) {
|
||||
xhtml_table($rs,array("description","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Respondent")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"tclass",false,false,"bs-table");
|
||||
|
||||
} else print "<h4 class='well text-info'>" . T_("No appointments missed") . "</h4>";
|
||||
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('[toggle="confirmation"]').confirmation()
|
||||
</script>
|
||||
|
||||
@@ -1,269 +1,269 @@
|
||||
<?php /**
|
||||
* Display extension status
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2010
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/software/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$msg = "";
|
||||
|
||||
if (isset($_GET))
|
||||
{
|
||||
foreach($_GET as $key=>$val)
|
||||
{
|
||||
if (substr($key,0,12) == "operator_id_")
|
||||
{
|
||||
if (isset($_GET['extension_id']))
|
||||
{
|
||||
$ex = intval($_GET['extension_id']);
|
||||
$op = intval($val);
|
||||
|
||||
$sql = "UPDATE `extension`
|
||||
SET current_operator_id = $op
|
||||
WHERE extension_id = $ex
|
||||
AND current_operator_id IS NULL";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['extension']))
|
||||
{
|
||||
$extension = $db->qstr($_POST['extension']);
|
||||
$password = $db->qstr($_POST['password']);
|
||||
$extension_id = "NULL";
|
||||
|
||||
if (isset($_POST['extensionid']))
|
||||
$extension_id = intval($_POST['extensionid']);
|
||||
|
||||
if (isset($_POST['delete']))
|
||||
{
|
||||
$sql = "DELETE FROM `extension`
|
||||
WHERE current_operator_id IS NULL
|
||||
AND extension_id = $extension_id";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if (!$rs)
|
||||
$msg = ("Failed to delete extension. There may be an operator currently assigned to it");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($_POST['extension']))
|
||||
{
|
||||
$sql = "INSERT INTO `extension` (extension_id,extension,password)
|
||||
VALUES ($extension_id,$extension,$password)
|
||||
ON DUPLICATE KEY UPDATE extension=$extension,password=$password";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if (!$rs)
|
||||
$msg = T_("Failed to add extension. There already may be an extension of this name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['unassign']))
|
||||
{
|
||||
$e = intval($_GET['unassign']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "SELECT e.current_operator_id
|
||||
FROM `extension` as e
|
||||
LEFT JOIN `case` as c ON (c.current_operator_id = e.current_operator_id)
|
||||
WHERE e.extension_id = $e
|
||||
AND c.case_id IS NULL";
|
||||
|
||||
$cid = $db->GetOne($sql);
|
||||
|
||||
if (!empty($cid))
|
||||
{
|
||||
$sql = "UPDATE `extension` as e
|
||||
SET current_operator_id = NULL
|
||||
WHERE extension_id = $e
|
||||
AND current_operator_id = $cid";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Extensions & status"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
//sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.editext.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
//res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.editext.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_GET['edit']) || isset($_GET['addext']))
|
||||
{
|
||||
if (isset($_GET['edit'])){
|
||||
|
||||
$sql = "SELECT extension,password,current_operator_id
|
||||
FROM extension
|
||||
WHERE extension_id = " . intval($_GET['edit']);
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
}
|
||||
|
||||
print "<a href='?' class='btn btn-default pull-left'>" . T_("Go back") . "</a>";
|
||||
?>
|
||||
<div class="panel-body ">
|
||||
<h3 class="col-sm-offset-3"><?php if (isset($_GET['edit']))echo T_("Edit extension"); else echo T_("Add an extension");?></h3>
|
||||
<form enctype="multipart/form-data" action="?" method="post" name="editext" class="form-horizontal">
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Extension name: ");?></label>
|
||||
<input name="extension" type="text" placeholder="<?php echo T_("such as SIP/1000");?>" maxlength="12" required value="<?php echo $rs['extension'];?>" class="form-control"/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Extension password: ");?></label>
|
||||
<input name="password" type="text" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" style="width:20em;" maxlength="50" value="<?php echo $rs['password'];?>" class="form-control pull-left" placeholder="<?php echo T_("Enter New Password");?>"/>  <?php echo T_(" or ");?> 
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("New password");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters long");?>
|
||||
</div>
|
||||
|
||||
<div class=" col-sm-offset-3 ">
|
||||
<input type="submit" class="btn btn-primary " value="<?php if (isset($_GET['edit'])) echo T_("Save changes"); else echo T_("Add extension"); ?>" />
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['edit'])){?>
|
||||
|
||||
<input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/>
|
||||
|
||||
<?php if (empty($rs['current_operator_id'])) { ?>
|
||||
|
||||
<input type="submit" name="delete" class="btn btn-danger " data-toggle="confirmation" value="<?php echo T_("Delete extension"); ?>" />
|
||||
|
||||
<?php } else
|
||||
print "</br></br><b class='well text-danger'>" . T_("Unassign the operator from this extension to be able to delete it") . "</b>";
|
||||
}
|
||||
|
||||
print "</form></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql= "SELECT CONCAT('<a href=\'operatorlist.php?edit=',o.operator_id,'\'>',o.firstName,' ', o.lastname,'</a>') as firstName,
|
||||
CONCAT('<a href=\'?edit=',e.extension_id,'\' class=\'\'>',e.extension,'</a>') as extension,
|
||||
IF(c.case_id IS NULL,IF(e.current_operator_id IS NULL,'list'
|
||||
,CONCAT('<a href=\'?unassign=',e.extension_id,'\'>". TQ_("Unassign") ."</a>')),'". TQ_("End case to change assignment")."') as assignment,
|
||||
CASE e.status WHEN 0 THEN '" . TQ_("VoIP Offline") . "' ELSE '" . TQ_("VoIP Online") . "' END as status,
|
||||
CASE ca.state WHEN 0 THEN '" . TQ_("Not called") . "' WHEN 1 THEN '" . TQ_("Requesting call") . "' WHEN 2 THEN '" . TQ_("Ringing") . "' WHEN 3 THEN '" . TQ_("Answered") . "' WHEN 4 THEN '" . TQ_("Requires coding") . "' ELSE '" . TQ_("Done") . "' END as state,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id , '\'>' , c.case_id, '</a>') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime,
|
||||
e.status as vs,
|
||||
e.extension_id
|
||||
FROM extension as e
|
||||
LEFT JOIN `operator` as o ON (o.operator_id = e.current_operator_id)
|
||||
LEFT JOIN `case` as c ON (c.current_operator_id = o.operator_id)
|
||||
LEFT JOIN `call_attempt` as cal ON (cal.operator_id = o.operator_id AND cal.end IS NULL and cal.case_id = c.case_id)
|
||||
LEFT JOIN `call` as ca ON (ca.case_id = c.case_id AND ca.operator_id = o.operator_id AND ca.outcome_id= 0 AND ca.call_attempt_id = cal.call_attempt_id)
|
||||
ORDER BY e.extension_id ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if ($msg != "")
|
||||
print "<p>$msg</p>";
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
$sql = "SELECT o.operator_id as value, o.firstName as description
|
||||
FROM `operator` as o
|
||||
LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id)
|
||||
WHERE e.extension_id IS NULL";
|
||||
|
||||
$ers = $db->GetAll($sql);
|
||||
|
||||
for ($i = 0; $i < count($rs); $i++)
|
||||
{
|
||||
if ($rs[$i]['assignment'] == "list")
|
||||
$rs[$i]['assignment'] = display_chooser($ers,"operator_id_" . $rs[$i]["extension_id"],"operator_id_" . $rs[$i]["extension_id"],true,"extension_id=".$rs[$i]["extension_id"],true,false,false,false);
|
||||
}
|
||||
print "<div class='panel-body'>";
|
||||
xhtml_table($rs,array("extension","firstName","assignment","status","case_id","state","calltime"),array(T_("Extension"),T_("Operator"),T_("Assignment"),T_("VoIP Status"),T_("Case ID"),T_("Call state"),T_("Time on call")),"tclass",array("vs" => "1"));
|
||||
print "</div>";
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No extensions") . "</p>";
|
||||
|
||||
print "<div class='col-sm-3'><a href='?addext=addext' class='btn btn-default '>" . T_("Add extension") . "</a></div>";
|
||||
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<?php /**
|
||||
* Display extension status
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2010
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/software/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$msg = "";
|
||||
|
||||
if (isset($_GET))
|
||||
{
|
||||
foreach($_GET as $key=>$val)
|
||||
{
|
||||
if (substr($key,0,12) == "operator_id_")
|
||||
{
|
||||
if (isset($_GET['extension_id']))
|
||||
{
|
||||
$ex = intval($_GET['extension_id']);
|
||||
$op = intval($val);
|
||||
|
||||
$sql = "UPDATE `extension`
|
||||
SET current_operator_id = $op
|
||||
WHERE extension_id = $ex
|
||||
AND current_operator_id IS NULL";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['extension']))
|
||||
{
|
||||
$extension = $db->qstr($_POST['extension']);
|
||||
$password = $db->qstr($_POST['password']);
|
||||
$extension_id = "NULL";
|
||||
|
||||
if (isset($_POST['extensionid']))
|
||||
$extension_id = intval($_POST['extensionid']);
|
||||
|
||||
if (isset($_POST['delete']))
|
||||
{
|
||||
$sql = "DELETE FROM `extension`
|
||||
WHERE current_operator_id IS NULL
|
||||
AND extension_id = $extension_id";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if (!$rs)
|
||||
$msg = ("Failed to delete extension. There may be an operator currently assigned to it");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($_POST['extension']))
|
||||
{
|
||||
$sql = "INSERT INTO `extension` (extension_id,extension,password)
|
||||
VALUES ($extension_id,$extension,$password)
|
||||
ON DUPLICATE KEY UPDATE extension=$extension,password=$password";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if (!$rs)
|
||||
$msg = T_("Failed to add extension. There already may be an extension of this name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['unassign']))
|
||||
{
|
||||
$e = intval($_GET['unassign']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "SELECT e.current_operator_id
|
||||
FROM `extension` as e
|
||||
LEFT JOIN `case` as c ON (c.current_operator_id = e.current_operator_id)
|
||||
WHERE e.extension_id = $e
|
||||
AND c.case_id IS NULL";
|
||||
|
||||
$cid = $db->GetOne($sql);
|
||||
|
||||
if (!empty($cid))
|
||||
{
|
||||
$sql = "UPDATE `extension` as e
|
||||
SET current_operator_id = NULL
|
||||
WHERE extension_id = $e
|
||||
AND current_operator_id = $cid";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Extensions & status"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
//sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.editext.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
//res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.editext.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_GET['edit']) || isset($_GET['addext']))
|
||||
{
|
||||
if (isset($_GET['edit'])){
|
||||
|
||||
$sql = "SELECT extension,password,current_operator_id
|
||||
FROM extension
|
||||
WHERE extension_id = " . intval($_GET['edit']);
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
}
|
||||
|
||||
print "<a href='?' class='btn btn-default pull-left'>" . T_("Go back") . "</a>";
|
||||
?>
|
||||
<div class="panel-body ">
|
||||
<h3 class="col-sm-offset-3"><?php if (isset($_GET['edit']))echo T_("Edit extension"); else echo T_("Add an extension");?></h3>
|
||||
<form enctype="multipart/form-data" action="?" method="post" name="editext" class="form-horizontal">
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Extension name: ");?></label>
|
||||
<input name="extension" type="text" placeholder="<?php echo T_("such as SIP/1000");?>" maxlength="12" required value="<?php echo $rs['extension'];?>" class="form-control"/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3"><?php echo T_("Extension password: ");?></label>
|
||||
<input name="password" type="text" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" style="width:20em;" maxlength="50" value="<?php echo $rs['password'];?>" class="form-control pull-left" placeholder="<?php echo T_("Enter New Password");?>"/>  <?php echo T_(" or ");?> 
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("New password");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters long");?>
|
||||
</div>
|
||||
|
||||
<div class=" col-sm-offset-3 ">
|
||||
<input type="submit" class="btn btn-primary " value="<?php if (isset($_GET['edit'])) echo T_("Save changes"); else echo T_("Add extension"); ?>" />
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['edit'])){?>
|
||||
|
||||
<input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/>
|
||||
|
||||
<?php if (empty($rs['current_operator_id'])) { ?>
|
||||
|
||||
<input type="submit" name="delete" class="btn btn-danger " data-toggle="confirmation" value="<?php echo T_("Delete extension"); ?>" />
|
||||
|
||||
<?php } else
|
||||
print "</br></br><b class='well text-danger'>" . T_("Unassign the operator from this extension to be able to delete it") . "</b>";
|
||||
}
|
||||
|
||||
print "</form></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql= "SELECT CONCAT('<a href=\'operatorlist.php?edit=',o.operator_id,'\'>',o.firstName,' ', o.lastname,'</a>') as firstName,
|
||||
CONCAT('<a href=\'?edit=',e.extension_id,'\' class=\'\'>',e.extension,'</a>') as extension,
|
||||
IF(c.case_id IS NULL,IF(e.current_operator_id IS NULL,'list'
|
||||
,CONCAT('<a href=\'?unassign=',e.extension_id,'\'>". TQ_("Unassign") ."</a>')),'". TQ_("End case to change assignment")."') as assignment,
|
||||
CASE e.status WHEN 0 THEN '" . TQ_("VoIP Offline") . "' ELSE '" . TQ_("VoIP Online") . "' END as status,
|
||||
CASE ca.state WHEN 0 THEN '" . TQ_("Not called") . "' WHEN 1 THEN '" . TQ_("Requesting call") . "' WHEN 2 THEN '" . TQ_("Ringing") . "' WHEN 3 THEN '" . TQ_("Answered") . "' WHEN 4 THEN '" . TQ_("Requires coding") . "' ELSE '" . TQ_("Done") . "' END as state,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id , '\'>' , c.case_id, '</a>') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime,
|
||||
e.status as vs,
|
||||
e.extension_id
|
||||
FROM extension as e
|
||||
LEFT JOIN `operator` as o ON (o.operator_id = e.current_operator_id)
|
||||
LEFT JOIN `case` as c ON (c.current_operator_id = o.operator_id)
|
||||
LEFT JOIN `call_attempt` as cal ON (cal.operator_id = o.operator_id AND cal.end IS NULL and cal.case_id = c.case_id)
|
||||
LEFT JOIN `call` as ca ON (ca.case_id = c.case_id AND ca.operator_id = o.operator_id AND ca.outcome_id= 0 AND ca.call_attempt_id = cal.call_attempt_id)
|
||||
ORDER BY e.extension_id ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if ($msg != "")
|
||||
print "<p>$msg</p>";
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
$sql = "SELECT o.operator_id as value, o.firstName as description
|
||||
FROM `operator` as o
|
||||
LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id)
|
||||
WHERE e.extension_id IS NULL";
|
||||
|
||||
$ers = $db->GetAll($sql);
|
||||
|
||||
for ($i = 0; $i < count($rs); $i++)
|
||||
{
|
||||
if ($rs[$i]['assignment'] == "list")
|
||||
$rs[$i]['assignment'] = display_chooser($ers,"operator_id_" . $rs[$i]["extension_id"],"operator_id_" . $rs[$i]["extension_id"],true,"extension_id=".$rs[$i]["extension_id"],true,false,false,false);
|
||||
}
|
||||
print "<div class='panel-body'>";
|
||||
xhtml_table($rs,array("extension","firstName","assignment","status","case_id","state","calltime"),array(T_("Extension"),T_("Operator"),T_("Assignment"),T_("VoIP Status"),T_("Case ID"),T_("Call state"),T_("Time on call")),"tclass",array("vs" => "1"));
|
||||
print "</div>";
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No extensions") . "</p>";
|
||||
|
||||
print "<div class='col-sm-3'><a href='?addext=addext' class='btn btn-default '>" . T_("Add extension") . "</a></div>";
|
||||
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
310
admin/import.php
310
admin/import.php
@@ -1,155 +1,155 @@
|
||||
<?php
|
||||
/**
|
||||
* Import a sample from a Headered CSV file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Sample import functions
|
||||
*/
|
||||
include("../functions/functions.import.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/bootstrap-filestyle.min.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
if (isset($_POST['import_form']))
|
||||
{
|
||||
//form has been submitted
|
||||
$subtitle = T_("Validating and uploading");
|
||||
xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle);
|
||||
echo "<a href='?' class='btn btn-default pull-left' ><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
|
||||
//verify each GET field is unique (except import_form)
|
||||
$sfields = array();
|
||||
foreach($_POST as $getv => $val)
|
||||
//clean up?
|
||||
$sfields[$getv] = $val;
|
||||
|
||||
$error = verify_fields($sfields);
|
||||
|
||||
$description = $_POST['description'];
|
||||
|
||||
if ($error == "")
|
||||
{ //verified so upload
|
||||
if (import_file($_POST['filename'],$description,$sfields))
|
||||
{
|
||||
print "<div class='well text-primary col-md-offset-2'><p>" . T_("Successfully imported sample") . " <h3>$description</h3></p></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print -"<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error importing file. Please try again") . "</p></div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
print "<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error:") . " $error </p><p>" . T_("Please check imported file, go back in your browser and fix the problem") . "</p></div>";
|
||||
|
||||
//verifiy that exactly one primary phone number is selected
|
||||
//upload to database
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
|
||||
}
|
||||
else if (isset($_POST['import_file']))
|
||||
{
|
||||
//file has been submitted
|
||||
$subtitle = T_("Select columns to import");
|
||||
xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle);
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
|
||||
print "<form action='' method='post' class='col-md-10 form-group col-md-offset-1'>";
|
||||
|
||||
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
|
||||
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
|
||||
|
||||
display_table(get_first_row($tmpfname));
|
||||
|
||||
?>
|
||||
<input type="hidden" name="description" value="<?php if (isset($_POST['description'])) print($_POST['description']); ?>"/>
|
||||
<input type="hidden" name="filename" value="<?php echo $tmpfname; ?>"/>
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="submit"></label>
|
||||
<div class="col-md-4">
|
||||
<button id="submit" type="submit" name="import_form" class="btn btn-primary"><i class="fa fa-plus-square-o fa-lg"></i> <?php echo T_("Add sample"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
}
|
||||
else
|
||||
{
|
||||
//need to supply file to upload
|
||||
$subtitle = T_("Select file to upload");
|
||||
xhtml_head(T_("Import sample") .":",true,$css,$js_head,false,false,false,$subtitle);
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default'><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
$ua = $_SERVER['HTTP_USER_AGENT'];
|
||||
if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv";
|
||||
//print "ua=" . $_SERVER['HTTP_USER_AGENT'];
|
||||
?>
|
||||
|
||||
<form class="form-horizontal col-sm-12 " enctype="multipart/form-data" action="" method="post">
|
||||
<fieldset>
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
|
||||
|
||||
<!-- File Button -->
|
||||
<div class="form-group">
|
||||
|
||||
<label class="col-md-4 control-label" for="file"><?php echo T_("Choose the CSV sample file to upload"); ?>:</label>
|
||||
<div class="col-md-4">
|
||||
<input id="file" name="file" class="filestyle" required data-buttonBefore="true" data-iconName="fa fa-folder-open fa-lg text-primary " data-buttonText="<?php echo T_("Select file"); ?>..." type="file" accept="<?php echo $csv; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="description"><?php echo T_("Sample description"); ?>:</label>
|
||||
<div class="col-md-4">
|
||||
<input id="description" name="description" type="text" required placeholder="<?php echo T_("Enter new sample name..."); ?>" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Button -->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="submit"></label>
|
||||
<div class="col-md-4">
|
||||
<button id="submit" type="submit" name="import_file" class="btn btn-primary"><i class="fa fa-plus-square-o fa-lg"></i> <?php echo T_("Add sample"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Import a sample from a Headered CSV file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Sample import functions
|
||||
*/
|
||||
include("../functions/functions.import.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/bootstrap-filestyle.min.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
if (isset($_POST['import_form']))
|
||||
{
|
||||
//form has been submitted
|
||||
$subtitle = T_("Validating and uploading");
|
||||
xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle);
|
||||
echo "<a href='?' class='btn btn-default pull-left' ><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
|
||||
//verify each GET field is unique (except import_form)
|
||||
$sfields = array();
|
||||
foreach($_POST as $getv => $val)
|
||||
//clean up?
|
||||
$sfields[$getv] = $val;
|
||||
|
||||
$error = verify_fields($sfields);
|
||||
|
||||
$description = $_POST['description'];
|
||||
|
||||
if ($error == "")
|
||||
{ //verified so upload
|
||||
if (import_file($_POST['filename'],$description,$sfields))
|
||||
{
|
||||
print "<div class='well text-primary col-md-offset-2'><p>" . T_("Successfully imported sample") . " <h3>$description</h3></p></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print -"<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error importing file. Please try again") . "</p></div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
print "<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error:") . " $error </p><p>" . T_("Please check imported file, go back in your browser and fix the problem") . "</p></div>";
|
||||
|
||||
//verifiy that exactly one primary phone number is selected
|
||||
//upload to database
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
|
||||
}
|
||||
else if (isset($_POST['import_file']))
|
||||
{
|
||||
//file has been submitted
|
||||
$subtitle = T_("Select columns to import");
|
||||
xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle);
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
|
||||
print "<form action='' method='post' class='col-md-10 form-group col-md-offset-1'>";
|
||||
|
||||
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
|
||||
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
|
||||
|
||||
display_table(get_first_row($tmpfname));
|
||||
|
||||
?>
|
||||
<input type="hidden" name="description" value="<?php if (isset($_POST['description'])) print($_POST['description']); ?>"/>
|
||||
<input type="hidden" name="filename" value="<?php echo $tmpfname; ?>"/>
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="submit"></label>
|
||||
<div class="col-md-4">
|
||||
<button id="submit" type="submit" name="import_form" class="btn btn-primary"><i class="fa fa-plus-square-o fa-lg"></i> <?php echo T_("Add sample"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
}
|
||||
else
|
||||
{
|
||||
//need to supply file to upload
|
||||
$subtitle = T_("Select file to upload");
|
||||
xhtml_head(T_("Import sample") .":",true,$css,$js_head,false,false,false,$subtitle);
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default'><i class='fa fa-chevron-left fa-lg text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
$ua = $_SERVER['HTTP_USER_AGENT'];
|
||||
if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv";
|
||||
//print "ua=" . $_SERVER['HTTP_USER_AGENT'];
|
||||
?>
|
||||
|
||||
<form class="form-horizontal col-sm-12 " enctype="multipart/form-data" action="" method="post">
|
||||
<fieldset>
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
|
||||
|
||||
<!-- File Button -->
|
||||
<div class="form-group">
|
||||
|
||||
<label class="col-md-4 control-label" for="file"><?php echo T_("Choose the CSV sample file to upload"); ?>:</label>
|
||||
<div class="col-md-4">
|
||||
<input id="file" name="file" class="filestyle" required data-buttonBefore="true" data-iconName="fa fa-folder-open fa-lg text-primary " data-buttonText="<?php echo T_("Select file"); ?>..." type="file" accept="<?php echo $csv; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="description"><?php echo T_("Sample description"); ?>:</label>
|
||||
<div class="col-md-4">
|
||||
<input id="description" name="description" type="text" required placeholder="<?php echo T_("Enter new sample name..."); ?>" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Button -->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="submit"></label>
|
||||
<div class="col-md-4">
|
||||
<button id="submit" type="submit" name="import_file" class="btn btn-primary"><i class="fa fa-plus-square-o fa-lg"></i> <?php echo T_("Add sample"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
}
|
||||
?>
|
||||
|
||||
396
admin/index.php
396
admin/index.php
@@ -1,198 +1,198 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
* Display an index of Admin tools
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Language file
|
||||
*/
|
||||
include ("../lang.inc.php");
|
||||
|
||||
/**
|
||||
* Config file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
include ("../functions/functions.xhtml.php");
|
||||
$username = $_SERVER['PHP_AUTH_USER'];
|
||||
?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" style="" class=" " >
|
||||
<head>
|
||||
<meta charset="utf-8" >
|
||||
<title><?php echo T_("Administrative Tools") ;?> </title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link rel="stylesheet" href="../include/bootstrap-3.3.2/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="../include/font-awesome-4.3.0/css/font-awesome.css" />
|
||||
<link rel="stylesheet" href="../css/style.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-header-fixed navbar navbar-fixed-top " role="banner">
|
||||
<div class="container" style=" width: auto; padding-left: 1px;">
|
||||
<div class="navbar-header">
|
||||
<a class="pull-left menubutton " href="#" style="width: 50px; padding-left: 10px;" data-toggle="tooltip" data-placement="right" title="<?php echo T_("Click to Collapse / Expand Sidebar MENU ");?>">
|
||||
<i class="fa fa-globe fa-2x fa-spin"></i></a>
|
||||
<a class="navbar-brand" href="index.php"><?php echo COMPANY_NAME ;?> <span class="bold"><?php echo ADMIN_PANEL_NAME ;?></span></a>
|
||||
</div >
|
||||
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li class="dropdown pull-right user-data">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style=" min-width: 160px;">
|
||||
<i class="fa fa-user fa fa-fw "></i><?php print T_("Logged as:") . " " . $username ;?>
|
||||
</a>
|
||||
<!--- User menu // not connected to pages so not working yet // could be hidden -->
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="?page=settings.php"><i class="fa fa-cogs fa-fw "></i> <?php print T_("Settings"); ?></a></li>
|
||||
<li><a href="../screenloc.php"><i class="fa fa-lock fa-fw "></i> <?php print T_("Lock Screen"); ?></a></li>
|
||||
<li><a href="../logout.php"><i class="fa fa-sign-out fa-fw "></i> <?php print T_("Logout"); ?> </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content ">
|
||||
|
||||
<!-- Sidebar menu -->
|
||||
<div class="sidebar" >
|
||||
<ul class="panel-group nav" id="nav">
|
||||
<li><a class="" href="?page=dashboard.php"><i class="fa fa-tachometer fa-lg"></i><span><?php print T_("Dashboard") ;?></span></a></li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-list-alt fa-lg"></i><span class="arrow"><?php print T_("Questionnairies") ;?></span></a>
|
||||
<ul style="">
|
||||
<li><a href="?page=<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-file-text-o lime fa-fw"></i><?php print T_("Create an instrument in Limesurvey") ;?></a></li>
|
||||
<li><a href="?page=new.php"><i class="fa fa-plus-circle fa-fw"></i><?php print T_("Create a new questionnaire") ;?></a></li>
|
||||
<li><a href="?page=questionnairelist.php"><i class="fa fa-list fa-fw"></i><?php print T_("Questionnaire management") ;?></a></li>
|
||||
<li><a href="?page=<?php echo LIME_URL ;?>admin/admin.php"><i class="fa fa-lemon-o lime fa-fw"></i><?php print T_("Administer instruments with Limesurvey") ;?></a></li>
|
||||
<li><a href="?page=questionnaireprefill.php"><i class="fa fa-thumb-tack fa-fw"></i><?php print T_("Pre-fill questionnaire") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-book fa-lg"></i><span><?php print T_("Samples") ;?></span></a>
|
||||
<ul style="">
|
||||
<li><a href="?page=import.php"><i class="fa fa-upload fa-fw"></i><?php print T_("Import a sample file") ;?></a></li>
|
||||
<li><a href="?page=samplelist.php"><i class="fa fa-list fa-fw"></i><?php print T_("Sample management") ;?></a></li>
|
||||
<li><a href="?page=samplesearch.php"><i class="fa fa-search fa-fw"></i><?php print T_("Search the sample") ;?></a></li>
|
||||
<li><a href="?page=assignsample.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign samples to questionnaires") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-calendar fa-lg"></i><span><?php print T_("Time slots and shifts") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=assigntimeslots.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign Time slots") ;?></a></li>
|
||||
<!-- <li><a href="?page=questionnaireavailability.php"><i class="fa fa-thumb-tack fa-fw"></i><?php // print T_("Assign Time slots to questionnaires") ;?></a></li>
|
||||
<li><a href="?page=questionnairecatimeslots.php"><i class="fa fa-link fa-fw"></i><?php // print T_("Assign call attempt time slots to questionnaire") ; ?></a></li>
|
||||
<li><a href="?page=questionnairecatimeslotssample.php"><i class="fa fa-link fa-fw"></i><?php // print T_("Assign call attempt time slots to questionnaire sample") ; ?></a></li> -->
|
||||
<li><a href="?page=addshift.php"><i class="fa fa-calendar-o fa-fw"></i><?php print T_("Shift management") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-filter fa-lg"></i><span><?php print T_("Quotas") ;?></span></a>
|
||||
<ul style="">
|
||||
<li><a href="?page=quota.php"><i class="fa fa-list-ol fa-fw"></i><?php print T_("Quota management") ;?></a></li>
|
||||
<li><a href="?page=quotarow.php"><i class="fa fa-list-ul fa-fw "></i><?php print T_("Quota row management") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-users"></i><span><?php print T_("Operators") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=operators.php"><i class="fa fa-user-plus fa-fw"></i><?php print T_("Add operators to the system") ;?></a></li>
|
||||
<li><a href="?page=operatorlist.php"><i class="fa fa-user fa-fw"></i><?php print T_("Operator management") ;?></a></li>
|
||||
<li><a href="?page=extensionstatus.php "><i class="fa fa-phone fa-fw"></i><?php print T_("Extension status") ;?></a></li>
|
||||
<li><a href="?page=operatorquestionnaire.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign operators to questionnaires") ;?></a></li>
|
||||
<li><a href="?page=operatorskill.php"><i class="fa fa-user-md fa-fw"></i><?php print T_("Modify operator skills") ;?></a></li>
|
||||
<li><a href="?page=operatorperformance.php"><i class="fa fa-signal fa-fw"></i><?php print T_("Operator performance") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-line-chart"></i><span><?php print T_("Results") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=displayappointments.php"><i class="fa fa-clock-o fa-fw"></i><span><?php print T_("Display all future appointments") ;?></span></a></li>
|
||||
<li><a href="?page=samplecallattempts.php"><i class="fa fa-table fa-fw"></i><?php print T_("Sample call attempts report") ;?></a></li>
|
||||
<li><a href="?page=callhistory.php" class=""><i class="fa fa-history fa-fw"></i><?php print T_("Call history") ;?></a></li>
|
||||
<li><a href="?page=shiftreport.php"><i class="fa fa-th-large fa-fw"></i><?php print T_("Shift reports") ;?></a></li>
|
||||
<li><a href="?page=quotareport.php" ><i class="fa fa-filter fa-fw"></i><?php print T_("Quota report") ;?></a></li>
|
||||
<li><a href="?page=outcomes.php"><i class="fa fa-bar-chart fa-fw"></i><?php print T_("Questionnaire outcomes") ;?></a></li>
|
||||
<li><a href="?page=dataoutput.php"><i class="fa fa-download fa-fw"></i><?php print T_("Data output") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-user-secret fa-fw"></i><span><?php print T_("Clients") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=clients.php"><i class="fa fa-lg fa-user-plus fa-fw"></i><?php print T_("Add clients to the system") ;?></a></li>
|
||||
<li><a href="?page=clientquestionnaire.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign clients to questionnaires") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-briefcase"></i><span><?php print T_("Supervisor functions") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=supervisor.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign outcomes to cases") ;?></a></li>
|
||||
<li><a href="?page=casestatus.php"><i class="fa fa-question-circle fa-fw"></i><?php print T_("Case status and assignment") ;?></a></li>
|
||||
<li><a href="?page=bulkappointment.php"><i class="fa fa-th-list fa-fw"></i><?php print T_("Bulk appointment generator") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-gear"></i><span><?php print T_("System settings") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=timezonetemplate.php"><i class="fa fa-globe fa-fw"></i><?php print T_("Set default timezone list") ;?></a></li>
|
||||
<li><a href="?page=availabilitygroup.php"><i class="fa fa-clock-o fa-fw"></i><?php print T_("Manage Time slots") ;?></a></li>
|
||||
<li><a href="?page=shifttemplate.php"><i class="fa fa-calendar fa-fw"></i><?php print T_("Set default shift times") ;?></a></li>
|
||||
<li><a href="?page=callrestrict.php"><i class="fa fa-clock-o fa-fw"></i><?php print T_("Set call restriction times") ;?></a></li>
|
||||
<li><a href="?page=centreinfo.php"><i class="fa fa-university fa-fw"></i><?php print T_("Set centre information") ;?></a></li>
|
||||
<li><a href="?page=supervisorchat.php"><i class="fa fa-comments-o fa-fw"></i><?php print T_("Supervisor chat") ;?></a></li>
|
||||
<li><a href="?page=systemsort.php"><i class="fa fa-sort fa-fw"></i><?php print T_("System wide case sorting") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
if (VOIP_ENABLED == true )
|
||||
{ ; ?>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-tty"></i><span><?php print T_("VoIP");?><i class="fa fa-toggle-on pull-right" style="font-size:1.5em !important; margin-right:20px;"></i></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=voipmonitor.php"><i class="fa fa-power-off v"></i><?php print T_("Start and monitor VoIP") ;?></a></li>
|
||||
<!-- <li><a href="?page=extensionstatus.php"><i class="fa fa-asterisk fa-fw"></i><?php //print T_("Extension status") ;?></a></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php } else {; ?>
|
||||
<li class=""><a href="" class=""><i class="fa fa-lg fa-tty"></i><span><?php print T_("VoIP") . " " . T_("Disabled") ;?><i class="fa fa-toggle-off pull-right" style="font-size:1.5em !important; margin-right:20px;"></i></span></a></li>
|
||||
<?php }; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Main page container -->
|
||||
<?php $page = "questionnairelist.php"; if (isset($_GET['page'])) $page = $_GET['page']; ?>
|
||||
<div class="mainbar" id=" "><?php xhtml_object($page,' '); ?></div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
<script src="../js/jquery-2.1.3.min.js"></script>
|
||||
<script src="../include/bootstrap-3.3.2/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="../js/admin.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
/*
|
||||
|
||||
* Display an index of Admin tools
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Language file
|
||||
*/
|
||||
include ("../lang.inc.php");
|
||||
|
||||
/**
|
||||
* Config file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
include ("../functions/functions.xhtml.php");
|
||||
$username = $_SERVER['PHP_AUTH_USER'];
|
||||
?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" style="" class=" " >
|
||||
<head>
|
||||
<meta charset="utf-8" >
|
||||
<title><?php echo T_("Administrative Tools") ;?> </title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link rel="stylesheet" href="../include/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="../include/font-awesome/css/font-awesome.css" />
|
||||
<link rel="stylesheet" href="../css/style.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-header-fixed navbar navbar-fixed-top " role="banner">
|
||||
<div class="container" style=" width: auto; padding-left: 1px;">
|
||||
<div class="navbar-header">
|
||||
<a class="pull-left menubutton " href="#" style="width: 50px; padding-left: 10px;" data-toggle="tooltip" data-placement="right" title="<?php echo T_("Click to Collapse / Expand Sidebar MENU ");?>">
|
||||
<i class="fa fa-globe fa-2x fa-spin"></i></a>
|
||||
<a class="navbar-brand" href="index.php"><?php echo COMPANY_NAME ;?> <span class="bold"><?php echo ADMIN_PANEL_NAME ;?></span></a>
|
||||
</div >
|
||||
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li class="dropdown pull-right user-data">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style=" min-width: 160px;">
|
||||
<i class="fa fa-user fa fa-fw "></i><?php print T_("Logged as:") . " " . $username ;?>
|
||||
</a>
|
||||
<!--- User menu // not connected to pages so not working yet // could be hidden -->
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="?page=settings.php"><i class="fa fa-cogs fa-fw "></i> <?php print T_("Settings"); ?></a></li>
|
||||
<li><a href="../screenloc.php"><i class="fa fa-lock fa-fw "></i> <?php print T_("Lock Screen"); ?></a></li>
|
||||
<li><a href="../logout.php"><i class="fa fa-sign-out fa-fw "></i> <?php print T_("Logout"); ?> </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content ">
|
||||
|
||||
<!-- Sidebar menu -->
|
||||
<div class="sidebar" >
|
||||
<ul class="panel-group nav" id="nav">
|
||||
<li><a class="" href="?page=dashboard.php"><i class="fa fa-tachometer fa-lg"></i><span><?php print T_("Dashboard") ;?></span></a></li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-list-alt fa-lg"></i><span class="arrow"><?php print T_("Questionnairies") ;?></span></a>
|
||||
<ul style="">
|
||||
<li><a href="?page=<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-file-text-o lime fa-fw"></i><?php print T_("Create an instrument in Limesurvey") ;?></a></li>
|
||||
<li><a href="?page=new.php"><i class="fa fa-plus-circle fa-fw"></i><?php print T_("Create a new questionnaire") ;?></a></li>
|
||||
<li><a href="?page=questionnairelist.php"><i class="fa fa-list fa-fw"></i><?php print T_("Questionnaire management") ;?></a></li>
|
||||
<li><a href="?page=<?php echo LIME_URL ;?>admin/admin.php"><i class="fa fa-lemon-o lime fa-fw"></i><?php print T_("Administer instruments with Limesurvey") ;?></a></li>
|
||||
<li><a href="?page=questionnaireprefill.php"><i class="fa fa-thumb-tack fa-fw"></i><?php print T_("Pre-fill questionnaire") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-book fa-lg"></i><span><?php print T_("Samples") ;?></span></a>
|
||||
<ul style="">
|
||||
<li><a href="?page=import.php"><i class="fa fa-upload fa-fw"></i><?php print T_("Import a sample file") ;?></a></li>
|
||||
<li><a href="?page=samplelist.php"><i class="fa fa-list fa-fw"></i><?php print T_("Sample management") ;?></a></li>
|
||||
<li><a href="?page=samplesearch.php"><i class="fa fa-search fa-fw"></i><?php print T_("Search the sample") ;?></a></li>
|
||||
<li><a href="?page=assignsample.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign samples to questionnaires") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-calendar fa-lg"></i><span><?php print T_("Time slots and shifts") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=assigntimeslots.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign Time slots") ;?></a></li>
|
||||
<!-- <li><a href="?page=questionnaireavailability.php"><i class="fa fa-thumb-tack fa-fw"></i><?php // print T_("Assign Time slots to questionnaires") ;?></a></li>
|
||||
<li><a href="?page=questionnairecatimeslots.php"><i class="fa fa-link fa-fw"></i><?php // print T_("Assign call attempt time slots to questionnaire") ; ?></a></li>
|
||||
<li><a href="?page=questionnairecatimeslotssample.php"><i class="fa fa-link fa-fw"></i><?php // print T_("Assign call attempt time slots to questionnaire sample") ; ?></a></li> -->
|
||||
<li><a href="?page=addshift.php"><i class="fa fa-calendar-o fa-fw"></i><?php print T_("Shift management") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-filter fa-lg"></i><span><?php print T_("Quotas") ;?></span></a>
|
||||
<ul style="">
|
||||
<li><a href="?page=quota.php"><i class="fa fa-list-ol fa-fw"></i><?php print T_("Quota management") ;?></a></li>
|
||||
<li><a href="?page=quotarow.php"><i class="fa fa-list-ul fa-fw "></i><?php print T_("Quota row management") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-users"></i><span><?php print T_("Operators") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=operators.php"><i class="fa fa-user-plus fa-fw"></i><?php print T_("Add operators to the system") ;?></a></li>
|
||||
<li><a href="?page=operatorlist.php"><i class="fa fa-user fa-fw"></i><?php print T_("Operator management") ;?></a></li>
|
||||
<li><a href="?page=extensionstatus.php "><i class="fa fa-phone fa-fw"></i><?php print T_("Extension status") ;?></a></li>
|
||||
<li><a href="?page=operatorquestionnaire.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign operators to questionnaires") ;?></a></li>
|
||||
<li><a href="?page=operatorskill.php"><i class="fa fa-user-md fa-fw"></i><?php print T_("Modify operator skills") ;?></a></li>
|
||||
<li><a href="?page=operatorperformance.php"><i class="fa fa-signal fa-fw"></i><?php print T_("Operator performance") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-line-chart"></i><span><?php print T_("Results") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=displayappointments.php"><i class="fa fa-clock-o fa-fw"></i><span><?php print T_("Display all future appointments") ;?></span></a></li>
|
||||
<li><a href="?page=samplecallattempts.php"><i class="fa fa-table fa-fw"></i><?php print T_("Sample call attempts report") ;?></a></li>
|
||||
<li><a href="?page=callhistory.php" class=""><i class="fa fa-history fa-fw"></i><?php print T_("Call history") ;?></a></li>
|
||||
<li><a href="?page=shiftreport.php"><i class="fa fa-th-large fa-fw"></i><?php print T_("Shift reports") ;?></a></li>
|
||||
<li><a href="?page=quotareport.php" ><i class="fa fa-filter fa-fw"></i><?php print T_("Quota report") ;?></a></li>
|
||||
<li><a href="?page=outcomes.php"><i class="fa fa-bar-chart fa-fw"></i><?php print T_("Questionnaire outcomes") ;?></a></li>
|
||||
<li><a href="?page=dataoutput.php"><i class="fa fa-download fa-fw"></i><?php print T_("Data output") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-user-secret fa-fw"></i><span><?php print T_("Clients") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=clients.php"><i class="fa fa-lg fa-user-plus fa-fw"></i><?php print T_("Add clients to the system") ;?></a></li>
|
||||
<li><a href="?page=clientquestionnaire.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign clients to questionnaires") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-briefcase"></i><span><?php print T_("Supervisor functions") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=supervisor.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign outcomes to cases") ;?></a></li>
|
||||
<li><a href="?page=casestatus.php"><i class="fa fa-question-circle fa-fw"></i><?php print T_("Case status and assignment") ;?></a></li>
|
||||
<li><a href="?page=bulkappointment.php"><i class="fa fa-th-list fa-fw"></i><?php print T_("Bulk appointment generator") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-gear"></i><span><?php print T_("System settings") ;?></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=timezonetemplate.php"><i class="fa fa-globe fa-fw"></i><?php print T_("Set default timezone list") ;?></a></li>
|
||||
<li><a href="?page=availabilitygroup.php"><i class="fa fa-clock-o fa-fw"></i><?php print T_("Manage Time slots") ;?></a></li>
|
||||
<li><a href="?page=shifttemplate.php"><i class="fa fa-calendar fa-fw"></i><?php print T_("Set default shift times") ;?></a></li>
|
||||
<li><a href="?page=callrestrict.php"><i class="fa fa-clock-o fa-fw"></i><?php print T_("Set call restriction times") ;?></a></li>
|
||||
<li><a href="?page=centreinfo.php"><i class="fa fa-university fa-fw"></i><?php print T_("Set centre information") ;?></a></li>
|
||||
<li><a href="?page=supervisorchat.php"><i class="fa fa-comments-o fa-fw"></i><?php print T_("Supervisor chat") ;?></a></li>
|
||||
<li><a href="?page=systemsort.php"><i class="fa fa-sort fa-fw"></i><?php print T_("System wide case sorting") ;?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
if (VOIP_ENABLED == true )
|
||||
{ ; ?>
|
||||
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-tty"></i><span><?php print T_("VoIP");?><i class="fa fa-toggle-on pull-right" style="font-size:1.5em !important; margin-right:20px;"></i></span></a>
|
||||
<ul class="" style="">
|
||||
<li><a href="?page=voipmonitor.php"><i class="fa fa-power-off v"></i><?php print T_("Start and monitor VoIP") ;?></a></li>
|
||||
<!-- <li><a href="?page=extensionstatus.php"><i class="fa fa-asterisk fa-fw"></i><?php //print T_("Extension status") ;?></a></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php } else {; ?>
|
||||
<li class=""><a href="" class=""><i class="fa fa-lg fa-tty"></i><span><?php print T_("VoIP") . " " . T_("Disabled") ;?><i class="fa fa-toggle-off pull-right" style="font-size:1.5em !important; margin-right:20px;"></i></span></a></li>
|
||||
<?php }; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Main page container -->
|
||||
<?php $page = "questionnairelist.php"; if (isset($_GET['page'])) $page = $_GET['page']; ?>
|
||||
<div class="mainbar" id=" "><?php xhtml_object($page,' '); ?></div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
<script src="../include/jquery/jquery.min.js"></script>
|
||||
<script src="../include/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="../js/admin.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
756
admin/new.php
756
admin/new.php
@@ -1,378 +1,378 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/new.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Create a new questionnaire"),true,$css,$js_head);
|
||||
|
||||
if (isset($_POST['import_file']))
|
||||
{
|
||||
//file has been submitted
|
||||
$ras =0;
|
||||
$rws = 0;
|
||||
$testing = 0;
|
||||
$referral = 0;
|
||||
$rs = 0;
|
||||
$lime_sid = 0;
|
||||
$respsc = 0;
|
||||
$lime_rs_sid = "NULL";
|
||||
if (isset($_POST['ras'])) $ras = 1;
|
||||
if (isset($_POST['rws'])) $rws = 1;
|
||||
if (isset($_POST['testing'])) $testing = 1;
|
||||
if (isset($_POST['respsc'])) $respsc = 1;
|
||||
if (isset($_POST['referral'])) $respsc = 1;
|
||||
if ($_POST['selectrs'] != "none") $rs = 1;
|
||||
|
||||
$name = $db->qstr($_POST['description']);
|
||||
$rs_intro = $db->qstr(html_entity_decode($_POST['rs_intro'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_project_intro = $db->qstr(html_entity_decode($_POST['rs_project_intro'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_callback = $db->qstr(html_entity_decode($_POST['rs_callback'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_answeringmachine = $db->qstr(html_entity_decode($_POST['rs_answeringmachine'],ENT_QUOTES,'UTF-8'));
|
||||
$info = $db->qstr(html_entity_decode($_POST['info'],ENT_QUOTES,'UTF-8'));
|
||||
|
||||
//use existing lime instrument
|
||||
$lime_sid = bigintval($_POST['select']);
|
||||
|
||||
|
||||
if (is_numeric($_POST['selectrs']))
|
||||
{
|
||||
$lime_rs_sid = bigintval($_POST['selectrs']);
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete,referral)
|
||||
VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc,$referral)";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if ($rs)
|
||||
{
|
||||
$qid = $db->Insert_ID();
|
||||
if ($respsc == 1)
|
||||
{
|
||||
$lime_mode = $db->qstr($_POST['lime_mode']);
|
||||
$lime_template = $db->qstr($_POST['lime_template']);
|
||||
$lime_endurl = $db->qstr($_POST['lime_endurl']);
|
||||
|
||||
$sql = "UPDATE questionnaire
|
||||
SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
|
||||
WHERE questionnaire_id = $qid";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
$cl = info;
|
||||
$message = T_("Successfully inserted") . " " . T_("with ID") . "  $qid, </h4><h4>" . T_("linked to survey") . "  $lime_sid ";
|
||||
|
||||
}
|
||||
else{
|
||||
$cl = danger;
|
||||
$message = T_("Error: Failed to insert questionnaire");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript" >
|
||||
$(function() {
|
||||
$('#modal-confirm').modal('show');
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$_POST['import_file'] = false;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Modal window confirmation start -->
|
||||
<div class="modal fade " id="modal-confirm">
|
||||
<div class="modal-dialog ">
|
||||
<div class="modal-content ">
|
||||
<div class="modal-header" style="border-bottom:none;">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-header"><?php echo T_("Questionnaire");?>  <strong class="text-<?php echo $cl;?>"> <?php echo $name; ?></strong></h4>
|
||||
</div>
|
||||
<div class="modal-body ">
|
||||
<div class="alert alert-<?php echo $cl;?> text-center" role="alert">
|
||||
<h4> <?php print $message ;?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" style="borfer-top:none">
|
||||
<button class="btn btn-default pull-left" data-dismiss="modal" style="width: 250px;" ><i class="fa fa-check fa-2x pull-right text-<?php echo $cl;?>"></i> <?php echo T_("Create another ?");?><br><?php echo T_("Questionnaire");?></button>  
|
||||
<a href="questionnairelist.php" class="btn btn-default pull-right" style="width: 250px;" ><i class="fa fa-list text-<?php echo $cl;?> fa-2x pull-left"></i><?php echo T_("No, Thank you, go to");?> <br><?php echo T_("Questionnaire management");?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /modal end -->
|
||||
|
||||
<!-- create new questionnaire -->
|
||||
<body>
|
||||
|
||||
|
||||
<a href="questionnairelist.php" class="btn btn-default pull-left" ><i class="fa fa-list text-primary"></i> <?php echo T_("Go to");?> <?php echo T_("Questionnaire management");?> </a>
|
||||
|
||||
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal col-lg-12" >
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
|
||||
<div class="form-group">
|
||||
<label class="col-lg-4 control-label" ><?php echo T_("Name for questionnaire:"); ?> </label>
|
||||
<div class="col-lg-4">
|
||||
<input type="text" name="description" class="form-control" required placeholder="<?php echo T_("Enter New questionnaire name..");?>" title="<?php echo T_("Name for questionnaire:") ; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title
|
||||
FROM " . LIME_PREFIX . "surveys AS s
|
||||
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
|
||||
WHERE s.active = 'Y'
|
||||
GROUP BY s.sid";
|
||||
$surveys = $db->GetAll($sql);
|
||||
?>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Select limesurvey instrument:");?> </label>
|
||||
<div class='col-sm-4'>
|
||||
<?php if (!empty($surveys)){?>
|
||||
<select name="select" class="form-control">
|
||||
<?php foreach($surveys as $s){?>
|
||||
<option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:"), " ", $s['title'] ;?></option><?php } ?>
|
||||
</select>
|
||||
<?php } else { ?>
|
||||
<a class="btn btn-lime" href="<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-lemon-o text-danger"></i> <?php echo T_("Create an instrument in Limesurvey") ;?></a> <?php } ?>
|
||||
</div>
|
||||
<div class='col-sm-4'>
|
||||
<strong><?php echo T_("or") ;?> </strong>
|
||||
<a class="btn btn-lime" href="<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-lemon-o text-danger"></i> <?php echo T_("Create an instrument in Limesurvey") ;?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Respondent selection type:"); ?> </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="selectrs" id="selectrs" onchange="if(this.value == 'old') show(this,'rstext'); else hide(this,'rstext')">
|
||||
<option value="none"><?php echo T_("No respondent selection (go straight to questionnaire)"); ?></option>
|
||||
<option value="old" ><?php echo T_("Use basic respondent selection text (below)"); ?></option>
|
||||
<?php
|
||||
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title
|
||||
FROM " . LIME_PREFIX . "surveys AS s
|
||||
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
|
||||
WHERE s.active = 'Y'";
|
||||
$surveys = $db->GetAll($sql);
|
||||
|
||||
if (!empty($surveys)){ foreach($surveys as $s){ ?>
|
||||
<option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:") ," ", $s['title'] ;?></option>
|
||||
<?php } } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Restrict appointments to shifts?"); ?></label>
|
||||
<div class="col-sm-4" style="height: 30px;">
|
||||
<input name="ras" type="checkbox" checked="checked" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Restrict work to shifts?"); ?></label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="rws" type="checkbox" checked="checked" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Questionnaire for testing only?"); ?></label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="testing" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-width="80" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Allow operators to generate referrals?"); ?></label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="referral" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Allow for respondent self completion via email invitation?"); ?> </label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="respsc" type="checkbox" onchange="if(this.checked==true) {show(this,'limesc'); $('#url').attr('required','required');} else{ hide(this,'limesc'); $('#url').removeAttr('required');}" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="limesc" style="display:none" >
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Questionnaire display mode for respondent");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="lime_mode">
|
||||
<option value="survey"><?php echo T_("All in one"); ?></option>
|
||||
<option value="question"><?php echo T_("Question by question"); ?></option>
|
||||
<option value="group"><?php echo T_("Group at a time"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Limesurvey template for respondent");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="lime_template">
|
||||
<?php
|
||||
if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/templates")) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/templates/" . $entry)){
|
||||
echo "<option value=\"$entry\">$entry</option>";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label text-danger" ><?php echo T_("URL to forward respondents on self completion (required)");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" name="lime_endurl" id="url" type="url" placeholder="<?php print SITE_URL ;?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
/* CKEditor */
|
||||
|
||||
include("../include/ckeditor/ckeditor.php");
|
||||
|
||||
$CKEditor = new CKEditor();
|
||||
$CKEditor->basePath = "../include/ckeditor/";
|
||||
|
||||
$ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"),
|
||||
array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"),
|
||||
array("Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"),
|
||||
array('Link','Unlink','Anchor'),
|
||||
array('Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'),
|
||||
array('About'),
|
||||
"/",
|
||||
array("Bold","Italic","Underline","Strike","-","Subscript","Superscript"),
|
||||
array("NumberedList","BulletedList","-","Outdent","Indent","Blockquote"),
|
||||
array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
|
||||
array('BidiLtr', 'BidiRtl'),
|
||||
array('Styles','Format','Font','FontSize'),
|
||||
array('TextColor','BGColor')),
|
||||
"extraPlugins" => "tokens");
|
||||
?>
|
||||
|
||||
<div id="rstext" class=" " style="display:none ">
|
||||
|
||||
<div class="panel panel-default" >
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title text-primary "><?php echo T_("Respondent selection introduction:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_intro","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" >
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title text-primary "><?php echo T_("Respondent selection project introduction:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_project_intro","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title text-primary"><?php echo T_("Respondent selection callback (already started questionnaire):");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_callback","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title "><?php echo T_("Message to leave on an answering machine:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_answeringmachine","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title "><?php echo T_("Project end text (thank you screen):");?></h3>
|
||||
</div>
|
||||
<div class="content" >
|
||||
<?php echo $CKEditor->editor("rs_project_end","",$ckeditorConfig); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default ">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title"><?php echo T_("Project information for interviewers/operators:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("info","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-4 ">
|
||||
<a href="questionnairelist.php" class="btn btn-default pull-right" ><i class="fa fa-list text-primary"></i> <?php echo T_("Go to");?> <?php echo T_("Questionnaire management");?></a>
|
||||
</div>
|
||||
<div class="col-sm-4 ">
|
||||
<button type="submit" class="btn btn-default pull-right" name="import_file" ><i class="fa fa-check-square-o fa-lg text-primary"></i> <?php echo T_("Create Questionnaire"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);//
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/new.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Create a new questionnaire"),true,$css,$js_head);
|
||||
|
||||
if (isset($_POST['import_file']))
|
||||
{
|
||||
//file has been submitted
|
||||
$ras =0;
|
||||
$rws = 0;
|
||||
$testing = 0;
|
||||
$referral = 0;
|
||||
$rs = 0;
|
||||
$lime_sid = 0;
|
||||
$respsc = 0;
|
||||
$lime_rs_sid = "NULL";
|
||||
if (isset($_POST['ras'])) $ras = 1;
|
||||
if (isset($_POST['rws'])) $rws = 1;
|
||||
if (isset($_POST['testing'])) $testing = 1;
|
||||
if (isset($_POST['respsc'])) $respsc = 1;
|
||||
if (isset($_POST['referral'])) $respsc = 1;
|
||||
if ($_POST['selectrs'] != "none") $rs = 1;
|
||||
|
||||
$name = $db->qstr($_POST['description']);
|
||||
$rs_intro = $db->qstr(html_entity_decode($_POST['rs_intro'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_project_intro = $db->qstr(html_entity_decode($_POST['rs_project_intro'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_callback = $db->qstr(html_entity_decode($_POST['rs_callback'],ENT_QUOTES,'UTF-8'));
|
||||
$rs_answeringmachine = $db->qstr(html_entity_decode($_POST['rs_answeringmachine'],ENT_QUOTES,'UTF-8'));
|
||||
$info = $db->qstr(html_entity_decode($_POST['info'],ENT_QUOTES,'UTF-8'));
|
||||
|
||||
//use existing lime instrument
|
||||
$lime_sid = bigintval($_POST['select']);
|
||||
|
||||
|
||||
if (is_numeric($_POST['selectrs']))
|
||||
{
|
||||
$lime_rs_sid = bigintval($_POST['selectrs']);
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete,referral)
|
||||
VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc,$referral)";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if ($rs)
|
||||
{
|
||||
$qid = $db->Insert_ID();
|
||||
if ($respsc == 1)
|
||||
{
|
||||
$lime_mode = $db->qstr($_POST['lime_mode']);
|
||||
$lime_template = $db->qstr($_POST['lime_template']);
|
||||
$lime_endurl = $db->qstr($_POST['lime_endurl']);
|
||||
|
||||
$sql = "UPDATE questionnaire
|
||||
SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
|
||||
WHERE questionnaire_id = $qid";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
$cl = info;
|
||||
$message = T_("Successfully inserted") . " " . T_("with ID") . "  $qid, </h4><h4>" . T_("linked to survey") . "  $lime_sid ";
|
||||
|
||||
}
|
||||
else{
|
||||
$cl = danger;
|
||||
$message = T_("Error: Failed to insert questionnaire");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript" >
|
||||
$(function() {
|
||||
$('#modal-confirm').modal('show');
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$_POST['import_file'] = false;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Modal window confirmation start -->
|
||||
<div class="modal fade " id="modal-confirm">
|
||||
<div class="modal-dialog ">
|
||||
<div class="modal-content ">
|
||||
<div class="modal-header" style="border-bottom:none;">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-header"><?php echo T_("Questionnaire");?>  <strong class="text-<?php echo $cl;?>"> <?php echo $name; ?></strong></h4>
|
||||
</div>
|
||||
<div class="modal-body ">
|
||||
<div class="alert alert-<?php echo $cl;?> text-center" role="alert">
|
||||
<h4> <?php print $message ;?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" style="borfer-top:none">
|
||||
<button class="btn btn-default pull-left" data-dismiss="modal" style="width: 250px;" ><i class="fa fa-check fa-2x pull-right text-<?php echo $cl;?>"></i> <?php echo T_("Create another ?");?><br><?php echo T_("Questionnaire");?></button>  
|
||||
<a href="questionnairelist.php" class="btn btn-default pull-right" style="width: 250px;" ><i class="fa fa-list text-<?php echo $cl;?> fa-2x pull-left"></i><?php echo T_("No, Thank you, go to");?> <br><?php echo T_("Questionnaire management");?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /modal end -->
|
||||
|
||||
<!-- create new questionnaire -->
|
||||
<body>
|
||||
|
||||
|
||||
<a href="questionnairelist.php" class="btn btn-default pull-left" ><i class="fa fa-list text-primary"></i> <?php echo T_("Go to");?> <?php echo T_("Questionnaire management");?> </a>
|
||||
|
||||
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal col-lg-12" >
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
|
||||
<div class="form-group">
|
||||
<label class="col-lg-4 control-label" ><?php echo T_("Name for questionnaire:"); ?> </label>
|
||||
<div class="col-lg-4">
|
||||
<input type="text" name="description" class="form-control" required placeholder="<?php echo T_("Enter New questionnaire name..");?>" title="<?php echo T_("Name for questionnaire:") ; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title
|
||||
FROM " . LIME_PREFIX . "surveys AS s
|
||||
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
|
||||
WHERE s.active = 'Y'
|
||||
GROUP BY s.sid";
|
||||
$surveys = $db->GetAll($sql);
|
||||
?>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Select limesurvey instrument:");?> </label>
|
||||
<div class='col-sm-4'>
|
||||
<?php if (!empty($surveys)){?>
|
||||
<select name="select" class="form-control">
|
||||
<?php foreach($surveys as $s){?>
|
||||
<option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:"), " ", $s['title'] ;?></option><?php } ?>
|
||||
</select>
|
||||
<?php } else { ?>
|
||||
<a class="btn btn-lime" href="<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-lemon-o text-danger"></i> <?php echo T_("Create an instrument in Limesurvey") ;?></a> <?php } ?>
|
||||
</div>
|
||||
<div class='col-sm-4'>
|
||||
<strong><?php echo T_("or") ;?> </strong>
|
||||
<a class="btn btn-lime" href="<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-lemon-o text-danger"></i> <?php echo T_("Create an instrument in Limesurvey") ;?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Respondent selection type:"); ?> </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="selectrs" id="selectrs" onchange="if(this.value == 'old') show(this,'rstext'); else hide(this,'rstext')">
|
||||
<option value="none"><?php echo T_("No respondent selection (go straight to questionnaire)"); ?></option>
|
||||
<option value="old" ><?php echo T_("Use basic respondent selection text (below)"); ?></option>
|
||||
<?php
|
||||
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title
|
||||
FROM " . LIME_PREFIX . "surveys AS s
|
||||
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
|
||||
WHERE s.active = 'Y'";
|
||||
$surveys = $db->GetAll($sql);
|
||||
|
||||
if (!empty($surveys)){ foreach($surveys as $s){ ?>
|
||||
<option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:") ," ", $s['title'] ;?></option>
|
||||
<?php } } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Restrict appointments to shifts?"); ?></label>
|
||||
<div class="col-sm-4" style="height: 30px;">
|
||||
<input name="ras" type="checkbox" checked="checked" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Restrict work to shifts?"); ?></label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="rws" type="checkbox" checked="checked" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Questionnaire for testing only?"); ?></label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="testing" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-width="80" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Allow operators to generate referrals?"); ?></label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="referral" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Allow for respondent self completion via email invitation?"); ?> </label>
|
||||
<div class="col-sm-4"style="height: 30px;">
|
||||
<input name="respsc" type="checkbox" onchange="if(this.checked==true) {show(this,'limesc'); $('#url').attr('required','required');} else{ hide(this,'limesc'); $('#url').removeAttr('required');}" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="limesc" style="display:none" >
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Questionnaire display mode for respondent");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="lime_mode">
|
||||
<option value="survey"><?php echo T_("All in one"); ?></option>
|
||||
<option value="question"><?php echo T_("Question by question"); ?></option>
|
||||
<option value="group"><?php echo T_("Group at a time"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label" ><?php echo T_("Limesurvey template for respondent");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" name="lime_template">
|
||||
<?php
|
||||
if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/templates")) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/templates/" . $entry)){
|
||||
echo "<option value=\"$entry\">$entry</option>";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label text-danger" ><?php echo T_("URL to forward respondents on self completion (required)");?>: </label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" name="lime_endurl" id="url" type="url" placeholder="<?php print SITE_URL ;?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
/* CKEditor */
|
||||
|
||||
include("../include/ckeditor/ckeditor.php");
|
||||
|
||||
$CKEditor = new CKEditor();
|
||||
$CKEditor->basePath = "../include/ckeditor/";
|
||||
|
||||
$ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"),
|
||||
array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"),
|
||||
array("Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"),
|
||||
array('Link','Unlink','Anchor'),
|
||||
array('Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'),
|
||||
array('About'),
|
||||
"/",
|
||||
array("Bold","Italic","Underline","Strike","-","Subscript","Superscript"),
|
||||
array("NumberedList","BulletedList","-","Outdent","Indent","Blockquote"),
|
||||
array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
|
||||
array('BidiLtr', 'BidiRtl'),
|
||||
array('Styles','Format','Font','FontSize'),
|
||||
array('TextColor','BGColor')),
|
||||
"extraPlugins" => "tokens");
|
||||
?>
|
||||
|
||||
<div id="rstext" class=" " style="display:none ">
|
||||
|
||||
<div class="panel panel-default" >
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title text-primary "><?php echo T_("Respondent selection introduction:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_intro","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" >
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title text-primary "><?php echo T_("Respondent selection project introduction:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_project_intro","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title text-primary"><?php echo T_("Respondent selection callback (already started questionnaire):");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_callback","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title "><?php echo T_("Message to leave on an answering machine:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("rs_answeringmachine","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title "><?php echo T_("Project end text (thank you screen):");?></h3>
|
||||
</div>
|
||||
<div class="content" >
|
||||
<?php echo $CKEditor->editor("rs_project_end","",$ckeditorConfig); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default ">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-2x wminimize fa-chevron-circle-up text-primary pull-left" data-toggle="tooltip" title="<?php echo T_("Expand/Collapse");?>" style="margin-top: -5px;"></i>
|
||||
<h3 class="panel-title"><?php echo T_("Project information for interviewers/operators:");?></h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $CKEditor->editor("info","",$ckeditorConfig);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-4 ">
|
||||
<a href="questionnairelist.php" class="btn btn-default pull-right" ><i class="fa fa-list text-primary"></i> <?php echo T_("Go to");?> <?php echo T_("Questionnaire management");?></a>
|
||||
</div>
|
||||
<div class="col-sm-4 ">
|
||||
<button type="submit" class="btn btn-default pull-right" name="import_file" ><i class="fa fa-check-square-o fa-lg text-primary"></i> <?php echo T_("Create Questionnaire"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot($js_foot);//
|
||||
?>
|
||||
|
||||
@@ -1,406 +1,406 @@
|
||||
<?php
|
||||
/**
|
||||
* List operators and allow for customised VoIP downloads, changing passwords, disabling, etc
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2007,2008,2009,2010,2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../db.inc.php');
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../functions/functions.xhtml.php');
|
||||
|
||||
$display = true;
|
||||
$msg = "";
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$operator_id = intval($_POST['operator_id']);
|
||||
$chat_enable = $voip = $enabled = 0;
|
||||
if (isset($_POST['voip'])) $voip = 1;
|
||||
if (isset($_POST['chat_enable'])) $chat_enable = 1;
|
||||
if (isset($_POST['enabled'])) $enabled = 1;
|
||||
|
||||
if (HTPASSWD_PATH !== false && $_POST['existing_username'] != $_POST['username'] && empty($_POST['password']))
|
||||
{
|
||||
$msg = "<div class='alert alert-danger'><h3>" . T_("If changing usernames, you must specify a new password") . "</h3></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "UPDATE operator
|
||||
SET username = " . $db->qstr($_POST['username']) . ",
|
||||
lastName = " . $db->qstr($_POST['lastName']) . ",
|
||||
firstName = " . $db->qstr($_POST['firstName']) . ",
|
||||
chat_user = " . $db->qstr($_POST['chat_user']) . ",
|
||||
chat_password = " . $db->qstr($_POST['chat_password']) . ",
|
||||
Time_zone_name = " . $db->qstr($_POST['timezone']) . ",
|
||||
voip = $voip, enabled = $enabled, chat_enable = $chat_enable
|
||||
WHERE operator_id = $operator_id";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
//only update extension if we aren't on a case
|
||||
$sql = "SELECT case_id
|
||||
FROM `case`
|
||||
WHERE current_operator_id = $operator_id";
|
||||
|
||||
$cc= $db->GetOne($sql);
|
||||
|
||||
if (empty($cc))
|
||||
{
|
||||
$sql = "UPDATE extension
|
||||
SET current_operator_id = NULL
|
||||
WHERE current_operator_id= $operator_id";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
if (!empty($_POST['extension_id']))
|
||||
{
|
||||
$sql = "UPDATE extension
|
||||
SET current_operator_id = $operator_id
|
||||
WHERE extension_id = " . intval($_POST['extension_id']);
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if (HTPASSWD_PATH !== false && !empty($_POST['password']))
|
||||
{
|
||||
//update password in htaccess
|
||||
include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php');
|
||||
$htp = New Htpasswd(HTPASSWD_PATH);
|
||||
$htp->deleteUser($_POST["existing_username"]);
|
||||
$htp->deleteUser($_POST["username"]);
|
||||
$htp->addUser($_POST["username"],$_POST["password"]);
|
||||
$htg = New Htgroup(HTGROUP_PATH);
|
||||
$htg->deleteUserFromGroup($_POST["existing_username"],HTGROUP_INTERVIEWER);
|
||||
$htg->addUserToGroup($_POST["username"],HTGROUP_INTERVIEWER);
|
||||
}
|
||||
|
||||
$msg = "<div class='alert alert-info'><h3>" . T_("Successfully updated user") . ": " . $_POST['username'] . "</h3></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = "<div class='alert alert-danger'><h3>" . T_("Failed to update user") . ": " . $_POST['username'] . " " . T_("Please make sure the username is unique") . "</h3></div>";
|
||||
}
|
||||
}
|
||||
$_GET['edit'] = $operator_id;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['edit']))
|
||||
{
|
||||
xhtml_head(T_("Edit Operator settings"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js"));
|
||||
|
||||
$operator_id = intval($_GET['edit']);
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM operator
|
||||
WHERE operator_id = $operator_id";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$sql = "SELECT Time_zone_name as value, Time_zone_name as description
|
||||
FROM timezone_template";
|
||||
|
||||
$tz = $db->GetAll($sql);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.operform.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.operform.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="form-group clearfix"><div class="col-sm-3"><a href='?' class="btn btn-default"><?php echo T_("Go back") ;?></a></div><div class="col-sm-6">
|
||||
<?php
|
||||
print "<h3>" . T_("Operator") . ": " . $rs['username'] . "</h3>";
|
||||
echo "</div></div>";
|
||||
|
||||
if (!empty($msg)) echo $msg;
|
||||
|
||||
$sql = "SELECT extension_id as value, extension as description,
|
||||
CASE WHEN current_operator_id = $operator_id THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM extension
|
||||
WHERE current_operator_id IS NULL
|
||||
OR current_operator_id = $operator_id";
|
||||
|
||||
$ers = $db->GetAll($sql);
|
||||
|
||||
?>
|
||||
<form action="?" method="post" class="form-horizontal panel-body" name="operform">
|
||||
<div class="form-group">
|
||||
<label for="username" class="col-sm-3 control-label"><?php echo T_("Username") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='username' class="form-control" value="<?php echo $rs['username'];?>"/></div>
|
||||
</div>
|
||||
<?php if (HTPASSWD_PATH !== false) { ?>
|
||||
<div class="form-group">
|
||||
<label for="password" class="col-sm-3 control-label"><?php echo T_("Password") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='password' class="form-control" placeholder="<?php echo T_("leave blank to keep existing password");?>"/></div>
|
||||
<div class="col-sm-6 form-inline"> 
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default"/> <?php echo T_("Password with");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label for="firstName" class="col-sm-3 control-label"><?php echo T_("First name") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='firstName' class="form-control" value="<?php echo $rs['firstName'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastName" class="col-sm-3 control-label"><?php echo T_("Last name") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='lastName' class="form-control" value="<?php echo $rs['lastName'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="timezone" class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
|
||||
<div class="col-sm-3"><?php display_chooser($tz,"timezone","timezone",false,false,false,true,array("value",$rs['Time_zone_name']),true,"form-inline"); ?></div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='timezonetemplate.php' class="btn btn-default"><?php echo T_("TimeZones list");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="extension_id" class="col-sm-3 control-label"><?php echo T_("Extension") . ": "; ?></label>
|
||||
<div class="col-sm-3"><?php echo display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline"); ?> </div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='extensionstatus.php' class="btn btn-default"><?php echo T_("Extensions");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="voip" class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label>
|
||||
<div class="col-sm-3"><input type="checkbox" name="voip" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['voip'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="chat_user" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='chat_user' class="form-control" value="<?php echo $rs['chat_user'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="chat_password" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='chat_password' class="form-control" value="<?php echo $rs['chat_password'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="chat_enable" class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
|
||||
<div class="col-sm-3"><input type="checkbox" name="chat_enable" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['chat_enable'] == 1) echo "checked=\"checked\"";?> value="1"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="enabled" class="col-sm-3 control-label"><?php echo T_("Enabled") . "? ";?></label>
|
||||
<div class="col-sm-3"><input type="checkbox" name="enabled" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['enabled'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
|
||||
</div>
|
||||
<div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></div>
|
||||
<div><input type='hidden' name='existing_username' value="<?php echo $rs['username'];?>"/></div>
|
||||
|
||||
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="submit" class="btn btn-primary btn-block" value="<?php echo T_("Update operator");?>"/></div></div>
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['voipdisable']))
|
||||
{
|
||||
$operator_id = intval($_GET['voipdisable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET voip = 0
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['voipenable']))
|
||||
{
|
||||
$operator_id = intval($_GET['voipenable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET voip = 1
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['disable']))
|
||||
{
|
||||
$operator_id = intval($_GET['disable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET enabled = 0
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['enable']))
|
||||
{
|
||||
$operator_id = intval($_GET['enable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET enabled = 1
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['operator_id']))
|
||||
{
|
||||
$operator_id = intval($_GET['operator_id']);
|
||||
|
||||
$sql = "SELECT *,SUBSTRING_INDEX(e.extension, '/', -1) as ext
|
||||
FROM extension as e
|
||||
WHERE e.current_operator_id = $operator_id";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
$display = false;
|
||||
|
||||
if (isset($_GET['winbat']) || isset($_GET['sh']))
|
||||
{
|
||||
header("Content-Type: text/txt");
|
||||
if (isset($_GET['winbat']))
|
||||
header("Content-Disposition: attachment; filename=operator_$operator_id.bat");
|
||||
else
|
||||
header("Content-Disposition: attachment; filename=operator_$operator_id.sh");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Pragma: public"); // HTTP/1.0
|
||||
|
||||
if (isset($_GET['winbat']))
|
||||
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
else
|
||||
echo "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($display)
|
||||
{
|
||||
$sql = "SELECT operator_id,
|
||||
CONCAT(firstName, ' ', lastName) as name,
|
||||
CONCAT ('<a href=\'extensionstatus.php?edit=',e.extension_id,'\'>', e.extension ,'</a>') as `extension`,
|
||||
CONCAT('<a href=\'?winbat=winbat&operator_id=',operator_id,'\'>" . TQ_("Win .bat file") . "</a>') as winbat,
|
||||
CONCAT('<a href=\'?sh=sh&operator_id=',operator_id,'\'>" . TQ_("*nix script file") . "</a>') as sh,
|
||||
CASE WHEN enabled = 0 THEN
|
||||
CONCAT(' <a href=\'?enable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Enable") . "\' class=\'fa fa-toggle-off fa-2x\' style=\'color:grey;\'></i></a> ')
|
||||
ELSE
|
||||
CONCAT(' <a href=\'?disable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Disable") . "\' class=\'fa fa-toggle-on fa-2x\'></i></a> ')
|
||||
END as enabledisable,
|
||||
CASE WHEN voip = 0 THEN
|
||||
CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . TQ_("Enable VoIP") . "</a>')
|
||||
ELSE
|
||||
CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . TQ_("Disable VoIP") . "</a>')
|
||||
END as voipenabledisable,
|
||||
CONCAT(' <a href=\'?edit=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\' class=\'fa fa-pencil-square-o fa-lg\'></i></a> ') as edit, username
|
||||
FROM operator
|
||||
LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
xhtml_head(T_("Operator list"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/font-awesome-4.3.0/css/font-awesome.css","../css/custom.css"));
|
||||
|
||||
$columns = array("operator_id","name","username","extension","enabledisable","edit");
|
||||
$titles = array("ID",T_("Operator"),T_("Username"),T_("Extension")," <i class='fa fa-lg fa-power-off '></i>"," <i class='fa fa-lg fa-pencil-square-o'></i>");
|
||||
|
||||
if (VOIP_ENABLED)
|
||||
{
|
||||
$columns[] = "voipenabledisable";
|
||||
$columns[] = "winbat";
|
||||
$columns[] = "sh";
|
||||
$titles[] = T_("VoIP ON/Off");
|
||||
$titles[] = T_("Win file");//Windows VoIP
|
||||
$titles[] = T_("*nix flle");//*nix VoIP
|
||||
}
|
||||
echo "<div class=' col-sm-10'><div class=' panel-body'>";
|
||||
xhtml_table($rs,$columns,$titles);
|
||||
echo "</div></div>";
|
||||
|
||||
echo "<div class='form-group col-sm-2'>
|
||||
<div class='panel-body'><a href='operators.php?add=add' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-plus'></i> " . T_("Add an operator") . "</a></div>
|
||||
<div class='panel-body'><a href='extensionstatus.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-whatsapp'></i> " . T_("Extensions") . "</a></div>
|
||||
<div class='panel-body'><a href='operatorquestionnaire.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-link'></i> " . T_("Assign to questionnaire") . "</a></div>
|
||||
<div class='panel-body'><a href='operatorskill.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-md'></i> " . T_("Operator skills") . "</a></div>
|
||||
<div class='panel-body'><a href='operatorperformance.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-signal'></i> " . T_("Operator performance") . "</a></div>";
|
||||
|
||||
if (VOIP_ENABLED)
|
||||
{
|
||||
print "<div class='well'>" . T_("Download the file for each user and save in the same folder as the voip.exe executable. When the file is executed, it will run the voip.exe program with the correct connection details to connect the operator to the VoIP server"). "</br></br>";
|
||||
|
||||
print "<a href='../voip/voipclient.exe' class='btn btn-default btn-block' title='" . T_("Download Windows VoIP Client Executable file") . "'><i class='fa fa-lg fa-download'></i> " . T_("Download Win file") . "</a></br>";
|
||||
print "<a href='../voip/voipclient' class='btn btn-default btn-block' title='" . T_("Download Linux VoIP Executable file") . "'><i class='fa fa-lg fa-download'></i> " . T_("Download Linux file") . "</a></div>";
|
||||
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
xhtml_foot();
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* List operators and allow for customised VoIP downloads, changing passwords, disabling, etc
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2007,2008,2009,2010,2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../db.inc.php');
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../functions/functions.xhtml.php');
|
||||
|
||||
$display = true;
|
||||
$msg = "";
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$operator_id = intval($_POST['operator_id']);
|
||||
$chat_enable = $voip = $enabled = 0;
|
||||
if (isset($_POST['voip'])) $voip = 1;
|
||||
if (isset($_POST['chat_enable'])) $chat_enable = 1;
|
||||
if (isset($_POST['enabled'])) $enabled = 1;
|
||||
|
||||
if (HTPASSWD_PATH !== false && $_POST['existing_username'] != $_POST['username'] && empty($_POST['password']))
|
||||
{
|
||||
$msg = "<div class='alert alert-danger'><h3>" . T_("If changing usernames, you must specify a new password") . "</h3></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "UPDATE operator
|
||||
SET username = " . $db->qstr($_POST['username']) . ",
|
||||
lastName = " . $db->qstr($_POST['lastName']) . ",
|
||||
firstName = " . $db->qstr($_POST['firstName']) . ",
|
||||
chat_user = " . $db->qstr($_POST['chat_user']) . ",
|
||||
chat_password = " . $db->qstr($_POST['chat_password']) . ",
|
||||
Time_zone_name = " . $db->qstr($_POST['timezone']) . ",
|
||||
voip = $voip, enabled = $enabled, chat_enable = $chat_enable
|
||||
WHERE operator_id = $operator_id";
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
//only update extension if we aren't on a case
|
||||
$sql = "SELECT case_id
|
||||
FROM `case`
|
||||
WHERE current_operator_id = $operator_id";
|
||||
|
||||
$cc= $db->GetOne($sql);
|
||||
|
||||
if (empty($cc))
|
||||
{
|
||||
$sql = "UPDATE extension
|
||||
SET current_operator_id = NULL
|
||||
WHERE current_operator_id= $operator_id";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
if (!empty($_POST['extension_id']))
|
||||
{
|
||||
$sql = "UPDATE extension
|
||||
SET current_operator_id = $operator_id
|
||||
WHERE extension_id = " . intval($_POST['extension_id']);
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if (HTPASSWD_PATH !== false && !empty($_POST['password']))
|
||||
{
|
||||
//update password in htaccess
|
||||
include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php');
|
||||
$htp = New Htpasswd(HTPASSWD_PATH);
|
||||
$htp->deleteUser($_POST["existing_username"]);
|
||||
$htp->deleteUser($_POST["username"]);
|
||||
$htp->addUser($_POST["username"],$_POST["password"]);
|
||||
$htg = New Htgroup(HTGROUP_PATH);
|
||||
$htg->deleteUserFromGroup($_POST["existing_username"],HTGROUP_INTERVIEWER);
|
||||
$htg->addUserToGroup($_POST["username"],HTGROUP_INTERVIEWER);
|
||||
}
|
||||
|
||||
$msg = "<div class='alert alert-info'><h3>" . T_("Successfully updated user") . ": " . $_POST['username'] . "</h3></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = "<div class='alert alert-danger'><h3>" . T_("Failed to update user") . ": " . $_POST['username'] . " " . T_("Please make sure the username is unique") . "</h3></div>";
|
||||
}
|
||||
}
|
||||
$_GET['edit'] = $operator_id;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['edit']))
|
||||
{
|
||||
xhtml_head(T_("Edit Operator settings"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css"),array("../include/jquery/jquery.min.js","../include/bootstrap/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js"));
|
||||
|
||||
$operator_id = intval($_GET['edit']);
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM operator
|
||||
WHERE operator_id = $operator_id";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
$sql = "SELECT Time_zone_name as value, Time_zone_name as description
|
||||
FROM timezone_template";
|
||||
|
||||
$tz = $db->GetAll($sql);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.operform.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.operform.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="form-group clearfix"><div class="col-sm-3"><a href='?' class="btn btn-default"><?php echo T_("Go back") ;?></a></div><div class="col-sm-6">
|
||||
<?php
|
||||
print "<h3>" . T_("Operator") . ": " . $rs['username'] . "</h3>";
|
||||
echo "</div></div>";
|
||||
|
||||
if (!empty($msg)) echo $msg;
|
||||
|
||||
$sql = "SELECT extension_id as value, extension as description,
|
||||
CASE WHEN current_operator_id = $operator_id THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM extension
|
||||
WHERE current_operator_id IS NULL
|
||||
OR current_operator_id = $operator_id";
|
||||
|
||||
$ers = $db->GetAll($sql);
|
||||
|
||||
?>
|
||||
<form action="?" method="post" class="form-horizontal panel-body" name="operform">
|
||||
<div class="form-group">
|
||||
<label for="username" class="col-sm-3 control-label"><?php echo T_("Username") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='username' class="form-control" value="<?php echo $rs['username'];?>"/></div>
|
||||
</div>
|
||||
<?php if (HTPASSWD_PATH !== false) { ?>
|
||||
<div class="form-group">
|
||||
<label for="password" class="col-sm-3 control-label"><?php echo T_("Password") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='password' class="form-control" placeholder="<?php echo T_("leave blank to keep existing password");?>"/></div>
|
||||
<div class="col-sm-6 form-inline"> 
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default"/> <?php echo T_("Password with");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label for="firstName" class="col-sm-3 control-label"><?php echo T_("First name") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='firstName' class="form-control" value="<?php echo $rs['firstName'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastName" class="col-sm-3 control-label"><?php echo T_("Last name") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='lastName' class="form-control" value="<?php echo $rs['lastName'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="timezone" class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
|
||||
<div class="col-sm-3"><?php display_chooser($tz,"timezone","timezone",false,false,false,true,array("value",$rs['Time_zone_name']),true,"form-inline"); ?></div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='timezonetemplate.php' class="btn btn-default"><?php echo T_("TimeZones list");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="extension_id" class="col-sm-3 control-label"><?php echo T_("Extension") . ": "; ?></label>
|
||||
<div class="col-sm-3"><?php echo display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline"); ?> </div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='extensionstatus.php' class="btn btn-default"><?php echo T_("Extensions");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="voip" class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label>
|
||||
<div class="col-sm-3"><input type="checkbox" name="voip" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['voip'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="chat_user" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='chat_user' class="form-control" value="<?php echo $rs['chat_user'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="chat_password" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": "; ?></label>
|
||||
<div class="col-sm-3"><input type='text' name='chat_password' class="form-control" value="<?php echo $rs['chat_password'];?>"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="chat_enable" class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
|
||||
<div class="col-sm-3"><input type="checkbox" name="chat_enable" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['chat_enable'] == 1) echo "checked=\"checked\"";?> value="1"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="enabled" class="col-sm-3 control-label"><?php echo T_("Enabled") . "? ";?></label>
|
||||
<div class="col-sm-3"><input type="checkbox" name="enabled" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['enabled'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
|
||||
</div>
|
||||
<div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></div>
|
||||
<div><input type='hidden' name='existing_username' value="<?php echo $rs['username'];?>"/></div>
|
||||
|
||||
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="submit" class="btn btn-primary btn-block" value="<?php echo T_("Update operator");?>"/></div></div>
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['voipdisable']))
|
||||
{
|
||||
$operator_id = intval($_GET['voipdisable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET voip = 0
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['voipenable']))
|
||||
{
|
||||
$operator_id = intval($_GET['voipenable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET voip = 1
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['disable']))
|
||||
{
|
||||
$operator_id = intval($_GET['disable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET enabled = 0
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['enable']))
|
||||
{
|
||||
$operator_id = intval($_GET['enable']);
|
||||
|
||||
$sql = "UPDATE operator
|
||||
SET enabled = 1
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (isset($_GET['operator_id']))
|
||||
{
|
||||
$operator_id = intval($_GET['operator_id']);
|
||||
|
||||
$sql = "SELECT *,SUBSTRING_INDEX(e.extension, '/', -1) as ext
|
||||
FROM extension as e
|
||||
WHERE e.current_operator_id = $operator_id";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
$display = false;
|
||||
|
||||
if (isset($_GET['winbat']) || isset($_GET['sh']))
|
||||
{
|
||||
header("Content-Type: text/txt");
|
||||
if (isset($_GET['winbat']))
|
||||
header("Content-Disposition: attachment; filename=operator_$operator_id.bat");
|
||||
else
|
||||
header("Content-Disposition: attachment; filename=operator_$operator_id.sh");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Pragma: public"); // HTTP/1.0
|
||||
|
||||
if (isset($_GET['winbat']))
|
||||
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
else
|
||||
echo "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($display)
|
||||
{
|
||||
$sql = "SELECT operator_id,
|
||||
CONCAT(firstName, ' ', lastName) as name,
|
||||
CONCAT ('<a href=\'extensionstatus.php?edit=',e.extension_id,'\'>', e.extension ,'</a>') as `extension`,
|
||||
CONCAT('<a href=\'?winbat=winbat&operator_id=',operator_id,'\'>" . TQ_("Win .bat file") . "</a>') as winbat,
|
||||
CONCAT('<a href=\'?sh=sh&operator_id=',operator_id,'\'>" . TQ_("*nix script file") . "</a>') as sh,
|
||||
CASE WHEN enabled = 0 THEN
|
||||
CONCAT(' <a href=\'?enable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Enable") . "\' class=\'fa fa-toggle-off fa-2x\' style=\'color:grey;\'></i></a> ')
|
||||
ELSE
|
||||
CONCAT(' <a href=\'?disable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Disable") . "\' class=\'fa fa-toggle-on fa-2x\'></i></a> ')
|
||||
END as enabledisable,
|
||||
CASE WHEN voip = 0 THEN
|
||||
CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . TQ_("Enable VoIP") . "</a>')
|
||||
ELSE
|
||||
CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . TQ_("Disable VoIP") . "</a>')
|
||||
END as voipenabledisable,
|
||||
CONCAT(' <a href=\'?edit=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\' class=\'fa fa-pencil-square-o fa-lg\'></i></a> ') as edit, username
|
||||
FROM operator
|
||||
LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
xhtml_head(T_("Operator list"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/font-awesome/css/font-awesome.css","../css/custom.css"));
|
||||
|
||||
$columns = array("operator_id","name","username","extension","enabledisable","edit");
|
||||
$titles = array("ID",T_("Operator"),T_("Username"),T_("Extension")," <i class='fa fa-lg fa-power-off '></i>"," <i class='fa fa-lg fa-pencil-square-o'></i>");
|
||||
|
||||
if (VOIP_ENABLED)
|
||||
{
|
||||
$columns[] = "voipenabledisable";
|
||||
$columns[] = "winbat";
|
||||
$columns[] = "sh";
|
||||
$titles[] = T_("VoIP ON/Off");
|
||||
$titles[] = T_("Win file");//Windows VoIP
|
||||
$titles[] = T_("*nix flle");//*nix VoIP
|
||||
}
|
||||
echo "<div class=' col-sm-10'><div class=' panel-body'>";
|
||||
xhtml_table($rs,$columns,$titles);
|
||||
echo "</div></div>";
|
||||
|
||||
echo "<div class='form-group col-sm-2'>
|
||||
<div class='panel-body'><a href='operators.php?add=add' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-plus'></i> " . T_("Add an operator") . "</a></div>
|
||||
<div class='panel-body'><a href='extensionstatus.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-whatsapp'></i> " . T_("Extensions") . "</a></div>
|
||||
<div class='panel-body'><a href='operatorquestionnaire.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-link'></i> " . T_("Assign to questionnaire") . "</a></div>
|
||||
<div class='panel-body'><a href='operatorskill.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-md'></i> " . T_("Operator skills") . "</a></div>
|
||||
<div class='panel-body'><a href='operatorperformance.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-signal'></i> " . T_("Operator performance") . "</a></div>";
|
||||
|
||||
if (VOIP_ENABLED)
|
||||
{
|
||||
print "<div class='well'>" . T_("Download the file for each user and save in the same folder as the voip.exe executable. When the file is executed, it will run the voip.exe program with the correct connection details to connect the operator to the VoIP server"). "</br></br>";
|
||||
|
||||
print "<a href='../voip/voipclient.exe' class='btn btn-default btn-block' title='" . T_("Download Windows VoIP Client Executable file") . "'><i class='fa fa-lg fa-download'></i> " . T_("Download Win file") . "</a></br>";
|
||||
print "<a href='../voip/voipclient' class='btn btn-default btn-block' title='" . T_("Download Linux VoIP Executable file") . "'><i class='fa fa-lg fa-download'></i> " . T_("Download Linux file") . "</a></div>";
|
||||
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
xhtml_foot();
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,110 +1,110 @@
|
||||
<?php /**
|
||||
* Display operator performance
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Performance functions
|
||||
*/
|
||||
include("../functions/functions.performance.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
xhtml_head(T_("Operator Performance"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
|
||||
//$rs = get_stats_total(get_stats());
|
||||
//print "<h2>" . T_("Overall") . "</h2>";
|
||||
//xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||
|
||||
$questionnaire_id = false;
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Please select a questionnaire") . " </h3>";
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
display_questionnaire_chooser($questionnaire_id,false,"form-inline clearfix", "form-control");
|
||||
|
||||
if ($questionnaire_id)
|
||||
{
|
||||
$rs = get_stats_total(get_stats_by_questionnaire($questionnaire_id));
|
||||
print "<h2>" . T_("This project") . "</h2>";
|
||||
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
$shift_id = false;
|
||||
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
||||
|
||||
$sql = "SELECT s.shift_id as value,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT . "'),' " . TQ_("till") . " ',DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as description,CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM shift as s
|
||||
LEFT JOIN (operator as o) on (o.operator_id = '$operator_id')
|
||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||
ORDER BY s.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "</br><h3 class='form-inline pull-left'>" . T_("Please select a shift") . " </h3>";
|
||||
|
||||
display_chooser($rs,"shift_id","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");//,false,true,false,true,"pull-left"
|
||||
|
||||
if ($shift_id)
|
||||
{
|
||||
$rs = get_stats_total(get_stats_by_shift($questionnaire_id,$shift_id));
|
||||
print "<h2>" . T_("This shift") . "</h2>";
|
||||
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
<?php /**
|
||||
* Display operator performance
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Performance functions
|
||||
*/
|
||||
include("../functions/functions.performance.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
xhtml_head(T_("Operator Performance"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
|
||||
//$rs = get_stats_total(get_stats());
|
||||
//print "<h2>" . T_("Overall") . "</h2>";
|
||||
//xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||
|
||||
$questionnaire_id = false;
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Please select a questionnaire") . " </h3>";
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
display_questionnaire_chooser($questionnaire_id,false,"form-inline clearfix", "form-control");
|
||||
|
||||
if ($questionnaire_id)
|
||||
{
|
||||
$rs = get_stats_total(get_stats_by_questionnaire($questionnaire_id));
|
||||
print "<h2>" . T_("This project") . "</h2>";
|
||||
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
$shift_id = false;
|
||||
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
||||
|
||||
$sql = "SELECT s.shift_id as value,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT . "'),' " . TQ_("till") . " ',DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as description,CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM shift as s
|
||||
LEFT JOIN (operator as o) on (o.operator_id = '$operator_id')
|
||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||
ORDER BY s.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "</br><h3 class='form-inline pull-left'>" . T_("Please select a shift") . " </h3>";
|
||||
|
||||
display_chooser($rs,"shift_id","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");//,false,true,false,true,"pull-left"
|
||||
|
||||
if ($shift_id)
|
||||
{
|
||||
$rs = get_stats_total(get_stats_by_shift($questionnaire_id,$shift_id));
|
||||
print "<h2>" . T_("This shift") . "</h2>";
|
||||
xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness")));
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,279 +1,279 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign operators to questionnaires in a checkbox matrix
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Return if an operator has already been assigned to this questionnaire
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
* @return int 1 if assigned otherwise 0
|
||||
*
|
||||
*/
|
||||
function vq($operator_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT operator_id,questionnaire_id
|
||||
FROM operator_questionnaire
|
||||
WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$vq = $db->Execute($sql);
|
||||
|
||||
if ($vq)
|
||||
return $vq->RecordCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an operator to a questionnaire
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqi($operator_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "INSERT INTO
|
||||
operator_questionnaire (operator_id,questionnaire_id)
|
||||
VALUES('$operator_id','$questionnaire_id')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unassign an operator from a questionnaire
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqd($operator_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "DELETE FROM
|
||||
operator_questionnaire
|
||||
WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE
|
||||
FROM operator_questionnaire
|
||||
WHERE questionnaire_id IN (
|
||||
SELECT questionnaire_id
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1)
|
||||
AND operator_id IN (
|
||||
SELECT operator_id
|
||||
FROM operator
|
||||
WHERE enabled = 1)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach ($_POST as $g => $v)
|
||||
{
|
||||
$a = explode("_",$g);
|
||||
if ($a[0] == "cb")
|
||||
vqi($a[2],$a[1]);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT questionnaire_id,description
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1
|
||||
ORDER by questionnaire_id DESC";
|
||||
|
||||
$questionnaires = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName ) as opname, username
|
||||
FROM operator
|
||||
WHERE enabled = 1
|
||||
ORDER by operator_id ASC";
|
||||
|
||||
$operators = $db->GetAll($sql);
|
||||
|
||||
|
||||
xhtml_head(T_("Assign operators to questionnaires"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/iCheck/icheck.min.js"));
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
print "questionnaire_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$s .= "'{$q['questionnaire_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
print "operator_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($operators as $q)
|
||||
{
|
||||
$s .= "'{$q['operator_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
?>
|
||||
|
||||
var QidOn = 0;
|
||||
var VidOn = 0;
|
||||
|
||||
function checkQid(q)
|
||||
{
|
||||
|
||||
for (y in operator_id)
|
||||
{
|
||||
v = operator_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (QidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (QidOn == 0)
|
||||
QidOn = 1;
|
||||
else
|
||||
QidOn = 0;
|
||||
}
|
||||
|
||||
function checkVid(v)
|
||||
{
|
||||
|
||||
for (y in questionnaire_id)
|
||||
{
|
||||
q = questionnaire_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (VidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (VidOn == 0)
|
||||
VidOn = 1;
|
||||
else
|
||||
VidOn = 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||
|
||||
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Operator") . " </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
|
||||
}
|
||||
print "</tr></thead>";
|
||||
|
||||
|
||||
foreach($operators as $v)
|
||||
{
|
||||
|
||||
print "<tr class=''>
|
||||
<th> {$v['username']} </th>
|
||||
<th style=\"text-align: left;\";> <a href=\"javascript:checkVid({$v['operator_id']})\" >{$v['opname']}</a> </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$checked = "";
|
||||
if (vq($v['operator_id'],$q['questionnaire_id'])) $checked="checked=\"checked\"";
|
||||
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" $checked style=\"width: 16px; height: 16px; margin-top: 5px;\"></input></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
print "</table><input class='btn btn-default fa' type='submit' name='submit' value='" . T_("Assign operators to questionnaires") . "'/></form>";
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Assign operators to questionnaires in a checkbox matrix
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Return if an operator has already been assigned to this questionnaire
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
* @return int 1 if assigned otherwise 0
|
||||
*
|
||||
*/
|
||||
function vq($operator_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT operator_id,questionnaire_id
|
||||
FROM operator_questionnaire
|
||||
WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$vq = $db->Execute($sql);
|
||||
|
||||
if ($vq)
|
||||
return $vq->RecordCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an operator to a questionnaire
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqi($operator_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "INSERT INTO
|
||||
operator_questionnaire (operator_id,questionnaire_id)
|
||||
VALUES('$operator_id','$questionnaire_id')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unassign an operator from a questionnaire
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $questionnaire_id Questionnaire id
|
||||
*
|
||||
*/
|
||||
function vqd($operator_id,$questionnaire_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "DELETE FROM
|
||||
operator_questionnaire
|
||||
WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE
|
||||
FROM operator_questionnaire
|
||||
WHERE questionnaire_id IN (
|
||||
SELECT questionnaire_id
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1)
|
||||
AND operator_id IN (
|
||||
SELECT operator_id
|
||||
FROM operator
|
||||
WHERE enabled = 1)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach ($_POST as $g => $v)
|
||||
{
|
||||
$a = explode("_",$g);
|
||||
if ($a[0] == "cb")
|
||||
vqi($a[2],$a[1]);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT questionnaire_id,description
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1
|
||||
ORDER by questionnaire_id DESC";
|
||||
|
||||
$questionnaires = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName ) as opname, username
|
||||
FROM operator
|
||||
WHERE enabled = 1
|
||||
ORDER by operator_id ASC";
|
||||
|
||||
$operators = $db->GetAll($sql);
|
||||
|
||||
|
||||
xhtml_head(T_("Assign operators to questionnaires"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/iCheck/icheck.min.js"));
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
print "questionnaire_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$s .= "'{$q['questionnaire_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
print "operator_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($operators as $q)
|
||||
{
|
||||
$s .= "'{$q['operator_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
?>
|
||||
|
||||
var QidOn = 0;
|
||||
var VidOn = 0;
|
||||
|
||||
function checkQid(q)
|
||||
{
|
||||
|
||||
for (y in operator_id)
|
||||
{
|
||||
v = operator_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (QidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (QidOn == 0)
|
||||
QidOn = 1;
|
||||
else
|
||||
QidOn = 0;
|
||||
}
|
||||
|
||||
function checkVid(v)
|
||||
{
|
||||
|
||||
for (y in questionnaire_id)
|
||||
{
|
||||
q = questionnaire_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (VidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (VidOn == 0)
|
||||
VidOn = 1;
|
||||
else
|
||||
VidOn = 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||
|
||||
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Operator") . " </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
|
||||
}
|
||||
print "</tr></thead>";
|
||||
|
||||
|
||||
foreach($operators as $v)
|
||||
{
|
||||
|
||||
print "<tr class=''>
|
||||
<th> {$v['username']} </th>
|
||||
<th style=\"text-align: left;\";> <a href=\"javascript:checkVid({$v['operator_id']})\" >{$v['opname']}</a> </th>";
|
||||
foreach($questionnaires as $q)
|
||||
{
|
||||
$checked = "";
|
||||
if (vq($v['operator_id'],$q['questionnaire_id'])) $checked="checked=\"checked\"";
|
||||
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" $checked style=\"width: 16px; height: 16px; margin-top: 5px;\"></input></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
print "</table><input class='btn btn-default fa' type='submit' name='submit' value='" . T_("Assign operators to questionnaires") . "'/></form>";
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,316 +1,316 @@
|
||||
<?php
|
||||
/**
|
||||
* Create an operator and link to a webserver username for authentication
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
global $db;
|
||||
|
||||
$a = false;
|
||||
|
||||
if (isset($_POST['operator']) && isset($_POST['adduser']))
|
||||
{
|
||||
$operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc());
|
||||
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
|
||||
$lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc());
|
||||
$chat_user = $db->qstr($_POST['chat_user'],get_magic_quotes_gpc());
|
||||
$chat_password = $db->qstr($_POST['chat_password'],get_magic_quotes_gpc());
|
||||
$time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
|
||||
$extension = "";
|
||||
if (FREEPBX_PATH != false)
|
||||
{
|
||||
//Generate new extension from last one in database and random password
|
||||
$sql = "SELECT SUBSTRING_INDEX(extension, '/', -1) as ext
|
||||
FROM extension
|
||||
ORDER BY ext DESC
|
||||
LIMIT 1";
|
||||
|
||||
$laste = $db->GetRow($sql);
|
||||
|
||||
$extensionn = "2000";
|
||||
$extension = "'IAX2/2000'";
|
||||
|
||||
//increment if exists
|
||||
if (!empty($laste))
|
||||
{
|
||||
$extensionn = $laste['ext'] + 1;
|
||||
$extension = "'IAX2/$extensionn'";
|
||||
}
|
||||
|
||||
//generate random 8 length password
|
||||
$extensionnp = "";
|
||||
$length = 25;
|
||||
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
$extensionnp .= $chars[(mt_rand() % strlen($chars))];
|
||||
|
||||
//quote for SQL
|
||||
$extensionp = "'$extensionnp'";
|
||||
|
||||
}
|
||||
$supervisor = 0;
|
||||
$temporary = 0;
|
||||
$refusal = 0;
|
||||
$voip = 0;
|
||||
$chat = 0;
|
||||
if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1;
|
||||
if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1;
|
||||
if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1;
|
||||
if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1;
|
||||
if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1;
|
||||
|
||||
if (!empty($_POST['operator']))
|
||||
{
|
||||
$sql = "INSERT INTO operator
|
||||
(`operator_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`,`voip`,`chat_enable`,`chat_user`,`chat_password`)
|
||||
VALUES (NULL , $operator, $firstname , $lastname, $time_zone_name, $voip, $chat, $chat_user, $chat_password);";
|
||||
|
||||
if ($db->Execute($sql))
|
||||
{
|
||||
$oid = $db->Insert_ID();
|
||||
|
||||
if (FREEPBX_PATH !== false)
|
||||
{
|
||||
//add extension
|
||||
$sql = "INSERT INTO extension (`extension`,`password`,`current_operator_id`)
|
||||
VALUES ($extension, $extensionp, $oid)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//Generate new extension in freepbx
|
||||
include_once("../functions/functions.freepbx.php");
|
||||
freepbx_add_extension($extensionn, $_POST["firstname"] . " " . $_POST["lastname"], $extensionnp);
|
||||
}
|
||||
else if (!empty($_POST['extension_id']))
|
||||
{
|
||||
$sql = "UPDATE extension
|
||||
SET current_operator_id = $oid
|
||||
WHERE extension_id = " . intval($_POST['extension_id']);
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false)
|
||||
{
|
||||
//Get password and add it to the configured htpassword
|
||||
include_once("../functions/functions.htpasswd.php");
|
||||
$htp = New Htpasswd(HTPASSWD_PATH);
|
||||
$htg = New Htgroup(HTGROUP_PATH);
|
||||
|
||||
$htp->addUser($_POST['operator'],$_POST['password']);
|
||||
$htg->addUserToGroup($_POST['operator'],HTGROUP_INTERVIEWER);
|
||||
|
||||
if ($supervisor)
|
||||
$htg->addUserGroup(HTGROUP_ADMIN);
|
||||
}
|
||||
|
||||
$a = "<div class='alert alert-info'><h3>" . T_("Added operator :") . " " . $operator . "</h3>";
|
||||
|
||||
if (FREEPBX_PATH !== false)
|
||||
$a .= "<br/>" . T_("FreePBX has been reloaded for the new VoIP extension to take effect");
|
||||
|
||||
print "</div>";
|
||||
|
||||
if ($temporary)
|
||||
{
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','1')");
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','5')"); //and appointment
|
||||
}
|
||||
|
||||
if ($supervisor)
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','2')");
|
||||
|
||||
if ($refusal)
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','3')");
|
||||
}
|
||||
else
|
||||
{
|
||||
$a = T_("Could not add operator. There may already be an operator of this name:") . " $operator ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Add an operator"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css"), array("../js/jquery-2.1.3.min.js", "../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js"));
|
||||
|
||||
if ($a) {
|
||||
echo $a;
|
||||
}
|
||||
else {
|
||||
echo "<div class='well'>";
|
||||
//echo "<p>" . T_("Adding an operator here will give the user the ability to call cases") . "<a href='operatorquestionnaire.php'>" . T_("Assign Operator to Questionnaire") . "</a>" . T_("tool") . ".</p>";
|
||||
echo "<p>" . T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here.") . "</p>";
|
||||
echo "<p>" . T_("The username and extension must be unique for each operator.") . "</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
$sql = "SELECT Time_zone_name as value, Time_zone_name as description
|
||||
FROM timezone_template";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT extension_id as value, extension as description
|
||||
FROM extension
|
||||
WHERE current_operator_id IS NULL";
|
||||
|
||||
$ers = $db->GetAll($sql);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.operform.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.operform.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal panel-body" name="operform">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Username") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="operator" type="text" class="form-control" required /></div>
|
||||
</div>
|
||||
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Password") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="password" id="password" type="text" class="form-control" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" /></div>
|
||||
<div class="col-sm-6 form-inline"> 
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("Password with");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("First name") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="firstname" type="text" class="form-control" required/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Last name") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="lastname" type="text" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
|
||||
<div class="col-sm-3"><?php display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,true,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"form-inline");?></div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='timezonetemplate.php' class="btn btn-default fa"><?php echo T_("TimeZones list");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (FREEPBX_PATH == false) { ?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Extension") . ": ";?></label>
|
||||
<div class="col-sm-3"><?php display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline");?></div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label>
|
||||
<div class="col-sm-3"><input name="voip" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" checked="checked"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="chat_user" type="text" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="chat_password" type="text" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
|
||||
<div class="col-sm-3"><input name="chat_enable" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" /></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a normal interviewer?");?></label>
|
||||
<div class="col-sm-3"><input name="temporary" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-offstyle="danger" checked="checked"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a supervisor?");?></label>
|
||||
<div class="col-sm-3"><input name="supervisor" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a refusal converter?");?></label>
|
||||
<div class="col-sm-3"><input name="refusal" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="adduser" class="btn btn-primary btn-block" value="<?php echo T_("Add an operator"); ?>" /></div></div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Create an operator and link to a webserver username for authentication
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
global $db;
|
||||
|
||||
$a = false;
|
||||
|
||||
if (isset($_POST['operator']) && isset($_POST['adduser']))
|
||||
{
|
||||
$operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc());
|
||||
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
|
||||
$lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc());
|
||||
$chat_user = $db->qstr($_POST['chat_user'],get_magic_quotes_gpc());
|
||||
$chat_password = $db->qstr($_POST['chat_password'],get_magic_quotes_gpc());
|
||||
$time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
|
||||
$extension = "";
|
||||
if (FREEPBX_PATH != false)
|
||||
{
|
||||
//Generate new extension from last one in database and random password
|
||||
$sql = "SELECT SUBSTRING_INDEX(extension, '/', -1) as ext
|
||||
FROM extension
|
||||
ORDER BY ext DESC
|
||||
LIMIT 1";
|
||||
|
||||
$laste = $db->GetRow($sql);
|
||||
|
||||
$extensionn = "2000";
|
||||
$extension = "'IAX2/2000'";
|
||||
|
||||
//increment if exists
|
||||
if (!empty($laste))
|
||||
{
|
||||
$extensionn = $laste['ext'] + 1;
|
||||
$extension = "'IAX2/$extensionn'";
|
||||
}
|
||||
|
||||
//generate random 8 length password
|
||||
$extensionnp = "";
|
||||
$length = 25;
|
||||
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
$extensionnp .= $chars[(mt_rand() % strlen($chars))];
|
||||
|
||||
//quote for SQL
|
||||
$extensionp = "'$extensionnp'";
|
||||
|
||||
}
|
||||
$supervisor = 0;
|
||||
$temporary = 0;
|
||||
$refusal = 0;
|
||||
$voip = 0;
|
||||
$chat = 0;
|
||||
if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1;
|
||||
if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1;
|
||||
if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1;
|
||||
if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1;
|
||||
if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1;
|
||||
|
||||
if (!empty($_POST['operator']))
|
||||
{
|
||||
$sql = "INSERT INTO operator
|
||||
(`operator_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`,`voip`,`chat_enable`,`chat_user`,`chat_password`)
|
||||
VALUES (NULL , $operator, $firstname , $lastname, $time_zone_name, $voip, $chat, $chat_user, $chat_password);";
|
||||
|
||||
if ($db->Execute($sql))
|
||||
{
|
||||
$oid = $db->Insert_ID();
|
||||
|
||||
if (FREEPBX_PATH !== false)
|
||||
{
|
||||
//add extension
|
||||
$sql = "INSERT INTO extension (`extension`,`password`,`current_operator_id`)
|
||||
VALUES ($extension, $extensionp, $oid)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//Generate new extension in freepbx
|
||||
include_once("../functions/functions.freepbx.php");
|
||||
freepbx_add_extension($extensionn, $_POST["firstname"] . " " . $_POST["lastname"], $extensionnp);
|
||||
}
|
||||
else if (!empty($_POST['extension_id']))
|
||||
{
|
||||
$sql = "UPDATE extension
|
||||
SET current_operator_id = $oid
|
||||
WHERE extension_id = " . intval($_POST['extension_id']);
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false)
|
||||
{
|
||||
//Get password and add it to the configured htpassword
|
||||
include_once("../functions/functions.htpasswd.php");
|
||||
$htp = New Htpasswd(HTPASSWD_PATH);
|
||||
$htg = New Htgroup(HTGROUP_PATH);
|
||||
|
||||
$htp->addUser($_POST['operator'],$_POST['password']);
|
||||
$htg->addUserToGroup($_POST['operator'],HTGROUP_INTERVIEWER);
|
||||
|
||||
if ($supervisor)
|
||||
$htg->addUserGroup(HTGROUP_ADMIN);
|
||||
}
|
||||
|
||||
$a = "<div class='alert alert-info'><h3>" . T_("Added operator :") . " " . $operator . "</h3>";
|
||||
|
||||
if (FREEPBX_PATH !== false)
|
||||
$a .= "<br/>" . T_("FreePBX has been reloaded for the new VoIP extension to take effect");
|
||||
|
||||
print "</div>";
|
||||
|
||||
if ($temporary)
|
||||
{
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','1')");
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','5')"); //and appointment
|
||||
}
|
||||
|
||||
if ($supervisor)
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','2')");
|
||||
|
||||
if ($refusal)
|
||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||
VALUES ('$oid','3')");
|
||||
}
|
||||
else
|
||||
{
|
||||
$a = T_("Could not add operator. There may already be an operator of this name:") . " $operator ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Add an operator"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css"), array("../include/jquery/jquery.min.js", "../include/bootstrap/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js"));
|
||||
|
||||
if ($a) {
|
||||
echo $a;
|
||||
}
|
||||
else {
|
||||
echo "<div class='well'>";
|
||||
//echo "<p>" . T_("Adding an operator here will give the user the ability to call cases") . "<a href='operatorquestionnaire.php'>" . T_("Assign Operator to Questionnaire") . "</a>" . T_("tool") . ".</p>";
|
||||
echo "<p>" . T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here.") . "</p>";
|
||||
echo "<p>" . T_("The username and extension must be unique for each operator.") . "</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
$sql = "SELECT Time_zone_name as value, Time_zone_name as description
|
||||
FROM timezone_template";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT extension_id as value, extension as description
|
||||
FROM extension
|
||||
WHERE current_operator_id IS NULL";
|
||||
|
||||
$ers = $db->GetAll($sql);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//Password generator
|
||||
upp = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
|
||||
low = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
|
||||
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function rnd(x,y,z) {
|
||||
var num;
|
||||
do {
|
||||
num = parseInt(Math.random()*z);
|
||||
if (num >= x && num <= y) break;
|
||||
} while (true);
|
||||
return(num);
|
||||
}
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
function generate() {
|
||||
var pwd = '';
|
||||
var res, s;
|
||||
var k = 0;
|
||||
var n = document.operform.number.value;
|
||||
var pass = new Array();
|
||||
var w = rnd(30,80,100);
|
||||
for (var r = 0; r < w; r++) {
|
||||
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||
}
|
||||
for (var i = 0; i < n; i++) {
|
||||
s = rnd(1,k-1,100);
|
||||
pwd+= pass[s];
|
||||
}
|
||||
document.operform.password.value = pwd;
|
||||
}
|
||||
</script>
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal panel-body" name="operform">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Username") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="operator" type="text" class="form-control" required /></div>
|
||||
</div>
|
||||
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Password") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="password" id="password" type="text" class="form-control" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" /></div>
|
||||
<div class="col-sm-6 form-inline"> 
|
||||
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("Password with");?> 
|
||||
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("First name") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="firstname" type="text" class="form-control" required/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Last name") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="lastname" type="text" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
|
||||
<div class="col-sm-3"><?php display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,true,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"form-inline");?></div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='timezonetemplate.php' class="btn btn-default fa"><?php echo T_("TimeZones list");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (FREEPBX_PATH == false) { ?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Extension") . ": ";?></label>
|
||||
<div class="col-sm-3"><?php display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline");?></div>
|
||||
<div class="col-sm-6 form-inline">
|
||||
<?php echo T_("Edit") . " ";?>
|
||||
<a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label>
|
||||
<div class="col-sm-3"><input name="voip" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" checked="checked"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="chat_user" type="text" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": ";?></label>
|
||||
<div class="col-sm-3"><input name="chat_password" type="text" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
|
||||
<div class="col-sm-3"><input name="chat_enable" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" /></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a normal interviewer?");?></label>
|
||||
<div class="col-sm-3"><input name="temporary" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-offstyle="danger" checked="checked"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a supervisor?");?></label>
|
||||
<div class="col-sm-3"><input name="supervisor" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a refusal converter?");?></label>
|
||||
<div class="col-sm-3"><input name="refusal" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="adduser" class="btn btn-primary btn-block" value="<?php echo T_("Add an operator"); ?>" /></div></div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
@@ -1,279 +1,279 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign operators to skills in a checkbox matrix
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Determine if an operator has been assigned to a skill (outcome_type)
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $outcome_type_id Outcome type id (skill)
|
||||
* @return int 1 if assigned to that skill otherwise 0
|
||||
*
|
||||
*/
|
||||
function vq($operator_id,$outcome_type_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT operator_id,outcome_type_id
|
||||
FROM operator_skill
|
||||
WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'";
|
||||
|
||||
$vq = $db->Execute($sql);
|
||||
|
||||
if ($vq)
|
||||
return $vq->RecordCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an operator to a skill (outcome_type)
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $outcome_type_id Outcome type id (skill)
|
||||
*
|
||||
*/
|
||||
function vqi($operator_id,$outcome_type_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "INSERT INTO
|
||||
operator_skill (operator_id,outcome_type_id)
|
||||
VALUES('$operator_id','$outcome_type_id')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a skill (outcome_type) from an operator
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $outcome_type_id Outcome type id (skill)
|
||||
*
|
||||
*/
|
||||
function vqd($operator_id,$outcome_type_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "DELETE FROM
|
||||
operator_skill
|
||||
WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE
|
||||
FROM operator_skill
|
||||
WHERE operator_id IN (
|
||||
SELECT operator_id
|
||||
FROM operator
|
||||
WHERE enabled = 1)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach ($_POST as $g => $v)
|
||||
{
|
||||
$a = explode("_",$g);
|
||||
if ($a[0] == "cb")
|
||||
vqi($a[2],$a[1]);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT outcome_type_id,description
|
||||
FROM outcome_type
|
||||
ORDER by outcome_type_id ASC";
|
||||
|
||||
$outcome_types = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName) as description, username
|
||||
FROM operator
|
||||
WHERE enabled = 1
|
||||
ORDER by operator_id ASC";
|
||||
|
||||
$operators = $db->GetAll($sql);
|
||||
|
||||
|
||||
xhtml_head(T_("Assign operators to Skills"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/iCheck/icheck.min.js"));
|
||||
|
||||
print "<div class='well'>" . T_("Set which types of cases will be made available to each operator. </br> Please note that all operators will be allowed to assign all possible outcomes to a case. This restricts which ones will be assigned to an operator.") . "</div>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
print "outcome_type_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($outcome_types as $q)
|
||||
{
|
||||
$s .= "'{$q['outcome_type_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
print "operator_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($operators as $q)
|
||||
{
|
||||
$s .= "'{$q['operator_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
?>
|
||||
|
||||
var QidOn = 0;
|
||||
var VidOn = 0;
|
||||
|
||||
function checkQid(q)
|
||||
{
|
||||
|
||||
for (y in operator_id)
|
||||
{
|
||||
v = operator_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (QidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (QidOn == 0)
|
||||
QidOn = 1;
|
||||
else
|
||||
QidOn = 0;
|
||||
}
|
||||
|
||||
|
||||
function checkVid(v)
|
||||
{
|
||||
|
||||
for (y in outcome_type_id)
|
||||
{
|
||||
q = outcome_type_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (VidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (VidOn == 0)
|
||||
VidOn = 1;
|
||||
else
|
||||
VidOn = 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
//$country_code = 'RU'; // Nederlandse Antillen
|
||||
//print_r(DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code));
|
||||
|
||||
|
||||
print "<form action=\"\" method=\"post\"><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||
|
||||
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Operator") . " </th>";
|
||||
foreach($outcome_types as $q)
|
||||
{
|
||||
print "<th> <a href=\"javascript:checkQid({$q['outcome_type_id']})\">" . T_($q['description']) . "</a> </th>";
|
||||
}
|
||||
print "</tr></thead>";
|
||||
|
||||
|
||||
foreach($operators as $v)
|
||||
{
|
||||
print "<tr class=''>
|
||||
<th> {$v['username']} </th>
|
||||
<th> <a href=\"javascript:checkVid({$v['operator_id']})\">{$v['description']}</a> </th>";
|
||||
foreach($outcome_types as $q)
|
||||
{
|
||||
$checked = "";
|
||||
if (vq($v['operator_id'],$q['outcome_type_id'])) $checked="checked=\"checked\"";
|
||||
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['outcome_type_id']}_{$v['operator_id']}\" id=\"cb_{$q['outcome_type_id']}_{$v['operator_id']}\" $checked></input></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Modify operator skills") ."\"/></form>";
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Assign operators to skills in a checkbox matrix
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Determine if an operator has been assigned to a skill (outcome_type)
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $outcome_type_id Outcome type id (skill)
|
||||
* @return int 1 if assigned to that skill otherwise 0
|
||||
*
|
||||
*/
|
||||
function vq($operator_id,$outcome_type_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT operator_id,outcome_type_id
|
||||
FROM operator_skill
|
||||
WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'";
|
||||
|
||||
$vq = $db->Execute($sql);
|
||||
|
||||
if ($vq)
|
||||
return $vq->RecordCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an operator to a skill (outcome_type)
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $outcome_type_id Outcome type id (skill)
|
||||
*
|
||||
*/
|
||||
function vqi($operator_id,$outcome_type_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "INSERT INTO
|
||||
operator_skill (operator_id,outcome_type_id)
|
||||
VALUES('$operator_id','$outcome_type_id')";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a skill (outcome_type) from an operator
|
||||
*
|
||||
* @param int $operator_id Operator id
|
||||
* @param int $outcome_type_id Outcome type id (skill)
|
||||
*
|
||||
*/
|
||||
function vqd($operator_id,$outcome_type_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "DELETE FROM
|
||||
operator_skill
|
||||
WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE
|
||||
FROM operator_skill
|
||||
WHERE operator_id IN (
|
||||
SELECT operator_id
|
||||
FROM operator
|
||||
WHERE enabled = 1)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach ($_POST as $g => $v)
|
||||
{
|
||||
$a = explode("_",$g);
|
||||
if ($a[0] == "cb")
|
||||
vqi($a[2],$a[1]);
|
||||
}
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT outcome_type_id,description
|
||||
FROM outcome_type
|
||||
ORDER by outcome_type_id ASC";
|
||||
|
||||
$outcome_types = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName) as description, username
|
||||
FROM operator
|
||||
WHERE enabled = 1
|
||||
ORDER by operator_id ASC";
|
||||
|
||||
$operators = $db->GetAll($sql);
|
||||
|
||||
|
||||
xhtml_head(T_("Assign operators to Skills"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/iCheck/icheck.min.js"));
|
||||
|
||||
print "<div class='well'>" . T_("Set which types of cases will be made available to each operator. </br> Please note that all operators will be allowed to assign all possible outcomes to a case. This restricts which ones will be assigned to an operator.") . "</div>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
print "outcome_type_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($outcome_types as $q)
|
||||
{
|
||||
$s .= "'{$q['outcome_type_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
print "operator_id = new Array(";
|
||||
|
||||
$s = "";
|
||||
|
||||
foreach($operators as $q)
|
||||
{
|
||||
$s .= "'{$q['operator_id']}',";
|
||||
}
|
||||
|
||||
$s = substr($s,0,strlen($s) - 1);
|
||||
print "$s);\n";
|
||||
|
||||
?>
|
||||
|
||||
var QidOn = 0;
|
||||
var VidOn = 0;
|
||||
|
||||
function checkQid(q)
|
||||
{
|
||||
|
||||
for (y in operator_id)
|
||||
{
|
||||
v = operator_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (QidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (QidOn == 0)
|
||||
QidOn = 1;
|
||||
else
|
||||
QidOn = 0;
|
||||
}
|
||||
|
||||
|
||||
function checkVid(v)
|
||||
{
|
||||
|
||||
for (y in outcome_type_id)
|
||||
{
|
||||
q = outcome_type_id[y];
|
||||
|
||||
cb = document.getElementById('cb_' + q + "_" + v);
|
||||
|
||||
if (VidOn == 0)
|
||||
cb.checked = 'checked';
|
||||
else
|
||||
cb.checked = '';
|
||||
|
||||
}
|
||||
|
||||
if (VidOn == 0)
|
||||
VidOn = 1;
|
||||
else
|
||||
VidOn = 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
//$country_code = 'RU'; // Nederlandse Antillen
|
||||
//print_r(DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code));
|
||||
|
||||
|
||||
print "<form action=\"\" method=\"post\"><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||
|
||||
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Operator") . " </th>";
|
||||
foreach($outcome_types as $q)
|
||||
{
|
||||
print "<th> <a href=\"javascript:checkQid({$q['outcome_type_id']})\">" . T_($q['description']) . "</a> </th>";
|
||||
}
|
||||
print "</tr></thead>";
|
||||
|
||||
|
||||
foreach($operators as $v)
|
||||
{
|
||||
print "<tr class=''>
|
||||
<th> {$v['username']} </th>
|
||||
<th> <a href=\"javascript:checkVid({$v['operator_id']})\">{$v['description']}</a> </th>";
|
||||
foreach($outcome_types as $q)
|
||||
{
|
||||
$checked = "";
|
||||
if (vq($v['operator_id'],$q['outcome_type_id'])) $checked="checked=\"checked\"";
|
||||
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['outcome_type_id']}_{$v['operator_id']}\" id=\"cb_{$q['outcome_type_id']}_{$v['operator_id']}\" $checked></input></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Modify operator skills") ."\"/></form>";
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,306 +1,306 @@
|
||||
<?php /**
|
||||
* Display outcomes by questionnaire
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../db.inc.php');
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* AAPOR calculation functions
|
||||
*/
|
||||
include ("../functions/functions.aapor.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include ("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Performance functions
|
||||
*/
|
||||
include ("../functions/functions.performance.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include ("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$admin_operator_id = get_operator_id();
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
xhtml_head(T_("Questionnaire Outcomes"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
|
||||
print "<h3 class='col-sm-4 pull-left text-right'>" . T_("Select a questionnaire") . "</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id, false, "pull-left col-sm-4", "form-control");
|
||||
print "<div class='clearfix form-group'></div>";
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
//print "<h1>" . T_("Outcomes") . "</h1>";
|
||||
print "<div class='col-sm-4'><div class='panel panel-body'><h5>" . T_("Sample status") . "</h5>";
|
||||
|
||||
$sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn,
|
||||
count(*) as count
|
||||
FROM sample as s
|
||||
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id)
|
||||
LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id)
|
||||
GROUP BY (c.sample_id is not null)";
|
||||
if ($db->GetAll($sql)) xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "table-hover table table-condensed", false, array("count"));
|
||||
else print "<div class='alert text-danger'>" . T_("No samples assigned") . ". </div>";
|
||||
print "</div>";
|
||||
|
||||
print "<div class='panel panel-body'><h5>" . T_("Case availability (cases with temporary or appointment outcomes)") ."</h5>";
|
||||
|
||||
$sql = "SELECT count(c.case_id) as available, si.description
|
||||
FROM `case` as c
|
||||
LEFT JOIN `call` as a on (a.call_id = c.last_call_id)
|
||||
JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id)
|
||||
JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (q.questionnaire_id = $questionnaire_id and c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and qs.questionnaire_id = q.questionnaire_id and ou.outcome_id = c.current_outcome_id)
|
||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||
LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC')))
|
||||
LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end))
|
||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id)
|
||||
LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id)
|
||||
LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
|
||||
WHERE c.current_operator_id IS NULL
|
||||
AND ou.outcome_type_id IN (1,5)
|
||||
AND (casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
||||
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
||||
AND ap.case_id is NULL
|
||||
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0)
|
||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL AND ou.outcome_type_id != 2)
|
||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL AND ou.outcome_type_id != 2)
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) < qs.call_attempt_max))
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE `call`.case_id = c.case_id) < qs.call_max))
|
||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE `questionnaire_sample_quota`.questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND `questionnaire_sample_quota`.quota_reached = 1) = 0
|
||||
|
||||
group by s.import_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (empty($rs))
|
||||
{
|
||||
print "<div class='alert text-danger'>" . T_("No cases currently available to call") . "</div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
xhtml_table($rs,array("description","available"),array(T_("Sample"),T_("Cases currently available to call")),"tclass",false,array("available"));
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
$atime = get_average_time_questionnaire(10,$questionnaire_id);
|
||||
$mins = intval($atime / 60);
|
||||
$secs = $atime % 60;
|
||||
|
||||
print "<div class='panel panel-body'><h5>" . T_("Average time on a completed questionnaire") . ":<b> $mins " . T_("Min") . " $secs " . T_("Secs") . "</b></h5>";
|
||||
|
||||
$sql = "SELECT o.calc, count( c.case_id )
|
||||
FROM `case` AS c, `outcome` AS o
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.current_outcome_id = o.outcome_id
|
||||
GROUP BY o.calc";
|
||||
|
||||
$a = $db->GetAssoc($sql);
|
||||
$a = aapor_clean($a);
|
||||
|
||||
print "<table class='col-sm-10'><thead><tr><th class='col-sm-8'>" . T_("Outcome") . "</th><th>" . T_("Rate") . "</th></tr></thead>"; // table-hover table table-condensed
|
||||
print "<tr><td>" . T_("Response Rate 1") . "</td><td>" . round(aapor_rr1($a),2) . "</td></tr>";
|
||||
print "<tr><td>" . T_("Refusal Rate 1") . "</td><td>" . round(aapor_ref1($a),2) . "</td></tr>";
|
||||
print "<tr><td>" . T_("Cooperation Rate 1") . "</td><td>" . round(aapor_coop1($a),2) . "</td></tr>";
|
||||
print "<tr><td>" . T_("Contact Rate 1") . "</td><td>" . round(aapor_con1($a),2) . "</td></tr>";
|
||||
print "</table></div></div>";
|
||||
|
||||
$sql = "SELECT count(case_id) FROM `case` WHERE `case`.questionnaire_id = '$questionnaire_id'";
|
||||
$cases = $db->GetOne($sql);
|
||||
|
||||
$sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&outcome_id=', o.outcome_id, '\'>', o.description, '</a>') as des, o.outcome_id, count( c.case_id ) as count, ROUND((count( c.case_id ) / $cases) * 100,2) as perc
|
||||
FROM `case` AS c, `outcome` AS o
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.current_outcome_id = o.outcome_id
|
||||
GROUP BY o.outcome_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{ print "<div class='col-sm-8'><div class='panel panel-body'>";
|
||||
//print "<h4>" . T_("Total cases for questionnaire") . " = <b>$cases</b></h4>";
|
||||
translate_array($rs,array("des"));
|
||||
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count")," " . T_("%")),"tclass",false,array("count","perc"));//array("des" => "Complete")
|
||||
print "</div></div>";
|
||||
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
//display a list of samples
|
||||
$sql = "SELECT s.sample_import_id as value,s.description, CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM sample_import as s, questionnaire_sample as q
|
||||
WHERE s.sample_import_id = q.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
|
||||
print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Sample") . ": " . "</h3>";
|
||||
if(!empty($r))
|
||||
display_chooser($r,"sample_import_id","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left col-sm-4");
|
||||
else print "<h4 class='col-sm-3 text-danger'>" . T_("No samples assigned") . "</h4>";
|
||||
if ($sample_import_id != false)
|
||||
{
|
||||
print "<div class='clearfix form-group'></div><div class='col-sm-4'><div class='panel panel-body'><p>" . T_("Sample status") . "</p>";
|
||||
|
||||
$sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn,
|
||||
count(*) as count
|
||||
FROM sample as s
|
||||
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id)
|
||||
LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id)
|
||||
WHERE s.import_id = '$sample_import_id'
|
||||
GROUP BY (c.sample_id is not null)";
|
||||
|
||||
xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "tclass", false, array("count"));
|
||||
print "</div></div>";
|
||||
|
||||
print "<div class='col-sm-8'><div class='panel panel-body'>"; //<p>" . T_("Outcomes") . "</p>";
|
||||
|
||||
|
||||
$sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&outcome_id=', o.outcome_id, '\'>', o.description, '</a>') as des, o.outcome_id, count( c.case_id ) as count,ROUND(count(c.case_id) / (SELECT count(case_id) FROM `case` JOIN sample ON (`case`.sample_id = sample.sample_id AND sample.import_id = '$sample_import_id') WHERE questionnaire_id = '$questionnaire_id' ) * 100,2) as perc
|
||||
|
||||
FROM `case` AS c, `outcome` AS o, sample as s
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.sample_id = s.sample_id
|
||||
AND s.import_id = '$sample_import_id'
|
||||
AND c.current_outcome_id = o.outcome_id
|
||||
GROUP BY o.outcome_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
translate_array($rs,array("des"));
|
||||
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc"));
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No outcomes recorded for this sample") . "</p>";
|
||||
|
||||
print "</div></div>";
|
||||
}
|
||||
$operator_id = false;
|
||||
if (isset($_GET['operator_id'])) $operator_id = bigintval($_GET['operator_id']);
|
||||
|
||||
//display a list of operators !!!worked for this questionnaire_id !!!!
|
||||
$sql = "SELECT s.operator_id as value, s.firstname as description, CASE WHEN s.operator_id = '$operator_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `call` as c , `operator`as s, `case` as ca
|
||||
WHERE ca.questionnaire_id = '$questionnaire_id'
|
||||
AND ca.case_id = c.case_id
|
||||
AND c.operator_id = s.operator_id
|
||||
GROUP by c.operator_id";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Operator") . ": " . "</h3>";
|
||||
if(!empty($r))
|
||||
display_chooser($r,"operator_id","operator_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left col-sm-4");
|
||||
else print "<h4 class='col-sm-3 text-danger'>" . T_("No operators assigned") . ". </h4>";
|
||||
print "" ;
|
||||
if ($operator_id != false)
|
||||
{
|
||||
print "<div class='clearfix form-group'></div><div class='col-sm-6'><div class='panel panel-body'><p>" . T_("Operator call outcomes") . "</p>";
|
||||
|
||||
$sql = "SELECT o.description as des, o.outcome_id, count( c.call_id ) as count, ROUND((count(c.call_id) / (SELECT count(call.call_id) FROM `call` JOIN `case` ON (call.case_id = `case`.case_id AND `case`.questionnaire_id = $questionnaire_id ) WHERE call.operator_id = '$operator_id')) * 100,2) as perc
|
||||
FROM `call` AS c, `case` as ca, `outcome` AS o
|
||||
WHERE ca.questionnaire_id = '$questionnaire_id'
|
||||
AND ca.case_id = c.case_id
|
||||
AND c.operator_id = '$operator_id'
|
||||
AND c.outcome_id = o.outcome_id
|
||||
GROUP BY o.outcome_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
translate_array($rs,array("des"));
|
||||
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc"));
|
||||
}
|
||||
print "</div></div>";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No outcomes recorded for this questionnaire") . "</p>";
|
||||
|
||||
|
||||
//display a list of shifts with completions and a link to either add a report or view reports
|
||||
print "<div class='clearfix'></div>";
|
||||
print "<h3 class='col-sm-4 pull-left text-center'>" . T_("Shifts") . ":</h3>";
|
||||
|
||||
$sql = "SELECT s.shift_id, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_FORMAT . "')) as sdate,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "'),'-', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as stime,
|
||||
CASE WHEN sr.shift_id IS NULL THEN
|
||||
CONCAT('<a href=\'shiftreport.php?questionnaire_id=$questionnaire_id&shift_id=', s.shift_id, '&createnewreport=yes\' data-toggle=\'tooltip\' title=\'" . TQ_("No shift reports: Add report") . "\' class=\'btn center-block\'><i class=\'fa fa-plus text-warning\'></i><i class=\'fa fa-file-text-o fa-lg\'></i></a>')
|
||||
ELSE CONCAT('<a href=\'shiftreport.php?questionnaire_id=$questionnaire_id&shift_id=', s.shift_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("View shift reports") . "\' class=\'btn center-block\'><i class=\'fa fa-file-text-o fa-lg\'></i></a>')
|
||||
END AS link,
|
||||
c.completions as completions,
|
||||
CONCAT('<a href=\'operatorperformance.php?questionnaire_id=$questionnaire_id&shift_id=', s.shift_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("View operator performance") . "\' class=\'btn center-block\'><i class=\'fa fa-user fa-lg\'></i><i class=\'fa fa-signal \'></i></a>') as operform
|
||||
FROM `shift` as s
|
||||
JOIN operator as o on (o.operator_id = '$admin_operator_id')
|
||||
LEFT JOIN shift_report as sr on (sr.shift_id = s.shift_id)
|
||||
LEFT JOIN ( SELECT count(*) as completions,sh.shift_id
|
||||
FROM `call` as a, `case` as b, shift as sh
|
||||
WHERE a.outcome_id = '10'
|
||||
AND a.case_id = b.case_id
|
||||
AND b.questionnaire_id = '$questionnaire_id'
|
||||
AND sh.start <= a.start
|
||||
AND sh.end >= a.start
|
||||
GROUP BY sh.shift_id) as c on (s.shift_id = c.shift_id)
|
||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||
GROUP BY shift_id
|
||||
ORDER BY s.start ASC";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (empty($r))
|
||||
print "<h4 class='col-sm-4 text-danger'>" . T_("No shifts defined for this questionnaire") . "</h4>";
|
||||
else {
|
||||
print "<div class='clearfix form-group'></div>";
|
||||
print "<div class='col-sm-6 panel-body' style='max-height:400px; overflow:auto;'>";
|
||||
xhtml_table($r,array("sdate","stime","completions","link","operform"),array(T_("Date"),T_("Shift time"),T_("Completions"),T_("Shift report"),T_("Operator performance")),"tclass");
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
|
||||
?>
|
||||
<?php /**
|
||||
* Display outcomes by questionnaire
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../db.inc.php');
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* AAPOR calculation functions
|
||||
*/
|
||||
include ("../functions/functions.aapor.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include ("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Performance functions
|
||||
*/
|
||||
include ("../functions/functions.performance.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include ("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
$admin_operator_id = get_operator_id();
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
xhtml_head(T_("Questionnaire Outcomes"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
|
||||
|
||||
|
||||
print "<h3 class='col-sm-4 pull-left text-right'>" . T_("Select a questionnaire") . "</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id, false, "pull-left col-sm-4", "form-control");
|
||||
print "<div class='clearfix form-group'></div>";
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
//print "<h1>" . T_("Outcomes") . "</h1>";
|
||||
print "<div class='col-sm-4'><div class='panel panel-body'><h5>" . T_("Sample status") . "</h5>";
|
||||
|
||||
$sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn,
|
||||
count(*) as count
|
||||
FROM sample as s
|
||||
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id)
|
||||
LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id)
|
||||
GROUP BY (c.sample_id is not null)";
|
||||
if ($db->GetAll($sql)) xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "table-hover table table-condensed", false, array("count"));
|
||||
else print "<div class='alert text-danger'>" . T_("No samples assigned") . ". </div>";
|
||||
print "</div>";
|
||||
|
||||
print "<div class='panel panel-body'><h5>" . T_("Case availability (cases with temporary or appointment outcomes)") ."</h5>";
|
||||
|
||||
$sql = "SELECT count(c.case_id) as available, si.description
|
||||
FROM `case` as c
|
||||
LEFT JOIN `call` as a on (a.call_id = c.last_call_id)
|
||||
JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id)
|
||||
JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (q.questionnaire_id = $questionnaire_id and c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and qs.questionnaire_id = q.questionnaire_id and ou.outcome_id = c.current_outcome_id)
|
||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||
LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC')))
|
||||
LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end))
|
||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id)
|
||||
LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id)
|
||||
LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
|
||||
WHERE c.current_operator_id IS NULL
|
||||
AND ou.outcome_type_id IN (1,5)
|
||||
AND (casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
||||
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
||||
AND ap.case_id is NULL
|
||||
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0)
|
||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL AND ou.outcome_type_id != 2)
|
||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL AND ou.outcome_type_id != 2)
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) < qs.call_attempt_max))
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE `call`.case_id = c.case_id) < qs.call_max))
|
||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE `questionnaire_sample_quota`.questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND `questionnaire_sample_quota`.quota_reached = 1) = 0
|
||||
|
||||
group by s.import_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (empty($rs))
|
||||
{
|
||||
print "<div class='alert text-danger'>" . T_("No cases currently available to call") . "</div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
xhtml_table($rs,array("description","available"),array(T_("Sample"),T_("Cases currently available to call")),"tclass",false,array("available"));
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
$atime = get_average_time_questionnaire(10,$questionnaire_id);
|
||||
$mins = intval($atime / 60);
|
||||
$secs = $atime % 60;
|
||||
|
||||
print "<div class='panel panel-body'><h5>" . T_("Average time on a completed questionnaire") . ":<b> $mins " . T_("Min") . " $secs " . T_("Secs") . "</b></h5>";
|
||||
|
||||
$sql = "SELECT o.calc, count( c.case_id )
|
||||
FROM `case` AS c, `outcome` AS o
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.current_outcome_id = o.outcome_id
|
||||
GROUP BY o.calc";
|
||||
|
||||
$a = $db->GetAssoc($sql);
|
||||
$a = aapor_clean($a);
|
||||
|
||||
print "<table class='col-sm-10'><thead><tr><th class='col-sm-8'>" . T_("Outcome") . "</th><th>" . T_("Rate") . "</th></tr></thead>"; // table-hover table table-condensed
|
||||
print "<tr><td>" . T_("Response Rate 1") . "</td><td>" . round(aapor_rr1($a),2) . "</td></tr>";
|
||||
print "<tr><td>" . T_("Refusal Rate 1") . "</td><td>" . round(aapor_ref1($a),2) . "</td></tr>";
|
||||
print "<tr><td>" . T_("Cooperation Rate 1") . "</td><td>" . round(aapor_coop1($a),2) . "</td></tr>";
|
||||
print "<tr><td>" . T_("Contact Rate 1") . "</td><td>" . round(aapor_con1($a),2) . "</td></tr>";
|
||||
print "</table></div></div>";
|
||||
|
||||
$sql = "SELECT count(case_id) FROM `case` WHERE `case`.questionnaire_id = '$questionnaire_id'";
|
||||
$cases = $db->GetOne($sql);
|
||||
|
||||
$sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&outcome_id=', o.outcome_id, '\'>', o.description, '</a>') as des, o.outcome_id, count( c.case_id ) as count, ROUND((count( c.case_id ) / $cases) * 100,2) as perc
|
||||
FROM `case` AS c, `outcome` AS o
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.current_outcome_id = o.outcome_id
|
||||
GROUP BY o.outcome_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{ print "<div class='col-sm-8'><div class='panel panel-body'>";
|
||||
//print "<h4>" . T_("Total cases for questionnaire") . " = <b>$cases</b></h4>";
|
||||
translate_array($rs,array("des"));
|
||||
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count")," " . T_("%")),"tclass",false,array("count","perc"));//array("des" => "Complete")
|
||||
print "</div></div>";
|
||||
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
//display a list of samples
|
||||
$sql = "SELECT s.sample_import_id as value,s.description, CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM sample_import as s, questionnaire_sample as q
|
||||
WHERE s.sample_import_id = q.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
|
||||
print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Sample") . ": " . "</h3>";
|
||||
if(!empty($r))
|
||||
display_chooser($r,"sample_import_id","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left col-sm-4");
|
||||
else print "<h4 class='col-sm-3 text-danger'>" . T_("No samples assigned") . "</h4>";
|
||||
if ($sample_import_id != false)
|
||||
{
|
||||
print "<div class='clearfix form-group'></div><div class='col-sm-4'><div class='panel panel-body'><p>" . T_("Sample status") . "</p>";
|
||||
|
||||
$sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn,
|
||||
count(*) as count
|
||||
FROM sample as s
|
||||
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id)
|
||||
LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id)
|
||||
WHERE s.import_id = '$sample_import_id'
|
||||
GROUP BY (c.sample_id is not null)";
|
||||
|
||||
xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "tclass", false, array("count"));
|
||||
print "</div></div>";
|
||||
|
||||
print "<div class='col-sm-8'><div class='panel panel-body'>"; //<p>" . T_("Outcomes") . "</p>";
|
||||
|
||||
|
||||
$sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&outcome_id=', o.outcome_id, '\'>', o.description, '</a>') as des, o.outcome_id, count( c.case_id ) as count,ROUND(count(c.case_id) / (SELECT count(case_id) FROM `case` JOIN sample ON (`case`.sample_id = sample.sample_id AND sample.import_id = '$sample_import_id') WHERE questionnaire_id = '$questionnaire_id' ) * 100,2) as perc
|
||||
|
||||
FROM `case` AS c, `outcome` AS o, sample as s
|
||||
WHERE c.questionnaire_id = '$questionnaire_id'
|
||||
AND c.sample_id = s.sample_id
|
||||
AND s.import_id = '$sample_import_id'
|
||||
AND c.current_outcome_id = o.outcome_id
|
||||
GROUP BY o.outcome_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
translate_array($rs,array("des"));
|
||||
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc"));
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No outcomes recorded for this sample") . "</p>";
|
||||
|
||||
print "</div></div>";
|
||||
}
|
||||
$operator_id = false;
|
||||
if (isset($_GET['operator_id'])) $operator_id = bigintval($_GET['operator_id']);
|
||||
|
||||
//display a list of operators !!!worked for this questionnaire_id !!!!
|
||||
$sql = "SELECT s.operator_id as value, s.firstname as description, CASE WHEN s.operator_id = '$operator_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `call` as c , `operator`as s, `case` as ca
|
||||
WHERE ca.questionnaire_id = '$questionnaire_id'
|
||||
AND ca.case_id = c.case_id
|
||||
AND c.operator_id = s.operator_id
|
||||
GROUP by c.operator_id";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Operator") . ": " . "</h3>";
|
||||
if(!empty($r))
|
||||
display_chooser($r,"operator_id","operator_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left col-sm-4");
|
||||
else print "<h4 class='col-sm-3 text-danger'>" . T_("No operators assigned") . ". </h4>";
|
||||
print "" ;
|
||||
if ($operator_id != false)
|
||||
{
|
||||
print "<div class='clearfix form-group'></div><div class='col-sm-6'><div class='panel panel-body'><p>" . T_("Operator call outcomes") . "</p>";
|
||||
|
||||
$sql = "SELECT o.description as des, o.outcome_id, count( c.call_id ) as count, ROUND((count(c.call_id) / (SELECT count(call.call_id) FROM `call` JOIN `case` ON (call.case_id = `case`.case_id AND `case`.questionnaire_id = $questionnaire_id ) WHERE call.operator_id = '$operator_id')) * 100,2) as perc
|
||||
FROM `call` AS c, `case` as ca, `outcome` AS o
|
||||
WHERE ca.questionnaire_id = '$questionnaire_id'
|
||||
AND ca.case_id = c.case_id
|
||||
AND c.operator_id = '$operator_id'
|
||||
AND c.outcome_id = o.outcome_id
|
||||
GROUP BY o.outcome_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
{
|
||||
translate_array($rs,array("des"));
|
||||
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc"));
|
||||
}
|
||||
print "</div></div>";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
print "<p>" . T_("No outcomes recorded for this questionnaire") . "</p>";
|
||||
|
||||
|
||||
//display a list of shifts with completions and a link to either add a report or view reports
|
||||
print "<div class='clearfix'></div>";
|
||||
print "<h3 class='col-sm-4 pull-left text-center'>" . T_("Shifts") . ":</h3>";
|
||||
|
||||
$sql = "SELECT s.shift_id, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_FORMAT . "')) as sdate,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "'),'-', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as stime,
|
||||
CASE WHEN sr.shift_id IS NULL THEN
|
||||
CONCAT('<a href=\'shiftreport.php?questionnaire_id=$questionnaire_id&shift_id=', s.shift_id, '&createnewreport=yes\' data-toggle=\'tooltip\' title=\'" . TQ_("No shift reports: Add report") . "\' class=\'btn center-block\'><i class=\'fa fa-plus text-warning\'></i><i class=\'fa fa-file-text-o fa-lg\'></i></a>')
|
||||
ELSE CONCAT('<a href=\'shiftreport.php?questionnaire_id=$questionnaire_id&shift_id=', s.shift_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("View shift reports") . "\' class=\'btn center-block\'><i class=\'fa fa-file-text-o fa-lg\'></i></a>')
|
||||
END AS link,
|
||||
c.completions as completions,
|
||||
CONCAT('<a href=\'operatorperformance.php?questionnaire_id=$questionnaire_id&shift_id=', s.shift_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("View operator performance") . "\' class=\'btn center-block\'><i class=\'fa fa-user fa-lg\'></i><i class=\'fa fa-signal \'></i></a>') as operform
|
||||
FROM `shift` as s
|
||||
JOIN operator as o on (o.operator_id = '$admin_operator_id')
|
||||
LEFT JOIN shift_report as sr on (sr.shift_id = s.shift_id)
|
||||
LEFT JOIN ( SELECT count(*) as completions,sh.shift_id
|
||||
FROM `call` as a, `case` as b, shift as sh
|
||||
WHERE a.outcome_id = '10'
|
||||
AND a.case_id = b.case_id
|
||||
AND b.questionnaire_id = '$questionnaire_id'
|
||||
AND sh.start <= a.start
|
||||
AND sh.end >= a.start
|
||||
GROUP BY sh.shift_id) as c on (s.shift_id = c.shift_id)
|
||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||
GROUP BY shift_id
|
||||
ORDER BY s.start ASC";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (empty($r))
|
||||
print "<h4 class='col-sm-4 text-danger'>" . T_("No shifts defined for this questionnaire") . "</h4>";
|
||||
else {
|
||||
print "<div class='clearfix form-group'></div>";
|
||||
print "<div class='col-sm-6 panel-body' style='max-height:400px; overflow:auto;'>";
|
||||
xhtml_table($r,array("sdate","stime","completions","link","operform"),array(T_("Date"),T_("Shift time"),T_("Completions"),T_("Shift report"),T_("Operator performance")),"tclass");
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot($js_foot);
|
||||
|
||||
?>
|
||||
|
||||
@@ -72,15 +72,15 @@ include("../include/ckeditor/ckeditor.php");
|
||||
global $db;
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js"
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js"
|
||||
);
|
||||
$js_foot = array(
|
||||
"../js/new.js",
|
||||
@@ -598,4 +598,4 @@ xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('[data-toggle="confirmation"]').confirmation();
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,196 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* Select and set questions to pre fill in the questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']))
|
||||
{
|
||||
//need to add prefill to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$value = $db->quote($_GET['value']);
|
||||
$svar = $db->quote($_GET['svar']);
|
||||
$sgqa = $db->quote($_GET['sgqa']);
|
||||
|
||||
if (!empty($_GET['svar']) && empty($_GET['value']))
|
||||
$value = $svar;
|
||||
|
||||
$sql = "INSERT INTO questionnaire_prefill(questionnaire_id,lime_sgqa,value)
|
||||
VALUES('$questionnaire_id',$sgqa,$value)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_prefill_id']))
|
||||
{
|
||||
//need to remove prefill from questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$questionnaire_prefill_id = bigintval($_GET['questionnaire_prefill_id']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_prefill
|
||||
WHERE questionnaire_prefill_id = '$questionnaire_prefill_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Pre fill questionnaire: Set values for questionnaire to prefill"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Select a questionnaire") . ": </h3>";
|
||||
|
||||
$sql = "SELECT questionnaire_id as value,description,
|
||||
CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1";
|
||||
display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline form-group");
|
||||
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
print "<h2>" . T_("Current pre fills") . "</h2>";
|
||||
|
||||
$sql = "SELECT questionnaire_prefill_id,lime_sgqa,value
|
||||
FROM questionnaire_prefill
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (empty($r))
|
||||
{
|
||||
print "<p class='well text-info'>" . T_("Currently no pre fills") . "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($r as $v)
|
||||
{
|
||||
print "<ul class='form-group clearfix'><p class='col-sm-2'>" . T_("SGQA code") . ": <b class='text-primary'>{$v['lime_sgqa']}</b></p><p class='col-sm-4'>" . T_("Sample variable") . ": <b class='text-primary'>{$v['value']}</b></p><a href='?questionnaire_id=$questionnaire_id&questionnaire_prefill_id={$v['questionnaire_prefill_id']}'><i class='fa fa-lg text-danger'>" . T_("Delete") . "</i></a></ul>";
|
||||
}
|
||||
}
|
||||
print "";
|
||||
|
||||
print "<h3 class='pull-left'>" . T_("Select a question to pre fill") . " </h3>";
|
||||
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetRow($sql);
|
||||
|
||||
$lime_sid = $r['lime_sid'];
|
||||
|
||||
$sgqa = false;
|
||||
if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa'];
|
||||
|
||||
$sql = "SELECT CONCAT( q.sid, 'X', q.gid, 'X', q.qid) AS value,
|
||||
CASE WHEN qo.question IS NULL THEN q.question ELSE CONCAT(qo.question,' : ',q.question) END as description,
|
||||
CASE WHEN CONCAT(q.sid, 'X', q.gid, 'X', q.qid) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `" . LIME_PREFIX . "questions` AS q
|
||||
LEFT JOIN `" . LIME_PREFIX . "questions` as qo ON (qo.qid = q.parent_qid)
|
||||
WHERE q.sid = '$lime_sid'
|
||||
ORDER BY CASE WHEN qo.question_order IS NULL THEN q.question_order ELSE qo.question_order + (q.question_order / 1000) END ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
for ($i=0; $i<count($rs); $i++)
|
||||
{
|
||||
$rs[$i]['description'] = substr(strip_tags($rs[$i]['description']),0,400);
|
||||
}
|
||||
|
||||
display_chooser($rs,"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left");
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sgqa != false)
|
||||
{
|
||||
print "<h2 >" . T_("Enter a value to pre fill this question with:") . "</h2>";
|
||||
print "<div class='well'><p>";
|
||||
print T_("Possible uses:");
|
||||
print "</p><ul>";
|
||||
print "<li>" . T_("{Respondent:firstName} First name of the respondent") . "</li>";
|
||||
print "<li>" . T_("{Respondent:lastName} Last name of the respondent") . "</li>";
|
||||
print "<li>" . T_("{Sample:var} A record from the sample where the column name is 'var'") . "</li>";
|
||||
print "</ul></div>";
|
||||
|
||||
$sql = "SELECT sivr.var as description, CONCAT('{Sample:', sivr.var, '}') as value
|
||||
FROM `sample_import_var_restrict` as sivr, questionnaire_sample as qs
|
||||
WHERE qs.questionnaire_id = '$questionnaire_id'
|
||||
AND sivr.sample_import_id = qs.sample_import_id";
|
||||
?>
|
||||
<form action="" method="get" class="form-inline form-group">
|
||||
<label for="value"><?php echo T_("The value to pre fill"); ?>: </label><input type="text" name="value" id="value" size="50" class="form-control"/>
|
||||
<label for="svar"> <?php echo T_("or: Select pre fill from sample list"); ?> </label>
|
||||
<?php //display a list of possible sample variables for this questionnaire
|
||||
display_chooser($db->GetAll($sql),"svar","svar",true,false,false,true,false,true,"form-group");
|
||||
?>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
|
||||
<input type="submit" name="add_prefill" class="btn btn-primary fa" value="<?php print(T_("Add pre fill")); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Select and set questions to pre fill in the questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']))
|
||||
{
|
||||
//need to add prefill to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$value = $db->quote($_GET['value']);
|
||||
$svar = $db->quote($_GET['svar']);
|
||||
$sgqa = $db->quote($_GET['sgqa']);
|
||||
|
||||
if (!empty($_GET['svar']) && empty($_GET['value']))
|
||||
$value = $svar;
|
||||
|
||||
$sql = "INSERT INTO questionnaire_prefill(questionnaire_id,lime_sgqa,value)
|
||||
VALUES('$questionnaire_id',$sgqa,$value)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_prefill_id']))
|
||||
{
|
||||
//need to remove prefill from questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$questionnaire_prefill_id = bigintval($_GET['questionnaire_prefill_id']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_prefill
|
||||
WHERE questionnaire_prefill_id = '$questionnaire_prefill_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Pre fill questionnaire: Set values for questionnaire to prefill"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Select a questionnaire") . ": </h3>";
|
||||
|
||||
$sql = "SELECT questionnaire_id as value,description,
|
||||
CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1";
|
||||
display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline form-group");
|
||||
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
print "<h2>" . T_("Current pre fills") . "</h2>";
|
||||
|
||||
$sql = "SELECT questionnaire_prefill_id,lime_sgqa,value
|
||||
FROM questionnaire_prefill
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (empty($r))
|
||||
{
|
||||
print "<p class='well text-info'>" . T_("Currently no pre fills") . "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($r as $v)
|
||||
{
|
||||
print "<ul class='form-group clearfix'><p class='col-sm-2'>" . T_("SGQA code") . ": <b class='text-primary'>{$v['lime_sgqa']}</b></p><p class='col-sm-4'>" . T_("Sample variable") . ": <b class='text-primary'>{$v['value']}</b></p><a href='?questionnaire_id=$questionnaire_id&questionnaire_prefill_id={$v['questionnaire_prefill_id']}'><i class='fa fa-lg text-danger'>" . T_("Delete") . "</i></a></ul>";
|
||||
}
|
||||
}
|
||||
print "";
|
||||
|
||||
print "<h3 class='pull-left'>" . T_("Select a question to pre fill") . " </h3>";
|
||||
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetRow($sql);
|
||||
|
||||
$lime_sid = $r['lime_sid'];
|
||||
|
||||
$sgqa = false;
|
||||
if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa'];
|
||||
|
||||
$sql = "SELECT CONCAT( q.sid, 'X', q.gid, 'X', q.qid) AS value,
|
||||
CASE WHEN qo.question IS NULL THEN q.question ELSE CONCAT(qo.question,' : ',q.question) END as description,
|
||||
CASE WHEN CONCAT(q.sid, 'X', q.gid, 'X', q.qid) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `" . LIME_PREFIX . "questions` AS q
|
||||
LEFT JOIN `" . LIME_PREFIX . "questions` as qo ON (qo.qid = q.parent_qid)
|
||||
WHERE q.sid = '$lime_sid'
|
||||
ORDER BY CASE WHEN qo.question_order IS NULL THEN q.question_order ELSE qo.question_order + (q.question_order / 1000) END ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
for ($i=0; $i<count($rs); $i++)
|
||||
{
|
||||
$rs[$i]['description'] = substr(strip_tags($rs[$i]['description']),0,400);
|
||||
}
|
||||
|
||||
display_chooser($rs,"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left");
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sgqa != false)
|
||||
{
|
||||
print "<h2 >" . T_("Enter a value to pre fill this question with:") . "</h2>";
|
||||
print "<div class='well'><p>";
|
||||
print T_("Possible uses:");
|
||||
print "</p><ul>";
|
||||
print "<li>" . T_("{Respondent:firstName} First name of the respondent") . "</li>";
|
||||
print "<li>" . T_("{Respondent:lastName} Last name of the respondent") . "</li>";
|
||||
print "<li>" . T_("{Sample:var} A record from the sample where the column name is 'var'") . "</li>";
|
||||
print "</ul></div>";
|
||||
|
||||
$sql = "SELECT sivr.var as description, CONCAT('{Sample:', sivr.var, '}') as value
|
||||
FROM `sample_import_var_restrict` as sivr, questionnaire_sample as qs
|
||||
WHERE qs.questionnaire_id = '$questionnaire_id'
|
||||
AND sivr.sample_import_id = qs.sample_import_id";
|
||||
?>
|
||||
<form action="" method="get" class="form-inline form-group">
|
||||
<label for="value"><?php echo T_("The value to pre fill"); ?>: </label><input type="text" name="value" id="value" size="50" class="form-control"/>
|
||||
<label for="svar"> <?php echo T_("or: Select pre fill from sample list"); ?> </label>
|
||||
<?php //display a list of possible sample variables for this questionnaire
|
||||
display_chooser($db->GetAll($sql),"svar","svar",true,false,false,true,false,true,"form-group");
|
||||
?>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
|
||||
<input type="submit" name="add_prefill" class="btn btn-primary fa" value="<?php print(T_("Add pre fill")); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
522
admin/quota.php
522
admin/quota.php
@@ -1,261 +1,261 @@
|
||||
<?php
|
||||
/**
|
||||
* Set quota's for answered questions
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008,2009
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Limesurvey functions
|
||||
*/
|
||||
include("../functions/functions.limesurvey.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']) && isset($_GET['completions']) && isset($_GET['sample_import_id']) && isset($_GET['comparison']))
|
||||
{
|
||||
//need to add quota
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$value = $db->quote($_GET['value']);
|
||||
$completions = $db->quote($_GET['completions']);
|
||||
$sgqa = $db->quote($_GET['sgqa']);
|
||||
$comparison = $db->quote($_GET['comparison']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample_quota(questionnaire_id, sample_import_id, lime_sgqa,value,completions,comparison)
|
||||
VALUES ($questionnaire_id, $sample_import_id, $sgqa, $value, $completions, $comparison)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//Make sure to calculate on the spot
|
||||
update_quotas($questionnaire_id);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_sample_quota_id']))
|
||||
{
|
||||
//need to remove quota
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$questionnaire_sample_quota_id = bigintval($_GET['questionnaire_sample_quota_id']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_sample_quota
|
||||
WHERE questionnaire_sample_quota_id = '$questionnaire_sample_quota_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Quota management"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Questionnaire") . ": </h3>";
|
||||
|
||||
$sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1";
|
||||
display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline pull-left ");
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT s.sample_import_id as value,s.description, CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM sample_import as s, questionnaire_sample as q
|
||||
WHERE q.questionnaire_id = $questionnaire_id
|
||||
AND q.sample_import_id = s.sample_import_id";
|
||||
$s = $db->GetAll($sql);
|
||||
if (!empty($s)){
|
||||
|
||||
print "<h3 class='form-inline pull-left'>   " . T_("Sample") . ":  </h3>";
|
||||
display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left");
|
||||
|
||||
} else {
|
||||
print "<div class='clearfix'></div><div class='well text-info'>" . T_("No samples assigned to this questionnaire.") . "</div>";
|
||||
|
||||
}
|
||||
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sample_import_id != false)
|
||||
{
|
||||
print "<h2>" . T_("Current quotas") . ":</h2>";//(click to delete)
|
||||
|
||||
$sql = "SELECT questionnaire_sample_quota_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison
|
||||
FROM questionnaire_sample_quota as qsq, questionnaire as q
|
||||
WHERE qsq.questionnaire_id = '$questionnaire_id'
|
||||
AND qsq.sample_import_id = '$sample_import_id'
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (empty($r))
|
||||
{
|
||||
print "<p class='well text-info'>" . T_("Currently no quotas") . "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($r as $v)
|
||||
{
|
||||
print "<div><a href='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&questionnaire_sample_quota_id={$v['questionnaire_sample_quota_id']}'>" . T_("Stop calling this sample when:") . " {$v['lime_sgqa']} {$v['comparison']} {$v['value']} " . T_("for") . ": {$v['completions']} " . T_("completions") ."</a> - ";
|
||||
|
||||
if ($v['quota_reached'] == 1)
|
||||
print T_("Quota reached");
|
||||
else
|
||||
print T_("Quota not yet reached");
|
||||
|
||||
print " - " . T_("Current completions: ") . limesurvey_quota_completions($v['lime_sgqa'],$v['lime_sid'],$questionnaire_id,$sample_import_id,$v['value'],$v['comparison']);
|
||||
|
||||
print "</div>";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "<h3 class=' '>" . T_("Select a question for the quota") . "</h3>";
|
||||
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetRow($sql);
|
||||
|
||||
$lime_sid = $r['lime_sid'];
|
||||
|
||||
$sgqa = false;
|
||||
if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa'];
|
||||
|
||||
$sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value,
|
||||
CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ': ', lq.question) END as description,
|
||||
CASE WHEN CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `" . LIME_PREFIX . "questions` AS lq
|
||||
LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid )
|
||||
JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid)
|
||||
WHERE lq.sid = '$lime_sid'
|
||||
ORDER BY CASE WHEN lq2.question_order IS NULL THEN lq.question_order ELSE lq2.question_order + (lq.question_order / 1000) END ASC";
|
||||
|
||||
display_chooser($db->GetAll($sql),"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-group");
|
||||
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sgqa != false)
|
||||
{
|
||||
|
||||
print "<div class='col-sm-6 panel-body'><h3>" . T_("Enter the details for creating the quota:") . "</h3>";
|
||||
|
||||
?>
|
||||
<form action="" method="get" class="form-inline form-group">
|
||||
|
||||
<p><label for="comparison"><?php echo T_("The type of comparison"); ?>: </label>
|
||||
<select name="comparison" class='form-control' id="comparison">
|
||||
<option value="LIKE">LIKE</option>
|
||||
<option value="NOT LIKE">NOT LIKE</option>
|
||||
<option value="=">=</option><option value="!=">!=</option>
|
||||
<option value="<"><</option>
|
||||
<option value=">">></option>
|
||||
<option value="<="><=</option>
|
||||
<option value=">=">>=</option></select></p>
|
||||
|
||||
<p><label for="value"><?php echo T_("The code value to compare"); ?>: </label>
|
||||
<input type="text" name="value" id="value" class="form-control" size="35" required /></p>
|
||||
|
||||
<p><label for="completions"><?php echo T_("The number of completions to stop calling at"); ?>: </label>
|
||||
<input type="number" name="completions" id="completions" class="form-control" size="6" maxlength="6" style="width:8em;" required /></p>
|
||||
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
|
||||
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
|
||||
|
||||
<p><input type="submit" name="add_quota" value="<?php print(T_("Add quota")); ?>" class="btn btn-primary fa"/></p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
print "</div>";
|
||||
|
||||
print "<div class='col-sm-6 panel-body'><h3>" . T_("Code values for this question") . ":</h3>";
|
||||
|
||||
$qid = explode("X", $sgqa);
|
||||
$qid = $qid[2];
|
||||
|
||||
$sql = "SELECT CONCAT('<b class=\'fa\'> ', l.code , '</b>')as code,l.answer as title
|
||||
FROM `" . LIME_PREFIX . "answers` as l
|
||||
WHERE l.qid = '$qid'";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!isset($rs) || empty($rs))
|
||||
print "<p class='well text-info'>" . T_("No labels defined for this question") ."</p>";
|
||||
else
|
||||
xhtml_table($rs,array('code','title'),array(T_("Code value"), T_("Description")));
|
||||
|
||||
|
||||
print "</div>";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Set quota's for answered questions
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008,2009
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
/**
|
||||
* Limesurvey functions
|
||||
*/
|
||||
include("../functions/functions.limesurvey.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']) && isset($_GET['completions']) && isset($_GET['sample_import_id']) && isset($_GET['comparison']))
|
||||
{
|
||||
//need to add quota
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$value = $db->quote($_GET['value']);
|
||||
$completions = $db->quote($_GET['completions']);
|
||||
$sgqa = $db->quote($_GET['sgqa']);
|
||||
$comparison = $db->quote($_GET['comparison']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample_quota(questionnaire_id, sample_import_id, lime_sgqa,value,completions,comparison)
|
||||
VALUES ($questionnaire_id, $sample_import_id, $sgqa, $value, $completions, $comparison)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//Make sure to calculate on the spot
|
||||
update_quotas($questionnaire_id);
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_sample_quota_id']))
|
||||
{
|
||||
//need to remove quota
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$questionnaire_sample_quota_id = bigintval($_GET['questionnaire_sample_quota_id']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_sample_quota
|
||||
WHERE questionnaire_sample_quota_id = '$questionnaire_sample_quota_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Quota management"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Questionnaire") . ": </h3>";
|
||||
|
||||
$sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1";
|
||||
display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline pull-left ");
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT s.sample_import_id as value,s.description, CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM sample_import as s, questionnaire_sample as q
|
||||
WHERE q.questionnaire_id = $questionnaire_id
|
||||
AND q.sample_import_id = s.sample_import_id";
|
||||
$s = $db->GetAll($sql);
|
||||
if (!empty($s)){
|
||||
|
||||
print "<h3 class='form-inline pull-left'>   " . T_("Sample") . ":  </h3>";
|
||||
display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left");
|
||||
|
||||
} else {
|
||||
print "<div class='clearfix'></div><div class='well text-info'>" . T_("No samples assigned to this questionnaire.") . "</div>";
|
||||
|
||||
}
|
||||
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sample_import_id != false)
|
||||
{
|
||||
print "<h2>" . T_("Current quotas") . ":</h2>";//(click to delete)
|
||||
|
||||
$sql = "SELECT questionnaire_sample_quota_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison
|
||||
FROM questionnaire_sample_quota as qsq, questionnaire as q
|
||||
WHERE qsq.questionnaire_id = '$questionnaire_id'
|
||||
AND qsq.sample_import_id = '$sample_import_id'
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (empty($r))
|
||||
{
|
||||
print "<p class='well text-info'>" . T_("Currently no quotas") . "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($r as $v)
|
||||
{
|
||||
print "<div><a href='?questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id&questionnaire_sample_quota_id={$v['questionnaire_sample_quota_id']}'>" . T_("Stop calling this sample when:") . " {$v['lime_sgqa']} {$v['comparison']} {$v['value']} " . T_("for") . ": {$v['completions']} " . T_("completions") ."</a> - ";
|
||||
|
||||
if ($v['quota_reached'] == 1)
|
||||
print T_("Quota reached");
|
||||
else
|
||||
print T_("Quota not yet reached");
|
||||
|
||||
print " - " . T_("Current completions: ") . limesurvey_quota_completions($v['lime_sgqa'],$v['lime_sid'],$questionnaire_id,$sample_import_id,$v['value'],$v['comparison']);
|
||||
|
||||
print "</div>";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "<h3 class=' '>" . T_("Select a question for the quota") . "</h3>";
|
||||
|
||||
$sql = "SELECT lime_sid
|
||||
FROM questionnaire
|
||||
WHERE questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$r = $db->GetRow($sql);
|
||||
|
||||
$lime_sid = $r['lime_sid'];
|
||||
|
||||
$sgqa = false;
|
||||
if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa'];
|
||||
|
||||
$sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value,
|
||||
CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ': ', lq.question) END as description,
|
||||
CASE WHEN CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `" . LIME_PREFIX . "questions` AS lq
|
||||
LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid )
|
||||
JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid)
|
||||
WHERE lq.sid = '$lime_sid'
|
||||
ORDER BY CASE WHEN lq2.question_order IS NULL THEN lq.question_order ELSE lq2.question_order + (lq.question_order / 1000) END ASC";
|
||||
|
||||
display_chooser($db->GetAll($sql),"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-group");
|
||||
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sgqa != false)
|
||||
{
|
||||
|
||||
print "<div class='col-sm-6 panel-body'><h3>" . T_("Enter the details for creating the quota:") . "</h3>";
|
||||
|
||||
?>
|
||||
<form action="" method="get" class="form-inline form-group">
|
||||
|
||||
<p><label for="comparison"><?php echo T_("The type of comparison"); ?>: </label>
|
||||
<select name="comparison" class='form-control' id="comparison">
|
||||
<option value="LIKE">LIKE</option>
|
||||
<option value="NOT LIKE">NOT LIKE</option>
|
||||
<option value="=">=</option><option value="!=">!=</option>
|
||||
<option value="<"><</option>
|
||||
<option value=">">></option>
|
||||
<option value="<="><=</option>
|
||||
<option value=">=">>=</option></select></p>
|
||||
|
||||
<p><label for="value"><?php echo T_("The code value to compare"); ?>: </label>
|
||||
<input type="text" name="value" id="value" class="form-control" size="35" required /></p>
|
||||
|
||||
<p><label for="completions"><?php echo T_("The number of completions to stop calling at"); ?>: </label>
|
||||
<input type="number" name="completions" id="completions" class="form-control" size="6" maxlength="6" style="width:8em;" required /></p>
|
||||
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
|
||||
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
|
||||
|
||||
<p><input type="submit" name="add_quota" value="<?php print(T_("Add quota")); ?>" class="btn btn-primary fa"/></p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
print "</div>";
|
||||
|
||||
print "<div class='col-sm-6 panel-body'><h3>" . T_("Code values for this question") . ":</h3>";
|
||||
|
||||
$qid = explode("X", $sgqa);
|
||||
$qid = $qid[2];
|
||||
|
||||
$sql = "SELECT CONCAT('<b class=\'fa\'> ', l.code , '</b>')as code,l.answer as title
|
||||
FROM `" . LIME_PREFIX . "answers` as l
|
||||
WHERE l.qid = '$qid'";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
if (!isset($rs) || empty($rs))
|
||||
print "<p class='well text-info'>" . T_("No labels defined for this question") ."</p>";
|
||||
else
|
||||
xhtml_table($rs,array('code','title'),array(T_("Code value"), T_("Description")));
|
||||
|
||||
|
||||
print "</div>";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
@@ -106,7 +106,7 @@ if (isset($_POST['submit']))
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Quota report"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/font-awesome-4.3.0/css/font-awesome.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/iCheck/icheck.min.js","../js/window.js"));
|
||||
xhtml_head(T_("Quota report"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/font-awesome/css/font-awesome.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/bootstrap/js/bootstrap.min.js","../include/iCheck/icheck.min.js","../js/window.js"));
|
||||
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Select a questionnaire") . ": </h3>";
|
||||
|
||||
@@ -310,4 +310,4 @@ $('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -284,7 +284,7 @@ if (isset($_GET['qsqri']) & isset($_GET['edit']))
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Quota row management"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../include/font-awesome-4.3.0/css/font-awesome.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../include/iCheck/icheck.min.js","../js/window.js"));
|
||||
xhtml_head(T_("Quota row management"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../include/font-awesome/css/font-awesome.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/bootstrap/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../include/iCheck/icheck.min.js","../js/window.js"));
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Questionnaire") . ": </h3>";
|
||||
|
||||
$sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
@@ -623,4 +623,4 @@ $('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
increaseArea: '30%'
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -181,7 +181,7 @@ function sample_call_attempt_report($questionnaire_id = false, $sample_id = fals
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Sample call attempt"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
xhtml_head(T_("Sample call attempt"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
|
||||
print "<h3 class='form-inline pull-left'>" . T_("Please select a questionnaire") . " </h3>";
|
||||
$questionnaire_id = false;
|
||||
|
||||
1012
admin/samplelist.php
1012
admin/samplelist.php
File diff suppressed because it is too large
Load Diff
@@ -1,205 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* Select and search within a sample to see what case(s) is/are assigned to a sample record
|
||||
* and if so to look at them, otherwise give the option to remove a sample record
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome-4.3.0/css/font-awesome.css",
|
||||
/* "../include/bootgrid/jquery.bootgrid.css", */
|
||||
"../include/bs-data-table/css/jquery.bdt.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
/* "../include/bootgrid/jquery.bootgrid.min.js", */
|
||||
);
|
||||
$js_foot = array(
|
||||
|
||||
"../include/bs-data-table/js/vendor/jquery.sortelements.js",
|
||||
"../include/bs-data-table/js/jquery.bdt.js",
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
$subtitle = T_("Search within this sample");
|
||||
|
||||
xhtml_head(T_("Search the sample"),true,$css,$js_head);
|
||||
|
||||
?>
|
||||
<div class="modal fade delete-confirm" id="delete-confirm" tabindex="-1" role="dialog" aria-labelledby="delete-confirm" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title text-danger " ><?php echo T_("WARNING !");?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php echo T_("Are you shure you want to delete") . " " . T_("Sample ID") . " <b class='text-danger'>" . "</b>?";?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><?php echo T_("NOOOO...");?></button>
|
||||
<a class="btn btn-danger" href=" "><?php echo T_("Yes"),", ",T_("Delete");?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
$sql = "SELECT sample_import_id as value,description, CASE WHEN sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM sample_import";
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if(!empty($r))
|
||||
|
||||
print "<div class=' form-inline form-group col-md-6'><h4 class='control-label form-group col-sm-6 text-right'>" . T_("Select sample ") . " </h4>";
|
||||
display_chooser($r,"sample_import_id","sample_import_id",true,false,true,false);
|
||||
|
||||
print "</div>";
|
||||
|
||||
if (isset($_GET['sample_id']))
|
||||
{
|
||||
//need to remove this sample record from the sample
|
||||
|
||||
$sample_id = bigintval($_GET['sample_id']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM sample_var
|
||||
WHERE sample_id = '$sample_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM sample
|
||||
WHERE sample_id = '$sample_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
|
||||
print "<div class='alert alert-danger pull-left form-group col-sm-6' role='alert'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p>" . T_("Sample ID") . " <b>" . $sample_id . "</b> " . T_("Deleted") . ".</p></div>";
|
||||
}
|
||||
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sample_import_id != false)
|
||||
{
|
||||
$sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN
|
||||
CONCAT(' <a href=\'\' data-toggle=\'modal\' data-target=\'.delete-confirm\' data-href=\'?sample_import_id=$sample_import_id&sample_id=', sv.sample_id ,'\' data-sample_id=\' ', sv.sample_id ,' \' class=\'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Delete sample record") . " ', sv.sample_id ,'\' class=\'fa fa-2x fa-trash-o text-danger\'></i></a> ')
|
||||
ELSE CONCAT('<a href=\'supervisor.php?case_id=', c.case_id , '\' data-toggle=\'tooltip\' title=\'" . TQ_("Assigned to case ID :") . " ', c.case_id , '\'><b>', c.case_id ,'</b></a>')
|
||||
END as link
|
||||
FROM sample_var AS sv
|
||||
JOIN (sample as s) ON (s.import_id = '$sample_import_id' and sv.sample_id = s.sample_id)
|
||||
LEFT JOIN (`case` AS c, questionnaire AS q) ON ( c.sample_id = sv.sample_id AND q.questionnaire_id = c.questionnaire_id )
|
||||
GROUP BY s.sample_id, c.case_id";
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if ($r) {
|
||||
|
||||
|
||||
$fnames = array("sample_id");
|
||||
$fdesc = array(T_("Sample id"));
|
||||
|
||||
$fnames[] = "link";
|
||||
$fdesc[] = T_("Case ID");
|
||||
|
||||
$sql = "SELECT var,var_id
|
||||
FROM sample_import_var_restrict
|
||||
WHERE sample_import_id = $sample_import_id
|
||||
ORDER by var ASC";
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
foreach($rs as $rsw)
|
||||
{
|
||||
$fnames[] = $rsw['var_id'];
|
||||
$fdesc[] = $rsw['var'];
|
||||
}
|
||||
foreach($r as &$rw)
|
||||
{
|
||||
$sql = "SELECT var_id,val
|
||||
FROM sample_var
|
||||
WHERE sample_id = {$rw['sample_id']}";
|
||||
$rs = $db->GetAll($sql);
|
||||
foreach($rs as $rsw){
|
||||
$rw[$rsw['var_id']] = $rsw['val'];
|
||||
}
|
||||
}
|
||||
|
||||
print "<div class='form-group'>";
|
||||
xhtml_table($r,$fnames,$fdesc,"tclass",false,false,"bs-table");
|
||||
print "</div>";
|
||||
}
|
||||
else print "<div class='alert alert-info col-sm-6 ' role='alert'><h4>" . T_("There's no data in this sample.") . "</h4></div>";
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('#bs-table').bdt();
|
||||
/* $('#bs-table').bootgrid({
|
||||
ajax: true,
|
||||
post: "$sample_import_id",
|
||||
url: "?sample_import_id=\"$sample_import_id\"",
|
||||
}); */
|
||||
|
||||
$('#delete-confirm').on('show.bs.modal', function (event) {
|
||||
var a = $(event.relatedTarget)
|
||||
var href = a.data('href')
|
||||
var sample_id =a.data('sample_id')
|
||||
var modal = $(this)
|
||||
modal.find('.modal-body p b').text( +sample_id )
|
||||
modal.find('.modal-footer a').attr('href', href)
|
||||
})
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Select and search within a sample to see what case(s) is/are assigned to a sample record
|
||||
* and if so to look at them, otherwise give the option to remove a sample record
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
"../include/bootstrap/css/bootstrap-theme.min.css",
|
||||
"../include/font-awesome/css/font-awesome.css",
|
||||
/* "../include/bootgrid/jquery.bootgrid.css", */
|
||||
"../include/bs-data-table/css/jquery.bdt.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
/* "../include/bootgrid/jquery.bootgrid.min.js", */
|
||||
);
|
||||
$js_foot = array(
|
||||
|
||||
"../include/bs-data-table/js/vendor/jquery.sortelements.js",
|
||||
"../include/bs-data-table/js/jquery.bdt.js",
|
||||
"../js/window.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
|
||||
$subtitle = T_("Search within this sample");
|
||||
|
||||
xhtml_head(T_("Search the sample"),true,$css,$js_head);
|
||||
|
||||
?>
|
||||
<div class="modal fade delete-confirm" id="delete-confirm" tabindex="-1" role="dialog" aria-labelledby="delete-confirm" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title text-danger " ><?php echo T_("WARNING !");?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php echo T_("Are you shure you want to delete") . " " . T_("Sample ID") . " <b class='text-danger'>" . "</b>?";?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><?php echo T_("NOOOO...");?></button>
|
||||
<a class="btn btn-danger" href=" "><?php echo T_("Yes"),", ",T_("Delete");?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i> " . T_("Go back") . "</a>";
|
||||
|
||||
$sql = "SELECT sample_import_id as value,description, CASE WHEN sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM sample_import";
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if(!empty($r))
|
||||
|
||||
print "<div class=' form-inline form-group col-md-6'><h4 class='control-label form-group col-sm-6 text-right'>" . T_("Select sample ") . " </h4>";
|
||||
display_chooser($r,"sample_import_id","sample_import_id",true,false,true,false);
|
||||
|
||||
print "</div>";
|
||||
|
||||
if (isset($_GET['sample_id']))
|
||||
{
|
||||
//need to remove this sample record from the sample
|
||||
|
||||
$sample_id = bigintval($_GET['sample_id']);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM sample_var
|
||||
WHERE sample_id = '$sample_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM sample
|
||||
WHERE sample_id = '$sample_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
|
||||
print "<div class='alert alert-danger pull-left form-group col-sm-6' role='alert'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p>" . T_("Sample ID") . " <b>" . $sample_id . "</b> " . T_("Deleted") . ".</p></div>";
|
||||
}
|
||||
|
||||
print "<div class='clearfix'></div>";
|
||||
|
||||
if ($sample_import_id != false)
|
||||
{
|
||||
$sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN
|
||||
CONCAT(' <a href=\'\' data-toggle=\'modal\' data-target=\'.delete-confirm\' data-href=\'?sample_import_id=$sample_import_id&sample_id=', sv.sample_id ,'\' data-sample_id=\' ', sv.sample_id ,' \' class=\'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Delete sample record") . " ', sv.sample_id ,'\' class=\'fa fa-2x fa-trash-o text-danger\'></i></a> ')
|
||||
ELSE CONCAT('<a href=\'supervisor.php?case_id=', c.case_id , '\' data-toggle=\'tooltip\' title=\'" . TQ_("Assigned to case ID :") . " ', c.case_id , '\'><b>', c.case_id ,'</b></a>')
|
||||
END as link
|
||||
FROM sample_var AS sv
|
||||
JOIN (sample as s) ON (s.import_id = '$sample_import_id' and sv.sample_id = s.sample_id)
|
||||
LEFT JOIN (`case` AS c, questionnaire AS q) ON ( c.sample_id = sv.sample_id AND q.questionnaire_id = c.questionnaire_id )
|
||||
GROUP BY s.sample_id, c.case_id";
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if ($r) {
|
||||
|
||||
|
||||
$fnames = array("sample_id");
|
||||
$fdesc = array(T_("Sample id"));
|
||||
|
||||
$fnames[] = "link";
|
||||
$fdesc[] = T_("Case ID");
|
||||
|
||||
$sql = "SELECT var,var_id
|
||||
FROM sample_import_var_restrict
|
||||
WHERE sample_import_id = $sample_import_id
|
||||
ORDER by var ASC";
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
foreach($rs as $rsw)
|
||||
{
|
||||
$fnames[] = $rsw['var_id'];
|
||||
$fdesc[] = $rsw['var'];
|
||||
}
|
||||
foreach($r as &$rw)
|
||||
{
|
||||
$sql = "SELECT var_id,val
|
||||
FROM sample_var
|
||||
WHERE sample_id = {$rw['sample_id']}";
|
||||
$rs = $db->GetAll($sql);
|
||||
foreach($rs as $rsw){
|
||||
$rw[$rsw['var_id']] = $rsw['val'];
|
||||
}
|
||||
}
|
||||
|
||||
print "<div class='form-group'>";
|
||||
xhtml_table($r,$fnames,$fdesc,"tclass",false,false,"bs-table");
|
||||
print "</div>";
|
||||
}
|
||||
else print "<div class='alert alert-info col-sm-6 ' role='alert'><h4>" . T_("There's no data in this sample.") . "</h4></div>";
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('#bs-table').bdt();
|
||||
/* $('#bs-table').bootgrid({
|
||||
ajax: true,
|
||||
post: "$sample_import_id",
|
||||
url: "?sample_import_id=\"$sample_import_id\"",
|
||||
}); */
|
||||
|
||||
$('#delete-confirm').on('show.bs.modal', function (event) {
|
||||
var a = $(event.relatedTarget)
|
||||
var href = a.data('href')
|
||||
var sample_id =a.data('sample_id')
|
||||
var modal = $(this)
|
||||
modal.find('.modal-body p b').text( +sample_id )
|
||||
modal.find('.modal-footer a').attr('href', href)
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,176 +1,176 @@
|
||||
<?php /**
|
||||
* List and edit reports on shifts
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
xhtml_head(T_("Shift reports"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
print "<h3>" . T_("Please select a questionnaire") . "</h3>";
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
display_questionnaire_chooser($questionnaire_id ,false,"form-inline clearfix", "form-control");
|
||||
|
||||
if ($questionnaire_id)
|
||||
{
|
||||
print "<h3>" . T_("Please select a shift") . "</h3>";
|
||||
|
||||
$shift_id = false;
|
||||
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
||||
|
||||
//get shifts for this questionnaire in operator time
|
||||
$sql = "SELECT s.shift_id as value, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."'), ' - ', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT ."')) as description,
|
||||
CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `shift` as s, operator as o
|
||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||
AND o.operator_id = '$operator_id'
|
||||
ORDER BY s.start ASC";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (!empty($r))
|
||||
display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");
|
||||
|
||||
if ($shift_id)
|
||||
{
|
||||
print "<h3>" . T_("Reports for this shift") . "</h3>";
|
||||
|
||||
//list current reports with a link to edit
|
||||
$sql = "SELECT s.report,o.firstName,DATE_FORMAT(CONVERT_TZ(s.datetime,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."') as d,
|
||||
CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&shift_id=$shift_id&shift_report_id=', s.shift_report_id, '\'>". TQ_("Edit") . "</a>') as link
|
||||
FROM shift_report as s, operator as o
|
||||
WHERE s.operator_id = o.operator_id
|
||||
AND s.shift_id = '$shift_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (!empty($r))
|
||||
xhtml_table($r,array("firstName", "d", "report","link"),array(T_("Operator"),T_("Date"),T_("Report"),T_("Edit")),"tclass");
|
||||
|
||||
//link to create a new report
|
||||
print "<p><a href='?questionnaire_id=$questionnaire_id&shift_id=$shift_id&createnewreport=yes'>" . T_("Create new report for this shift") . "</a></p>";
|
||||
|
||||
|
||||
if (isset($_GET['createnewreport']))
|
||||
{
|
||||
//create a new report
|
||||
print "<h3>" . T_("Enter report for this shift") . "</h3>";
|
||||
print "<form action='?' method='get'><p><textarea name='report' id='report' rows='15' cols='80'></textarea></p>";
|
||||
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
||||
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
||||
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Add report") . "\"/>";
|
||||
print "</p></form>";
|
||||
}
|
||||
else if (isset($_GET['report']))
|
||||
{
|
||||
//add report to database
|
||||
$report = $db->qstr($_GET['report']);
|
||||
|
||||
$sql = "INSERT INTO shift_report (shift_id,operator_id,datetime,report,shift_report_id)
|
||||
VALUES ('$shift_id','$operator_id',CONVERT_TZ(NOW(),'System','UTC'),$report,NULL)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
else if (isset($_GET['shift_report_id']))
|
||||
{
|
||||
$shift_report_id = bigintval($_GET['shift_report_id']);
|
||||
|
||||
if (isset($_GET['ereport']))
|
||||
{
|
||||
//edit report
|
||||
$report = $db->qstr($_GET['ereport']);
|
||||
|
||||
$sql = "UPDATE shift_report
|
||||
SET operator_id = '$operator_id', datetime = CONVERT_TZ(NOW(),'System','UTC'), report = $report
|
||||
WHERE shift_report_id = '$shift_report_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
$sql = "SELECT report
|
||||
FROM shift_report
|
||||
WHERE shift_report_id = '$shift_report_id'";
|
||||
|
||||
$r = $db->GetRow($sql);
|
||||
if (empty($r))
|
||||
{
|
||||
print "<h3>" . T_("This report does not exist in the database") . "</h3>";
|
||||
}
|
||||
else
|
||||
{
|
||||
//edit report
|
||||
print "<h3>" . T_("Edit report for this shift") . "</h3>";
|
||||
print "<form action='?' method='get'><p><textarea name='ereport' id='ereport' rows='15' cols='80'>{$r['report']}</textarea></p>";
|
||||
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
||||
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
||||
print "<input type='hidden' name='shift_report_id' id='shift_report_id' value='$shift_report_id'/>";
|
||||
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Modify report") . "\"/>";
|
||||
print "</p></form>";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<?php /**
|
||||
* List and edit reports on shifts
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Operator functions
|
||||
*/
|
||||
include("../functions/functions.operator.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
xhtml_head(T_("Shift reports"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||
|
||||
$operator_id = get_operator_id();
|
||||
|
||||
print "<h3>" . T_("Please select a questionnaire") . "</h3>";
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
display_questionnaire_chooser($questionnaire_id ,false,"form-inline clearfix", "form-control");
|
||||
|
||||
if ($questionnaire_id)
|
||||
{
|
||||
print "<h3>" . T_("Please select a shift") . "</h3>";
|
||||
|
||||
$shift_id = false;
|
||||
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
|
||||
|
||||
//get shifts for this questionnaire in operator time
|
||||
$sql = "SELECT s.shift_id as value, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."'), ' - ', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT ."')) as description,
|
||||
CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM `shift` as s, operator as o
|
||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||
AND o.operator_id = '$operator_id'
|
||||
ORDER BY s.start ASC";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (!empty($r))
|
||||
display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");
|
||||
|
||||
if ($shift_id)
|
||||
{
|
||||
print "<h3>" . T_("Reports for this shift") . "</h3>";
|
||||
|
||||
//list current reports with a link to edit
|
||||
$sql = "SELECT s.report,o.firstName,DATE_FORMAT(CONVERT_TZ(s.datetime,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."') as d,
|
||||
CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&shift_id=$shift_id&shift_report_id=', s.shift_report_id, '\'>". TQ_("Edit") . "</a>') as link
|
||||
FROM shift_report as s, operator as o
|
||||
WHERE s.operator_id = o.operator_id
|
||||
AND s.shift_id = '$shift_id'";
|
||||
|
||||
$r = $db->GetAll($sql);
|
||||
|
||||
if (!empty($r))
|
||||
xhtml_table($r,array("firstName", "d", "report","link"),array(T_("Operator"),T_("Date"),T_("Report"),T_("Edit")),"tclass");
|
||||
|
||||
//link to create a new report
|
||||
print "<p><a href='?questionnaire_id=$questionnaire_id&shift_id=$shift_id&createnewreport=yes'>" . T_("Create new report for this shift") . "</a></p>";
|
||||
|
||||
|
||||
if (isset($_GET['createnewreport']))
|
||||
{
|
||||
//create a new report
|
||||
print "<h3>" . T_("Enter report for this shift") . "</h3>";
|
||||
print "<form action='?' method='get'><p><textarea name='report' id='report' rows='15' cols='80'></textarea></p>";
|
||||
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
||||
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
||||
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Add report") . "\"/>";
|
||||
print "</p></form>";
|
||||
}
|
||||
else if (isset($_GET['report']))
|
||||
{
|
||||
//add report to database
|
||||
$report = $db->qstr($_GET['report']);
|
||||
|
||||
$sql = "INSERT INTO shift_report (shift_id,operator_id,datetime,report,shift_report_id)
|
||||
VALUES ('$shift_id','$operator_id',CONVERT_TZ(NOW(),'System','UTC'),$report,NULL)";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
else if (isset($_GET['shift_report_id']))
|
||||
{
|
||||
$shift_report_id = bigintval($_GET['shift_report_id']);
|
||||
|
||||
if (isset($_GET['ereport']))
|
||||
{
|
||||
//edit report
|
||||
$report = $db->qstr($_GET['ereport']);
|
||||
|
||||
$sql = "UPDATE shift_report
|
||||
SET operator_id = '$operator_id', datetime = CONVERT_TZ(NOW(),'System','UTC'), report = $report
|
||||
WHERE shift_report_id = '$shift_report_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
$sql = "SELECT report
|
||||
FROM shift_report
|
||||
WHERE shift_report_id = '$shift_report_id'";
|
||||
|
||||
$r = $db->GetRow($sql);
|
||||
if (empty($r))
|
||||
{
|
||||
print "<h3>" . T_("This report does not exist in the database") . "</h3>";
|
||||
}
|
||||
else
|
||||
{
|
||||
//edit report
|
||||
print "<h3>" . T_("Edit report for this shift") . "</h3>";
|
||||
print "<form action='?' method='get'><p><textarea name='ereport' id='ereport' rows='15' cols='80'>{$r['report']}</textarea></p>";
|
||||
print "<p><input type='hidden' name='questionnaire_id' id='questionnaire_id' value='$questionnaire_id'/>";
|
||||
print "<input type='hidden' name='shift_id' id='shift_id' value='$shift_id'/>";
|
||||
print "<input type='hidden' name='shift_report_id' id='shift_report_id' value='$shift_report_id'/>";
|
||||
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Modify report") . "\"/>";
|
||||
print "</p></form>";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,159 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* Modify the standard shift template
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap-3.3.2/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../js/jquery-2.1.3.min.js",
|
||||
"../include/bootstrap-3.3.2/js/bootstrap.min.js",
|
||||
"../js/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM shift_template
|
||||
WHERE 1";
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO shift_template(day_of_week,start,end)
|
||||
VALUES ($val,$start,$end)";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Set default shift times"),true,$css,$js_head);//T_("Modify shift template"),array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
/**
|
||||
* 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
|
||||
FROM 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
|
||||
FROM 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>
|
||||
<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>
|
||||
<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);
|
||||
print " </td><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"08:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"20:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td></tr>";
|
||||
|
||||
?>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to shifts"); ?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
/**
|
||||
* Modify the standard shift template
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include ("../functions/functions.xhtml.php");
|
||||
|
||||
$css = array(
|
||||
"../include/bootstrap/css/bootstrap.min.css",
|
||||
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.min.css",
|
||||
"../css/custom.css"
|
||||
);
|
||||
$js_head = array(
|
||||
"../include/jquery/jquery.min.js",
|
||||
"../include/bootstrap/js/bootstrap.min.js",
|
||||
"../js/addrow-v2.js",
|
||||
);
|
||||
$js_foot = array(
|
||||
"../include/clockpicker/dist/bootstrap-clockpicker.js",
|
||||
"../js/custom.js"
|
||||
);
|
||||
|
||||
global $db;
|
||||
|
||||
$year="2008";
|
||||
$woy="1";
|
||||
|
||||
if (isset($_POST['day']))
|
||||
{
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM shift_template
|
||||
WHERE 1";
|
||||
$db->Execute($sql);
|
||||
|
||||
foreach($_POST['day'] as $key => $val)
|
||||
{
|
||||
if (!empty($val))
|
||||
{
|
||||
$val = intval($val);
|
||||
$key = intval($key);
|
||||
|
||||
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
|
||||
$end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO shift_template(day_of_week,start,end)
|
||||
VALUES ($val,$start,$end)";
|
||||
$db->Execute($sql);
|
||||
}
|
||||
}
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Set default shift times"),true,$css,$js_head);//T_("Modify shift template"),array("../css/shifts.css"),array("../js/addrow-v2.js")
|
||||
|
||||
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (empty($rs) || !$rs || empty($rs['t']))
|
||||
print "<div class='alert alert-danger'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
|
||||
/**
|
||||
* 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
|
||||
FROM 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
|
||||
FROM 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>
|
||||
<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>
|
||||
<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);
|
||||
print " </td><td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"start[$count]\" type=\"text\" value=\"08:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td>
|
||||
<td><div class=\"input-group clockpicker\"><input readonly class=\"form-control\" size=\"8\" maxlength=\"8\" name=\"end[$count]\" type=\"text\" value=\"20:00:00\"/><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-time fa\"></span></span></div></td></tr>";
|
||||
|
||||
?>
|
||||
</tbody></table>
|
||||
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/>
|
||||
<input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to shifts"); ?>"/>
|
||||
</form></div>
|
||||
<?php
|
||||
xhtml_foot($js_foot);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('.clockpicker').clockpicker({
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
|
||||
1152
admin/supervisor.php
1152
admin/supervisor.php
File diff suppressed because it is too large
Load Diff
@@ -1,91 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Set if supervisor chat should be enabled and required details
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
if (isset($_POST['update']))
|
||||
{
|
||||
set_setting("bosh_service",$_POST['bosh']);
|
||||
set_setting("supervisor_xmpp",$_POST['supervisor']);
|
||||
$enable = false;
|
||||
|
||||
if (isset($_POST['enable']))
|
||||
$enable = true;
|
||||
|
||||
set_setting("chat_enabled",$enable);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Supervisor chat"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js", "../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js"));
|
||||
|
||||
print "<p class='well'>" . T_("Allow interviewers to chat with the supervisor over XMPP (Jabber). Required is a BOSH enabled XMPP/Jabber server. The operators and the supervisor will need XMPP/Jabber accounts.") . "</p>";
|
||||
|
||||
$e = get_setting("chat_enabled");
|
||||
$checked = "checked='checked'";
|
||||
if (empty($e))
|
||||
$checked = "";
|
||||
?>
|
||||
<form action="" method="post" class="form-horizontal">
|
||||
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3" for="enable"><?php echo T_("Enable supervisor chat?"); ?>: </label>
|
||||
<input id='enable' type='checkbox' data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80" name='enable' val='1' <?php echo $checked; ?>/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3" for="bosh"><?php echo T_("Set BOSH URL"); ?>: </label>
|
||||
<input id='bosh' type='text' name='bosh' class="form-control pull-left" required size="60" value='<?php echo get_setting("bosh_service"); ?>'/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3" for="supervisor"><?php echo T_("Supervisor XMPP/Jabber id"); ?>: </label>
|
||||
<input id='supervisor' name='supervisor' type='text' class="form-control pull-left" required size="60" value='<?php echo get_setting("supervisor_xmpp"); ?>'/>
|
||||
</div>
|
||||
|
||||
<input type="submit" id="update" name="update" class="btn btn-primary col-sm-offset-3 col-sm-3" value="<?php echo T_("Update"); ?>"/>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Set if supervisor chat should be enabled and required details
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
if (isset($_POST['update']))
|
||||
{
|
||||
set_setting("bosh_service",$_POST['bosh']);
|
||||
set_setting("supervisor_xmpp",$_POST['supervisor']);
|
||||
$enable = false;
|
||||
|
||||
if (isset($_POST['enable']))
|
||||
$enable = true;
|
||||
|
||||
set_setting("chat_enabled",$enable);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Supervisor chat"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../include/jquery/jquery.min.js", "../include/bootstrap/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js"));
|
||||
|
||||
print "<p class='well'>" . T_("Allow interviewers to chat with the supervisor over XMPP (Jabber). Required is a BOSH enabled XMPP/Jabber server. The operators and the supervisor will need XMPP/Jabber accounts.") . "</p>";
|
||||
|
||||
$e = get_setting("chat_enabled");
|
||||
$checked = "checked='checked'";
|
||||
if (empty($e))
|
||||
$checked = "";
|
||||
?>
|
||||
<form action="" method="post" class="form-horizontal">
|
||||
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3" for="enable"><?php echo T_("Enable supervisor chat?"); ?>: </label>
|
||||
<input id='enable' type='checkbox' data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-width="80" name='enable' val='1' <?php echo $checked; ?>/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3" for="bosh"><?php echo T_("Set BOSH URL"); ?>: </label>
|
||||
<input id='bosh' type='text' name='bosh' class="form-control pull-left" required size="60" value='<?php echo get_setting("bosh_service"); ?>'/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label col-sm-3" for="supervisor"><?php echo T_("Supervisor XMPP/Jabber id"); ?>: </label>
|
||||
<input id='supervisor' name='supervisor' type='text' class="form-control pull-left" required size="60" value='<?php echo get_setting("supervisor_xmpp"); ?>'/>
|
||||
</div>
|
||||
|
||||
<input type="submit" id="update" name="update" class="btn btn-primary col-sm-offset-3 col-sm-3" value="<?php echo T_("Update"); ?>"/>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
@@ -1,110 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* Run the system wide case sorting process and monitor it's progress
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* Process
|
||||
*/
|
||||
include ("../functions/functions.process.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['watch']))
|
||||
{
|
||||
//start watching process
|
||||
start_process(realpath(dirname(__FILE__) . "/systemsortprocess.php"),2);
|
||||
}
|
||||
|
||||
$p = is_process_running(2);
|
||||
|
||||
|
||||
if ($p)
|
||||
{
|
||||
if (isset($_GET['kill']))
|
||||
{
|
||||
if ($_GET['kill'] == "force")
|
||||
end_process($p);
|
||||
else
|
||||
kill_process($p);
|
||||
|
||||
set_setting('systemsort',false);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,true);
|
||||
|
||||
print "<h2>" . T_("Running process:") . " $p</h2>";
|
||||
|
||||
if (is_process_killed($p))
|
||||
{
|
||||
print "<h3>" . T_("Kill signal sent: Please wait...") . "</h3>";
|
||||
print "<p><a href='?kill=force'>" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "</a></p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a></p>";
|
||||
}
|
||||
|
||||
$d = process_get_data($p);
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"));
|
||||
//print "<h2>" . T_("Monitor system wide case sorting") . "</h2>";
|
||||
print "<p><a href='?watch=watch'>" . T_("Click here to enable and begin system wide case sorting") . "</a></p>";
|
||||
print "<div class='well pull-right col-sm-4'><p>" . T_("System wide case sorting is periodically (via SYSTEM_SORT_MINUTES configuration directive) sorting cases on a system wide basis instead of finding the most appropriate case each time an operator requests a new case. This may increase performance where there are a large number of cases or complex quotas in place. If you are not experiencing any performance problems, it is not recommended to use this feature.") . "</p></div>";
|
||||
print "<h2>" . T_("Outcome of last process run (if any)") . "</h2>";
|
||||
$d = process_get_last_data(2);
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Run the system wide case sorting process and monitor it's progress
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* Process
|
||||
*/
|
||||
include ("../functions/functions.process.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['watch']))
|
||||
{
|
||||
//start watching process
|
||||
start_process(realpath(dirname(__FILE__) . "/systemsortprocess.php"),2);
|
||||
}
|
||||
|
||||
$p = is_process_running(2);
|
||||
|
||||
|
||||
if ($p)
|
||||
{
|
||||
if (isset($_GET['kill']))
|
||||
{
|
||||
if ($_GET['kill'] == "force")
|
||||
end_process($p);
|
||||
else
|
||||
kill_process($p);
|
||||
|
||||
set_setting('systemsort',false);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,true);
|
||||
|
||||
print "<h2>" . T_("Running process:") . " $p</h2>";
|
||||
|
||||
if (is_process_killed($p))
|
||||
{
|
||||
print "<h3>" . T_("Kill signal sent: Please wait...") . "</h3>";
|
||||
print "<p><a href='?kill=force'>" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "</a></p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a></p>";
|
||||
}
|
||||
|
||||
$d = process_get_data($p);
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"));
|
||||
//print "<h2>" . T_("Monitor system wide case sorting") . "</h2>";
|
||||
print "<p><a href='?watch=watch'>" . T_("Click here to enable and begin system wide case sorting") . "</a></p>";
|
||||
print "<div class='well pull-right col-sm-4'><p>" . T_("System wide case sorting is periodically (via SYSTEM_SORT_MINUTES configuration directive) sorting cases on a system wide basis instead of finding the most appropriate case each time an operator requests a new case. This may increase performance where there are a large number of cases or complex quotas in place. If you are not experiencing any performance problems, it is not recommended to use this feature.") . "</p></div>";
|
||||
print "<h2>" . T_("Outcome of last process run (if any)") . "</h2>";
|
||||
$d = process_get_last_data(2);
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,137 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* Modify the default timezones
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
if (isset($_POST['dtime_zone']))
|
||||
{
|
||||
set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['time_zone']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
|
||||
$tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO timezone_template(Time_zone_name)
|
||||
VALUES($tz)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['tz']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
|
||||
$tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "DELETE FROM timezone_template
|
||||
WHERE Time_zone_name = $tz";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Set Timezones"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); //,"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css"
|
||||
|
||||
$dtz = get_setting("DEFAULT_TIME_ZONE");
|
||||
|
||||
$sql = "SELECT name as value, name as description,
|
||||
CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM mysql.time_zone_name
|
||||
WHERE `Name` LIKE 'Europe%' OR `Name` LIKE 'Asia%' ";
|
||||
|
||||
$tzl = $db->GetAll($sql);
|
||||
|
||||
if (empty($tzl) || !$tzl)
|
||||
{
|
||||
print "<div class='alert alert-danger'>" . T_("Your database does not have timezones installed, please see here for details") . "<a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'> ... </a></div>";
|
||||
}
|
||||
|
||||
print "<div class='col-sm-4 '><h3 class=''>" . T_("Default Timezone: ") . " <b class='text-primary'>$dtz</b></h3>";//<div class='panel-body'>
|
||||
?>
|
||||
<form action="" method="post" class="form-horizontal">
|
||||
<?php display_chooser($tzl, 'dtime_zone', 'dtime_zone',false,false,false,true,false,true,"form-inline pull-left"); ?> 
|
||||
<input type="submit" class='btn btn-default fa' name="set_dtimezone" value="<?php echo T_("Set default timezone"); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
print "</div>";
|
||||
|
||||
print "<div class='col-sm-5'><h3>" . T_("Timezone list") . "</h3>";
|
||||
|
||||
$sql = "SELECT Time_zone_name, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,Time_zone_name),'". TIME_FORMAT ."') as time, CONCAT('<p class=\'text-center\' style=\'margin-bottom: 3px;\'><b class=\'label label-default\' style=\'font-size:85%;\'>', TIME_FORMAT(TIMEDIFF( CONVERT_TZ(NOW(),'$dtz','$dtz'),CONVERT_TZ(NOW(), Time_zone_name,'$dtz')),' %H : %i'), '</b></p>') AS timediff,
|
||||
CONCAT('<a href=\"?tz=', Time_zone_name ,'\" title=\"" . T_("Remove Timezone") . "\"><i class=\"fa fa-trash fa-lg text-danger\">" . T_("Remove") . "</i></a>') as link
|
||||
FROM timezone_template ORDER BY time ASC";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
xhtml_table($qs, array("Time_zone_name","timediff","time","link"), array(T_("Timezone name"),T_("Time diff to Default Time zone"),T_("Current time"),T_("Remove")));
|
||||
print "</div>";
|
||||
|
||||
print "<div class='col-sm-3'><h3 class=''>" . T_("Add a Timezone:") . " </h3>";
|
||||
?>
|
||||
<form action="" method="get" class="form-horizontal">
|
||||
<?php display_chooser($tzl, 'time_zone', 'time_zone',false,false,false,true,false,true,"form-inline pull-left"); ?> 
|
||||
<input type="submit" class='btn btn-default fa' name="add_timezone" value="<?php echo T_("Add Timezone"); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
print "</div>";
|
||||
|
||||
xhtml_foot();
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Modify the default timezones
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
if (isset($_POST['dtime_zone']))
|
||||
{
|
||||
set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['time_zone']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
|
||||
$tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "INSERT INTO timezone_template(Time_zone_name)
|
||||
VALUES($tz)";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['tz']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
|
||||
$tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc());
|
||||
|
||||
$sql = "DELETE FROM timezone_template
|
||||
WHERE Time_zone_name = $tz";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
xhtml_head(T_("Set Timezones"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); //,"../include/bootstrap/css/bootstrap-theme.min.css"
|
||||
|
||||
$dtz = get_setting("DEFAULT_TIME_ZONE");
|
||||
|
||||
$sql = "SELECT name as value, name as description,
|
||||
CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM mysql.time_zone_name
|
||||
WHERE `Name` LIKE 'Europe%' OR `Name` LIKE 'Asia%' ";
|
||||
|
||||
$tzl = $db->GetAll($sql);
|
||||
|
||||
if (empty($tzl) || !$tzl)
|
||||
{
|
||||
print "<div class='alert alert-danger'>" . T_("Your database does not have timezones installed, please see here for details") . "<a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'> ... </a></div>";
|
||||
}
|
||||
|
||||
print "<div class='col-sm-4 '><h3 class=''>" . T_("Default Timezone: ") . " <b class='text-primary'>$dtz</b></h3>";//<div class='panel-body'>
|
||||
?>
|
||||
<form action="" method="post" class="form-horizontal">
|
||||
<?php display_chooser($tzl, 'dtime_zone', 'dtime_zone',false,false,false,true,false,true,"form-inline pull-left"); ?> 
|
||||
<input type="submit" class='btn btn-default fa' name="set_dtimezone" value="<?php echo T_("Set default timezone"); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
print "</div>";
|
||||
|
||||
print "<div class='col-sm-5'><h3>" . T_("Timezone list") . "</h3>";
|
||||
|
||||
$sql = "SELECT Time_zone_name, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,Time_zone_name),'". TIME_FORMAT ."') as time, CONCAT('<p class=\'text-center\' style=\'margin-bottom: 3px;\'><b class=\'label label-default\' style=\'font-size:85%;\'>', TIME_FORMAT(TIMEDIFF( CONVERT_TZ(NOW(),'$dtz','$dtz'),CONVERT_TZ(NOW(), Time_zone_name,'$dtz')),' %H : %i'), '</b></p>') AS timediff,
|
||||
CONCAT('<a href=\"?tz=', Time_zone_name ,'\" title=\"" . T_("Remove Timezone") . "\"><i class=\"fa fa-trash fa-lg text-danger\">" . T_("Remove") . "</i></a>') as link
|
||||
FROM timezone_template ORDER BY time ASC";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
xhtml_table($qs, array("Time_zone_name","timediff","time","link"), array(T_("Timezone name"),T_("Time diff to Default Time zone"),T_("Current time"),T_("Remove")));
|
||||
print "</div>";
|
||||
|
||||
print "<div class='col-sm-3'><h3 class=''>" . T_("Add a Timezone:") . " </h3>";
|
||||
?>
|
||||
<form action="" method="get" class="form-horizontal">
|
||||
<?php display_chooser($tzl, 'time_zone', 'time_zone',false,false,false,true,false,true,"form-inline pull-left"); ?> 
|
||||
<input type="submit" class='btn btn-default fa' name="add_timezone" value="<?php echo T_("Add Timezone"); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
print "</div>";
|
||||
|
||||
xhtml_foot();
|
||||
?>
|
||||
|
||||
@@ -1,107 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Run the VoIP monitoring process and monitor it via the database
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* Process
|
||||
*/
|
||||
include ("../functions/functions.process.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['watch']))
|
||||
{
|
||||
//start watching process
|
||||
start_process(realpath(dirname(__FILE__) . "/process.php"));
|
||||
}
|
||||
|
||||
$p = is_process_running();
|
||||
|
||||
|
||||
if ($p)
|
||||
{
|
||||
if (isset($_GET['kill']))
|
||||
{
|
||||
if ($_GET['kill'] == "force")
|
||||
end_process($p);
|
||||
else
|
||||
kill_process($p);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),false,false,false,true);
|
||||
|
||||
print "<h2>" . T_("Running process:") . " $p</h2>";
|
||||
|
||||
if (is_process_killed($p))
|
||||
{
|
||||
print "<h3>" . T_("Kill signal sent: Please wait... </br>(Note: Process will be stalled until there is activity on the VoIP Server)") . "</h3>";
|
||||
print "<p>" . T_("Process is already closed (eg. server was rebooted)") . "<a href='?kill=force'>" . T_("click here to confirm") . "</a></p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p><a class='btn btn-default' href='?kill=kill'>" . T_("Kill the running process") . "</a> ". T_("(requires activity on the VoIP Server to take effect)") . "</p>";
|
||||
}
|
||||
|
||||
$d = process_get_data($p);
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"));
|
||||
//print "<h2>" . T_("Monitor VoIP Process") . "</h2>";
|
||||
print "<p><a class='btn btn-warning' href='?watch=watch'>" . T_("Click here to begin monitoring the VoIP Process") . "</a></p>";
|
||||
print "<h3>" . T_("Outcome of last process run (if any)") . "</h3>";
|
||||
$d = process_get_last_data();
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Run the VoIP monitoring process and monitor it via the database
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@deakin.edu.au>
|
||||
* @copyright Deakin University 2007,2008
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include ("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* Process
|
||||
*/
|
||||
include ("../functions/functions.process.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['watch']))
|
||||
{
|
||||
//start watching process
|
||||
start_process(realpath(dirname(__FILE__) . "/process.php"));
|
||||
}
|
||||
|
||||
$p = is_process_running();
|
||||
|
||||
|
||||
if ($p)
|
||||
{
|
||||
if (isset($_GET['kill']))
|
||||
{
|
||||
if ($_GET['kill'] == "force")
|
||||
end_process($p);
|
||||
else
|
||||
kill_process($p);
|
||||
}
|
||||
|
||||
xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,true);
|
||||
|
||||
print "<h2>" . T_("Running process:") . " $p</h2>";
|
||||
|
||||
if (is_process_killed($p))
|
||||
{
|
||||
print "<h3>" . T_("Kill signal sent: Please wait... </br>(Note: Process will be stalled until there is activity on the VoIP Server)") . "</h3>";
|
||||
print "<p>" . T_("Process is already closed (eg. server was rebooted)") . "<a href='?kill=force'>" . T_("click here to confirm") . "</a></p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p><a class='btn btn-default' href='?kill=kill'>" . T_("Kill the running process") . "</a> ". T_("(requires activity on the VoIP Server to take effect)") . "</p>";
|
||||
}
|
||||
|
||||
$d = process_get_data($p);
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"));
|
||||
//print "<h2>" . T_("Monitor VoIP Process") . "</h2>";
|
||||
print "<p><a class='btn btn-warning' href='?watch=watch'>" . T_("Click here to begin monitoring the VoIP Process") . "</a></p>";
|
||||
print "<h3>" . T_("Outcome of last process run (if any)") . "</h3>";
|
||||
$d = process_get_last_data();
|
||||
if ($d !== false)
|
||||
{
|
||||
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user