He's intercepting and redirecting the go back button.
If the back button is clicked on from the grandchild it goes to the grandparent (my problem exactly) , but he tests the referrer in the first level (tl survey) - and if the referer is third level (tl_survey question) he kicks it to the second level (tl_survey_page) using $this->redirect.
The code is at the bottom of dca/tl_survey.php
Code:
class tl_survey extends Backend
{
/**
* Load database object
*/
protected function __construct()
{
parent::__construct();
// somehow dirty patch to allow going back if someone clicks back on a survey question list
if (strpos($this->getReferer(ENCODE_AMPERSANDS), 'tl_survey_question'))
{
if (preg_match("/id=(\\d+)/", $this->getReferer(ENCODE_AMPERSANDS), $matches))
{
$page_id = $matches[1];
$survey_id = $this->Database->prepare("SELECT pid FROM tl_survey_page WHERE id=?")
->execute($page_id)
->fetchEach('pid');
if ($survey_id[0] > 0)
{
$this->redirect($this->addToUrl('table=tl_survey_page&id=' . $survey_id[0]));
}
}
}
}
I could create a new goback button that went to the right place, but couldn't get rid of the old one.... whereas Helmut just tests the old one when it lands and redirects it. Clever clever.
Thank you Georg. Thankyou Thyon. Thank you Helmut. Thats my solution.
Bookmarks