2
0
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:
Alex
2015-07-10 04:14:03 +03:00
parent afb159d217
commit 41cc3dbcb3
76 changed files with 8542 additions and 8544 deletions

View File

@@ -1,278 +1,278 @@
<?php <?php
/** /**
* Add and modify shifts by questionnaire * Add and modify shifts by questionnaire
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Operator functions * Operator functions
*/ */
include ("../functions/functions.operator.php"); include ("../functions/functions.operator.php");
/** /**
* Display functions * Display functions
*/ */
include ("../functions/functions.display.php"); include ("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
global $db; global $db;
/** /**
* Add shifts to the DB based on the shift_template table * 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['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['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($_POST['qid'])) $questionnaire_id = bigintval($_POST['qid']); else $questionnaire_id = false;
if (isset($_GET['year'])) $year = bigintval($_GET['year']); if (isset($_GET['year'])) $year = bigintval($_GET['year']);
if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']); if (isset($_GET['woy'])) $woy = bigintval($_GET['woy']);
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
$y = $db->GetRow("SELECT $year as y"); $y = $db->GetRow("SELECT $year as y");
$year = $y['y']; $year = $y['y'];
$y = $db->GetRow("SELECT $woy as y"); $y = $db->GetRow("SELECT $woy as y");
$woy = $y['y']; $woy = $y['y'];
$operator_id = get_operator_id(); $operator_id = get_operator_id();
if (!$operator_id) if (!$operator_id)
{ {
xhtml_head(T_("Add shifts")); xhtml_head(T_("Add shifts"));
print "<p>" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "</p>"; print "<p>" . T_("You must be an operator (as well as have administrator access) to add/edit shifts") . "</p>";
xhtml_foot(); xhtml_foot();
exit(); exit();
} }
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
//process //process
//update or delete existing shifts //update or delete existing shifts
foreach($_POST as $key => $val) foreach($_POST as $key => $val)
{ {
if (substr($key,0,5) == "start") if (substr($key,0,5) == "start")
{ {
$num = bigintval(substr($key,6)); $num = bigintval(substr($key,6));
if (isset($_POST["use_$num"])) if (isset($_POST["use_$num"]))
{ {
$sql = "UPDATE shift as s, operator as o $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'), 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') 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' WHERE o.operator_id = '$operator_id'
AND shift_id = '$num'"; AND shift_id = '$num'";
$db->Execute($sql); $db->Execute($sql);
} }
else else
{ {
$sql = "DELETE FROM shift $sql = "DELETE FROM shift
WHERE shift_id = '$num'"; WHERE shift_id = '$num'";
$db->Execute($sql); $db->Execute($sql);
} }
} }
} }
//insert new shifts //insert new shifts
foreach($_POST as $key => $val) foreach($_POST as $key => $val)
{ {
if (substr($key,0,7) == "NEW_use") if (substr($key,0,7) == "NEW_use")
{ {
if ($val == "on") if ($val == "on")
{ {
$num = bigintval(substr($key,8)); $num = bigintval(substr($key,8));
$sql = "INSERT INTO shift (shift_id,questionnaire_id,start,end) $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') 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 FROM operator
WHERE operator_id = '$operator_id'"; WHERE operator_id = '$operator_id'";
$db->Execute($sql); $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")); 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", //"../css/shifts.css",
/** /**
* Display warning if timezone data not installed * Display warning if timezone data not installed
* *
*/ */
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM','UTC') as t"; $sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM','UTC') as t";
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
if (empty($rs) || !$rs || empty($rs['t'])) 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>"; 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 years including current selected year
* display weeks of year including current selected week of 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 * 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 * when submitted, add checked shifts, and delete unchecked shifts if they exist
* *
* @todo Use javascript to add shifts if necessarry outside the template * @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 "<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 "<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>"; 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"); display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control");
print "</div><div class='panel-body'>"; print "</div><div class='panel-body'>";
if ($questionnaire_id != false) if ($questionnaire_id != false)
{ {
print "<h4>" . T_("Select year") . ":&emsp;&ensp;"; print "<h4>" . T_("Select year") . ":&emsp;&ensp;";
for ($i = $year - 1; $i < $year + 4; $i++) for ($i = $year - 1; $i < $year + 4; $i++)
{ {
if ($i == $year) if ($i == $year)
print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>"; print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>";
else else
print "<a href=\"?year=$i&amp;woy=$woy&amp;questionnaire_id=$questionnaire_id\"> $i </a> "; print "<a href=\"?year=$i&amp;woy=$woy&amp;questionnaire_id=$questionnaire_id\"> $i </a> ";
} }
print "</h4>"; print "</h4>";
print "<h4>" . T_("Select week") . ":&emsp;"; print "<h4>" . T_("Select week") . ":&emsp;";
for ($i = 1; $i <= 53; $i++) for ($i = 1; $i <= 53; $i++)
{ {
if ($i == $woy) if ($i == $woy)
print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>"; print "<span class='btn-lg btn btn-default'><b class='fa text-danger '>$i</b></span>";
else else
print "<a href=\"?woy=$i&amp;year=$year&amp;questionnaire_id=$questionnaire_id\"> $i </a> "; print "<a href=\"?woy=$i&amp;year=$year&amp;questionnaire_id=$questionnaire_id\"> $i </a> ";
} }
print "</h4>"; print "</h4>";
$sql = "SELECT shift_id, dt, dta,start,end $sql = "SELECT shift_id, dt, dta,start,end
FROM ( FROM (
( (
SELECT shift_id, DATE_FORMAT( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , '%W %d %m %Y' ) AS dt, 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, 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.start, 'UTC', o.Time_zone_name ) ) AS start,
TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end TIME( CONVERT_TZ( s.end, 'UTC', o.Time_zone_name ) ) AS end
FROM shift AS s, operator AS o FROM shift AS s, operator AS o
WHERE WEEK( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) , 3 ) = '$woy' 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 YEAR( CONVERT_TZ( s.start, 'UTC', o.Time_zone_name ) ) = '$year'
AND o.operator_id = '$operator_id' AND o.operator_id = '$operator_id'
AND s.questionnaire_id = '$questionnaire_id' AND s.questionnaire_id = '$questionnaire_id'
) )
UNION ( UNION (
SELECT NULL AS shift_id, 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, 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, STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) AS dta,
start,end start,end
FROM shift_template FROM shift_template
) )
) AS sb ) AS sb
GROUP BY dta,start,end"; GROUP BY dta,start,end";
$shifts = $db->GetAll($sql); $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, $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'), '%W') as dtd,
DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%d %m %Y') as dto, 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 day_of_week - 1 as value
FROM day_of_week FROM day_of_week
GROUP BY value"; GROUP BY value";
$daysofweek = $db->GetAll($sql); $daysofweek = $db->GetAll($sql);
translate_array($daysofweek,array("dtd")); translate_array($daysofweek,array("dtd"));
foreach($daysofweek as $key => $val) foreach($daysofweek as $key => $val)
$daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto']; $daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto'];
?> ?>
<form method="post" action="" class="panel-body"> <form method="post" action="" class="panel-body">
<table class="table-bordered table-condensed table-hover"> <table class="table-bordered table-condensed table-hover">
<?php <?php
print "<thead><tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th>&ensp;<th>" . T_("End") . "</th><th>" . T_("Use shift?") . "</th></tr></thead>"; print "<thead><tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th>&ensp;<th>" . T_("End") . "</th><th>" . T_("Use shift?") . "</th></tr></thead>";
$count = 1; $count = 1;
foreach($shifts as $shift) foreach($shifts as $shift)
{ {
$checked=""; $checked="";
$shift_id=""; $shift_id="";
$prefix=""; $prefix="";
if (!empty($shift['shift_id'])) if (!empty($shift['shift_id']))
{ {
$checked="checked=\"checked\""; $shift_id = $shift['shift_id']; $checked="checked=\"checked\""; $shift_id = $shift['shift_id'];
} }
else else
{ {
$shift_id = $count; $shift_id = $count;
$prefix = "NEW_"; $prefix = "NEW_";
} }
print "<tr><td>"; print "<tr><td>";
display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt'])); 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>"; 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++; $count++;
} }
?> ?>
<!--<tr><td/><td/><td/><td>Select all</td></tr>--> <!--<tr><td/><td/><td/><td>Select all</td></tr>-->
</table></br> </table></br>
<!--<p><input type="submit" name="addshift" value="Add Shift"/></p>--> <!--<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="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="year" value="<?php echo $year; ?>"/>
<input type="hidden" name="woy" value="<?php echo $woy; ?>"/> <input type="hidden" name="woy" value="<?php echo $woy; ?>"/>
<input type="hidden" name="qid" value="<?php echo $questionnaire_id; ?>"/> <input type="hidden" name="qid" value="<?php echo $questionnaire_id; ?>"/>
</form> </form>
<?php <?php
} }
print "</div>"; print "</div>";
xhtml_foot(); xhtml_foot();
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('.clockpicker').clockpicker({ $('.clockpicker').clockpicker({
autoclose: true autoclose: true
}); });
</script> </script>

View File

@@ -1,282 +1,282 @@
<?php <?php
/** /**
* Assign sample(s) to a questionnaire * Assign sample(s) to a questionnaire
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", "../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
"../js/window.js" "../js/window.js"
); );
$js_foot = array( $js_foot = array(
"../js/bootstrap-confirmation.js", "../js/bootstrap-confirmation.js",
"../js/custom.js" "../js/custom.js"
); );
global $db; global $db;
if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max'])) if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max']))
{ {
//need to add sample to questionnaire //need to add sample to questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sid = bigintval($_GET['sample']); $sid = bigintval($_GET['sample']);
$cm = bigintval($_GET['call_max']); $cm = bigintval($_GET['call_max']);
$cam = bigintval($_GET['call_attempt_max']); $cam = bigintval($_GET['call_attempt_max']);
$am = bigintval($_GET['answering_machine_messages']); $am = bigintval($_GET['answering_machine_messages']);
$selecttype = 0; $selecttype = 0;
if (isset($_GET['selecttype'])) $selecttype = 1; if (isset($_GET['selecttype'])) $selecttype = 1;
$an = 0; $an = 0;
if (isset($_GET['allownew'])) $an = 1; 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) $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')"; VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_POST['edit'])) if (isset($_POST['edit']))
{ {
//need to add sample to questionnaire //need to add sample to questionnaire
$questionnaire_id = bigintval($_POST['questionnaire_id']); $questionnaire_id = bigintval($_POST['questionnaire_id']);
$sid = bigintval($_POST['sample_import_id']); $sid = bigintval($_POST['sample_import_id']);
$cm = bigintval($_POST['call_max']); $cm = bigintval($_POST['call_max']);
$cam = bigintval($_POST['call_attempt_max']); $cam = bigintval($_POST['call_attempt_max']);
$am = bigintval($_POST['answering_machine_messages']); $am = bigintval($_POST['answering_machine_messages']);
$selecttype = 0; $selecttype = 0;
if (isset($_POST['selecttype'])) $selecttype = 1; if (isset($_POST['selecttype'])) $selecttype = 1;
$an = 0; $an = 0;
if (isset($_POST['allownew'])) $an = 1; if (isset($_POST['allownew'])) $an = 1;
$sql = "UPDATE questionnaire_sample $sql = "UPDATE questionnaire_sample
SET call_max = '$cm', SET call_max = '$cm',
call_attempt_max = '$cam', call_attempt_max = '$cam',
random_select = '$selecttype', random_select = '$selecttype',
answering_machine_messages = '$am', answering_machine_messages = '$am',
allow_new = '$an' allow_new = '$an'
WHERE questionnaire_id = '$questionnaire_id' WHERE questionnaire_id = '$questionnaire_id'
AND sample_import_id = '$sid'"; AND sample_import_id = '$sid'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
{ {
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sid = bigintval($_GET['rsid']); $sid = bigintval($_GET['rsid']);
if (isset($_GET['edit'])) if (isset($_GET['edit']))
{ {
$subtitle = T_("Edit assignment parameters"); $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") 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, $sql = "SELECT si.description as description,
qr.description as qdescription, qr.description as qdescription,
q.call_max, q.call_max,
q.call_attempt_max, q.call_attempt_max,
q.random_select, q.random_select,
q.answering_machine_messages, q.answering_machine_messages,
q.allow_new q.allow_new
FROM questionnaire_sample as q, sample_import as si, questionnaire as qr FROM questionnaire_sample as q, sample_import as si, questionnaire as qr
WHERE q.sample_import_id = si.sample_import_id WHERE q.sample_import_id = si.sample_import_id
AND q.questionnaire_id = '$questionnaire_id' AND q.questionnaire_id = '$questionnaire_id'
AND si.sample_import_id = '$sid' AND si.sample_import_id = '$sid'
AND qr.questionnaire_id = q.questionnaire_id"; AND qr.questionnaire_id = q.questionnaire_id";
$qs = $db->GetRow($sql); $qs = $db->GetRow($sql);
//print "<h1>" . T_("Edit sample details") . "<h1>"; //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>&emsp;" . T_("Go back") . "</a></p> print " <p><a href='?questionnaire_id=$questionnaire_id' class='btn btn-default '><i class='fa fa-chevron-left fa-lg text-primary'></i>&emsp;" . 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_("Questionnaire") . ": <span class='text-primary'>" . $qs['qdescription'] . "</span></h2>
<h2 class='col-sm-6'>" . T_("Sample") . ": <span class='text-primary'>" . $qs['description'] . "</span></h2> <h2 class='col-sm-6'>" . T_("Sample") . ": <span class='text-primary'>" . $qs['description'] . "</span></h2>
<div class='panel-body form-group'>"; <div class='panel-body form-group'>";
$allownew = $selected =""; $allownew = $selected ="";
if ($qs['random_select'] == 1) if ($qs['random_select'] == 1)
$selected = "checked=\"checked\""; $selected = "checked=\"checked\"";
if ($qs['allow_new'] == 1) if ($qs['allow_new'] == 1)
$allownew = "checked=\"checked\""; $allownew = "checked=\"checked\"";
?> ?>
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post" class="form-horizontal"> <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> <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> <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 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> <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> <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 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> <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> <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 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> <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> <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 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> <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/> <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="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="hidden" name="sample_import_id" value="<?php print($sid); ?>"/> <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>&emsp;<?php echo T_("Save changes");?></button></div> <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>&emsp;<?php echo T_("Save changes");?></button></div>
</form></div> </form></div>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
die(); die();
} }
else else
{ {
//need to remove rsid from questionnaire //need to remove rsid from questionnaire
$sql = "DELETE FROM questionnaire_sample $sql = "DELETE FROM questionnaire_sample
WHERE questionnaire_id = '$questionnaire_id' WHERE questionnaire_id = '$questionnaire_id'
AND sample_import_id = '$sid'"; AND sample_import_id = '$sid'";
$db->Execute($sql); $db->Execute($sql);
} }
} }
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
$subtitle = T_("List & Add Sample"); $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") 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>&emsp;" . T_("Go back") . "</a>"; 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>&emsp;" . T_("Go back") . "</a>";
print "<h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>"; print "<h3 class='col-sm-4 text-right'>" . T_("Select a questionnaire") . ":</h3>";
display_questionnaire_chooser($questionnaire_id,false, "pull-left", "form-control"); display_questionnaire_chooser($questionnaire_id,false, "pull-left", "form-control");
if ($questionnaire_id != false) if ($questionnaire_id != false)
{ {
print "<div class='clearfix '></div><div class='panel-body'> print "<div class='clearfix '></div><div class='panel-body'>
<h3 class='text-primary'>". T_("Samples selected for this questionnaire") .":</h3>"; <h3 class='text-primary'>". T_("Samples selected for this questionnaire") .":</h3>";
$sql = "SELECT si.description as description, $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_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.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.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.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, CASE WHEN q.allow_new = 0 THEN '". TQ_("No") ."' ELSE '".TQ_("Yes")."' END as allow_new,
CONCAT('<a href=\"?edit=edit&amp;questionnaire_id=$questionnaire_id&amp;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=\"?edit=edit&amp;questionnaire_id=$questionnaire_id&amp;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&amp;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 CONCAT('<a href=\'\' data-toggle=\'confirmation\' data-placement=\'top\' data-href=\"?questionnaire_id=$questionnaire_id&amp;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 FROM questionnaire_sample as q, sample_import as si
WHERE q.sample_import_id = si.sample_import_id WHERE q.sample_import_id = si.sample_import_id
AND q.questionnaire_id = '$questionnaire_id'"; AND q.questionnaire_id = '$questionnaire_id'";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
if (!empty($qs)) 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"))); 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 else
print "<div class='alert text-danger'><h4>". T_("No samples selected for this questionnaire") ."</h4></div>"; print "<div class='alert text-danger'><h4>". T_("No samples selected for this questionnaire") ."</h4></div>";
$sql = "SELECT si.sample_import_id,si.description $sql = "SELECT si.sample_import_id,si.description
FROM sample_import as si 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) 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 WHERE q.questionnaire_id is NULL
AND si.enabled = 1"; AND si.enabled = 1";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
print"</div>"; print"</div>";
if (!empty($qs)) if (!empty($qs))
{ {
print "<div class='clearfix '></div>"; print "<div class='clearfix '></div>";
print "<div class='panel-body form-group'><h3 class='text-primary'>" . T_("Add a sample to this questionnaire:") . "</h3>"; 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"> <form action="" method="get" class="form-horizontal">
<label for="sample" class="control-label col-sm-4"><?php echo T_("Select sample:");?></label> <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 " > <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/> <?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> <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> <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 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> <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> <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 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> <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> <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 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> <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> <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 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> <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/> <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);?>"/> <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>&emsp;<?php echo T_("Add sample");?></button></div> <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>&emsp;<?php echo T_("Add sample");?></button></div>
</form></div> </form></div>
<?php <?php
} }
} }
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('[data-toggle="confirmation"]').confirmation() $('[data-toggle="confirmation"]').confirmation()
</script> </script>

View File

@@ -1,313 +1,313 @@
<?php <?php
/** /**
* Assign availability groups to a questionnaire * Assign availability groups to a questionnaire
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
//"../include/font-awesome-4.3.0/css/font-awesome.css", //"../include/font-awesome/css/font-awesome.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
); );
$js_foot = array( $js_foot = array(
"../js/window.js", "../js/window.js",
//"../js/custom.js" //"../js/custom.js"
); );
global $db; global $db;
//block availability //block availability
if (isset($_GET['questionnaire_id']) && isset($_GET['av_availability_group'])) if (isset($_GET['questionnaire_id']) && isset($_GET['av_availability_group']))
{ {
//need to add availability_group to questionnaire //need to add availability_group to questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$availability_group = bigintval($_GET['av_availability_group']); $availability_group = bigintval($_GET['av_availability_group']);
$sql = "INSERT INTO questionnaire_availability(questionnaire_id,availability_group_id) $sql = "INSERT INTO questionnaire_availability(questionnaire_id,availability_group_id)
VALUES('$questionnaire_id','$availability_group')"; VALUES('$questionnaire_id','$availability_group')";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['questionnaire_id']) && isset($_GET['av_ravailability_group'])) if (isset($_GET['questionnaire_id']) && isset($_GET['av_ravailability_group']))
{ {
//need to remove rsid from questionnaire //need to remove rsid from questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$availability_group = bigintval($_GET['av_ravailability_group']); $availability_group = bigintval($_GET['av_ravailability_group']);
$sql = "DELETE FROM questionnaire_availability $sql = "DELETE FROM questionnaire_availability
WHERE questionnaire_id = '$questionnaire_id' WHERE questionnaire_id = '$questionnaire_id'
AND availability_group_id = '$availability_group'"; AND availability_group_id = '$availability_group'";
$db->Execute($sql); $db->Execute($sql);
} }
//block call_attempts //block call_attempts
if (isset($_GET['questionnaire_id']) && isset($_GET['ca_availability_group'])) if (isset($_GET['questionnaire_id']) && isset($_GET['ca_availability_group']))
{ {
//need to add availability_group to questionnaire //need to add availability_group to questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$availability_group = bigintval($_GET['ca_availability_group']); $availability_group = bigintval($_GET['ca_availability_group']);
$sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id) $sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id)
VALUES('$questionnaire_id','$availability_group')"; VALUES('$questionnaire_id','$availability_group')";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['questionnaire_id']) && isset($_GET['ca_ravailability_group'])) if (isset($_GET['questionnaire_id']) && isset($_GET['ca_ravailability_group']))
{ {
//need to remove rsid from questionnaire //need to remove rsid from questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$availability_group = bigintval($_GET['ca_ravailability_group']); $availability_group = bigintval($_GET['ca_ravailability_group']);
$sql = "DELETE FROM questionnaire_timeslot $sql = "DELETE FROM questionnaire_timeslot
WHERE questionnaire_id = '$questionnaire_id' WHERE questionnaire_id = '$questionnaire_id'
AND availability_group_id = '$availability_group'"; AND availability_group_id = '$availability_group'";
$db->Execute($sql); $db->Execute($sql);
} }
//block call_attempts by sample //block call_attempts by sample
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_availability_group'])) if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_availability_group']))
{ {
//need to add availability_group to questionnaire //need to add availability_group to questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sample_import_id = bigintval($_GET['sample_import_id']); $sample_import_id = bigintval($_GET['sample_import_id']);
$availability_group = bigintval($_GET['qs_availability_group']); $availability_group = bigintval($_GET['qs_availability_group']);
$sql = "INSERT INTO questionnaire_sample_timeslot (questionnaire_id,sample_import_id,availability_group_id) $sql = "INSERT INTO questionnaire_sample_timeslot (questionnaire_id,sample_import_id,availability_group_id)
VALUES('$questionnaire_id','$sample_import_id','$availability_group')"; VALUES('$questionnaire_id','$sample_import_id','$availability_group')";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_ravailability_group'])) if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_ravailability_group']))
{ {
//need to remove rsid from questionnaire //need to remove rsid from questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sample_import_id = bigintval($_GET['sample_import_id']); $sample_import_id = bigintval($_GET['sample_import_id']);
$availability_group = bigintval($_GET['qs_ravailability_group']); $availability_group = bigintval($_GET['qs_ravailability_group']);
$sql = "DELETE FROM questionnaire_sample_timeslot $sql = "DELETE FROM questionnaire_sample_timeslot
WHERE questionnaire_id = '$questionnaire_id' WHERE questionnaire_id = '$questionnaire_id'
AND sample_import_id = '$sample_import_id' AND sample_import_id = '$sample_import_id'
AND availability_group_id = '$availability_group'"; AND availability_group_id = '$availability_group'";
$db->Execute($sql); $db->Execute($sql);
} }
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sample_import_id = false; $sample_import_id = false;
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); 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") 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>"; 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"); display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control");
print "</div>"; print "</div>";
if ($questionnaire_id != false) if ($questionnaire_id != false)
{ {
//page questionnaireavailability.php //page questionnaireavailability.php
print "<div class=col-sm-4><h2>" . T_("Time slot groups") . "</h2>"; 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>"; 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&amp;av_ravailability_group=', a.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link $sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&amp;av_ravailability_group=', a.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
FROM questionnaire_availability as q, availability_group as a FROM questionnaire_availability as q, availability_group as a
WHERE q.availability_group_id = a.availability_group_id WHERE q.availability_group_id = a.availability_group_id
AND q.questionnaire_id = '$questionnaire_id'"; AND q.questionnaire_id = '$questionnaire_id'";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
print "</br></br></br><div class='panel-body'>"; print "</br></br></br><div class='panel-body'>";
if (empty($qs)) if (empty($qs))
{ {
print "<h4 class='alert text-danger'>" . T_("There are no time slots groups selected for this questionnaire") . "</h4>"; print "<h4 class='alert text-danger'>" . T_("There are no time slots groups selected for this questionnaire") . "</h4>";
} }
else else
{ {
print "<h4>" . T_("Time slots groups selected for this questionnaire") . "</h4>"; print "<h4>" . T_("Time slots groups selected for this questionnaire") . "</h4>";
xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover"); xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
} }
print "</div>"; print "</div>";
$sql = "SELECT si.availability_group_id,si.description $sql = "SELECT si.availability_group_id,si.description
FROM availability_group as si 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) 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"; WHERE q.questionnaire_id is NULL";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
if (!empty($qs)) if (!empty($qs))
{ {
print "<div class='panel-body'>"; print "<div class='panel-body'>";
//print "<h3>" . T_("Add time slot to this questionnaire:") . "</h3>"; //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'>"; 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) foreach($qs as $q)
{ {
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>"; print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
} }
print "</select></div> print "</select></div>
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/> <input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
&ensp;<input type='submit' class='btn btn-default' name='add_av_availability' value='" . T_("Add time slot group") . "'/> &ensp;<input type='submit' class='btn btn-default' name='add_av_availability' value='" . T_("Add time slot group") . "'/>
</form></div>"; </form></div>";
} }
print "</div>"; print "</div>";
//page questionnairecatimeslots.php //page questionnairecatimeslots.php
print "<div class=col-sm-4><h2>" . T_("Call attempt time slots") . "</h2>"; 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>"; 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&amp;ca_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link $sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&amp;ca_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
FROM questionnaire_timeslot as q, availability_group as a FROM questionnaire_timeslot as q, availability_group as a
WHERE q.availability_group_id = a.availability_group_id WHERE q.availability_group_id = a.availability_group_id
AND q.questionnaire_id = '$questionnaire_id'"; AND q.questionnaire_id = '$questionnaire_id'";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
print "</br><div class='panel-body'>"; print "</br><div class='panel-body'>";
if (empty($qs)) if (empty($qs))
{ {
print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire") . "</h4>"; print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire") . "</h4>";
} }
else else
{ {
print "<h4>" . T_("Call attempt time slots selected for this questionnaire") . "</h4>"; 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"); xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
} }
print "</div>"; print "</div>";
$sql = "SELECT si.availability_group_id,si.description $sql = "SELECT si.availability_group_id,si.description
FROM availability_group as si 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) 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"; WHERE q.questionnaire_id is NULL";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
if (!empty($qs)) if (!empty($qs))
{ {
print "<div class='panel-body'>"; print "<div class='panel-body'>";
//print "<h3>" . T_("Add a call attempt time slot to this questionnaire:") . "</h3>"; //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'>"; 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) foreach($qs as $q)
{ {
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>"; print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
} }
print "</select></div> print "</select></div>
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/> <input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
&ensp;<input type='submit' class='btn btn-default' name='add_ca_availability' value='" . TQ_("Add call attempt time slot") . "'/> &ensp;<input type='submit' class='btn btn-default' name='add_ca_availability' value='" . TQ_("Add call attempt time slot") . "'/>
</form></div>"; </form></div>";
} }
print "</div>"; print "</div>";
//page questionnairetimeslosample.php //page questionnairetimeslosample.php
print "<div class=col-sm-4><h2>" . T_("Call attempt time slots for sample") . "</h2>"; 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 "<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") . ":&ensp;</h3>"; print "<h3 class='pull-left'>" . T_("Sample") . ":&ensp;</h3>";
$sample_import_id = false; $sample_import_id = false;
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); 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"); display_sample_chooser($questionnaire_id,$sample_import_id,false, "form-inline", "form-control");
if ($sample_import_id !== false) if ($sample_import_id !== false)
{ {
$sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?sample_import_id=$sample_import_id&amp;questionnaire_id=$questionnaire_id&amp;qs_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link $sql = "SELECT q.availability_group_id,a.description as description, CONCAT('<a href=\'?sample_import_id=$sample_import_id&amp;questionnaire_id=$questionnaire_id&amp;qs_ravailability_group=', q.availability_group_id,'\' >" . T_("Click to unassign") . "</a>') as link
FROM questionnaire_sample_timeslot as q, availability_group as a FROM questionnaire_sample_timeslot as q, availability_group as a
WHERE q.availability_group_id = a.availability_group_id WHERE q.availability_group_id = a.availability_group_id
AND q.questionnaire_id = '$questionnaire_id' AND q.questionnaire_id = '$questionnaire_id'
AND q.sample_import_id = '$sample_import_id'"; AND q.sample_import_id = '$sample_import_id'";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
if (empty($qs)) if (empty($qs))
{ {
print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire sample") . "</h4>"; print "<h4 class='alert text-danger'>" . T_("There are no call attempt time slots selected for this questionnaire sample") . "</h4>";
} }
else else
{ {
print "<h4>" . T_("Call attempt time slots selected for this sample") . ":</h4>"; 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"); xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover");
} }
$sql = "SELECT si.availability_group_id,si.description $sql = "SELECT si.availability_group_id,si.description
FROM availability_group as si 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) 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"; WHERE q.questionnaire_id is NULL";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
if (!empty($qs)) if (!empty($qs))
{ {
print "<div class='panel-body'>"; print "<div class='panel-body'>";
//print "<h3>" . T_("Add a call attempt time slot to this questionnaire sample:") . "</h3>"; //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'>"; 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) foreach($qs as $q)
{ {
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>"; print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
} }
print "</select></div> print "</select></div>
<input type='hidden' name='questionnaire_id' value='$questionnaire_id'/> <input type='hidden' name='questionnaire_id' value='$questionnaire_id'/>
<input type='hidden' name='sample_import_id' value='$sample_import_id'/> <input type='hidden' name='sample_import_id' value='$sample_import_id'/>
&ensp;<input type='submit' name='add_qs_availability' class='btn btn-default' value='" . T_("Add call attempt time slot for sample") . "'/> &ensp;<input type='submit' name='add_qs_availability' class='btn btn-default' value='" . T_("Add call attempt time slot for sample") . "'/>
</form></div>"; </form></div>";
} }
} }
print "</div>"; print "</div>";
} }
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>

View File

@@ -1,190 +1,190 @@
<?php <?php
/** /**
* Modify availability within this availability group * Modify availability within this availability group
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", //"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
"../include/clockpicker/dist/bootstrap-clockpicker.min.css", "../include/clockpicker/dist/bootstrap-clockpicker.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
"../js/addrow-v2.js", "../js/addrow-v2.js",
); );
$js_foot = array( $js_foot = array(
"../include/clockpicker/dist/bootstrap-clockpicker.js", "../include/clockpicker/dist/bootstrap-clockpicker.js",
"../js/custom.js" "../js/custom.js"
); );
global $db; global $db;
$year="2008"; $year="2008";
$woy="1"; $woy="1";
if (isset($_GET['availability_group'])) if (isset($_GET['availability_group']))
$availability_group = intval($_GET['availability_group']); $availability_group = intval($_GET['availability_group']);
else if (isset($_POST['availability_group'])) else if (isset($_POST['availability_group']))
$availability_group = intval($_POST['availability_group']); $availability_group = intval($_POST['availability_group']);
else else
die(T_("No time slot group set")); die(T_("No time slot group set"));
if (isset($_POST['day'])) if (isset($_POST['day']))
{ {
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE FROM availability $sql = "DELETE FROM availability
WHERE availability_group_id = $availability_group"; WHERE availability_group_id = $availability_group";
$db->Execute($sql); $db->Execute($sql);
foreach($_POST['day'] as $key => $val) foreach($_POST['day'] as $key => $val)
{ {
if (!empty($val)) if (!empty($val))
{ {
$val = intval($val); $val = intval($val);
$key = intval($key); $key = intval($key);
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
$end = $db->qstr($_POST['end'][$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) $sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id)
VALUES ('$val',$start,$end,$availability_group)"; VALUES ('$val',$start,$end,$availability_group)";
$db->Execute($sql); $db->Execute($sql);
} }
} }
$sql = "UPDATE availability_group $sql = "UPDATE availability_group
SET description = " . $db->qstr($_POST['description']) . " SET description = " . $db->qstr($_POST['description']) . "
WHERE availability_group_id= $availability_group"; WHERE availability_group_id= $availability_group";
$db->Execute($sql); $db->Execute($sql);
$db->CompleteTrans(); $db->CompleteTrans();
} }
xhtml_head(T_("Modify time slots"),true,$css,$js_head);//,true,array("../css/shifts.css"),array("../js/addrow-v2.js") 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 * Display warning if timezone data not installed
* *
*/ */
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria' $sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
if (empty($rs) || !$rs || empty($rs['t'])) 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='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/>"; print "<div><a class='btn btn-default' href='availabilitygroup.php'>" . T_("Go back") . "</a></div><br/>";
$sql = "SELECT description $sql = "SELECT description
FROM availability_group FROM availability_group
WHERE availability_group_id = $availability_group"; WHERE availability_group_id = $availability_group";
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
$description = $rs['description']; $description = $rs['description'];
print "<h3>" . T_("Time slot") . " :&emsp;<span class = 'text-primary '>" . $rs['description'] . "</span></h3>"; print "<h3>" . T_("Time slot") . " :&emsp;<span class = 'text-primary '>" . $rs['description'] . "</span></h3>";
/** /**
* Begin displaying currently loaded restriction times * 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 $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 FROM availability
WHERE availability_group_id = $availability_group"; WHERE availability_group_id = $availability_group";
$availabilitys = $db->GetAll($sql); $availabilitys = $db->GetAll($sql);
translate_array($availabilitys,array("dt")); 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 $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"; FROM day_of_week";
$daysofweek = $db->GetAll($sql); $daysofweek = $db->GetAll($sql);
translate_array($daysofweek,array("description")); translate_array($daysofweek,array("description"));
?> ?>
<div class=" panel-body col-sm-4"><form method="post" action=""> <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> <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"> <table class="table-hover table-condensed "><thead class="highlight">
<?php <?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 "<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>"; print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
$count = 0; $count = 0;
foreach($availabilitys as $availability) foreach($availabilitys as $availability)
{ {
print "<tr id='row-$count' ><td>";//class='row_to_clone' print "<tr id='row-$count' ><td>";//class='row_to_clone'
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt'])); 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>"; 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++; $count++;
} }
print "<tr class='row_to_clone' id='row-$count'><td>"; print "<tr class='row_to_clone' id='row-$count'><td>";
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); 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>"; 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> </tbody></table>
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a><br/><br/> <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 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;?>"/> <input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
</form><br/><br/> </form><br/><br/>
<form method="post" action="availabilitygroup.php"> <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 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;?>"/> <input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
</form></div> </form></div>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('.clockpicker').clockpicker({ $('.clockpicker').clockpicker({
autoclose: true autoclose: true
}); });
</script> </script>

View File

@@ -1,141 +1,141 @@
<?php <?php
/** /**
* List and create availability groups * List and create availability groups
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Inc (2011) * @copyright Australian Consortium for Social and Political Research Inc (2011)
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Limesurvey functions * Limesurvey functions
*/ */
include("../functions/functions.limesurvey.php"); include("../functions/functions.limesurvey.php");
/** /**
* Operator functions * Operator functions
*/ */
include("../functions/functions.operator.php"); include("../functions/functions.operator.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
); );
$js_foot = array( $js_foot = array(
"../js/window.js", "../js/window.js",
"../js/custom.js" "../js/custom.js"
); );
global $db; global $db;
xhtml_head(T_("Time slots"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") xhtml_head(T_("Time slots"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
if (isset($_POST['subdel'])) if (isset($_POST['subdel']))
{ {
$availability_group = intval($_POST['availability_group']); $availability_group = intval($_POST['availability_group']);
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE FROM availability $sql = "DELETE FROM availability
WHERE availability_group_id = $availability_group"; WHERE availability_group_id = $availability_group";
$db->Execute($sql); $db->Execute($sql);
$sql = "DELETE FROM questionnaire_availability $sql = "DELETE FROM questionnaire_availability
WHERE availability_group_id = $availability_group"; WHERE availability_group_id = $availability_group";
$db->Execute($sql); $db->Execute($sql);
$sql = "DELETE FROM availability_group $sql = "DELETE FROM availability_group
WHERE availability_group_id = $availability_group"; WHERE availability_group_id = $availability_group";
$db->Execute($sql); $db->Execute($sql);
$db->CompleteTrans(); $db->CompleteTrans();
} }
else if (isset($_POST['availability_group'])) else if (isset($_POST['availability_group']))
{ {
$availability_group = $db->qstr($_POST['availability_group']); $availability_group = $db->qstr($_POST['availability_group']);
$sql = "INSERT INTO `availability_group` (availability_group_id,description) $sql = "INSERT INTO `availability_group` (availability_group_id,description)
VALUES (NULL,$availability_group)"; VALUES (NULL,$availability_group)";
$db->Execute($sql); $db->Execute($sql);
} }
//view groups //view groups
$sql = "SELECT availability_group_id,description, $sql = "SELECT availability_group_id,description,
CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link CONCAT('<a href=\'availability.php?availability_group=', availability_group_id, '\'>". TQ_("Modify") . "</a>') as link
FROM availability_group"; FROM availability_group";
$rs = $db->GetAll($sql); $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>"; 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)) if (empty($rs))
print "<div class='alert alert-danger'>" . T_("No time slots") . "</div>"; print "<div class='alert alert-danger'>" . T_("No time slots") . "</div>";
else{ else{
print "<div class='panel-body col-sm-6'>"; 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"); xhtml_table($rs,array("availability_group_id","description","link"),array(T_("ID"),T_("Time slot name"),T_("Modify")),"table table-hover");
print "</div>"; print "</div>";
} }
//add a time slot (ex- availablity group) //add a time slot (ex- availablity group)
?> ?>
<div class=" panel-body col-sm-4"><form method="post" action="?"> <div class=" panel-body col-sm-4"><form method="post" action="?">
<h3><?php echo T_("Add new time slot")," :";?></h3> <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"),"&ensp;",T_("new"),"&ensp;",T_("Time slot name"); ?>"/></p> <p><input type="text" class="textclass form-control" name="availability_group" id="availability_group" placeholder="<?php echo T_("Enter"),"&ensp;",T_("new"),"&ensp;",T_("Time slot name"); ?>"/></p>
<p><input class="submitclass btn btn-default" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/></p> <p><input class="submitclass btn btn-default" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/></p>
</form></div> </form></div>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>

View File

@@ -1,289 +1,289 @@
<?php <?php
/** /**
* Generate bulk appointments from a Headered CSV file * Generate bulk appointments from a Headered CSV file
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research (ACSPRI) 2012 * @copyright Australian Consortium for Social and Political Research (ACSPRI) 2012
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Database functions * Database functions
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* Operator functions * Operator functions
*/ */
include("../functions/functions.operator.php"); include("../functions/functions.operator.php");
/** /**
* Validate that an uploaded CSV file contains a caseid, starttime and endtime column and generate * 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 * an array containing the details for confirming on screen or updating the database
* *
* @param string $tmpfname File name of uploaded CSV file * @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 * @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> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2012-11-02 * @since 2012-11-02
*/ */
function validate_bulk_appointment($tmpfname) function validate_bulk_appointment($tmpfname)
{ {
$handle = fopen($tmpfname, "r"); $handle = fopen($tmpfname, "r");
$row = 1; $row = 1;
$cols = array("caseid" => -1,"starttime" => -1,"endtime" => -1); $cols = array("caseid" => -1,"starttime" => -1,"endtime" => -1);
$index = array(); $index = array();
$optcols = array("note" => -1); $optcols = array("note" => -1);
$todo = array(); $todo = array();
while (($data = fgetcsv($handle)) !== FALSE) while (($data = fgetcsv($handle)) !== FALSE)
{ {
//data contains an array of elements in the csv //data contains an array of elements in the csv
//selected contains an indexed array of elements to import with the type attached //selected contains an indexed array of elements to import with the type attached
if ($row == 1) //validate if ($row == 1) //validate
{ {
$colcount = 0; $colcount = 0;
$ic = 0; $ic = 0;
foreach($data as $col) foreach($data as $col)
{ {
if (array_key_exists(strtolower($col),$cols)) if (array_key_exists(strtolower($col),$cols))
{ {
$cols[strtolower($col)] = $ic; $cols[strtolower($col)] = $ic;
$colcount++; $colcount++;
} }
if (array_key_exists(strtolower($col),$optcols)) if (array_key_exists(strtolower($col),$optcols))
{ {
$optcols[strtolower($col)] = $ic; $optcols[strtolower($col)] = $ic;
} }
$ic++; $ic++;
} }
if ($colcount != 3) if ($colcount != 3)
{ {
return false; return false;
} }
} }
else else
{ {
$note = ""; $note = "";
if (isset($data[$optcols['note']])) if (isset($data[$optcols['note']]))
$note = $data[$optcols['note']]; $note = $data[$optcols['note']];
$sd = getdate(strtotime($data[$cols['starttime']])); $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); $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']])); $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); $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); $todor = array($data[$cols['caseid']],$s,$e,$note);
$todo[] = $todor; $todo[] = $todor;
} }
$row++; $row++;
} }
fclose($handle); fclose($handle);
return $todo; return $todo;
} }
if (isset($_POST['tmpfname'])) if (isset($_POST['tmpfname']))
{ {
$subtitle = T_("Result"); $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); 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']); $todo = validate_bulk_appointment($_POST['tmpfname']);
if (is_array($todo)) if (is_array($todo))
{ {
$res = array(); $res = array();
foreach($todo as $r) foreach($todo as $r)
{ {
$db->StartTrans(); $db->StartTrans();
//check the current case id exists and outcome is not final //check the current case id exists and outcome is not final
$sql = "SELECT c.case_id $sql = "SELECT c.case_id
FROM `case` as c, `outcome` as o FROM `case` as c, `outcome` as o
WHERE c.current_outcome_id = o.outcome_id WHERE c.current_outcome_id = o.outcome_id
AND o.outcome_type_id != 4 AND o.outcome_type_id != 4
AND c.case_id = {$r[0]} AND c.case_id = {$r[0]}
AND c.current_operator_id IS NULL"; AND c.current_operator_id IS NULL";
$caseid = $db->GetOne($sql); $caseid = $db->GetOne($sql);
if (!empty($caseid)) if (!empty($caseid))
{ {
//insert an appointment in respondent time //insert an appointment in respondent time
$sql = "SELECT respondent_id $sql = "SELECT respondent_id
FROM respondent FROM respondent
WHERE case_id = {$r[0]}"; WHERE case_id = {$r[0]}";
$rid = $db->GetOne($sql); $rid = $db->GetOne($sql);
$sql = "SELECT contact_phone_id $sql = "SELECT contact_phone_id
FROM contact_phone FROM contact_phone
WHERE case_id = {$r[0]} WHERE case_id = {$r[0]}
ORDER BY priority ASC"; ORDER BY priority ASC";
$cid = $db->GetOne($sql); $cid = $db->GetOne($sql);
$oid = get_operator_id(); $oid = get_operator_id();
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end) $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'))"; VALUES (NULL,{$r[0]},$oid,$rid,CONVERT_TZ(NOW(),'System','UTC'),CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql); $db->Execute($sql);
$call_attempt_id = $db->Insert_ID(); $call_attempt_id = $db->Insert_ID();
$sql = "INSERT INTO appointment (case_id,contact_phone_id,`start`,`end`,respondent_id,call_attempt_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 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 FROM respondent
WHERE respondent_id = $rid"; WHERE respondent_id = $rid";
$db->Execute($sql); $db->Execute($sql);
$aid = $db->Insert_ID(); $aid = $db->Insert_ID();
//change the outcome to unspecified appointment, other //change the outcome to unspecified appointment, other
$sql = "UPDATE `case` $sql = "UPDATE `case`
SET current_outcome_id = 22 SET current_outcome_id = 22
WHERE case_id = {$r[0]}"; WHERE case_id = {$r[0]}";
$db->Execute($sql); $db->Execute($sql);
//add a note if not blank //add a note if not blank
if (!empty($r[3])) if (!empty($r[3]))
{ {
$note = $db->qstr($r[3]); $note = $db->qstr($r[3]);
$sql = "INSERT INTO case_note (case_id,operator_id,note,datetime) $sql = "INSERT INTO case_note (case_id,operator_id,note,datetime)
VALUES ({$r[0]},$oid,$note,CONVERT_TZ(NOW(),'System','UTC'))"; VALUES ({$r[0]},$oid,$note,CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql); $db->Execute($sql);
} }
$cnote = T_("Added appointment") . " <a href='displayappointments?case_id={$r[0]}&amp;appointment_id=$aid'>$aid</a>"; $cnote = T_("Added appointment") . " <a href='displayappointments?case_id={$r[0]}&amp;appointment_id=$aid'>$aid</a>";
} }
else else
{ {
$cnote = T_("No such case id, or case set to a final outcome, or case currently assigned to an operator"); $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); $res[] = array("<a href='supervisor.php?case_id=" . $r[0] . "'>" . $r[0] . "</a>",$cnote);
$db->CompleteTrans(); $db->CompleteTrans();
} }
xhtml_table($res,array(0,1),array(T_("Case id"),T_("Result"))); xhtml_table($res,array(0,1),array(T_("Case id"),T_("Result")));
} }
xhtml_foot(); xhtml_foot();
} }
else if (isset($_POST['import_file'])) else if (isset($_POST['import_file']))
{ {
//file has been submitted //file has been submitted
$subtitle = T_("Check data to submit"); $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); 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" > <form action="" method="post" >
<?php <?php
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO"); $tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname); move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
$todo = validate_bulk_appointment($tmpfname); $todo = validate_bulk_appointment($tmpfname);
if (is_array($todo) && !empty($todo)) { 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>"; 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")); $todoh = array(T_("Case id"), T_("Start time"), T_("End time"), T_("Note"));
xhtml_table($todo,array(0,1,2,3),$todoh); xhtml_table($todo,array(0,1,2,3),$todoh);
?> ?>
<form action="" method="post"> <form action="" method="post">
<input type="hidden" name="tmpfname" value="<?php echo $tmpfname; ?>" /> <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"/> <input type="submit" name="import_file" value="<?php echo T_("Accept and generate bulk appointments"); ?>" class="btn btn-primary"/>
</form> </form>
<?php <?php
} }
else 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 "<p class='well text-danger'>" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."</p>";
print "</form>"; print "</form>";
xhtml_foot(); xhtml_foot();
} }
else else
{ {
//need to supply file to upload //need to supply file to upload
$subtitle = T_("Import: Select 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 ); 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']; $ua = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv"; 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> <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"> <div class="panel-body">
<h5><u><?php echo T_("Example CSV file:"); ?></u></h5> <h5><u><?php echo T_("Example CSV file:"); ?></u></h5>
<table class="table-bordered table-condensed form-group"> <table class="table-bordered table-condensed form-group">
<tr><th>caseid</th><th>starttime</th><th>endtime</th><th>note</th></tr> <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>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>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> <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> </table>
</div> </div>
<form enctype="multipart/form-data" action="" method="post"> <form enctype="multipart/form-data" action="" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /> <input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
<h4 class="pull-left" ><?php echo T_("Select bulk appointment CSV file to upload"); ?>:&ensp;</h4> <h4 class="pull-left" ><?php echo T_("Select bulk appointment CSV file to upload"); ?>:&ensp;</h4>
<div class="col-sm-4"> <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; ?>"/>&emsp; <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; ?>"/>&emsp;
</div> </div>
<button type="submit" class="btn btn-primary" name="import_file" value=""><i class='fa fa-upload fa-lg'></i>&emsp;<?php echo T_("Upload file"); ?></button> <button type="submit" class="btn btn-primary" name="import_file" value=""><i class='fa fa-upload fa-lg'></i>&emsp;<?php echo T_("Upload file"); ?></button>
</form> </form>
<?php <?php
xhtml_foot(); xhtml_foot();
} }
?> ?>

View File

@@ -1,181 +1,181 @@
<?php <?php
/** /**
* Display a list of calls and outcomes for all calls * Display a list of calls and outcomes for all calls
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage user * @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Operator functions * Operator functions
*/ */
include("../functions/functions.operator.php"); include("../functions/functions.operator.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../include/bs-data-table/css/jquery.bdt.css", "../include/bs-data-table/css/jquery.bdt.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js" "../include/bootstrap/js/bootstrap.min.js"
); );
$js_foot = array( $js_foot = array(
"../include/bs-data-table/js/vendor/jquery.sortelements.js", "../include/bs-data-table/js/vendor/jquery.sortelements.js",
"../include/bs-data-table/js/jquery.bdt.js", "../include/bs-data-table/js/jquery.bdt.js",
"../js/custom.js" "../js/custom.js"
); );
//List the case call history //List the case call history
$operator_id = get_operator_id(); $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.... 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/ ) 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 ($operator_id)
{ {
if (isset($_GET['questionnaire_id'])) $qid = $_GET['questionnaire_id']; if (isset($_GET['questionnaire_id'])) $qid = $_GET['questionnaire_id'];
if (isset($_GET['sample_import_id'])) $sid = $_GET['sample_import_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, $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>&para;&emsp;' ) FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes,"; (SELECT GROUP_CONCAT(cn1.note SEPARATOR '</br>&para;&emsp;' ) 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 "; if (isset($_GET['csv'])) $sql .= " c.case_id ";
else $sql .= " CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') "; 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 $sql .= " as case_id, q.description as qd , contact_phone.phone as cpi, sample_import.description as spl
FROM `call` as c FROM `call` as c
JOIN (operator as op, respondent as r) on (op.operator_id = '$operator_id' and r.respondent_id = c.respondent_id)"; 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 ($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"; if ($sid) $samimpid = "$sid and sample_import.sample_import_id=$sid"; else $samimpid = "sample_import.sample_import_id";
$sql .= " $sql .= "
JOIN (`case` as ca, questionnaire as q) ON (ca.case_id = c.case_id AND ca.questionnaire_id = $quest) 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 (outcome as o) on (c.outcome_id = o.outcome_id)
LEFT JOIN (operator as opp) on (opp.operator_id = c.operator_id), LEFT JOIN (operator as opp) on (opp.operator_id = c.operator_id),
contact_phone, sample_import, sample contact_phone, sample_import, sample
WHERE c.contact_phone_id = contact_phone.contact_phone_id AND sample.import_id = $samimpid WHERE c.contact_phone_id = contact_phone.contact_phone_id AND sample.import_id = $samimpid
AND sample.sample_id = ca.sample_id AND sample.sample_id = ca.sample_id
ORDER BY c.start DESC"; ORDER BY c.start DESC";
if (!isset($_GET['csv'])) if (!isset($_GET['csv']))
$sql .= " LIMIT 500"; $sql .= " LIMIT 500";
else $sql .= " LIMIT 5000"; else $sql .= " LIMIT 5000";
$rs = $db->Execute($sql); $rs = $db->Execute($sql);
if (empty($rs)) if (empty($rs))
{ {
print "<div class='alert alert-warning col-sm-6'><p>" . T_("No calls ever made") . "</p></div>"; print "<div class='alert alert-warning col-sm-6'><p>" . T_("No calls ever made") . "</p></div>";
} }
else else
{ {
if (isset($_GET['csv'])) if (isset($_GET['csv']))
{ {
$qds = str_replace(' ','_',$_GET['dq']); $smpds = str_replace(' ','_',$_GET['ds']); $qds = str_replace(' ','_',$_GET['dq']); $smpds = str_replace(' ','_',$_GET['ds']);
$fn = "callhistory-" . $qds . $smpds . date("_d-M-Y_H-i") . ".csv"; $fn = "callhistory-" . $qds . $smpds . date("_d-M-Y_H-i") . ".csv";
header("Content-Type: text/csv"); header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=$fn"); header("Content-Disposition: attachment; filename=$fn");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past 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("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache"); // HTTP/1.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"); 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()) while ($r = $rs->FetchRow())
{ {
translate_array($r,array("des")); 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"; 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; exit;
} }
else else
{ {
xhtml_head(T_("Call History List"),true,$css,$js_head); xhtml_head(T_("Call History List"),true,$css,$js_head);
echo "<div class='form-group col-sm-2'><a href='' onclick='history.back();return false;' class='btn btn-default'><i class='fa fa-chevron-left fa-lg text-primary'></i>&emsp;" . T_("Go back") . "</a></div>"; echo "<div class='form-group col-sm-2'><a href='' onclick='history.back();return false;' class='btn btn-default'><i class='fa fa-chevron-left fa-lg text-primary'></i>&emsp;" . T_("Go back") . "</a></div>";
$rs = $rs->GetArray(); $rs = $rs->GetArray();
if (count($rs) ==0) if (count($rs) ==0)
{ {
print "<div class='alert alert-info col-sm-6'><h3>" . T_("NO Call history records for Your query") . "</h3></div>"; print "<div class='alert alert-info col-sm-6'><h3>" . T_("NO Call history records for Your query") . "</h3></div>";
} }
else else
{ {
translate_array($rs,array("des")); translate_array($rs,array("des"));
$datacol = array("start_date", "start_time","end","case_id","qd","spl","cpi","opname","descr","casenotes","firstName"); $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")); $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'])){ if (isset($_GET['questionnaire_id'])){
$sql = "SELECT description FROM `questionnaire` WHERE `questionnaire_id` = $qid "; $sql = "SELECT description FROM `questionnaire` WHERE `questionnaire_id` = $qid ";
$dq = $db->GetOne($sql); $dq = $db->GetOne($sql);
print "<h3><small>" . T_("Questionnaire") . "&emsp;ID: $qid</small>&emsp;" . $dq . "</h3>"; print "<h3><small>" . T_("Questionnaire") . "&emsp;ID: $qid</small>&emsp;" . $dq . "</h3>";
unset($datacol[4]); unset($headers[4]); } unset($datacol[4]); unset($headers[4]); }
if (isset($_GET['sample_import_id'])){ if (isset($_GET['sample_import_id'])){
$sql = "SELECT description FROM `sample_import` WHERE `sample_import_id` = $sid "; $sql = "SELECT description FROM `sample_import` WHERE `sample_import_id` = $sid ";
$ds = $db->GetOne($sql); $ds = $db->GetOne($sql);
print "<h3><small>" . T_("Sample") . "&emsp;ID: $sid</small>&emsp;" . $ds . "</h3>"; print "<h3><small>" . T_("Sample") . "&emsp;ID: $sid</small>&emsp;" . $ds . "</h3>";
unset($datacol[5]); unset($headers[5]); } unset($datacol[5]); unset($headers[5]); }
print "&nbsp;<a href='?csv=csv&amp;questionnaire_id=$qid&amp;dq=" . $dq . "&amp;sample_import_id=$sid&amp;ds=" . $ds . "' class='btn btn-default pull-right'><i class='fa fa-download fa-lg text-primary'></i>&emsp;" . T_("Download Call History List") . "</a> print "&nbsp;<a href='?csv=csv&amp;questionnaire_id=$qid&amp;dq=" . $dq . "&amp;sample_import_id=$sid&amp;ds=" . $ds . "' class='btn btn-default pull-right'><i class='fa fa-download fa-lg text-primary'></i>&emsp;" . 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>&emsp;" . T_("Go to Call History Report") . "</a>&nbsp; "; //<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>&emsp;" . T_("Go to Call History Report") . "</a>&nbsp;
xhtml_table($rs,$datacol,$headers,"tclass",false,false,"bs-table"); xhtml_table($rs,$datacol,$headers,"tclass",false,false,"bs-table");
} }
} }
} }
} }
else else
{ {
print "<div class='alert alert-warning col-sm-6'>" . T_("No operator") . "</div>"; print "<div class='alert alert-warning col-sm-6'>" . T_("No operator") . "</div>";
} }
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('#bs-table').bdt(); $('#bs-table').bdt();
</script> </script>

