コード例 #1
0
ファイル: detail-fx.php プロジェクト: nojimage/fxphp
header('Content-Type: text/html;charset=utf-8');
// Added by msyk 2004/8/13
// For avoiding MOJI-BAKE( invalid character ), please saving this file by UTF-8 chacter set.
// このファイルはUTF-8で保存して利用してください。
include_once 'FX/FX.php';
// FX_charset.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once 'server_data.php';
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$BookQuery = new FX($serverIP, $webCompanionPort, 'FMPro7');
// This line creates an instance of the FX class
// If you use version 6 pro/unlimited, modify to 'FMPro5/6' from 'FMPro7'.
$BookQuery->SetDBData("Book_List", "Detail_View");
// The '->' indicates that SetDBData is part of the FX instance we just created.
$BookQuery->AddDBParam('-recid', $HTTP_GET_VARS['ID']);
// '-recid' is a reference to the unique ID that FileMaker
// creates for each record.  You'll also note that PHP
// recognizes the parameters passed from the last page ('ID').
$query = $HTTP_GET_VARS['query'];
$BookData = $BookQuery->FMFind();
$currentKey = key($BookData['data']);
// From the online PHP manual:
// key() returns the index element of the current array position
// This is ideal in our case since the outer array has one element.
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
コード例 #2
0
ファイル: index.php プロジェクト: SmartPCGuy/fxphp
######## !!! Welcome to PHP, the FX.php Class and the FX Parser !!!! ###########
#  	BEGINNING OF USER CODE HERE
#  	This area is for you to change so the FileMaker query matches your own query.
#  	Use the FX Class documentation for understanding more about this process...
#
#  	To make the FX class work, the FX folder must be at the root level of your
#  	site, and you must INCLUDE the FX class into this page like this:
require_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
#  	You start your query by creating a new instance of an FX Class and assigning
#  	it to a variable.
$query = new FX(your_serverIP, 80, 'FMPro7');
#  	Using the same variable call the SetDBPassword (if necessary) using the pass-
#  	word and username that has the fmxml extended privilege.
$query->SetDBPassword(your_password, your_username);
#  	Using the new variable $query, call the SetDBData function, specifying which
#	FMP file, layout and how many you want in the returned set (this example
#	shows how to limit the result record set to 3).
$query->SetDBData(your_fm7File, your_layout, 3);
#  	Using the same variable call the AddDBParam to specify your serach criteria,
#  	passing it the field name and the match content (you can repeat this function
# 	as many times as you wish to add find requests).
$query->AddDBParam(your_fieldname, your_find_criteria);
#  	If you want to sort the result, us the AddSortParam  function and specify  the
#  	field and  the direction  (ascend/descend) of  your sort (you can repeat this
#  	function as many times as you wish for each sort request).  Uncomment this
#	this function line and add your field name to sort your find results.
#   $query->AddSortParam(your_sort_field_name, 'ascend');
#  	The last function is  FMFind which  is assigned  to a new variable. NOTE: You
#  	must assigned this to the a variable named $queryResult  for the FX Parser to
#  	be able to recognize the found set...
$queryResult = $query->FMFind();
コード例 #3
0
function findSeminars($args = false, $webArgs = false) {
	$sixWeeksFromToday = time() + (60 * 60 * 24 * 7 * 6);
	$dateRange = date('n/j/Y').'...'.date('n/j/Y', $sixWeeksFromToday);
	
	$fm = new FX();
	$fm->SetDBData('meyerSeminar', 'xsl_calendar');
	if($args) {
		foreach($args as $arg) {
			$fm->AddDBParam('KEY', $arg);
		}
		$fm->AddDBParam('-lop', 'or');
	} else {
		$fm->AddDBParam('isOpen', 1);
		$fm->AddDBParam('seminarTopic::isWebinar', 'yes', 'neq');
	}
//	$fm->AddDBParam('startDate', $dateRange);
	
	
	$fm->AddSortParam('venue::territory', 'regions');
	$fm->AddSortParam('startDate', 'ascend');
	$queryResult = $fm->FMFind();  
	if(FX::isError($queryResult)) $cache_this->errorCatch();
	$calendar = $queryResult['data'];
	
	
	// get Webinars
	
	$fm->SetDBData('meyerSeminar', 'xsl_calendar');
	if($webArgs) {
		foreach($webArgs as $arg) {
			$webinar_keys = $_REQUEST['ids_for_'.$arg];
			foreach($webinar_keys as $key) {
				$fm->AddDBParam('KEY', $key);
			}
		}
		$fm->AddDBParam('-lop', 'or');
	} else {
		$fm->AddDBParam('isOpen', 1);
		$fm->AddDBParam('seminarTopic::isWebinar', 'yes', 'eq');
	}
//	$fm->AddDBParam('startDate', $dateRange);
	
	$fm->AddSortParam('startDate', 'ascend');
	$fm->AddSortParam('startTime', 'ascend');
	$queryResult = $fm->FMFind();  
	if(FX::isError($queryResult)) $cache_this->errorCatch();
	if($queryResult['foundCount'] > 0) $webinars = $queryResult['data'];
	
	
	$region = '';
	$lastRegion = '';
	
	if(!$args) {
		$output = '<form action="upcoming_seminars.php" method="post">
								<input type="hidden" name="_do" value="process" />';
	}
	
	
	// seminars loop
	
	foreach($calendar as $recID => $data) {
		// 2 column design.  This $col keeps track of which column we are on, so we can know when to open/close table rows
		$col = (($col == 1)?2:1);
		$region = $data['venue::territory'][0];

		//HTML Output Variables
		$regionHTML = '
					<tr>
						<td colspan="3" align="center" height="50" style="line-height:21px;">
							<div></div>
						</td>
					</tr>
					<tr>
						<td colspan="3">
							<table cellspacing="0" cellpadding="0" border="0" class="text_wrap">
								<tr>
									<td colspan="1" style="font-size:20px;line-height:28px;" class="cat_header">
										<span style="font-family:Arial,sans-serif;font-weight:bold;color:#558ac8;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing: grayscale;">'.$region.'</span>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" align="center" height="20" style="line-height:21px;">
							<div style="border-top:1px solid #558ac8;" id="seminars_underline"></div>
						</td>
					</tr>
					<tr>
						<td colspan="3" align="center" height="20" style="line-height:21px;">
							<div></div>
						</td>
					</tr>
					<tr>
						<td align="center" valign="top">';
		$padding = 	'<tr><td colspan="3" align="center" height="40" style="line-height:21px;" class="seminars_pad"><div></div></td></tr>';
		$leftCol = '<tr><td align="center" valign="top"><table cellpadding="0" cellspacing="0" border="0" width="210" align="left" class="stories_cont">' . '<tr><td colspan="2" align="center">';
		$rightCol = '<table cellpadding="0" cellspacing="0" border="0" width="210" align="right" class="stories_cont"><tr><td colspan="2" align="center">';
		$openSem = '<table cellpadding="0" cellspacing="0" border="0" class="seminars_text"><tr><td colspan="1" valign="top" style="font-size:18px;line-height:25px;" class="seminars_align">';

		// split things up by region
		if(!$region || $region != $lastRegion) {
			// different case for the first row
			if($lastRegion) {
				// if row was unfinished, finish it
				if($col == 2) {
					$output .= '<td>&nbsp;</td></tr>';
					$col = 1;
				}
				// close previous section, make divider
				$output .= '
					</td>
				</tr>';
			}
			
			// open new seminar block (REPLACED)
			$output .= $regionHTML;
		}
		
		
		//open a new row
		if($col == 1) {
			$output .= $leftCol;
		}
		if($col == 2) {
			$output .= $rightCol;
		}
		// the meat of the seminars
		$id = $data['KEY'][0];
		$regLink = (($data['Cvent_link'][0])?$data['Cvent_link'][0]:'http://www.meyersound.com/seminars/registration.php?id='.$id);
		$language = '('.str_replace(array('(',')'),'',$data['web_language'][0]).')';
		$output .= $openSem;
		if(!$args) {
			$output .= '<input type="checkbox" name="selectedSeminars[]" class="seminarSelect" value="'.$id.'">';
		}
		$output .= '
										<a href="'.$regLink.'" style="font-family:Arial,sans-serif;font-weight:normal;color:#5d6e83;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;text-decoration:none;" class="tagline">'.$data['venue::friendlyLocation'][0].'</a> 
									</td>
								</tr>
								<tr>
									<td colspan="1" valign="top" style="font-size:14px;line-height:21px;" class="seminars_align">
										<span style="font-family:Arial, sans-serif;font-weight:normal;color:#0f4dbc;text-decoration:none;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;" class="description">'.$data['friendlyDate'][0].'</span>
									</td>
								</tr>
								<tr>
									<td colspan="1" valign="top" style="font-size:14px;line-height:21px;" class="seminars_align">
										<span style="font-family:Arial, sans-serif;font-weight:normal;color:#51667c;text-decoration:none;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;" class="description">'.$data['seminarTopic::friendlyName'][0].' '.(($region != 'North America')?$language:'').'</span>
									</td>
								</tr>
						</table>
					</td>
				</tr>
			</table>';
		if($col == 2){
			$output .= '</td></tr>' .$padding;
		}			
		$lastRegion = $region;
		
	}// End Foreach Loop	
	
	// close last region:
	//$output .= '
				//		</table>
			//		</td>
			//	</tr>';
	// open new divider if there are webinars	to display
	if($webinars) {
		$output .= '
				<tr>
						<td class="w448" style="font-size: 11px; line-height: 22px; padding: 0px 35px; vertical-align: top;">
							<p class="left" style="margin: 2px 0px; float: left;"><img src="http://www.meyersound.com/mail/seminar_images/short-hr.gif" alt="" style="border: none;" /></p>
						</td>
				</tr>
				<tr>
						<td class="w448" style="font-size: 11px; line-height: 22px; padding: 0px 35px; vertical-align: top;">

							<p class="left" style="margin: 5px 0px; float: left;"><span class="mh1 blue normal" style="font-size: 14px; font-weight: normal; color: #3a4e7f;">Webinars</span></p>						</td>
					</tr>
					<tr>
						<td class="w448" style="font-size: 11px; line-height: 22px; padding: 0px 35px; vertical-align: top;">
							<table cellspacing="0" border="0" cellpadding="0" width="100%">';
	
		$col = 0;
		// webinars loop
		// first loop through and group webinars by the same date, and format so multiple webinars on one day gets one entry
		// webinars are put into an array, keyed by dateKey (seminar date and topic ID)
		foreach($webinars as $recID => $data) {
			
			// the meat of the seminars
			$id = $data['KEY'][0];
			$regLink = (($data['Cvent_link'][0])?$data['Cvent_link'][0]:'http://www.meyersound.com/seminars/registration.php?id='.$id);
			$language = '('.str_replace(array('(',')'),'',$data['web_language'][0]).')';
			
			$dateKey = str_replace(' ','_',str_replace(',','',$data['friendlyDate'][0]).'-'.$data['seminarTopic::KEY'][0]);
			
			$web[$dateKey]['courseName'] = str_replace('Webinar - ','',$data['seminarTopic::friendlyName'][0]).' '.(($region != 'North America')?$language:'');
			$web[$dateKey]['date'] = $data['friendlyDate'][0];
			//$web[$data['friendlyDate'][0]]['topicKey'] = $data['seminarTopic::KEY'][0];
			
			$web[$dateKey]['time'][$id] = '<a href="'.$regLink.'" style="font-size: 11px; color: #555656; text-decoration: none;">Register for '.formatFMTime($data['startTime'][0]).' PST</a>';
			
		}
		
		foreach($web as $dateKey => $data) {
			// 2 column design.  This $col keeps track of which column we are on, so we can know when to open/close table rows
			$col = (($col == 1)?2:1);
			
			//open a new row
			if($col == 1) {
				$output .= '<tr>';
			}
			
			// the meat of the seminars
			$id = $data['KEY'][0];
			$regLink = (($data['Cvent_link'][0])?$data['Cvent_link'][0]:'http://www.meyersound.com/seminars/registration.php?id='.$id);
			$language = '('.str_replace(array('(',')'),'',$data['web_language'][0]).')';
			
			$output .= '
								<td style="vertical-align: top;">';
			if(!$args) {
				// each webinar has 1 or more distinct course IDs for different times
				// make one checkbox for this course (by date+key, replacing commas and spaces w/ underscores
				//$dateKey = str_replace(' ','_',str_replace(',','',$data['date']).'-'.$data['topicKey']);
				$output .= '<input type="checkbox" name="selectedWebinars[]" class="seminarSelect" value="'.$dateKey.'">';
				foreach($data['time'] as $key => $time) {
					$output .= '<input type="hidden" name="ids_for_'.$dateKey.'[]" value="'.$key.'">';
				}
			}
			$output .= '
									<ul class="seminar" style="margin: 0px; list-style: none; line-height: normal; padding: 0px 0px 20px 0px; width: 224px;">
										<li class="sloc" style="font-weight: bold; font-size: 12px; color: #555656;">
											'.str_replace('(1 hour)', '', $data['courseName']).'
											
										</li>
										<li class="sdate" style="font-size: 11px; color: #3a4e7f;">'.$data['date'].'</li>';
			foreach($data['time'] as $key => $time) {
				$output .= '<li class="sinfo" style="font-size: 11px; width: 150px;">'.$time.'</li>';
			}
			$output .= '
									</ul> 
								</td>';
										
			if($col == 2) {
				$output .= '</tr>';
			}
			
			
		}	
		// close last row
		$output .= '		</table>
						</td>
					</tr>';
	} // end if webinars	
	if(!$args) {
		$output .= '
						<tr>
					<td><input type="submit" value="submit">
				</form>
			</td>
		</tr>';
	}
	
	return $output;
}
コード例 #4
0
ファイル: displayFXDataset.php プロジェクト: SmartPCGuy/fxphp
<?php

