Skip to content

Commit

Permalink
Outlook_Calendar_Cleanup
Browse files Browse the repository at this point in the history
Standard calendar column widths determined by provider count, not by
length of provider name string.  Cleaned-up kludgy getProviderInfo()
function in patient.inc while adding users.calendar as primary sort
order for displayed calendar columns.  Still need to locate prgram where
users.calendar row is set and modify it from an on/off flag to a numeric
allowing calendar provider columns to be displayed in any order.
  • Loading branch information
PFWilliams committed May 1, 2014
1 parent 6c38858 commit bec3e9d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
Expand Up @@ -320,7 +320,7 @@
// EOS FF
// ==============================
echo "</div>";
echo " <select multiple size='5' name='pc_username[]' id='pc_username' class='view2'>\n";
echo " <select multiple size='10' name='pc_username[]' id='pc_username' class='view2'>\n";
echo " <option value='__PC_ALL__'>" .xl ("All Users"). "</option>\n";
foreach ($provinfo as $doc) {
$username = $doc['username'];
Expand Down Expand Up @@ -386,6 +386,10 @@
}
echo "</table></div></td>";

//pw start ********
$pname_max = 136 / count($providers); // tune for resolution?
If ($pname_max < 13) { $pname_max = 13; } // tune for resolution?
//pw end ********

// This loops once for each provider to be displayed.
//
Expand All @@ -403,9 +407,20 @@
// having a 'title' for the TD makes the date appear by the mouse pointer
// this is nice when all you see are times on the left side and no head
// row with the dates or day-of-week (DOW)
echo "<td class='schedule' title='".htmlspecialchars($provider["fname"],ENT_QUOTES)." ".htmlspecialchars($provider["lname"],ENT_QUOTES)."' date='".date("Ymd",$caldate )."' provider='$providerid'>";
//pw start ********
$pname_display = htmlspecialchars($provider['fname'],ENT_QUOTES)." ".htmlspecialchars($provider['lname'],ENT_QUOTES);
If (strlen($pname_display) > $pname_max) { // if full name exceeds $pname_max, collapse first name to first initial
$pname_display = htmlspecialchars(substr($provider['fname'], 0, 1),ENT_QUOTES)." ".htmlspecialchars($provider['lname'],ENT_QUOTES);
If (strlen($pname_display) > $pname_max) { // if full name still exceeds $pname_max, remove first initial
$pname_display = htmlspecialchars($provider['lname'],ENT_QUOTES);
}
}
$pname_len = ($pname_max - strlen($pname_display)) / 2;
$pname_display = substr(" ", 0, $pname_len).$pname_display.substr(" ", 0, $pname_len + .5);
echo "<td class='schedule' title='".$pname_display."' date='".date("Ymd",$caldate )."' provider='$providerid'>";
echo "<div class='providerheader'>";
echo htmlspecialchars($provider['fname'],ENT_QUOTES)." ".htmlspecialchars($provider['lname'],ENT_QUOTES)."</div>";
echo $pname_display."</div>";
//pw end ********
echo "<div class='calendar_day'>";

// For each event...
Expand Down
Expand Up @@ -299,7 +299,7 @@
// EOS FF
// ==============================
echo "</div>";
echo " <select multiple size='5' name='pc_username[]' id='pc_username' class='view2'>\n";
echo " <select multiple size='10' name='pc_username[]' id='pc_username' class='view2'>\n";
echo " <option value='__PC_ALL__'>" .xl ("All Users"). "</option>\n";
foreach ($provinfo as $doc) {
$username = $doc['username'];
Expand Down
Expand Up @@ -323,7 +323,7 @@
// EOS FF
// ==============================
echo "</div>";
echo " <select multiple size='5' name='pc_username[]' id='pc_username' class='view2'>\n";
echo " <select multiple size='10' name='pc_username[]' id='pc_username' class='view2'>\n";
echo " <option value='__PC_ALL__'>" .xl ("All Users"). "</option>\n";
foreach ($provinfo as $doc) {
$username = $doc['username'];
Expand Down
4 changes: 3 additions & 1 deletion interface/themes/ajax_calendar.css
Expand Up @@ -215,12 +215,14 @@ div.tiny { width:1px; height:1px; font-size:1px; }

/* for the header row with provider names */
.providerheader {
font-family: "Lucida Console", Monaco, monospace;
font-size: 0.7em;
text-align: center;
background-color: #EDEAFF;
width: 100%;
overflow:hidden;
border-bottom: 1px solid lightgrey;
white-space: nowrap;
white-space: pre;
}

/* for the DIV inside each TD, this DIV contains any events for a single day */
Expand Down
45 changes: 14 additions & 31 deletions library/patient.inc
Expand Up @@ -227,52 +227,35 @@ function getServiceFacilities($first = '') {
}
}

//(CHEMED) facility filter
function getProviderInfo($providerID = "%", $providers_only = true, $facility = '' ) {
$param1 = "";
if ($providers_only === 'any') {
$param1 = " AND authorized = 1 AND active = 1 ";
function getProviderInfo($providerID = '', $providers_only = true, $facility = '' ) {
$query = "select id, username, lname, fname, authorized, info, facility from users where username != '' and active = 1";
if (is_numeric($providerID)) {
$query .= " and id = " . $providerID;
}
if ($providers_only == 'any') {
$query .= " AND authorized = 1";
}
else if ($providers_only) {
$param1 = " AND authorized = 1 AND calendar = 1 ";
$query .= " AND authorized = 1 AND calendar";
}

//--------------------------------
//(CHEMED) facility filter
$param2 = "";
//(CHEMED) facility filter -------
if ($facility) {
if ($GLOBALS['restrict_user_facility']) {
$param2 = " AND (facility_id = $facility
OR $facility IN
(select facility_id
from users_facility
where tablename = 'users'
and table_id = id)
)
";
$query .= " AND (facility_id = $facility OR $facility IN
(select facility_id from users_facility where tablename = 'users' and table_id = id))";
}
else {
$param2 = " AND facility_id = $facility ";
$query .= " AND facility_id = $facility";
}
}
//--------------------------------

$command = "=";
if ($providerID == "%") {
$command = "like";
}
$query = "select distinct id, username, lname, fname, authorized, info, facility " .
"from users where username != '' and active = 1 and id $command '" .
mysql_real_escape_string($providerID) . "' " . $param1 . $param2;
// sort by last name -- JRM June 2008
$query .= " ORDER BY lname, fname ";
$query .= " ORDER BY calendar, lname, fname;";
$rez = sqlStatement($query);
for($iter=0; $row=sqlFetchArray($rez); $iter++)
$returnval[$iter]=$row;

//if only one result returned take the key/value pairs in array [0] and merge them down the the base array so that $resultval[0]['key'] is also
//accessible from $resultval['key']

//accessible from $resultval['key'] -- Say what???
if($iter==1) {
$akeys = array_keys($returnval[0]);
foreach($akeys as $key) {
Expand Down

0 comments on commit bec3e9d

Please sign in to comment.