[FX.php List] CDML: [FMP-linkfirst], [FMP-linklast], [FMP-rangestart], [FMP-rangeend] and [FMP-currentrecordcount]

Phil Goodman Philip.Goodman at bechtle.co.uk
Thu Jan 19 09:31:30 MST 2006


Hi Chris,

Okay, all the modifications are in the AssembleDataSet Function, I've
marked the lines I altered...

This is in FX.php v4.2 (Date 03 Dec 2005).

If you thought they are good enough to add, I'd be more than happy.

//---------------------------------Start of
Function----------------------- 

  function AssembleDataSet ($returnData)
  {
    $dataSet = array();
    $FMNext = $this->currentSkip + $this->groupSize;
    $FMPrevious = $this->currentSkip - $this->groupSize;

//** lines below added by Phil G - 02-Dec-2005. **

    $FMFirst = 0;
    $FMLast = $this->foundCount - $this->groupSize;

//** lines above added by Phil G - 02-Dec-2005. **

    switch ($returnData) {
      case 'object':
        $dataSet = $this->currentData;

        if ($FMNext < $this->foundCount || $FMPrevious >= 0) {
          $tempQueryString = $this->BuildLinkQueryString();
        } else {
          $tempQueryString = '';
        }
        if ($FMNext >= $this->foundCount) {
          $this->lastLinkNext = "";
        } else {
          $this->lastLinkNext = $_SERVER['SCRIPT_NAME'] .
"?skip=$FMNext&{$tempQueryString}";
        }
        if ($FMPrevious < 0) {
          $this->lastLinkPrevious = "";
        } else {
          $this->lastLinkPrevious = $_SERVER['SCRIPT_NAME'] .
"?skip=$FMPrevious&{$tempQueryString}";
        }

        $this->lastFoundCount = $this->foundCount;
        $this->lastFields = $this->fieldInfo;
        $this->lastURL = $this->dataURL;
        $this->lastQuery = $this->dataQuery;
        $this->lastErrorCode = $this->fxError;
        $this->lastValueLists = $this->valueLists;
        break;
      case 'full':
        $dataSet['data'] = $this->currentData;
      case 'basic':
        if ($FMNext < $this->foundCount || $FMPrevious >= 0) {
          $tempQueryString = $this->BuildLinkQueryString();
        } else {
          $tempQueryString = '';
        }
        if ($FMNext >= $this->foundCount) {
          $dataSet['linkNext'] = "";
        } else {
          $dataSet['linkNext'] = $_SERVER['SCRIPT_NAME'] .
"?skip=$FMNext&{$tempQueryString}";
        }

//** The below line changed by Phil G - 02-12-05 **
        //if ($FMPrevious < 0) {
        if ($FMPrevious <= 0 - $this->groupSize) {
          $dataSet['linkPrevious'] = "";
        } else {
          $dataSet['linkPrevious'] = $_SERVER['SCRIPT_NAME'] .
"?skip=$FMPrevious&{$tempQueryString}";
        }

        $dataSet['foundCount'] = $this->foundCount;

//** lines below added by Phil G - 02-Dec-2005. **

        // Duplicates the CDML [FMP-linklast]
        if ($FMLast <= $this->currentSkip + $this->$groupSize) {
          $dataSet['linkLast'] = "";
        } else {
          $dataSet['linkLast'] = $_SERVER['SCRIPT_NAME'] .
"?skip=$FMLast&{$tempQueryString}";
        }

        // Duplicates the CDML [FMP-linkfirst]
        if ($this->currentSkip <= 0) {
          $dataSet['linkFirst'] = "";
        } else {
          $dataSet['linkFirst'] = $_SERVER['SCRIPT_NAME'] .
"?skip=$FMFirst&{$tempQueryString}";
        }

        // Duplicates the CDML [FMP-currentrecordcount]
        $dataSet['totalRecordCount'] = $this->totalRecordCount;

        $dataSet['currentSkip'] = $this->currentSkip;

        // Duplicates the CDML [FMP-rangestart]
        $dataSet['rangeStart'] = $this->currentSkip + 1;

        // Duplicates the CDML [FMP-rangeend]
        if ($this->currentSkip + $this->groupSize >= $this->foundCount)
{
          $dataSet['rangeEnd'] = $this->foundCount;
        } else {
          $dataSet['rangeEnd'] = $this->currentSkip + $this->groupSize;
        } 

//** lines above added by Phil G - 02-Dec-2005. **

        $dataSet['fields'] = $this->fieldInfo;
        $dataSet['URL'] = $this->dataURL;
        $dataSet['query'] = $this->dataQuery;
        $dataSet['errorCode'] = $this->fxError;
        $dataSet['valueLists'] = $this->valueLists;
        break;
    }

    $this->ClearAllParams();
    return $dataSet;
  }

