}
}
+ /**
+ * Sets an array of data into the API, ignoring things in $exclude. Keys
+ * in the array that don't exist in the API will be ignored.
+ *
+ * @param array A dictionary of field names and values to set
+ * @param array Array of keys to exclude
+ */
+ public function setArray(Array $data, $exclude = array())
+ {
+ foreach ($data as $key => $value)
+ {
+ if (in_array($key, $exclude) || !isset($this->fields[$key]))
+ {
+ continue;
+ }
+ $this->set($key, $value);
+ }
+ }
+
/**
* Sets a value, sanitizes it, and validates it
*
3.1.0
===================
- Change: BSPrinterElementTable:__construct() can now take straight strings and convert them into BSPrinterElementLabel's
-- Change: Removed the text indent on .input elements in BSPrinter
\ No newline at end of file
+- Change: Removed the text indent on .input elements in BSPrinter
+- New: BSPrinterRootPage::setHeaderCode() allows injecting in between the <head> tag of the root page element (creates BSPrinterRootPage::$headerCode)
+- New: BSPrinterAbstract::setId() allows all elements to have an id attribute added in _prepareStyle()
+- New: Added an ability to quick-set API information via an array with BSApi::setArray()
*/
protected $cssClass = ':swap:';
+ /**
+ * DOM ID of the element
+ * @var string
+ */
+ protected $id;
+
/**
* Fluent object instantiation
*/
return $this;
}
+ /**
+ * Sets the DOM/CSS ID of the element
+ *
+ * @param string The ID
+ */
+ public function setId($id)
+ {
+ $this->id = $id;
+ return $this;
+ }
+
/**
* Returns a string of CSS style attributes
*
*/
protected function _prepareStyle()
{
- if (empty($this->style) && empty($this->cssClass))
+ if (empty($this->style) && empty($this->cssClass) && empty($this->id))
{
return;
}
{
$string .= ' style="' . $style . '"';
}
+ if ($this->id)
+ {
+ $string .= ' id="' . $this->id . '"';
+ }
return $string;
}
*/
private $navigator;
+ /**
+ * The header code for the page
+ * @var string
+ */
+ private $headerCode;
+
/**
* Constructor
*
return $this->navigatior;
}
+ /**
+ * Sets the code to inject into the <head> element of the page
+ *
+ * @param string Code
+ */
+ public function setHeaderCode($code)
+ {
+ $this->headerCode = $code;
+ }
+
/**
* Creates a redirect to another page; constructs the header and footer
* (therefore execution stops)
echo "\n\t<title>" . BSPrinter::get_realm() . " - " . $this->title . "</title>";
echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $language['charset'] . "\" />";
echo "\n\t<link rel=\"stylesheet\" href=\"" . BSPrinter::get_stylesheet() . "\" />";
+ echo "\n" . $this->headerCode;
echo "\n</head>\n<body>\n";
if ($this->navigator && (!defined('ISSO_PRINTER_NO_NAVIGATION') || !constant('ISSO_PRINTER_NO_NAVIGATION')))