[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/controller/ -> responsemodel.inc.php (source)

   1  <?php
   2  //--------------------------------------------------------------------------------
   3  // Copyright 2003 Procata, Inc.
   4  // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
   5  //--------------------------------------------------------------------------------
   6  /**
   7  * @package WACT_CONTROLLERS
   8  * @version $Id: responsemodel.inc.php,v 1.2 2004/11/14 15:49:51 jeffmoore Exp $
   9  */
  10  // EXPERIMENTAL
  11  
  12  require_once WACT_ROOT . 'util/dataspace.inc.php';
  13  
  14  /**
  15  * @access public
  16  * @package WACT_CONTROLLERS
  17  */
  18  class ResponseModel extends DataSpace {
  19  
  20      var $isValid = TRUE;
  21      var $errorList = NULL;
  22      
  23      function ensureErrorList() {
  24          if (!is_object($this->errorList)) {
  25              require_once WACT_ROOT . 'validation/errorlist.inc.php';
  26              $this->errorList =& new ErrorList();
  27          }
  28      }
  29  
  30      function addError($group, $id, $fieldList = NULL, $values = NULL) {
  31          $this->ensureErrorList();
  32          $this->errorList->addError($group, $id, $fieldList, $values);
  33          $this->isValid = FALSE;
  34      }
  35  
  36      function addErrorMessage($message, $fieldList = NULL) {
  37          $this->ensureErrorList();
  38          $this->errorList->addErrorMessage($message, $fieldList);
  39          $this->isValid = FALSE;
  40      }
  41      
  42      function isValid() {
  43          return $this->isValid;
  44      }
  45      
  46      function &getErrorList() {
  47          return $this->errorList;
  48      }
  49      
  50      function applyRule(&$rule) {
  51          $result = $rule->validate($this, $this);
  52          $this->isValid = $this->isValid && $result;
  53          return $result;
  54      }
  55          
  56  }
  57  
  58  ?>


Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5