Where is relevant code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
John01
Forum Newbie
Posts: 1
Joined: Mon Sep 14, 2015 7:26 pm

Where is relevant code?

Post by John01 »

Hi

I am new to PHP. I have inherited a site. One of the pages has a 'Register Interest' button, screen attached.

All the relevant code, as far as I can see, is given below at the end across various files.

My question is where is the code that gets executed when 'Register Interest' button is clicked?

Thanks

Regards

Code: Select all

future_jobs.php
---------------

<?php include 'template/header.php'; ?>

<!-- BEGIN TITLE -->
<h1 class="post-title-margin">Future Jobs</h1>
<!-- END TITLE -->

<!-- BEGIN CONTENT -->
<div class="entry-content">	
<?php 
		$dataAccess = Core::getInstance();
		$futureJobs = $dataAccess->GetUpcomingJobs($_SESSION['username'],$_SESSION['password']);
		echo $futureJobs; 
	?>

</div>
<!-- END CONTENT -->
<?php include 'template/footer.php'; ?>


dataacess.php
-------------

	public function GetUpcomingJobs($username, $password){
		$crypt = new proCrypt;
		$params = new stdClass();
		
		$decryptedUsername = $crypt->decrypt($username);
		$decryptedPassword = $crypt->decrypt($password);
		$client = new SoapClient("http://staff.domain.tld/mobile/mobilewebservice.asmx?wsdl");
		$params->Username = $decryptedUsername;
		$params->Password = $decryptedPassword;    
		$result = $client->GetUpcomingJobs($params)->GetUpcomingJobsResult;

		$resultTransform = $this->TransformXml($result, 'includes/ServiceResultTransform.xsl');
		
		$resultTransform = str_replace('@@username@@', $decryptedUsername, $resultTransform);
		
		return $resultTransform;
	}


