| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <!--- |
|---|
| 3 | Name : handlers/mc/stats.cfm |
|---|
| 4 | Author : Raymond Camden |
|---|
| 5 | Created : September 21, 2004 |
|---|
| 6 | Last Updated : March 30, 2006 |
|---|
| 7 | History : tableprefix fix (rkc 3/30/06) |
|---|
| 8 | Purpose : Supports True/False, Yes/No |
|---|
| 9 | ---> |
|---|
| 10 | |
|---|
| 11 | <cfparam name="attributes.questionidfk"> |
|---|
| 12 | <cfparam name="attributes.r_data" type="variablename"> |
|---|
| 13 | <cfparam name="attributes.other" default="false"> |
|---|
| 14 | <cfparam name="attributes.getother" default="false"> |
|---|
| 15 | |
|---|
| 16 | <cfif not attributes.getother> |
|---|
| 17 | |
|---|
| 18 | <cfset data = structNew()> |
|---|
| 19 | |
|---|
| 20 | <!--- get my answer data ---> |
|---|
| 21 | <cfset answers = application.question.getAnswers(attributes.questionidfk)> |
|---|
| 22 | |
|---|
| 23 | <cfloop query="answers"> |
|---|
| 24 | |
|---|
| 25 | <cfquery name="getcount" datasource="#application.settings.dsn#"> |
|---|
| 26 | select count(answeridfk) as total |
|---|
| 27 | from #application.settings.tableprefix#results |
|---|
| 28 | where answeridfk = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" maxlength="35" value="#id#"> |
|---|
| 29 | </cfquery> |
|---|
| 30 | |
|---|
| 31 | <cfif getcount.recordCount> |
|---|
| 32 | <cfset data[id] = getcount.total> |
|---|
| 33 | <cfelse> |
|---|
| 34 | <cfset data[id] = 0> |
|---|
| 35 | </cfif> |
|---|
| 36 | |
|---|
| 37 | </cfloop> |
|---|
| 38 | |
|---|
| 39 | <cfif attributes.other> |
|---|
| 40 | |
|---|
| 41 | <cfquery name="getother" datasource="#application.settings.dsn#"> |
|---|
| 42 | select count(other) as totalother |
|---|
| 43 | from #application.settings.tableprefix#results |
|---|
| 44 | where questionidfk = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" maxlength="35" value="#attributes.questionidfk#"> |
|---|
| 45 | and answeridfk is null |
|---|
| 46 | </cfquery> |
|---|
| 47 | |
|---|
| 48 | <cfif getother.recordCount> |
|---|
| 49 | <cfset data.other = getother.totalother> |
|---|
| 50 | <cfelse> |
|---|
| 51 | <cfset data.other = 0> |
|---|
| 52 | </cfif> |
|---|
| 53 | |
|---|
| 54 | </cfif> |
|---|
| 55 | |
|---|
| 56 | <cfelse> |
|---|
| 57 | <!--- In this mode we are just getting the "other" data ---> |
|---|
| 58 | <cfquery name="data" datasource="#application.settings.dsn#"> |
|---|
| 59 | select other |
|---|
| 60 | from #application.settings.tableprefix#results |
|---|
| 61 | where questionidfk = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" maxlength="35" value="#attributes.questionidfk#"> |
|---|
| 62 | and answeridfk is null |
|---|
| 63 | </cfquery> |
|---|
| 64 | |
|---|
| 65 | </cfif> |
|---|
| 66 | |
|---|
| 67 | <cfset caller[attributes.r_data] = data> |
|---|
| 68 | <cfsetting enablecfoutputonly=false> |
|---|
| 69 | |
|---|
| 70 | <cfexit method="exittag"> |
|---|