View File

@@ -1,163 +1,163 @@
<?php <?php
/** /**
* Modify the call restriction times * Modify the call restriction times
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", //"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
//"../include/font-awesome-4.3.0/css/font-awesome.css", //"../include/font-awesome/css/font-awesome.css",
"../include/clockpicker/dist/bootstrap-clockpicker.min.css", "../include/clockpicker/dist/bootstrap-clockpicker.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
"../js/addrow-v2.js", "../js/addrow-v2.js",
); );
$js_foot = array( $js_foot = array(
"../include/clockpicker/dist/bootstrap-clockpicker.js", "../include/clockpicker/dist/bootstrap-clockpicker.js",
"../js/custom.js" "../js/custom.js"
); );
global $db; global $db;
$year="2008"; $year="2008";
$woy="1"; $woy="1";
if (isset($_POST['day'])) if (isset($_POST['day']))
{ {
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE FROM call_restrict $sql = "DELETE FROM call_restrict
WHERE 1"; WHERE 1";
$db->Execute($sql); $db->Execute($sql);
foreach($_POST['day'] as $key => $val) foreach($_POST['day'] as $key => $val)
{ {
if (!empty($val)) if (!empty($val))
{ {
$val = intval($val); $val = intval($val);
$key = intval($key); $key = intval($key);
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
$end = $db->qstr($_POST['end'][$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) $sql = "INSERT INTO call_restrict (day_of_week,start,end)
VALUES ('$val',$start,$end)"; VALUES ('$val',$start,$end)";
$db->Execute($sql); $db->Execute($sql);
} }
} }
$db->CompleteTrans(); $db->CompleteTrans();
} }
xhtml_head(T_("Set call restriction times"),true,$css,$js_head);//,array("../css/shifts.css"),array("../js/addrow-v2.js") 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 * Display warning if timezone data not installed
* *
*/ */
$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria' $sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
if (empty($rs) || !$rs || empty($rs['t'])) 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='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>"; 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 * 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 $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"; FROM call_restrict";
$shifts = $db->GetAll($sql); $shifts = $db->GetAll($sql);
translate_array($shifts,array("dt")); 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 $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"; FROM day_of_week";
$daysofweek = $db->GetAll($sql); $daysofweek = $db->GetAll($sql);
translate_array($daysofweek,array("description")); translate_array($daysofweek,array("description"));
?> ?>
<div class=" panel-body col-sm-4"><form method="post" action=""> <div class=" panel-body col-sm-4"><form method="post" action="">
<table class="table-hover table-condensed " id="restrict"><thead class="highlight"> <table class="table-hover table-condensed " id="restrict"><thead class="highlight">
<?php <?php
print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>"; print "<tr><th>" . T_("Day") . "</th><th>" . T_("Start") . "</th><th>" . T_("End") . "</th></tr></thead><tbody>";
$count = 0; $count = 0;
foreach($shifts as $shift) foreach($shifts as $shift)
{ {
print "<tr id='row-$count' ><td>";//class='row_to_clone' /* these are not the rows to clone...*/ 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'])); 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> 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>"; <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++; $count++;
} }
print "<tr class='row_to_clone' id='row-$count'><td>"; print "<tr class='row_to_clone' id='row-$count'><td>";
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); 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> 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>"; <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> </tbody></table>
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/> <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"); ?>"/> <input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to restriction times"); ?>"/>
</form></div> </form></div>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('.clockpicker').clockpicker({ $('.clockpicker').clockpicker({
autoclose: true autoclose: true
}); });
</script> </script>

View File