// '<?' or '<?php' tells PHP to start parsing
/*********************************************************************
 * The comments herein are designed to be helpful to someone with    *
 * little or no programming experience.  To that end, many of the    *
 * comments may address things will appear obvious to many coders.   *
 * For the most part I'll place my comments at the end of each line. *
 * Feel free to e-mail any comments or questions to FX@iviking.org.  *
 * Please remember that this code is being released as open source   *
 * under The Artistic License of PERL fame...                        *
 * http://www.opensource.org/licenses/artistic-license.html          *
 *...and is also covered by the FX.php license addendum...           *
 * http://www.iviking.org/downloads/ADDENDUM.txt                     *
 *********************************************************************/
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
// FX.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php";
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
// This line creates an instance of the FX class
$DatasetQuery->SetDBData("Book_List.fp5", "Detail_View", 2);
// The '->' indicates that SetDBData is part of
// the FX instance we just created.
$DatasetQuery->FMSkipRecords(2);
$BookData = $DatasetQuery->FMFindAll();
?>
コード例 #5
0
<?php

// '<?' or '<?php' tells PHP to start parsing
/*********************************************************************
 * The comments herein are designed to be helpful to someone with    *
 * little or no programming experience.  To that end, many of the    *
 * comments may address things will appear obvious to many coders.   *
 * For the most part I'll place my comments at the end of each line. *
 * Feel free to e-mail any comments or questions to FX@iviking.org.  *
 * Please remember that this code is being released as open source   *
 * under The Artistic License of PERL fame...                        *
 * http://www.opensource.org/licenses/artistic-license.html          *
 *...and is also covered by the FX.php license addendum...           *
 * http://www.iviking.org/downloads/ADDENDUM.txt                     *
 *********************************************************************/
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
// FX.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php";
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
// This line creates an instance of the FX class
$DatasetQuery->SetDBUserPass($webUN, $webPW);
$DatasetQuery->SetDBData('Tester', 'Main_View');
$LayoutData = $DatasetQuery->FMView();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
コード例 #6
0
<?php