ServiceResultTransform.xsl
--------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"
    xmlns:media="http://search.yahoo.com/mrss/" version="1.0">
    
    <xsl:output method="html" indent="yes" version="4.0" omit-xml-declaration="yes"/>
    
    <xsl:template match="/rss">
        <xsl:for-each select="channel/item">
			<xsl:choose>
				<xsl:when test="media:thumbnail">
					<xsl:element name="div">
						<xsl:attribute name="class">scene3D</xsl:attribute>
						<xsl:element name="div">
							<xsl:attribute name="class">flip</xsl:attribute>
							<xsl:element name="div">
								<xsl:element name="p">
									<xsl:element name="a">
										<xsl:attribute name="class">news-link</xsl:attribute>
										<xsl:attribute name="href"> /news_item.php?newsid=<xsl:value-of
												select="guid"/>
										</xsl:attribute>
										<xsl:value-of select="title"/>
									</xsl:element>
								</xsl:element>
							</xsl:element>
							<xsl:element name="div">
								<xsl:element name="img">
									<xsl:attribute name="src">
										<xsl:value-of select="media:thumbnail/@url"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:element>
						</xsl:element>
					</xsl:element>
				</xsl:when>
				<xsl:otherwise>
					<xsl:element name="div">
						<xsl:attribute name="class">scene3D</xsl:attribute>
						<xsl:element name="div">
							<xsl:attribute name="class">flip</xsl:attribute>
							<xsl:element name="div">
								<xsl:element name="p">
									<xsl:element name="a">
										<xsl:attribute name="class">news-link</xsl:attribute>
										<xsl:attribute name="href"> /news_item.php?newsid=<xsl:value-of
												select="guid"/>
										</xsl:attribute>
										<xsl:value-of select="title"/>
									</xsl:element>
								</xsl:element>
							</xsl:element>
							<xsl:element name="div">
								<xsl:attribute name="style">background: none repeat scroll 0 0 #333333;</xsl:attribute>
								<xsl:element name="p">
									<xsl:element name="a">
										<xsl:attribute name="class">news-link</xsl:attribute>
										<xsl:attribute name="href"> /news_item.php?newsid=<xsl:value-of
												select="guid"/>
										</xsl:attribute>
										<xsl:value-of select="title"/>
									</xsl:element>
								</xsl:element>
							</xsl:element>
						</xsl:element>
					</xsl:element>
				</xsl:otherwise>
			</xsl:choose>
        </xsl:for-each>
    </xsl:template>
    
    <xsl:template match="/NewDataSet">
        <xsl:for-each select="BookedJobs">
            <xsl:call-template name="CreateJobHtml">
                <xsl:with-param name="job" select="."></xsl:with-param>
                <xsl:with-param name="count" select="position()"></xsl:with-param>
            </xsl:call-template>
        </xsl:for-each>
        
        <xsl:for-each select="UpcomingJobs">
            <xsl:call-template name="CreateJobHtml">
                <xsl:with-param name="job" select="."></xsl:with-param>
                <xsl:with-param name="count" select="position()"></xsl:with-param>
            </xsl:call-template>
        </xsl:for-each>

        <xsl:for-each select="StaffPreferred">
            <xsl:call-template name="CreatePreferredHtml">
                <xsl:with-param name="preference" select="."></xsl:with-param>
                <xsl:with-param name="count" select="position()"></xsl:with-param>
            </xsl:call-template>
        </xsl:for-each>
		
    </xsl:template>
        
    <xsl:template name="CreateJobHtml">
        <xsl:param name="job"></xsl:param>
        <xsl:param name="count"></xsl:param>
        <div class="toggleboxgrey">
			<xsl:element name="div">
				<xsl:attribute name="id">toggleclosed-button<xsl:value-of select="$count"/></xsl:attribute>
				<xsl:attribute name="class">toggleclosed-button</xsl:attribute>
			</xsl:element>    
            <xsl:element name="div">
                <xsl:attribute name="id">boxclosedtoggle<xsl:value-of select="$count"/></xsl:attribute>
				<xsl:attribute name="class">boxclosedtoggle</xsl:attribute>
				<xsl:choose>
					<xsl:when test="$job/DateTo and $job/DateTo != ''">
						<xsl:value-of select="$job/DateFrom"/> - <span class="date"><xsl:value-of select="$job/DateTo"/></span><br /><xsl:value-of select="substring($job/Venue,1,20)"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$job/DateFrom"/> - <xsl:value-of select="substring($job/Venue,1,20)"/>
					</xsl:otherwise>
				</xsl:choose>
            </xsl:element>    
            <xsl:element name="div">
                <xsl:attribute name="id">boxclosed<xsl:value-of select="$count"/></xsl:attribute>
				<xsl:attribute name="class">boxclosed</xsl:attribute>
                <div class="box listing">
                    <p><span class="table-title">Event ID:</span><xsl:value-of select="$job/ID"/></p>
                    <p><span class="table-title">Client:</span><xsl:value-of select="$job/Client"/></p>
					<xsl:choose>
						<xsl:when test="$job/DateTo and $job/DateTo != ''">
							<p><span class="table-title">Date:</span><span class="date"><xsl:value-of select="$job/DateFrom"/></span> - <span class="date"><xsl:value-of select="$job/DateTo"/></span></p>
						</xsl:when>
						<xsl:otherwise>
							<p><span class="table-title">Date:</span><span class="date"><xsl:value-of select="$job/DateFrom"/></span></p>
						</xsl:otherwise>
					</xsl:choose>
                    <p><span class="table-title">From:</span><span class="date"><xsl:value-of select="$job/TimeFrom"/></span></p>
                    <p><span class="table-title">To:</span><xsl:value-of select="$job/TimeTo"/></p>
                    <p><span class="table-title">Venue:</span><xsl:value-of select="$job/Venue"/></p>
					<p><span class="table-title">Map:</span>
					<xsl:element name="a">
						<xsl:choose>
							<xsl:when test="$job/VenuePostcode and $job/VenuePostcode != ''">
								<xsl:attribute name="href">http://maps.google.co.uk/maps?q=<xsl:value-of select="$job/VenuePostcode"/></xsl:attribute>
							</xsl:when>
							<xsl:otherwise>
								<xsl:attribute name="href">http://maps.google.co.uk/maps?q=<xsl:value-of select="$job/Venue"/></xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
                        <xsl:attribute name="target">_blank</xsl:attribute>View Map
					</xsl:element>                      
                    </p>
                    <p><span class="table-title">Uniforms:</span><xsl:value-of select="$job/Uniforms"/></p>
                    <p><span class="table-title">Staff Role:</span><xsl:value-of select="$job/Staff_x0020_Role"/></p>
					<xsl:if test="$job/Comments and $job/Comments != ''">
						<p><span class="table-title">Additional Information:</span></p>
						<p><xsl:value-of select="$job/Comments"/></p>
					</xsl:if>
					<xsl:element name="form">
						<xsl:attribute name="id">registerinterest-form<xsl:value-of select="$count"/></xsl:attribute>
						<xsl:attribute name="class">registerinterest</xsl:attribute>
						<xsl:element name="input">
							<xsl:attribute name="type">hidden</xsl:attribute>
							<xsl:attribute name="name">eventID</xsl:attribute>
							<xsl:attribute name="id">eventID</xsl:attribute>
							<xsl:attribute name="value">
                <xsl:value-of select="$job/DateFrom"/> - <xsl:value-of select="substring($job/Venue,1,20)"/>
              </xsl:attribute>
						</xsl:element>
						<xsl:element name="input">
							<xsl:attribute name="type">hidden</xsl:attribute>
							<xsl:attribute name="name">username</xsl:attribute>
							<xsl:attribute name="id">username</xsl:attribute>
							<xsl:attribute name="value">@@username@@</xsl:attribute>
						</xsl:element>
						<input type="submit" name="submit" value="Register Interest" id="submit" />
					</xsl:element>                      
                </div>	
            </xsl:element>
        </div>
	</xsl:template>

	<xsl:template name="CreatePreferredHtml">
        <xsl:param name="preference"></xsl:param>
        <xsl:param name="count"></xsl:param>
        <div class="toggleboxgrey">
			<xsl:element name="div">
				<xsl:attribute name="id">toggleclosed-button<xsl:value-of select="$count"/></xsl:attribute>
			</xsl:element>    
            <xsl:element name="div">
                <xsl:attribute name="id">boxclosedtoggle<xsl:value-of select="$count"/></xsl:attribute>
                <xsl:value-of select="$preference/Column1"/> - <xsl:value-of select="$preference/Client"/>
            </xsl:element>    
            <xsl:element name="div">
                <xsl:attribute name="id">boxclosed<xsl:value-of select="$count"/></xsl:attribute>
                <div class="box listing">
                    <p><span class="table-title">Client:</span><xsl:value-of select="$preference/Client"/></p>
                    <p><span class="table-title">Date:</span><span class="date"><xsl:value-of select="$preference/Column1"/></span></p>
                    <p><span class="table-title">Venue:</span><xsl:value-of select="$preference/Venue"/></p>
                </div>	
            </xsl:element>
        </div>
	</xsl:template>
	
</xsl:stylesheet>
Attachments
Screen.png
Post Reply