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; }
// Note the '$$' a couple of lines down. I'm using a variable // whose name is the contents of another variable. VERY handy. // **** Added by msyk 2004/3/23 **** To make a new record in DB. if (${$arrayName}['currentQuery'] == 'New Record') { foreach ($HTTP_POST_VARS as $key => $value) { if ($key != 'currentQuery' && $key != 'currentSort') { $BookQuery->AddDBParam($key, stripslashes($value)); } } $BookQuery->FMNew(); } //$BookQuery->SetDBData("Book_List.fp7", "Book_List"); // The extension in the file name omited for multi version compatibility(msyk) if (${$arrayName}['currentSort'] != '') { // If sorting has been requested, this adds it to the query. $BookQuery->AddSortParam($HTTP_GET_VARS['currentSort']); } if (${$arrayName}['currentQuery'] == 'Search Book List!') { // Check if this page is being accessed by a search foreach (${$arrayName} as $key => $value) { // 'foreach()' is a VERY handy function. It steps // through an array and stores the data in temporary // variables as directed ($key and $value in this case) if ($key != 'currentSort' && $key != 'currentQuery') { $BookQuery->AddDBParam($key, $value); // '$key' contains the name of the field to search in, } // '$value' contains the value we hope to find. $currentSearch .= '&' . "{$key}=" . urlencode($value); // The '.' and '.=' operators concatenate expressions }