// '<?' or '<?php' tells PHP to start parsing
/*********************************************************************
 * The comments herein are designed to be helpful to someone with    *
 * little or no programming experience.  To that end, many of the    *
 * comments may address things will appear obvious to many coders.   *
 * For the most part I'll place my comments at the end of each line. *
 * Feel free to e-mail any comments or questions to FX@iviking.org.  *
 * Please remember that this code is being released as open source   *
 * under The Artistic License of PERL fame...                        *
 * http://www.opensource.org/licenses/artistic-license.html          *
 *...and is also covered by the FX.php license addendum...           *
 * http://www.iviking.org/downloads/ADDENDUM.txt                     *
 *********************************************************************/
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
// FX.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php";
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
// This line creates an instance of the FX class
$DatasetQuery->SetDBData('Book_List.fp5');
$LayoutData = $DatasetQuery->FMLayoutNames();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
コード例 #7
0
ファイル: fx_tester.php プロジェクト: SmartPCGuy/fxphp
    // configure a connection to FileMaker Server Advanced
    $contactsListQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
    // set database and layout information
    $contactsListQuery->SetDBData('Contacts.fp7', 'web_list');
    // set database username and password
    $contactsListQuery->SetDBUserPass($webUN, $webPW);
    // add parameter array for new record
    $contactsListQuery->AddDBParamArray($searchRecordsArray);
    // create a new record
    $contactsList = $contactsListQuery->DoFXAction('perform_find');
} else {
    // otherwise, find all records
    // configure a connection to FileMaker Server Advanced
    $contactsListQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
    // set database and layout information
    $contactsListQuery->SetDBData('Contacts.fp7', 'web_list', 'all');
    // set database username and password
    $contactsListQuery->SetDBUserPass($webUN, $webPW);
    // retrieve all records in this database available to the current user
    $contactsList = $contactsListQuery->DoFXAction('show_all');
}
?>
<html>
    <head>
        <title>FX Error Tester</title>
    </head>
    <body>
        <h1>Contact List</h1>
        <table border="1">
            <tr>
                <th>First Name</th>