@@ -1,121 +1,121 @@
<?php <?php
/** /**
* Display a list of cases for a questionnaire based on the current outcome * Display a list of cases for a questionnaire based on the current outcome
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2012 * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2012
* @package queXS * @package queXS
* @subpackage user * @subpackage user
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Operator functions * Operator functions
*/ */
include("../functions/functions.operator.php"); 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")); 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'>&emsp;" . T_("Go back") . "&emsp;</a></div>"; print "<div class='col-sm-3'><a onclick='history.back();return false;' href='' class='btn btn-default'>&emsp;" . T_("Go back") . "&emsp;</a></div>";
//List the cases by outcome //List the cases by outcome
$operator_id = get_operator_id(); $operator_id = get_operator_id();
if ($operator_id) if ($operator_id)
{ {
//get the outcome and the questionnaire //get the outcome and the questionnaire
$outcome_id = intval($_GET['outcome_id']); $outcome_id = intval($_GET['outcome_id']);
$questionnaire_id = intval($_GET['questionnaire_id']); $questionnaire_id = intval($_GET['questionnaire_id']);
$sql = "SELECT o.description, q.description as qd $sql = "SELECT o.description, q.description as qd
FROM `outcome` as o, questionnaire as q FROM `outcome` as o, questionnaire as q
WHERE o.outcome_id = '$outcome_id' WHERE o.outcome_id = '$outcome_id'
AND q.questionnaire_id = '$questionnaire_id'"; AND q.questionnaire_id = '$questionnaire_id'";
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
if (!empty($rs)){ if (!empty($rs)){
print "<h2 class=' '>" . T_("Project") . ":&emsp;<span class='text-primary'>{$rs['qd']}</span></h2>"; print "<h2 class=' '>" . T_("Project") . ":&emsp;<span class='text-primary'>{$rs['qd']}</span></h2>";
if($sample_import_id=intval($_GET['sample_import_id'])){ if($sample_import_id=intval($_GET['sample_import_id'])){
$sql = "SELECT si.description as sd $sql = "SELECT si.description as sd
FROM `sample_import` as si FROM `sample_import` as si
WHERE si.sample_import_id = '$sample_import_id' ;"; WHERE si.sample_import_id = '$sample_import_id' ;";
$sd = $db->GetRow($sql); $sd = $db->GetRow($sql);
print "<h3>". T_("Sample:") ."&emsp;<span class='text-primary'>" . T_($sd['sd']) . "</span></h3>"; print "<h3>". T_("Sample:") ."&emsp;<span class='text-primary'>" . T_($sd['sd']) . "</span></h3>";
$sid = "AND s.import_id= '$sample_import_id'"; $sid = "AND s.import_id= '$sample_import_id'";
} }
else{$sid = " ";}; else{$sid = " ";};
if($oper_id= intval($_GET['oper_id'])){ if($oper_id= intval($_GET['oper_id'])){
$sql = "SELECT CONCAT(op.firstname, op.lastname) as opname $sql = "SELECT CONCAT(op.firstname, op.lastname) as opname
FROM `operator` as op FROM `operator` as op
WHERE op.operator_id = '$oper_id' ;"; WHERE op.operator_id = '$oper_id' ;";
$on = $db->GetRow($sql); $on = $db->GetRow($sql);
print "<h3>". T_("Operator") ." : " . T_($on['opname']) . "</h3> oper_id = $oper_id "; print "<h3>". T_("Operator") ." : " . T_($on['opname']) . "</h3> oper_id = $oper_id ";
$opn = "AND c.current_operator_id= '$oper_id'"; $opn = "AND c.current_operator_id= '$oper_id'";
} }
else{$opn = " ";}; else{$opn = " ";};
print "<h3 class=' '>". T_("Current outcome:") ."&emsp;<span class='text-primary'>" . T_($rs['description']) . "</span></h3>"; print "<h3 class=' '>". T_("Current outcome:") ."&emsp;<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 $sql = "SELECT CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id
FROM `case` as c FROM `case` as c
LEFT JOIN `sample` as s ON ( s.sample_id = c.sample_id ) LEFT JOIN `sample` as s ON ( s.sample_id = c.sample_id )
WHERE c.questionnaire_id = '$questionnaire_id' WHERE c.questionnaire_id = '$questionnaire_id'
AND c.current_outcome_id = '$outcome_id' AND c.current_outcome_id = '$outcome_id'
$sid $sid
$opn $opn
LIMIT 500"; LIMIT 500";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
print "<div class='panel-body col-sm-4' style='max-height:750px; overflow:auto;'>"; print "<div class='panel-body col-sm-4' style='max-height:750px; overflow:auto;'>";
if (empty($rs)) if (empty($rs))
print "<p>" . T_("No cases with this outcome") . "</p>"; print "<p>" . T_("No cases with this outcome") . "</p>";
else else
{ {
xhtml_table($rs,array("case_id"),array(T_("Case ID"))); xhtml_table($rs,array("case_id"),array(T_("Case ID")));
} }
} }
else else
print "<p>" . T_("Error with input") . "</p>"; print "<p>" . T_("Error with input") . "</p>";
} }
else else
print "<p>" . T_("No operator") . "</p>"; print "<p>" . T_("No operator") . "</p>";
print "</div>"; print "</div>";
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,254 +1,252 @@
<?php /** <?php /**
* Display a list of cases including status. Allow for assigning to operators in a queue * Display a list of cases including status. Allow for assigning to operators in a queue
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../include/bs-data-table/css/jquery.bdt.css", "../include/bs-data-table/css/jquery.bdt.css",
//"../include/iCheck/skins/square/blue.css", //"../include/iCheck/skins/square/blue.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js" "../include/bootstrap/js/bootstrap.min.js"
); );
$js_foot = array( $js_foot = array(
"../include/bs-data-table/js/vendor/jquery.sortelements.js", "../include/bs-data-table/js/vendor/jquery.sortelements.js",
"../include/bs-data-table/js/jquery.bdt.js", "../include/bs-data-table/js/jquery.bdt.js",
"../include/iCheck/icheck.min.js", "../include/iCheck/icheck.min.js",
"../js/window.js", "../js/window.js",
"../js/custom.js" "../js/custom.js"
); );
/** /**
* Generate the case status report * Generate the case status report
* *
* @param mixed $questionnaire_id The quesitonnaire, if specified * @param mixed $questionnaire_id The quesitonnaire, if specified
* @param string $sample_id The sample, if speified * @param string $sample_id The sample, if speified
* @param mixed $outcome_id THe outcome id, if specified * @param mixed $outcome_id THe outcome id, if specified
* *
* @return false if empty otherwise true if table drawn * @return false if empty otherwise true if table drawn
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2012-10-02 * @since 2012-10-02
*/ */
function case_status_report($questionnaire_id = false, $sample_id = false, $outcome_id = false) function case_status_report($questionnaire_id = false, $sample_id = false, $outcome_id = false)
{ {
global $db; global $db;
$q = ""; $q = "";
if ($questionnaire_id !== false) if ($questionnaire_id !== false)
$q = "AND c.questionnaire_id = $questionnaire_id"; $q = "AND c.questionnaire_id = $questionnaire_id";
$s = ""; $s = "";
if ($sample_id !== false) if ($sample_id !== false)
$s = "AND s.import_id = '$sample_id'"; $s = "AND s.import_id = '$sample_id'";
$o = ""; $o = "";
if ($outcome_id !== false) if ($outcome_id !== false)
$o = "AND c.current_outcome_id = $outcome_id"; $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, $sql = "SELECT CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
o.description as outcomes, 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, 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") . "' 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") . "' 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),'&emsp;" . TQ_("minutes") . "') ELSE CONCAT(ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60),'&emsp;" . TQ_("minutes") . "')
END AS availableinmin, END AS availableinmin,
CASE WHEN oq.operator_id IS NULL THEN CASE WHEN oq.operator_id IS NULL THEN
CONCAT('') CONCAT('')
ELSE CONCAT('<span class=\'text-info\'>', oq.firstName,' ',oq.lastName,'</span>') ELSE CONCAT('<span class=\'text-info\'>', oq.firstName,' ',oq.lastName,'</span>')
END AS assignedoperator, END AS assignedoperator,
CASE WHEN oq.operator_id IS NULL THEN CASE WHEN oq.operator_id IS NULL THEN
CONCAT('') CONCAT('')
ELSE CONCAT(' &emsp; ', cq.sortorder ,'&emsp;') ELSE CONCAT(' &emsp; ', cq.sortorder ,'&emsp;')
END AS ordr, END AS ordr,
CASE WHEN oq.operator_id IS NULL THEN 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>') 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&amp;sample_import_id=$sample_id&amp;unassign=', cq.case_queue_id, '\" data-toggle=\'tooltip\' title=\'" . TQ_("Click to unassign") ."\'><i class=\'fa fa-trash-o fa-lg text-danger\'></i></a>') ELSE CONCAT('<a href=\"?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_id&amp;unassign=', cq.case_queue_id, '\" data-toggle=\'tooltip\' title=\'" . TQ_("Click to unassign") ."\'><i class=\'fa fa-trash-o fa-lg text-danger\'></i></a>')
END AS flag END AS flag
FROM `case` as c FROM `case` as c
JOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1) 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 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 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 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) 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 `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 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 case_queue as cq ON (cq.case_id = c.case_id)
LEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id) LEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id)
WHERE c.current_operator_id IS NULL $q $o WHERE c.current_operator_id IS NULL $q $o
ORDER BY c.case_id ASC"; ORDER BY c.case_id ASC";
// print $sql; // print $sql;
print ("<form method=\"post\" action=\"?questionnaire_id=$questionnaire_id&sample_import_id=$sample_id\">"); 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'); $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>"); $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]); } if (isset($_GET['sample_import_id'])){ unset($datacol[1]); unset($headers[1]); }
xhtml_table($db->GetAll($sql),$datacol,$headers,"tclass",false,false,"bs-table"); xhtml_table($db->GetAll($sql),$datacol,$headers,"tclass",false,false,"bs-table");
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected $sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected
FROM operator FROM operator
WHERE enabled = 1"; WHERE enabled = 1";
$rs3 = $db->GetAll($sql); $rs3 = $db->GetAll($sql);
print "<h4 class='col-sm-offset-5 pull-left text-right control-label'>" . T_("Assign selected cases to") . "&ensp;" . T_("operator") . "&ensp;:&emsp;</h4> "; print "<h4 class='col-sm-offset-5 pull-left text-right control-label'>" . T_("Assign selected cases to") . "&ensp;" . T_("operator") . "&ensp;:&emsp;</h4> ";
display_chooser($rs3, "operator_id", "operator_id",true,false,false,true,false,true,"pull-left"); display_chooser($rs3, "operator_id", "operator_id",true,false,false,true,false,true,"pull-left");
print "&emsp;<button class='btn btn-default' type='submit' data-toggle='tooltip' title='" . T_("Assign cases to operator queue") . "'><i class='fa fa-link fa-lg text-primary'></i>&emsp;" . T_("Assign") . "</button>"; print "&emsp;<button class='btn btn-default' type='submit' data-toggle='tooltip' title='" . T_("Assign cases to operator queue") . "'><i class='fa fa-link fa-lg text-primary'></i>&emsp;" . T_("Assign") . "</button>";
print "</form></br>"; print "</form></br>";
return true; return true;
} }
if (isset($_POST['operator_id']) && !empty($_POST['operator_id'])) if (isset($_POST['operator_id']) && !empty($_POST['operator_id']))
{ {
$operator_id = intval($_POST['operator_id']); $operator_id = intval($_POST['operator_id']);
$db->StartTrans(); $db->StartTrans();
$sql = "SELECT MAX(sortorder) $sql = "SELECT MAX(sortorder)
FROM case_queue FROM case_queue
WHERE operator_id = '$operator_id'"; WHERE operator_id = '$operator_id'";
$sortorder = $db->GetOne($sql); $sortorder = $db->GetOne($sql);
foreach($_POST as $key => $val) foreach($_POST as $key => $val)
{ {
$sortorder++; $sortorder++;
if (substr($key,0,1) == "c") if (substr($key,0,1) == "c")
{ {
$sql = "INSERT INTO case_queue (case_id,operator_id,sortorder) $sql = "INSERT INTO case_queue (case_id,operator_id,sortorder)
VALUES ('" . bigintval($val) . "', '$operator_id', '$sortorder')"; VALUES ('" . bigintval($val) . "', '$operator_id', '$sortorder')";
$db->Execute($sql); $db->Execute($sql);
} }
} }
$db->CompleteTrans(); $db->CompleteTrans();
} }
if (isset($_GET['unassign'])) if (isset($_GET['unassign']))
{ {
$case_queue_id = bigintval($_GET['unassign']); $case_queue_id = bigintval($_GET['unassign']);
$db->StartTrans(); $db->StartTrans();
$sql = "SELECT operator_id $sql = "SELECT operator_id
FROM case_queue FROM case_queue
WHERE case_queue_id = '$case_queue_id'"; WHERE case_queue_id = '$case_queue_id'";
$operator_id = $db->GetOne($sql); $operator_id = $db->GetOne($sql);
$sql = "DELETE FROM case_queue $sql = "DELETE FROM case_queue
WHERE case_queue_id = '$case_queue_id'"; WHERE case_queue_id = '$case_queue_id'";
$db->Execute($sql); $db->Execute($sql);
$sql = "SELECT case_queue_id $sql = "SELECT case_queue_id
FROM case_queue FROM case_queue
WHERE operator_id = '$operator_id' WHERE operator_id = '$operator_id'
ORDER BY sortorder ASC"; ORDER BY sortorder ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
$sortorder = 1; $sortorder = 1;
foreach($rs as $r) foreach($rs as $r)
{ {
$sql = "UPDATE case_queue $sql = "UPDATE case_queue
SET sortorder = '$sortorder' SET sortorder = '$sortorder'
WHERE case_queue_id = '{$r['case_queue_id']}'"; WHERE case_queue_id = '{$r['case_queue_id']}'";
$db->Execute($sql); $db->Execute($sql);
$sortorder++; $sortorder++;
} }
$db->CompleteTrans(); $db->CompleteTrans();
} }
xhtml_head(T_("Case status and assignment"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") 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>&emsp;" . T_("Go back") . "</a> echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i>&emsp;" . T_("Go back") . "</a>
<i class='fa fa-question-circle fa-3x text-primary pull-right btn' data-toggle='modal' data-target='.inform'></i>"; <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 fade inform" id="inform" tabindex="-1" role="dialog" aria-labelledby="inform" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title"><small class="text-info"><?php echo T_("INFORMATION");?></small></h4> <h3 class="modal-title"><small class="text-info"><?php echo T_("INFORMATION");?></small></h4>
</div> </div>
<div class="modal-body"> <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> <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>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-info" data-dismiss="modal"><?php echo T_("OK");?></button> <button type="button" class="btn btn-info" data-dismiss="modal"><?php echo T_("OK");?></button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sample_import_id = false; $sample_import_id = false;
if (isset($_GET['sample_import_id']) && !empty($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); if (isset($_GET['sample_import_id']) && !empty($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
$outcome_id = false; $outcome_id = false;
print "<div class='form-group '><h3 class=' col-sm-2 text-right'>" . T_("Questionnaire") . ":</h3>"; 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"); display_questionnaire_chooser($questionnaire_id, false, "pull-left", "form-control");
if ($questionnaire_id){
print "<h3 class=' col-sm-2 text-right'>" . T_("Sample") . ":</h3>";
if ($questionnaire_id){ display_sample_chooser($questionnaire_id,$sample_import_id,false, "pull-left", "form-control");
print "<h3 class=' col-sm-2 text-right'>" . T_("Sample") . ":</h3>"; print "</div>
display_sample_chooser($questionnaire_id,$sample_import_id,false, "pull-left", "form-control"); <div class='clearfix'></div>";
print "</div>
<div class='clearfix'></div>"; case_status_report($questionnaire_id,$sample_import_id,$outcome_id);
}
case_status_report($questionnaire_id,$sample_import_id,$outcome_id); xhtml_foot($js_foot);
} ?>
xhtml_foot($js_foot); <script type="text/javascript">
?> $('#bs-table').bdt();
<script type="text/javascript"> $('input').iCheck({
$('#bs-table').bdt(); //checkboxClass: 'icheckbox_square-blue',
$('input').iCheck({ //increaseArea: '30%'
//checkboxClass: 'icheckbox_square-blue', checkboxClass: 'fa fa-lg ', // text-primary
//increaseArea: '30%' checkedCheckboxClass: 'fa-check-square-o text-primary',
checkboxClass: 'fa fa-lg ', // text-primary uncheckedCheckboxClass: 'fa-square-o'
checkedCheckboxClass: 'fa-check-square-o text-primary', });
uncheckedCheckboxClass: 'fa-square-o' </script>
});
</script>

View File

@@ -1,72 +1,72 @@
<?php <?php
/** /**
* Set information about this centre for diplay to operators * Set information about this centre for diplay to operators
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011 * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* CKEditor * CKEditor
*/ */
include("../include/ckeditor/ckeditor.php"); include("../include/ckeditor/ckeditor.php");
global $db; global $db;
$CKEditor = new CKEditor(); $CKEditor = new CKEditor();
$CKEditor->basePath = "../include/ckeditor/"; $CKEditor->basePath = "../include/ckeditor/";
if (isset($_POST['information'])) if (isset($_POST['information']))
{ {
set_setting("information",$_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")); 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"> <form action="" method="post" class="panel-body">
<!-- <label for="information"><?php //echo T_("Set centre information: "); ?></label> --> <!-- <label for="information"><?php //echo T_("Set centre information: "); ?></label> -->
<?php echo $CKEditor->editor("information",get_setting("information")); ?> <?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"); ?>"/> <br/><input class="btn btn-primary" type="submit" name="update" value="<?php echo T_("Update centre information"); ?>"/>
</form> </form>
<?php <?php
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,274 +1,274 @@
<?php <?php
/** /**
* Assign clients to questionnaires in a checkbox matrix * Assign clients to questionnaires in a checkbox matrix
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Return if an client has already been assigned to this questionnaire * Return if an client has already been assigned to this questionnaire
* *
* @param int $client Client id * @param int $client Client id
* @param int $questionnaire_id Questionnaire id * @param int $questionnaire_id Questionnaire id
* @return int 1 if assigned otherwise 0 * @return int 1 if assigned otherwise 0
* *
*/ */
function vq($client_id,$questionnaire_id) function vq($client_id,$questionnaire_id)
{ {
global $db; global $db;
$sql = "SELECT client_id,questionnaire_id $sql = "SELECT client_id,questionnaire_id
FROM client_questionnaire FROM client_questionnaire
WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'"; WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'";
$vq = $db->Execute($sql); $vq = $db->Execute($sql);
if ($vq) if ($vq)
return $vq->RecordCount(); return $vq->RecordCount();
else else
return 0; return 0;
} }
/** /**
* Assign an client to a questionnaire * Assign an client to a questionnaire
* *
* @param int $client_id Client id * @param int $client_id Client id
* @param int $questionnaire_id Questionnaire id * @param int $questionnaire_id Questionnaire id
* *
*/ */
function vqi($client_id,$questionnaire_id) function vqi($client_id,$questionnaire_id)
{ {
global $db; global $db;
$sql = "INSERT INTO $sql = "INSERT INTO
client_questionnaire (client_id,questionnaire_id) client_questionnaire (client_id,questionnaire_id)
VALUES('$client_id','$questionnaire_id')"; VALUES('$client_id','$questionnaire_id')";
$db->Execute($sql); $db->Execute($sql);
} }
/** /**
* Unassign an client from a questionnaire * Unassign an client from a questionnaire
* *
* @param int $client_id Client id * @param int $client_id Client id
* @param int $questionnaire_id Questionnaire id * @param int $questionnaire_id Questionnaire id
* *
*/ */
function vqd($client_id,$questionnaire_id) function vqd($client_id,$questionnaire_id)
{ {
global $db; global $db;
$sql = "DELETE FROM $sql = "DELETE FROM
client_questionnaire client_questionnaire
WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'"; WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE $sql = "DELETE
FROM client_questionnaire FROM client_questionnaire
WHERE questionnaire_id IN ( WHERE questionnaire_id IN (
SELECT questionnaire_id SELECT questionnaire_id
FROM questionnaire FROM questionnaire
WHERE enabled = 1)"; WHERE enabled = 1)";
$db->Execute($sql); $db->Execute($sql);
foreach ($_POST as $g => $v) foreach ($_POST as $g => $v)
{ {
$a = explode("_",$g); $a = explode("_",$g);
if ($a[0] == "cb") if ($a[0] == "cb")
vqi($a[2],$a[1]); vqi($a[2],$a[1]);
} }
$db->CompleteTrans(); $db->CompleteTrans();
} }
$sql = "SELECT questionnaire_id,description $sql = "SELECT questionnaire_id,description
FROM questionnaire FROM questionnaire
WHERE enabled = 1 WHERE enabled = 1
ORDER by questionnaire_id ASC"; ORDER by questionnaire_id ASC";
$questionnaires = $db->GetAll($sql); $questionnaires = $db->GetAll($sql);
$sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username $sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username
FROM client FROM client
ORDER by client_id ASC"; ORDER by client_id ASC";
$clients = $db->GetAll($sql); $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")); 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"> <script type="text/javascript">
<?php <?php
print "questionnaire_id = new Array("; print "questionnaire_id = new Array(";
$s = ""; $s = "";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
$s .= "'{$q['questionnaire_id']}',"; $s .= "'{$q['questionnaire_id']}',";
} }
$s = substr($s,0,strlen($s) - 1); $s = substr($s,0,strlen($s) - 1);
print "$s);\n"; print "$s);\n";
print "client_id = new Array("; print "client_id = new Array(";
$s = ""; $s = "";
foreach($clients as $q) foreach($clients as $q)
{ {
$s .= "'{$q['client_id']}',"; $s .= "'{$q['client_id']}',";
} }
$s = substr($s,0,strlen($s) - 1); $s = substr($s,0,strlen($s) - 1);
print "$s);\n"; print "$s);\n";
?> ?>
var QidOn = 0; var QidOn = 0;
var VidOn = 0; var VidOn = 0;
function checkQid(q) function checkQid(q)
{ {
for (y in client_id) for (y in client_id)
{ {
v = client_id[y]; v = client_id[y];
cb = document.getElementById('cb_' + q + "_" + v); cb = document.getElementById('cb_' + q + "_" + v);
if (QidOn == 0) if (QidOn == 0)
cb.checked = 'checked'; cb.checked = 'checked';
else else
cb.checked = ''; cb.checked = '';
} }
if (QidOn == 0) if (QidOn == 0)
QidOn = 1; QidOn = 1;
else else
QidOn = 0; QidOn = 0;
} }
function checkVid(v) function checkVid(v)
{ {
for (y in questionnaire_id) for (y in questionnaire_id)
{ {
q = questionnaire_id[y]; q = questionnaire_id[y];
cb = document.getElementById('cb_' + q + "_" + v); cb = document.getElementById('cb_' + q + "_" + v);
if (VidOn == 0) if (VidOn == 0)
cb.checked = 'checked'; cb.checked = 'checked';
else else
cb.checked = ''; cb.checked = '';
} }
if (VidOn == 0) if (VidOn == 0)
VidOn = 1; VidOn = 1;
else else
VidOn = 0; VidOn = 0;
} }
</script> </script>
</head> </head>
<body> <body>
<?php <?php
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>"; print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Client") . "&emsp;</th>"; print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Client") . "&emsp;</th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>"; print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
} }
print "</tr></thead>"; print "</tr></thead>";
foreach($clients as $v) foreach($clients as $v)
{ {
print "<tr class=''> print "<tr class=''>
<th>&emsp;{$v['username']}&emsp;</th> <th>&emsp;{$v['username']}&emsp;</th>
<th>&emsp;<a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a>&emsp;</th>"; <th>&emsp;<a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a>&emsp;</th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
$checked = ""; $checked = "";
if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"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 "<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 "</tr>";
} }
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></form>"; print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></form>";
xhtml_foot(); xhtml_foot();
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('input').iCheck({ $('input').iCheck({
checkboxClass: 'icheckbox_square-blue', checkboxClass: 'icheckbox_square-blue',
increaseArea: '30%' increaseArea: '30%'
}); });
</script> </script>

View File

@@ -1,179 +1,179 @@
<?php <?php
/** /**
* Create a client and link to a webserver username for authentication * Create a client and link to a webserver username for authentication
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
* @todo Make timezone a drop down list * @todo Make timezone a drop down list
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
global $db; global $db;
$a = false; $a = false;
if (isset($_POST['client'])) if (isset($_POST['client']))
{ {
$client = $db->qstr($_POST['client'],get_magic_quotes_gpc()); $client = $db->qstr($_POST['client'],get_magic_quotes_gpc());
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
$lastname = $db->qstr($_POST['lastname'],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()); $time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
if (!empty($_POST['client'])) if (!empty($_POST['client']))
{ {
$sql = "INSERT INTO client $sql = "INSERT INTO client
(`client_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`) (`client_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`)
VALUES (NULL , $client, $firstname , $lastname, $time_zone_name);"; VALUES (NULL , $client, $firstname , $lastname, $time_zone_name);";
if ($db->Execute($sql)) if ($db->Execute($sql))
{ {
if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false)
{ {
//Get password and add it to the configured htpassword //Get password and add it to the configured htpassword
include_once("../functions/functions.htpasswd.php"); include_once("../functions/functions.htpasswd.php");
$htp = New Htpasswd(HTPASSWD_PATH); $htp = New Htpasswd(HTPASSWD_PATH);
$htg = New Htgroup(HTGROUP_PATH); $htg = New Htgroup(HTGROUP_PATH);
$htp->addUser($_POST['client'],$_POST['password']); $htp->addUser($_POST['client'],$_POST['password']);
$htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT); $htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT);
} }
$a = T_("Added: $client"); $a = T_("Added: $client");
} }
else else
$a = T_("Could not add") . " " . $client . ". " . T_("There may already be a client of this name"); $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")); 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 $sql = "SELECT Time_zone_name as value, Time_zone_name as description
FROM timezone_template"; FROM timezone_template";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if ($a) if ($a)
{ {
?> ?>
<div class='alert alert-info'><?php echo $a; ?></div> <div class='alert alert-info'><?php echo $a; ?></div>
<?php <?php
} }
?> ?>
<script type="text/javascript"> <script type="text/javascript">
//Password generator //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'); 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'); 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'); dig = new Array('0','1','2','3','4','5','6','7','8','9');
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']'); sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function rnd(x,y,z) { function rnd(x,y,z) {
var num; var num;
do { do {
num = parseInt(Math.random()*z); num = parseInt(Math.random()*z);
if (num >= x && num <= y) break; if (num >= x && num <= y) break;
} while (true); } while (true);
return(num); return(num);
} }
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function generate() { function generate() {
var pwd = ''; var pwd = '';
var res, s; var res, s;
var k = 0; var k = 0;
var n = document.addclient.number.value; var n = document.addclient.number.value;
var pass = new Array(); var pass = new Array();
var w = rnd(30,80,100); var w = rnd(30,80,100);
for (var r = 0; r < w; r++) { for (var r = 0; r < w; r++) {
res = rnd(1,25,100); pass[k] = upp[res]; k++; res = rnd(1,25,100); pass[k] = upp[res]; k++;
res = rnd(1,25,100); pass[k] = low[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,9,100); pass[k] = dig[res]; k++;
res = rnd(1,24,100); pass[k] = sym[res]; k++; res = rnd(1,24,100); pass[k] = sym[res]; k++;
} }
for (var i = 0; i < n; i++) { for (var i = 0; i < n; i++) {
s = rnd(1,k-1,100); s = rnd(1,k-1,100);
pwd+= pass[s]; pwd+= pass[s];
} }
document.addclient.password.value = pwd; document.addclient.password.value = pwd;
} }
</script> </script>
<div class="well"> <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_("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> <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" > <form enctype="multipart/form-data" action="" method="post" class="form-horizontal" name="addclient" >
<div class="form-group form-inline"> <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> <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" /> <input name="client" type="text" class="form-control pull-left" required size="40" />
</div> </div>
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?> <?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
<div class="form-group form-inline"> <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> <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,}" /> <input name="password" type="text" class="form-control pull-left" size="40" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" />
<div class="form-inline">&emsp;&emsp; <div class="form-inline">&emsp;&emsp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
<div class="form-group form-inline"> <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> <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" /> <input name="firstname" type="text" class="form-control pull-left" size="40" />
</div> </div>
<div class="form-group form-inline"> <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> <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"/> <input name="lastname" type="text" class="form-control pull-left" size="40"/>
</div> </div>
<div class="form-group form-inline"> <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>"; <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"); ?> display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"pull-left"); ?>
</div> </div>
<input type="submit" value="<?php echo T_("Add a client"); ?>" class="btn btn-primary col-sm-offset-3 col-sm-3"/> <input type="submit" value="<?php echo T_("Add a client"); ?>" class="btn btn-primary col-sm-offset-3 col-sm-3"/>
</form> </form>
<?php <?php
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,242 +1,242 @@
<?php /** <?php /**
* Output data as a fixed width ASCII file * Output data as a fixed width ASCII file
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
if (isset($_GET['key']) || isset($_GET['sample'])) if (isset($_GET['key']) || isset($_GET['sample']))
{ {
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sample_import_id = bigintval($_GET['sample_import_id']); $sample_import_id = bigintval($_GET['sample_import_id']);
$sql = "SELECT sivr.var as value, sivr.var_id as var_id $sql = "SELECT sivr.var as value, sivr.var_id as var_id
FROM `sample_import_var_restrict` as sivr FROM `sample_import_var_restrict` as sivr
WHERE sivr.sample_import_id = $sample_import_id"; WHERE sivr.sample_import_id = $sample_import_id";
$svars = $db->GetAll($sql); $svars = $db->GetAll($sql);
$fn = "key_"; $fn = "key_";
if (isset($_GET['sample'])) $fn = "sample_"; if (isset($_GET['sample'])) $fn = "sample_";
$fn .= T_("ALL") . "_Qid=" . $questionnaire_id . "_Sid=" . $sample_import_id .".csv"; $fn .= T_("ALL") . "_Qid=" . $questionnaire_id . "_Sid=" . $sample_import_id .".csv";
header("Content-Type: text/csv"); header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=$fn"); header("Content-Disposition: attachment; filename=$fn");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past 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("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
echo("token,".T_("Case ID").""); echo("token,".T_("Case ID")."");
foreach($svars as $s) foreach($svars as $s)
{ {
echo("," . $s['value']); echo("," . $s['value']);
} }
if (isset($_GET['sample'])) 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(",".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"); echo("\n");
$sql = "SELECT c.token,c.case_id "; $sql = "SELECT c.token,c.case_id ";
if (isset($_GET['sample'])) $sql .= ", o.description, 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(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 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 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(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 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 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 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 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, (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 "; o.aapor_id ";
$i = 0; $i = 0;
foreach ($svars as $s) foreach ($svars as $s)
{ {
$sql .= ", sv$i.val as v$i"; $sql .= ", sv$i.val as v$i";
$i++; $i++;
} }
$sql .= " FROM sample "; $sql .= " FROM sample ";
//left join if getting whole sample file //left join if getting whole sample file
if (isset($_GET['sample'])) $sql .= "LEFT "; if (isset($_GET['sample'])) $sql .= "LEFT ";
$sql .= "JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id' AND c.sample_id = `sample`.sample_id) "; $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)"; if (isset($_GET['sample'])) $sql .= " LEFT JOIN `outcome` as o ON (o.outcome_id = c.current_outcome_id)";
$i = 0; $i = 0;
foreach ($svars as $s) 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']}') "; $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++; $i++;
} }
$sql .= " WHERE `sample`.import_id = '$sample_import_id'"; $sql .= " WHERE `sample`.import_id = '$sample_import_id'";
$list = $db->GetAll($sql); $list = $db->GetAll($sql);
if (!empty($list)) if (!empty($list))
{ {
foreach($list as $l) foreach($list as $l)
{ {
echo $l['token'] . "," . $l['case_id']; echo $l['token'] . "," . $l['case_id'];
$i = 0; $i = 0;
foreach ($svars as $s) foreach ($svars as $s)
{ {
echo "," . str_replace(","," ",$l["v$i"]); echo "," . str_replace(","," ",$l["v$i"]);
$i++; $i++;
} }
if (isset($_GET['sample'])) 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 "," . 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"; echo "\n";
} }
} }
exit; exit;
} }
if (isset($_GET['sample_var'])){ if (isset($_GET['sample_var'])){
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sample_import_id = bigintval($_GET['sample_import_id']); $sample_import_id = bigintval($_GET['sample_import_id']);
$varid = intval($_GET['sample_var']); $varid = intval($_GET['sample_var']);
$sql = "SELECT c.token, c.case_id, sv.val, sivr.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 FROM `case` as c, `sample_import_var_restrict` as sivr, `sample_var` as sv
WHERE c.questionnaire_id = $questionnaire_id WHERE c.questionnaire_id = $questionnaire_id
AND sivr.sample_import_id = $sample_import_id AND sivr.sample_import_id = $sample_import_id
AND c.sample_id = sv.sample_id AND c.sample_id = sv.sample_id
AND sivr.var_id = sv.var_id AND sivr.var_id = sv.var_id
AND sivr.var_id = $varid"; AND sivr.var_id = $varid";
$list = $db->GetAll($sql); $list = $db->GetAll($sql);
$sample_var = $list[0]['var']; $sample_var = $list[0]['var'];
$fn = "key-" . $sample_var . "_Qid=$questionnaire_id" . "_Sid=" . $sample_import_id .".csv"; $fn = "key-" . $sample_var . "_Qid=$questionnaire_id" . "_Sid=" . $sample_import_id .".csv";
header("Content-Type: text/csv"); header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=$fn"); header("Content-Disposition: attachment; filename=$fn");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past 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("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
echo("token,caseid,$sample_var\n"); echo("token,caseid,$sample_var\n");
if (!empty($list)) if (!empty($list))
{ {
foreach($list as $l) foreach($list as $l)
{ {
echo $l['token'] . "," . $l['case_id'] . "," . $l['val'] . "\n"; echo $l['token'] . "," . $l['case_id'] . "," . $l['val'] . "\n";
} }
} }
exit; exit;
} }
xhtml_head(T_("Data output"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); 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") . ":&emsp;</h3>"; print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a questionnaire") . ":&emsp;</h3>";
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); 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"); display_questionnaire_chooser($questionnaire_id,false,"form-inline col-sm-3 pull-left", "form-control");
if ($questionnaire_id) if ($questionnaire_id)
{ {
$sql = "SELECT lime_sid $sql = "SELECT lime_sid
FROM questionnaire FROM questionnaire
WHERE questionnaire_id = $questionnaire_id"; WHERE questionnaire_id = $questionnaire_id";
$ls = $db->GetRow($sql); $ls = $db->GetRow($sql);
$lsid = $ls['lime_sid']; $lsid = $ls['lime_sid'];
print "&emsp;<a href='" . LIME_URL . "admin/admin.php?action=exportresults&amp;sid=$lsid' class='btn btn-default fa btn-lime'>". T_("Download data for this questionnaire via Limesurvey") . "</a></div>"; print "&emsp;<a href='" . LIME_URL . "admin/admin.php?action=exportresults&amp;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") . ":&emsp;</h3>"; print "<div class='form-group clearfix'><h3 class='col-sm-4 text-right'>" . T_("Please select a sample") . ":&emsp;</h3>";
$sample_import_id = false; $sample_import_id = false;
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); 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"); display_sample_chooser($questionnaire_id,$sample_import_id,false,"form-inline col-sm-3 pull-left", "form-control");
if ($sample_import_id) if ($sample_import_id)
{ {
print "&emsp;<a href='" .LIME_URL . "admin/admin.php?action=exportresults&amp;sid=$lsid&amp;quexsfilterinc=$questionnaire_id:$sample_import_id' class='btn btn-default fa btn-lime'>" . T_("Download data for this sample via Limesurvey") . "</a></div>"; print "&emsp;<a href='" .LIME_URL . "admin/admin.php?action=exportresults&amp;sid=$lsid&amp;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 //get sample vars
$sql = "SELECT sivr.var_id as value, sivr.var as description $sql = "SELECT sivr.var_id as value, sivr.var as description
FROM `sample_import_var_restrict` as sivr FROM `sample_import_var_restrict` as sivr
WHERE sivr.sample_import_id = $sample_import_id"; WHERE sivr.sample_import_id = $sample_import_id";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
//download a key file linking the caseid to the sample //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") . ":&emsp;</h3>"; print "<div class='form-group '><h3 class='col-sm-4 text-right'>" . T_("Download key file: select sample var") . ":&emsp;</h3>";
display_chooser($rs,"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id",true,true,false,true,"form-inline col-sm-3 pull-left"); display_chooser($rs,"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id",true,true,false,true,"form-inline col-sm-3 pull-left");
print "</div><div class=' col-sm-4'>"; print "</div><div class=' col-sm-4'>";
//download complete key file //download complete key file
print "<a href='?key=key&amp;questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete key file") . "</a></br></br>"; print "<a href='?key=key&amp;questionnaire_id=$questionnaire_id&amp;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 //download complete sample file with outcomes
print "<a href='?sample=sample&amp;questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete sample file with current outcomes") . "</a></div>"; print "<a href='?sample=sample&amp;questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' class='btn btn-default fa'>" . T_("Download complete sample file with current outcomes") . "</a></div>";
} }
} }
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,279 +1,279 @@
<?php /** <?php /**
* Display appointments * Display appointments
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Operator functions * Operator functions
*/ */
include ("../functions/functions.operator.php"); include ("../functions/functions.operator.php");
/** /**
* Input functions * Input functions
*/ */
include ("../functions/functions.input.php"); include ("../functions/functions.input.php");
/** /**
* Calendar functions * Calendar functions
*/ */
include ("../functions/functions.calendar.php"); include ("../functions/functions.calendar.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css", "../include/jquery-ui/jquery-ui.min.css",
"../include/timepicker/jquery-ui.min.css", "../include/timepicker/jquery-ui.min.css",
"../include/timepicker/jquery-ui-timepicker-addon.css", "../include/timepicker/jquery-ui-timepicker-addon.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
"../include/timepicker/jquery-ui.min.js", "../include/timepicker/jquery-ui.min.js",
//"../include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js", //"../include/jquery-ui/jquery-ui.min.js",
"../include/timepicker/jquery-ui-timepicker-addon.js", "../include/timepicker/jquery-ui-timepicker-addon.js",
"../include/timepicker/jquery-ui-timepicker-ru.js", "../include/timepicker/jquery-ui-timepicker-ru.js",
); );
$js_foot = array( $js_foot = array(
"../js/bootstrap-confirmation.js", "../js/bootstrap-confirmation.js",
"../js/custom.js" "../js/custom.js"
); );
//create new or update appointment //create new or update appointment
if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update'])) if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update']))
{ {
$start = $db->qstr($_GET['start']); $start = $db->qstr($_GET['start']);
$end = $db->qstr($_GET['end']); $end = $db->qstr($_GET['end']);
$contact_phone_id = bigintval($_GET['contact_phone_id']); $contact_phone_id = bigintval($_GET['contact_phone_id']);
$respondent_id = bigintval($_GET['respondent_id']); $respondent_id = bigintval($_GET['respondent_id']);
$require_operator_id = "NULL"; $require_operator_id = "NULL";
if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']); if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']);
if ($_GET['new'] == 'create'){ if ($_GET['new'] == 'create'){
$case_id = bigintval($_GET['case_id']); $case_id = bigintval($_GET['case_id']);
$operator_id = get_operator_id(); $operator_id = get_operator_id();
if ($operator_id == false) die(); if ($operator_id == false) die();
$sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '$respondent_id'"; $sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '$respondent_id'";
$respondent_tz = $db->GetOne($sql); $respondent_tz = $db->GetOne($sql);
// create a call attempt // create a call attempt
$sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end) $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'))"; 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); $db->Execute($sql);
$call_attempt_id = $db->Insert_ID(); $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) $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)"; 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); $db->Execute($sql);
$appointment_id = $db->Insert_ID(); $appointment_id = $db->Insert_ID();
$_GET['appointment_id'] = $appointment_id; $_GET['appointment_id'] = $appointment_id;
$appointment_id = bigintval($_GET['appointment_id']); $appointment_id = bigintval($_GET['appointment_id']);
} else { } else {
$appointment_id = bigintval($_GET['appointment_id']); $appointment_id = bigintval($_GET['appointment_id']);
//Edit this appointment in the database //Edit this appointment in the database
$sql = "UPDATE appointment as a, respondent as r $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 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 WHERE a.appointment_id = $appointment_id
AND r.respondent_id = $respondent_id"; AND r.respondent_id = $respondent_id";
$db->Execute($sql); $db->Execute($sql);
} }
unset ($_GET['start'],$_GET['end'],$_GET['appointment_id'],$_GET['case_id'],$_GET['new'],$_GET['update']); 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']))) if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(($_GET['new'] == 'new') && isset($_GET['case_id'])))
{ {
$appointment_id = bigintval($_GET['appointment_id']); $appointment_id = bigintval($_GET['appointment_id']);
$case_id = bigintval($_GET['case_id']); $case_id = bigintval($_GET['case_id']);
if (isset($_GET['delete'])) if (isset($_GET['delete']))
{ {
$sql = "DELETE FROM appointment $sql = "DELETE FROM appointment
WHERE appointment_id = '$appointment_id'"; WHERE appointment_id = '$appointment_id'";
$db->Execute($sql); $db->Execute($sql);
xhtml_head(T_("Now modify case outcome"),true,$css,$js_head); 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> 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>"; <a href='supervisor.php?case_id=$case_id' class='btn btn-default'>" . T_("Modify case outcome") . "</a></div>";
} }
else else
{ {
//Display an edit form //Display an edit form
if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID&ensp;" . $appointment_id;} if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID&ensp;" . $appointment_id;}
xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle); xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle);
$lang = DEFAULT_LOCALE; $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"; $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']; $rs = $db->GetRow($sql); $startdate = $rs['startdate'];$enddate = $rs['enddate'];
print "<script type='text/javascript'> print "<script type='text/javascript'>
$(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end'); $(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end');
$.timepicker.datetimeRange( $.timepicker.datetimeRange(
startDateTextBox,endDateTextBox,{ startDateTextBox,endDateTextBox,{
minInterval: (1000*60*15), // 15min minInterval: (1000*60*15), // 15min
numberOfMonths: 2, numberOfMonths: 2,
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
timeFormat: 'HH:mm:ss', timeFormat: 'HH:mm:ss',
showSecond: false, showSecond: false,
regional: '$lang', regional: '$lang',
hourMin: 9, hourMin: 9,
hourMax: 21, hourMax: 21,
stepMinute: 5, stepMinute: 5,
hourGrid: 2, hourGrid: 2,
minuteGrid: 10, minuteGrid: 10,
minDate: '$startdate', minDate: '$startdate',
maxDate: '$enddate', maxDate: '$enddate',
});});</script>"; });});</script>";
if ($_GET['new'] =='new'){ if ($_GET['new'] =='new'){
$start = $startdate; $start = $startdate;
$end = $enddate; $end = $enddate;
$rtz = $_GET['rtz']; $rtz = $_GET['rtz'];
} }
if (isset($_GET['appointment_id'])) { 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 $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 FROM `appointment` as a, respondent as r
WHERE a.appointment_id = '$appointment_id' WHERE a.appointment_id = '$appointment_id'
AND a.case_id = '$case_id' AND a.case_id = '$case_id'
AND r.respondent_id = a.respondent_id"; AND r.respondent_id = a.respondent_id";
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
if (!empty($rs)){ if (!empty($rs)){
$respondent_id = $rs['respondent_id']; $respondent_id = $rs['respondent_id'];
$contact_phone_id = $rs['contact_phone_id']; $contact_phone_id = $rs['contact_phone_id'];
$require_operator_id = $rs['require_operator_id']; $require_operator_id = $rs['require_operator_id'];
$start = $rs['start']; $start = $rs['start'];
$end = $rs['end']; $end = $rs['end'];
$rtz = $rs['rtz']; $rtz = $rs['rtz'];
} }
} }
print "<form action='?' method='get' class='form-horizontal'>"; 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>"; 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, 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 CASE when respondent_id = '$respondent_id' THEN 'selected=\'selected\'' ELSE '' END as selected
FROM respondent FROM respondent
WHERE case_id = '$case_id'"),"respondent_id","respondent_id",false,false,false,true,false,true,"pull-left"); 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>"; 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, 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 CASE when contact_phone_id = '$contact_phone_id' THEN 'selected=\'selected\'' ELSE '' END as selected
FROM contact_phone FROM contact_phone
WHERE case_id = '$case_id'"), WHERE case_id = '$case_id'"),
"contact_phone_id","contact_phone_id",false,false,false,true,false,true,"pull-left"); "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>"; 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); date_default_timezone_set($rtz);
print "<label class='text-right col-sm-2 control-label'>" . T_("Respondent TimeZone") . ":</label> 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> <h4 class='col-sm-2 text-danger text-uppercase fa-lg'>" . $rtz . "</h4>
<label class=''>" . T_("Respondent Time") . ":&emsp;<b class='fa fa-2x '>" . date("H:i:s") . "</b></label>"; <label class=''>" . T_("Respondent Time") . ":&emsp;<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> 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>"; <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> 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>"; <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>"; 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, $ops = $db->GetAll("SELECT o.operator_id as value,
CONCAT(o.firstName, ' ', o.lastName) as description, CONCAT(o.firstName, ' ', o.lastName) as description,
CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected
FROM operator as o"); FROM operator as o");
$selected = "selected=\'selected\'"; $selected = "selected=\'selected\'";
foreach($ops as $o) foreach($ops as $o)
{ {
if (!empty($o['selected'])) if (!empty($o['selected']))
{ {
$selected = ""; $selected = "";
break; break;
} }
} }
array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected)); 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"); 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'/>"; 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'/>";} 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/> 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>&emsp;" . T_("Cancel edit") . "</a></div>"; <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>&emsp;" . 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>&emsp;" . T_("Save changes") . "</button></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>&emsp;" . 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&amp;appointment_id=$appointment_id&amp;case_id=$case_id' ><i class='fa fa-trash fa-lg text-danger'></i>&emsp;" . T_("Delete this appointment") . "</a></div>"; print "<div class='col-sm-2'><a href='' class='btn btn-default pull-right' toggle='confirmation' data-placement='left' data-href='?delete=delete&amp;appointment_id=$appointment_id&amp;case_id=$case_id' ><i class='fa fa-trash fa-lg text-danger'></i>&emsp;" . T_("Delete this appointment") . "</a></div>";
print "</form>"; print "</form>";
} }
} }
else { else {
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$subtitle = T_("Appointments"); $subtitle = T_("Appointments");
xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30); //array("../css/table.css") 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>"; 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, $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=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link, CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link,
CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho
FROM appointment as a 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) 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 (`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 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 WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
ORDER BY a.start ASC"; ORDER BY a.start ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!empty($rs)) { if (!empty($rs)) {
translate_array($rs,array("outcome")); 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"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table"); 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"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table");
} else print "<h4 class='well text-info'>" . T_("No future appointments") . "</h4>"; } 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>"; 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, $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=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link, CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link,
CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit
FROM appointment as a 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) 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) 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 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 GROUP BY c.case_id
ORDER BY a.start ASC"; ORDER BY a.start ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!empty($rs)) { 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"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Respondent"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table"); xhtml_table($rs,array("description","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Respondent"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table");
} else print "<h4 class='well text-info'>" . T_("No appointments missed") . "</h4>"; } else print "<h4 class='well text-info'>" . T_("No appointments missed") . "</h4>";
} }
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('[toggle="confirmation"]').confirmation() $('[toggle="confirmation"]').confirmation()
</script> </script>

