I am basically having a problem whereby a class method is scrambling the value of its parameters it receives from another class method, and I can't figure this one out to save my life!
Here is the first class:
/**
* Specifically generated ErrorDisplayHandler for IVC
*
* @author Phil Powell
* @version 1.0.0
* @package IMAGE_CATALOG
*/
class IVCErrorDisplayHandler extends ErrorDisplayHandler {
/**
* ID
*
* @access private
* @var int $id
*/
var $id;
/**
* Error Array
*
* @access private
* @var array $errorArray (default array())
*/
var $errorArray = array();
/**
* LinkView object
*
* @access private
* @var object $linkView
* @see LinkView
*/
var $linkView;
/**
* Constructor. Call "super()" to populate parent constructor with $errorArray parameter
*
* *NOTE* In future PHP versions (5+) the $linkView object property can be replaced by implementing LinkView onto this class
*
* @access public
* @param int $id
* @param array $errorArray (optional)
*/
function IVCErrorDisplayHandler($id, $errorArray = '') { // CONSTRUCTOR
parent::ErrorDisplayHandler($errorArray); // "super()"
$this->id = $id;
if (@sizeof($errorArray) > 0) $this->errorArray = $errorArray;
$this->linkView =& new LinkView();
}
/**
* Display "reset fields HTML" around class wrapper
*
* @access public
* @param mixed $resetFieldsSectionMsg (optional)
* @param mixed $resetFieldsActionMsg (optional)
* @return mixed HTML
*/
function &displayResetFieldsHTML($resetFieldsSectionMsg = '', $resetFieldsActionMsg = '') {
global $section, $action;
print_r("$resetFieldsSectionMsg = '', $resetFieldsActionMsg = ''<P>");
// NEW 8/17/2004: DISPLAY "Reset All Fields" LINK IF MISTAKES WERE MADE
if (@sizeof($this->errorArray) > 0 || preg_grep('/^assoc_/i', @array_keys($_POST))) {
$html .= "\n <tr>\n <td colspan=\"3\" bgcolor=\"#eeeedd\"><b>" .
$this->linkView->displayResetFieldsNavQS($section, $action, $this->id, '', $resetFieldsSectionMsg, $resetFieldsActionMsg) .
"</b></td>\n </tr>\n";
}
return $html;
}
}
Here is part of the LinkView class:
class LinkView extends View {
function LinkView() {}
/**
* Display a "reset all fields" link
*
* @access public
* @param mixed $section
* @param mixed $action
* @param mixed $id
* @param mixed $sectionDisplayName (optional)
* @param mixed $actionDisplayName (optional)
* @return mixed HTML
*/
function &displayResetFieldsNavQS($section, $action, $id, $sectionDisplayName = '', $actionDisplayName = '') { // STATIC HTML STRING METHOD
global $section, $action;
print_r("<P>$section, $action, $id, $sectionDisplayName = '', $actionDisplayName = ''<P>");
print_r(" $sectionDisplayName = '', $actionDisplayName = ''");
$html = "<a href=\"index.php?section=$section&action=$action&id=" . urlencode($id) . "&chooseAlbum=1&album=" .
urlencode($_REQUEST['album']) . "\">Reset all fields for ";
$html .= ($sectionDisplayName) ? "$sectionDisplayName " : "$section ";
$html .= ($actionDisplayName) ? "$actionDisplayName " : "$action ";
return $html . '</a>';
}
}
image, edit, 40, = '', image = ''
= '', image = ''
Literally put, the parameters "$sectionDisplayName" and "$actionDisplayName" swap values somehow and there is no logical explanation why. This is PHP 4.3.2
Thanx
Phil