HTML_QuickForm_Wizard
[ class tree: HTML_QuickForm_Wizard ] [ index: HTML_QuickForm_Wizard ] [ all elements ]

Source for file skip.php

Documentation is available at skip.php

  1. <?php
  2. /* vim: set number autoindent tabstop=2 shiftwidth=2 softtabstop=2: */
  3.  
  4. /**
  5. * Skip action
  6. *
  7. * PHP versions 4 and 5
  8. *
  9. * LICENSE: This source file is subject to version 3.0 of the PHP license
  10. * that is available through the world-wide-web at the following URI:
  11. * http://www.php.net/license/3_0.txt. If you did not receive a copy of
  12. * the PHP License and are unable to obtain it through the web, please
  13. * send a note to license@php.net so we can mail you a copy immediately.
  14. *
  15. * @category HTML
  16. * @package HTML_QuickForm_Wizard
  17. * @author Fabio Ambrosanio <fabio@ambrosanio.com>
  18. * @license http://www.php.net/license/3_01.txt PHP
  19. * @version @package_version@
  20. *
  21. * $Id: skip.php,v 1.2 2007/03/14 16:41:38 fabamb Exp $
  22. */
  23.  
  24. require_once 'HTML/QuickForm/Action/Next.php';
  25.  
  26. /**
  27. * This class implements "skip" action that is to jump to next page without save form's data
  28. *
  29. */
  30. class HTML_QuickForm_Wizard_skip extends HTML_QuickForm_Action_Next
  31. {
  32. function perform(&$page, $actionName)
  33. {
  34. // save the form values and validation status to the session
  35. $page->isFormBuilt() or $page->buildForm();
  36. $pageName = $page->getAttribute('id');
  37. $data =& $page->controller->container();
  38. $data['valid'][$pageName] = true;
  39.  
  40. // get next page from wizard
  41. $nextName = $page->controller->getNextName($pageName);
  42.  
  43. // remove this page from stack
  44. $page->controller->getBackName($pageName);
  45.  
  46. // sets valid all pages between actual and next one
  47. $keys = $page->controller->getPageNames();
  48. $start = array_search($pageName, $keys);
  49. $stop = array_search($nextName, $keys);
  50. for($i = $start+1; $i < $stop; $i++) {
  51. $key = $keys[$i];
  52. if (!is_array($data['values'][$keys[$i]])) {
  53. $data['values'][$keys[$i]] = array();
  54. }
  55. $data['valid'][$key] = true;
  56. }
  57.  
  58. // jumps to the next page
  59. $next =& $page->controller->getPage($nextName);
  60. return $next->handle('jump');
  61. }
  62. }
  63. ?>

Documentation generated on Thu, 19 Apr 2007 08:13:26 +0200 by phpDocumentor 1.3.0RC3