View File

@@ -1,269 +1,269 @@
<?php /** <?php /**
* Display extension status * Display extension status
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2010 * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2010
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/software/ queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
$msg = ""; $msg = "";
if (isset($_GET)) if (isset($_GET))
{ {
foreach($_GET as $key=>$val) foreach($_GET as $key=>$val)
{ {
if (substr($key,0,12) == "operator_id_") if (substr($key,0,12) == "operator_id_")
{ {
if (isset($_GET['extension_id'])) if (isset($_GET['extension_id']))
{ {
$ex = intval($_GET['extension_id']); $ex = intval($_GET['extension_id']);
$op = intval($val); $op = intval($val);
$sql = "UPDATE `extension` $sql = "UPDATE `extension`
SET current_operator_id = $op SET current_operator_id = $op
WHERE extension_id = $ex WHERE extension_id = $ex
AND current_operator_id IS NULL"; AND current_operator_id IS NULL";
$db->Execute($sql); $db->Execute($sql);
} }
} }
} }
} }
if (isset($_POST['extension'])) if (isset($_POST['extension']))
{ {
$extension = $db->qstr($_POST['extension']); $extension = $db->qstr($_POST['extension']);
$password = $db->qstr($_POST['password']); $password = $db->qstr($_POST['password']);
$extension_id = "NULL"; $extension_id = "NULL";
if (isset($_POST['extensionid'])) if (isset($_POST['extensionid']))
$extension_id = intval($_POST['extensionid']); $extension_id = intval($_POST['extensionid']);
if (isset($_POST['delete'])) if (isset($_POST['delete']))
{ {
$sql = "DELETE FROM `extension` $sql = "DELETE FROM `extension`
WHERE current_operator_id IS NULL WHERE current_operator_id IS NULL
AND extension_id = $extension_id"; AND extension_id = $extension_id";
$rs = $db->Execute($sql); $rs = $db->Execute($sql);
if (!$rs) if (!$rs)
$msg = ("Failed to delete extension. There may be an operator currently assigned to it"); $msg = ("Failed to delete extension. There may be an operator currently assigned to it");
} }
else else
{ {
if (!empty($_POST['extension'])) if (!empty($_POST['extension']))
{ {
$sql = "INSERT INTO `extension` (extension_id,extension,password) $sql = "INSERT INTO `extension` (extension_id,extension,password)
VALUES ($extension_id,$extension,$password) VALUES ($extension_id,$extension,$password)
ON DUPLICATE KEY UPDATE extension=$extension,password=$password"; ON DUPLICATE KEY UPDATE extension=$extension,password=$password";
$rs = $db->Execute($sql); $rs = $db->Execute($sql);
if (!$rs) if (!$rs)
$msg = T_("Failed to add extension. There already may be an extension of this name"); $msg = T_("Failed to add extension. There already may be an extension of this name");
} }
} }
} }
if (isset($_GET['unassign'])) if (isset($_GET['unassign']))
{ {
$e = intval($_GET['unassign']); $e = intval($_GET['unassign']);
$db->StartTrans(); $db->StartTrans();
$sql = "SELECT e.current_operator_id $sql = "SELECT e.current_operator_id
FROM `extension` as e FROM `extension` as e
LEFT JOIN `case` as c ON (c.current_operator_id = e.current_operator_id) LEFT JOIN `case` as c ON (c.current_operator_id = e.current_operator_id)
WHERE e.extension_id = $e WHERE e.extension_id = $e
AND c.case_id IS NULL"; AND c.case_id IS NULL";
$cid = $db->GetOne($sql); $cid = $db->GetOne($sql);
if (!empty($cid)) if (!empty($cid))
{ {
$sql = "UPDATE `extension` as e $sql = "UPDATE `extension` as e
SET current_operator_id = NULL SET current_operator_id = NULL
WHERE extension_id = $e WHERE extension_id = $e
AND current_operator_id = $cid"; AND current_operator_id = $cid";
$db->Execute($sql); $db->Execute($sql);
} }
$db->CompleteTrans(); $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")); xhtml_head(T_("Extensions & status"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
?> ?>
<script type="text/javascript"> <script type="text/javascript">
//Password generator //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'); 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'); 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'); dig = new Array('0','1','2','3','4','5','6','7','8','9');
//sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']'); //sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function rnd(x,y,z) { function rnd(x,y,z) {
var num; var num;
do { do {
num = parseInt(Math.random()*z); num = parseInt(Math.random()*z);
if (num >= x && num <= y) break; if (num >= x && num <= y) break;
} while (true); } while (true);
return(num); return(num);
} }
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function generate() { function generate() {
var pwd = ''; var pwd = '';
var res, s; var res, s;
var k = 0; var k = 0;
var n = document.editext.number.value; var n = document.editext.number.value;
var pass = new Array(); var pass = new Array();
var w = rnd(30,80,100); var w = rnd(30,80,100);
for (var r = 0; r < w; r++) { for (var r = 0; r < w; r++) {
res = rnd(1,25,100); pass[k] = upp[res]; k++; res = rnd(1,25,100); pass[k] = upp[res]; k++;
res = rnd(1,25,100); pass[k] = low[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,9,100); pass[k] = dig[res]; k++;
//res = rnd(1,24,100); pass[k] = sym[res]; k++; //res = rnd(1,24,100); pass[k] = sym[res]; k++;
} }
for (var i = 0; i < n; i++) { for (var i = 0; i < n; i++) {
s = rnd(1,k-1,100); s = rnd(1,k-1,100);
pwd+= pass[s]; pwd+= pass[s];
} }
document.editext.password.value = pwd; document.editext.password.value = pwd;
} }
</script> </script>
<?php <?php
if (isset($_GET['edit']) || isset($_GET['addext'])) if (isset($_GET['edit']) || isset($_GET['addext']))
{ {
if (isset($_GET['edit'])){ if (isset($_GET['edit'])){
$sql = "SELECT extension,password,current_operator_id $sql = "SELECT extension,password,current_operator_id
FROM extension FROM extension
WHERE extension_id = " . intval($_GET['edit']); WHERE extension_id = " . intval($_GET['edit']);
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
} }
print "<a href='?' class='btn btn-default pull-left'>" . T_("Go back") . "</a>"; print "<a href='?' class='btn btn-default pull-left'>" . T_("Go back") . "</a>";
?> ?>
<div class="panel-body "> <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> <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"> <form enctype="multipart/form-data" action="?" method="post" name="editext" class="form-horizontal">
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Extension name: ");?></label> <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"/> <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>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Extension password: ");?></label> <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");?>"/>&emsp;&emsp;<?php echo T_(" or ");?>&ensp; <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");?>"/>&emsp;&emsp;<?php echo T_(" or ");?>&ensp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("New password");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("New password");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters long");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters long");?>
</div> </div>
<div class=" col-sm-offset-3 "> <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"); ?>" /> <input type="submit" class="btn btn-primary " value="<?php if (isset($_GET['edit'])) echo T_("Save changes"); else echo T_("Add extension"); ?>" />
</div> </div>
<?php if (isset($_GET['edit'])){?> <?php if (isset($_GET['edit'])){?>
<input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/> <input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/>
<?php if (empty($rs['current_operator_id'])) { ?> <?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"); ?>" /> <input type="submit" name="delete" class="btn btn-danger " data-toggle="confirmation" value="<?php echo T_("Delete extension"); ?>" />
<?php } else <?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 "</br></br><b class='well text-danger'>" . T_("Unassign the operator from this extension to be able to delete it") . "</b>";
} }
print "</form></div>"; print "</form></div>";
} }
else else
{ {
$sql= "SELECT CONCAT('<a href=\'operatorlist.php?edit=',o.operator_id,'\'>',o.firstName,' ', o.lastname,'</a>') as firstName, $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, 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' 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, ,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 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, 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, 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.status as vs,
e.extension_id e.extension_id
FROM extension as e FROM extension as e
LEFT JOIN `operator` as o ON (o.operator_id = e.current_operator_id) 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 `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_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) 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"; ORDER BY e.extension_id ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if ($msg != "") if ($msg != "")
print "<p>$msg</p>"; print "<p>$msg</p>";
if (!empty($rs)) if (!empty($rs))
{ {
$sql = "SELECT o.operator_id as value, o.firstName as description $sql = "SELECT o.operator_id as value, o.firstName as description
FROM `operator` as o FROM `operator` as o
LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id) LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id)
WHERE e.extension_id IS NULL"; WHERE e.extension_id IS NULL";
$ers = $db->GetAll($sql); $ers = $db->GetAll($sql);
for ($i = 0; $i < count($rs); $i++) for ($i = 0; $i < count($rs); $i++)
{ {
if ($rs[$i]['assignment'] == "list") 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); $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'>"; 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")); 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>"; print "</div>";
} }
else else
print "<p>" . T_("No extensions") . "</p>"; 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>"; print "<div class='col-sm-3'><a href='?addext=addext' class='btn btn-default '>" . T_("Add extension") . "</a></div>";
} }
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,155 +1,155 @@
<?php <?php
/** /**
* Import a sample from a Headered CSV file * Import a sample from a Headered CSV file
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Sample import functions * Sample import functions
*/ */
include("../functions/functions.import.php"); include("../functions/functions.import.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", "../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
); );
$js_foot = array( $js_foot = array(
"../js/bootstrap-filestyle.min.js", "../js/bootstrap-filestyle.min.js",
"../js/custom.js" "../js/custom.js"
); );
if (isset($_POST['import_form'])) if (isset($_POST['import_form']))
{ {
//form has been submitted //form has been submitted
$subtitle = T_("Validating and uploading"); $subtitle = T_("Validating and uploading");
xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle); 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>&emsp;" . T_("Go back") . "</a>"; echo "<a href='?' class='btn btn-default pull-left' ><i class='fa fa-chevron-left fa-lg text-primary'></i>&emsp;" . T_("Go back") . "</a>";
//verify each GET field is unique (except import_form) //verify each GET field is unique (except import_form)
$sfields = array(); $sfields = array();
foreach($_POST as $getv => $val) foreach($_POST as $getv => $val)
//clean up? //clean up?
$sfields[$getv] = $val; $sfields[$getv] = $val;
$error = verify_fields($sfields); $error = verify_fields($sfields);
$description = $_POST['description']; $description = $_POST['description'];
if ($error == "") if ($error == "")
{ //verified so upload { //verified so upload
if (import_file($_POST['filename'],$description,$sfields)) if (import_file($_POST['filename'],$description,$sfields))
{ {
print "<div class='well text-primary col-md-offset-2'><p>" . T_("Successfully imported sample") . "&emsp;<h3>$description</h3></p></div>"; print "<div class='well text-primary col-md-offset-2'><p>" . T_("Successfully imported sample") . "&emsp;<h3>$description</h3></p></div>";
} }
else else
{ {
print -"<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error importing file. Please try again") . "</p></div>"; print -"<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error importing file. Please try again") . "</p></div>";
} }
} }
else 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>"; 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 //verifiy that exactly one primary phone number is selected
//upload to database //upload to database
xhtml_foot($js_foot); xhtml_foot($js_foot);
} }
else if (isset($_POST['import_file'])) else if (isset($_POST['import_file']))
{ {
//file has been submitted //file has been submitted
$subtitle = T_("Select columns to import"); $subtitle = T_("Select columns to import");
xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle); 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>&emsp;" . T_("Go back") . "</a>"; 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>&emsp;" . T_("Go back") . "</a>";
print "<form action='' method='post' class='col-md-10 form-group col-md-offset-1'>"; print "<form action='' method='post' class='col-md-10 form-group col-md-offset-1'>";
$tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO"); $tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO");
move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname); move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname);
display_table(get_first_row($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="description" value="<?php if (isset($_POST['description'])) print($_POST['description']); ?>"/>
<input type="hidden" name="filename" value="<?php echo $tmpfname; ?>"/> <input type="hidden" name="filename" value="<?php echo $tmpfname; ?>"/>
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label" for="submit"></label> <label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4"> <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>&emsp;<?php echo T_("Add sample"); ?></button> <button id="submit" type="submit" name="import_form" class="btn btn-primary"><i class="fa fa-plus-square-o fa-lg"></i>&emsp;<?php echo T_("Add sample"); ?></button>
</div> </div>
</div> </div>
</form> </form>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
} }
else else
{ {
//need to supply file to upload //need to supply file to upload
$subtitle = T_("Select file to upload"); $subtitle = T_("Select file to upload");
xhtml_head(T_("Import sample") .":",true,$css,$js_head,false,false,false,$subtitle); 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>&emsp;" . T_("Go back") . "</a>"; echo "<a href='' onclick='history.back();return false;' class='btn btn-default'><i class='fa fa-chevron-left fa-lg text-primary'></i>&emsp;" . T_("Go back") . "</a>";
$ua = $_SERVER['HTTP_USER_AGENT']; $ua = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv"; if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv";
//print "ua=" . $_SERVER['HTTP_USER_AGENT']; //print "ua=" . $_SERVER['HTTP_USER_AGENT'];
?> ?>
<form class="form-horizontal col-sm-12 " enctype="multipart/form-data" action="" method="post"> <form class="form-horizontal col-sm-12 " enctype="multipart/form-data" action="" method="post">
<fieldset> <fieldset>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /> <input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
<!-- File Button --> <!-- File Button -->
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label" for="file"><?php echo T_("Choose the CSV sample file to upload"); ?>:</label> <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"> <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; ?>" /> <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>
</div> </div>
<!-- Text input--> <!-- Text input-->
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label" for="description"><?php echo T_("Sample description"); ?>:</label> <label class="col-md-4 control-label" for="description"><?php echo T_("Sample description"); ?>:</label>
<div class="col-md-4"> <div class="col-md-4">
<input id="description" name="description" type="text" required placeholder="<?php echo T_("Enter new sample name..."); ?>" class="form-control"> <input id="description" name="description" type="text" required placeholder="<?php echo T_("Enter new sample name..."); ?>" class="form-control">
</div> </div>
</div> </div>
<!-- Button --> <!-- Button -->
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label" for="submit"></label> <label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4"> <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>&emsp;<?php echo T_("Add sample"); ?></button> <button id="submit" type="submit" name="import_file" class="btn btn-primary"><i class="fa fa-plus-square-o fa-lg"></i>&emsp;<?php echo T_("Add sample"); ?></button>
</div> </div>
</div> </div>
</fieldset> </fieldset>
</form> </form>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
} }
?> ?>

View File

