Advertisement
Advertisement
| 05.02.2008 at 10:31PM PDT, ID: 23373480 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" src="../../SunrisePortal/Includes/common.js"></script>
</head>
<cfquery name="qrySurveyReview" datasource="cfelsunrise" dbtype="odbc">
Select * from surveys where id=#url.survey#
</cfquery>
<cfquery name="qryQuestionReview" datasource="cfelsunrise" dbtype="odbc">
select * from questions where surveyidfk=#url.survey# order by sortOrder
</cfquery>
<cfquery name="qryCheck" datasource="cfelsunrise" dbtype="odbc">
select * from survey_results where empID=#session.empID# and surveyIDfk=#url.survey#
</cfquery>
<cfset FlagInsert=''>
<cfif qryCheck.recordcount eq 0>
<cfset FlagInsert=1>
<cfquery name="qryInsert" datasource="cfelsunrise" dbtype="odbc">
insert into survey_results (surveyidfk, empID) values (#url.survey#, #session.EmpID#)
select @@Identity as newID from survey_results
</cfquery>
<cfset result=#qryInsert.newID#>
<cfelse>
<cfset FlagInsert=0>
<cfset result=#qryCheck.id#>
</cfif>
<!---get answers--->
<body>
<cfprocessingdirective suppresswhitespace="yes">
<form name="survey1" id="survey1" method="post" action="">
<div style="border:thin ##CC0000 solid; width:100%;">
<cfif isDefined("url.survey")>
<!---Header of the survey--->
<cfoutput query="qrySurveyReview">
<p align="center">#UCase(name)#</p>
<div align="center"><img src="../images/#logo#"alt="#name#" /></div>
<p align="center"><b style="font-size:18px;">Description:</b>#description#</p>
</cfoutput>
<cfoutput>
<cfloop query="qryQuestionReview">
#header#
<div style=" text-indent:5em;">
<br /><b>#qryQuestionReview.currentrow#.#question#</b>
</div><br />
<cfif qryQuestionReview.recordcount gt 0>
<cfquery name="qryQuestionOptionsReview1" datasource="cfelsunrise" dbtype="odbc">
select * from questionOptions where questionID=#qryQuestionReview.id# order by sortOrder
</cfquery>
<cfloop query="qryQuestionOptionsReview1">
<cfquery name="qryAnswers" datasource="cfelsunrise" dbtype="odbc" >
select * from surveyResultsDetail where answer=#qryQuestionOptionsReview1.id# and surveyID=#url.survey#
</cfquery>
<span style=" margin-left:5em;">
<cfset selectOptions=''>
<cfswitch expression="#questiontypeidfk#">
<cfcase value="7">
<input type="checkbox" name="chk_#id#" id="chk" value="#options#_#id#" <cfif qryAnswers.answer eq #id#>checked</cfif> /> #options#<br />
</cfcase>
<cfcase value="5">
<input type="text" name="txt#questionID#" id="txt" value="#options#_#id#" />#options#
<br />
</cfcase>
<cfcase value="8">
<input type="radio" name="rdn#questionID#" id="rdn" value="#options#_#id#" <cfif qryAnswers.answer eq #id#>checked</cfif>/> #Options#<br />
</cfcase>
<cfcase value="6">
<textarea name="txtArea#questionID#" id="txtArea" cols="70" rows="5">#options#</textarea>
<br />
</cfcase>
<cfcase value="9">
<cfloop query="qryQuestionOptionsReview1">
<cfset selectOptions = selectOptions& '<option value="' & id & '">' & options & '</option>'>
</cfloop>
</cfcase>
<cfcase value="10">
<input class="calendarButton" type="button" style=" background:url(../../SunrisePortal/Cal/Grid.GIF); width:23px;" onclick="displayDatePicker('shift1', this);"/>
<input name="shift1#id#" id="shift1" class="inputDatePicker" disabled="disabled" ><br/>
</cfcase>
</cfswitch>
</span>
</cfloop>
</cfif>
#footer#
</cfloop>
<cfif len(trim(selectOptions)) gt 0>
<select name="sel" id="sel">
<cfoutput>#selectOptions#</cfoutput>
</select>
<br />
</cfif>
<br />
<input type="submit" name="btnSubmitSurvey" id="btnSubmitSurvey" value="Submit And Come Back" />
<input type="submit" name="btnSubmitSurvey2" id="btnSubmitSurvey2" value="Complete Survey" />
</cfoutput>
<!---Actual questions and options--->
</cfif>
</div>
</form>
</cfprocessingdirective>
</body>
</html>
<cfif isDefined("btnSubmitSurvey") >
<cfoutput>
<cfif isDefined("form.fieldnames")>
<CFLOOP LIST="#form.fieldnames#" Index="field">
<cfif #field# neq "btnSubmitSurvey" and #field# neq "btnSubmitSurvey2" and FlagInsert eq 1 >
<cfquery name="qryInsert1" datasource="cfelsunrise" dbtype="odbc">
delete from SurveyResultsDetail where idfk =#qryInsert.newID#
insert into SurveyResultsDetail (answer,surveyID,idfk) values (#ListLast(Evaluate("Form.#field#"),"_")#,#url.survey#,#results#)
</cfquery>
<cfelseif FlagInsert eq 0>
<cfquery name="qryUpdate" datasource="cfelsunrise" dbtype="odbc">
update SurveyResultsDetail set answer=#ListLast(Evaluate("Form.#field#"),"_")# where surveyID=#url.survey# and idfk=#results#
</cfquery>
</cfif>
</CFLOOP>
</cfif>
<!--- insert into answers (questionidfk,answer,empID,surveyID) values (#ListLast(Evaluate("Form.#field#"),"_")#,'#Evaluate(field)#',#session.empID#,#url.survey#)
surveyID=#url.survey# and answer=#ListLast(Evaluate("Form.#field#"),"_")#--->
<cflocation url="index.cfm" addtoken="no">
</cfoutput>
</cfif>
<cfdump var="#url#">
<cfdump var="#session#">
<cfdump var="#form#">
|