mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Rename availability groups to time slots
Added details of what an availability group is Added front end for call attempt time slots Added database changes for call attempt time slots
This commit is contained in:
@@ -54,7 +54,7 @@ if (isset($_GET['availability_group']))
|
||||
else if (isset($_POST['availability_group']))
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
else
|
||||
die(T_("No availability group set"));
|
||||
die(T_("No time slot group set"));
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
@@ -92,7 +92,7 @@ if (isset($_POST['day']))
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify availability"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
|
||||
xhtml_head(T_("Modify time slots"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
@@ -158,12 +158,12 @@ translate_array($daysofweek,array("description"));
|
||||
?>
|
||||
</table>
|
||||
<p><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></p>
|
||||
<p><label for="description"><?php echo T_("Availability group name"); ?>: </label><input type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to availabilities"); ?>"/></p>
|
||||
<p><label for="description"><?php echo T_("Time slot group name"); ?>: </label><input type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to time slot group"); ?>"/></p>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form>
|
||||
<form method="post" action="availabilitygroup.php">
|
||||
<p><input type="submit" name="subdel" value="<?php echo T_("Delete this availability group"); ?>"/></p>
|
||||
<p><input type="submit" name="subdel" value="<?php echo T_("Delete this time slot group"); ?>"/></p>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
@@ -67,7 +67,7 @@ include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Availability groups"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
xhtml_head(T_("Time slots"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
|
||||
if (isset($_POST['subdel']))
|
||||
{
|
||||
@@ -109,22 +109,22 @@ $sql = "SELECT description,
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "<h3>" . T_("Availability groups")."</h3>";
|
||||
print "<h3>" . T_("Time slots")."</h3>";
|
||||
|
||||
print "<p>" . T_("Availability groups define periods of time of respondent availability.") . "</p>";
|
||||
print "<p>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</p>";
|
||||
|
||||
if (empty($rs))
|
||||
print "<p>" . T_("No availability groups") . "</p>";
|
||||
print "<p>" . T_("No time slots") . "</p>";
|
||||
else
|
||||
xhtml_table($rs,array("description","link"),array(T_("Availablity group"),T_("Modify")));
|
||||
xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify")));
|
||||
|
||||
|
||||
//add an availablity group
|
||||
print "<h3>" . T_("Add availability group") . "</h3>";
|
||||
print "<h3>" . T_("Add time slot") . "</h3>";
|
||||
?>
|
||||
<form method="post" action="?">
|
||||
<p><label for="availability_group"><?php echo T_("Availability group name"); ?>: </label><input type="text" class="textclass" name="availability_group" id="availability_group"/></p>
|
||||
<p><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add availability group"); ?>"/>
|
||||
<p><label for="availability_group"><?php echo T_("Time slot name"); ?>: </label><input type="text" class="textclass" name="availability_group" id="availability_group"/></p>
|
||||
<p><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
@@ -70,8 +70,9 @@ print "<li><a href=\"?page=operatorquestionnaire.php\">" . T_("Assign operators
|
||||
print "<li><a href=\"?page=operatorskill.php\">" . T_("Modify operator skills") . "</a></li></ul></li>";
|
||||
|
||||
print "<li><h3>" . T_("Availability and shift management") . "</h3><ul>";
|
||||
print "<li><a href=\"?page=availabilitygroup.php\">" . T_("Manage availablity groups") . "</a></li>";
|
||||
print "<li><a href=\"?page=availabilitygroup.php\">" . T_("Manage time slots") . "</a></li>";
|
||||
print "<li><a href=\"?page=questionnaireavailability.php\">" . T_("Assign availabilities to questionnaires") . "</a></li>";
|
||||
print "<li><a href=\"?page=questionnairecatimeslots.php\">" . T_("Assign call attempt time slots to questionnaire") . "</a></li>";
|
||||
print "<li><a href=\"?page=addshift.php\">" . T_("Shift management (add/remove)") . "</a></li></ul></li>";
|
||||
|
||||
print "<li><h3>" . T_("Questionnaire progress") . "</h3>";
|
||||
|
||||
@@ -91,7 +91,10 @@ $questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Assign availability group to questionnaire"),true,false,array("../js/window.js"));
|
||||
print "<h1>" . T_("Select a questionnaire from the list below") . "</h1>";
|
||||
|
||||
print "<p>" . T_("Assigning an availability group to a questionnaire will allow interviewers to select from those groups to restrict calls to a particular case to the times within the group") ."</p>";
|
||||
|
||||
print "<h3>" . T_("Select a questionnaire from the list below") . "</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id);
|
||||
|
||||
|
||||
@@ -143,7 +146,7 @@ if ($questionnaire_id != false)
|
||||
?>
|
||||
</select><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="submit" name="add_availability" value="Add availability group"/></p>
|
||||
<input type="submit" name="add_availability" value="<?php echo TQ_("Add availability group") ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
157
admin/questionnairecatimeslots.php
Normal file
157
admin/questionnairecatimeslots.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign call attempt time slots to a questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$availability_group')";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_timeslot
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Assign call attempt time slots to questionnaire"),true,false,array("../js/window.js"));
|
||||
|
||||
print "<p>" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been called at least n times in all assigned timeslots") ."</p>";
|
||||
|
||||
print "<h3>" . T_("Select a questionnaire from the list below") . "</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id);
|
||||
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
|
||||
$sql = "SELECT q.availability_group_id,a.description as description
|
||||
FROM questionnaire_timeslot as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h2>" . T_("There are no call attempt time slots selected for this questionnaire") . "</h2>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h2>" . T_("Call attempt time slots selected for this questionnaire") . "</h2>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<p><a href=\"?questionnaire_id=$questionnaire_id&ravailability_group={$q['availability_group_id']}\">{$q['availability_group_id']} - {$q['description']} (" . T_("Click to unassign") . ")</a></p>";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_timeslot as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
|
||||
|
||||
print "<h2>" . T_("Add a call attempt time slot to this questionnaire:") . "</h2>";
|
||||
?>
|
||||
<form action="" method="get">
|
||||
<p><label for="availability_group"><?php echo T_("Select call attempt time slot:"); ?></label><select name="availability_group" id="availability_group">
|
||||
<?php
|
||||
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
</select><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="submit" name="add_availability" value="<?php echo TQ_("Add call attempt time slot") ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
?>
|
||||
@@ -1555,6 +1555,13 @@ CREATE TABLE `questionnaire_sample_quota_row_exclude` (
|
||||
--
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `questionnaire_timeslot` (
|
||||
`questionnaire_id` bigint( 20 ) NOT NULL ,
|
||||
`availability_group_id` bigint( 20 ) NOT NULL ,
|
||||
PRIMARY KEY ( `questionnaire_id` , `availability_group_id` )
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user