Advertisement
Guest User

Untitled

a guest
Nov 15th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cfparam name="url.event_id" default="17">
  2. <cfparam name="url.sess_id" default="0">
  3. <cfquery name="getData" datasource="#application.dsn#">
  4.     <!---
  5.     SELECT S.Title, S.Session_ID, S.Start_Date, S.Start_Time, S.End_Date, S.End_Time, S.Room, S.Code, T.Title AS Track, S.Submitted_Description AS Description, S.Type
  6.     FROM Sessions S
  7.     LEFT OUTER JOIN Tracks T
  8.     ON T.Track_ID = S.Track_ID
  9.     WHERE S.Event_ID =  <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#url.event_id#">
  10.     AND S.Session_ID =  <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#url.sess_id#">
  11.    AND S.Status = 'Active'
  12.     --->
  13.    
  14.     SELECT <!---'('+CAST(S.Session_ID AS VARCHAR(10))+') '+--->S.Title AS Title, S.Session_ID, S.Start_Date, S.Start_Time, S.End_Date, S.End_Time, S.Room_Location AS Room, S.Location, S.Session_Code AS Code,
  15.           S.Agenda_Type, CAST(S.Description AS VARCHAR(4000)) AS Description, '' AS Type, T.Title AS Track, '' AS Affiliations, '' AS Points_Of_Interest, Co_Sponsor AS Sponsor, S.Venue_ID, S.Floor,
  16.             S.Agenda_Type_Display AS Event_Type, S.Session_Level
  17.     FROM v_Sessions_Expomap S   LEFT OUTER JOIN Tracks T ON T.Track_ID = S.Track_ID
  18.     WHERE S.Event_ID =  <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#url.event_id#">
  19.     AND S.Session_ID =  <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#url.sess_id#">
  20.     <!---AND S.Agenda_Type IN ('Session','Default')--->
  21.     AND S.Itin_Type = 'Post'
  22.     AND S.Public_Private LIKE <cfqueryparam value="%Mobile App%" cfsqltype="CF_SQL_VARCHAR">
  23.     AND S.Status = 'Active'
  24. </cfquery>
  25. <cfset delim = '","'>
  26. <cfset outstr = '{"COLUMNS":["SESS_ID","TITLE","TRACK","ROOM","STARTDATE","STARTDATESORT","STARTTIME","STARTTIME24","ENDTIME","DESCRIPTION","PROGRAM_TYPE","AUDIENCE","INTEREST","SPONSOR","MAP_URL","EVENT_TYPE","CODE","SESSION_LEVEL"],"DATA":['>
  27. <cfset n=0>
  28. <cfloop query="getData">
  29.     <cfset titlestr = rtrim(getData.title)>
  30.     <cfif getData.Code EQ "0">
  31.         <cfset getData.Code = "">
  32.     </cfif>
  33.     <!---
  34.     <cfif len(getData.Code)>
  35.         <cfset titlestr = rtrim(getData.Code) & ": " & titlestr>
  36.     </cfif>
  37.     --->
  38.     <cfset roomstr = rtrim(getData.room)>
  39.     <cfif len(getData.location)>
  40.         <cfset roomstr = roomstr & ", " & rtrim(getData.location)>
  41.     </cfif>
  42.  
  43.   <!--- data = replace(data, chr(10), '\n', 'all');
  44.    data = replace(data, chr(9), '', 'all');
  45.    data = replace(data, chr(13), '', 'all'); --->
  46.     <cfset desc = replacenocase(getData.description,chr(10),'\n','all')>
  47.     <cfset desc = replace(desc,chr(9),'','all')>
  48.     <cfset desc = replace(desc,chr(10),'','all')>
  49.   <!--- <cfset desc = reReplace(desc, "[^\x20-\x7E]", "", "ALL")> --->
  50.   <!--- <cfset desc = reReplace(desc, "[^\x00-\x7F]", "", "ALL")> --->
  51.   <!--- <cfset desc = paragraphFormat(desc)> --->
  52.  
  53.     <!--- <cfset desc = "<div style='font-family:arial,sans-serif'>#desc#</div>"> --->
  54.     <cfset mapstr = "">
  55.     <cfquery name="getMap" datasource="#application.dsn#">
  56.         SELECT URL
  57.         FROM ExpoToGo_Maps
  58.         WHERE Event_ID = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#url.event_id#">
  59.         AND Venue_ID = <cfqueryparam value="#getData.Venue_ID#" cfsqltype="CF_SQL_INTEGER">
  60.     </cfquery>
  61.     <cfif getMap.recordcount EQ 1>
  62.         <cfset mapstr = getMap.URL>
  63.     </cfif>
  64.     <cfif getMap.recordcount GT 1>
  65.         <cfquery name="getMap" datasource="#application.dsn#">
  66.             SELECT TOP 1 URL
  67.             FROM ExpoToGo_Maps
  68.             WHERE Event_ID = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#url.event_id#">
  69.             AND Venue_ID = <cfqueryparam value="#getData.Venue_ID#" cfsqltype="CF_SQL_INTEGER">
  70.             AND Level = <cfqueryparam value="#getData.Floor#" cfsqltype="CF_SQL_VARCHAR">
  71.         </cfquery>
  72.         <cfset mapstr = getMap.URL>
  73.     </cfif>
  74.     <cfscript>
  75.         n=n+1;
  76.         if (n GT 1) {
  77.             rdelim = ",";
  78.         } else {
  79.             rdelim = "";
  80.         }
  81.         outstr = outstr & rdelim
  82.             & '["' & getData.session_id & delim
  83.             & replacenocase(titlestr,'"','\"','all') & delim
  84.             & replacenocase(getData.track,'"','\"','all') & delim
  85.             & replacenocase(roomstr,'"','\"','all') & delim
  86.             & replacenocase(dateformat(getData.start_date,"short"),'"','\"','all') & delim
  87.             & replacenocase(dateformat(getData.start_date,"short"),'"','\"','all') & delim
  88.             & replacenocase(timeformat(getData.start_time,"short"),'"','\"','all') & delim
  89.             & replacenocase(timeformat(getData.start_time,"HHmm"),'"','\"','all') & delim
  90.             & replacenocase(timeformat(getData.end_time,"short"),'"','\"','all') & delim
  91.             & replacenocase(trim(desc),'"','\"','all') & delim
  92.             & replacenocase(getData.type,'"','\"','all') & delim
  93.             & replacenocase(getData.affiliations,'"','\"','all') & delim
  94.             & replacenocase(getData.points_of_interest,'"','\"','all') & delim
  95.             & replacenocase(getData.sponsor,'"','\"','all') & delim
  96.             & replacenocase(mapstr,'"','\"','all') & delim
  97.             & replacenocase(getData.Event_Type,'"','\"','all') & delim
  98.             & replacenocase(getData.Code,'"','\"','all') & delim
  99.             & replacenocase(getData.Session_Level,'"','\"','all') & '"]';
  100.     </cfscript>
  101. </cfloop>
  102. <cfset outstr = outstr & ']}'>
  103. <cfoutput>#outstr#</cfoutput>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement