', 'tfoot', 'right', 1);
$print->table_end();
}
}
// ###################################################################
/**
* Returns the value of a given descriptor and property by comparing
* the mater set and custom set then returning the right one
*
* @access private
*
* @param string Descriptor
* @param string Property
*
* @return string Value of the given property
*/
function fetch_value($descriptor, $property)
{
if ($this->customdata["$descriptor"]["$property"] == '')
{
return $this->masterdata["$descriptor"]["$property"];
}
else
{
return $this->customdata["$descriptor"]["$property"];
}
}
// ###################################################################
/**
* Generates an array of queries that should be run on your database to
* update CSS changes. All of the queries have sprintf() markers that
* need to be evaluated:
*
* %1$s - Database table
* %2$s - styleid field
* %3$s - descriptor field
* %4$s - property field
* %5$s - value field
* %6%d - Styleid value
*
* @access public
*
* @param array Array of user-inputted information to be transformed into queries
*
* @return array Queries that need to be evaluated then ran
*/
function generate_change_query($data)
{
$queries[0] = '--- RESERVED FOR LATER USE ---';
print_r($data);
$deletes = array();
foreach ($this->descriptors AS $descriptor => $opts)
{
$dolink = $opts['dolink'];
if ($dolink)
{
$loops = array('', ' a:link', ' a:visited', ' a:hover');
}
else
{
$loops = array('');
}
foreach ($loops AS $sel)
{
foreach ($data["$descriptor$sel"] AS $prop => $value)
{
// the given value matches the master -- no change
if ($this->masterdata["$descriptor$sel"]["$prop"] == $value)
{
continue;
}
// the given matches the custom -- no change
else if ($this->customdata["$descriptor$sel"]["$prop"] == $value)
{
continue;
}
// no matching, it's new
else
{
$deletes[] = "%3\$s = '" . $this->escape($descriptor . $sel) . "' AND %4\$s = '" . $this->escape($prop) . "'";
$queries[] = "INSERT INTO %1\$s (%2\$s, %3\$s, %4\$s, %5\$s) VALUES (%6\$d, '" . $this->escape($descriptor . $sel) . "', '" . $this->escape($prop) . "', '" . $this->escape($value) . "')";
}
}
}
}
$queries[0] = "DELETE FROM %1\$s WHERE styleid = %6\$d AND ((" . implode(') OR (', $deletes) . "))";
return $queries;
}
// ###################################################################
/**
* Wrapper for $this->registry->modules[ISSO_DB_LAYER]->escape_string()
*
* @access private
*
* @param string Unprotected string
*
* @return string Sanitized string
*/
function escape($string)
{
return $this->registry->modules[ISSO_DB_LAYER]->escape_string($string);
}
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>