public function do_unskip() { $answers = $this->_applicant->findAnswersByPage($this->_applicationPage->getPage()); if (count($answers) and $answers[0]->getPageStatus() == self::SKIPPED) { $this->_applicant->getAnswers()->removeElement($answers[0]); $this->_controller->getEntityManager()->remove($answers[0]); } }
/** * Create a temporary application page * @return \Jazzee\Entity\ApplicationPage */ public function getFakeApplicationPage() { if ($this->_fakeApplicationPage == null) { $this->_fakeApplicationPage = new ApplicationPage(); $this->_fakeApplicationPage->setPage($this); } return $this->_fakeApplicationPage; }
/** * By default list the elements on a page * * @return array */ public function listDisplayElements() { $elements = array(); $weight = 0; foreach ($this->_applicationPage->getPage()->getElements() as $element) { $elements[] = new \Jazzee\Display\Element('element', $element->getTitle(), $weight++, $element->getId(), $element->getPage()->getId()); } $elements[] = new \Jazzee\Display\Element('page', $this->_applicationPage->getTitle() . ' Attacment', $weight++, 'attachment', $this->_applicationPage->getPage()->getId()); $elements[] = new \Jazzee\Display\Element('page', $this->_applicationPage->getTitle() . ' Public Answer Status', $weight++, 'publicAnswerStatus', $this->_applicationPage->getPage()->getId()); $elements[] = new \Jazzee\Display\Element('page', $this->_applicationPage->getTitle() . ' Private Answer Status', $weight++, 'privateAnswerStatus', $this->_applicationPage->getPage()->getId()); return $elements; }
/** * Compare this page to another page and list the differences * * @param \Jazzee\Entity\ApplicationPage $applicationPage */ public function compareWith(\Jazzee\Entity\ApplicationPage $applicationPage) { $differences = array('different' => false, 'title' => $this->_applicationPage->getTitle(), 'properties' => array(), 'elements' => array('new' => array(), 'removed' => array(), 'same' => array(), 'changed' => array()), 'children' => array('new' => array(), 'removed' => array(), 'same' => array(), 'changed' => array())); $arr = array('title' => 'Title', 'name' => 'Name', 'instructions' => 'Instructions', 'leadingText' => 'Leading Text', 'trailingText' => 'Trailing Text'); foreach ($arr as $name => $niceName) { $func = 'get' . ucfirst($name); if ($this->_applicationPage->{$func}() != $applicationPage->{$func}()) { $differences['different'] = true; $differences['properties'][] = array('name' => $niceName, 'type' => 'textdiff', 'this' => $this->_applicationPage->{$func}(), 'other' => $applicationPage->{$func}()); } } return $differences; }