@@ -1,198 +1,198 @@
<?php <?php
/* /*
* Display an index of Admin tools * Display an index of Admin tools
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*/ */
/** /**
* Language file * Language file
*/ */
include ("../lang.inc.php"); include ("../lang.inc.php");
/** /**
* Config file * Config file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
$username = $_SERVER['PHP_AUTH_USER']; $username = $_SERVER['PHP_AUTH_USER'];
?> ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" style="" class=" " > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" style="" class=" " >
<head> <head>
<meta charset="utf-8" > <meta charset="utf-8" >
<title><?php echo T_("Administrative Tools") ;?> </title> <title><?php echo T_("Administrative Tools") ;?> </title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<link rel="stylesheet" href="../include/bootstrap-3.3.2/css/bootstrap.min.css" /> <link rel="stylesheet" href="../include/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="../include/font-awesome-4.3.0/css/font-awesome.css" /> <link rel="stylesheet" href="../include/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="../css/style.css" /> <link rel="stylesheet" href="../css/style.css" />
</head> </head>
<body> <body>
<div class="page-header-fixed navbar navbar-fixed-top " role="banner"> <div class="page-header-fixed navbar navbar-fixed-top " role="banner">
<div class="container" style=" width: auto; padding-left: 1px;"> <div class="container" style=" width: auto; padding-left: 1px;">
<div class="navbar-header"> <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 ");?>"> <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> <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> <a class="navbar-brand" href="index.php"><?php echo COMPANY_NAME ;?> <span class="bold"><?php echo ADMIN_PANEL_NAME ;?></span></a>
</div > </div >
<ul class="nav navbar-nav pull-right"> <ul class="nav navbar-nav pull-right">
<li class="dropdown pull-right user-data"> <li class="dropdown pull-right user-data">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style=" min-width: 160px;"> <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:") . "&ensp;" . $username ;?> <i class="fa fa-user fa fa-fw "></i><?php print T_("Logged as:") . "&ensp;" . $username ;?>
</a> </a>
<!--- User menu // not connected to pages so not working yet // could be hidden --> <!--- User menu // not connected to pages so not working yet // could be hidden -->
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li><a href="?page=settings.php"><i class="fa fa-cogs fa-fw "></i>&ensp;<?php print T_("Settings"); ?></a></li> <li><a href="?page=settings.php"><i class="fa fa-cogs fa-fw "></i>&ensp;<?php print T_("Settings"); ?></a></li>
<li><a href="../screenloc.php"><i class="fa fa-lock fa-fw "></i>&ensp;<?php print T_("Lock Screen"); ?></a></li> <li><a href="../screenloc.php"><i class="fa fa-lock fa-fw "></i>&ensp;<?php print T_("Lock Screen"); ?></a></li>
<li><a href="../logout.php"><i class="fa fa-sign-out fa-fw "></i>&ensp;<?php print T_("Logout"); ?> </a></li> <li><a href="../logout.php"><i class="fa fa-sign-out fa-fw "></i>&ensp;<?php print T_("Logout"); ?> </a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="content "> <div class="content ">
<!-- Sidebar menu --> <!-- Sidebar menu -->
<div class="sidebar" > <div class="sidebar" >
<ul class="panel-group nav" id="nav"> <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><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> <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=""> <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=<?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=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=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=<?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> <li><a href="?page=questionnaireprefill.php"><i class="fa fa-thumb-tack fa-fw"></i><?php print T_("Pre-fill questionnaire") ;?></a></li>
</ul> </ul>
</li> </li>
<li class="has_sub"><a href="" class=""><i class="fa fa-book fa-lg"></i><span><?php print T_("Samples") ;?></span></a> <li class="has_sub"><a href="" class=""><i class="fa fa-book fa-lg"></i><span><?php print T_("Samples") ;?></span></a>
<ul style=""> <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=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=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=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> <li><a href="?page=assignsample.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign samples to questionnaires") ;?></a></li>
</ul> </ul>
</li> </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> <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=""> <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=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=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=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=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> <li><a href="?page=addshift.php"><i class="fa fa-calendar-o fa-fw"></i><?php print T_("Shift management") ;?></a></li>
</ul> </ul>
</li> </li>
<li class="has_sub"><a href="" class=""><i class="fa fa-filter fa-lg"></i><span><?php print T_("Quotas") ;?></span></a> <li class="has_sub"><a href="" class=""><i class="fa fa-filter fa-lg"></i><span><?php print T_("Quotas") ;?></span></a>
<ul style=""> <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=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> <li><a href="?page=quotarow.php"><i class="fa fa-list-ul fa-fw "></i><?php print T_("Quota row management") ;?></a></li>
</ul> </ul>
</li> </li>
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-users"></i><span><?php print T_("Operators") ;?></span></a> <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=""> <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=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=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=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=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=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> <li><a href="?page=operatorperformance.php"><i class="fa fa-signal fa-fw"></i><?php print T_("Operator performance") ;?></a></li>
</ul> </ul>
</li> </li>
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-line-chart"></i><span><?php print T_("Results") ;?></span></a> <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=""> <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=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=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=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=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=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=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> <li><a href="?page=dataoutput.php"><i class="fa fa-download fa-fw"></i><?php print T_("Data output") ;?></a></li>
</ul> </ul>
</li> </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> <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=""> <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=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> <li><a href="?page=clientquestionnaire.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign clients to questionnaires") ;?></a></li>
</ul> </ul>
</li> </li>
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-briefcase"></i><span><?php print T_("Supervisor functions") ;?></span></a> <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=""> <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=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=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> <li><a href="?page=bulkappointment.php"><i class="fa fa-th-list fa-fw"></i><?php print T_("Bulk appointment generator") ;?></a></li>
</ul> </ul>
</li> </li>
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-gear"></i><span><?php print T_("System settings") ;?></span></a> <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=""> <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=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=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=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=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=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=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> <li><a href="?page=systemsort.php"><i class="fa fa-sort fa-fw"></i><?php print T_("System wide case sorting") ;?></a></li>
</ul> </ul>
</li> </li>
<?php <?php
if (VOIP_ENABLED == true ) 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> <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=""> <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=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> --> <!-- <li><a href="?page=extensionstatus.php"><i class="fa fa-asterisk fa-fw"></i><?php //print T_("Extension status") ;?></a></li> -->
</ul> </ul>
</li> </li>
<?php } else {; ?> <?php } else {; ?>
<li class=""><a href="" class=""><i class="fa fa-lg fa-tty"></i><span><?php print T_("VoIP") . "&ensp;" . T_("Disabled") ;?><i class="fa fa-toggle-off pull-right" style="font-size:1.5em !important; margin-right:20px;"></i></span></a></li> <li class=""><a href="" class=""><i class="fa fa-lg fa-tty"></i><span><?php print T_("VoIP") . "&ensp;" . T_("Disabled") ;?><i class="fa fa-toggle-off pull-right" style="font-size:1.5em !important; margin-right:20px;"></i></span></a></li>
<?php }; ?> <?php }; ?>
</ul> </ul>
</div> </div>
<!-- Main page container --> <!-- Main page container -->
<?php $page = "questionnairelist.php"; if (isset($_GET['page'])) $page = $_GET['page']; ?> <?php $page = "questionnairelist.php"; if (isset($_GET['page'])) $page = $_GET['page']; ?>
<div class="mainbar" id=" "><?php xhtml_object($page,' '); ?></div> <div class="mainbar" id=" "><?php xhtml_object($page,' '); ?></div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<script src="../js/jquery-2.1.3.min.js"></script> <script src="../include/jquery/jquery.min.js"></script>
<script src="../include/bootstrap-3.3.2/js/bootstrap.min.js"></script> <script src="../include/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/admin.js"></script> <script type="text/javascript" src="../js/admin.js"></script>
</body> </body>
</html> </html>

View File

@@ -1,378 +1,378 @@
<?php <?php
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", "../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
); );
$js_foot = array( $js_foot = array(
"../js/new.js", "../js/new.js",
"../js/custom.js" "../js/custom.js"
); );
global $db; global $db;
xhtml_head(T_("Create a new questionnaire"),true,$css,$js_head); xhtml_head(T_("Create a new questionnaire"),true,$css,$js_head);
if (isset($_POST['import_file'])) if (isset($_POST['import_file']))
{ {
//file has been submitted //file has been submitted
$ras =0; $ras =0;
$rws = 0; $rws = 0;
$testing = 0; $testing = 0;
$referral = 0; $referral = 0;
$rs = 0; $rs = 0;
$lime_sid = 0; $lime_sid = 0;
$respsc = 0; $respsc = 0;
$lime_rs_sid = "NULL"; $lime_rs_sid = "NULL";
if (isset($_POST['ras'])) $ras = 1; if (isset($_POST['ras'])) $ras = 1;
if (isset($_POST['rws'])) $rws = 1; if (isset($_POST['rws'])) $rws = 1;
if (isset($_POST['testing'])) $testing = 1; if (isset($_POST['testing'])) $testing = 1;
if (isset($_POST['respsc'])) $respsc = 1; if (isset($_POST['respsc'])) $respsc = 1;
if (isset($_POST['referral'])) $respsc = 1; if (isset($_POST['referral'])) $respsc = 1;
if ($_POST['selectrs'] != "none") $rs = 1; if ($_POST['selectrs'] != "none") $rs = 1;
$name = $db->qstr($_POST['description']); $name = $db->qstr($_POST['description']);
$rs_intro = $db->qstr(html_entity_decode($_POST['rs_intro'],ENT_QUOTES,'UTF-8')); $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_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_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_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')); $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')); $info = $db->qstr(html_entity_decode($_POST['info'],ENT_QUOTES,'UTF-8'));
//use existing lime instrument //use existing lime instrument
$lime_sid = bigintval($_POST['select']); $lime_sid = bigintval($_POST['select']);
if (is_numeric($_POST['selectrs'])) if (is_numeric($_POST['selectrs']))
{ {
$lime_rs_sid = bigintval($_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) $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)"; 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); $rs = $db->Execute($sql);
if ($rs) if ($rs)
{ {
$qid = $db->Insert_ID(); $qid = $db->Insert_ID();
if ($respsc == 1) if ($respsc == 1)
{ {
$lime_mode = $db->qstr($_POST['lime_mode']); $lime_mode = $db->qstr($_POST['lime_mode']);
$lime_template = $db->qstr($_POST['lime_template']); $lime_template = $db->qstr($_POST['lime_template']);
$lime_endurl = $db->qstr($_POST['lime_endurl']); $lime_endurl = $db->qstr($_POST['lime_endurl']);
$sql = "UPDATE questionnaire $sql = "UPDATE questionnaire
SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl
WHERE questionnaire_id = $qid"; WHERE questionnaire_id = $qid";
$db->Execute($sql); $db->Execute($sql);
} }
$cl = info; $cl = info;
$message = T_("Successfully inserted") . "&ensp;" . T_("with ID") . "&ensp; $qid, </h4><h4>" . T_("linked to survey") . "&ensp; $lime_sid "; $message = T_("Successfully inserted") . "&ensp;" . T_("with ID") . "&ensp; $qid, </h4><h4>" . T_("linked to survey") . "&ensp; $lime_sid ";
} }
else{ else{
$cl = danger; $cl = danger;
$message = T_("Error: Failed to insert questionnaire"); $message = T_("Error: Failed to insert questionnaire");
} }
?> ?>
<script type="text/javascript" > <script type="text/javascript" >
$(function() { $(function() {
$('#modal-confirm').modal('show'); $('#modal-confirm').modal('show');
}); });
</script> </script>
<?php <?php
$_POST['import_file'] = false; $_POST['import_file'] = false;
} }
?> ?>
<!-- Modal window confirmation start --> <!-- Modal window confirmation start -->
<div class="modal fade " id="modal-confirm"> <div class="modal fade " id="modal-confirm">
<div class="modal-dialog "> <div class="modal-dialog ">
<div class="modal-content "> <div class="modal-content ">
<div class="modal-header" style="border-bottom:none;"> <div class="modal-header" style="border-bottom:none;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-header"><?php echo T_("Questionnaire");?>&emsp; <strong class="text-<?php echo $cl;?>"> <?php echo $name; ?></strong></h4> <h4 class="modal-header"><?php echo T_("Questionnaire");?>&emsp; <strong class="text-<?php echo $cl;?>"> <?php echo $name; ?></strong></h4>
</div> </div>
<div class="modal-body "> <div class="modal-body ">
<div class="alert alert-<?php echo $cl;?> text-center" role="alert"> <div class="alert alert-<?php echo $cl;?> text-center" role="alert">
<h4> <?php print $message ;?></h4> <h4> <?php print $message ;?></h4>
</div> </div>
</div> </div>
<div class="modal-footer" style="borfer-top:none"> <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>&emsp;<?php echo T_("Create another ?");?><br><?php echo T_("Questionnaire");?></button> &emsp; <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>&emsp;<?php echo T_("Create another ?");?><br><?php echo T_("Questionnaire");?></button> &emsp;
<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");?>&ensp;<br><?php echo T_("Questionnaire management");?></a> <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");?>&ensp;<br><?php echo T_("Questionnaire management");?></a>
</div> </div>
</div> </div>
</div> </div>
</div><!-- /modal end --> </div><!-- /modal end -->
<!-- create new questionnaire --> <!-- create new questionnaire -->
<body> <body>
<a href="questionnairelist.php" class="btn btn-default pull-left" ><i class="fa fa-list text-primary"></i>&emsp;<?php echo T_("Go to");?>&ensp;<?php echo T_("Questionnaire management");?> </a> <a href="questionnairelist.php" class="btn btn-default pull-left" ><i class="fa fa-list text-primary"></i>&emsp;<?php echo T_("Go to");?>&ensp;<?php echo T_("Questionnaire management");?> </a>
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal col-lg-12" > <form enctype="multipart/form-data" action="" method="post" class="form-horizontal col-lg-12" >
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /> <input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
<div class="form-group"> <div class="form-group">
<label class="col-lg-4 control-label" ><?php echo T_("Name for questionnaire:"); ?> </label> <label class="col-lg-4 control-label" ><?php echo T_("Name for questionnaire:"); ?> </label>
<div class="col-lg-4"> <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:") ; ?>" /> <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>
</div> </div>
<?php <?php
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title $sql = "SELECT s.sid as sid, sl.surveyls_title AS title
FROM " . LIME_PREFIX . "surveys AS s FROM " . LIME_PREFIX . "surveys AS s
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id) LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
WHERE s.active = 'Y' WHERE s.active = 'Y'
GROUP BY s.sid"; GROUP BY s.sid";
$surveys = $db->GetAll($sql); $surveys = $db->GetAll($sql);
?> ?>
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-4 control-label" ><?php echo T_("Select limesurvey instrument:");?> </label> <label class="col-sm-4 control-label" ><?php echo T_("Select limesurvey instrument:");?> </label>
<div class='col-sm-4'> <div class='col-sm-4'>
<?php if (!empty($surveys)){?> <?php if (!empty($surveys)){?>
<select name="select" class="form-control"> <select name="select" class="form-control">
<?php foreach($surveys as $s){?> <?php foreach($surveys as $s){?>
<option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:"), "&ensp;", $s['title'] ;?></option><?php } ?> <option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:"), "&ensp;", $s['title'] ;?></option><?php } ?>
</select> </select>
<?php } else { ?> <?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>&emsp;<?php echo T_("Create an instrument in Limesurvey") ;?></a> <?php } ?> <a class="btn btn-lime" href="<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-lemon-o text-danger"></i>&emsp;<?php echo T_("Create an instrument in Limesurvey") ;?></a> <?php } ?>
</div> </div>
<div class='col-sm-4'> <div class='col-sm-4'>
<strong><?php echo T_("or") ;?>&emsp;</strong> <strong><?php echo T_("or") ;?>&emsp;</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>&emsp;<?php echo T_("Create an instrument in Limesurvey") ;?></a> <a class="btn btn-lime" href="<?php echo LIME_URL ;?>admin/admin.php?action=newsurvey"><i class="fa fa-lemon-o text-danger"></i>&emsp;<?php echo T_("Create an instrument in Limesurvey") ;?></a>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Respondent selection type:"); ?> </label> <label class="col-sm-4 control-label" ><?php echo T_("Respondent selection type:"); ?> </label>
<div class="col-sm-4"> <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')"> <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="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> <option value="old" ><?php echo T_("Use basic respondent selection text (below)"); ?></option>
<?php <?php
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title $sql = "SELECT s.sid as sid, sl.surveyls_title AS title
FROM " . LIME_PREFIX . "surveys AS s FROM " . LIME_PREFIX . "surveys AS s
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id) LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
WHERE s.active = 'Y'"; WHERE s.active = 'Y'";
$surveys = $db->GetAll($sql); $surveys = $db->GetAll($sql);
if (!empty($surveys)){ foreach($surveys as $s){ ?> if (!empty($surveys)){ foreach($surveys as $s){ ?>
<option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:") ,"&ensp;", $s['title'] ;?></option> <option value="<?php echo $s['sid'];?>"><?php echo T_("Existing instrument:") ,"&ensp;", $s['title'] ;?></option>
<?php } } ?> <?php } } ?>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Restrict appointments to shifts?"); ?></label> <label class="col-sm-4 control-label" ><?php echo T_("Restrict appointments to shifts?"); ?></label>
<div class="col-sm-4" style="height: 30px;"> <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" /> <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> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Restrict work to shifts?"); ?></label> <label class="col-sm-4 control-label" ><?php echo T_("Restrict work to shifts?"); ?></label>
<div class="col-sm-4"style="height: 30px;"> <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"/> <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> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Questionnaire for testing only?"); ?></label> <label class="col-sm-4 control-label" ><?php echo T_("Questionnaire for testing only?"); ?></label>
<div class="col-sm-4"style="height: 30px;"> <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" /> <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> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Allow operators to generate referrals?"); ?></label> <label class="col-sm-4 control-label" ><?php echo T_("Allow operators to generate referrals?"); ?></label>
<div class="col-sm-4"style="height: 30px;"> <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"/> <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> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Allow for respondent self completion via email invitation?"); ?> </label> <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;"> <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"/> <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> </div>
<div id="limesc" style="display:none" > <div id="limesc" style="display:none" >
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Questionnaire display mode for respondent");?>: </label> <label class="col-sm-4 control-label" ><?php echo T_("Questionnaire display mode for respondent");?>: </label>
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-control" name="lime_mode"> <select class="form-control" name="lime_mode">
<option value="survey"><?php echo T_("All in one"); ?></option> <option value="survey"><?php echo T_("All in one"); ?></option>
<option value="question"><?php echo T_("Question by question"); ?></option> <option value="question"><?php echo T_("Question by question"); ?></option>
<option value="group"><?php echo T_("Group at a time"); ?></option> <option value="group"><?php echo T_("Group at a time"); ?></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ><?php echo T_("Limesurvey template for respondent");?>: </label> <label class="col-sm-4 control-label" ><?php echo T_("Limesurvey template for respondent");?>: </label>
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-control" name="lime_template"> <select class="form-control" name="lime_template">
<?php <?php
if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/templates")) { if ($handle = opendir(dirname(__FILE__)."/../include/limesurvey/templates")) {
while (false !== ($entry = readdir($handle))) { while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/templates/" . $entry)){ if ($entry != "." && $entry != ".." && is_dir(dirname(__FILE__)."/../include/limesurvey/templates/" . $entry)){
echo "<option value=\"$entry\">$entry</option>"; echo "<option value=\"$entry\">$entry</option>";
} }
} }
closedir($handle); closedir($handle);
} }
?> ?>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <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> <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"> <div class="col-sm-4">
<input class="form-control" name="lime_endurl" id="url" type="url" placeholder="<?php print SITE_URL ;?>" /> <input class="form-control" name="lime_endurl" id="url" type="url" placeholder="<?php print SITE_URL ;?>" />
</div> </div>
</div> </div>
</div> </div>
<?php <?php
/* CKEditor */ /* CKEditor */
include("../include/ckeditor/ckeditor.php"); include("../include/ckeditor/ckeditor.php");
$CKEditor = new CKEditor(); $CKEditor = new CKEditor();
$CKEditor->basePath = "../include/ckeditor/"; $CKEditor->basePath = "../include/ckeditor/";
$ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"), $ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"),
array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"), array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"),
array("Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"), array("Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"),
array('Link','Unlink','Anchor'), array('Link','Unlink','Anchor'),
array('Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'), array('Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'),
array('About'), array('About'),
"/", "/",
array("Bold","Italic","Underline","Strike","-","Subscript","Superscript"), array("Bold","Italic","Underline","Strike","-","Subscript","Superscript"),
array("NumberedList","BulletedList","-","Outdent","Indent","Blockquote"), array("NumberedList","BulletedList","-","Outdent","Indent","Blockquote"),
array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'), array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
array('BidiLtr', 'BidiRtl'), array('BidiLtr', 'BidiRtl'),
array('Styles','Format','Font','FontSize'), array('Styles','Format','Font','FontSize'),
array('TextColor','BGColor')), array('TextColor','BGColor')),
"extraPlugins" => "tokens"); "extraPlugins" => "tokens");
?> ?>
<div id="rstext" class=" " style="display:none "> <div id="rstext" class=" " style="display:none ">
<div class="panel panel-default" > <div class="panel panel-default" >
<div class="panel-heading"> <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> <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> <h3 class="panel-title text-primary "><?php echo T_("Respondent selection introduction:");?></h3>
</div> </div>
<div class="content"> <div class="content">
<?php echo $CKEditor->editor("rs_intro","",$ckeditorConfig);?> <?php echo $CKEditor->editor("rs_intro","",$ckeditorConfig);?>
</div> </div>
</div> </div>
<div class="panel panel-default" > <div class="panel panel-default" >
<div class="panel-heading"> <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> <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> <h3 class="panel-title text-primary "><?php echo T_("Respondent selection project introduction:");?></h3>
</div> </div>
<div class="content"> <div class="content">
<?php echo $CKEditor->editor("rs_project_intro","",$ckeditorConfig);?> <?php echo $CKEditor->editor("rs_project_intro","",$ckeditorConfig);?>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <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> <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> <h3 class="panel-title text-primary"><?php echo T_("Respondent selection callback (already started questionnaire):");?></h3>
</div> </div>
<div class="content"> <div class="content">
<?php echo $CKEditor->editor("rs_callback","",$ckeditorConfig);?> <?php echo $CKEditor->editor("rs_callback","",$ckeditorConfig);?>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <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> <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> <h3 class="panel-title "><?php echo T_("Message to leave on an answering machine:");?></h3>
</div> </div>
<div class="content"> <div class="content">
<?php echo $CKEditor->editor("rs_answeringmachine","",$ckeditorConfig);?> <?php echo $CKEditor->editor("rs_answeringmachine","",$ckeditorConfig);?>
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <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> <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> <h3 class="panel-title "><?php echo T_("Project end text (thank you screen):");?></h3>
</div> </div>
<div class="content" > <div class="content" >
<?php echo $CKEditor->editor("rs_project_end","",$ckeditorConfig); ?> <?php echo $CKEditor->editor("rs_project_end","",$ckeditorConfig); ?>
</div> </div>
</div> </div>
<div class="panel panel-default "> <div class="panel panel-default ">
<div class="panel-heading"> <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> <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> <h3 class="panel-title"><?php echo T_("Project information for interviewers/operators:");?></h3>
</div> </div>
<div class="content"> <div class="content">
<?php echo $CKEditor->editor("info","",$ckeditorConfig);?> <?php echo $CKEditor->editor("info","",$ckeditorConfig);?>
</div> </div>
</div> </div>
<div class="row form-group"> <div class="row form-group">
<div class="col-sm-4 "> <div class="col-sm-4 ">
<a href="questionnairelist.php" class="btn btn-default pull-right" ><i class="fa fa-list text-primary"></i>&emsp;<?php echo T_("Go to");?>&ensp;<?php echo T_("Questionnaire management");?></a> <a href="questionnairelist.php" class="btn btn-default pull-right" ><i class="fa fa-list text-primary"></i>&emsp;<?php echo T_("Go to");?>&ensp;<?php echo T_("Questionnaire management");?></a>
</div> </div>
<div class="col-sm-4 "> <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>&emsp;<?php echo T_("Create Questionnaire"); ?></button> <button type="submit" class="btn btn-default pull-right" name="import_file" ><i class="fa fa-check-square-o fa-lg text-primary"></i>&emsp;<?php echo T_("Create Questionnaire"); ?></button>
</div> </div>
</div> </div>
</form> </form>
<?php <?php
xhtml_foot($js_foot);// xhtml_foot($js_foot);//
?> ?>

View File

