From 10607f0dc81504037d5f4d6fa4bf094c0a02f33e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 18 Mar 2006 21:16:52 +0000 Subject: [PATCH] - Make sure we don't get query errors when there are no deletes - Wrote generate_css_output() to construct stylesheets --- printer_css.php | 82 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) diff --git a/printer_css.php b/printer_css.php index 1be0983..3c4fa75 100644 --- a/printer_css.php +++ b/printer_css.php @@ -364,8 +364,6 @@ HTML; { $queries[0] = '--- RESERVED FOR LATER USE ---'; - print_r($data); - $deletes = array(); foreach ($this->descriptors AS $descriptor => $opts) @@ -405,7 +403,14 @@ HTML; } } - $queries[0] = "DELETE FROM %1\$s WHERE styleid = %6\$d AND ((" . implode(') OR (', $deletes) . "))"; + if (sizeof($deletes) < 1) + { + $queries[0] = '##'; + } + else + { + $queries[0] = "DELETE FROM %1\$s WHERE styleid = %6\$d AND ((" . implode(') OR (', $deletes) . "))"; + } return $queries; } @@ -424,6 +429,77 @@ HTML; { return $this->registry->modules[ISSO_DB_LAYER]->escape_string($string); } + + // ################################################################### + /** + * Generates a linkable/usable CSS stylehseet content file; this can + * be outputted to the browser + * + * @access public + * + * @return string CSS output + */ + function generate_css_output() + { + $data = 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 ($this->masterdata["$descriptor$sel"] AS $prop => $value) + { + $data["$descriptor$sel"]["$prop"] = $value; + } + if (is_array($this->customdata["$descriptor$sel"])) + { + foreach ($this->customdata["$descriptor$sel"] AS $prop => $value) + { + $data["$descriptor$sel"]["$prop"] = $value; + } + } + } + } + + $output = '/* CSS Style Sheet (generated by ISSO.Printer.CSS $Revision$) */'; + + foreach ($data AS $selector => $props) + { + $output .= "\n\n$selector\n{"; + foreach ($props AS $name => $value) + { + if ($name != 'extra') + { + $output .= "\n\t$name: $value;"; + } + } + + if ($props['extra']) + { + $extra = explode("\n", $this->registry->modules['functions']->convert_line_breaks($props['extra'])); + + foreach ($extra AS $prop) + { + $output .= "\n\t$prop"; + } + } + + $output .= "\n}"; + } + + return $output; + } } /*=====================================================================*\ -- 2.22.5