2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

checked for existence of result set before applying RecordCount method

New questionnaire form has larger text boxes for entering data - and hides entry when rs not required
This commit is contained in:
azammitdcarf
2008-11-14 00:58:44 +00:00
parent 26bc2b866c
commit 0976fe62ee
7 changed files with 37 additions and 16 deletions

View File

@@ -62,8 +62,10 @@ function vq($client_id,$questionnaire_id)
$vq = $db->Execute($sql);
return $vq->RecordCount();
if ($vq)
return $vq->RecordCount();
else
return 0;
}
/**

View File

@@ -55,7 +55,7 @@ include("../functions/functions.input.php");
global $ldb;
global $db;
xhtml_head(T_("New: Create new questionnaire"));
xhtml_head(T_("New: Create new questionnaire"),true,false,array("../js/new.js"));
if (isset($_POST['import_file']))
{
@@ -139,13 +139,15 @@ foreach($surveys as $s)
<p><? echo T_("Restrict appointments to shifts?"); ?> <input name="ras" type="checkbox" checked="checked"/></p>
<p><? echo T_("Restrict work to shifts?"); ?> <input name="rws" type="checkbox" checked="checked"/></p>
<p><? echo T_("Questionnaire for testing only?"); ?> <input name="testing" type="checkbox"/></p>
<p><? echo T_("Use respondent selection text?"); ?> <input name="rs" type="checkbox" checked="checked"/></p>
<p><? echo T_("Respondent selection introduction:"); ?> <input type="text" name="rs_intro"/></p>
<p><? echo T_("Respondent selection project introduction:"); ?> <input type="text" name="rs_project_intro"/></p>
<p><? echo T_("Respondent selection project end:"); ?> <input type="text" name="rs_project_end"/></p>
<p><? echo T_("Respondent selection callback (already started questionnaire):"); ?> <input type="text" name="rs_callback"/></p>
<p><? echo T_("Message to leave on an answering machine:"); ?> <input type="text" name="rs_answeringmachine"/></p>
<p><input type="submit" name="import_file"/></p>
<p><? echo T_("Use respondent selection text?"); ?> <input name="rs" id="rs" type="checkbox" checked="checked" onclick="showHide(this,'rstext');"/></p>
<div id='rstext'>
<p><? echo T_("Respondent selection introduction:"); ?> <textarea cols="40" rows="4" name="rs_intro"></textarea></p>
<p><? echo T_("Respondent selection project introduction:"); ?> <textarea cols="40" rows="4" name="rs_project_intro"></textarea></p>
<p><? echo T_("Respondent selection project end:"); ?> <textarea cols="40" rows="4" name="rs_project_end"></textarea></p>
<p><? echo T_("Respondent selection callback (already started questionnaire):"); ?> <textarea cols="40" rows="4" name="rs_callback"></textarea></p>
<p><? echo T_("Message to leave on an answering machine:"); ?> <textarea cols="40" rows="4" name="rs_answeringmachine"></textarea></p>
</div>
<p><input type="submit" name="import_file" value="<? echo T_("Create Questionnaire"); ?>"/></p>
</form>
<?
xhtml_foot();

View File

@@ -62,8 +62,10 @@ function vq($operator_id,$questionnaire_id)
$vq = $db->Execute($sql);
return $vq->RecordCount();
if ($vq)
return $vq->RecordCount();
else
return 0;
}
/**

View File

@@ -62,8 +62,10 @@ function vq($operator_id,$outcome_type_id)
$vq = $db->Execute($sql);
return $vq->RecordCount();
if ($vq)
return $vq->RecordCount();
else
return 0;
}
/**

View File

@@ -496,7 +496,7 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
AND MONTH(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) = '{$Day->thisMonth()}'
AND YEAR(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) = '{$Day->thisYear()}'");
if ($rs->RecordCount() == 0)
if (!empty($rs) && $rs->RecordCount() == 0)
{
echo ( "<td class=\"notavailable $today\">".$Day->thisDay()."</td>\n" );
}

View File

@@ -95,7 +95,7 @@ function create_limesurvey_questionnaire($title)
$isquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE sid=$surveyid";
$isresult = $ldb->Execute($isquery);
}
while ($isresult->RecordCount()>0);
while (!empty($isresult) && $isresult->RecordCount() > 0);
$isquery = "INSERT INTO ". LIME_PREFIX ."surveys\n"
. "(sid, owner_id, admin, active, useexpiry, expires, "

13
js/new.js Normal file
View File

@@ -0,0 +1,13 @@
function showHide(me,id)
{
e = document.getElementById(id);
if (me.checked == true)
{
e.style.display = 'inline';
}
else
{
e.style.display = 'none';
}
}