Advertisement
Guest User

Untitled

a guest
Oct 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!--- I created a function to generate the html that I output, it's called buildSessionOutput --->
  2. <cffunction name="buildSessionOutput" output="true" returntype="string">
  3.     <cfargument name="scheduleID" type="numeric" required="true">
  4.     <cfargument name="userID" type="numeric" required="true">
  5.     <cfargument name="title" type="string" required="true">
  6.     <cfargument name="teaser" type="string" required="true">
  7.     <cfargument name="startDateTime" type="string" required="true">
  8.     <cfargument name="endDateTime" type="string" required="true">
  9.     <cfargument name="locationName" type="string" required="true">
  10.     <cfargument name="location" type="string" required="true">
  11.     <cfargument name="trackDesc" type="string" required="true">
  12.     <cfargument name="trackName" type="string" required="true">
  13.     <cfargument name="followed" type="string" required="true">
  14.  
  15.     <cfset var outputText = ""/>
  16.  
  17.     <cfsavecontent variable="outputText">
  18.         <div class="session">
  19.             <a
  20.                href="/session/#arguments.scheduleID#"
  21.                class="session-link"
  22.                data-log-activity="true"
  23.                data-log-activity-action="viewed"
  24.                data-log-activity-action-type="session"
  25.                data-log-activity-url="/session/#arguments.scheduleID#/"
  26.                data-log-activity-userid="#arguments.userID#"
  27.                data-log-activity-ip="#cgi.remote_addr#"
  28.                data-log-activity-action_on_id="#arguments.scheduleID#"
  29.                data-log-activity-message="source:agenda"
  30.            >
  31.                 <div class="session-details">
  32.                     <h3 class="session-name">#arguments.title#</h3>
  33.                     <cfif len(arguments.teaser)>
  34.                        
  35.                         <p>#arguments.teaser#</p>
  36.                        
  37.                     </cfif>
  38.                     <cfif hideTime EQ 0>
  39.                         <div class="detail-item">
  40.                             <span webicon="fa:clock-o"></span>#TimeFormat(arguments.startdatetime,'h:mm tt')#
  41.                             <cfif len(endDateTime)>- #TimeFormat(arguments.enddatetime,'h:mm tt')#</cfif>
  42.                         </div>
  43.                     </cfif>
  44.  
  45.                     <cfif len(locationName)>
  46.                         <div class="detail-item">
  47.                             <span webicon="fa:map-marker"></span> #arguments.locationName#
  48.                         </div>
  49.                     <cfelseif len(location)>
  50.                         <div class="detail-item">
  51.                             <span webicon="fa:map-marker"></span> #arguments.location#
  52.                         </div>
  53.                     </cfif>
  54.  
  55.                     <cfif layoutSetting.getHideTrackOnAgendaDisplay() NEQ 1>
  56.                         <div class="detail-item">
  57.                             <span class="badge" style="background-color: #color#"><cfif arguments.trackDesc NEQ 0>Track #arguments.trackDesc# : </cfif>#arguments.trackName#</span>
  58.                         </div>
  59.                     </cfif>
  60.                 </div>
  61.             </a>
  62.             <span class="favorite-star save-follow <cfif len(arguments.followed)>active</cfif>" webicon="fa:star-o" data-followtype="session" data-followid="#arguments.scheduleID#"></span>
  63.  
  64.         </div> <!--- /.session --->
  65.     </cfsavecontent>
  66.  
  67.     <cfreturn outputText/>
  68. </cffunction>
  69.  
  70. <!--- then when I'm looping through the sessions to display, i call that function with the data ---->
  71. #buildSessionOutput(scheduleID,session.user.getUserID(),title,teaser,startDateTime,endDateTime,locationName,location,trackDesc,trackName,followed)#
  72.  
  73. <!--- this is the part where I check for part 1 in the session title, if found, loop from 2-4 to check for parts 2 - 4--->
  74. <!--- the checkNextPart query will be an endpoint for you to call and i can return the session data back ---->
  75.                                 <cfif findNoCase('part 1', title)>
  76.                                     <cfloop from="2" to="4" index="i">
  77.  
  78.                                         <cfquery name="checkNextPart">
  79.                                             EXECUTE [dbo].[agendaGetNextPart]
  80.                                                 @userID = <cfqueryparam cfsqltype="cf_sql_integer" value="#session.user.getUserID()#"/>,
  81.                                                 @partText = <cfqueryparam cfsqltype="cf_sql_varchar" value="Part #i#%"/>,
  82.                                                 @trackID = <cfqueryparam cfsqltype="cf_sql_integer" value="#trackID#"/>,
  83.                                                 @startDateTime  = <cfqueryparam cfsqltype="cf_sql_varchar" value="#dateTimeFormat(startDateTime,'short')#"/>
  84.                                         </cfquery>
  85.  
  86.                                         <cfif checkNextPart.recordCount>
  87.                                             #buildSessionOutput(checkNextPart.scheduleID,session.user.getUserID(),checkNextPart.title,checkNextPart.teaser,checkNextPart.startDateTime,checkNextPart.endDateTime,checkNextPart.locationName,checkNextPart.location,checkNextPart.trackDesc,checkNextPart.trackName,checkNextPart.followed)#
  88.                                         </cfif>
  89.                                     </cfloop>
  90.                                 </cfif>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement