Further compacting of code for future split up.
This commit is contained in:
parent
fbb0753c11
commit
6b07cf03fe
47
index.php
47
index.php
@ -121,35 +121,26 @@ if (!$tpl_done && isset($_SESSION['access_token']) && $_SESSION['access_token'])
|
|||||||
echo 'Mail sending failed!!';
|
echo 'Mail sending failed!!';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'event':
|
|
||||||
$ho->setTemplate('event_html');
|
|
||||||
$tpl_done = true;
|
|
||||||
break;
|
|
||||||
case 'flight':
|
|
||||||
$ho->setTemplate('flight_html');
|
|
||||||
$tpl_done = true;
|
|
||||||
$action = 'flight';
|
|
||||||
require 'prep_form.php';
|
|
||||||
break;
|
|
||||||
case 'hotel':
|
|
||||||
$ho->setTemplate('hotel_html');
|
|
||||||
$tpl_done = true;
|
|
||||||
$action = 'hotel';
|
|
||||||
require 'prep_form.php';
|
|
||||||
break;
|
|
||||||
case 'restaurant':
|
|
||||||
$ho->setTemplate('restaurant_html');
|
|
||||||
$tpl_done = true;
|
|
||||||
$action = 'restaurant';
|
|
||||||
require 'prep_form.php';
|
|
||||||
break;
|
|
||||||
case 'rentalcar':
|
|
||||||
$ho->setTemplate('rentalcar_html');
|
|
||||||
$tpl_done = true;
|
|
||||||
$action = 'rentalcar';
|
|
||||||
require 'prep_form.php';
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
|
if (in_array($action, array('event', 'flight', 'hotel', 'restaurant', 'rentalcar'))) {
|
||||||
|
$ho->setTemplate($action . '_html');
|
||||||
|
$tpl_done = true;
|
||||||
|
$skey = 'form_' . $action;
|
||||||
|
|
||||||
|
$placeholders = array(
|
||||||
|
'USER_NAME' => $data['user']['name_first'] . ' ' . $data['user']['name_last'],
|
||||||
|
'USER_EMAIL' => $data['user']['email'],
|
||||||
|
);
|
||||||
|
$fd = new FieldDefinition($action);
|
||||||
|
$fd->setPlaceholders($placeholders);
|
||||||
|
$fd->setFieldValues($_SESSION[$skey]);
|
||||||
|
|
||||||
|
$by_group = $fd->getGroups();
|
||||||
|
|
||||||
|
// Convert hash to list for Mustache compatibility
|
||||||
|
$by_group = array_values($by_group);
|
||||||
|
$data['form_data'] = $by_group;
|
||||||
|
}
|
||||||
if (!$tpl_done) {
|
if (!$tpl_done) {
|
||||||
$ho->setTemplate('loggedin_html');
|
$ho->setTemplate('loggedin_html');
|
||||||
$tpl_done = true;
|
$tpl_done = true;
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use \Frs\FieldDefinition;
|
|
||||||
|
|
||||||
// FOR TESTING:
|
|
||||||
if (!isset($action)) {
|
|
||||||
$action = 'hotel';
|
|
||||||
$debug = true;
|
|
||||||
}
|
|
||||||
$skey = 'form_' . $action;
|
|
||||||
|
|
||||||
$fd = new FieldDefinition($action);
|
|
||||||
|
|
||||||
$placeholders = array(
|
|
||||||
'USER_NAME' => $data['user']['name_first'] . ' ' . $data['user']['name_last'],
|
|
||||||
'USER_EMAIL' => $data['user']['email'],
|
|
||||||
);
|
|
||||||
$fd->setPlaceholders($placeholders);
|
|
||||||
$fd->setFieldValues($_SESSION[$skey]);
|
|
||||||
|
|
||||||
$by_group = $fd->getGroups();
|
|
||||||
|
|
||||||
// Convert hash to list for Mustache compatibility
|
|
||||||
$by_group = array_values($by_group);
|
|
||||||
|
|
||||||
if ($debug) {
|
|
||||||
print_r($by_group);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['form_data'] = $by_group;
|
|
Reference in New Issue
Block a user