Bruce Gust
asked on
How is this working?
I'm trying to trace the logic of a page that's using Blitz.
The index.php has several functions at the top, but it's the bottom that I'm thinking represents the answer to my questions.
Line 1, you've got an IF statement that's looking for a subDomain and if there's something present, we're moving forward.
Line 7, we instantiate a new Blitz dynamic,
Now, here's my question...
The HTML, at one point, has this:
You're submitting a form "onchange," but there's nothing on the index.php that's seemingly interested in either of the hidden fields, as far as what would trigger dynamic content.
There is, however, a Blitz IF statement asking for the presence of an $empID variable ({{ IF $empID }}).
Looking at the index.php page on line 61, you see this:
if(empty($out['empID'])){
What is $out and is this line what I'm thinking it is, as far as the thing that determines what is viewed on the .tpl page?
The index.php has several functions at the top, but it's the bottom that I'm thinking represents the answer to my questions.
if (!empty($subDomain) && file_exists(REG_ROOT.'templates/'.$subDomain.'.tpl')) {
if($_GET['resetSession']){
resetSession();
}
$T = new Blitz(REG_ROOT.'templates/'.$subDomain.'.tpl');
$_POST['subdomain'] = $subDomain;
$out = array_merge($_GET, $_POST);
if(!empty($_POST['verifyUser'])){
if(verifyUser($_POST)){
$out['usrVerified'] = 1;
unset($_POST['findUser']);
} else {
unset($_POST['verifyUser'],$out['usrID']);
$_POST['findUser'] = 1;
}
}
if(!empty($_POST['findUser'])){
$usrArray = findUser($_POST);
if(is_array($usrArray)){
$out = array_merge($out,$usrArray);
} else {
$out['usrMsg'] = $usrArray;
}
echo $T->parse($out);
return false;
}
if(!empty($_POST['findCoachingSessions']) && is_numeric($out['usrID'])){
$out['event_list'] = findCoachingSessions($out['empID'], $out['usrID'], $subDomain);
if(is_array($out['event_list'])){
foreach($out['event_list'] as &$event){
$event['guid'] = buildGUID(array('empID'=>$out['empID'],'evID'=> $event['evID'],'ruEvent'=>'email-click','ruReferrer'=>'ezor.net','ruVerb'=>'register','ruObj'=>'event','usrID'=>$out['usrID'], 'hID'=>$out['hID']));
}
} else {
$out['usrMsg'] = $usrArray;
}
/*
$out['appt_list'] = findAppointments($out['usrID']);
if(is_array($out['appt_list'])){
if(count($out['appt_list'])>0){
foreach($out['appt_list'] as &$appt){
$appt['guid'] = buildGUID(array('empID'=>$out['empID'],'aID'=> $appt['aID'],'ruEvent'=>'email-click','ruReferrer'=>'ezor.net','ruVerb'=>'register','ruObj'=>'coaching','usrID'=>$out['usrID']));
}
} else {
$out['appt_list'] = 0;
}
} else {
$out['usrMsg'] .= $usrArray;
}
*/
echo $T->parse($out);
return false;
}
$out['event_list'] = findEvents($out['empID']);
$out['survey'] = findSurvey($out['empID']);
if(empty($out['hID'])){
$out['hID'] = $out['survey']['hID'];
}
if(is_array($out['event_list']) && sizeof($out['event_list'])>0){
foreach($out['event_list'] as &$event){
$event['guid'] = buildGUID(array('empID'=>$out['empID'],'evID'=> $event['evID'],'ruEvent'=>'email-click','ruReferrer'=>'cpap','ruVerb'=>'register','ruObj'=>'event','usrID'=>$out['usrID'], 'hID'=>$out['hID']));
}
} else {
$out['event_list'] = array('guid'=>'resetSession=1','evName'=>'No schedule found for this location. Please click to choose another','url'=>$_SERVER['PHP_SELF'],'target'=>'_self');
}
$out['survey_guid'] = buildGUID(array('empSurveyUsername'=>$out['survey']['credUsername'], 'empSurveyPassword'=>decrypt($out['survey']['credPassIV'], $out['survey']['credPass']), usrLang=>'', 'empID'=>$out['empID'], 'hID'=>$out['hID'], 'usrID'=>$out['usrID']));
} else {
echo 'Error loading employer data.';
}
echo $T->parse($out);
}
Line 1, you've got an IF statement that's looking for a subDomain and if there's something present, we're moving forward.
Line 7, we instantiate a new Blitz dynamic,
Now, here's my question...
The HTML, at one point, has this:
<<div class="row">
<div class="col-xs-12">
{{ IF $empID }}
<h4>Step 1:</h4>
{{IF $evName}}Selected site: {{$empName}}{{ELSE}} Site Selected.{{END}}
<h4>Step 2:</h4>
<p>Select a class from the list to register for classes:</p>
{{ BEGIN event_list }}
{{ UNLESS $url }}
<div><a href="https://personalhealthsurvey.net/event.php?{{$guid}}" target="{{IF $target}}{{$target}}{{ELSE}}_blank{{END IF}}">{{$evName}}</a></div>
{{ ELSE }}
<div><a href="{{$url}}?{{$guid}}" target="{{IF $target}}{{$target}}{{ELSE}}_blank{{END IF}}">{{$evName}}</a></div>
{{ END IF }}
{{ END event_list }}
<p><br>
Once you have scheduled your screening, you can log in again to the scheduler to change or cancel your appointment. Confirmation emails will contain a link back to the online scheduler.
</p>
{{ ELSE }}
<h4>Step 1:</h4>
<form name="kickit" method="post" action="#">
<input type="hidden" name="evID" id="evID" value="3851,3844,3842,3838,3830,3822,3781,3780,3848,3854,3847,3846,3845,3843,3841,3840,3837,3836,3825,3824,3823,3785,3784,3783,3782,3850,5068,5110" style="visibility:hidden">
<input type="hidden" name="fetchEvents" value="1" />
<select id="empID" name="empID" onchange="if (this.value.length > 0) kickit.submit();" class="form-control">
<option value="">Select a Site</option>
<!--I removed the actual hospital names-->
<option>hospital names>/option>
</select>
</form>
<p><br>
Once you have scheduled your screening, you can log in again to the scheduler to change or cancel your appointment. Confirmation emails will contain a link back to the online scheduler.
</p>
{{ END IF }}
</div>
</div>
You're submitting a form "onchange," but there's nothing on the index.php that's seemingly interested in either of the hidden fields, as far as what would trigger dynamic content.
There is, however, a Blitz IF statement asking for the presence of an $empID variable ({{ IF $empID }}).
Looking at the index.php page on line 61, you see this:
if(empty($out['empID'])){
What is $out and is this line what I'm thinking it is, as far as the thing that determines what is viewed on the .tpl page?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER