mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
new "Operators" menu pages
new Feature: Password generator, switch to bs-toggle from bs-switch
This commit is contained in:
@@ -1,164 +0,0 @@
|
|||||||
<?php /**
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration file
|
|
||||||
*/
|
|
||||||
include_once(dirname(__FILE__).'/../config.inc.php');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Database file
|
|
||||||
*/
|
|
||||||
include ("../db.inc.php");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* XHTML functions
|
|
||||||
*/
|
|
||||||
include ("../functions/functions.xhtml.php");
|
|
||||||
|
|
||||||
$msg = "";
|
|
||||||
|
|
||||||
if (isset($_GET))
|
|
||||||
{
|
|
||||||
foreach($_GET as $key=>$val)
|
|
||||||
{
|
|
||||||
if (substr($key,0,12) == "operator_id_")
|
|
||||||
{
|
|
||||||
if (isset($_GET['extension_id']))
|
|
||||||
{
|
|
||||||
$ex = intval($_GET['extension_id']);
|
|
||||||
$op = intval($val);
|
|
||||||
|
|
||||||
$sql = "UPDATE `extension`
|
|
||||||
SET current_operator_id = $op
|
|
||||||
WHERE extension_id = $ex
|
|
||||||
AND current_operator_id IS NULL";
|
|
||||||
|
|
||||||
$db->Execute($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST['extension']))
|
|
||||||
{
|
|
||||||
$extension = $db->qstr($_POST['extension']);
|
|
||||||
$password = $db->qstr($_POST['password']);
|
|
||||||
$extension_id = "NULL";
|
|
||||||
|
|
||||||
if (isset($_POST['extensionid']))
|
|
||||||
$extension_id = intval($_POST['extensionid']);
|
|
||||||
|
|
||||||
if (isset($_POST['delete']))
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM `extension`
|
|
||||||
WHERE current_operator_id IS NULL
|
|
||||||
AND extension_id = $extension_id";
|
|
||||||
|
|
||||||
$rs = $db->Execute($sql);
|
|
||||||
|
|
||||||
if (!$rs)
|
|
||||||
$msg = ("Failed to delete extension. There may be an operator currently assigned to it");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!empty($_POST['extension']))
|
|
||||||
{
|
|
||||||
$sql = "INSERT INTO `extension` (extension_id,extension,password)
|
|
||||||
VALUES ($extension_id,$extension,$password)
|
|
||||||
ON DUPLICATE KEY UPDATE extension=$extension,password=$password";
|
|
||||||
|
|
||||||
$rs = $db->Execute($sql);
|
|
||||||
|
|
||||||
if (!$rs)
|
|
||||||
$msg = T_("Failed to add extension. There already may be an extension of this name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['unassign']))
|
|
||||||
{
|
|
||||||
$e = intval($_GET['unassign']);
|
|
||||||
|
|
||||||
$db->StartTrans();
|
|
||||||
|
|
||||||
$sql = "SELECT e.current_operator_id
|
|
||||||
FROM `extension` as e
|
|
||||||
LEFT JOIN `case` as c ON (c.current_operator_id = e.current_operator_id)
|
|
||||||
WHERE e.extension_id = $e
|
|
||||||
AND c.case_id IS NULL";
|
|
||||||
|
|
||||||
$cid = $db->GetOne($sql);
|
|
||||||
|
|
||||||
if (!empty($cid))
|
|
||||||
{
|
|
||||||
$sql = "UPDATE `extension` as e
|
|
||||||
SET current_operator_id = NULL
|
|
||||||
WHERE extension_id = $e
|
|
||||||
AND current_operator_id = $cid";
|
|
||||||
|
|
||||||
$db->Execute($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->CompleteTrans();
|
|
||||||
}
|
|
||||||
|
|
||||||
xhtml_head(T_("Display extension status"),true,array("../css/table.css"),array("../js/window.js"));
|
|
||||||
|
|
||||||
if (isset($_GET['edit']))
|
|
||||||
{
|
|
||||||
$sql = "SELECT extension,password,current_operator_id
|
|
||||||
FROM extension
|
|
||||||
WHERE extension_id = " . intval($_GET['edit']);
|
|
||||||
|
|
||||||
$rs = $db->GetRow($sql);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql= "SELECT CONCAT('<a href=\'operatorlist.php?edit=',o.operator_id,'\'>',o.firstName,' ', o.lastname,'</a>') as firstName,
|
|
||||||
CONCAT('<a href=\'?edit=',e.extension_id,'\'>',e.extension,'</a>') as extension,
|
|
||||||
IF(c.case_id IS NULL,IF(e.current_operator_id IS NULL,'list'
|
|
||||||
,CONCAT('<a href=\'?unassign=',e.extension_id,'\'>". TQ_("Unassign") ."</a>')),'". TQ_("End case to change assignment")."') as assignment,
|
|
||||||
CASE e.status WHEN 0 THEN '" . TQ_("VoIP Offline") . "' ELSE '" . TQ_("VoIP Online") . "' END as status,
|
|
||||||
CASE ca.state WHEN 0 THEN '" . TQ_("Not called") . "' WHEN 1 THEN '" . TQ_("Requesting call") . "' WHEN 2 THEN '" . TQ_("Ringing") . "' WHEN 3 THEN '" . TQ_("Answered") . "' WHEN 4 THEN '" . TQ_("Requires coding") . "' ELSE '" . TQ_("Done") . "' END as state,
|
|
||||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id , '\'>' , c.case_id, '</a>') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime,
|
|
||||||
e.status as vs,
|
|
||||||
e.extension_id
|
|
||||||
FROM extension as e
|
|
||||||
LEFT JOIN `operator` as o ON (o.operator_id = e.current_operator_id)
|
|
||||||
LEFT JOIN `case` as c ON (c.current_operator_id = o.operator_id)
|
|
||||||
LEFT JOIN `call_attempt` as cal ON (cal.operator_id = o.operator_id AND cal.end IS NULL and cal.case_id = c.case_id)
|
|
||||||
LEFT JOIN `call` as ca ON (ca.case_id = c.case_id AND ca.operator_id = o.operator_id AND ca.outcome_id= 0 AND ca.call_attempt_id = cal.call_attempt_id)
|
|
||||||
ORDER BY e.extension_id ASC";
|
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
|
||||||
|
|
||||||
if ($msg != "")
|
|
||||||
print "<p>$msg</p>";
|
|
||||||
|
|
||||||
if (!empty($rs))
|
|
||||||
{
|
|
||||||
$sql = "SELECT o.operator_id as value, CONCAT(o.firstName,' ', o.lastname) as description
|
|
||||||
FROM `operator` as o
|
|
||||||
LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id)
|
|
||||||
WHERE e.extension_id IS NULL";
|
|
||||||
|
|
||||||
$ers = $db->GetAll($sql);
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($rs); $i++)
|
|
||||||
{
|
|
||||||
if ($rs[$i]['assignment'] == "list")
|
|
||||||
$rs[$i]['assignment'] = display_chooser($ers,"operator_id_" . $rs[$i]["extension_id"],"operator_id_" . $rs[$i]["extension_id"],true,"extension_id=".$rs[$i]["extension_id"],true,false,false,false);
|
|
||||||
}
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print "<p>" . T_("No extensions") . "</p>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
xhtml_foot();
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,219 +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_("Display extension status"),true,array("../css/table.css"),array("../js/window.js"));
|
xhtml_head(T_("Extensions & status"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"));
|
||||||
|
?>
|
||||||
if (isset($_GET['edit']))
|
<script type="text/javascript">
|
||||||
{
|
//Password generator
|
||||||
$sql = "SELECT extension,password,current_operator_id
|
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');
|
||||||
FROM extension
|
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');
|
||||||
WHERE extension_id = " . intval($_GET['edit']);
|
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||||
|
//sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||||
$rs = $db->GetRow($sql);
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
function rnd(x,y,z) {
|
||||||
print "<p><a href='?'>" . T_("Go back") . "</a></p>";
|
var num;
|
||||||
?>
|
do {
|
||||||
<form enctype="multipart/form-data" action="?" method="post">
|
num = parseInt(Math.random()*z);
|
||||||
<p><?php echo T_("Extension name (such as SIP/1000):"); ?> <input name="extension" type="text" value="<?php echo $rs['extension'];?>"/></p>
|
if (num >= x && num <= y) break;
|
||||||
<p><?php echo T_("Extension password:"); ?> <input name="password" type="text" value="<?php echo $rs['password'];?>"/></p>
|
} while (true);
|
||||||
<input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/></p>
|
return(num);
|
||||||
<p><input type="submit" value="<?php echo T_("Edit extension"); ?>" /></p>
|
}
|
||||||
<?php
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
if (empty($rs['current_operator_id']))
|
function generate() {
|
||||||
{
|
var pwd = '';
|
||||||
?>
|
var res, s;
|
||||||
<br/>
|
var k = 0;
|
||||||
<p><input type="submit" name="delete" value="<?php echo T_("Delete extension"); ?>" /></p>
|
var n = document.editext.number.value;
|
||||||
</form>
|
var pass = new Array();
|
||||||
<?php
|
var w = rnd(30,80,100);
|
||||||
}
|
for (var r = 0; r < w; r++) {
|
||||||
else
|
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||||
print "<p>" . T_("Unassign the operator from this extension to be able to delete it") . "</p>";
|
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||||
|
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||||
}
|
//res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||||
else
|
}
|
||||||
{
|
for (var i = 0; i < n; i++) {
|
||||||
$sql= "SELECT CONCAT('<a href=\'operatorlist.php?edit=',o.operator_id,'\'>',o.firstName,'</a>') as firstName,
|
s = rnd(1,k-1,100);
|
||||||
CONCAT('<a href=\'?edit=',e.extension_id,'\'>',e.extension,'</a>') as extension,
|
pwd+= pass[s];
|
||||||
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,
|
document.editext.password.value = pwd;
|
||||||
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,
|
</script>
|
||||||
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,
|
<?php
|
||||||
e.extension_id
|
|
||||||
FROM extension as e
|
if (isset($_GET['edit']) || isset($_GET['addext']))
|
||||||
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)
|
if (isset($_GET['edit'])){
|
||||||
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)
|
$sql = "SELECT extension,password,current_operator_id
|
||||||
ORDER BY e.extension_id ASC";
|
FROM extension
|
||||||
|
WHERE extension_id = " . intval($_GET['edit']);
|
||||||
$rs = $db->GetAll($sql);
|
|
||||||
|
$rs = $db->GetRow($sql);
|
||||||
if ($msg != "")
|
}
|
||||||
print "<p>$msg</p>";
|
|
||||||
|
print "<a href='?' class='btn btn-default pull-left'>" . T_("Go back") . "</a>";
|
||||||
if (!empty($rs))
|
?>
|
||||||
{
|
<div class="panel-body ">
|
||||||
$sql = "SELECT o.operator_id as value, o.firstName as description
|
<h3 class="col-sm-offset-3"><?php if (isset($_GET['edit']))echo T_("Edit extension"); else echo T_("Add an extension");?></h3>
|
||||||
FROM `operator` as o
|
<form enctype="multipart/form-data" action="?" method="post" name="editext" class="form-horizontal">
|
||||||
LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id)
|
<div class="form-group form-inline">
|
||||||
WHERE e.extension_id IS NULL";
|
<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"/>
|
||||||
$ers = $db->GetAll($sql);
|
</div>
|
||||||
|
<div class="form-group form-inline">
|
||||||
for ($i = 0; $i < count($rs); $i++)
|
<label class="control-label col-sm-3"><?php echo T_("Extension password: ");?></label>
|
||||||
{
|
<input name="password" type="text" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" style="width:20em;" maxlength="50" value="<?php echo $rs['password'];?>" class="form-control pull-left" placeholder="<?php echo T_("Enter New Password");?>"/>  <?php echo T_(" or ");?> 
|
||||||
if ($rs[$i]['assignment'] == "list")
|
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("New password");?> 
|
||||||
$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);
|
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters long");?>
|
||||||
}
|
</div>
|
||||||
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"));
|
|
||||||
}
|
<div class=" col-sm-offset-3 ">
|
||||||
else
|
<input type="submit" class="btn btn-primary " value="<?php if (isset($_GET['edit'])) echo T_("Save changes"); else echo T_("Add extension"); ?>" />
|
||||||
print "<p>" . T_("No extensions") . "</p>";
|
</div>
|
||||||
|
|
||||||
print "<h2>" . T_("Add an extension") . "</h2>";
|
<?php if (isset($_GET['edit'])){?>
|
||||||
?>
|
|
||||||
|
<input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/>
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
|
||||||
<p><?php echo T_("Extension name (such as SIP/1000):"); ?> <input name="extension" type="text"/></p>
|
<?php if (empty($rs['current_operator_id'])) { ?>
|
||||||
<p><?php echo T_("Extension password:"); ?> <input name="password" type="text"/></p>
|
|
||||||
<p><input type="submit" value="<?php echo T_("Add extension"); ?>" /></p>
|
<input type="submit" name="delete" class="btn btn-danger " data-toggle="confirmation" value="<?php echo T_("Delete extension"); ?>" />
|
||||||
</form>
|
|
||||||
|
<?php } else
|
||||||
<?php
|
print "</br></br><b class='well text-danger'>" . T_("Unassign the operator from this extension to be able to delete it") . "</b>";
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_foot();
|
print "</form></div>";
|
||||||
|
}
|
||||||
?>
|
else
|
||||||
|
{
|
||||||
|
$sql= "SELECT CONCAT('<a href=\'operatorlist.php?edit=',o.operator_id,'\'>',o.firstName,' ', o.lastname,'</a>') as firstName,
|
||||||
|
CONCAT('<a href=\'?edit=',e.extension_id,'\' class=\'\'>',e.extension,'</a>') as extension,
|
||||||
|
IF(c.case_id IS NULL,IF(e.current_operator_id IS NULL,'list'
|
||||||
|
,CONCAT('<a href=\'?unassign=',e.extension_id,'\'>". TQ_("Unassign") ."</a>')),'". TQ_("End case to change assignment")."') as assignment,
|
||||||
|
CASE e.status WHEN 0 THEN '" . TQ_("VoIP Offline") . "' ELSE '" . TQ_("VoIP Online") . "' END as status,
|
||||||
|
CASE ca.state WHEN 0 THEN '" . TQ_("Not called") . "' WHEN 1 THEN '" . TQ_("Requesting call") . "' WHEN 2 THEN '" . TQ_("Ringing") . "' WHEN 3 THEN '" . TQ_("Answered") . "' WHEN 4 THEN '" . TQ_("Requires coding") . "' ELSE '" . TQ_("Done") . "' END as state,
|
||||||
|
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id , '\'>' , c.case_id, '</a>') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime,
|
||||||
|
e.status as vs,
|
||||||
|
e.extension_id
|
||||||
|
FROM extension as e
|
||||||
|
LEFT JOIN `operator` as o ON (o.operator_id = e.current_operator_id)
|
||||||
|
LEFT JOIN `case` as c ON (c.current_operator_id = o.operator_id)
|
||||||
|
LEFT JOIN `call_attempt` as cal ON (cal.operator_id = o.operator_id AND cal.end IS NULL and cal.case_id = c.case_id)
|
||||||
|
LEFT JOIN `call` as ca ON (ca.case_id = c.case_id AND ca.operator_id = o.operator_id AND ca.outcome_id= 0 AND ca.call_attempt_id = cal.call_attempt_id)
|
||||||
|
ORDER BY e.extension_id ASC";
|
||||||
|
|
||||||
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
|
if ($msg != "")
|
||||||
|
print "<p>$msg</p>";
|
||||||
|
|
||||||
|
if (!empty($rs))
|
||||||
|
{
|
||||||
|
$sql = "SELECT o.operator_id as value, o.firstName as description
|
||||||
|
FROM `operator` as o
|
||||||
|
LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id)
|
||||||
|
WHERE e.extension_id IS NULL";
|
||||||
|
|
||||||
|
$ers = $db->GetAll($sql);
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($rs); $i++)
|
||||||
|
{
|
||||||
|
if ($rs[$i]['assignment'] == "list")
|
||||||
|
$rs[$i]['assignment'] = display_chooser($ers,"operator_id_" . $rs[$i]["extension_id"],"operator_id_" . $rs[$i]["extension_id"],true,"extension_id=".$rs[$i]["extension_id"],true,false,false,false);
|
||||||
|
}
|
||||||
|
print "<div class='panel-body'>";
|
||||||
|
xhtml_table($rs,array("extension","firstName","assignment","status","case_id","state","calltime"),array(T_("Extension"),T_("Operator"),T_("Assignment"),T_("VoIP Status"),T_("Case ID"),T_("Call state"),T_("Time on call")),"tclass",array("vs" => "1"));
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
print "<p>" . T_("No extensions") . "</p>";
|
||||||
|
|
||||||
|
print "<div class='col-sm-3'><a href='?addext=addext' class='btn btn-default '>" . T_("Add extension") . "</a></div>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
xhtml_foot();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,315 +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 = T_("If changing usernames, you must specify a new password");
|
$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 = T_("Successfully updated user");
|
$msg = "<div class='alert alert-info'><h3>" . T_("Successfully updated user") . ": " . $_POST['username'] . "</h3></div>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$msg = T_("Failed to update user. Please make sure the username is unique");
|
$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_("Operator edit"),true,array("../css/table.css"));
|
xhtml_head(T_("Edit Operator settings"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/bootstrap-3.3.2/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js"));
|
||||||
|
|
||||||
$operator_id = intval($_GET['edit']);
|
$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);
|
||||||
|
?>
|
||||||
print "<h2>" . T_("Edit") . ": " . $rs['username'] . "</h2>";
|
|
||||||
echo "<p><a href='?'>" . T_("Go back") . "</a></p>";
|
<script type="text/javascript">
|
||||||
if (!empty($msg)) print "<h3>$msg</h3>";
|
//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');
|
||||||
$sql = "SELECT extension_id as value, extension as description,
|
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');
|
||||||
CASE WHEN current_operator_id = $operator_id THEN 'selected=\'selected\'' ELSE '' END AS selected
|
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||||
FROM extension
|
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||||
WHERE current_operator_id IS NULL
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
OR current_operator_id = $operator_id";
|
function rnd(x,y,z) {
|
||||||
|
var num;
|
||||||
$ers = $db->GetAll($sql);
|
do {
|
||||||
|
num = parseInt(Math.random()*z);
|
||||||
?>
|
if (num >= x && num <= y) break;
|
||||||
<form action="?" method="post">
|
} while (true);
|
||||||
<div><label for="username"><?php echo T_("Username") . ": "; ?></label><input type='text' name='username' value="<?php echo $rs['username'];?>"/></div>
|
return(num);
|
||||||
<?php
|
}
|
||||||
if (HTPASSWD_PATH !== false)
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
{ ?>
|
function generate() {
|
||||||
<div><label for="password"><?php echo T_("Update password (leave blank to keep existing password)") . ": "; ?></label><input type='text' name='password'/></div>
|
var pwd = '';
|
||||||
<?php }
|
var res, s;
|
||||||
?>
|
var k = 0;
|
||||||
<div><label for="firstName"><?php echo T_("First name") . ": "; ?></label><input type='text' name='firstName' value="<?php echo $rs['firstName'];?>"/></div>
|
var n = document.operform.number.value;
|
||||||
<div><label for="lastName"><?php echo T_("Last name") . ": "; ?></label><input type='text' name='lastName' value="<?php echo $rs['lastName'];?>"/></div>
|
var pass = new Array();
|
||||||
<div><label for="extension_id"><?php echo T_("Extension"); echo "</label>"; display_chooser($ers,"extension_id","extension_id",true,false,false,false); ?> </div>
|
var w = rnd(30,80,100);
|
||||||
<div><label for="chat_user"><?php echo T_("Jabber/XMPP chat user") . ": "; ?></label><input type='text' name='chat_user' value="<?php echo $rs['chat_user'];?>"/></div>
|
for (var r = 0; r < w; r++) {
|
||||||
<div><label for="chat_password"><?php echo T_("Jabber/XMPP chat password") . ": "; ?></label><input type='text' name='chat_password' value="<?php echo $rs['chat_password'];?>"/></div>
|
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||||
<div><label for="chat_enable"><?php echo T_("Uses chat") . "? ";?></label><input type="checkbox" name="chat_enable" <?php if ($rs['chat_enable'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
|
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||||
<div><label for="timezone"><?php echo T_("Timezone") . ": ";?></label><?php display_chooser($tz,"timezone","timezone",false,false,false,false,array("value",$rs['Time_zone_name'])); ?></div>
|
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||||
<div><label for="enabled"><?php echo T_("Enabled") . "? ";?></label><input type="checkbox" name="enabled" <?php if ($rs['enabled'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
|
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||||
<div><label for="voip"><?php echo T_("Uses VoIP") . "? ";?></label><input type="checkbox" name="voip" <?php if ($rs['voip'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
|
}
|
||||||
<div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></div>
|
for (var i = 0; i < n; i++) {
|
||||||
<div><input type='hidden' name='existing_username' value="<?php echo $rs['username'];?>"/></div>
|
s = rnd(1,k-1,100);
|
||||||
<div><input type="submit" name="submit" value="<?php echo T_("Update operator");?>"/></div>
|
pwd+= pass[s];
|
||||||
</form>
|
}
|
||||||
<?php
|
document.operform.password.value = pwd;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
xhtml_foot();
|
|
||||||
exit();
|
<div class="form-group clearfix"><div class="col-sm-3"><a href='?' class="btn btn-default"><?php echo T_("Go back") ;?></a></div><div class="col-sm-6">
|
||||||
}
|
<?php
|
||||||
|
print "<h3>" . T_("Operator") . ": " . $rs['username'] . "</h3>";
|
||||||
|
echo "</div></div>";
|
||||||
|
|
||||||
if (isset($_GET['voipdisable']))
|
if (!empty($msg)) echo $msg;
|
||||||
{
|
|
||||||
$operator_id = intval($_GET['voipdisable']);
|
$sql = "SELECT extension_id as value, extension as description,
|
||||||
|
CASE WHEN current_operator_id = $operator_id THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||||
$sql = "UPDATE operator
|
FROM extension
|
||||||
SET voip = 0
|
WHERE current_operator_id IS NULL
|
||||||
WHERE operator_id = '$operator_id'";
|
OR current_operator_id = $operator_id";
|
||||||
|
|
||||||
$db->Execute($sql);
|
$ers = $db->GetAll($sql);
|
||||||
}
|
|
||||||
|
?>
|
||||||
if (isset($_GET['voipenable']))
|
<form action="?" method="post" class="form-horizontal panel-body" name="operform">
|
||||||
{
|
<div class="form-group">
|
||||||
$operator_id = intval($_GET['voipenable']);
|
<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>
|
||||||
$sql = "UPDATE operator
|
</div>
|
||||||
SET voip = 1
|
<?php if (HTPASSWD_PATH !== false) { ?>
|
||||||
WHERE operator_id = '$operator_id'";
|
<div class="form-group">
|
||||||
|
<label for="password" class="col-sm-3 control-label"><?php echo T_("Password") . ": "; ?></label>
|
||||||
$db->Execute($sql);
|
<div class="col-sm-3"><input type='text' name='password' class="form-control" placeholder="<?php echo T_("leave blank to keep existing password");?>"/></div>
|
||||||
}
|
<div class="col-sm-6 form-inline"> 
|
||||||
|
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default"/> <?php echo T_("Password with");?> 
|
||||||
|
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||||
if (isset($_GET['disable']))
|
</div>
|
||||||
{
|
</div>
|
||||||
$operator_id = intval($_GET['disable']);
|
<?php } ?>
|
||||||
|
<div class="form-group">
|
||||||
$sql = "UPDATE operator
|
<label for="firstName" class="col-sm-3 control-label"><?php echo T_("First name") . ": "; ?></label>
|
||||||
SET enabled = 0
|
<div class="col-sm-3"><input type='text' name='firstName' class="form-control" value="<?php echo $rs['firstName'];?>"/></div>
|
||||||
WHERE operator_id = '$operator_id'";
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
$db->Execute($sql);
|
<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>
|
||||||
if (isset($_GET['enable']))
|
<div class="form-group">
|
||||||
{
|
<label for="timezone" class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
|
||||||
$operator_id = intval($_GET['enable']);
|
<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">
|
||||||
$sql = "UPDATE operator
|
<?php echo T_("Edit") . " ";?>
|
||||||
SET enabled = 1
|
<a href='timezonetemplate.php' class="btn btn-default"><?php echo T_("TimeZones list");?></a>
|
||||||
WHERE operator_id = '$operator_id'";
|
</div>
|
||||||
|
</div>
|
||||||
$db->Execute($sql);
|
<div class="form-group">
|
||||||
}
|
<label for="extension_id" class="col-sm-3 control-label"><?php echo T_("Extension") . ": "; ?></label>
|
||||||
|
<div class="col-sm-3"><?php echo display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline"); ?> </div>
|
||||||
if (isset($_GET['operator_id']))
|
<div class="col-sm-6 form-inline">
|
||||||
{
|
<?php echo T_("Edit") . " ";?>
|
||||||
$operator_id = intval($_GET['operator_id']);
|
<a href='extensionstatus.php' class="btn btn-default"><?php echo T_("Extensions");?></a>
|
||||||
|
</div>
|
||||||
$sql = "SELECT *,SUBSTRING_INDEX(e.extension, '/', -1) as ext
|
</div>
|
||||||
FROM extension as e
|
<div class="form-group">
|
||||||
WHERE e.current_operator_id = $operator_id";
|
<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>
|
||||||
$rs = $db->GetRow($sql);
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
if (!empty($rs))
|
<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>
|
||||||
$display = false;
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
if (isset($_GET['winbat']) || isset($_GET['sh']))
|
<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>
|
||||||
header("Content-Type: text/txt");
|
</div>
|
||||||
if (isset($_GET['winbat']))
|
<div class="form-group">
|
||||||
header("Content-Disposition: attachment; filename=operator_$operator_id.bat");
|
<label for="chat_enable" class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
|
||||||
else
|
<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>
|
||||||
header("Content-Disposition: attachment; filename=operator_$operator_id.sh");
|
</div>
|
||||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
<div class="form-group">
|
||||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
<label for="enabled" class="col-sm-3 control-label"><?php echo T_("Enabled") . "? ";?></label>
|
||||||
header("Pragma: public"); // HTTP/1.0
|
<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>
|
||||||
if (isset($_GET['winbat']))
|
<div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></div>
|
||||||
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
<div><input type='hidden' name='existing_username' value="<?php echo $rs['username'];?>"/></div>
|
||||||
else
|
|
||||||
echo "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="submit" class="btn btn-primary btn-block" value="<?php echo T_("Update operator");?>"/></div></div>
|
||||||
}
|
</form>
|
||||||
}
|
|
||||||
}
|
|
||||||
|
<?php
|
||||||
if ($display)
|
xhtml_foot();
|
||||||
{
|
exit();
|
||||||
$sql = "SELECT
|
}
|
||||||
CONCAT(firstName, ' ', lastName) as name,
|
|
||||||
e.extension,
|
if (isset($_GET['voipdisable']))
|
||||||
CONCAT('<a href=\'?winbat=winbat&operator_id=',operator_id,'\'>" . TQ_("Windows bat file") . "</a>') as winbat,
|
{
|
||||||
CONCAT('<a href=\'?sh=sh&operator_id=',operator_id,'\'>" . TQ_("*nix script file") . "</a>') as sh,
|
$operator_id = intval($_GET['voipdisable']);
|
||||||
CASE WHEN enabled = 0 THEN
|
|
||||||
CONCAT('<a href=\'?enable=',operator_id,'\'>" . TQ_("Enable") . "</a>')
|
$sql = "UPDATE operator
|
||||||
ELSE
|
SET voip = 0
|
||||||
CONCAT('<a href=\'?disable=',operator_id,'\'>" . TQ_("Disable") . "</a>')
|
WHERE operator_id = '$operator_id'";
|
||||||
END
|
|
||||||
as enabledisable,
|
$db->Execute($sql);
|
||||||
CASE WHEN voip = 0 THEN
|
}
|
||||||
CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . TQ_("Enable VoIP") . "</a>')
|
|
||||||
ELSE
|
if (isset($_GET['voipenable']))
|
||||||
CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . TQ_("Disable VoIP") . "</a>')
|
{
|
||||||
END as voipenabledisable,
|
$operator_id = intval($_GET['voipenable']);
|
||||||
CONCAT('<a href=\'?edit=',operator_id,'\'>" . TQ_("Edit") . "</a>') as edit,
|
|
||||||
username
|
$sql = "UPDATE operator
|
||||||
FROM operator
|
SET voip = 1
|
||||||
LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)";
|
WHERE operator_id = '$operator_id'";
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
$db->Execute($sql);
|
||||||
|
}
|
||||||
xhtml_head(T_("Operator list"),true,array("../css/table.css"));
|
|
||||||
|
if (isset($_GET['disable']))
|
||||||
$columns = array("name","username","extension","enabledisable","edit");
|
{
|
||||||
$titles = array(T_("Operator"),T_("Username"),T_("Extension"),T_("Enable/Disable"),T_("Edit"));
|
$operator_id = intval($_GET['disable']);
|
||||||
|
|
||||||
if (VOIP_ENABLED)
|
$sql = "UPDATE operator
|
||||||
{
|
SET enabled = 0
|
||||||
print "<p>" . 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") . "</p>";
|
WHERE operator_id = '$operator_id'";
|
||||||
|
|
||||||
print "<p><a href='../voipclient.exe'>" . T_("Download Windows VoIP Executable") . "</a></p>";
|
$db->Execute($sql);
|
||||||
print "<p><a href='../voipclient'>" . T_("Download Linux VoIP Executable") . "</a></p>";
|
}
|
||||||
|
|
||||||
$columns[] = "voipenabledisable";
|
if (isset($_GET['enable']))
|
||||||
$columns[] = "winbat";
|
{
|
||||||
$columns[] = "sh";
|
$operator_id = intval($_GET['enable']);
|
||||||
$titles[] = T_("Enable/Disable VoIP");
|
|
||||||
$titles[] = T_("Windows VoIP");
|
$sql = "UPDATE operator
|
||||||
$titles[] = T_("*nix VoIP");
|
SET enabled = 1
|
||||||
}
|
WHERE operator_id = '$operator_id'";
|
||||||
|
|
||||||
xhtml_table($rs,$columns,$titles);
|
$db->Execute($sql);
|
||||||
|
}
|
||||||
|
|
||||||
xhtml_foot();
|
if (isset($_GET['operator_id']))
|
||||||
}
|
{
|
||||||
?>
|
$operator_id = intval($_GET['operator_id']);
|
||||||
|
|
||||||
|
$sql = "SELECT *,SUBSTRING_INDEX(e.extension, '/', -1) as ext
|
||||||
|
FROM extension as e
|
||||||
|
WHERE e.current_operator_id = $operator_id";
|
||||||
|
|
||||||
|
$rs = $db->GetRow($sql);
|
||||||
|
|
||||||
|
if (!empty($rs))
|
||||||
|
{
|
||||||
|
$display = false;
|
||||||
|
|
||||||
|
if (isset($_GET['winbat']) || isset($_GET['sh']))
|
||||||
|
{
|
||||||
|
header("Content-Type: text/txt");
|
||||||
|
if (isset($_GET['winbat']))
|
||||||
|
header("Content-Disposition: attachment; filename=operator_$operator_id.bat");
|
||||||
|
else
|
||||||
|
header("Content-Disposition: attachment; filename=operator_$operator_id.sh");
|
||||||
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||||
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||||
|
header("Pragma: public"); // HTTP/1.0
|
||||||
|
|
||||||
|
if (isset($_GET['winbat']))
|
||||||
|
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||||
|
else
|
||||||
|
echo "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($display)
|
||||||
|
{
|
||||||
|
$sql = "SELECT
|
||||||
|
CONCAT(firstName, ' ', lastName) as name,
|
||||||
|
CONCAT ('<a href=\'extensionstatus.php?edit=',e.extension_id,'\'>', e.extension ,'</a>') as `extension`,
|
||||||
|
CONCAT('<a href=\'?winbat=winbat&operator_id=',operator_id,'\'>" . TQ_("Win .bat file") . "</a>') as winbat,
|
||||||
|
CONCAT('<a href=\'?sh=sh&operator_id=',operator_id,'\'>" . TQ_("*nix script file") . "</a>') as sh,
|
||||||
|
CASE WHEN enabled = 0 THEN
|
||||||
|
CONCAT(' <a href=\'?enable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Enable") . "\' class=\'fa fa-toggle-off fa-2x\' style=\'color:grey;\'></i></a> ')
|
||||||
|
ELSE
|
||||||
|
CONCAT(' <a href=\'?disable=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Disable") . "\' class=\'fa fa-toggle-on fa-2x\'></i></a> ')
|
||||||
|
END as enabledisable,
|
||||||
|
CASE WHEN voip = 0 THEN
|
||||||
|
CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . TQ_("Enable VoIP") . "</a>')
|
||||||
|
ELSE
|
||||||
|
CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . TQ_("Disable VoIP") . "</a>')
|
||||||
|
END as voipenabledisable,
|
||||||
|
CONCAT(' <a href=\'?edit=',operator_id,'\'><i data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\' class=\'fa fa-pencil-square-o fa-lg\'></i></a> ') as edit, username
|
||||||
|
FROM operator
|
||||||
|
LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)";
|
||||||
|
|
||||||
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
|
xhtml_head(T_("Operator list"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/font-awesome-4.3.0/css/font-awesome.css","../css/custom.css"));
|
||||||
|
|
||||||
|
$columns = array("name","username","extension","enabledisable","edit");
|
||||||
|
$titles = array(T_("Operator"),T_("Username"),T_("Extension")," <i class='fa fa-lg fa-power-off '></i>"," <i class='fa fa-lg fa-pencil-square-o'></i>");
|
||||||
|
|
||||||
|
if (VOIP_ENABLED)
|
||||||
|
{
|
||||||
|
$columns[] = "voipenabledisable";
|
||||||
|
$columns[] = "winbat";
|
||||||
|
$columns[] = "sh";
|
||||||
|
$titles[] = T_("VoIP ON/Off");
|
||||||
|
$titles[] = T_("Win file");//Windows VoIP
|
||||||
|
$titles[] = T_("*nix flle");//*nix VoIP
|
||||||
|
}
|
||||||
|
echo "<div class=' col-sm-10'><div class=' panel-body'>";
|
||||||
|
xhtml_table($rs,$columns,$titles);
|
||||||
|
echo "</div></div>";
|
||||||
|
|
||||||
|
echo "<div class='form-group col-sm-2'>
|
||||||
|
<div class='panel-body'><a href='operators.php?add=add' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-plus'></i> " . T_("Add an operator") . "</a></div>
|
||||||
|
<div class='panel-body'><a href='extensionstatus.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-whatsapp'></i> " . T_("Extensions") . "</a></div>
|
||||||
|
<div class='panel-body'><a href='operatorquestionnaire.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-link'></i> " . T_("Assign to questionnaire") . "</a></div>
|
||||||
|
<div class='panel-body'><a href='operatorskill.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-md'></i> " . T_("Operator skills") . "</a></div>
|
||||||
|
<div class='panel-body'><a href='operatorperformance.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-signal'></i> " . T_("Operator performance") . "</a></div>";
|
||||||
|
|
||||||
|
if (VOIP_ENABLED)
|
||||||
|
{
|
||||||
|
print "<div class='well'>" . T_("Download the file for each user and save in the same folder as the voip.exe executable. When the file is executed, it will run the voip.exe program with the correct connection details to connect the operator to the VoIP server"). "</br></br>";
|
||||||
|
|
||||||
|
print "<a href='../voip/voipclient.exe' class='btn btn-default btn-block' title='" . T_("Download Windows VoIP Client Executable file") . "'><i class='fa fa-lg fa-download'></i> " . T_("Download Win file") . "</a></br>";
|
||||||
|
print "<a href='../voip/voipclient' class='btn btn-default btn-block' title='" . T_("Download Linux VoIP Executable file") . "'><i class='fa fa-lg fa-download'></i> " . T_("Download Linux file") . "</a></div>";
|
||||||
|
|
||||||
|
}
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
xhtml_foot();
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -1,284 +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
|
||||||
|
FROM operator_questionnaire
|
||||||
$sql = "DELETE
|
WHERE questionnaire_id IN (
|
||||||
FROM operator_questionnaire
|
SELECT questionnaire_id
|
||||||
WHERE questionnaire_id IN (
|
FROM questionnaire
|
||||||
SELECT questionnaire_id
|
WHERE enabled = 1)
|
||||||
FROM questionnaire
|
AND operator_id IN (
|
||||||
WHERE enabled = 1)
|
SELECT operator_id
|
||||||
AND operator_id IN (
|
FROM operator
|
||||||
SELECT operator_id
|
WHERE enabled = 1)";
|
||||||
FROM operator
|
|
||||||
WHERE enabled = 1)";
|
$db->Execute($sql);
|
||||||
|
|
||||||
$db->Execute($sql);
|
foreach ($_POST as $g => $v)
|
||||||
|
{
|
||||||
foreach ($_POST as $g => $v)
|
$a = explode("_",$g);
|
||||||
{
|
if ($a[0] == "cb")
|
||||||
$a = explode("_",$g);
|
vqi($a[2],$a[1]);
|
||||||
if ($a[0] == "cb")
|
}
|
||||||
vqi($a[2],$a[1]);
|
|
||||||
}
|
$db->CompleteTrans();
|
||||||
|
}
|
||||||
$db->CompleteTrans();
|
|
||||||
}
|
|
||||||
|
$sql = "SELECT questionnaire_id,description
|
||||||
|
FROM questionnaire
|
||||||
|
WHERE enabled = 1
|
||||||
$sql = "SELECT questionnaire_id,description
|
ORDER by questionnaire_id DESC";
|
||||||
FROM questionnaire
|
|
||||||
WHERE enabled = 1
|
$questionnaires = $db->GetAll($sql);
|
||||||
ORDER by questionnaire_id DESC";
|
|
||||||
|
$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName ) as opname, username
|
||||||
$questionnaires = $db->GetAll($sql);
|
FROM operator
|
||||||
|
WHERE enabled = 1
|
||||||
$sql = "SELECT operator_id,firstname as description
|
ORDER by operator_id ASC";
|
||||||
FROM operator
|
|
||||||
WHERE enabled = 1
|
$operators = $db->GetAll($sql);
|
||||||
ORDER by operator_id ASC";
|
|
||||||
|
|
||||||
$operators = $db->GetAll($sql);
|
xhtml_head(T_("Assign operators to questionnaires"),true,array("../include/bootstrap-3.3.2/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../js/jquery-2.1.3.min.js","../include/iCheck/icheck.min.js"));
|
||||||
|
|
||||||
|
?>
|
||||||
xhtml_head(T_("Assign operators to questionnaires"),false,array("../css/table.css"));
|
|
||||||
|
<script type="text/javascript">
|
||||||
?>
|
|
||||||
|
<?php
|
||||||
<script type="text/javascript">
|
print "questionnaire_id = new Array(";
|
||||||
|
|
||||||
<?php
|
$s = "";
|
||||||
print "questionnaire_id = new Array(";
|
|
||||||
|
foreach($questionnaires as $q)
|
||||||
$s = "";
|
{
|
||||||
|
$s .= "'{$q['questionnaire_id']}',";
|
||||||
foreach($questionnaires as $q)
|
}
|
||||||
{
|
|
||||||
$s .= "'{$q['questionnaire_id']}',";
|
$s = substr($s,0,strlen($s) - 1);
|
||||||
}
|
print "$s);\n";
|
||||||
|
|
||||||
$s = substr($s,0,strlen($s) - 1);
|
print "operator_id = new Array(";
|
||||||
print "$s);\n";
|
|
||||||
|
$s = "";
|
||||||
print "operator_id = new Array(";
|
|
||||||
|
foreach($operators as $q)
|
||||||
$s = "";
|
{
|
||||||
|
$s .= "'{$q['operator_id']}',";
|
||||||
foreach($operators as $q)
|
}
|
||||||
{
|
|
||||||
$s .= "'{$q['operator_id']}',";
|
$s = substr($s,0,strlen($s) - 1);
|
||||||
}
|
print "$s);\n";
|
||||||
|
|
||||||
$s = substr($s,0,strlen($s) - 1);
|
?>
|
||||||
print "$s);\n";
|
|
||||||
|
var QidOn = 0;
|
||||||
?>
|
var VidOn = 0;
|
||||||
|
|
||||||
var QidOn = 0;
|
function checkQid(q)
|
||||||
var VidOn = 0;
|
{
|
||||||
|
|
||||||
function checkQid(q)
|
for (y in operator_id)
|
||||||
{
|
{
|
||||||
|
v = operator_id[y];
|
||||||
for (y in operator_id)
|
|
||||||
{
|
cb = document.getElementById('cb_' + q + "_" + v);
|
||||||
v = operator_id[y];
|
|
||||||
|
if (QidOn == 0)
|
||||||
cb = document.getElementById('cb_' + q + "_" + v);
|
cb.checked = 'checked';
|
||||||
|
else
|
||||||
if (QidOn == 0)
|
cb.checked = '';
|
||||||
cb.checked = 'checked';
|
|
||||||
else
|
}
|
||||||
cb.checked = '';
|
|
||||||
|
if (QidOn == 0)
|
||||||
}
|
QidOn = 1;
|
||||||
|
else
|
||||||
if (QidOn == 0)
|
QidOn = 0;
|
||||||
QidOn = 1;
|
}
|
||||||
else
|
|
||||||
QidOn = 0;
|
function checkVid(v)
|
||||||
}
|
{
|
||||||
|
|
||||||
|
for (y in questionnaire_id)
|
||||||
|
{
|
||||||
function checkVid(v)
|
q = questionnaire_id[y];
|
||||||
{
|
|
||||||
|
cb = document.getElementById('cb_' + q + "_" + v);
|
||||||
for (y in questionnaire_id)
|
|
||||||
{
|
if (VidOn == 0)
|
||||||
q = questionnaire_id[y];
|
cb.checked = 'checked';
|
||||||
|
else
|
||||||
cb = document.getElementById('cb_' + q + "_" + v);
|
cb.checked = '';
|
||||||
|
|
||||||
if (VidOn == 0)
|
}
|
||||||
cb.checked = 'checked';
|
|
||||||
else
|
if (VidOn == 0)
|
||||||
cb.checked = '';
|
VidOn = 1;
|
||||||
|
else
|
||||||
}
|
VidOn = 0;
|
||||||
|
}
|
||||||
if (VidOn == 0)
|
|
||||||
VidOn = 1;
|
</script>
|
||||||
else
|
|
||||||
VidOn = 0;
|
</head>
|
||||||
}
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
</script>
|
|
||||||
</head>
|
print "<form action=\"\" method=\"post\" class=''><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||||
<body>
|
|
||||||
|
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Operator") . " </th>";
|
||||||
|
foreach($questionnaires as $q)
|
||||||
<?php
|
{
|
||||||
|
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
|
||||||
|
}
|
||||||
|
print "</tr></thead>";
|
||||||
print "<form action=\"\" method=\"post\"><table>";
|
|
||||||
|
|
||||||
print "<tr><th></th>";
|
foreach($operators as $v)
|
||||||
foreach($questionnaires as $q)
|
{
|
||||||
{
|
|
||||||
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>";
|
print "<tr class=''>
|
||||||
}
|
<th> {$v['username']} </th>
|
||||||
print "</tr>";
|
<th style=\"text-align: left;\";> <a href=\"javascript:checkVid({$v['operator_id']})\" >{$v['opname']}</a> </th>";
|
||||||
|
foreach($questionnaires as $q)
|
||||||
$class = 0;
|
{
|
||||||
|
$checked = "";
|
||||||
foreach($operators as $v)
|
if (vq($v['operator_id'],$q['questionnaire_id'])) $checked="checked=\"checked\"";
|
||||||
{
|
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" $checked style=\"width: 16px; height: 16px; margin-top: 5px;\"></input></td>";
|
||||||
print "<tr class='";
|
}
|
||||||
if ($class == 0) {$class = 1; print "even";} else {$class = 0; print "odd";}
|
|
||||||
print "'>";
|
print "</tr>";
|
||||||
print "<th><a href=\"javascript:checkVid({$v['operator_id']})\">{$v['description']}</a></th>";
|
}
|
||||||
foreach($questionnaires as $q)
|
|
||||||
{
|
|
||||||
$checked = "";
|
print "</table><input class='btn btn-default fa' type='submit' name='submit' value='" . T_("Assign operators to questionnaires") . "'/></form>";
|
||||||
if (vq($v['operator_id'],$q['questionnaire_id'])) $checked="checked=\"checked\"";
|
|
||||||
print "<td><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['operator_id']}\" $checked></input></td>";
|
|
||||||
}
|
xhtml_foot();
|
||||||
|
|
||||||
print "</tr>";
|
?>
|
||||||
}
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('input').iCheck({
|
||||||
print "</table><p><input type=\"submit\" name=\"submit\" value=\"" . T_("Assign operators to questionnaires") . "\"/></p></form>";
|
checkboxClass: 'icheckbox_square-blue',
|
||||||
|
increaseArea: '30%'
|
||||||
|
});
|
||||||
xhtml_foot();
|
</script>
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,232 +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']))
|
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 = "1000";
|
$extensionn = "2000";
|
||||||
$extension = "'IAX2/1000'";
|
$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 = 12;
|
$length = 25;
|
||||||
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
for ($i = 0; $i < $length; $i++)
|
for ($i = 0; $i < $length; $i++)
|
||||||
$extensionnp .= $chars[(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 = T_("Added:") . " " . $operator;
|
$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>";
|
||||||
if ($temporary)
|
|
||||||
{
|
if ($temporary)
|
||||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
{
|
||||||
VALUES ('$oid','1')");
|
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
VALUES ('$oid','1')");
|
||||||
VALUES ('$oid','5')"); //and appointment
|
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||||
}
|
VALUES ('$oid','5')"); //and appointment
|
||||||
|
}
|
||||||
if ($supervisor)
|
|
||||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
if ($supervisor)
|
||||||
VALUES ('$oid','2')");
|
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||||
|
VALUES ('$oid','2')");
|
||||||
if ($refusal)
|
|
||||||
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
if ($refusal)
|
||||||
VALUES ('$oid','3')");
|
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
|
||||||
|
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"));
|
||||||
}
|
|
||||||
|
if ($a) {
|
||||||
|
echo $a;
|
||||||
xhtml_head(T_("Add an operator"));
|
}
|
||||||
|
else {
|
||||||
if ($a)
|
echo "<div class='well'>";
|
||||||
{
|
//echo "<p>" . T_("Adding an operator here will give the user the ability to call cases") . "<a href='operatorquestionnaire.php'>" . T_("Assign Operator to Questionnaire") . "</a>" . T_("tool") . ".</p>";
|
||||||
?>
|
echo "<p>" . T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here.") . "</p>";
|
||||||
<h3><?php echo $a; ?></h3>
|
echo "<p>" . T_("The username and extension must be unique for each operator.") . "</p>";
|
||||||
<?php
|
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);
|
||||||
|
?>
|
||||||
?>
|
|
||||||
<h1><?php echo T_("Add an operator"); ?></h1>
|
<script type="text/javascript">
|
||||||
<p><?php echo T_("Adding an operator here will give the user the ability to call cases"); ?> <a href="operatorquestionnaire.php"><?php echo T_("Assign Operator to Questionnaire"); ?></a> <?php echo T_("tool"); ?>.</p>
|
//Password generator
|
||||||
<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>
|
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');
|
||||||
<p><?php echo T_("The username and extension must be unique for each operator.")?></p>
|
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');
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
dig = new Array('0','1','2','3','4','5','6','7','8','9');
|
||||||
<p><?php echo T_("Enter the username of an operator to add:"); ?> <input name="operator" type="text"/></p>
|
sym = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','=','|',';','.','/','?','<','>','{','}','[',']');
|
||||||
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
<p><?php echo T_("Enter the password of an operator to add:"); ?> <input name="password" type="text"/></p>
|
function rnd(x,y,z) {
|
||||||
<?php } ?>
|
var num;
|
||||||
<p><?php echo T_("Enter the first name of an operator to add:"); ?> <input name="firstname" type="text"/></p>
|
do {
|
||||||
<p><?php echo T_("Enter the surname of an operator to add:"); ?> <input name="lastname" type="text"/></p>
|
num = parseInt(Math.random()*z);
|
||||||
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of an operator to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE"))); ?> </p>
|
if (num >= x && num <= y) break;
|
||||||
<?php if (FREEPBX_PATH == false) { ?>
|
} while (true);
|
||||||
<p><a href='extensionstatus.php'><?php echo T_("Select an extension for this operator:"); echo "</a>"; display_chooser($ers,"extension_id","extension_id",true,false,false,false); ?> </p>
|
return(num);
|
||||||
<?php } ?>
|
}
|
||||||
<p><?php echo T_("Will this operator be using VoIP?"); ?> <input name="voip" type="checkbox" checked="checked"/></p>
|
// --------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
<p><?php echo T_("Jabber/XMPP chat user"); ?>: <input name="chat_user" type="text"/></p>
|
function generate() {
|
||||||
<p><?php echo T_("Jabber/XMPP chat password"); ?>: <input name="chat_password" type="text"/></p>
|
var pwd = '';
|
||||||
<p><?php echo T_("Will this operator be using chat?"); ?> <input name="chat_enable" type="checkbox"/></p>
|
var res, s;
|
||||||
<p><?php echo T_("Is the operator a normal interviewer?"); ?> <input name="temporary" type="checkbox" checked="checked"/></p>
|
var k = 0;
|
||||||
<p><?php echo T_("Is the operator a supervisor?"); ?> <input name="supervisor" type="checkbox"/></p>
|
var n = document.operform.number.value;
|
||||||
<p><?php echo T_("Is the operator a refusal converter?"); ?> <input name="refusal" type="checkbox"/></p>
|
var pass = new Array();
|
||||||
<p><input type="submit" value="<?php echo T_("Add user"); ?>" /></p>
|
var w = rnd(30,80,100);
|
||||||
</form>
|
for (var r = 0; r < w; r++) {
|
||||||
|
res = rnd(1,25,100); pass[k] = upp[res]; k++;
|
||||||
<?php
|
res = rnd(1,25,100); pass[k] = low[res]; k++;
|
||||||
|
res = rnd(1,9,100); pass[k] = dig[res]; k++;
|
||||||
xhtml_foot();
|
res = rnd(1,24,100); pass[k] = sym[res]; k++;
|
||||||
|
}
|
||||||
?>
|
for (var i = 0; i < n; i++) {
|
||||||
|
s = rnd(1,k-1,100);
|
||||||
|
pwd+= pass[s];
|
||||||
|
}
|
||||||
|
document.operform.password.value = pwd;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal panel-body" name="operform">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Username") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="operator" type="text" class="form-control" required /></div>
|
||||||
|
</div>
|
||||||
|
<?php if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) { ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Password") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="password" id="password" type="text" class="form-control" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" /></div>
|
||||||
|
<div class="col-sm-6 form-inline"> 
|
||||||
|
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" /> <?php echo T_("Password with");?> 
|
||||||
|
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" /> <?php echo T_("characters");?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("First name") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="firstname" type="text" class="form-control" required/></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Last name") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="lastname" type="text" class="form-control"/></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><?php display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,true,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"form-inline");?></div>
|
||||||
|
<div class="col-sm-6 form-inline">
|
||||||
|
<?php echo T_("Edit") . " ";?>
|
||||||
|
<a href='timezonetemplate.php' class="btn btn-default fa"><?php echo T_("TimeZones list");?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php if (FREEPBX_PATH == false) { ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Extension") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><?php display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline");?></div>
|
||||||
|
<div class="col-sm-6 form-inline">
|
||||||
|
<?php echo T_("Edit") . " ";?>
|
||||||
|
<a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="voip" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" checked="checked"/></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="chat_user" type="text" class="form-control"/></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="chat_password" type="text" class="form-control"/></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
|
||||||
|
<div class="col-sm-3"><input name="chat_enable" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a normal interviewer?");?></label>
|
||||||
|
<div class="col-sm-3"><input name="temporary" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-offstyle="danger" checked="checked"/></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a supervisor?");?></label>
|
||||||
|
<div class="col-sm-3"><input name="supervisor" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a refusal converter?");?></label>
|
||||||
|
<div class="col-sm-3"><input name="refusal" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="adduser" class="btn btn-primary btn-block" value="<?php echo T_("Add an operator"); ?>" /></div></div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
xhtml_foot();
|
||||||
|
?>
|
||||||
@@ -1,280 +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
|
||||||
|
FROM operator_skill
|
||||||
$sql = "DELETE
|
WHERE operator_id IN (
|
||||||
FROM operator_skill
|
SELECT operator_id
|
||||||
WHERE operator_id IN (
|
FROM operator
|
||||||
SELECT operator_id
|
WHERE enabled = 1)";
|
||||||
FROM operator
|
|
||||||
WHERE enabled = 1)";
|
$db->Execute($sql);
|
||||||
|
|
||||||
$db->Execute($sql);
|
foreach ($_POST as $g => $v)
|
||||||
|
{
|
||||||
foreach ($_POST as $g => $v)
|
$a = explode("_",$g);
|
||||||
{
|
if ($a[0] == "cb")
|
||||||
$a = explode("_",$g);
|
vqi($a[2],$a[1]);
|
||||||
if ($a[0] == "cb")
|
}
|
||||||
vqi($a[2],$a[1]);
|
|
||||||
}
|
$db->CompleteTrans();
|
||||||
|
}
|
||||||
$db->CompleteTrans();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$sql = "SELECT outcome_type_id,description
|
||||||
|
FROM outcome_type
|
||||||
$sql = "SELECT outcome_type_id,description
|
ORDER by outcome_type_id ASC";
|
||||||
FROM outcome_type
|
|
||||||
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
|
||||||
|
FROM operator
|
||||||
$sql = "SELECT operator_id,firstname as description
|
WHERE enabled = 1
|
||||||
FROM operator
|
ORDER by operator_id ASC";
|
||||||
WHERE enabled = 1
|
|
||||||
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"),false,array("../css/table.css"));
|
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 "<p>" . T_("Set which types of cases will be made available to each operator. 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.") . "</p>";
|
|
||||||
|
?>
|
||||||
?>
|
|
||||||
|
<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)
|
||||||
|
cb.checked = 'checked';
|
||||||
if (VidOn == 0)
|
else
|
||||||
cb.checked = 'checked';
|
cb.checked = '';
|
||||||
else
|
|
||||||
cb.checked = '';
|
}
|
||||||
|
|
||||||
}
|
if (VidOn == 0)
|
||||||
|
VidOn = 1;
|
||||||
if (VidOn == 0)
|
else
|
||||||
VidOn = 1;
|
VidOn = 0;
|
||||||
else
|
}
|
||||||
VidOn = 0;
|
|
||||||
}
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
</script>
|
<?php
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
//$country_code = 'RU'; // Nederlandse Antillen
|
||||||
|
//print_r(DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code));
|
||||||
<?php
|
|
||||||
|
|
||||||
|
print "<form action=\"\" method=\"post\"><table class='table-bordered table-hover table-condensed form-group'><thead>";
|
||||||
|
|
||||||
print "<form action=\"\" method=\"post\"><table>";
|
print "<tr><th> " . T_("Username") . " </th><th> " . T_("Operator") . " </th>";
|
||||||
|
foreach($outcome_types as $q)
|
||||||
print "<tr><th></th>";
|
{
|
||||||
foreach($outcome_types as $q)
|
print "<th> <a href=\"javascript:checkQid({$q['outcome_type_id']})\">" . T_($q['description']) . "</a> </th>";
|
||||||
{
|
}
|
||||||
print "<th><a href=\"javascript:checkQid({$q['outcome_type_id']})\">" . T_($q['description']) . "</a></th>";
|
print "</tr></thead>";
|
||||||
}
|
|
||||||
print "</tr>";
|
|
||||||
|
foreach($operators as $v)
|
||||||
$ct = 1;
|
{
|
||||||
|
print "<tr class=''>
|
||||||
foreach($operators as $v)
|
<th> {$v['username']} </th>
|
||||||
{
|
<th> <a href=\"javascript:checkVid({$v['operator_id']})\">{$v['description']}</a> </th>";
|
||||||
print "<tr class='";
|
foreach($outcome_types as $q)
|
||||||
if ($ct == 1) {$ct = 0; print "even";} else {$ct = 1; print "odd";}
|
{
|
||||||
print "'>";
|
$checked = "";
|
||||||
print "<th><a href=\"javascript:checkVid({$v['operator_id']})\">{$v['description']}</a></th>";
|
if (vq($v['operator_id'],$q['outcome_type_id'])) $checked="checked=\"checked\"";
|
||||||
foreach($outcome_types as $q)
|
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>";
|
||||||
{
|
}
|
||||||
$checked = "";
|
|
||||||
if (vq($v['operator_id'],$q['outcome_type_id'])) $checked="checked=\"checked\"";
|
print "</tr>";
|
||||||
print "<td><input type=\"checkbox\" name=\"cb_{$q['outcome_type_id']}_{$v['operator_id']}\" id=\"cb_{$q['outcome_type_id']}_{$v['operator_id']}\" $checked></input></td>";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>";
|
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Modify operator skills") ."\"/></form>";
|
||||||
}
|
|
||||||
|
xhtml_foot();
|
||||||
|
|
||||||
print "</table><p><input type=\"submit\" name=\"submit\" value=\"" . T_("Modify operator skills") ."\"/></p></form>";
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
xhtml_foot();
|
$('input').iCheck({
|
||||||
|
checkboxClass: 'icheckbox_square-blue',
|
||||||
?>
|
increaseArea: '30%'
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ function get_stats_total($rs)
|
|||||||
$callsph = round($calls/($totaltime/3600),4);
|
$callsph = round($calls/($totaltime/3600),4);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs[] = array("effectiveness" => $effectiveness, "completions" => $completions,"time" => sec_to_time($totaltime),"totalcalls" => $calls,"callt" => sec_to_time($calltime),"CPH" => $cph,"CALLSPH" => $callsph);
|
$rs[] = array("effectiveness" => '<b>' . $effectiveness . '</b>', "completions" => '<b>' .$completions. '</b>',"time" => '<b>' . sec_to_time($totaltime). '</b>',"totalcalls" => '<b>' . $calls. '</b>',"callt" => '<b>' . sec_to_time($calltime). '</b>',"CPH" => '<b>' . $cph. '</b>',"CALLSPH" => '<b>' . $callsph. '</b>');
|
||||||
|
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user