SourceForge.net LogoPHPGallue
[ class tree: libbase ] [ index: libbase ] [ all elements ]

Class: GALConfig

Source Location: /libbase/config.inc.php

Class Overview

GALSection
   |
   --GALConfig

Used to read and change configuration files.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: GALSection

GALSection::__construct()
Initialize values by reading the section element.
GALSection::addSection()
Adds a new section to this config.
GALSection::addValue()
Adds a new value tho this config.
GALSection::getName()
Returns this section's name.
GALSection::getSections()
List all defined section inside the current section.
GALSection::getValues()
List all defined values inside the current section.
GALSection::merge()
Merges the given GALSection recursively into this section.
GALSection::mountAddSection()
Adds a section from another config.
GALSection::mountReplace()
Replaces the contents of this section with the new section.
GALSection::remove()
Remove the specified value or section.
GALSection::removeFrom()
Deletes the section's tag from the given node.
GALSection::sectionExists()
Test if the specified section exists
GALSection::touchSection()
Adds a section with the given name if a value or section with the given name doesn't exist.
GALSection::touchValue()
Adds a value with the given name and type if a value or section with the given name doesn't exist.
GALSection::umountReplace()
Removes a replacing section.
GALSection::valueExists()
Test if the specified value exists
GALSection::__get()
Magic method to read a value of this section like a property.
GALSection::__set()
Writing sections is not supported.

Class Details

[line 503]
Used to read and change configuration files.

This class reads and writes XML formatted config files using DOM classes. These config files look like this:

  1.  <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  <config>
  3.      <section name="firstSection">
  4.          <value type="string" name="firstValue">foo</value>
  5.          <value type="uint" name="bar">42</value>
  6.      </section>
  7.      <section name="testing">
  8.          <value type="path" name="base">/</value>
  9.          <value type="whatever" name="tmp">no matter why</value>
  10.          <section name="aSubsection">
  11.              <value type="myType" name="someValue">7de5</value>
  12.          </section>
  13.      </section>
  14.      <value type="float" name="pi">3.14159</value>
  15.  </config>

The attribute type is just a hint, but no guarantee that the value matches that type. This might be implemented in later versions for some special types like uint.




Tags:

todo:  Evaluate POST data of formDOM()
example:  example


[ Top ]


Class Variables

$domDocument =

[line 507]



Tags:

var:  The XML document to read.
access:  protected

Type:   DOMDocument


[ Top ]



Class Methods


constructor __construct [line 514]

GALConfig __construct( $domDocument)

Read values from XML document.

If there are multiple sections or values with the same name, an Exception is thrown.




Overrides GALSection::__construct() (Initialize values by reading the section element.)

Parameters:

DOMDocument   $domDocument   The XML document to read.

[ Top ]

method dumpDOM [line 577]

DOMElement dumpDOM( $node)

Return sections and values as formatted HTML using DOM.

Append an unordered list to the given node, then for every section add a list item with the name of the section and a table with the section's values.




Tags:

return:  A HTML representation of the config data.


Parameters:

DOMNode   $node   The node the list is appended to.

[ Top ]

method formDOM [line 533]

DOMElement formDOM( $node)

Build an input form using DOM.

It appends a form element as child element to the given node. Then it adds fieldsets for every section and input fields for every value. The name of an input field is set to "sectionName@valueName". Finally it adds a submit button. The user has to set the form's action and method attributes himself - no problem with DOM, I hope ;).




Tags:

return:  The created form.
deprecated:  Not implemented for mounted subconfigs; creating html forms is not a base librarie's task...


Parameters:

DOMNode   $node   The node the form is appended to.

[ Top ]


Documentation generated on Wed, 16 Aug 2006 15:35:34 +0200 by phpDocumentor 1.3.0RC6