@@ -1,406 +1,406 @@
<?php <?php
/** /**
* List operators and allow for customised VoIP downloads, changing passwords, disabling, etc * List operators and allow for customised VoIP downloads, changing passwords, disabling, etc
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2007,2008,2009,2010,2011 * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2007,2008,2009,2010,2011
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/software queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database * Database
*/ */
include_once(dirname(__FILE__).'/../db.inc.php'); include_once(dirname(__FILE__).'/../db.inc.php');
/** /**
* XHTML functions * XHTML functions
*/ */
include_once(dirname(__FILE__).'/../functions/functions.xhtml.php'); include_once(dirname(__FILE__).'/../functions/functions.xhtml.php');
$display = true; $display = true;
$msg = ""; $msg = "";
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$operator_id = intval($_POST['operator_id']); $operator_id = intval($_POST['operator_id']);
$chat_enable = $voip = $enabled = 0; $chat_enable = $voip = $enabled = 0;
if (isset($_POST['voip'])) $voip = 1; if (isset($_POST['voip'])) $voip = 1;
if (isset($_POST['chat_enable'])) $chat_enable = 1; if (isset($_POST['chat_enable'])) $chat_enable = 1;
if (isset($_POST['enabled'])) $enabled = 1; if (isset($_POST['enabled'])) $enabled = 1;
if (HTPASSWD_PATH !== false && $_POST['existing_username'] != $_POST['username'] && empty($_POST['password'])) 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>"; $msg = "<div class='alert alert-danger'><h3>" . T_("If changing usernames, you must specify a new password") . "</h3></div>";
} }
else else
{ {
$sql = "UPDATE operator $sql = "UPDATE operator
SET username = " . $db->qstr($_POST['username']) . ", SET username = " . $db->qstr($_POST['username']) . ",
lastName = " . $db->qstr($_POST['lastName']) . ", lastName = " . $db->qstr($_POST['lastName']) . ",
firstName = " . $db->qstr($_POST['firstName']) . ", firstName = " . $db->qstr($_POST['firstName']) . ",
chat_user = " . $db->qstr($_POST['chat_user']) . ", chat_user = " . $db->qstr($_POST['chat_user']) . ",
chat_password = " . $db->qstr($_POST['chat_password']) . ", chat_password = " . $db->qstr($_POST['chat_password']) . ",
Time_zone_name = " . $db->qstr($_POST['timezone']) . ", Time_zone_name = " . $db->qstr($_POST['timezone']) . ",
voip = $voip, enabled = $enabled, chat_enable = $chat_enable voip = $voip, enabled = $enabled, chat_enable = $chat_enable
WHERE operator_id = $operator_id"; WHERE operator_id = $operator_id";
$rs = $db->Execute($sql); $rs = $db->Execute($sql);
if (!empty($rs)) if (!empty($rs))
{ {
//only update extension if we aren't on a case //only update extension if we aren't on a case
$sql = "SELECT case_id $sql = "SELECT case_id
FROM `case` FROM `case`
WHERE current_operator_id = $operator_id"; WHERE current_operator_id = $operator_id";
$cc= $db->GetOne($sql); $cc= $db->GetOne($sql);
if (empty($cc)) if (empty($cc))
{ {
$sql = "UPDATE extension $sql = "UPDATE extension
SET current_operator_id = NULL SET current_operator_id = NULL
WHERE current_operator_id= $operator_id"; WHERE current_operator_id= $operator_id";
$db->Execute($sql); $db->Execute($sql);
if (!empty($_POST['extension_id'])) if (!empty($_POST['extension_id']))
{ {
$sql = "UPDATE extension $sql = "UPDATE extension
SET current_operator_id = $operator_id SET current_operator_id = $operator_id
WHERE extension_id = " . intval($_POST['extension_id']); WHERE extension_id = " . intval($_POST['extension_id']);
$db->Execute($sql); $db->Execute($sql);
} }
} }
if (HTPASSWD_PATH !== false && !empty($_POST['password'])) if (HTPASSWD_PATH !== false && !empty($_POST['password']))
{ {
//update password in htaccess //update password in htaccess
include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php'); include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php');
$htp = New Htpasswd(HTPASSWD_PATH); $htp = New Htpasswd(HTPASSWD_PATH);
$htp->deleteUser($_POST["existing_username"]); $htp->deleteUser($_POST["existing_username"]);
$htp->deleteUser($_POST["username"]); $htp->deleteUser($_POST["username"]);
$htp->addUser($_POST["username"],$_POST["password"]); $htp->addUser($_POST["username"],$_POST["password"]);
$htg = New Htgroup(HTGROUP_PATH); $htg = New Htgroup(HTGROUP_PATH);
$htg->deleteUserFromGroup($_POST["existing_username"],HTGROUP_INTERVIEWER); $htg->deleteUserFromGroup($_POST["existing_username"],HTGROUP_INTERVIEWER);
$htg->addUserToGroup($_POST["username"],HTGROUP_INTERVIEWER); $htg->addUserToGroup($_POST["username"],HTGROUP_INTERVIEWER);
} }
$msg = "<div class='alert alert-info'><h3>" . T_("Successfully updated user") . ": " . $_POST['username'] . "</h3></div>"; $msg = "<div class='alert alert-info'><h3>" . T_("Successfully updated user") . ": " . $_POST['username'] . "</h3></div>";
} }
else 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>"; $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; $_GET['edit'] = $operator_id;
} }
if (isset($_GET['edit'])) 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")); 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']); $operator_id = intval($_GET['edit']);
$sql = "SELECT * $sql = "SELECT *
FROM operator FROM operator
WHERE operator_id = $operator_id"; WHERE operator_id = $operator_id";
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
$sql = "SELECT Time_zone_name as value, Time_zone_name as description $sql = "SELECT Time_zone_name as value, Time_zone_name as description
FROM timezone_template"; FROM timezone_template";
$tz = $db->GetAll($sql); $tz = $db->GetAll($sql);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
//Password generator //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'); 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'); 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'); dig = new Array('0','1','2','3','4','5','6','7','8','9');
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']'); sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function rnd(x,y,z) { function rnd(x,y,z) {
var num; var num;
do { do {
num = parseInt(Math.random()*z); num = parseInt(Math.random()*z);
if (num >= x && num <= y) break; if (num >= x && num <= y) break;
} while (true); } while (true);
return(num); return(num);
} }
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function generate() { function generate() {
var pwd = ''; var pwd = '';
var res, s; var res, s;
var k = 0; var k = 0;
var n = document.operform.number.value; var n = document.operform.number.value;
var pass = new Array(); var pass = new Array();
var w = rnd(30,80,100); var w = rnd(30,80,100);
for (var r = 0; r < w; r++) { for (var r = 0; r < w; r++) {
res = rnd(1,25,100); pass[k] = upp[res]; k++; res = rnd(1,25,100); pass[k] = upp[res]; k++;
res = rnd(1,25,100); pass[k] = low[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,9,100); pass[k] = dig[res]; k++;
res = rnd(1,24,100); pass[k] = sym[res]; k++; res = rnd(1,24,100); pass[k] = sym[res]; k++;
} }
for (var i = 0; i < n; i++) { for (var i = 0; i < n; i++) {
s = rnd(1,k-1,100); s = rnd(1,k-1,100);
pwd+= pass[s]; pwd+= pass[s];
} }
document.operform.password.value = pwd; document.operform.password.value = pwd;
} }
</script> </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"> <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 <?php
print "<h3>" . T_("Operator") . ": " . $rs['username'] . "</h3>"; print "<h3>" . T_("Operator") . ": " . $rs['username'] . "</h3>";
echo "</div></div>"; echo "</div></div>";
if (!empty($msg)) echo $msg; if (!empty($msg)) echo $msg;
$sql = "SELECT extension_id as value, extension as description, $sql = "SELECT extension_id as value, extension as description,
CASE WHEN current_operator_id = $operator_id THEN 'selected=\'selected\'' ELSE '' END AS selected CASE WHEN current_operator_id = $operator_id THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM extension FROM extension
WHERE current_operator_id IS NULL WHERE current_operator_id IS NULL
OR current_operator_id = $operator_id"; OR current_operator_id = $operator_id";
$ers = $db->GetAll($sql); $ers = $db->GetAll($sql);
?> ?>
<form action="?" method="post" class="form-horizontal panel-body" name="operform"> <form action="?" method="post" class="form-horizontal panel-body" name="operform">
<div class="form-group"> <div class="form-group">
<label for="username" class="col-sm-3 control-label"><?php echo T_("Username") . ": "; ?></label> <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 class="col-sm-3"><input type='text' name='username' class="form-control" value="<?php echo $rs['username'];?>"/></div>
</div> </div>
<?php if (HTPASSWD_PATH !== false) { ?> <?php if (HTPASSWD_PATH !== false) { ?>
<div class="form-group"> <div class="form-group">
<label for="password" class="col-sm-3 control-label"><?php echo T_("Password") . ": "; ?></label> <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-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">&emsp; <div class="col-sm-6 form-inline">&emsp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default"/>&emsp;<?php echo T_("Password with");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default"/>&emsp;<?php echo T_("Password with");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
<div class="form-group"> <div class="form-group">
<label for="firstName" class="col-sm-3 control-label"><?php echo T_("First name") . ": "; ?></label> <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 class="col-sm-3"><input type='text' name='firstName' class="form-control" value="<?php echo $rs['firstName'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="lastName" class="col-sm-3 control-label"><?php echo T_("Last name") . ": "; ?></label> <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 class="col-sm-3"><input type='text' name='lastName' class="form-control" value="<?php echo $rs['lastName'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="timezone" class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label> <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-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"> <div class="col-sm-6 form-inline">
<?php echo T_("Edit") . "&emsp;";?> <?php echo T_("Edit") . "&emsp;";?>
<a href='timezonetemplate.php' class="btn btn-default"><?php echo T_("TimeZones list");?></a> <a href='timezonetemplate.php' class="btn btn-default"><?php echo T_("TimeZones list");?></a>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="extension_id" class="col-sm-3 control-label"><?php echo T_("Extension") . ": "; ?></label> <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-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"> <div class="col-sm-6 form-inline">
<?php echo T_("Edit") . "&emsp;";?> <?php echo T_("Edit") . "&emsp;";?>
<a href='extensionstatus.php' class="btn btn-default"><?php echo T_("Extensions");?></a> <a href='extensionstatus.php' class="btn btn-default"><?php echo T_("Extensions");?></a>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="voip" class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label> <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 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>
<div class="form-group"> <div class="form-group">
<label for="chat_user" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": "; ?></label> <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 class="col-sm-3"><input type='text' name='chat_user' class="form-control" value="<?php echo $rs['chat_user'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="chat_password" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": "; ?></label> <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 class="col-sm-3"><input type='text' name='chat_password' class="form-control" value="<?php echo $rs['chat_password'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="chat_enable" class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label> <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 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>
<div class="form-group"> <div class="form-group">
<label for="enabled" class="col-sm-3 control-label"><?php echo T_("Enabled") . "? ";?></label> <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 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>
<div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></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><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> <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> </form>
<?php <?php
xhtml_foot(); xhtml_foot();
exit(); exit();
} }
if (isset($_GET['voipdisable'])) if (isset($_GET['voipdisable']))
{ {
$operator_id = intval($_GET['voipdisable']); $operator_id = intval($_GET['voipdisable']);
$sql = "UPDATE operator $sql = "UPDATE operator
SET voip = 0 SET voip = 0
WHERE operator_id = '$operator_id'"; WHERE operator_id = '$operator_id'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['voipenable'])) if (isset($_GET['voipenable']))
{ {
$operator_id = intval($_GET['voipenable']); $operator_id = intval($_GET['voipenable']);
$sql = "UPDATE operator $sql = "UPDATE operator
SET voip = 1 SET voip = 1
WHERE operator_id = '$operator_id'"; WHERE operator_id = '$operator_id'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['disable'])) if (isset($_GET['disable']))
{ {
$operator_id = intval($_GET['disable']); $operator_id = intval($_GET['disable']);
$sql = "UPDATE operator $sql = "UPDATE operator
SET enabled = 0 SET enabled = 0
WHERE operator_id = '$operator_id'"; WHERE operator_id = '$operator_id'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['enable'])) if (isset($_GET['enable']))
{ {
$operator_id = intval($_GET['enable']); $operator_id = intval($_GET['enable']);
$sql = "UPDATE operator $sql = "UPDATE operator
SET enabled = 1 SET enabled = 1
WHERE operator_id = '$operator_id'"; WHERE operator_id = '$operator_id'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['operator_id'])) if (isset($_GET['operator_id']))
{ {
$operator_id = intval($_GET['operator_id']); $operator_id = intval($_GET['operator_id']);
$sql = "SELECT *,SUBSTRING_INDEX(e.extension, '/', -1) as ext $sql = "SELECT *,SUBSTRING_INDEX(e.extension, '/', -1) as ext
FROM extension as e FROM extension as e
WHERE e.current_operator_id = $operator_id"; WHERE e.current_operator_id = $operator_id";
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
if (!empty($rs)) if (!empty($rs))
{ {
$display = false; $display = false;
if (isset($_GET['winbat']) || isset($_GET['sh'])) if (isset($_GET['winbat']) || isset($_GET['sh']))
{ {
header("Content-Type: text/txt"); header("Content-Type: text/txt");
if (isset($_GET['winbat'])) if (isset($_GET['winbat']))
header("Content-Disposition: attachment; filename=operator_$operator_id.bat"); header("Content-Disposition: attachment; filename=operator_$operator_id.bat");
else else
header("Content-Disposition: attachment; filename=operator_$operator_id.sh"); header("Content-Disposition: attachment; filename=operator_$operator_id.sh");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past 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("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: public"); // HTTP/1.0 header("Pragma: public"); // HTTP/1.0
if (isset($_GET['winbat'])) if (isset($_GET['winbat']))
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME']; echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
else else
echo "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME']; echo "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
} }
} }
} }
if ($display) if ($display)
{ {
$sql = "SELECT operator_id, $sql = "SELECT operator_id,
CONCAT(firstName, ' ', lastName) as name, CONCAT(firstName, ' ', lastName) as name,
CONCAT ('<a href=\'extensionstatus.php?edit=',e.extension_id,'\'>', e.extension ,'</a>') as `extension`, CONCAT ('<a href=\'extensionstatus.php?edit=',e.extension_id,'\'>', e.extension ,'</a>') as `extension`,
CONCAT('<a href=\'?winbat=winbat&amp;operator_id=',operator_id,'\'>" . TQ_("Win .bat file") . "</a>') as winbat, CONCAT('<a href=\'?winbat=winbat&amp;operator_id=',operator_id,'\'>" . TQ_("Win .bat file") . "</a>') as winbat,
CONCAT('<a href=\'?sh=sh&amp;operator_id=',operator_id,'\'>" . TQ_("*nix script file") . "</a>') as sh, CONCAT('<a href=\'?sh=sh&amp;operator_id=',operator_id,'\'>" . TQ_("*nix script file") . "</a>') as sh,
CASE WHEN enabled = 0 THEN CASE WHEN enabled = 0 THEN
CONCAT('&ensp;<a href=\'?enable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Enable") . "\' class=\'fa fa-toggle-off fa-2x\' style=\'color:grey;\'></i></a>&ensp;') CONCAT('&ensp;<a href=\'?enable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Enable") . "\' class=\'fa fa-toggle-off fa-2x\' style=\'color:grey;\'></i></a>&ensp;')
ELSE ELSE
CONCAT('&ensp;<a href=\'?disable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Disable") . "\' class=\'fa fa-toggle-on fa-2x\'></i></a>&ensp;') CONCAT('&ensp;<a href=\'?disable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Disable") . "\' class=\'fa fa-toggle-on fa-2x\'></i></a>&ensp;')
END as enabledisable, END as enabledisable,
CASE WHEN voip = 0 THEN CASE WHEN voip = 0 THEN
CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . TQ_("Enable VoIP") . "</a>') CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . TQ_("Enable VoIP") . "</a>')
ELSE ELSE
CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . TQ_("Disable VoIP") . "</a>') CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . TQ_("Disable VoIP") . "</a>')
END as voipenabledisable, END as voipenabledisable,
CONCAT('&emsp;<a href=\'?edit=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\' class=\'fa fa-pencil-square-o fa-lg\'></i></a>&emsp;') as edit, username CONCAT('&emsp;<a href=\'?edit=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\' class=\'fa fa-pencil-square-o fa-lg\'></i></a>&emsp;') as edit, username
FROM operator FROM operator
LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)"; LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)";
$rs = $db->GetAll($sql); $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")); 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"); $columns = array("operator_id","name","username","extension","enabledisable","edit");
$titles = array("ID",T_("Operator"),T_("Username"),T_("Extension"),"&emsp;<i class='fa fa-lg fa-power-off '></i>","&emsp;<i class='fa fa-lg fa-pencil-square-o'></i>"); $titles = array("ID",T_("Operator"),T_("Username"),T_("Extension"),"&emsp;<i class='fa fa-lg fa-power-off '></i>","&emsp;<i class='fa fa-lg fa-pencil-square-o'></i>");
if (VOIP_ENABLED) if (VOIP_ENABLED)
{ {
$columns[] = "voipenabledisable"; $columns[] = "voipenabledisable";
$columns[] = "winbat"; $columns[] = "winbat";
$columns[] = "sh"; $columns[] = "sh";
$titles[] = T_("VoIP ON/Off"); $titles[] = T_("VoIP ON/Off");
$titles[] = T_("Win file");//Windows VoIP $titles[] = T_("Win file");//Windows VoIP
$titles[] = T_("*nix flle");//*nix VoIP $titles[] = T_("*nix flle");//*nix VoIP
} }
echo "<div class=' col-sm-10'><div class=' panel-body'>"; echo "<div class=' col-sm-10'><div class=' panel-body'>";
xhtml_table($rs,$columns,$titles); xhtml_table($rs,$columns,$titles);
echo "</div></div>"; echo "</div></div>";
echo "<div class='form-group col-sm-2'> 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>&emsp;" . T_("Add an operator") . "</a></div> <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>&emsp;" . 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>&emsp;" . T_("Extensions") . "</a></div> <div class='panel-body'><a href='extensionstatus.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-whatsapp'></i>&emsp;" . 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='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>&emsp;" . T_("Operator skills") . "</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>&emsp;" . 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>&emsp;" . T_("Operator performance") . "</a></div>"; <div class='panel-body'><a href='operatorperformance.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-signal'></i>&emsp;" . T_("Operator performance") . "</a></div>";
if (VOIP_ENABLED) 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 "<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>&emsp;" . T_("Download Win file") . "</a></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>&emsp;" . 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>&emsp;" . T_("Download Linux file") . "</a></div>"; 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>&emsp;" . T_("Download Linux file") . "</a></div>";
} }
print "</div>"; print "</div>";
xhtml_foot(); xhtml_foot();
} }
?> ?>

View File

@@ -1,110 +1,110 @@
<?php /** <?php /**
* Display operator performance * Display operator performance
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Performance functions * Performance functions
*/ */
include("../functions/functions.performance.php"); include("../functions/functions.performance.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
/** /**
* Operator functions * Operator functions
*/ */
include("../functions/functions.operator.php"); 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")); 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()); //$rs = get_stats_total(get_stats());
//print "<h2>" . T_("Overall") . "</h2>"; //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"))); //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; $questionnaire_id = false;
print "<h3 class='form-inline pull-left'>" . T_("Please select a questionnaire") . "&emsp;</h3>"; print "<h3 class='form-inline pull-left'>" . T_("Please select a questionnaire") . "&emsp;</h3>";
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
display_questionnaire_chooser($questionnaire_id,false,"form-inline clearfix", "form-control"); display_questionnaire_chooser($questionnaire_id,false,"form-inline clearfix", "form-control");
if ($questionnaire_id) if ($questionnaire_id)
{ {
$rs = get_stats_total(get_stats_by_questionnaire($questionnaire_id)); $rs = get_stats_total(get_stats_by_questionnaire($questionnaire_id));
print "<h2>" . T_("This project") . "</h2>"; 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"))); 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(); $operator_id = get_operator_id();
$shift_id = false; $shift_id = false;
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']); 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 $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 FROM shift as s
LEFT JOIN (operator as o) on (o.operator_id = '$operator_id') LEFT JOIN (operator as o) on (o.operator_id = '$operator_id')
WHERE s.questionnaire_id = '$questionnaire_id' WHERE s.questionnaire_id = '$questionnaire_id'
ORDER BY s.start ASC"; ORDER BY s.start ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
print "</br><h3 class='form-inline pull-left'>" . T_("Please select a shift") . "&emsp;</h3>"; print "</br><h3 class='form-inline pull-left'>" . T_("Please select a shift") . "&emsp;</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" 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) if ($shift_id)
{ {
$rs = get_stats_total(get_stats_by_shift($questionnaire_id,$shift_id)); $rs = get_stats_total(get_stats_by_shift($questionnaire_id,$shift_id));
print "<h2>" . T_("This shift") . "</h2>"; 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_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(); xhtml_foot();
?> ?>

View File

@@ -1,279 +1,279 @@
<?php <?php
/** /**
* Assign operators to questionnaires in a checkbox matrix * Assign operators to questionnaires in a checkbox matrix
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Return if an operator has already been assigned to this questionnaire * Return if an operator has already been assigned to this questionnaire
* *
* @param int $operator_id Operator id * @param int $operator_id Operator id
* @param int $questionnaire_id Questionnaire id * @param int $questionnaire_id Questionnaire id
* @return int 1 if assigned otherwise 0 * @return int 1 if assigned otherwise 0
* *
*/ */
function vq($operator_id,$questionnaire_id) function vq($operator_id,$questionnaire_id)
{ {
global $db; global $db;
$sql = "SELECT operator_id,questionnaire_id $sql = "SELECT operator_id,questionnaire_id
FROM operator_questionnaire FROM operator_questionnaire
WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'"; WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'";
$vq = $db->Execute($sql); $vq = $db->Execute($sql);
if ($vq) if ($vq)
return $vq->RecordCount(); return $vq->RecordCount();
else else
return 0; return 0;
} }
/** /**
* Assign an operator to a questionnaire * Assign an operator to a questionnaire
* *
* @param int $operator_id Operator id * @param int $operator_id Operator id
* @param int $questionnaire_id Questionnaire id * @param int $questionnaire_id Questionnaire id
* *
*/ */
function vqi($operator_id,$questionnaire_id) function vqi($operator_id,$questionnaire_id)
{ {
global $db; global $db;
$sql = "INSERT INTO $sql = "INSERT INTO
operator_questionnaire (operator_id,questionnaire_id) operator_questionnaire (operator_id,questionnaire_id)
VALUES('$operator_id','$questionnaire_id')"; VALUES('$operator_id','$questionnaire_id')";
$db->Execute($sql); $db->Execute($sql);
} }
/** /**
* Unassign an operator from a questionnaire * Unassign an operator from a questionnaire
* *
* @param int $operator_id Operator id * @param int $operator_id Operator id
* @param int $questionnaire_id Questionnaire id * @param int $questionnaire_id Questionnaire id
* *
*/ */
function vqd($operator_id,$questionnaire_id) function vqd($operator_id,$questionnaire_id)
{ {
global $db; global $db;
$sql = "DELETE FROM $sql = "DELETE FROM
operator_questionnaire operator_questionnaire
WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'"; WHERE operator_id = '$operator_id' and questionnaire_id = '$questionnaire_id'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE $sql = "DELETE
FROM operator_questionnaire FROM operator_questionnaire
WHERE questionnaire_id IN ( WHERE questionnaire_id IN (
SELECT questionnaire_id SELECT questionnaire_id
FROM questionnaire FROM questionnaire
WHERE enabled = 1) WHERE enabled = 1)
AND operator_id IN ( AND operator_id IN (
SELECT operator_id SELECT operator_id
FROM operator FROM operator
WHERE enabled = 1)"; WHERE enabled = 1)";
$db->Execute($sql); $db->Execute($sql);
foreach ($_POST as $g => $v) foreach ($_POST as $g => $v)
{ {
$a = explode("_",$g); $a = explode("_",$g);
if ($a[0] == "cb") if ($a[0] == "cb")
vqi($a[2],$a[1]); vqi($a[2],$a[1]);
} }
$db->CompleteTrans(); $db->CompleteTrans();
} }
$sql = "SELECT questionnaire_id,description $sql = "SELECT questionnaire_id,description
FROM questionnaire FROM questionnaire
WHERE enabled = 1 WHERE enabled = 1
ORDER by questionnaire_id DESC"; ORDER by questionnaire_id DESC";
$questionnaires = $db->GetAll($sql); $questionnaires = $db->GetAll($sql);
$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName ) as opname, username $sql = "SELECT operator_id, CONCAT(firstName,' ', lastName ) as opname, username
FROM operator FROM operator
WHERE enabled = 1 WHERE enabled = 1
ORDER by operator_id ASC"; ORDER by operator_id ASC";
$operators = $db->GetAll($sql); $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")); 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"> <script type="text/javascript">
<?php <?php
print "questionnaire_id = new Array("; print "questionnaire_id = new Array(";
$s = ""; $s = "";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
$s .= "'{$q['questionnaire_id']}',"; $s .= "'{$q['questionnaire_id']}',";
} }
$s = substr($s,0,strlen($s) - 1); $s = substr($s,0,strlen($s) - 1);
print "$s);\n"; print "$s);\n";
print "operator_id = new Array("; print "operator_id = new Array(";
$s = ""; $s = "";
foreach($operators as $q) foreach($operators as $q)
{ {
$s .= "'{$q['operator_id']}',"; $s .= "'{$q['operator_id']}',";
} }
$s = substr($s,0,strlen($s) - 1); $s = substr($s,0,strlen($s) - 1);
print "$s);\n"; print "$s);\n";
?> ?>
var QidOn = 0; var QidOn = 0;
var VidOn = 0; var VidOn = 0;
function checkQid(q) function checkQid(q)
{ {
for (y in operator_id) for (y in operator_id)
{ {
v = operator_id[y]; v = operator_id[y];
cb = document.getElementById('cb_' + q + "_" + v); cb = document.getElementById('cb_' + q + "_" + v);
if (QidOn == 0) if (QidOn == 0)
cb.checked = 'checked'; cb.checked = 'checked';
else else
cb.checked = ''; cb.checked = '';
} }
if (QidOn == 0) if (QidOn == 0)
QidOn = 1; QidOn = 1;
else else
QidOn = 0; QidOn = 0;
} }
function checkVid(v) function checkVid(v)
{ {
for (y in questionnaire_id) for (y in questionnaire_id)
{ {
q = questionnaire_id[y]; q = questionnaire_id[y];
cb = document.getElementById('cb_' + q + "_" + v); cb = document.getElementById('cb_' + q + "_" + v);
if (VidOn == 0) if (VidOn == 0)
cb.checked = 'checked'; cb.checked = 'checked';
else else
cb.checked = ''; cb.checked = '';
} }
if (VidOn == 0) if (VidOn == 0)
VidOn = 1; VidOn = 1;
else else
VidOn = 0; VidOn = 0;
} }
</script> </script>
</head> </head>
<body> <body>
<?php <?php
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>"; print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Operator") . "&emsp;</th>"; print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Operator") . "&emsp;</th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>"; print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
} }
print "</tr></thead>"; print "</tr></thead>";
foreach($operators as $v) foreach($operators as $v)
{ {
print "<tr class=''> print "<tr class=''>
<th>&emsp;{$v['username']}&emsp;</th> <th>&emsp;{$v['username']}&emsp;</th>
<th style=\"text-align: left;\";>&emsp;<a href=\"javascript:checkVid({$v['operator_id']})\" >{$v['opname']}</a>&emsp;</th>"; <th style=\"text-align: left;\";>&emsp;<a href=\"javascript:checkVid({$v['operator_id']})\" >{$v['opname']}</a>&emsp;</th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
$checked = ""; $checked = "";
if (vq($v['operator_id'],$q['questionnaire_id'])) $checked="checked=\"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 "<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 "</tr>";
} }
print "</table><input class='btn btn-default fa' type='submit' name='submit' value='" . T_("Assign operators to questionnaires") . "'/></form>"; print "</table><input class='btn btn-default fa' type='submit' name='submit' value='" . T_("Assign operators to questionnaires") . "'/></form>";
xhtml_foot(); xhtml_foot();
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('input').iCheck({ $('input').iCheck({
checkboxClass: 'icheckbox_square-blue', checkboxClass: 'icheckbox_square-blue',
increaseArea: '30%' increaseArea: '30%'
}); });
</script> </script>

View File

@@ -1,316 +1,316 @@
<?php <?php
/** /**
* Create an operator and link to a webserver username for authentication * Create an operator and link to a webserver username for authentication
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
global $db; global $db;
$a = false; $a = false;
if (isset($_POST['operator']) && isset($_POST['adduser'])) if (isset($_POST['operator']) && isset($_POST['adduser']))
{ {
$operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc()); $operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc());
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
$lastname = $db->qstr($_POST['lastname'],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_user = $db->qstr($_POST['chat_user'],get_magic_quotes_gpc());
$chat_password = $db->qstr($_POST['chat_password'],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()); $time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
$extension = ""; $extension = "";
if (FREEPBX_PATH != false) if (FREEPBX_PATH != false)
{ {
//Generate new extension from last one in database and random password //Generate new extension from last one in database and random password
$sql = "SELECT SUBSTRING_INDEX(extension, '/', -1) as ext $sql = "SELECT SUBSTRING_INDEX(extension, '/', -1) as ext
FROM extension FROM extension
ORDER BY ext DESC ORDER BY ext DESC
LIMIT 1"; LIMIT 1";
$laste = $db->GetRow($sql); $laste = $db->GetRow($sql);
$extensionn = "2000"; $extensionn = "2000";
$extension = "'IAX2/2000'"; $extension = "'IAX2/2000'";
//increment if exists //increment if exists
if (!empty($laste)) if (!empty($laste))
{ {
$extensionn = $laste['ext'] + 1; $extensionn = $laste['ext'] + 1;
$extension = "'IAX2/$extensionn'"; $extension = "'IAX2/$extensionn'";
} }
//generate random 8 length password //generate random 8 length password
$extensionnp = ""; $extensionnp = "";
$length = 25; $length = 25;
$chars = "abcdefghijklmnopqrstuvwxyz0123456789"; $chars = "abcdefghijklmnopqrstuvwxyz0123456789";
for ($i = 0; $i < $length; $i++) for ($i = 0; $i < $length; $i++)
$extensionnp .= $chars[(mt_rand() % strlen($chars))]; $extensionnp .= $chars[(mt_rand() % strlen($chars))];
//quote for SQL //quote for SQL
$extensionp = "'$extensionnp'"; $extensionp = "'$extensionnp'";
} }
$supervisor = 0; $supervisor = 0;
$temporary = 0; $temporary = 0;
$refusal = 0; $refusal = 0;
$voip = 0; $voip = 0;
$chat = 0; $chat = 0;
if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1; if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1;
if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1; if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1;
if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1; if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1;
if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1; if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1;
if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1; if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1;
if (!empty($_POST['operator'])) if (!empty($_POST['operator']))
{ {
$sql = "INSERT INTO operator $sql = "INSERT INTO operator
(`operator_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`,`voip`,`chat_enable`,`chat_user`,`chat_password`) (`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);"; VALUES (NULL , $operator, $firstname , $lastname, $time_zone_name, $voip, $chat, $chat_user, $chat_password);";
if ($db->Execute($sql)) if ($db->Execute($sql))
{ {
$oid = $db->Insert_ID(); $oid = $db->Insert_ID();
if (FREEPBX_PATH !== false) if (FREEPBX_PATH !== false)
{ {
//add extension //add extension
$sql = "INSERT INTO extension (`extension`,`password`,`current_operator_id`) $sql = "INSERT INTO extension (`extension`,`password`,`current_operator_id`)
VALUES ($extension, $extensionp, $oid)"; VALUES ($extension, $extensionp, $oid)";
$db->Execute($sql); $db->Execute($sql);
//Generate new extension in freepbx //Generate new extension in freepbx
include_once("../functions/functions.freepbx.php"); include_once("../functions/functions.freepbx.php");
freepbx_add_extension($extensionn, $_POST["firstname"] . " " . $_POST["lastname"], $extensionnp); freepbx_add_extension($extensionn, $_POST["firstname"] . " " . $_POST["lastname"], $extensionnp);
} }
else if (!empty($_POST['extension_id'])) else if (!empty($_POST['extension_id']))
{ {
$sql = "UPDATE extension $sql = "UPDATE extension
SET current_operator_id = $oid SET current_operator_id = $oid
WHERE extension_id = " . intval($_POST['extension_id']); WHERE extension_id = " . intval($_POST['extension_id']);
$db->Execute($sql); $db->Execute($sql);
} }
if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false)
{ {
//Get password and add it to the configured htpassword //Get password and add it to the configured htpassword
include_once("../functions/functions.htpasswd.php"); include_once("../functions/functions.htpasswd.php");
$htp = New Htpasswd(HTPASSWD_PATH); $htp = New Htpasswd(HTPASSWD_PATH);
$htg = New Htgroup(HTGROUP_PATH); $htg = New Htgroup(HTGROUP_PATH);
$htp->addUser($_POST['operator'],$_POST['password']); $htp->addUser($_POST['operator'],$_POST['password']);
$htg->addUserToGroup($_POST['operator'],HTGROUP_INTERVIEWER); $htg->addUserToGroup($_POST['operator'],HTGROUP_INTERVIEWER);
if ($supervisor) if ($supervisor)
$htg->addUserGroup(HTGROUP_ADMIN); $htg->addUserGroup(HTGROUP_ADMIN);
} }
$a = "<div class='alert alert-info'><h3>" . T_("Added operator :") . " " . $operator . "</h3>"; $a = "<div class='alert alert-info'><h3>" . T_("Added operator :") . " " . $operator . "</h3>";
if (FREEPBX_PATH !== false) if (FREEPBX_PATH !== false)
$a .= "<br/>" . T_("FreePBX has been reloaded for the new VoIP extension to take effect"); $a .= "<br/>" . T_("FreePBX has been reloaded for the new VoIP extension to take effect");
print "</div>"; print "</div>";
if ($temporary) if ($temporary)
{ {
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id) $db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','1')"); VALUES ('$oid','1')");
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id) $db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','5')"); //and appointment VALUES ('$oid','5')"); //and appointment
} }
if ($supervisor) if ($supervisor)
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id) $db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','2')"); VALUES ('$oid','2')");
if ($refusal) if ($refusal)
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id) $db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','3')"); VALUES ('$oid','3')");
} }
else else
{ {
$a = T_("Could not add operator. There may already be an operator of this name:") . " $operator "; $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")); 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) { if ($a) {
echo $a; echo $a;
} }
else { else {
echo "<div class='well'>"; 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_("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_("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 "<p>" . T_("The username and extension must be unique for each operator.") . "</p>";
echo "</div>"; echo "</div>";
} }
$sql = "SELECT Time_zone_name as value, Time_zone_name as description $sql = "SELECT Time_zone_name as value, Time_zone_name as description
FROM timezone_template"; FROM timezone_template";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
$sql = "SELECT extension_id as value, extension as description $sql = "SELECT extension_id as value, extension as description
FROM extension FROM extension
WHERE current_operator_id IS NULL"; WHERE current_operator_id IS NULL";
$ers = $db->GetAll($sql); $ers = $db->GetAll($sql);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
//Password generator //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'); 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'); 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'); dig = new Array('0','1','2','3','4','5','6','7','8','9');
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']'); sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function rnd(x,y,z) { function rnd(x,y,z) {
var num; var num;
do { do {
num = parseInt(Math.random()*z); num = parseInt(Math.random()*z);
if (num >= x && num <= y) break; if (num >= x && num <= y) break;
} while (true); } while (true);
return(num); return(num);
} }
// -------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------
function generate() { function generate() {
var pwd = ''; var pwd = '';
var res, s; var res, s;
var k = 0; var k = 0;
var n = document.operform.number.value; var n = document.operform.number.value;
var pass = new Array(); var pass = new Array();
var w = rnd(30,80,100); var w = rnd(30,80,100);
for (var r = 0; r < w; r++) { for (var r = 0; r < w; r++) {
res = rnd(1,25,100); pass[k] = upp[res]; k++; res = rnd(1,25,100); pass[k] = upp[res]; k++;
res = rnd(1,25,100); pass[k] = low[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,9,100); pass[k] = dig[res]; k++;
res = rnd(1,24,100); pass[k] = sym[res]; k++; res = rnd(1,24,100); pass[k] = sym[res]; k++;
} }
for (var i = 0; i < n; i++) { for (var i = 0; i < n; i++) {
s = rnd(1,k-1,100); s = rnd(1,k-1,100);
pwd+= pass[s]; pwd+= pass[s];
} }
document.operform.password.value = pwd; document.operform.password.value = pwd;
} }
</script> </script>
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal panel-body" name="operform"> <form enctype="multipart/form-data" action="" method="post" class="form-horizontal panel-body" name="operform">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Username") . ": ";?></label> <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 class="col-sm-3"><input name="operator" type="text" class="form-control" required /></div>
</div> </div>
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?> <?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Password") . ": ";?></label> <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-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">&emsp; <div class="col-sm-6 form-inline">&emsp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("First name") . ": ";?></label> <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 class="col-sm-3"><input name="firstname" type="text" class="form-control" required/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Last name") . ": ";?></label> <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 class="col-sm-3"><input name="lastname" type="text" class="form-control"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label> <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-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"> <div class="col-sm-6 form-inline">
<?php echo T_("Edit") . "&emsp;";?> <?php echo T_("Edit") . "&emsp;";?>
<a href='timezonetemplate.php' class="btn btn-default fa"><?php echo T_("TimeZones list");?></a> <a href='timezonetemplate.php' class="btn btn-default fa"><?php echo T_("TimeZones list");?></a>
</div> </div>
</div> </div>
<?php if (FREEPBX_PATH == false) { ?> <?php if (FREEPBX_PATH == false) { ?>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Extension") . ": ";?></label> <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-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"> <div class="col-sm-6 form-inline">
<?php echo T_("Edit") . "&emsp;";?> <?php echo T_("Edit") . "&emsp;";?>
<a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a> <a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label> <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 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>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": ";?></label> <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 class="col-sm-3"><input name="chat_user" type="text" class="form-control"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": ";?></label> <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 class="col-sm-3"><input name="chat_password" type="text" class="form-control"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label> <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 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>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a normal interviewer?");?></label> <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 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>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a supervisor?");?></label> <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 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>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a refusal converter?");?></label> <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 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>
<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> <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> </form>
<?php <?php
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,279 +1,279 @@
<?php <?php
/** /**
* Assign operators to skills in a checkbox matrix * Assign operators to skills in a checkbox matrix
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Determine if an operator has been assigned to a skill (outcome_type) * Determine if an operator has been assigned to a skill (outcome_type)
* *
* @param int $operator_id Operator id * @param int $operator_id Operator id
* @param int $outcome_type_id Outcome type id (skill) * @param int $outcome_type_id Outcome type id (skill)
* @return int 1 if assigned to that skill otherwise 0 * @return int 1 if assigned to that skill otherwise 0
* *
*/ */
function vq($operator_id,$outcome_type_id) function vq($operator_id,$outcome_type_id)
{ {
global $db; global $db;
$sql = "SELECT operator_id,outcome_type_id $sql = "SELECT operator_id,outcome_type_id
FROM operator_skill FROM operator_skill
WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'"; WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'";
$vq = $db->Execute($sql); $vq = $db->Execute($sql);
if ($vq) if ($vq)
return $vq->RecordCount(); return $vq->RecordCount();
else else
return 0; return 0;
} }
/** /**
* Assign an operator to a skill (outcome_type) * Assign an operator to a skill (outcome_type)
* *
* @param int $operator_id Operator id * @param int $operator_id Operator id
* @param int $outcome_type_id Outcome type id (skill) * @param int $outcome_type_id Outcome type id (skill)
* *
*/ */
function vqi($operator_id,$outcome_type_id) function vqi($operator_id,$outcome_type_id)
{ {
global $db; global $db;
$sql = "INSERT INTO $sql = "INSERT INTO
operator_skill (operator_id,outcome_type_id) operator_skill (operator_id,outcome_type_id)
VALUES('$operator_id','$outcome_type_id')"; VALUES('$operator_id','$outcome_type_id')";
$db->Execute($sql); $db->Execute($sql);
} }
/** /**
* Delete a skill (outcome_type) from an operator * Delete a skill (outcome_type) from an operator
* *
* @param int $operator_id Operator id * @param int $operator_id Operator id
* @param int $outcome_type_id Outcome type id (skill) * @param int $outcome_type_id Outcome type id (skill)
* *
*/ */
function vqd($operator_id,$outcome_type_id) function vqd($operator_id,$outcome_type_id)
{ {
global $db; global $db;
$sql = "DELETE FROM $sql = "DELETE FROM
operator_skill operator_skill
WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'"; WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE $sql = "DELETE
FROM operator_skill FROM operator_skill
WHERE operator_id IN ( WHERE operator_id IN (
SELECT operator_id SELECT operator_id
FROM operator FROM operator
WHERE enabled = 1)"; WHERE enabled = 1)";
$db->Execute($sql); $db->Execute($sql);
foreach ($_POST as $g => $v) foreach ($_POST as $g => $v)
{ {
$a = explode("_",$g); $a = explode("_",$g);
if ($a[0] == "cb") if ($a[0] == "cb")
vqi($a[2],$a[1]); vqi($a[2],$a[1]);
} }
$db->CompleteTrans(); $db->CompleteTrans();
} }
$sql = "SELECT outcome_type_id,description $sql = "SELECT outcome_type_id,description
FROM outcome_type FROM outcome_type
ORDER by outcome_type_id ASC"; ORDER by outcome_type_id ASC";
$outcome_types = $db->GetAll($sql); $outcome_types = $db->GetAll($sql);
$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName) as description, username $sql = "SELECT operator_id, CONCAT(firstName,' ', lastName) as description, username
FROM operator FROM operator
WHERE enabled = 1 WHERE enabled = 1
ORDER by operator_id ASC"; ORDER by operator_id ASC";
$operators = $db->GetAll($sql); $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")); 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>"; 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"> <script type="text/javascript">
<?php <?php
print "outcome_type_id = new Array("; print "outcome_type_id = new Array(";
$s = ""; $s = "";
foreach($outcome_types as $q) foreach($outcome_types as $q)
{ {
$s .= "'{$q['outcome_type_id']}',"; $s .= "'{$q['outcome_type_id']}',";
} }
$s = substr($s,0,strlen($s) - 1); $s = substr($s,0,strlen($s) - 1);
print "$s);\n"; print "$s);\n";
print "operator_id = new Array("; print "operator_id = new Array(";
$s = ""; $s = "";
foreach($operators as $q) foreach($operators as $q)
{ {
$s .= "'{$q['operator_id']}',"; $s .= "'{$q['operator_id']}',";
} }
$s = substr($s,0,strlen($s) - 1); $s = substr($s,0,strlen($s) - 1);
print "$s);\n"; print "$s);\n";
?> ?>
var QidOn = 0; var QidOn = 0;
var VidOn = 0; var VidOn = 0;
function checkQid(q) function checkQid(q)
{ {
for (y in operator_id) for (y in operator_id)
{ {
v = operator_id[y]; v = operator_id[y];
cb = document.getElementById('cb_' + q + "_" + v); cb = document.getElementById('cb_' + q + "_" + v);
if (QidOn == 0) if (QidOn == 0)
cb.checked = 'checked'; cb.checked = 'checked';
else else
cb.checked = ''; cb.checked = '';
} }
if (QidOn == 0) if (QidOn == 0)
QidOn = 1; QidOn = 1;
else else
QidOn = 0; QidOn = 0;
} }
function checkVid(v) function checkVid(v)
{ {
for (y in outcome_type_id) for (y in outcome_type_id)
{ {
q = outcome_type_id[y]; q = outcome_type_id[y];
cb = document.getElementById('cb_' + q + "_" + v); cb = document.getElementById('cb_' + q + "_" + v);
if (VidOn == 0) if (VidOn == 0)
cb.checked = 'checked'; cb.checked = 'checked';
else else
cb.checked = ''; cb.checked = '';
} }
if (VidOn == 0) if (VidOn == 0)
VidOn = 1; VidOn = 1;
else else
VidOn = 0; VidOn = 0;
} }
</script> </script>
</head> </head>
<body> <body>
<?php <?php
//$country_code = 'RU'; // Nederlandse Antillen //$country_code = 'RU'; // Nederlandse Antillen
//print_r(DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code)); //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 "<form action=\"\" method=\"post\"><table class='table-bordered table-hover table-condensed form-group'><thead>";
print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Operator") . "&emsp;</th>"; print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Operator") . "&emsp;</th>";
foreach($outcome_types as $q) foreach($outcome_types as $q)
{ {
print "<th>&emsp;<a href=\"javascript:checkQid({$q['outcome_type_id']})\">" . T_($q['description']) . "</a>&emsp;</th>"; print "<th>&emsp;<a href=\"javascript:checkQid({$q['outcome_type_id']})\">" . T_($q['description']) . "</a>&emsp;</th>";
} }
print "</tr></thead>"; print "</tr></thead>";
foreach($operators as $v) foreach($operators as $v)
{ {
print "<tr class=''> print "<tr class=''>
<th>&emsp;{$v['username']}&emsp;</th> <th>&emsp;{$v['username']}&emsp;</th>
<th>&emsp;<a href=\"javascript:checkVid({$v['operator_id']})\">{$v['description']}</a>&emsp;</th>"; <th>&emsp;<a href=\"javascript:checkVid({$v['operator_id']})\">{$v['description']}</a>&emsp;</th>";
foreach($outcome_types as $q) foreach($outcome_types as $q)
{ {
$checked = ""; $checked = "";
if (vq($v['operator_id'],$q['outcome_type_id'])) $checked="checked=\"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 "<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 "</tr>";
} }
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Modify operator skills") ."\"/></form>"; print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Modify operator skills") ."\"/></form>";
xhtml_foot(); xhtml_foot();
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('input').iCheck({ $('input').iCheck({
checkboxClass: 'icheckbox_square-blue', checkboxClass: 'icheckbox_square-blue',
increaseArea: '30%' increaseArea: '30%'
}); });
</script> </script>

View File

@@ -1,306 +1,306 @@
<?php /** <?php /**
* Display outcomes by questionnaire * Display outcomes by questionnaire
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database file * Database file
*/ */
include_once(dirname(__FILE__).'/../db.inc.php'); include_once(dirname(__FILE__).'/../db.inc.php');
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* AAPOR calculation functions * AAPOR calculation functions
*/ */
include ("../functions/functions.aapor.php"); include ("../functions/functions.aapor.php");
/** /**
* Display functions * Display functions
*/ */
include ("../functions/functions.display.php"); include ("../functions/functions.display.php");
/** /**
* Performance functions * Performance functions
*/ */
include ("../functions/functions.performance.php"); include ("../functions/functions.performance.php");
/** /**
* Operator functions * Operator functions
*/ */
include ("../functions/functions.operator.php"); include ("../functions/functions.operator.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
$admin_operator_id = get_operator_id(); $admin_operator_id = get_operator_id();
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
); );
$js_foot = array( $js_foot = array(
"../js/window.js", "../js/window.js",
"../js/custom.js" "../js/custom.js"
); );
xhtml_head(T_("Questionnaire Outcomes"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.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>"; 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"); display_questionnaire_chooser($questionnaire_id, false, "pull-left col-sm-4", "form-control");
print "<div class='clearfix form-group'></div>"; print "<div class='clearfix form-group'></div>";
if ($questionnaire_id != false) if ($questionnaire_id != false)
{ {
//print "<h1>" . T_("Outcomes") . "</h1>"; //print "<h1>" . T_("Outcomes") . "</h1>";
print "<div class='col-sm-4'><div class='panel panel-body'><h5>" . T_("Sample status") . "</h5>"; 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, $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 count(*) as count
FROM sample as s FROM sample as s
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) 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) 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)"; 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")); 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") . ".&emsp;</div>"; else print "<div class='alert text-danger'>" . T_("No samples assigned") . ".&emsp;</div>";
print "</div>"; print "</div>";
print "<div class='panel panel-body'><h5>" . T_("Case availability (cases with temporary or appointment outcomes)") ."</h5>"; 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 $sql = "SELECT count(c.case_id) as available, si.description
FROM `case` as c FROM `case` as c
LEFT JOIN `call` as a on (a.call_id = c.last_call_id) 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 (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) 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 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 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 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 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 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 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) LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
WHERE c.current_operator_id IS NULL WHERE c.current_operator_id IS NULL
AND ou.outcome_type_id IN (1,5) 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 (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 (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 ap.case_id is NULL
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0) 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 !(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 !(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_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 ((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 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"; group by s.import_id";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (empty($rs)) if (empty($rs))
{ {
print "<div class='alert text-danger'>" . T_("No cases currently available to call") . "</div>"; print "<div class='alert text-danger'>" . T_("No cases currently available to call") . "</div>";
} }
else else
{ {
xhtml_table($rs,array("description","available"),array(T_("Sample"),T_("Cases currently available to call")),"tclass",false,array("available")); xhtml_table($rs,array("description","available"),array(T_("Sample"),T_("Cases currently available to call")),"tclass",false,array("available"));
} }
print "</div>"; print "</div>";
$atime = get_average_time_questionnaire(10,$questionnaire_id); $atime = get_average_time_questionnaire(10,$questionnaire_id);
$mins = intval($atime / 60); $mins = intval($atime / 60);
$secs = $atime % 60; $secs = $atime % 60;
print "<div class='panel panel-body'><h5>" . T_("Average time on a completed questionnaire") . ":<b>&emsp;$mins&nbsp;" . T_("Min") . "&nbsp;$secs&nbsp;" . T_("Secs") . "</b></h5>"; print "<div class='panel panel-body'><h5>" . T_("Average time on a completed questionnaire") . ":<b>&emsp;$mins&nbsp;" . T_("Min") . "&nbsp;$secs&nbsp;" . T_("Secs") . "</b></h5>";
$sql = "SELECT o.calc, count( c.case_id ) $sql = "SELECT o.calc, count( c.case_id )
FROM `case` AS c, `outcome` AS o FROM `case` AS c, `outcome` AS o
WHERE c.questionnaire_id = '$questionnaire_id' WHERE c.questionnaire_id = '$questionnaire_id'
AND c.current_outcome_id = o.outcome_id AND c.current_outcome_id = o.outcome_id
GROUP BY o.calc"; GROUP BY o.calc";
$a = $db->GetAssoc($sql); $a = $db->GetAssoc($sql);
$a = aapor_clean($a); $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 "<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_("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_("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_("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 "<tr><td>" . T_("Contact Rate 1") . "</td><td>" . round(aapor_con1($a),2) . "</td></tr>";
print "</table></div></div>"; print "</table></div></div>";
$sql = "SELECT count(case_id) FROM `case` WHERE `case`.questionnaire_id = '$questionnaire_id'"; $sql = "SELECT count(case_id) FROM `case` WHERE `case`.questionnaire_id = '$questionnaire_id'";
$cases = $db->GetOne($sql); $cases = $db->GetOne($sql);
$sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&amp;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 $sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&amp;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 FROM `case` AS c, `outcome` AS o
WHERE c.questionnaire_id = '$questionnaire_id' WHERE c.questionnaire_id = '$questionnaire_id'
AND c.current_outcome_id = o.outcome_id AND c.current_outcome_id = o.outcome_id
GROUP BY o.outcome_id"; GROUP BY o.outcome_id";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!empty($rs)) if (!empty($rs))
{ print "<div class='col-sm-8'><div class='panel panel-body'>"; { print "<div class='col-sm-8'><div class='panel panel-body'>";
//print "<h4>" . T_("Total cases for questionnaire") . " = <b>$cases</b></h4>"; //print "<h4>" . T_("Total cases for questionnaire") . " = <b>$cases</b></h4>";
translate_array($rs,array("des")); translate_array($rs,array("des"));
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),"&emsp;" . T_("%")),"tclass",false,array("count","perc"));//array("des" => "Complete") xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),"&emsp;" . T_("%")),"tclass",false,array("count","perc"));//array("des" => "Complete")
print "</div></div>"; print "</div></div>";
$sample_import_id = false; $sample_import_id = false;
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
//display a list of samples //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 $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 FROM sample_import as s, questionnaire_sample as q
WHERE s.sample_import_id = q.sample_import_id WHERE s.sample_import_id = q.sample_import_id
AND q.questionnaire_id = '$questionnaire_id'"; AND q.questionnaire_id = '$questionnaire_id'";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Sample") . ": " . "</h3>"; print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Sample") . ": " . "</h3>";
if(!empty($r)) 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"); 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>"; else print "<h4 class='col-sm-3 text-danger'>" . T_("No samples assigned") . "</h4>";
if ($sample_import_id != false) 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>"; 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, $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 count(*) as count
FROM sample as s FROM sample as s
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) 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) 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' WHERE s.import_id = '$sample_import_id'
GROUP BY (c.sample_id is not null)"; 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")); xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "tclass", false, array("count"));
print "</div></div>"; print "</div></div>";
print "<div class='col-sm-8'><div class='panel panel-body'>"; //<p>" . T_("Outcomes") . "</p>"; 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&amp;sample_import_id=$sample_import_id&amp;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 $sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id&amp;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 FROM `case` AS c, `outcome` AS o, sample as s
WHERE c.questionnaire_id = '$questionnaire_id' WHERE c.questionnaire_id = '$questionnaire_id'
AND c.sample_id = s.sample_id AND c.sample_id = s.sample_id
AND s.import_id = '$sample_import_id' AND s.import_id = '$sample_import_id'
AND c.current_outcome_id = o.outcome_id AND c.current_outcome_id = o.outcome_id
GROUP BY o.outcome_id"; GROUP BY o.outcome_id";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!empty($rs)) if (!empty($rs))
{ {
translate_array($rs,array("des")); 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")); xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc"));
} }
else else
print "<p>" . T_("No outcomes recorded for this sample") . "</p>"; print "<p>" . T_("No outcomes recorded for this sample") . "</p>";
print "</div></div>"; print "</div></div>";
} }
$operator_id = false; $operator_id = false;
if (isset($_GET['operator_id'])) $operator_id = bigintval($_GET['operator_id']); if (isset($_GET['operator_id'])) $operator_id = bigintval($_GET['operator_id']);
//display a list of operators !!!worked for this questionnaire_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 $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 FROM `call` as c , `operator`as s, `case` as ca
WHERE ca.questionnaire_id = '$questionnaire_id' WHERE ca.questionnaire_id = '$questionnaire_id'
AND ca.case_id = c.case_id AND ca.case_id = c.case_id
AND c.operator_id = s.operator_id AND c.operator_id = s.operator_id
GROUP by c.operator_id"; GROUP by c.operator_id";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Operator") . ": " . "</h3>"; print "<div class='clearfix '></div><h3 class='col-sm-4 pull-left text-right'>" . T_("Operator") . ": " . "</h3>";
if(!empty($r)) if(!empty($r))
display_chooser($r,"operator_id","operator_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left col-sm-4"); 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") . ".&emsp;</h4>"; else print "<h4 class='col-sm-3 text-danger'>" . T_("No operators assigned") . ".&emsp;</h4>";
print "" ; print "" ;
if ($operator_id != false) 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>"; 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 $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 FROM `call` AS c, `case` as ca, `outcome` AS o
WHERE ca.questionnaire_id = '$questionnaire_id' WHERE ca.questionnaire_id = '$questionnaire_id'
AND ca.case_id = c.case_id AND ca.case_id = c.case_id
AND c.operator_id = '$operator_id' AND c.operator_id = '$operator_id'
AND c.outcome_id = o.outcome_id AND c.outcome_id = o.outcome_id
GROUP BY o.outcome_id"; GROUP BY o.outcome_id";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!empty($rs)) if (!empty($rs))
{ {
translate_array($rs,array("des")); 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")); xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc"));
} }
print "</div></div>"; print "</div></div>";
} }
} }
else else
print "<p>" . T_("No outcomes recorded for this questionnaire") . "</p>"; 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 //display a list of shifts with completions and a link to either add a report or view reports
print "<div class='clearfix'></div>"; print "<div class='clearfix'></div>";
print "<h3 class='col-sm-4 pull-left text-center'>" . T_("Shifts") . ":</h3>"; 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, $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 CASE WHEN sr.shift_id IS NULL THEN
CONCAT('<a href=\'shiftreport.php?questionnaire_id=$questionnaire_id&amp;shift_id=', s.shift_id, '&amp;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>') CONCAT('<a href=\'shiftreport.php?questionnaire_id=$questionnaire_id&amp;shift_id=', s.shift_id, '&amp;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&amp;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>') ELSE CONCAT('<a href=\'shiftreport.php?questionnaire_id=$questionnaire_id&amp;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, END AS link,
c.completions as completions, c.completions as completions,
CONCAT('<a href=\'operatorperformance.php?questionnaire_id=$questionnaire_id&amp;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 CONCAT('<a href=\'operatorperformance.php?questionnaire_id=$questionnaire_id&amp;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 FROM `shift` as s
JOIN operator as o on (o.operator_id = '$admin_operator_id') 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 shift_report as sr on (sr.shift_id = s.shift_id)
LEFT JOIN ( SELECT count(*) as completions,sh.shift_id LEFT JOIN ( SELECT count(*) as completions,sh.shift_id
FROM `call` as a, `case` as b, shift as sh FROM `call` as a, `case` as b, shift as sh
WHERE a.outcome_id = '10' WHERE a.outcome_id = '10'
AND a.case_id = b.case_id AND a.case_id = b.case_id
AND b.questionnaire_id = '$questionnaire_id' AND b.questionnaire_id = '$questionnaire_id'
AND sh.start <= a.start AND sh.start <= a.start
AND sh.end >= a.start AND sh.end >= a.start
GROUP BY sh.shift_id) as c on (s.shift_id = c.shift_id) GROUP BY sh.shift_id) as c on (s.shift_id = c.shift_id)
WHERE s.questionnaire_id = '$questionnaire_id' WHERE s.questionnaire_id = '$questionnaire_id'
GROUP BY shift_id GROUP BY shift_id
ORDER BY s.start ASC"; ORDER BY s.start ASC";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
if (empty($r)) if (empty($r))
print "<h4 class='col-sm-4 text-danger'>" . T_("No shifts defined for this questionnaire") . "</h4>"; print "<h4 class='col-sm-4 text-danger'>" . T_("No shifts defined for this questionnaire") . "</h4>";
else { else {
print "<div class='clearfix form-group'></div>"; print "<div class='clearfix form-group'></div>";
print "<div class='col-sm-6 panel-body' style='max-height:400px; overflow:auto;'>"; 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"); 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>"; print "</div>";
} }
} }
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>

