Documentation for PageContent and PageContentAdmin

/***************************************************************************
//"pagecontent.php"
/***************************************************************************

PageContent is a child of universalcontent.  The class provides content and 
menu from a MySQL table.  The function works by creating duplicates of a model
PHP web page.  When a visitor's browser loads the page, the class can be used
to determine what content and what menu should be returned.

/***************************************************************************
//Class Variables
/***************************************************************************
	$pagenameprefix: Prefix for the HTML <title>
	$forcedID:  If a site needs to include a visitor ID in the URL's of the 
		pages, such a ID number is stored here.  It is false if there is no
		such ID.  Primarily provided for forward compatibility with child
		classes.

/***************************************************************************	
//Class Functions
/***************************************************************************
function pagecontent ($paramtitleprefix = '', $paramtablename = 'pages', $forcedID = false)
	
	Class constructor Overload. 
	
	$paramtitleprefix:  Text to be appended to the HTML title of any given page 
		in the site.
	$paramtablename: MySQL table name.
	$forcedID: If other than false, will be appended to URLs as PC_VISITOR_ID 
		(default: 'visitorid').
	
	
function LoadPageFromFileName ()

	Loads content of page by determining what the page name is from the file 
	name and then constructing a MySQL file query.

	
function GetPageNameFromFileName ()

	Returns the file name of the script being executed.

	
function ReturnTitle ($fulltitle = TRUE, $HTMLSafe = TRUE, $returnalternate = FALSE)
	
	Returns the page title for the HTML <title> tag.
	
	$fulltitle: If true, function appends class variable pagenameprefix 
		to output.
	$HTMLSafe: If true, PHP HTMLEntities is applied to data.
	$returnalternate: If true, returns alternate page name (if such a column 
		also exists).
	

function ReturnSeparatedContent ($startkey, $endkey)

	Returns content of page in an array where each element of the array has
	a value PC_SPECIAL, which indicates if the content was between the start
	and end keys.  Useful for mixing dynamic content with static content.
	
	$startkey: String marking the beginning of special section.
	$endkey: String marking the end of special section.

	
function DisplayMultiLevelMenu ($preitemcode, $postitemcode, $alternatename = false,
	$class='', $itemleader='', $separator=',', $presub = '(', $postsub = ')')
	
	Converts page content into a menu (potentially, multilevel menu).  Menu content
	is normally formatted as follows:
	
		firstitem, seconditem, thirditem (subitemA, subitemB, subitemC), fourthitem
		
	If the visitor has not selected thirditem or one of its subitems, then the subitem
	menu will not be displayed.  You can make submenus as deep as you find practical.
	
	Please note, that items marked with a star can either be strings or numeric arrays. 
	Use of arrays indicates values for more than one level (ie. level 0 for main level 
	items, level 1 for the first level of submenus, etc).  If multiple levels are not 
	specified for a particular item but are specified for other items, the lowest level
	(that is the highest numeric index) will be copied automatically so that all arguments
	are arrays of exactly the same size.  
	
	$preitemcode* : HTML code and text which should appear before the HTML link of a 
		menu item.
	$postitemcode* : HTML code and text which should appear after the HTML link of a 
		menu item.
	$alternatename: Alternate names should be used for menu items.
	$class* : The class of the menu items' links.
	$itemleader* : HTML code and text which should appear before a menu item, but inside
		the link ($preitemcode appears outside the link).
	$separator: The character or string separating menu items.
	$presub:  The character or string indicating the start of a submenu
	$postsub:  The character or string indicating the end of a submenu	

	
function ConvertAllToSameSizeArray ($variablesarray)

	Makes a group of arrays identical in size (repeating the highest value in smaller 
	arrays to fill them in).  
	
	$variablesarray: An array of references to the arrays which will be converted to 
		the same size.
	
	
function CompressArrayToMultiLevel (&$currentpagename, &$compressedarraylocation, &$longarray)

	An intermediate step in DisplayMultiLevelMenu.  Not intended for external use.
	
	
function MakePageHREF ($destinationpage, $arguments=false)
	
	Creates the HREF values for links to any page managed by PageContent.  All child classes 
	should use this function for their links in order to allow ease in changing the format
	or location of the pages generated by the class.
	
	
function CreateMenu (&$compressedarray, &$arrayofpages, &$preitemcode, &$postitemcode, &$class, 
		&$itemleader, $level, $max)
	
	The final step in DisplayMultiLevelMenu.  Not intended for external use.


	
/***************************************************************************
//"pagecontentadmin.php"
/***************************************************************************

PageContentAdmin is a child of prepagecontentadmin (a copy of the functions
in UniversalContentAdmin with PageContent as a parent) which effectively makes
it a class with dual inheritance (from PageContent and UniversalContentAdmin).
Provides basic admin functions for database driven web content.  It is also 
a model for how to extend UniversalContentAdmin for your own usages.

ProcessInput has an important, but hidden function.  If the function is called 
and the $_REQUEST['admin'] variable is set to 'reset', all the pages listed
in the database will have their pages updated with the a (presumably) new 
version of the model page.  This can generally be set by using URL based
variable.

/***************************************************************************
//Class Variables
/***************************************************************************
	$modelpage:  The model PHP page for the site (any new page will be a copy
		of this model page).
	
	
/***************************************************************************	
//Class Functions
/***************************************************************************

function pagecontentadmin ($extrafields = array (''), $paramtablename = 'pages',
	$modelpage = DEFAULTMODELPAGE)

	Constructor.  $extrafields is an array with values set to the various 
	"standard" optional fields that a website might need.  At this time, there
	is only one extra (PC_ALTERNATE_NAME) which is intended to provide a second
	page name and can be accessed by the DisplayMultiLevelMenu function.
	
	$extrafields:  An array of constants representing the optional columns the 
		page table supports.
	
function ProcessInput (&$warning, &$reporttext)

	This is simply an overload function of the UniversalContentAdmin ProcessInput
	function.  The only difference is this version also checks to see if
	there is a variable $_REQUEST['admin'] which is set to 'reset'.  If there is
	it will call ResetRecords.
	
function ResetRecords (&$message)

	Uses message to report progress made.  Will query database, get a list of all
	pages and then copy a fresh copy of the model page (or any page specified by
	$_REQUEST['model'] to the page's location.  
	
	$message: Text message indicating files copied.
	
	
function ProcessMinorSpecialItem ($variablename, $value, &$warning, &$reporttext)

	Overload for parent function ProcessMinorSpecialItem providing special checks
	for variables.  Currently, it verifies that the page id is one that meets
	certain requirements and also it copies the page name into the alternate
	page name if the alternate page name is not specified and the table has
	such a column.  See the UniversalContentAdmin class for details on function
	arguments.
	
		
function ProcessUpdatePostQuery (&$warning, &$reporttext)
	
	Overloads parent function.  Copies the page model into the newly created record's
	page.
	
function ProcessPostDelete ($indexfield, $indexvalue, &$warning, &$reporttext)
	
	Overloads parent function.  Deletes PHP page for record after record has been 
	removed from database.
	

/***************************************************************************
//Depercated Functions
/***************************************************************************
	
function ProcessStandardPage (&$message)

	Depercated function.  Now wrapper for Process Input.
	
	
function DisplayPageSelector ($replypage, $deleteoption = true)

	Deprecated function: now wrapper for CreateSelector
	
	
function DisplayPageEditBoxes ($replypage)

	Depercated function now wrapper for GenerateForm