itopwizardwebpage.class.inc.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. // Copyright (C) 2010-2012 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. /**
  19. * Class iTopWizardWebPage
  20. *
  21. * @copyright Copyright (C) 2010-2012 Combodo SARL
  22. * @license http://opensource.org/licenses/AGPL-3.0
  23. */
  24. require_once('itopwebpage.class.inc.php');
  25. /**
  26. * Web page to display a wizard in the iTop framework
  27. */
  28. class iTopWizardWebPage extends iTopWebPage
  29. {
  30. var $m_iCurrentStep;
  31. var $m_aSteps;
  32. public function __construct($sTitle, $currentOrganization, $iCurrentStep, $aSteps)
  33. {
  34. parent::__construct($sTitle." - step $iCurrentStep of ".count($aSteps)." - ".$aSteps[$iCurrentStep - 1], $currentOrganization);
  35. $this->m_iCurrentStep = $iCurrentStep;
  36. $this->m_aSteps = $aSteps;
  37. }
  38. public function output()
  39. {
  40. $aSteps = array();
  41. $iIndex = 0;
  42. foreach($this->m_aSteps as $sStepTitle)
  43. {
  44. $iIndex++;
  45. $sStyle = ($iIndex == $this->m_iCurrentStep) ? 'wizActiveStep' : 'wizStep';
  46. $aSteps[] = "<div class=\"$sStyle\"><span>$sStepTitle</span></div>";
  47. }
  48. $sWizardHeader = "<div class=\"wizHeader\"><h1>".htmlentities($this->s_title, ENT_QUOTES, 'UTF-8')."</h1>\n".implode("<div class=\"wizSeparator\"><img align=\"bottom\" src=\"../images/wizArrow.gif\"></div>", $aSteps)."<br style=\"clear:both;\"/></div>\n";
  49. $this->s_content = "$sWizardHeader<div class=\"wizContainer\">".$this->s_content."</div>";
  50. parent::output();
  51. }
  52. }
  53. ?>