Skip to content

Commit

Permalink
updated interface, allow forms to be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
cfapress committed Jan 22, 2009
1 parent e72164a commit a161578
Showing 1 changed file with 83 additions and 62 deletions.
145 changes: 83 additions & 62 deletions interface/patient_file/encounter/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,68 +38,89 @@ function imdeleted() {

<span class="title"><?php xl('This Encounter','e'); ?></span>
<?php
$auth_notes_a = acl_check('encounters', 'notes_a');
$auth_notes = acl_check('encounters', 'notes');
$auth_relaxed = acl_check('encounters', 'relaxed');

if (is_numeric($pid)) {
// Check for no access to the patient's squad.
$result = getPatientData($pid, "fname,lname,squad");
echo " for " . $result['fname'] . " " . $result['lname'];
if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
$auth_notes_a = $auth_notes = $auth_relaxed = 0;
}
// Check for no access to the encounter's sensitivity level.
$result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
"pid = '$pid' AND encounter = '$encounter' LIMIT 1");
if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
$auth_notes_a = $auth_notes = $auth_relaxed = 0;
}
}

echo ":";
if (acl_check('admin', 'super')) {
echo "&nbsp;&nbsp;<a href='' onclick='return deleteme()'>" .
"<font class='more' style='color:red'>(Delete)</font></a>";
}
echo "<br>\n";

if ($result = getFormByEncounter($pid, $encounter, "id, date, form_id, form_name,formdir,user")) {
echo "<table>";
foreach ($result as $iter) {
$formdir = $iter['formdir'];

// Skip forms that we are not authorized to see.
if (($auth_notes_a) ||
($auth_notes && $iter['user'] == $_SESSION['authUser']) ||
($auth_relaxed && ($formdir == 'sports_fitness' || $formdir == 'podiatry'))) ;
else continue;

// $form_info = getFormInfoById($iter['id']);
echo '<tr valign="top">';
$user = getNameFromUsername($iter['user']);

$form_name = ($formdir == 'newpatient') ? "Patient Encounter" : $iter['form_name'];

echo '<td class="text"><span style="font-weight:bold;">' .
$user['fname'] . " " . $user['lname'] .'</span></td>';
echo "<td valign='top'><a target='";
echo $GLOBALS['concurrent_layout'] ? "_parent" : "Main";
echo "' href='$rootdir/patient_file/encounter/view_form.php?" .
"formname=" . $formdir . "&id=" . $iter['form_id'] .
"' class='text' onclick='top.restoreSession()'>$form_name</a></td>\n" .
"<td width='25'></td>\n" .
"<td valign='top'>";

// Use the form's report.php for display.
//
include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
call_user_func($formdir . "_report", $pid, $iter['encounter'], 2, $iter['form_id']);

echo "</td></tr>";
}
echo "</table>";
}
$auth_notes_a = acl_check('encounters', 'notes_a');
$auth_notes = acl_check('encounters', 'notes');
$auth_relaxed = acl_check('encounters', 'relaxed');

if (is_numeric($pid)) {
// Check for no access to the patient's squad.
$result = getPatientData($pid, "fname,lname,squad");
echo " for " . $result['fname'] . " " . $result['lname'];
if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
$auth_notes_a = $auth_notes = $auth_relaxed = 0;
}
// Check for no access to the encounter's sensitivity level.
$result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
"pid = '$pid' AND encounter = '$encounter' LIMIT 1");
if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
$auth_notes_a = $auth_notes = $auth_relaxed = 0;
}
}

echo ":";
if (acl_check('admin', 'super')) {
echo "&nbsp;&nbsp;<a href='' onclick='return deleteme()'>" .
"<font class='more' style='color:red'>(Delete)</font></a>";
}
echo "<br>\n";

if ($result = getFormByEncounter($pid, $encounter, "id, date, form_id, form_name, formdir, user, deleted")) {
echo "<table style='border-collapse:collapse; width:100%;'>";
echo "<tr><th>User</th><th>Form</th><th></th></tr>";
foreach ($result as $iter) {
$formdir = $iter['formdir'];

// skip forms whose 'deleted' flag is set to 1
if ($iter['deleted'] == 1) continue;

// Skip forms that we are not authorized to see.
if (($auth_notes_a) ||
($auth_notes && $iter['user'] == $_SESSION['authUser']) ||
($auth_relaxed && ($formdir == 'sports_fitness' || $formdir == 'podiatry'))) ;
else continue;

// $form_info = getFormInfoById($iter['id']);
echo '<tr style="vertical-align:top; border-bottom:1px solid black;">';
$user = getNameFromUsername($iter['user']);

$form_name = ($formdir == 'newpatient') ? "Patient Encounter" : $iter['form_name'];

echo '<td style="border-top:1px solid black;" class="text"><span style="font-weight:bold;">' .
$user['fname'] . " " . $user['lname'] .'</span></td>';
echo "<td style='vertical-align:top; border-top:1px solid black; text-align:center;' >";

// a link to edit the form
echo "<a target='".
($GLOBALS['concurrent_layout'] ? "_parent" : "Main") .
"' href='$rootdir/patient_file/encounter/view_form.php?" .
"formname=" . $formdir . "&id=" . $iter['form_id'] .
"' class='text' onclick='top.restoreSession()'>$form_name</a>";

if (acl_check('admin', 'super')) {
// a link to delete the form from the encounter
echo "<span class='small'> (<a target='".
($GLOBALS['concurrent_layout'] ? "_parent" : "Main") .
"' href='$rootdir/patient_file/encounter/delete_form.php?" .
"formname=" . $formdir .
"&id=" . $iter['id'] .
"&encounter=". $encounter.
"&pid=".$pid.
"' class='small' title='Delete this form' onclick='top.restoreSession()'>Delete</a>)</span>";
}

echo "</td>\n" .
"<td style='border-top:1px solid black; width: 25px'>&nbsp;</td>\n" .
"<td style='border-top:1px solid black; vertical-align:top;'>";

// Use the form's report.php for display.
//
include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
call_user_func($formdir . "_report", $pid, $iter['encounter'], 2, $iter['form_id']);

echo "</td></tr>";
}
echo "</table>";
}
?>

<?php if ($GLOBALS['athletic_team'] && $GLOBALS['concurrent_layout'] == 2) { ?>
Expand Down

0 comments on commit a161578

Please sign in to comment.