Home  PHP Projekte  PHP Schulung  Informationsquellen  Geschichte  Core PHP  Fortgeschrittenes PHP  Templates  Cache-Technologien  OOH Forms  Grundlagen  JavaScript  XML  Layoutmanager  Pages  Form Page  Form Page II  IT Manager Page  Wizards  Fazit  Technik der Site  Büchertipps  Fotografie  Airbrush  Kontakt  Stuff 
|
Pages, die den IT-Manager verwenden
Alle Wizard-Beispiele im CVS basieren auf page-Klassen, die
den IT-Manager verwenden. Nur so lassen sich die
hohen Ansprüche an CI und Usability erfüllen,
die Kunde und Endnutzer haben.
Die Klasse page aus dem Verzeichnis HTML_OOH_Form/examples/wizard/installer/
kann zugleich Seiten verarbeiten, die Formulare enthalten
als auch Seiten, die ausschließlich aus Text (einem Template)
bestehen. Die Klasse bietet einen guten Ausgangspunkt für
eigene Entwicklungen.
| HTML_OOH_Form/examples/wizard/installer/page.php |
Top |
|
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ // | PHP version 4.0 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Ulf Wendel <ulf.wendel@phpdoc.de> | // +----------------------------------------------------------------------+ // // $Id: page.php,v 1.3 2001/10/27 16:32:51 uw Exp $
require_once('HTML_OOH_Form/form.php'); require_once('HTML_OOH_Form/form_page_form.php'); require_once('HTML_OOH_Form/layoutmanager/form_itmanager.php'); require_once('HTML_OOH_Form/form_xmlfactory.php');
/** * Form page that can handle real form pages and plain text pages * * You should study this class if your're going to use the wizard * features. It's a very helpful starting point. * * @author Ulf Wendel <ulf.wendel@phpdoc.de> * @version $Id: page.php,v 1.3 2001/10/27 16:32:51 uw Exp $ * @package HTML_OOH_Form */ class page extends form_page_form {
/** * True if a page is shown the first time, later on false * * Used to suppress error messages in case a page is shown the first time. * * @var boolean */ var $first_call = true; /** * Template file to be used. * * @var string */ var $template = ''; /** * Creates a wizard page containing a plain text page or a itmanaged form * * @param string template file * @param string page name * @param string xml form definition file * @global FORM_FILE_DIR */ function page($template, $name = '', $xml_form = '') { $this->template = $template; $this->name = $name;
if ('' != $xml_form) { $this->form = new form_xmlfactory(FORM_FILE_DIR . $xml_form); // inform the wizard that this page contains a form $this->type = 'form'; } else { // this is not a form page - the wizard has to create it's own // form to be able to add the page switching buttons $this->type = 'template'; }
} // end constructor function get($startfinish = false, $reload = false) { return ('form' != $this->type) ? $this->getTemplatePage($startfinish) : $this->getFormPage($startfinish, $reload); } // end func get
/** * Returns a wizard page consisting of plain text (template) * * @return string * @see get(), getFormPage() * @global FORM_FILE_DIR */ function getTemplatePage() { return implode('', file(FORM_FILE_DIR . $this->template)); } // end func getTemplatePage /** * Returns a wizard page containing a form * * @param boolean print opening and closing form tag? * @param boolean is this a reload? * @return string * @see get(), getTemplatePage() * @global FORM_FILE_DIR */ function getFormPage($startfinish = false, $reload = false) {
if ($reload) // reload HTTP_[POST|GET]_VARS $this->form->autoloadValues(); // store validation flags $valres = $this->form->validate(); $valres = $valres[1]; $itx = new itmanager(); $itx->setTemplate($this->template, FORM_FILE_DIR, false);
// opening form tag if ($startfinish) $itx->addContent($this->form->Start(), 'START_FORM'); // dumping the form elements $ellist = $this->form->getElements(); reset($ellist); while (list($k, $name) = each($ellist)) { $itx->addContent($this->form->getElement($name), $name); $itx->addContent($this->form->getLabel($name), 'LABEL_' . $name); } if ($this->first_call) { // don't show error message the first time a page is presented $this->first_call = false; } else {
// show error messages reset($valres); while (list($name, $msg) = each($valres)) $itx->addContent($msg, 'ERROR_' . $name);
}
// closing form tag if ($startfinish) $itx->addContent($this->form->Finish(), 'END_FORM'); return $itx->get(); } // end func getFormPage
function isValid() { // template pages are always valid return ('form' != $this->type) ? true : parent::isValid(); } // end func isValid function getValues() { // template pages do not contain any values return ('form' != $this->type) ? array() : parent::getValues(); } // end func getValues } // end class page ?>
|
< ^ >
|