From 64a8006973ac63a210f08f4d8ea8708696fa453e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 21 Jan 2015 13:56:53 +0100 Subject: [PATCH] Add Wizard::isComplete() Wizard::isFinished() is not applicable in case a wizard is a child of another wizard. Wizard::isComplete() fulfills the need to check whether a user went through a wizard entirely. refs #8191 --- library/Icinga/Web/Wizard.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/library/Icinga/Web/Wizard.php b/library/Icinga/Web/Wizard.php index 6fbfda533..8e822abc9 100644 --- a/library/Icinga/Web/Wizard.php +++ b/library/Icinga/Web/Wizard.php @@ -487,6 +487,19 @@ class Wizard return $page->getName() === end($pages)->getName(); } + /** + * Return whether all of this wizard's pages were visited by the user + * + * The base implementation just verifies that the very last page has page data available. + * + * @return bool + */ + public function isComplete() + { + $pages = $this->getPages(); + return $this->hasPageData($pages[count($pages) - 1]->getName()); + } + /** * Set whether this wizard has been completed *