コード例 #8
0
ファイル: index.php プロジェクト: SmartPCGuy/fxphp
 // This line creates an instance of the FX class.
 $DatabaseData = $FXQuery->FMDBNames();
 // The '->' indicates that SetDBData is part of
 // the FX instance we just created.
 if (FX::isError($DatabaseData)) {
     echo "<pre>\n";
     print_r($LayoutData);
     echo "</pre>\n";
     exit;
 }
 foreach ($DatabaseData['data'] as $key => $value) {
     $currentDatabaseList[] = $value['DATABASE_NAME'][0];
 }
 unset($DatabaseData);
 if (in_array($FXE_currentDatabaseName, $currentDatabaseList)) {
     $FXQuery->SetDBData($FXE_currentDatabaseName);
     $FXQuery->SetDBPassword($FXE_password, $FXE_username);
     // Note that password is the FIRST parameter (since user names are only relevant for the FM Web Security DB.)
     $LayoutData = $FXQuery->FMLayoutNames();
     if (FX::isError($LayoutData)) {
         echo "<pre>\n";
         print_r($LayoutData);
         echo "</pre>\n";
         exit;
     }
     foreach ($LayoutData['data'] as $key => $value) {
         $currentLayoutList[] = $value['LAYOUT_NAME'][0];
     }
     unset($LayoutData);
     if ($FXE_currentLayoutName == '' && strtolower($dataSourceType) == 'fmpro5/6' || in_array($FXE_currentLayoutName, $currentLayoutList)) {
         $errorMessage = 'None';
コード例 #9
0
the math of bandwidth distribution is simple it follows the principles of the multilplication table.

The more fields and the bigger then content, the slower the query.

For the purpose of bandwidth distribution it is not desirable to make the total space more narrow than it already is.


A typical real world example below
*/
$tmpStaticFile = 'http://www.example.com/xml/order/' . $o . '.fmpxmlresult.xml';
if (uriexists($tmpStaticFile)) {
    $q = new FX($tmpStaticFile);
    $q->FMFOpenQuery(true);
} else {
    $q = new FX($dinnerForOne, $sandeman);
    $q->SetDBData('WorldWideWait', 'xmlOrderStatusFlag');
    $q->AddDBParam('ordernumber', $_POST['ordernumber'], 'eq');
    $q->SetDBPassword($xmlPass, $xmlUser);
}
$r = $q->FMFind();
/*

uriexists implementation below:
*/
function uriexists($uri)
{
    // $o = output
    // $e = error code
    // $ch = cURL handler
    $ch = curl_init($uri);
    curl_setopt($ch, CURLOPT_NOBODY, true);