http://www.fsf.org/ or write * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * */ /* FORM CLASS */ /** * With the FORM class you can be able to retrieve form fields and form data sent from another page * even in GET and POST HTTP method. Form fields can be returned as an array list with parameters name * and value. You can also return all form fields returned from the previous page, annidate form modules * to a single page to get different page levels with a single template.

* Class instance: $cms->debug * @author dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net> */ class cmsdam_forms { /** * You should not use this variable from your section. * @access private */ var $conf; /** * You should not use this variable from your section. * @access private */ var $xmlstr; var $leveltree; function cmsdam_forms() { // Initialize forms /* // - Example $this->xmlstr = "\n"; $this->xmlstr .= "\n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= " \n"; $this->xmlstr .= "\n"; */ $this->xmlstr = "\n"; $this->xmlstr .= "\n"; $this->xmlstr .= "\n"; $this->leveltree = new SimpleXMLElement($this->xmlstr); } /** * This api method can be used to return an array list with all the form fields valorized * from the previous page * * @return array Array with all valorized form fields * @author dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net> */ function getparamlist() { return array_keys($_REQUEST); } /** * Add a page level for the given section. If parent is not given, element is added to the root element * * @param str Level name to add for this section * @param str Append the level to this node, if given * @return bool True if the level was added to the stack, False on errors */ function addformlevel($name, $parent="") { if ($name != "") { // Check node availability // Search all nodes that have attribute with name "name" and value "name" $levelobj = $this->leveltree->xpath('/cmsdam_form_levels/cmsdam_form_level[@name=\'' . $name . '\']'); $levelname = (string)$levelobj[0]['name']; if ($levelname == $name) { // Level node already found return false; } } if ($parent != "") { // Check parent availability // Search all nodes that have attribute with name "name" and value "parent" $parentobj = $this->leveltree->xpath('/cmsdam_form_levels/cmsdam_form_level[@name=\'' . $parent . '\']'); $parentname = (string)$parentobj[0]['name']; if ($parentname == $parent) { // Parent node was found $level = $this->leveltree->addChild('cmsdam_form_level'); $level->addAttribute("name", $name); $level->addAttribute("parent", $parent); } else { // Parent node was not found return false; } } else { // Parent was not given, add this level to ROOT node $level = $this->leveltree->addChild('cmsdam_form_level'); $level->addAttribute("name", $name); } //echo $this->leveltree->asXML(); return true; } /** * Add a form element for the given element. * * @param str Level name * @param str Add the form element * @return bool True if the level was added to the stack, False on errors */ function addformelement($levelname, $name) { //TODO: Write this stuff } } ?>