View File

@@ -72,15 +72,15 @@ include("../include/ckeditor/ckeditor.php");
global $db; global $db;
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js" "../include/bootstrap/js/bootstrap.min.js"
); );
$js_foot = array( $js_foot = array(
"../js/new.js", "../js/new.js",
@@ -598,4 +598,4 @@ xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('[data-toggle="confirmation"]').confirmation(); $('[data-toggle="confirmation"]').confirmation();
</script> </script>

View File

@@ -1,196 +1,196 @@
<?php <?php
/** /**
* Select and set questions to pre fill in the questionnaire * Select and set questions to pre fill in the questionnaire
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
global $db; global $db;
if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value'])) if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']))
{ {
//need to add prefill to questionnaire //need to add prefill to questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$value = $db->quote($_GET['value']); $value = $db->quote($_GET['value']);
$svar = $db->quote($_GET['svar']); $svar = $db->quote($_GET['svar']);
$sgqa = $db->quote($_GET['sgqa']); $sgqa = $db->quote($_GET['sgqa']);
if (!empty($_GET['svar']) && empty($_GET['value'])) if (!empty($_GET['svar']) && empty($_GET['value']))
$value = $svar; $value = $svar;
$sql = "INSERT INTO questionnaire_prefill(questionnaire_id,lime_sgqa,value) $sql = "INSERT INTO questionnaire_prefill(questionnaire_id,lime_sgqa,value)
VALUES('$questionnaire_id',$sgqa,$value)"; VALUES('$questionnaire_id',$sgqa,$value)";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_prefill_id'])) if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_prefill_id']))
{ {
//need to remove prefill from questionnaire //need to remove prefill from questionnaire
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$questionnaire_prefill_id = bigintval($_GET['questionnaire_prefill_id']); $questionnaire_prefill_id = bigintval($_GET['questionnaire_prefill_id']);
$sql = "DELETE FROM questionnaire_prefill $sql = "DELETE FROM questionnaire_prefill
WHERE questionnaire_prefill_id = '$questionnaire_prefill_id'"; WHERE questionnaire_prefill_id = '$questionnaire_prefill_id'";
$db->Execute($sql); $db->Execute($sql);
} }
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); 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")); 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") . ":&emsp;</h3>"; print "<h3 class='form-inline pull-left'>" . T_("Select a questionnaire") . ":&emsp;</h3>";
$sql = "SELECT questionnaire_id as value,description, $sql = "SELECT questionnaire_id as value,description,
CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM questionnaire FROM questionnaire
WHERE enabled = 1"; WHERE enabled = 1";
display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline form-group"); display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline form-group");
if ($questionnaire_id != false) if ($questionnaire_id != false)
{ {
print "<h2>" . T_("Current pre fills") . "</h2>"; print "<h2>" . T_("Current pre fills") . "</h2>";
$sql = "SELECT questionnaire_prefill_id,lime_sgqa,value $sql = "SELECT questionnaire_prefill_id,lime_sgqa,value
FROM questionnaire_prefill FROM questionnaire_prefill
WHERE questionnaire_id = '$questionnaire_id'"; WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
if (empty($r)) if (empty($r))
{ {
print "<p class='well text-info'>" . T_("Currently no pre fills") . "</p>"; print "<p class='well text-info'>" . T_("Currently no pre fills") . "</p>";
} }
else else
{ {
foreach($r as $v) foreach($r as $v)
{ {
print "<ul class='form-group clearfix'><p class='col-sm-2'>" . T_("SGQA code") . ":&emsp;<b class='text-primary'>{$v['lime_sgqa']}</b></p><p class='col-sm-4'>" . T_("Sample variable") . ":&emsp;<b class='text-primary'>{$v['value']}</b></p><a href='?questionnaire_id=$questionnaire_id&amp;questionnaire_prefill_id={$v['questionnaire_prefill_id']}'><i class='fa fa-lg text-danger'>" . T_("Delete") . "</i></a></ul>"; print "<ul class='form-group clearfix'><p class='col-sm-2'>" . T_("SGQA code") . ":&emsp;<b class='text-primary'>{$v['lime_sgqa']}</b></p><p class='col-sm-4'>" . T_("Sample variable") . ":&emsp;<b class='text-primary'>{$v['value']}</b></p><a href='?questionnaire_id=$questionnaire_id&amp;questionnaire_prefill_id={$v['questionnaire_prefill_id']}'><i class='fa fa-lg text-danger'>" . T_("Delete") . "</i></a></ul>";
} }
} }
print ""; print "";
print "<h3 class='pull-left'>" . T_("Select a question to pre fill") . "&emsp;</h3>"; print "<h3 class='pull-left'>" . T_("Select a question to pre fill") . "&emsp;</h3>";
$sql = "SELECT lime_sid $sql = "SELECT lime_sid
FROM questionnaire FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'"; WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql); $r = $db->GetRow($sql);
$lime_sid = $r['lime_sid']; $lime_sid = $r['lime_sid'];
$sgqa = false; $sgqa = false;
if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa']; if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa'];
$sql = "SELECT CONCAT( q.sid, 'X', q.gid, 'X', q.qid) AS value, $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 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 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 FROM `" . LIME_PREFIX . "questions` AS q
LEFT JOIN `" . LIME_PREFIX . "questions` as qo ON (qo.qid = q.parent_qid) LEFT JOIN `" . LIME_PREFIX . "questions` as qo ON (qo.qid = q.parent_qid)
WHERE q.sid = '$lime_sid' 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"; 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); $rs = $db->GetAll($sql);
for ($i=0; $i<count($rs); $i++) for ($i=0; $i<count($rs); $i++)
{ {
$rs[$i]['description'] = substr(strip_tags($rs[$i]['description']),0,400); $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"); display_chooser($rs,"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left");
print "<div class='clearfix'></div>"; print "<div class='clearfix'></div>";
if ($sgqa != false) if ($sgqa != false)
{ {
print "<h2 >" . T_("Enter a value to pre fill this question with:") . "</h2>"; print "<h2 >" . T_("Enter a value to pre fill this question with:") . "</h2>";
print "<div class='well'><p>"; print "<div class='well'><p>";
print T_("Possible uses:"); print T_("Possible uses:");
print "</p><ul>"; print "</p><ul>";
print "<li>" . T_("{Respondent:firstName} First name of the respondent") . "</li>"; 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_("{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 "<li>" . T_("{Sample:var} A record from the sample where the column name is 'var'") . "</li>";
print "</ul></div>"; print "</ul></div>";
$sql = "SELECT sivr.var as description, CONCAT('{Sample:', sivr.var, '}') as value $sql = "SELECT sivr.var as description, CONCAT('{Sample:', sivr.var, '}') as value
FROM `sample_import_var_restrict` as sivr, questionnaire_sample as qs FROM `sample_import_var_restrict` as sivr, questionnaire_sample as qs
WHERE qs.questionnaire_id = '$questionnaire_id' WHERE qs.questionnaire_id = '$questionnaire_id'
AND sivr.sample_import_id = qs.sample_import_id"; AND sivr.sample_import_id = qs.sample_import_id";
?> ?>
<form action="" method="get" class="form-inline form-group"> <form action="" method="get" class="form-inline form-group">
<label for="value"><?php echo T_("The value to pre fill"); ?>:&emsp;</label><input type="text" name="value" id="value" size="50" class="form-control"/> <label for="value"><?php echo T_("The value to pre fill"); ?>:&emsp;</label><input type="text" name="value" id="value" size="50" class="form-control"/>
<label for="svar">&emsp;<?php echo T_("or: Select pre fill from sample list"); ?>&emsp;</label> <label for="svar">&emsp;<?php echo T_("or: Select pre fill from sample list"); ?>&emsp;</label>
<?php //display a list of possible sample variables for this questionnaire <?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"); 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="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/> <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")); ?>"/> <input type="submit" name="add_prefill" class="btn btn-primary fa" value="<?php print(T_("Add pre fill")); ?>"/>
</form> </form>
<?php <?php
} }
} }
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,261 +1,261 @@
<?php <?php
/** /**
* Set quota's for answered questions * Set quota's for answered questions
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008,2009 * @copyright Deakin University 2007,2008,2009
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
/** /**
* Limesurvey functions * Limesurvey functions
*/ */
include("../functions/functions.limesurvey.php"); include("../functions/functions.limesurvey.php");
/** /**
* Operator functions * Operator functions
*/ */
include("../functions/functions.operator.php"); include("../functions/functions.operator.php");
global $db; global $db;
if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']) && isset($_GET['completions']) && isset($_GET['sample_import_id']) && isset($_GET['comparison'])) 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 //need to add quota
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$sample_import_id = bigintval($_GET['sample_import_id']); $sample_import_id = bigintval($_GET['sample_import_id']);
$value = $db->quote($_GET['value']); $value = $db->quote($_GET['value']);
$completions = $db->quote($_GET['completions']); $completions = $db->quote($_GET['completions']);
$sgqa = $db->quote($_GET['sgqa']); $sgqa = $db->quote($_GET['sgqa']);
$comparison = $db->quote($_GET['comparison']); $comparison = $db->quote($_GET['comparison']);
$sql = "INSERT INTO questionnaire_sample_quota(questionnaire_id, sample_import_id, lime_sgqa,value,completions,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)"; VALUES ($questionnaire_id, $sample_import_id, $sgqa, $value, $completions, $comparison)";
$db->Execute($sql); $db->Execute($sql);
//Make sure to calculate on the spot //Make sure to calculate on the spot
update_quotas($questionnaire_id); update_quotas($questionnaire_id);
} }
if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_sample_quota_id'])) if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_sample_quota_id']))
{ {
//need to remove quota //need to remove quota
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
$questionnaire_sample_quota_id = bigintval($_GET['questionnaire_sample_quota_id']); $questionnaire_sample_quota_id = bigintval($_GET['questionnaire_sample_quota_id']);
$sql = "DELETE FROM questionnaire_sample_quota $sql = "DELETE FROM questionnaire_sample_quota
WHERE questionnaire_sample_quota_id = '$questionnaire_sample_quota_id'"; WHERE questionnaire_sample_quota_id = '$questionnaire_sample_quota_id'";
$db->Execute($sql); $db->Execute($sql);
} }
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); 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")); 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") . ":&emsp;</h3>"; print "<h3 class='form-inline pull-left'>" . T_("Questionnaire") . ":&emsp;</h3>";
$sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected $sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM questionnaire FROM questionnaire
WHERE enabled = 1"; WHERE enabled = 1";
display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline pull-left "); display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline pull-left ");
if ($questionnaire_id != false) if ($questionnaire_id != false)
{ {
$sample_import_id = false; $sample_import_id = false;
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); 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 $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 FROM sample_import as s, questionnaire_sample as q
WHERE q.questionnaire_id = $questionnaire_id WHERE q.questionnaire_id = $questionnaire_id
AND q.sample_import_id = s.sample_import_id"; AND q.sample_import_id = s.sample_import_id";
$s = $db->GetAll($sql); $s = $db->GetAll($sql);
if (!empty($s)){ if (!empty($s)){
print "<h3 class='form-inline pull-left'>&emsp;&emsp;&emsp;" . T_("Sample") . ": &emsp;</h3>"; print "<h3 class='form-inline pull-left'>&emsp;&emsp;&emsp;" . T_("Sample") . ": &emsp;</h3>";
display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left"); display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left");
} else { } else {
print "<div class='clearfix'></div><div class='well text-info'>" . T_("No samples assigned to this questionnaire.") . "</div>"; print "<div class='clearfix'></div><div class='well text-info'>" . T_("No samples assigned to this questionnaire.") . "</div>";
} }
print "<div class='clearfix'></div>"; print "<div class='clearfix'></div>";
if ($sample_import_id != false) if ($sample_import_id != false)
{ {
print "<h2>" . T_("Current quotas") . ":</h2>";//(click to delete) print "<h2>" . T_("Current quotas") . ":</h2>";//(click to delete)
$sql = "SELECT questionnaire_sample_quota_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison $sql = "SELECT questionnaire_sample_quota_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison
FROM questionnaire_sample_quota as qsq, questionnaire as q FROM questionnaire_sample_quota as qsq, questionnaire as q
WHERE qsq.questionnaire_id = '$questionnaire_id' WHERE qsq.questionnaire_id = '$questionnaire_id'
AND qsq.sample_import_id = '$sample_import_id' AND qsq.sample_import_id = '$sample_import_id'
AND q.questionnaire_id = '$questionnaire_id'"; AND q.questionnaire_id = '$questionnaire_id'";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
if (empty($r)) if (empty($r))
{ {
print "<p class='well text-info'>" . T_("Currently no quotas") . "</p>"; print "<p class='well text-info'>" . T_("Currently no quotas") . "</p>";
} }
else else
{ {
foreach($r as $v) foreach($r as $v)
{ {
print "<div><a href='?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id&amp;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> - "; print "<div><a href='?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id&amp;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) if ($v['quota_reached'] == 1)
print T_("Quota reached"); print T_("Quota reached");
else else
print T_("Quota not yet reached"); 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 " - " . T_("Current completions: ") . limesurvey_quota_completions($v['lime_sgqa'],$v['lime_sid'],$questionnaire_id,$sample_import_id,$v['value'],$v['comparison']);
print "</div>"; print "</div>";
} }
} }
print "<h3 class=' '>" . T_("Select a question for the quota") . "</h3>"; print "<h3 class=' '>" . T_("Select a question for the quota") . "</h3>";
$sql = "SELECT lime_sid $sql = "SELECT lime_sid
FROM questionnaire FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'"; WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql); $r = $db->GetRow($sql);
$lime_sid = $r['lime_sid']; $lime_sid = $r['lime_sid'];
$sgqa = false; $sgqa = false;
if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa']; 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, $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 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 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 FROM `" . LIME_PREFIX . "questions` AS lq
LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid ) LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid )
JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid) JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid)
WHERE lq.sid = '$lime_sid' 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"; 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&amp;sample_import_id=$sample_import_id",true,true,false,true,"form-group"); display_chooser($db->GetAll($sql),"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id",true,true,false,true,"form-group");
print "<div class='clearfix'></div>"; print "<div class='clearfix'></div>";
if ($sgqa != false) if ($sgqa != false)
{ {
print "<div class='col-sm-6 panel-body'><h3>" . T_("Enter the details for creating the quota:") . "</h3>"; 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"> <form action="" method="get" class="form-inline form-group">
<p><label for="comparison"><?php echo T_("The type of comparison"); ?>:&emsp;</label> <p><label for="comparison"><?php echo T_("The type of comparison"); ?>:&emsp;</label>
<select name="comparison" class='form-control' id="comparison"> <select name="comparison" class='form-control' id="comparison">
<option value="LIKE">LIKE</option> <option value="LIKE">LIKE</option>
<option value="NOT LIKE">NOT LIKE</option> <option value="NOT LIKE">NOT LIKE</option>
<option value="=">=</option><option value="!=">!=</option> <option value="=">=</option><option value="!=">!=</option>
<option value="&lt;">&lt;</option> <option value="&lt;">&lt;</option>
<option value="&gt;">&gt;</option> <option value="&gt;">&gt;</option>
<option value="&lt;=">&lt;=</option> <option value="&lt;=">&lt;=</option>
<option value="&gt;=">&gt;=</option></select></p> <option value="&gt;=">&gt;=</option></select></p>
<p><label for="value"><?php echo T_("The code value to compare"); ?>:&emsp;</label> <p><label for="value"><?php echo T_("The code value to compare"); ?>:&emsp;</label>
<input type="text" name="value" id="value" class="form-control" size="35" required /></p> <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"); ?>:&emsp;</label> <p><label for="completions"><?php echo T_("The number of completions to stop calling at"); ?>:&emsp;</label>
<input type="number" name="completions" id="completions" class="form-control" size="6" maxlength="6" style="width:8em;" required /></p> <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="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/> <input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/> <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> <p><input type="submit" name="add_quota" value="<?php print(T_("Add quota")); ?>" class="btn btn-primary fa"/></p>
</form> </form>
<?php <?php
print "</div>"; print "</div>";
print "<div class='col-sm-6 panel-body'><h3>" . T_("Code values for this question") . ":</h3>"; print "<div class='col-sm-6 panel-body'><h3>" . T_("Code values for this question") . ":</h3>";
$qid = explode("X", $sgqa); $qid = explode("X", $sgqa);
$qid = $qid[2]; $qid = $qid[2];
$sql = "SELECT CONCAT('<b class=\'fa\'>&emsp;', l.code , '</b>')as code,l.answer as title $sql = "SELECT CONCAT('<b class=\'fa\'>&emsp;', l.code , '</b>')as code,l.answer as title
FROM `" . LIME_PREFIX . "answers` as l FROM `" . LIME_PREFIX . "answers` as l
WHERE l.qid = '$qid'"; WHERE l.qid = '$qid'";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!isset($rs) || empty($rs)) if (!isset($rs) || empty($rs))
print "<p class='well text-info'>" . T_("No labels defined for this question") ."</p>"; print "<p class='well text-info'>" . T_("No labels defined for this question") ."</p>";
else else
xhtml_table($rs,array('code','title'),array(T_("Code value"), T_("Description"))); xhtml_table($rs,array('code','title'),array(T_("Code value"), T_("Description")));
print "</div>"; print "</div>";
} }
} }
} }
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -106,7 +106,7 @@ if (isset($_POST['submit']))
$db->CompleteTrans(); $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") . ":&emsp;</h3>"; print "<h3 class='form-inline pull-left'>" . T_("Select a questionnaire") . ":&emsp;</h3>";
@@ -310,4 +310,4 @@ $('input').iCheck({
checkboxClass: 'icheckbox_square-blue', checkboxClass: 'icheckbox_square-blue',
increaseArea: '30%' increaseArea: '30%'
}); });
</script> </script>

View File

@@ -284,7 +284,7 @@ if (isset($_GET['qsqri']) & isset($_GET['edit']))
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); 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") . ":&emsp;</h3>"; print "<h3 class='form-inline pull-left'>" . T_("Questionnaire") . ":&emsp;</h3>";
$sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected $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', checkboxClass: 'icheckbox_square-blue',
increaseArea: '30%' increaseArea: '30%'
}); });
</script> </script>

View File

@@ -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") . "&emsp;</h3>"; print "<h3 class='form-inline pull-left'>" . T_("Please select a questionnaire") . "&emsp;</h3>";
$questionnaire_id = false; $questionnaire_id = false;

File diff suppressed because it is too large Load Diff

View File