//---------------------------------End of
Function-----------------------

As a idea how to use them for anybody who is starting out on the CDML to
php conversion, I've included a couple of code fragments below...

//---------------------------------Start of Record
counts-----------------------
<table cellspacing="0" cellpadding="0" border="0">
  <tr>
    <td>Records: <b><?php echo ($databaseDataArray['totalRecordCount']);
?></b> Total.</td>
    <td>View: <b><?php echo ($databaseDataArray['rangeStart']); ?></b> -
<b><?php echo ($databaseDataArray['rangeEnd']); ?></b> of <b><?php echo
($databaseDataArray['foundCount']); ?></b> found.</td>
  </tr>
</table>
//---------------------------------End of Record
counts-----------------------

//---------------------------------Start of First, Prev, Next and Last
Links-----------------------
<table cellspacing="0" cellpadding="0" border="0">
  <tr>
    <td width="50">
      <?php if (strlen($databaseDataArray['linkFirst']) < 1) {
        echo '<A
class="backwardstoparrowgrey"><b>First&nbsp;&nbsp;&nbsp;</b></A>';
      } else {
        echo '<a title="Display first '.$listSize.' records"
href="'.$databaseDataArray['linkFirst'].'"
class="backwardstoparrow"><b>First&nbsp;&nbsp;&nbsp;</b></a>';
      } ?>
    </td>
    <td width="50">
      <?php if (strlen($databaseDataArray['linkPrevious']) < 1) {
        echo '<A
class="backwardarrowgrey"><b>Prev&nbsp;&nbsp;&nbsp;</b></A>';
      } else {
        echo '<a title="Display previous '.$listSize.' records"
href="'.$databaseDataArray['linkPrevious'].'"
class="backwardarrow"><b>Prev&nbsp;&nbsp;&nbsp;</b></a>';
      } ?>
    </td>
    <td width="50">
      <?php if (strlen($databaseDataArray['linkNext']) < 1) {
        echo '<A
class="forwardarrowgrey"><b>Next&nbsp;&nbsp;&nbsp;</b></A>';
      } else {
        echo '<a title="Display next '.$listSize.' records"
href="'.$databaseDataArray['linkNext'].'"
class="forwardarrow"><b>Next&nbsp;&nbsp;&nbsp;</b></a>';
      } ?>
    </td>
    <td width="50">
      <?php if (strlen($databaseDataArray['linkLast']) < 1) {
        echo '<A
class="forwardstoparrowgrey"><b>Last&nbsp;&nbsp;&nbsp;</b></A>';
      } else {
        echo '<a title="Display last '.$listSize.' records"
href="'.$databaseDataArray['linkLast'].'"
class="forwardstoparrow"><b>Last&nbsp;&nbsp;&nbsp;</b></a>';
      } ?>
    </td>
  </tr>
</table>
//---------------------------------Start of First, Prev, Next and Last
Links-----------------------

Hope this is useful.

Cheers,
Phil.

-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Chris Hansen
Sent: Thursday 19 January 2006 3:52 pm
To: FX.php Discussion List
Subject: Re: [FX.php List] CDML: [FMP-linkfirst],
[FMP-linklast],[FMP-rangestart], [FMP-rangeend] and
[FMP-currentrecordcount]

Phil,

I am.  I'd actually like to look at adding the functionality to FX.php
(it's open-source after all.)  Thanks!

--Chris Hansen
   creator of FX.php
   "The best way from FileMaker to the Web."
   www.iViking.org

On Jan 19, 2006, at 7:59 AM, Phil Goodman wrote:

> CDML: [FMP-linkfirst], [FMP-linklast], [FMP-rangestart], [FMP- 
> rangeend] and [FMP-currentrecordcount]
>
> Is anyone interested in my modifications to FX.php to duplicate the 
> above CDML functions?
>
> ============================================
>  Phil Goodman
>  Email: mailto:phil.goodman at bechtle.co.uk
>  Tel: +44 (0)1249 467936
>  Fax: +44 (0)1249 467933
>  Web: http://www.bechtle.co.uk
> ============================================
>
>
>
> ______________________________________________________________________
>
> Contact your Account Manager today to claim your FREE 2 week trial of 
> an Epson AcuLaser C2600N 
> ______________________________________________________________________
>
> This message has been checked for all known viruses by Star Internet 
> delivered through the MessageLabs Virus Scanning Service.
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list

______________________________________________________________________

Contact your Account Manager today to claim your FREE 2 week trial of an Epson AcuLaser C2600N ______________________________________________________________________

This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service.


More information about the FX.php_List mailing list