Class SamPaginator

(line 66)

Description


Located in File: /sampaginator.inc.php

We will need one class to work with this class

We will need one class to work with this class (1) SamMysql Class



Class Variables

Summary:
string $fieldA
string $fieldB
object $mydb
string $operation
integer $page_number
string $page_url
integer $rec_perPage
integer $rows_per_page
resource $tableResult
string $table_name
integer $totalPages
integer $totalRecord
string $valueA
string $valueB

$columns_per_row (line 144)

Data type : integer

The number of columns to display per row on each page

The number of columns to display per row on each page

  • access: - private

$fieldA (line 151)

Data type : string

The name of the first field we need to search for in the table

The name of the first field we need to search for in the table

  • access: - private

$fieldB (line 165)

Data type : string

The name of the second field we need to search for in the table

The name of the second field we need to search for in the table

  • access: - private

$ID_field_name (line 116)

Data type : string

The name of the ID field of the table we are working on

The name of the ID field of the table we are working on

  • access: - private

$mydb (line 72)

Data type : object

The instance of the SamMysql database class

The instance of the SamMysql database class

  • access: - private

$operation (line 179)

Data type : string

The type of operation to perform, search or normal query

The type of operation to perform, search or normal query

  • access: - private

$page_number (line 101)

Data type : integer

The page number of the page to be displayed

The page number of the page to be displayed

  • access: - private

$page_url (line 109)

Data type : string

The url of the page using this class now

The url of the page using this class now

  • access: - private

$rec_perPage (line 130)

Data type : integer

The maximum number of records per page to be displayed

The maximum number of records per page to be displayed

  • access: - private

$rows_per_page (line 137)

Data type : integer

The number of rows to display per page

The number of rows to display per page

  • access: - private

$tableResult (line 79)

Data type : resource

The resouce id for the results from the database query/search

The resouce id for the results from the database query/search

  • access: - private

$table_name (line 123)

Data type : string

The name of the table in the database

The name of the table in the database

  • access: - private

$totalPages (line 93)

Data type : integer

The total number of pages of records we have from the database query/search

The total number of pages of records we have from the database query/search

  • access: - private

$totalRecord (line 86)

Data type : integer

The total number of available records from the database query/search

The total number of available records from the database query/search

  • access: - private

$valueA (line 158)

Data type : string

The value of the first field we need to search for in the table

The value of the first field we need to search for in the table

  • access: - private

$valueB (line 172)

Data type : string

The value of the second field we need to search for in the table

The value of the second field we need to search for in the table

  • access: - private

Class Constants

Summary:

Method Detail

Summary:
SamPaginator SamPaginator (Object &$mydb, String $recordTable, String $Id_field, String $Operation, Integer $PageNumber, [Integer $maxRows = 2], [Integer $maxColumns = 1], [String $f_FieldName = "None"], [Mixed $f_FieldValue = "None"], [String $s_FieldName = "None"], [Mixed $s_FieldValue = "None"])
void displayerror ( $terror, string $terror,)
resource getResults ()
integer getTotalRecords ()
void showAllRecords ()
void showArticles (string $titleField, string $contentField, [integer $totalCharaters = ""], [string $linkPageUrl = ""], [string $imageField = ""], [String $imagePathPrefix = ""], [string $cssClass = ""])
integer showPagenumber (string $pageurl, [string $sub_method = ""], [string $labelA = ""], [string $labelA_val = ""], [string $labelB = ""], [string $labelB_val = ""], [string $cssClassA = ""], [string $cssClassB = ""])
void showPhotoGallery (string $imageField, string $imageTitleField, [string $linkPageUrl = ""], [String $imagePathPrefix = ""], [string $cssID = ""])
void showTitle ([string $r_title = ""], [string $css_id = ""])

Constructor SamPaginator (line 200)

SamPaginator SamPaginator( Object &$mydb, String $recordTable, String $Id_field, String $Operation, Integer $PageNumber, [Integer $maxRows = 2], [Integer $maxColumns = 1], [String $f_FieldName = "None"], [Mixed $f_FieldValue = "None"], [String $s_FieldName = "None"], [Mixed $s_FieldValue = "None"])

The Class Constructor Accepts your database connection object and other parameters.

The Class Constructor Accepts your database connection object and other parameters.

Parameters

  • Object &$mydb: Instance of the SamMysql Class
  • String $recordTable: Name of Table in the Database
  • String $Id_field: Name of the id field on the table
  • String $Operation: Type of operation to perform on the table, 'S' for SEARCH or 'Q' for QUERY
  • Integer $PageNumber: Page_number of the page to be displayed
  • Integer $maxRows: Number of rows to display per page
  • Integer $maxColumns: Number of columns to display per Row
  • String $f_FieldName: Name of the first field to search for in the table
  • Mixed $f_FieldValue: Value of the first field to search for in the table
  • String $s_FieldName: Name of the second field to search for in the table
  • Mixed $s_FieldValue: Value of the second field to search for in the table

