$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(); # Now load this page and FX Parser will give you a graphical display of your # results. Click on the "Array" links to drill down into the the result. # Have fun! # END OF USER CODE HERE # You do not need to alter anymore code for the parser to work # -------------------------------------------------------------------------------- # -------------------------------------------------------------------------------- # # Parser Code - Please Read! # # # # Unless you are familiar with PHP, CSS, XHTML or Javascript DO NOT # # alter code beneath this comment OR you may inadvertantly BREAK the # # parser. # # -------------------------------------------------------------------------------- #
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> </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; }
// 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> <title>iViking FX -- Book Detail Demo Page</title> <style type="text/css"> <!-- .whitetxt {color: #FFFFFF} --> </style> </head>
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); curl_exec($ch); $e = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($e == 200) { $o = true;