1. <?php
  2. /**
  3. * Creates the page for displaying errors/warnings on trying to generate new package.
  4. *
  5. * Errors and/or warning are issues only from package generation
  6. *
  7. * @category   PEAR
  8. * @package    PEAR_PackageFileManager_Frontend_Web
  9. * @author     Laurent Laville <pear@laurent-laville.org>
  10. * @copyright  2005-2006 Laurent Laville
  11. * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
  12. * @since      File available since Release 0.1.0
  13. */
  14.  
  15. /**
  16. * Creates the page for displaying errors/warnings on trying to generate new package.
  17. *
  18. * @category   PEAR
  19. * @package    PEAR_PackageFileManager_Frontend_Web
  20. * @author     Laurent Laville <pear@laurent-laville.org>
  21. * @copyright  2005-2006 Laurent Laville
  22. * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
  23. * @since      Class available since Release 0.1.0
  24. */
  25. class ErrorsPage extends TabbedPage
  26. {
  27.     /**
  28.      * Builds the current form-page.
  29.      *
  30.      * @since  0.1.0
  31.      * @access public
  32.      */
  33.     function buildForm()
  34.     {
  35.         $this->buildTabs();
  36.         // tab caption
  37.         $this->addElement('header', null, 'Error and Warning messages');
  38.  
  39.         // Get all warnings and errors.
  40.         if (PEAR_PackageFileManager_Frontend::hasErrors() ) {
  41.             $warn = PEAR_PackageFileManager_Frontend::getErrors(true);
  42.             $messages = '<ol>';
  43.             foreach($warn as $warning) {
  44.                 $messages .= '<li>' . $warning['message'] . '</li>';
  45.             }
  46.             $messages .= '</ol>';
  47.         } else {
  48.             $messages = 'Stack Empty';
  49.         }
  50.  
  51.         // We need a simple static html area for ordering messages list.
  52.         $div = '<div class="autoscroll">' . $messages . '</div>';
  53.         $this->addElement('static', 'errors', '', $div);
  54.  
  55.         // Buttons of the wizard to do the job
  56.         $this->buildButtons(array('reset','commit'));
  57.     }
  58. }
  59. ?>