@@ -1,205 +1,205 @@
<?php <?php
/** /**
* Select and search within a sample to see what case(s) is/are assigned to a sample record * 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 * and if so to look at them, otherwise give the option to remove a sample record
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
global $db; global $db;
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome/css/font-awesome.css",
/* "../include/bootgrid/jquery.bootgrid.css", */ /* "../include/bootgrid/jquery.bootgrid.css", */
"../include/bs-data-table/css/jquery.bdt.css", "../include/bs-data-table/css/jquery.bdt.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
/* "../include/bootgrid/jquery.bootgrid.min.js", */ /* "../include/bootgrid/jquery.bootgrid.min.js", */
); );
$js_foot = array( $js_foot = array(
"../include/bs-data-table/js/vendor/jquery.sortelements.js", "../include/bs-data-table/js/vendor/jquery.sortelements.js",
"../include/bs-data-table/js/jquery.bdt.js", "../include/bs-data-table/js/jquery.bdt.js",
"../js/window.js", "../js/window.js",
"../js/custom.js" "../js/custom.js"
); );
$sample_import_id = false; $sample_import_id = false;
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
$subtitle = T_("Search within this sample"); $subtitle = T_("Search within this sample");
xhtml_head(T_("Search the sample"),true,$css,$js_head); 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 fade delete-confirm" id="delete-confirm" tabindex="-1" role="dialog" aria-labelledby="delete-confirm" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <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> <h4 class="modal-title text-danger " ><?php echo T_("WARNING !");?></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p><?php echo T_("Are you shure you want to delete") . "&ensp;" . T_("Sample ID") . "&ensp;<b class='text-danger'>" . "</b>?";?></p> <p><?php echo T_("Are you shure you want to delete") . "&ensp;" . T_("Sample ID") . "&ensp;<b class='text-danger'>" . "</b>?";?></p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><?php echo T_("NOOOO...");?></button> <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"),",&ensp;",T_("Delete");?></a> <a class="btn btn-danger" href=" "><?php echo T_("Yes"),",&ensp;",T_("Delete");?></a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i>&emsp;" . T_("Go back") . "</a>"; echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i>&emsp;" . 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 $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"; FROM sample_import";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
if(!empty($r)) 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 ") . "&emsp;</h4>"; print "<div class=' form-inline form-group col-md-6'><h4 class='control-label form-group col-sm-6 text-right'>" . T_("Select sample ") . "&emsp;</h4>";
display_chooser($r,"sample_import_id","sample_import_id",true,false,true,false); display_chooser($r,"sample_import_id","sample_import_id",true,false,true,false);
print "</div>"; print "</div>";
if (isset($_GET['sample_id'])) if (isset($_GET['sample_id']))
{ {
//need to remove this sample record from the sample //need to remove this sample record from the sample
$sample_id = bigintval($_GET['sample_id']); $sample_id = bigintval($_GET['sample_id']);
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE FROM sample_var $sql = "DELETE FROM sample_var
WHERE sample_id = '$sample_id'"; WHERE sample_id = '$sample_id'";
$db->Execute($sql); $db->Execute($sql);
$sql = "DELETE FROM sample $sql = "DELETE FROM sample
WHERE sample_id = '$sample_id'"; WHERE sample_id = '$sample_id'";
$db->Execute($sql); $db->Execute($sql);
$db->CompleteTrans(); $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'>&times;</span></button><p>" . T_("Sample ID") . "&ensp;<b>" . $sample_id . "</b>&ensp;" . T_("Deleted") . ".</p></div>"; 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'>&times;</span></button><p>" . T_("Sample ID") . "&ensp;<b>" . $sample_id . "</b>&ensp;" . T_("Deleted") . ".</p></div>";
} }
print "<div class='clearfix'></div>"; print "<div class='clearfix'></div>";
if ($sample_import_id != false) if ($sample_import_id != false)
{ {
$sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN $sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN
CONCAT('&emsp;<a href=\'\' data-toggle=\'modal\' data-target=\'.delete-confirm\' data-href=\'?sample_import_id=$sample_import_id&amp;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>&emsp;') CONCAT('&emsp;<a href=\'\' data-toggle=\'modal\' data-target=\'.delete-confirm\' data-href=\'?sample_import_id=$sample_import_id&amp;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>&emsp;')
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>') 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 END as link
FROM sample_var AS sv FROM sample_var AS sv
JOIN (sample as s) ON (s.import_id = '$sample_import_id' and sv.sample_id = s.sample_id) 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 ) 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"; GROUP BY s.sample_id, c.case_id";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
if ($r) { if ($r) {
$fnames = array("sample_id"); $fnames = array("sample_id");
$fdesc = array(T_("Sample id")); $fdesc = array(T_("Sample id"));
$fnames[] = "link"; $fnames[] = "link";
$fdesc[] = T_("Case ID"); $fdesc[] = T_("Case ID");
$sql = "SELECT var,var_id $sql = "SELECT var,var_id
FROM sample_import_var_restrict FROM sample_import_var_restrict
WHERE sample_import_id = $sample_import_id WHERE sample_import_id = $sample_import_id
ORDER by var ASC"; ORDER by var ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
foreach($rs as $rsw) foreach($rs as $rsw)
{ {
$fnames[] = $rsw['var_id']; $fnames[] = $rsw['var_id'];
$fdesc[] = $rsw['var']; $fdesc[] = $rsw['var'];
} }
foreach($r as &$rw) foreach($r as &$rw)
{ {
$sql = "SELECT var_id,val $sql = "SELECT var_id,val
FROM sample_var FROM sample_var
WHERE sample_id = {$rw['sample_id']}"; WHERE sample_id = {$rw['sample_id']}";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
foreach($rs as $rsw){ foreach($rs as $rsw){
$rw[$rsw['var_id']] = $rsw['val']; $rw[$rsw['var_id']] = $rsw['val'];
} }
} }
print "<div class='form-group'>"; print "<div class='form-group'>";
xhtml_table($r,$fnames,$fdesc,"tclass",false,false,"bs-table"); xhtml_table($r,$fnames,$fdesc,"tclass",false,false,"bs-table");
print "</div>"; 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>"; 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); xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('#bs-table').bdt(); $('#bs-table').bdt();
/* $('#bs-table').bootgrid({ /* $('#bs-table').bootgrid({
ajax: true, ajax: true,
post: "$sample_import_id", post: "$sample_import_id",
url: "?sample_import_id=\"$sample_import_id\"", url: "?sample_import_id=\"$sample_import_id\"",
}); */ }); */
$('#delete-confirm').on('show.bs.modal', function (event) { $('#delete-confirm').on('show.bs.modal', function (event) {
var a = $(event.relatedTarget) var a = $(event.relatedTarget)
var href = a.data('href') var href = a.data('href')
var sample_id =a.data('sample_id') var sample_id =a.data('sample_id')
var modal = $(this) var modal = $(this)
modal.find('.modal-body p b').text( +sample_id ) modal.find('.modal-body p b').text( +sample_id )
modal.find('.modal-footer a').attr('href', href) modal.find('.modal-footer a').attr('href', href)
}) })
</script> </script>

View File

@@ -1,176 +1,176 @@
<?php /** <?php /**
* List and edit reports on shifts * List and edit reports on shifts
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../config.inc.php');
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Operator functions * Operator functions
*/ */
include("../functions/functions.operator.php"); include("../functions/functions.operator.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); 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")); 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(); $operator_id = get_operator_id();
print "<h3>" . T_("Please select a questionnaire") . "</h3>"; print "<h3>" . T_("Please select a questionnaire") . "</h3>";
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
display_questionnaire_chooser($questionnaire_id ,false,"form-inline clearfix", "form-control"); display_questionnaire_chooser($questionnaire_id ,false,"form-inline clearfix", "form-control");
if ($questionnaire_id) if ($questionnaire_id)
{ {
print "<h3>" . T_("Please select a shift") . "</h3>"; print "<h3>" . T_("Please select a shift") . "</h3>";
$shift_id = false; $shift_id = false;
if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']); if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']);
//get shifts for this questionnaire in operator time //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, $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 CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM `shift` as s, operator as o FROM `shift` as s, operator as o
WHERE s.questionnaire_id = '$questionnaire_id' WHERE s.questionnaire_id = '$questionnaire_id'
AND o.operator_id = '$operator_id' AND o.operator_id = '$operator_id'
ORDER BY s.start ASC"; ORDER BY s.start ASC";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
if (!empty($r)) if (!empty($r))
display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group"); display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");
if ($shift_id) if ($shift_id)
{ {
print "<h3>" . T_("Reports for this shift") . "</h3>"; print "<h3>" . T_("Reports for this shift") . "</h3>";
//list current reports with a link to edit //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, $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&amp;shift_id=$shift_id&amp;shift_report_id=', s.shift_report_id, '\'>". TQ_("Edit") . "</a>') as link CONCAT('<a href=\'?questionnaire_id=$questionnaire_id&amp;shift_id=$shift_id&amp;shift_report_id=', s.shift_report_id, '\'>". TQ_("Edit") . "</a>') as link
FROM shift_report as s, operator as o FROM shift_report as s, operator as o
WHERE s.operator_id = o.operator_id WHERE s.operator_id = o.operator_id
AND s.shift_id = '$shift_id'"; AND s.shift_id = '$shift_id'";
$r = $db->GetAll($sql); $r = $db->GetAll($sql);
if (!empty($r)) if (!empty($r))
xhtml_table($r,array("firstName", "d", "report","link"),array(T_("Operator"),T_("Date"),T_("Report"),T_("Edit")),"tclass"); xhtml_table($r,array("firstName", "d", "report","link"),array(T_("Operator"),T_("Date"),T_("Report"),T_("Edit")),"tclass");
//link to create a new report //link to create a new report
print "<p><a href='?questionnaire_id=$questionnaire_id&amp;shift_id=$shift_id&amp;createnewreport=yes'>" . T_("Create new report for this shift") . "</a></p>"; print "<p><a href='?questionnaire_id=$questionnaire_id&amp;shift_id=$shift_id&amp;createnewreport=yes'>" . T_("Create new report for this shift") . "</a></p>";
if (isset($_GET['createnewreport'])) if (isset($_GET['createnewreport']))
{ {
//create a new report //create a new report
print "<h3>" . T_("Enter report for this shift") . "</h3>"; 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 "<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 "<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_id' id='shift_id' value='$shift_id'/>";
print "<input type='submit' name='submit' id='submit' value=\"" . T_("Add report") . "\"/>"; print "<input type='submit' name='submit' id='submit' value=\"" . T_("Add report") . "\"/>";
print "</p></form>"; print "</p></form>";
} }
else if (isset($_GET['report'])) else if (isset($_GET['report']))
{ {
//add report to database //add report to database
$report = $db->qstr($_GET['report']); $report = $db->qstr($_GET['report']);
$sql = "INSERT INTO shift_report (shift_id,operator_id,datetime,report,shift_report_id) $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)"; VALUES ('$shift_id','$operator_id',CONVERT_TZ(NOW(),'System','UTC'),$report,NULL)";
$db->Execute($sql); $db->Execute($sql);
} }
else if (isset($_GET['shift_report_id'])) else if (isset($_GET['shift_report_id']))
{ {
$shift_report_id = bigintval($_GET['shift_report_id']); $shift_report_id = bigintval($_GET['shift_report_id']);
if (isset($_GET['ereport'])) if (isset($_GET['ereport']))
{ {
//edit report //edit report
$report = $db->qstr($_GET['ereport']); $report = $db->qstr($_GET['ereport']);
$sql = "UPDATE shift_report $sql = "UPDATE shift_report
SET operator_id = '$operator_id', datetime = CONVERT_TZ(NOW(),'System','UTC'), report = $report SET operator_id = '$operator_id', datetime = CONVERT_TZ(NOW(),'System','UTC'), report = $report
WHERE shift_report_id = '$shift_report_id'"; WHERE shift_report_id = '$shift_report_id'";
$db->Execute($sql); $db->Execute($sql);
} }
$sql = "SELECT report $sql = "SELECT report
FROM shift_report FROM shift_report
WHERE shift_report_id = '$shift_report_id'"; WHERE shift_report_id = '$shift_report_id'";
$r = $db->GetRow($sql); $r = $db->GetRow($sql);
if (empty($r)) if (empty($r))
{ {
print "<h3>" . T_("This report does not exist in the database") . "</h3>"; print "<h3>" . T_("This report does not exist in the database") . "</h3>";
} }
else else
{ {
//edit report //edit report
print "<h3>" . T_("Edit report for this shift") . "</h3>"; 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 "<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 "<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_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='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 "<input type='submit' name='submit' id='submit' value=\"" . T_("Modify report") . "\"/>";
print "</p></form>"; print "</p></form>";
} }
} }
} }
} }
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,159 +1,159 @@
<?php <?php
/** /**
* Modify the standard shift template * Modify the standard shift template
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
$css = array( $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap.min.css",
//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", //"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
"../include/clockpicker/dist/bootstrap-clockpicker.min.css", "../include/clockpicker/dist/bootstrap-clockpicker.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../include/jquery/jquery.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap/js/bootstrap.min.js",
"../js/addrow-v2.js", "../js/addrow-v2.js",
); );
$js_foot = array( $js_foot = array(
"../include/clockpicker/dist/bootstrap-clockpicker.js", "../include/clockpicker/dist/bootstrap-clockpicker.js",
"../js/custom.js" "../js/custom.js"
); );
global $db; global $db;
$year="2008"; $year="2008";
$woy="1"; $woy="1";
if (isset($_POST['day'])) if (isset($_POST['day']))
{ {
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE FROM shift_template $sql = "DELETE FROM shift_template
WHERE 1"; WHERE 1";
$db->Execute($sql); $db->Execute($sql);
foreach($_POST['day'] as $key => $val) foreach($_POST['day'] as $key => $val)
{ {
if (!empty($val)) if (!empty($val))
{ {
$val = intval($val); $val = intval($val);
$key = intval($key); $key = intval($key);
$start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc());
$end = $db->qstr($_POST['end'][$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) $sql = "INSERT INTO shift_template(day_of_week,start,end)
VALUES ($val,$start,$end)"; VALUES ($val,$start,$end)";
$db->Execute($sql); $db->Execute($sql);
} }
} }
$db->CompleteTrans(); $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") 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' $sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria'
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
if (empty($rs) || !$rs || empty($rs['t'])) 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='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 * Display warning if timezone data not installed
* *
*/ */
//print "<h1>" . T_("Set default shift times") . "</h1>"; //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>"; 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 * 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 $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"; FROM shift_template";
$shifts = $db->GetAll($sql); $shifts = $db->GetAll($sql);
translate_array($shifts,array("dt")); 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 $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"; FROM day_of_week";
$daysofweek = $db->GetAll($sql); $daysofweek = $db->GetAll($sql);
translate_array($daysofweek,array("description")); translate_array($daysofweek,array("description"));
?> ?>
<div class="panel-body col-sm-4"><form method="post" action="" class="form-horizontal"> <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"> <table class="table-hover table-condensed " id="shifts"><thead class="text-center highlight">
<?php <?php
print "<tr ><th >" . T_("Day") . "</th><th >" . T_("Start") . "</th><th >" . T_("End") . "</th></tr></thead><tbody>"; print "<tr ><th >" . T_("Day") . "</th><th >" . T_("Start") . "</th><th >" . T_("End") . "</th></tr></thead><tbody>";
$count = 0; $count = 0;
foreach($shifts as $shift) foreach($shifts as $shift)
{ {
print "<tr id='row-$count'><td>";// class='row_to_clone' /* these are not the rows to clone...*/ 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'])); display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt']));
print "</td> 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=\"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>"; <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++; $count++;
} }
print "<tr class='row_to_clone' id='row-$count'><td>"; print "<tr class='row_to_clone' id='row-$count'><td>";
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); 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> 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>"; <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> </tbody></table>
<a class="btn btn-default btn-sm" onclick="addRow(); return false;" href=""><?php echo T_("Add row"); ?></a><br/><br/> <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"); ?>"/> <input class="btn btn-default " type="submit" name="submit" value="<?php echo T_("Save changes to shifts"); ?>"/>
</form></div> </form></div>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$('.clockpicker').clockpicker({ $('.clockpicker').clockpicker({
autoclose: true autoclose: true
}); });
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@@ -1,91 +1,91 @@
<?php <?php
/** /**
* Set if supervisor chat should be enabled and required details * Set if supervisor chat should be enabled and required details
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013 * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
if (isset($_POST['update'])) if (isset($_POST['update']))
{ {
set_setting("bosh_service",$_POST['bosh']); set_setting("bosh_service",$_POST['bosh']);
set_setting("supervisor_xmpp",$_POST['supervisor']); set_setting("supervisor_xmpp",$_POST['supervisor']);
$enable = false; $enable = false;
if (isset($_POST['enable'])) if (isset($_POST['enable']))
$enable = true; $enable = true;
set_setting("chat_enabled",$enable); 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")); 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>"; 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"); $e = get_setting("chat_enabled");
$checked = "checked='checked'"; $checked = "checked='checked'";
if (empty($e)) if (empty($e))
$checked = ""; $checked = "";
?> ?>
<form action="" method="post" class="form-horizontal"> <form action="" method="post" class="form-horizontal">
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3" for="enable"><?php echo T_("Enable supervisor chat?"); ?>: </label> <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; ?>/> <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>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3" for="bosh"><?php echo T_("Set BOSH URL"); ?>: </label> <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"); ?>'/> <input id='bosh' type='text' name='bosh' class="form-control pull-left" required size="60" value='<?php echo get_setting("bosh_service"); ?>'/>
</div> </div>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3" for="supervisor"><?php echo T_("Supervisor XMPP/Jabber id"); ?>: </label> <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"); ?>'/> <input id='supervisor' name='supervisor' type='text' class="form-control pull-left" required size="60" value='<?php echo get_setting("supervisor_xmpp"); ?>'/>
</div> </div>
<input type="submit" id="update" name="update" class="btn btn-primary col-sm-offset-3 col-sm-3" value="<?php echo T_("Update"); ?>"/> <input type="submit" id="update" name="update" class="btn btn-primary col-sm-offset-3 col-sm-3" value="<?php echo T_("Update"); ?>"/>
</form> </form>
<?php <?php
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,110 +1,110 @@
<?php <?php
/** /**
* Run the system wide case sorting process and monitor it's progress * Run the system wide case sorting process and monitor it's progress
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011 * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* Process * Process
*/ */
include ("../functions/functions.process.php"); include ("../functions/functions.process.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
if (isset($_GET['watch'])) if (isset($_GET['watch']))
{ {
//start watching process //start watching process
start_process(realpath(dirname(__FILE__) . "/systemsortprocess.php"),2); start_process(realpath(dirname(__FILE__) . "/systemsortprocess.php"),2);
} }
$p = is_process_running(2); $p = is_process_running(2);
if ($p) if ($p)
{ {
if (isset($_GET['kill'])) if (isset($_GET['kill']))
{ {
if ($_GET['kill'] == "force") if ($_GET['kill'] == "force")
end_process($p); end_process($p);
else else
kill_process($p); kill_process($p);
set_setting('systemsort',false); 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); 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>"; print "<h2>" . T_("Running process:") . " $p</h2>";
if (is_process_killed($p)) if (is_process_killed($p))
{ {
print "<h3>" . T_("Kill signal sent: Please wait...") . "</h3>"; 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>"; print "<p><a href='?kill=force'>" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "</a></p>";
} }
else else
{ {
print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a></p>"; print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a></p>";
} }
$d = process_get_data($p); $d = process_get_data($p);
if ($d !== false) if ($d !== false)
{ {
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry"))); xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
} }
} }
else else
{ {
xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css")); 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 "<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 "<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 "<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>"; print "<h2>" . T_("Outcome of last process run (if any)") . "</h2>";
$d = process_get_last_data(2); $d = process_get_last_data(2);
if ($d !== false) if ($d !== false)
{ {
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry"))); xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
} }
} }
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,137 +1,137 @@
<?php <?php
/** /**
* Modify the default timezones * Modify the default timezones
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include("../config.inc.php"); include("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
/** /**
* Display functions * Display functions
*/ */
include("../functions/functions.display.php"); include("../functions/functions.display.php");
/** /**
* Input functions * Input functions
*/ */
include("../functions/functions.input.php"); include("../functions/functions.input.php");
global $db; global $db;
if (isset($_POST['dtime_zone'])) if (isset($_POST['dtime_zone']))
{ {
set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']); set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']);
} }
if (isset($_GET['time_zone'])) if (isset($_GET['time_zone']))
{ {
//need to add sample to questionnaire //need to add sample to questionnaire
$tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc()); $tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc());
$sql = "INSERT INTO timezone_template(Time_zone_name) $sql = "INSERT INTO timezone_template(Time_zone_name)
VALUES($tz)"; VALUES($tz)";
$db->Execute($sql); $db->Execute($sql);
} }
if (isset($_GET['tz'])) if (isset($_GET['tz']))
{ {
//need to remove rsid from questionnaire //need to remove rsid from questionnaire
$tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc()); $tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc());
$sql = "DELETE FROM timezone_template $sql = "DELETE FROM timezone_template
WHERE Time_zone_name = $tz"; WHERE Time_zone_name = $tz";
$db->Execute($sql); $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" 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"); $dtz = get_setting("DEFAULT_TIME_ZONE");
$sql = "SELECT name as value, name as description, $sql = "SELECT name as value, name as description,
CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM mysql.time_zone_name FROM mysql.time_zone_name
WHERE `Name` LIKE 'Europe%' OR `Name` LIKE 'Asia%' "; WHERE `Name` LIKE 'Europe%' OR `Name` LIKE 'Asia%' ";
$tzl = $db->GetAll($sql); $tzl = $db->GetAll($sql);
if (empty($tzl) || !$tzl) 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='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: ") . "&emsp;<b class='text-primary'>$dtz</b></h3>";//<div class='panel-body'> print "<div class='col-sm-4 '><h3 class=''>" . T_("Default Timezone: ") . "&emsp;<b class='text-primary'>$dtz</b></h3>";//<div class='panel-body'>
?> ?>
<form action="" method="post" class="form-horizontal"> <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"); ?>&emsp; <?php display_chooser($tzl, 'dtime_zone', 'dtime_zone',false,false,false,true,false,true,"form-inline pull-left"); ?>&emsp;
<input type="submit" class='btn btn-default fa' name="set_dtimezone" value="<?php echo T_("Set default timezone"); ?>"/> <input type="submit" class='btn btn-default fa' name="set_dtimezone" value="<?php echo T_("Set default timezone"); ?>"/>
</form> </form>
<?php <?php
print "</div>"; print "</div>";
print "<div class='col-sm-5'><h3>" . T_("Timezone list") . "</h3>"; 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, $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 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"; FROM timezone_template ORDER BY time ASC";
$qs = $db->GetAll($sql); $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"))); 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>";
print "<div class='col-sm-3'><h3 class=''>" . T_("Add a Timezone:") . "&emsp;</h3>"; print "<div class='col-sm-3'><h3 class=''>" . T_("Add a Timezone:") . "&emsp;</h3>";
?> ?>
<form action="" method="get" class="form-horizontal"> <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"); ?>&emsp; <?php display_chooser($tzl, 'time_zone', 'time_zone',false,false,false,true,false,true,"form-inline pull-left"); ?>&emsp;
<input type="submit" class='btn btn-default fa' name="add_timezone" value="<?php echo T_("Add Timezone"); ?>"/> <input type="submit" class='btn btn-default fa' name="add_timezone" value="<?php echo T_("Add Timezone"); ?>"/>
</form> </form>
<?php <?php
print "</div>"; print "</div>";
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -1,107 +1,107 @@
<?php <?php
/** /**
* Run the VoIP monitoring process and monitor it via the database * Run the VoIP monitoring process and monitor it via the database
* *
* *
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* queXS is distributed in the hope that it will be useful, * queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software * along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* *
* @author Adam Zammit <adam.zammit@deakin.edu.au> * @author Adam Zammit <adam.zammit@deakin.edu.au>
* @copyright Deakin University 2007,2008 * @copyright Deakin University 2007,2008
* @package queXS * @package queXS
* @subpackage admin * @subpackage admin
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @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 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
include ("../config.inc.php"); include ("../config.inc.php");
/** /**
* Database file * Database file
*/ */
include ("../db.inc.php"); include ("../db.inc.php");
/** /**
* Process * Process
*/ */
include ("../functions/functions.process.php"); include ("../functions/functions.process.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include("../functions/functions.xhtml.php"); include("../functions/functions.xhtml.php");
if (isset($_GET['watch'])) if (isset($_GET['watch']))
{ {
//start watching process //start watching process
start_process(realpath(dirname(__FILE__) . "/process.php")); start_process(realpath(dirname(__FILE__) . "/process.php"));
} }
$p = is_process_running(); $p = is_process_running();
if ($p) if ($p)
{ {
if (isset($_GET['kill'])) if (isset($_GET['kill']))
{ {
if ($_GET['kill'] == "force") if ($_GET['kill'] == "force")
end_process($p); end_process($p);
else else
kill_process($p); 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); 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>"; print "<h2>" . T_("Running process:") . " $p</h2>";
if (is_process_killed($p)) 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 "<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>"; print "<p>" . T_("Process is already closed (eg. server was rebooted)") . "<a href='?kill=force'>" . T_("click here to confirm") . "</a></p>";
} }
else 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>"; 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); $d = process_get_data($p);
if ($d !== false) if ($d !== false)
{ {
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry"))); xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
} }
} }
else else
{ {
xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css")); 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 "<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 "<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>"; print "<h3>" . T_("Outcome of last process run (if any)") . "</h3>";
$d = process_get_last_data(); $d = process_get_last_data();
if ($d !== false) if ($d !== false)
{ {
xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry"))); xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry")));
} }
} }
xhtml_foot(); xhtml_foot();
?> ?>

View File

@@ -115,10 +115,10 @@ if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && iss
$js = array("js/window.js"); $js = array("js/window.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; $js[] = "include/jquery/jquery-1.4.2.min.js";
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }
xhtml_head(T_("Create appointment"),false,array("include/bootstrap-3.3.2/css/bootstrap.min.css", "css/respondent.css"),$js);//"include/clockpicker/dist/bootstrap-clockpicker.min.css", xhtml_head(T_("Create appointment"),false,array("include/bootstrap/css/bootstrap.min.css", "css/respondent.css"),$js);//"include/clockpicker/dist/bootstrap-clockpicker.min.css",
//select a respondent from a list or create a new one //select a respondent from a list or create a new one
print "<h4>" . T_("Respondent") . ":"; print "<h4>" . T_("Respondent") . ":";

View File

@@ -51,7 +51,7 @@ include("functions/functions.operator.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Appointment List"),false,array("css/table.css"),$js,false,60); xhtml_head(T_("Appointment List"),false,array("css/table.css"),$js,false,60);

View File

@@ -51,7 +51,7 @@ include("functions/functions.operator.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Availability"),false,array("css/table.css"),$js); xhtml_head(T_("Availability"),false,array("css/table.css"),$js);

View File

@@ -255,7 +255,7 @@ if (isset($_GET['newstate']))
$js = "js/window.js"; $js = "js/window.js";
if (browser_ie()) $js = "js/window_ie6.js"; if (browser_ie()) $js = "js/window_ie6.js";
xhtml_head(T_("Call"),true,array("css/call.css"),array($js,"include/jquery-ui/js/jquery-1.4.2.min.js")); xhtml_head(T_("Call"),true,array("css/call.css"),array($js,"include/jquery/jquery-1.4.2.min.js"));
$state = is_on_call($operator_id); $state = is_on_call($operator_id);
switch($state) switch($state)

View File

@@ -303,7 +303,7 @@ if (isset($_GET['newstate']))
if (browser_ie()) $js = "js/window_ie6_interface2.js"; else $js = "js/window_interface2.js"; if (browser_ie()) $js = "js/window_ie6_interface2.js"; else $js = "js/window_interface2.js";
xhtml_head(T_("Set outcome"),true,array("include/bootstrap-3.3.2/css/bootstrap.min.css"/* ,"css/call.css" */),array($js,"include/jquery-ui/js/jquery-1.4.2.min.js")); xhtml_head(T_("Set outcome"),true,array("include/bootstrap/css/bootstrap.min.css"/* ,"css/call.css" */),array($js,"include/jquery/jquery-1.4.2.min.js"));
$state = is_on_call($operator_id); $state = is_on_call($operator_id);
switch($state) switch($state)

View File

@@ -51,7 +51,7 @@ include("functions/functions.operator.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Case History List"),false,array("css/table.css"),$js,false,60); xhtml_head(T_("Case History List"),false,array("css/table.css"),$js,false,60);

View File

@@ -51,7 +51,7 @@ include("functions/functions.operator.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Call List"),false,array("css/table.css"),$js,false,60); xhtml_head(T_("Call List"),false,array("css/table.css"),$js,false,60);

View File

@@ -51,7 +51,7 @@ include("functions/functions.operator.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Case Notes"),false,array("css/table.css","css/casenote.css"),$js, (isset($_GET['add'])) ? "onload=\"document.getElementById('note').focus();\"" : false); xhtml_head(T_("Case Notes"),false,array("css/table.css","css/casenote.css"),$js, (isset($_GET['add'])) ? "onload=\"document.getElementById('note').focus();\"" : false);

View File

@@ -63,7 +63,7 @@ $js = array("js/window.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; $js[] = "include/jquery/jquery-1.4.2.min.js";
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }

View File

@@ -41,7 +41,7 @@ include_once("lang.inc.php");
* XHTML functions * XHTML functions
*/ */
include_once("functions/functions.xhtml.php"); include_once("functions/functions.xhtml.php");
include_once("functions/functions.operator.php");
xhtml_head(T_("End of work")); xhtml_head(T_("End of work"));
if (isset($_GET['auto'])) if (isset($_GET['auto']))
@@ -51,7 +51,7 @@ if (isset($_GET['auto']))
print "<h1>" . T_("Work has ended. That is it") . "</h1>"; print "<h1>" . T_("Work has ended. That is it") . "</h1>";
include_once("functions/functions.operator.php");
if (ALLOW_OPERATOR_EXTENSION_SELECT && VOIP_ENABLED) if (ALLOW_OPERATOR_EXTENSION_SELECT && VOIP_ENABLED)
{ {
//unassign extension //unassign extension

View File

@@ -112,7 +112,7 @@ if (isset($_GET['endcase']))
//if ($db->HasFailedTrans()) {print "<p>FAILED AT ENDCASE</p>"; exit();} //if ($db->HasFailedTrans()) {print "<p>FAILED AT ENDCASE</p>"; exit();}
} }
$js = array("js/popup.js","js/tabber.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","js/tabber.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
$body = true; $body = true;
$script = ""; $script = "";
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
@@ -142,7 +142,7 @@ else if (HEADER_EXPANDER_MANUAL)
$js[] = "js/headerexpandmanual.js"; $js[] = "js/headerexpandmanual.js";
} }
xhtml_head(T_("queXS"), $body, array("css/index.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js); xhtml_head(T_("queXS"), $body, array("css/index.css","css/tabber.css","include/jquery-ui/jquery-ui.min.css") , $js);
print $script; print $script;
$case_id = get_case_id($operator_id,true); $case_id = get_case_id($operator_id,true);

View File

@@ -159,7 +159,7 @@ if (isset($_GET['endcase']))
} }
$js = array("js/popup.js","js/tabber.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","js/tabber.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
$body = true; $body = true;
$script = ""; $script = "";
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
@@ -194,7 +194,7 @@ else if (HEADER_EXPANDER_MANUAL)
} }
xhtml_head(T_("Case"), $body, array("css/index_interface2.css","css/tabber_interface2.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js); xhtml_head(T_("Case"), $body, array("css/index_interface2.css","css/tabber_interface2.css","include/jquery-ui/jquery-ui.min.css") , $js);
print $script; print $script;
$case_id = get_case_id($operator_id,true); $case_id = get_case_id($operator_id,true);

View File

@@ -51,7 +51,7 @@ include ("db.inc.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Information"),true,false,$js); xhtml_head(T_("Information"),true,false,$js);

View File

@@ -70,7 +70,7 @@ if (isset($_GET['contact_phone']))
$js = array(); $js = array();
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
$jsw = "js/window.js"; $jsw = "js/window.js";
if (browser_ie()) $jsw = "js/window_ie6.js"; if (browser_ie()) $jsw = "js/window_ie6.js";

View File

@@ -58,7 +58,7 @@ include ("functions/functions.limesurvey.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("No case available"),true,array("css/table.css"),$js); xhtml_head(T_("No case available"),true,array("css/table.css"),$js);

View File

@@ -56,7 +56,7 @@ include("functions/functions.performance.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Performance"),true,array("css/table.css"),$js); xhtml_head(T_("Performance"),true,array("css/table.css"),$js);

View File

@@ -56,7 +56,7 @@ include ("functions/functions.operator.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Project information"),true,false,$js); xhtml_head(T_("Project information"),true,false,$js);

View File

@@ -63,7 +63,7 @@ $js = array("js/window.js","js/showhide.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; $js[] = "include/jquery/jquery-1.4.2.min.js";
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }

View File

@@ -54,14 +54,14 @@ $case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id); $questionnaire_id = get_questionnaire_id($operator_id);
$leavemessage = leave_message($case_id); $leavemessage = leave_message($case_id);
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }
xhtml_head(T_("Respondent Selection - Answering machine"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"),$js); xhtml_head(T_("Respondent Selection - Answering machine"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"),$js);
if ($leavemessage) if ($leavemessage)
{ {

View File

@@ -54,14 +54,14 @@ $case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id); $questionnaire_id = get_questionnaire_id($operator_id);
$leavemessage = leave_message($case_id); $leavemessage = leave_message($case_id);
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }
xhtml_head(T_("Respondent Selection - Answering machine"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"),$js); xhtml_head(T_("Respondent Selection - Answering machine"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"),$js);
if ($leavemessage) if ($leavemessage)
{ {

View File

@@ -44,7 +44,7 @@ include ("functions/functions.xhtml.php");
*/ */
include ("lang.inc.php"); include ("lang.inc.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -52,7 +52,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
} }
xhtml_head(T_("Respondent Selection - Business answers"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Business answers"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
?> ?>

View File

@@ -44,7 +44,7 @@ include ("functions/functions.xhtml.php");
*/ */
include ("lang.inc.php"); include ("lang.inc.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -52,7 +52,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
} }
xhtml_head(T_("Respondent Selection - Business answers"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Business answers"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
?> ?>

View File

@@ -54,7 +54,7 @@ include ("functions/functions.operator.php");
*/ */
include ("functions/functions.limesurvey.php"); include ("functions/functions.limesurvey.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -63,7 +63,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
xhtml_head(T_("Respondent Selection - Call back"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js ); xhtml_head(T_("Respondent Selection - Call back"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js );
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);

View File

@@ -54,7 +54,7 @@ include ("functions/functions.operator.php");
*/ */
include ("functions/functions.limesurvey.php"); include ("functions/functions.limesurvey.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -63,7 +63,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
xhtml_head(T_("Respondent Selection - Call back"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js ); xhtml_head(T_("Respondent Selection - Call back"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js );
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);

View File

@@ -54,7 +54,7 @@ include ("functions/functions.operator.php");
*/ */
include ("functions/functions.limesurvey.php"); include ("functions/functions.limesurvey.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -62,7 +62,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
} }
xhtml_head(T_("Respondent Selection - Introduction"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Introduction"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
//display introduction text //display introduction text

View File

@@ -54,7 +54,7 @@ include ("functions/functions.operator.php");
*/ */
include ("functions/functions.limesurvey.php"); include ("functions/functions.limesurvey.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -62,7 +62,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
} }
xhtml_head(T_("Respondent Selection - Introduction"),false,array("include/bootstrap-3.3.2/css/bootstrap.min.css","css/rs.css","css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Introduction"),false,array("include/bootstrap/css/bootstrap.min.css","css/rs.css","css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);

View File

@@ -59,7 +59,7 @@ if (ALTERNATE_INTERFACE && !is_voip_enabled($operator_id))
die(); die();
} }
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -68,7 +68,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id); $questionnaire_id = get_questionnaire_id($operator_id);

View File

@@ -50,7 +50,7 @@ include_once ("functions/functions.xhtml.php");
include_once ("functions/functions.operator.php"); include_once ("functions/functions.operator.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -59,7 +59,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);

View File

@@ -49,14 +49,14 @@ include ("functions/functions.xhtml.php");
*/ */
include ("functions/functions.operator.php"); include ("functions/functions.operator.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }
xhtml_head(T_("Respondent Selection - Project Introduction"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Project Introduction"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);

View File

@@ -49,14 +49,14 @@ include ("functions/functions.xhtml.php");
*/ */
include ("functions/functions.operator.php"); include ("functions/functions.operator.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }
xhtml_head(T_("Respondent Selection - Project Introduction"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Project Introduction"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);

View File

@@ -49,7 +49,7 @@ include ("functions/functions.xhtml.php");
*/ */
include ("functions/functions.operator.php"); include ("functions/functions.operator.php");
$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $js = array("js/popup.js","include/jquery/jquery-1.4.2.min.js","include/jquery-ui/jquery-ui.min.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
@@ -58,7 +58,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
xhtml_head(T_("Respondent Selection - Project Quota End"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); xhtml_head(T_("Respondent Selection - Project Quota End"),true,array("css/rs.css","include/jquery-ui/jquery-ui.min.css"), $js);
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);

View File

@@ -51,7 +51,7 @@ include("functions/functions.operator.php");
$js = false; $js = false;
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Shift List"),false,array("css/table.css"),$js,false,600); xhtml_head(T_("Shift List"),false,array("css/table.css"),$js,false,600);

View File

@@ -70,7 +70,7 @@ if ($state == 4 && AUTO_POPUP)
$js = array("js/popupkeep.js"); $js = array("js/popupkeep.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; $js[] = "include/jquery/jquery-1.4.2.min.js";
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }

View File

@@ -63,11 +63,11 @@ else
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; $js[] = "include/jquery/jquery-1.4.2.min.js";
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }
xhtml_head(T_("Status"),false,array("include/bootstrap-3.3.2/css/bootstrap.min.css","css/status_interface2.css"),$js); xhtml_head(T_("Status"),false,array("include/bootstrap/css/bootstrap.min.css","css/status_interface2.css"),$js);
$ca = get_call_attempt($operator_id,false); $ca = get_call_attempt($operator_id,false);
if ($ca) if ($ca)

View File

@@ -49,7 +49,7 @@ include ("functions/functions.xhtml.php");
*/ */
include("functions/functions.operator.php"); include("functions/functions.operator.php");
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","include/strophe/strophe.js","js/supervisorchat.js"); $js = array("include/jquery/jquery-1.4.2.min.js","include/strophe/strophe.js","js/supervisorchat.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";

View File

@@ -40,7 +40,7 @@ include_once("lang.inc.php");
*/ */
include_once("functions/functions.xhtml.php"); include_once("functions/functions.xhtml.php");
xhtml_head(T_("Standby"),false,array("include/bootstrap-3.3.2/css/bootstrap.min.css","css/index_interface2.css"), array(), false, 300); xhtml_head(T_("Standby"),false,array("include/bootstrap/css/bootstrap.min.css","css/index_interface2.css"), array(), false, 300);
if (isset($_GET['auto'])) if (isset($_GET['auto']))
{ {
@@ -197,4 +197,4 @@ else
xhtml_foot(); xhtml_foot();
?> ?>