Info

Method displayerror (line 976)

void displayerror( $terror, string $terror,)

Function to display fine error messages if it occurs in the process of doing anything in this program.

Function to display fine error messages if it occurs in the process of doing anything in this program.

Parameters

  • string $terror,: error message to display
  • $terror:

Info

  • name - showmyerror

Method getResults (line 250)

resource getResults( )

Function that get our records from the given table in the database It does not take any parameter. You can use this if you want to display the records in your own way. Otherwise, you don't need to call this function as there is another function that will display the records for you.

Function that get our records from the given table in the database It does not take any parameter.
You can use this if you want to display the records in your own way.
Otherwise, you don't need to call this function as there is another function that will display the records for you. EXAMPLE:

  1.  Usage
  2.  =====
  3.  $mypageclass = new SamPaginator(.......);
  4.  // use this function only if you wish to display the
  5.  // records in your own way, otherwise, you may not really
  6.  // need this function
  7.  $my_resource $mypageclass->getResults();
  8.  // loop through the result to display your records
  9.  while ($my_result = mysql_fetch_array($my_resource{
  10.    // Display your records here using your own style
  11.      ............
  12.  }

Info

  • access - public

Method getTotalRecords (line 415)

integer getTotalRecords( )

Function that returns the total records in the given table in the database This function returns the total records based on our query/search You can use this function to test for any result so that you can display a very neat error message for your visitors if no record is available yet in the table.

Function that returns the total records in the given table in the database This function returns the total records based on our query/search You can use this function to test for any result so that you can display a very neat error message for your visitors if no record is available yet in the table. EXAMPLE

  1.  Usage
  2.  =====
  3.  $mypageclass = new SamPaginator(.......);
  4.  // check if there are records in the table
  5.  if ($mypageclass->getTotalRecords() ==0) { // No records
  6.     ?>
  7.     <!-- Dispaly message -->
  8.      <div> Sorry, There are no Records in this Table yet. </div>
  9.  
  10.     <?php
  11.      }

Info

  • access - public

Method showAllRecords (line 491)

void showAllRecords( )

Function that display the records in a single lines with headings

Function that display the records in a single lines with headings This function displays your records on the page using your supplied parameters.
The 'Type of Record' parameter is very important. This is what tells the function how the display of your records will be handled.

  1.  Usage
  2.  =====
  3.  $mypageclass = new SamPaginator(.......);
  4.  // check if there are records in the table
  5.  if ($mypageclass->getTotalRecords() ==0) { // No records
  6.     ?>
  7.     <!-- Dispaly message -->
  8.      <div> Sorry, There are no Records in this Table yet. </div>
  9.  
  10.     <?php
  11.      }
  12.   else // we have results
  13.     // Display our records
  14.    $mypageclass->showAllRecords();
  15.  
  16.  }

Info

  • access - public

Method showArticles (line 533)

void showArticles( string $titleField, string $contentField, [integer $totalCharaters = ""], [string $linkPageUrl = ""], [string $imageField = ""], [String $imagePathPrefix = ""], [string $cssClass = ""])

Function that display the Artcles/News records in the desired format

Function that display the Artcles/News records in the desired format This function displays your Articles/News records on the page using your supplied parameters.
The parameter is very important. This is what tells the function how the display of your records will be handled.

  1.  Usage
  2.  =====
  3.  $mypageclass = new SamPaginator(.......);
  4.  // check if there are records in the table
  5.  if ($mypageclass->getTotalRecords() ==0) { // No records
  6.     ?>
  7.     <!-- Dispaly message -->
  8.      <div> Sorry, There are no Records in this Table yet. </div>
  9.  
  10.     <?php
  11.      }
  12.   else // we have results
  13.     // Display our records
  14.    $mypageclass->showArticles("articletitle","details",200,"viewarticle.php","","","mycss");
  15.  
  16.  }

Parameters

  • string $titleField: Name of the Title/Topic field of the article/news records in the table
  • string $contentField: Name of the Content/Body field for the News/Article records in the table
  • integer $totalCharaters: Number of characaters to display for the Content/Body field [Optional]. It will display full Article/News if not specified.
  • string $linkPageUrl: URL of the page to link the article/News to [OPTIONAL] (possibly to display full article)
  • string $imageField: Name of the Main Picture/Image field for the News/Article if it has a picture associated with it [OPTIONAL].
  • String $imagePathPrefix: Name of the image path prefix [Folder] if you store the path to your image in the database and you need to prefix the path.
  • string $cssClass: Name of CSS Class defined for the Content/Body of the article/news

Info

  • access - public

Method showPagenumber (line 785)

