function MultiFormReturn($i_return_to) { global $iFormIndex; global $SessionAccessor; if (!IsSetSession("FormList") || !IsSetSession("FormIndex") || $i_return_to < 0 || $i_return_to > GetSession("FormIndex")) { Error("cannot_return", GetMessage(MSG_CANNOT_RETURN, array("TO" => $i_return_to, "TOPINDEX" => IsSetSession("FormIndex") ? GetSession("FormIndex") : "<undefined>")), false, false); } $a_list = GetSession("FormList"); assert($i_return_to < count($a_list)); $a_form_def = $a_list[$i_return_to]; SetSession("FormList", $a_list = array_slice($a_list, 0, $i_return_to + 1)); SetSession("FormIndex", $iFormIndex = $i_return_to); if (isset($a_form_def["FORM"])) { // // get the values that were originally submitted to this form // list(, , $a_values, , ) = GetMultiValues($a_list, $i_return_to); // // get the session values // $SessionAccessor->CopyIn($a_values, true); $a_lines = array(); // // process the page as a template // if (ProcessMultiFormTemplate($a_form_def["FORM"], $a_values, $a_lines)) { $n_lines = count($a_lines); $s_buf = ""; for ($ii = 0; $ii < $n_lines; $ii++) { $s_buf .= $a_lines[$ii] . "\n"; unset($a_lines[$ii]); // free memory (hopefully) } unset($a_lines); // free memory (hopefully) // // put in the values that the user previously submitted // to this form // echo SetPreviousValues($s_buf, $a_form_def["RAWDATA"]); } else { Error("multi_form_failed", GetMessage(MSG_MULTIFORM_FAILED, array("NAME" => $s_template)), false, false); } } else { // // we probably should include // $SessionAccessor->CopyIn(...,true); // at some stage in the future to get the session values....need to think about this // and run some case studies. // ProcessReturnToForm($a_form_def["URL"], $a_form_def["RAWDATA"], array("multi_start")); } //echo "Returned to $i_return_to"; }
function MultiFormReturn($i_return_to) { global $aSessionVars; global $iFormIndex; if (!isset($aSessionVars["FormList"]) || !isset($aSessionVars["FormIndex"]) || $i_return_to < 0 || $i_return_to > $aSessionVars["FormIndex"]) { Error("cannot_return", GetMessage(MSG_CANNOT_RETURN, array("TO" => $i_return_to, "TOPINDEX" => isset($aSessionVars["FormIndex"]) ? $aSessionVars["FormIndex"] : "<undefined>")), false, false); } assert($i_return_to < count($aSessionVars["FormList"])); $a_form_def = $aSessionVars["FormList"][$i_return_to]; $aSessionVars["FormList"] = array_slice($aSessionVars["FormList"], 0, $i_return_to + 1); $aSessionVars["FormIndex"] = $iFormIndex = $i_return_to; if (isset($a_form_def["FORM"])) { list(, , $a_values, , ) = GetMultiValues($aSessionVars["FormList"], $i_return_to); $a_lines = array(); if (ProcessMultiFormTemplate($a_form_def["FORM"], $a_values, $a_lines)) { $n_lines = count($a_lines); $s_buf = ""; for ($ii = 0; $ii < $n_lines; $ii++) { $s_buf .= $a_lines[$ii] . "\n"; unset($a_lines[$ii]); // free memory (hopefully) } unset($a_lines); // free memory (hopefully) // // put in the values that the user previously submitted // to this form // echo SetPreviousValues($s_buf, $a_form_def["RAWDATA"]); } else { Error("multi_form_failed", GetMessage(MSG_MULTIFORM_FAILED, array("NAME" => $s_template)), false, false); } } else { ProcessReturnToForm($a_form_def["URL"], $a_form_def["RAWDATA"]); } // // no return form this functon // //echo "Returned to $i_return_to"; }