integer showPagenumber( string $pageurl, [string $sub_method = ""], [string $labelA = ""], [string $labelA_val = ""], [string $labelB = ""], [string $labelB_val = ""], [string $cssClassA = ""], [string $cssClassB = ""])

Function that display the page numbers at the lower part of the page This function will display the page numbers using the style you define in the classes for both the present page and other pages.

Function that display the page numbers at the lower part of the page This function will display the page numbers using the style you define in the classes for both the present page and other pages.

  1.  Usage
  2.  =====
  3.  $mypageclass = new SamPaginator(.......);
  4.  // check if there are records in the table
  5.  if ($mypageclass->getTotalRecords() ==0) { // No records
  6.     ?>
  7.     <!-- Dispaly message -->
  8.      <div> Sorry, There are no Records in this Table yet. </div>
  9.  
  10.     <?php
  11.      }
  12.   else // we have results
  13.     // Display our records
  14.     .........
  15.     // display page numbers
  16.    $mypageclass->showPagenumber("photogallery.php","","cid","","p_navb","p_nava");
  17.   }

Parameters

  • string $pageurl: Url of the present page using this class
  • string $sub_method: Method to use for submission of page POST or GET [OPTIONAL] Default is GET
  • string $labelA: Label for the firstfield value you use in loading this page [OPTIONAL]
  • string $labelA_val: Value of the Label for the firstfield value you use in loading this page [OPTIONAL]
  • string $labelB: Label for the secondfield value you use in loading this page [OPTIONAL]
  • string $labelB_val: Value of the Label for the secondfield value you use in loading this page [OPTIONAL]
  • string $cssClassA: css_class name for the display of present page number [OPTIONAL]
  • string $cssClassB: css_class name for the display of other page numbers [OPTIONAL]

Info

  • access - public

Method showPhotoGallery (line 687)

void showPhotoGallery( string $imageField, string $imageTitleField, [string $linkPageUrl = ""], [String $imagePathPrefix = ""], [string $cssID = ""])

Function that display the Picture Gallery records in the desired format

Function that display the Picture Gallery records in the desired format This function displays your Photo Gallery records on the page using your supplied parameters.
The parameter is very important. This is what tells the function how the display of your records will be handled.

  1.  Usage
  2.  =====
  3.  $mypageclass = new SamPaginator(.......);
  4.  // check if there are records in the table
  5.  if ($mypageclass->getTotalRecords() ==0) { // No records
  6.     ?>
  7.     <!-- Dispaly message -->
  8.      <div> Sorry, There are no Records in this Table yet. </div>
  9.  
  10.     <?php
  11.      }
  12.   else // we have results
  13.     // Display our records
  14.    $mypageclass->ShowPhotoGallery("picaddress","imagetitle","showimage.php","photos","mycssid");
  15.  
  16.  }

Parameters

  • string $imageField: Name of the image/picture field in the table
  • string $imageTitleField: Name of the Image title/description field in the table
  • string $linkPageUrl: URL of the page to link the picture/image to [OPTIONAL] (possibly to display bigger picture with more details or dscription)
  • String $imagePathPrefix: Name of the image path prefix [Folder] if you store the path to your image in the database and you need to prefix the path.
  • string $cssID: Name of CSS ID defined for the display of the Image Title/description

Info

  • access - public

Method showTitle (line 949)

void showTitle( [string $r_title = ""], [string $css_id = ""])

Function that display the title or header section for the records on each page This function can be used to display the title or header section of the display It takes the title of the record and the css id defined for the display as parameters

Function that display the title or header section for the records on each page This function can be used to display the title or header section of the display It takes the title of the record and the css id defined for the display as parameters

  1.  Usage
  2.  =====
  3.  $mypageclass = new SamPaginator(.......);
  4.  // check if there are records in the table
  5.  if ($mypageclass->getTotalRecords() ==0) { // No records
  6.     ?>
  7.     <!-- Dispaly message -->
  8.      <div> Sorry, There are no Records in this Table yet. </div>
  9.  
  10.     <?php
  11.      }
  12.   else // we have results
  13.     // You can define the name of the your rcord or get it from database
  14.     $recordtitle "Business Club";
  15.        // Displat Record header/Title
  16.    $mypageclass->showTitle($recordtitle,"s_result")
  17.     // Display our records
  18.     .........
  19.     // display page numbers
  20.     ..........
  21.   }

Parameters

  • string $r_title: Title of the Record we are displaying [OPTIONAL]
  • string $css_id: CSS ID for the display of the title [OPTIONAL]

Info

  • access - public

Inherited Variables

Inherited Class Variable Summary

Inherited Methods

Inherited Method Summary


Documentation generated on Thu, 08 May 2008 13:36:59 +0200 by phpDocumentor 1.4.0a2