][Count]='<?php 
                echo htmlspecialchars($rowresult4['encounter'], ENT_QUOTES);
                ?>
';
                EncounterDateArray[<?php 
                echo attr($iter['enc_pid']);
                ?>
][Count]='<?php 
                echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date']))), ENT_QUOTES);
                ?>
';
                CalendarCategoryArray[<?php 
                echo attr($iter['enc_pid']);
                ?>
][Count]='<?php 
                echo htmlspecialchars(xl_appt_category($rowresult4['pc_catname']), ENT_QUOTES);
                ?>
';
				EncounterNoteArray[<?php 
                echo attr($iter['enc_pid']);
                ?>
][Count]='<?php 
                echo htmlspecialchars($rowresult4['billing_note'], ENT_QUOTES);
                ?>
';
                Count++;
         <?php 
                $enc_billing_note = $rowresult4['billing_note'];
            }
            ?>
        </script>
 function view_action($patient_id = "", $doc_id)
 {
     // Added by Rod to support document delete:
     global $gacl_object, $phpgacl_location;
     global $ISSUE_TYPES;
     require_once dirname(__FILE__) . "/../library/acl.inc";
     require_once dirname(__FILE__) . "/../library/lists.inc";
     $d = new Document($doc_id);
     $n = new Note();
     $notes = $n->notes_factory($doc_id);
     $this->assign("file", $d);
     $this->assign("web_path", $this->_link("retrieve") . "document_id=" . $d->get_id() . "&");
     $this->assign("NOTE_ACTION", $this->_link("note"));
     $this->assign("MOVE_ACTION", $this->_link("move") . "document_id=" . $d->get_id() . "&process=true");
     $this->assign("hide_encryption", $GLOBALS['hide_document_encryption']);
     // Added by Rod to support document delete:
     $delete_string = '';
     if (acl_check('admin', 'super')) {
         $delete_string = "<a href='' class='css_button' onclick='return deleteme(" . $d->get_id() . ")'><span><font color='red'>" . xl('Delete') . "</font></span></a>";
     }
     $this->assign("delete_string", $delete_string);
     $this->assign("REFRESH_ACTION", $this->_link("list"));
     $this->assign("VALIDATE_ACTION", $this->_link("validate") . "document_id=" . $d->get_id() . "&process=true");
     // Added by Rod to support document date update:
     $this->assign("DOCDATE", $d->get_docdate());
     $this->assign("UPDATE_ACTION", $this->_link("update") . "document_id=" . $d->get_id() . "&process=true");
     // Added by Rod to support document issue update:
     $issues_options = "<option value='0'>-- " . xl('Select Issue') . " --</option>";
     $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " . "pid = ? " . "ORDER BY type, begdate", array($patient_id));
     while ($irow = sqlFetchArray($ires)) {
         $desc = $irow['type'];
         if ($ISSUE_TYPES[$desc]) {
             $desc = $ISSUE_TYPES[$desc][2];
         }
         $desc .= ": " . $irow['begdate'] . " " . htmlspecialchars(substr($irow['title'], 0, 40));
         $sel = $irow['id'] == $d->get_list_id() ? ' selected' : '';
         $issues_options .= "<option value='" . $irow['id'] . "'{$sel}>{$desc}</option>";
     }
     $this->assign("ISSUES_LIST", $issues_options);
     // For tagging to encounter
     // Populate the dropdown with patient's encounter list
     $this->assign("TAG_ACTION", $this->_link("tag") . "document_id=" . $d->get_id() . "&process=true");
     $encOptions = "<option value='0'>-- " . xlt('Select Encounter') . " --</option>";
     $result_docs = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe " . "LEFT JOIN openemr_postcalendar_categories ON fe.pc_catid=openemr_postcalendar_categories.pc_catid  WHERE fe.pid = ? ORDER BY fe.date desc", array($patient_id));
     if (sqlNumRows($result_docs) > 0) {
         while ($row_result_docs = sqlFetchArray($result_docs)) {
             $sel_enc = $row_result_docs['encounter'] == $d->get_encounter_id() ? ' selected' : '';
             $encOptions .= "<option value='" . attr($row_result_docs['encounter']) . "' {$sel_enc}>" . oeFormatShortDate(date('Y-m-d', strtotime($row_result_docs['date']))) . "-" . text($row_result_docs['pc_catname']) . "</option>";
         }
     }
     $this->assign("ENC_LIST", $encOptions);
     //Populate the dropdown with category list
     $visit_category_list = "<option value='0'>-- " . xlt('Select One') . " --</option>";
     $cres = sqlStatement("SELECT pc_catid, pc_catname FROM openemr_postcalendar_categories ORDER BY pc_catname");
     while ($crow = sqlFetchArray($cres)) {
         $catid = $crow['pc_catid'];
         if ($catid < 9 && $catid != 5) {
             continue;
         }
         // Applying same logic as in new encounter page.
         $visit_category_list .= "<option value='" . attr($catid) . "'>" . text(xl_appt_category($crow['pc_catname'])) . "</option>\n";
     }
     $this->assign("VISIT_CATEGORY_LIST", $visit_category_list);
     $this->assign("notes", $notes);
     $this->_last_node = null;
     $menu = new HTML_TreeMenu();
     //pass an empty array because we don't want the documents for each category showing up in this list box
     $rnode = $this->_array_recurse($this->tree->tree, array());
     $menu->addItem($rnode);
     $treeMenu_listbox = new HTML_TreeMenu_Listbox($menu, array("promoText" => xl('Move Document to Category:')));
     $this->assign("tree_html_listbox", $treeMenu_listbox->toHTML());
     $activity = $this->fetch($GLOBALS['template_dir'] . "documents/" . $this->template_mod . "_view.html");
     $this->assign("activity", $activity);
     return $this->list_action($patient_id);
 }
        $dispmin = substr($row['pc_startTime'], 3, 2);
        if ($disphour >= 12) {
            $dispampm = "pm";
            if ($disphour > 12) {
                $disphour -= 12;
            }
        }
        $etitle = xl('(Click to edit)');
        if ($row['pc_hometext'] != "") {
            $etitle = xl('Comments') . ": " . $row['pc_hometext'] . "\r\n" . $etitle;
        }
        echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
        echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'], ENT_NOQUOTES) . "</b>" . xlt("Status") . "(";
        echo " " . generate_display_field(array('data_type' => '1', 'list_id' => 'apptstat'), $row['pc_apptstatus']) . ")<br>";
        // can't use special char parser on this
        echo htmlspecialchars("{$disphour}:{$dispmin} " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']), ENT_NOQUOTES) . "<br>\n";
        echo htmlspecialchars($row['fname'] . " " . $row['lname'], ENT_NOQUOTES) . "</a><br>\n";
    }
    if (isset($res) && $res != null) {
        if ($count < 1) {
            echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
        }
        echo "</div>";
    }
}
// Show PAST appointments.
if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['num_past_appointments_to_show'] > 0) {
    $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " . "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " . "c.pc_catname, e.pc_apptstatus " . "FROM openemr_postcalendar_events AS e, users AS u, " . "openemr_postcalendar_categories AS c WHERE " . "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " . "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " . "ORDER BY e.pc_eventDate, e.pc_startTime DESC " . "LIMIT " . $GLOBALS['num_past_appointments_to_show'];
    $pres = sqlStatement($query, array($pid));
    // appointments expand collapse widget
    $widgetTitle = xl("Past Appoinments");
Exemple #4
0
        EncounterIdArray=new Array;
        Count = 0;
	<?php 
    if (isset($enc_list) && sqlNumRows($enc_list) > 0) {
        while ($row = sqlFetchArray($enc_list)) {
            ?>
				        EncounterIdArray[Count]='<?php 
            echo attr($row['encounter']);
            ?>
';
                                        EncounterDateArray[Count]='<?php 
            echo attr(oeFormatShortDate(date("Y-m-d", strtotime($row['date']))));
            ?>
';
                                        CalendarCategoryArray[Count]='<?php 
            echo attr(xl_appt_category($row['pc_catname']));
            ?>
';
                                        Count++;
	<?php 
        }
    }
    ?>
  top.restoreSession();
  $.ajax({
    type:'get',
    url:'<?php 
    echo $GLOBALS['webroot'] . "/interface/patient_file/encounter/patient_encounter.php";
    ?>
',
    data:{set_pid: pid},
Exemple #5
0
function generate_print_field($frow, $currvalue)
{
    global $rootdir, $date_init, $ISSUE_TYPES;
    $currescaped = htmlspecialchars($currvalue, ENT_QUOTES);
    $data_type = $frow['data_type'];
    $field_id = $frow['field_id'];
    $list_id = $frow['list_id'];
    $fld_length = $frow['fld_length'];
    $backup_list = $frow['list_backup_id'];
    $description = htmlspecialchars(xl_layout_label($frow['description']), ENT_QUOTES);
    // Can pass $frow['empty_title'] with this variable, otherwise
    //  will default to 'Unassigned'.
    // If it is 'SKIP' then an empty text title is completely skipped.
    $showEmpty = true;
    if (isset($frow['empty_title'])) {
        if ($frow['empty_title'] == "SKIP") {
            //do not display an 'empty' choice
            $showEmpty = false;
            $empty_title = "Unassigned";
        } else {
            $empty_title = $frow['empty_title'];
        }
    } else {
        $empty_title = "Unassigned";
    }
    // generic single-selection list
    //  Supports backup lists.
    if ($data_type == 1 || $data_type == 26 || $data_type == 33) {
        if (empty($fld_length)) {
            if ($list_id == 'titles') {
                $fld_length = 3;
            } else {
                $fld_length = 10;
            }
        }
        $tmp = '';
        if ($currvalue) {
            $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($list_id, $currvalue));
            $tmp = xl_list_label($lrow['title']);
            if ($lrow == 0 && !empty($backup_list)) {
                // since primary list did not map, try to map to backup list
                $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($backup_list, $currvalue));
                $tmp = xl_list_label($lrow['title']);
            }
            if (empty($tmp)) {
                $tmp = "({$currvalue})";
            }
        }
        /*****************************************************************
           echo "<input type='text'" .
             " size='$fld_length'" .
             " value='$tmp'" .
             " class='under'" .
             " />";
           *****************************************************************/
        if ($tmp === '') {
            $tmp = '&nbsp;';
        } else {
            $tmp = htmlspecialchars($tmp, ENT_QUOTES);
        }
        echo $tmp;
    } else {
        if ($data_type == 2 || $data_type == 15) {
            /*****************************************************************
               echo "<input type='text'" .
                 " size='$fld_length'" .
                 " value='$currescaped'" .
                 " class='under'" .
                 " />";
               *****************************************************************/
            if ($currescaped === '') {
                $currescaped = '&nbsp;';
            }
            echo $currescaped;
        } else {
            if ($data_type == 3) {
                $fldlength = htmlspecialchars($fld_length, ENT_QUOTES);
                $maxlength = htmlspecialchars($frow['fld_rows'], ENT_QUOTES);
                echo "<textarea" . " cols='{$fldlength}'" . " rows='{$maxlength}'>" . $currescaped . "</textarea>";
            } else {
                if ($data_type == 4) {
                    $agestr = optionalAge($frow, $currvalue);
                    if ($agestr) {
                        echo "<table cellpadding='0' cellspacing='0'><tr><td class='text'>";
                    }
                    if ($currvalue === '') {
                        echo '&nbsp;';
                    } else {
                        echo text(oeFormatShortDate($currvalue));
                    }
                    // Optional display of age or gestational age.
                    if ($agestr) {
                        echo "</td></tr><tr><td class='text'>" . text($agestr) . "</td></tr></table>";
                    }
                } else {
                    if ($data_type == 10 || $data_type == 11) {
                        $tmp = '';
                        if ($currvalue) {
                            $urow = sqlQuery("SELECT fname, lname, specialty FROM users " . "WHERE id = ?", array($currvalue));
                            $tmp = ucwords($urow['fname'] . " " . $urow['lname']);
                            if (empty($tmp)) {
                                $tmp = "({$currvalue})";
                            }
                        }
                        /*****************************************************************
                           echo "<input type='text'" .
                             " size='$fld_length'" .
                             " value='$tmp'" .
                             " class='under'" .
                             " />";
                           *****************************************************************/
                        if ($tmp === '') {
                            $tmp = '&nbsp;';
                        } else {
                            $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                        }
                        echo $tmp;
                    } else {
                        if ($data_type == 12) {
                            $tmp = '';
                            if ($currvalue) {
                                $pres = get_pharmacies();
                                while ($prow = sqlFetchArray($pres)) {
                                    $key = $prow['id'];
                                    if ($currvalue == $key) {
                                        $tmp = $prow['name'] . ' ' . $prow['area_code'] . '-' . $prow['prefix'] . '-' . $prow['number'] . ' / ' . $prow['line1'] . ' / ' . $prow['city'];
                                    }
                                }
                                if (empty($tmp)) {
                                    $tmp = "({$currvalue})";
                                }
                            }
                            /*****************************************************************
                               echo "<input type='text'" .
                                 " size='$fld_length'" .
                                 " value='$tmp'" .
                                 " class='under'" .
                                 " />";
                               *****************************************************************/
                            if ($tmp === '') {
                                $tmp = '&nbsp;';
                            } else {
                                $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                            }
                            echo $tmp;
                        } else {
                            if ($data_type == 13) {
                                $tmp = '';
                                if ($currvalue) {
                                    $squads = acl_get_squads();
                                    if ($squads) {
                                        foreach ($squads as $key => $value) {
                                            if ($currvalue == $key) {
                                                $tmp = $value[3];
                                            }
                                        }
                                    }
                                    if (empty($tmp)) {
                                        $tmp = "({$currvalue})";
                                    }
                                }
                                /*****************************************************************
                                   echo "<input type='text'" .
                                     " size='$fld_length'" .
                                     " value='$tmp'" .
                                     " class='under'" .
                                     " />";
                                   *****************************************************************/
                                if ($tmp === '') {
                                    $tmp = '&nbsp;';
                                } else {
                                    $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                                }
                                echo $tmp;
                            } else {
                                if ($data_type == 14) {
                                    $tmp = '';
                                    if ($currvalue) {
                                        $urow = sqlQuery("SELECT fname, lname, specialty FROM users " . "WHERE id = ?", array($currvalue));
                                        $uname = $urow['lname'];
                                        if ($urow['fname']) {
                                            $uname .= ", " . $urow['fname'];
                                        }
                                        $tmp = $uname;
                                        if (empty($tmp)) {
                                            $tmp = "({$currvalue})";
                                        }
                                    }
                                    /*****************************************************************
                                       echo "<input type='text'" .
                                         " size='$fld_length'" .
                                         " value='$tmp'" .
                                         " class='under'" .
                                         " />";
                                       *****************************************************************/
                                    if ($tmp === '') {
                                        $tmp = '&nbsp;';
                                    } else {
                                        $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                                    }
                                    echo $tmp;
                                } else {
                                    if ($data_type == 16) {
                                        $tmp = '';
                                        if ($currvalue) {
                                            $insprovs = getInsuranceProviders();
                                            foreach ($insprovs as $key => $ipname) {
                                                if ($currvalue == $key) {
                                                    $tmp = $ipname;
                                                }
                                            }
                                            if (empty($tmp)) {
                                                $tmp = "({$currvalue})";
                                            }
                                        }
                                        if ($tmp === '') {
                                            $tmp = '&nbsp;';
                                        } else {
                                            $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                                        }
                                        echo $tmp;
                                    } else {
                                        if ($data_type == 17) {
                                            $tmp = '';
                                            if ($currvalue) {
                                                foreach ($ISSUE_TYPES as $key => $value) {
                                                    if ($currvalue == $key) {
                                                        $tmp = $value[1];
                                                    }
                                                }
                                                if (empty($tmp)) {
                                                    $tmp = "({$currvalue})";
                                                }
                                            }
                                            if ($tmp === '') {
                                                $tmp = '&nbsp;';
                                            } else {
                                                $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                                            }
                                            echo $tmp;
                                        } else {
                                            if ($data_type == 18) {
                                                $tmp = '';
                                                if ($currvalue) {
                                                    $crow = sqlQuery("SELECT pc_catid, pc_catname " . "FROM openemr_postcalendar_categories WHERE pc_catid = ?", array($currvalue));
                                                    $tmp = xl_appt_category($crow['pc_catname']);
                                                    if (empty($tmp)) {
                                                        $tmp = "({$currvalue})";
                                                    }
                                                }
                                                if ($tmp === '') {
                                                    $tmp = '&nbsp;';
                                                } else {
                                                    $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                                                }
                                                echo $tmp;
                                            } else {
                                                if ($data_type == 21) {
                                                    // In this special case, fld_length is the number of columns generated.
                                                    $cols = max(1, $fld_length);
                                                    $avalue = explode('|', $currvalue);
                                                    $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                    echo "<table cellpadding='0' cellspacing='0' width='100%'>";
                                                    $tdpct = (int) (100 / $cols);
                                                    for ($count = 0; $lrow = sqlFetchArray($lres); ++$count) {
                                                        $option_id = $lrow['option_id'];
                                                        if ($count % $cols == 0) {
                                                            if ($count) {
                                                                echo "</tr>";
                                                            }
                                                            echo "<tr>";
                                                        }
                                                        echo "<td width='{$tdpct}%'>";
                                                        echo "<input type='checkbox'";
                                                        if (in_array($option_id, $avalue)) {
                                                            echo " checked";
                                                        }
                                                        echo ">" . htmlspecialchars(xl_list_label($lrow['title']), ENT_NOQUOTES);
                                                        echo "</td>";
                                                    }
                                                    if ($count) {
                                                        echo "</tr>";
                                                        if ($count > $cols) {
                                                            // Add some space after multiple rows of checkboxes.
                                                            $cols = htmlspecialchars($cols, ENT_QUOTES);
                                                            echo "<tr><td colspan='{$cols}' style='height:0.7em'></td></tr>";
                                                        }
                                                    }
                                                    echo "</table>";
                                                } else {
                                                    if ($data_type == 22) {
                                                        $tmp = explode('|', $currvalue);
                                                        $avalue = array();
                                                        foreach ($tmp as $value) {
                                                            if (preg_match('/^([^:]+):(.*)$/', $value, $matches)) {
                                                                $avalue[$matches[1]] = $matches[2];
                                                            }
                                                        }
                                                        $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                        echo "<table cellpadding='0' cellspacing='0'>";
                                                        while ($lrow = sqlFetchArray($lres)) {
                                                            $option_id = $lrow['option_id'];
                                                            $fldlength = empty($fld_length) ? 20 : $fld_length;
                                                            echo "<tr><td>" . htmlspecialchars(xl_list_label($lrow['title']), ENT_NOQUOTES) . "&nbsp;</td>";
                                                            $fldlength = htmlspecialchars($fldlength, ENT_QUOTES);
                                                            $inputValue = htmlspecialchars($avalue[$option_id], ENT_QUOTES);
                                                            echo "<td><input type='text'" . " size='{$fldlength}'" . " value='{$inputValue}'" . " class='under'" . " /></td></tr>";
                                                        }
                                                        echo "</table>";
                                                    } else {
                                                        if ($data_type == 23) {
                                                            $tmp = explode('|', $currvalue);
                                                            $avalue = array();
                                                            foreach ($tmp as $value) {
                                                                if (preg_match('/^([^:]+):(.*)$/', $value, $matches)) {
                                                                    $avalue[$matches[1]] = $matches[2];
                                                                }
                                                            }
                                                            $fldlength = empty($fld_length) ? 20 : $fld_length;
                                                            $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                            echo "<table cellpadding='0' cellspacing='0'>";
                                                            echo "<tr><td>&nbsp;</td><td class='bold'>" . htmlspecialchars(xl('N/A'), ENT_NOQUOTES) . "&nbsp;</td><td class='bold'>" . htmlspecialchars(xl('Nor'), ENT_NOQUOTES) . "&nbsp;</td>" . "<td class='bold'>" . htmlspecialchars(xl('Abn'), ENT_NOQUOTES) . "&nbsp;</td><td class='bold'>" . htmlspecialchars(xl('Date/Notes'), ENT_NOQUOTES) . "</td></tr>";
                                                            while ($lrow = sqlFetchArray($lres)) {
                                                                $option_id = $lrow['option_id'];
                                                                $restype = substr($avalue[$option_id], 0, 1);
                                                                $resnote = substr($avalue[$option_id], 2);
                                                                echo "<tr><td>" . htmlspecialchars(xl_list_label($lrow['title']), ENT_NOQUOTES) . "&nbsp;</td>";
                                                                for ($i = 0; $i < 3; ++$i) {
                                                                    echo "<td><input type='radio'";
                                                                    if ($restype === "{$i}") {
                                                                        echo " checked";
                                                                    }
                                                                    echo " /></td>";
                                                                }
                                                                $resnote = htmlspecialchars($resnote, ENT_QUOTES);
                                                                $fldlength = htmlspecialchars($fldlength, ENT_QUOTES);
                                                                echo "<td><input type='text'" . " size='{$fldlength}'" . " value='{$resnote}'" . " class='under' /></td>" . "</tr>";
                                                            }
                                                            echo "</table>";
                                                        } else {
                                                            if ($data_type == 24) {
                                                                $query = "SELECT title, comments FROM lists WHERE " . "pid = ? AND type = 'allergy' AND enddate IS NULL " . "ORDER BY begdate";
                                                                $lres = sqlStatement($query, array($GLOBALS['pid']));
                                                                $count = 0;
                                                                while ($lrow = sqlFetchArray($lres)) {
                                                                    if ($count++) {
                                                                        echo "<br />";
                                                                    }
                                                                    echo htmlspecialchars($lrow['title'], ENT_QUOTES);
                                                                    if ($lrow['comments']) {
                                                                        echo htmlspecialchars(' (' . $lrow['comments'] . ')', ENT_QUOTES);
                                                                    }
                                                                }
                                                            } else {
                                                                if ($data_type == 25) {
                                                                    $tmp = explode('|', $currvalue);
                                                                    $avalue = array();
                                                                    foreach ($tmp as $value) {
                                                                        if (preg_match('/^([^:]+):(.*)$/', $value, $matches)) {
                                                                            $avalue[$matches[1]] = $matches[2];
                                                                        }
                                                                    }
                                                                    $fldlength = empty($fld_length) ? 20 : $fld_length;
                                                                    $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                                    echo "<table cellpadding='0' cellspacing='0'>";
                                                                    while ($lrow = sqlFetchArray($lres)) {
                                                                        $option_id = $lrow['option_id'];
                                                                        $restype = substr($avalue[$option_id], 0, 1);
                                                                        $resnote = substr($avalue[$option_id], 2);
                                                                        echo "<tr><td>" . htmlspecialchars(xl_list_label($lrow['title']), ENT_NOQUOTES) . "&nbsp;</td>";
                                                                        echo "<td><input type='checkbox'";
                                                                        if ($restype) {
                                                                            echo " checked";
                                                                        }
                                                                        echo " />&nbsp;</td>";
                                                                        $fldlength = htmlspecialchars($fldlength, ENT_QUOTES);
                                                                        $resnote = htmlspecialchars($resnote, ENT_QUOTES);
                                                                        echo "<td><input type='text'" . " size='{$fldlength}'" . " value='{$resnote}'" . " class='under'" . " /></td>" . "</tr>";
                                                                    }
                                                                    echo "</table>";
                                                                } else {
                                                                    if ($data_type == 27) {
                                                                        // In this special case, fld_length is the number of columns generated.
                                                                        $cols = max(1, $frow['fld_length']);
                                                                        $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                                        echo "<table cellpadding='0' cellspacing='0' width='100%'>";
                                                                        $tdpct = (int) (100 / $cols);
                                                                        for ($count = 0; $lrow = sqlFetchArray($lres); ++$count) {
                                                                            $option_id = $lrow['option_id'];
                                                                            if ($count % $cols == 0) {
                                                                                if ($count) {
                                                                                    echo "</tr>";
                                                                                }
                                                                                echo "<tr>";
                                                                            }
                                                                            echo "<td width='{$tdpct}%'>";
                                                                            echo "<input type='radio'";
                                                                            if (strlen($currvalue) == 0 && $lrow['is_default'] || strlen($currvalue) > 0 && $option_id == $currvalue) {
                                                                                echo " checked";
                                                                            }
                                                                            echo ">" . htmlspecialchars(xl_list_label($lrow['title']), ENT_NOQUOTES);
                                                                            echo "</td>";
                                                                        }
                                                                        if ($count) {
                                                                            echo "</tr>";
                                                                            if ($count > $cols) {
                                                                                // Add some space after multiple rows of radio buttons.
                                                                                $cols = htmlspecialchars($cols, ENT_QUOTES);
                                                                                echo "<tr><td colspan='{$cols}' style='height:0.7em'></td></tr>";
                                                                            }
                                                                        }
                                                                        echo "</table>";
                                                                    } else {
                                                                        if ($data_type == 28 || $data_type == 32) {
                                                                            $tmp = explode('|', $currvalue);
                                                                            switch (count($tmp)) {
                                                                                case "4":
                                                                                    $resnote = $tmp[0];
                                                                                    $restype = $tmp[1];
                                                                                    $resdate = $tmp[2];
                                                                                    $reslist = $tmp[3];
                                                                                    break;
                                                                                case "3":
                                                                                    $resnote = $tmp[0];
                                                                                    $restype = $tmp[1];
                                                                                    $resdate = $tmp[2];
                                                                                    break;
                                                                                case "2":
                                                                                    $resnote = $tmp[0];
                                                                                    $restype = $tmp[1];
                                                                                    $resdate = "";
                                                                                    break;
                                                                                case "1":
                                                                                    $resnote = $tmp[0];
                                                                                    $resdate = $restype = "";
                                                                                    break;
                                                                                default:
                                                                                    $restype = $resdate = $resnote = "";
                                                                                    break;
                                                                            }
                                                                            $fldlength = empty($frow['fld_length']) ? 20 : $frow['fld_length'];
                                                                            echo "<table cellpadding='0' cellspacing='0'>";
                                                                            echo "<tr>";
                                                                            $fldlength = htmlspecialchars($fldlength, ENT_QUOTES);
                                                                            $resnote = htmlspecialchars($resnote, ENT_QUOTES);
                                                                            $resdate = htmlspecialchars($resdate, ENT_QUOTES);
                                                                            if ($data_type == 28) {
                                                                                echo "<td><input type='text'" . " size='{$fldlength}'" . " class='under'" . " value='{$resnote}' /></td>";
                                                                                echo "<td class='bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . htmlspecialchars(xl('Status'), ENT_NOQUOTES) . ":&nbsp;</td>";
                                                                            } else {
                                                                                if ($data_type == 32) {
                                                                                    echo "<tr><td><input type='text'" . " size='{$fldlength}'" . " class='under'" . " value='{$resnote}' /></td></tr>";
                                                                                    $fldlength = 30;
                                                                                    $smoking_status_title = generate_display_field(array('data_type' => '1', 'list_id' => $list_id), $reslist);
                                                                                    echo "<td><input type='text'" . " size='{$fldlength}'" . " class='under'" . " value='{$smoking_status_title}' /></td>";
                                                                                    echo "<td class='bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . htmlspecialchars(xl('Status'), ENT_NOQUOTES) . ":&nbsp;&nbsp;</td>";
                                                                                }
                                                                            }
                                                                            echo "<td><input type='radio'";
                                                                            if ($restype == "current" . $field_id) {
                                                                                echo " checked";
                                                                            }
                                                                            echo "/>" . htmlspecialchars(xl('Current'), ENT_NOQUOTES) . "&nbsp;</td>";
                                                                            echo "<td><input type='radio'";
                                                                            if ($restype == "current" . $field_id) {
                                                                                echo " checked";
                                                                            }
                                                                            echo "/>" . htmlspecialchars(xl('Quit'), ENT_NOQUOTES) . "&nbsp;</td>";
                                                                            echo "<td><input type='text' size='6'" . " value='{$resdate}'" . " class='under'" . " /></td>";
                                                                            echo "<td><input type='radio'";
                                                                            if ($restype == "current" . $field_id) {
                                                                                echo " checked";
                                                                            }
                                                                            echo " />" . htmlspecialchars(xl('Never'), ENT_NOQUOTES) . "</td>";
                                                                            echo "<td><input type='radio'";
                                                                            if ($restype == "not_applicable" . $field_id) {
                                                                                echo " checked";
                                                                            }
                                                                            echo " />" . htmlspecialchars(xl('N/A'), ENT_NOQUOTES) . "&nbsp;</td>";
                                                                            echo "</tr>";
                                                                            echo "</table>";
                                                                        } else {
                                                                            if ($data_type == 31) {
                                                                                echo nl2br($frow['description']);
                                                                            } else {
                                                                                if ($data_type == 34) {
                                                                                    echo "<a href='../../../library/custom_template/custom_template.php?type=form_{$field_id}&contextName=" . htmlspecialchars($list_id_esc, ENT_QUOTES) . "' class='iframe_medium' style='text-decoration:none;color:black;'>";
                                                                                    echo "<div id='form_{$field_id}_div' class='text-area'></div>";
                                                                                    echo "<div style='display:none'><textarea name='form_{$field_id}' id='form_{$field_id}' stye='display:none'></textarea></div>";
                                                                                    echo "</a>";
                                                                                } else {
                                                                                    if ($data_type == 35) {
                                                                                        if (empty($currvalue)) {
                                                                                            $currvalue = 0;
                                                                                        }
                                                                                        dropdown_facility($selected = $currvalue, $name = "form_{$field_id_esc}", $allow_unspecified = true, $allow_allfacilities = false);
                                                                                    } else {
                                                                                        if ($data_type == 36) {
                                                                                            if (empty($fld_length)) {
                                                                                                if ($list_id == 'titles') {
                                                                                                    $fld_length = 3;
                                                                                                } else {
                                                                                                    $fld_length = 10;
                                                                                                }
                                                                                            }
                                                                                            $tmp = '';
                                                                                            $values_array = explode("|", $currvalue);
                                                                                            $i = 0;
                                                                                            foreach ($values_array as $value) {
                                                                                                if ($value) {
                                                                                                    $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($list_id, $value));
                                                                                                    $tmp = xl_list_label($lrow['title']);
                                                                                                    if ($lrow == 0 && !empty($backup_list)) {
                                                                                                        // since primary list did not map, try to map to backup list
                                                                                                        $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($backup_list, $currvalue));
                                                                                                        $tmp = xl_list_label($lrow['title']);
                                                                                                    }
                                                                                                    if (empty($tmp)) {
                                                                                                        $tmp = "({$value})";
                                                                                                    }
                                                                                                }
                                                                                                if ($tmp === '') {
                                                                                                    $tmp = '&nbsp;';
                                                                                                } else {
                                                                                                    $tmp = htmlspecialchars($tmp, ENT_QUOTES);
                                                                                                }
                                                                                                if ($i != 0 && $tmp != '&nbsp;') {
                                                                                                    echo ",";
                                                                                                }
                                                                                                echo $tmp;
                                                                                                $i++;
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Exemple #6
0
        echo "<td align='center' class='js-blink-infinite'>\t";
        # and if so blink
    } else {
        echo "<td align='center' class='detail'> ";
        # and if not do not blink
    }
    if ($yestime == '1' && $timecheck >= 1 && strtotime($newarrive) != '') {
        echo text($timecheck . ' ' . ($timecheck >= 2 ? xl('minutes') : xl('minute')));
    }
    #end time in current status
    ?>
	
		 </td>
         <td class="detail" align="center">
         <?php 
    echo text(xl_appt_category($appointment['pc_title']));
    ?>
         </td>
         <td class="detail" align="center">
         <?php 
    echo text($docname);
    ?>
         </td>
         <td class="detail" align="center"> 
         <?php 
    # total time in practice
    if (strtotime($newend) != '') {
        $from_time = strtotime($newarrive);
        $to_time = strtotime($newend);
    } else {
        $from_time = strtotime($newarrive);
Exemple #7
0
/**
 * search events
 */
function postcalendar_user_search()
{
    if (!(bool) PC_ACCESS_OVERVIEW) {
        return _POSTCALENDARNOAUTH;
    }
    $tpl = new pcSmarty();
    $k = formData("pc_keywords", "R");
    //from library/formdata.inc.php
    $k_andor = pnVarCleanFromInput('pc_keywords_andor');
    $pc_category = pnVarCleanFromInput('pc_category');
    $pc_facility = pnVarCleanFromInput('pc_facility');
    $pc_topic = pnVarCleanFromInput('pc_topic');
    $submit = pnVarCleanFromInput('submit');
    $event_dur_hours = pnVarCleanFromInput('event_dur_hours');
    $event_dur_minutes = pnVarCleanFromInput('event_dur_minutes');
    $start = pnVarCleanFromInput('start');
    $end = pnVarCleanFromInput('end');
    // get list of categories for the user to choose from
    $categories = postcalendar_userapi_getCategories();
    $cat_options = '';
    foreach ($categories as $category) {
        $selected = "";
        if ($pc_category == $category[id]) {
            $selected = " SELECTED ";
        }
        //modified 8/09 by BM to allow translation if applicable
        $cat_options .= "<option value=\"{$category['id']}\" {$selected}>" . xl_appt_category($category[name]) . "</option>";
    }
    $tpl->assign_by_ref('CATEGORY_OPTIONS', $cat_options);
    $tpl->assign('event_dur_hours', $event_dur_hours);
    $tpl->assign('event_dur_minutes', $event_dur_minutes);
    // create default start and end dates for the search form
    if (isset($start) && $start != "") {
        $tpl->assign('DATE_START', $start);
    } else {
        $tpl->assign('DATE_START', date("m/d/Y"));
    }
    if (isset($end) && $end != "") {
        $tpl->assign('DATE_END', $end);
    } else {
        $tpl->assign('DATE_END', date("m/d/Y", strtotime("+7 Days", time())));
    }
    // then override the setting if we have a value from the submitted form
    $ProviderID = pnVarCleanFromInput("provider_id");
    if (is_numeric($ProviderID)) {
        $tpl->assign('ProviderID', $ProviderID);
    } elseif ($ProviderID == "_ALL_") {
    } else {
        $tpl->assign('ProviderID', "");
    }
    $provinfo = getProviderInfo();
    $tpl->assign('providers', $provinfo);
    // build a list of provider-options for the select box on the input form -- JRM
    $provider_options = "<option value='_ALL_' ";
    if ($ProviderID == "_ALL_") {
        $provider_options .= " SELECTED ";
    }
    $provider_options .= ">" . xl('All Providers') . "</option>";
    foreach ($provinfo as $provider) {
        $selected = "";
        // if we don't have a ProviderID chosen, pick the first one from the
        // pc_username Session variable
        if ($ProviderID == "") {
            // that variable stores the 'username' and not the numeric 'id'
            if ($_SESSION['pc_username'][0] == $provider['username']) {
                $selected = " SELECTED ";
            }
        } else {
            if ($ProviderID == $provider['id']) {
                $selected = " SELECTED ";
            }
        }
        $provider_options .= "<option value=\"" . $provider['id'] . "\" " . $selected . ">";
        $provider_options .= $provider['lname'] . ", " . $provider['fname'] . "</option>";
    }
    $tpl->assign_by_ref('PROVIDER_OPTIONS', $provider_options);
    // build a list of facility options for the select box on the input form -- JRM
    $facilities = getFacilities();
    $fac_options = "<option value=''>" . xl('All Facilities') . "</option>";
    foreach ($facilities as $facility) {
        $selected = "";
        if ($facility['id'] == $pc_facility) {
            $selected = " SELECTED ";
        }
        $fac_options .= "<option value=\"" . $facility['id'] . "\" " . $selected . ">";
        $fac_options .= $facility['name'] . "</option>";
    }
    $tpl->assign_by_ref('FACILITY_OPTIONS', $fac_options);
    $PatientID = pnVarCleanFromInput("patient_id");
    // limit the number of results returned by getPatientPID
    // this helps to prevent the server from stalling on a request with
    // no PID and thousands of PIDs in the database -- JRM
    // the function getPatientPID($pid, $given, $orderby, $limit, $start) <-- defined in library/patient.inc
    $plistlimit = 500;
    if (is_numeric($PatientID)) {
        $tpl->assign('PatientList', getPatientPID(array('pid' => $PatientID, 'limit' => $plistlimit)));
    } else {
        $tpl->assign('PatientList', getPatientPID(array('limit' => $plistlimit)));
    }
    $event_endday = pnVarCleanFromInput("event_endday");
    $event_endmonth = pnVarCleanFromInput("event_endmonth");
    $event_endyear = pnVarCleanFromInput("event_endyear");
    $event_startday = pnVarCleanFromInput("event_startday");
    $event_startmonth = pnVarCleanFromInput("event_startmonth");
    $event_startyear = pnVarCleanFromInput("event_startyear");
    if ($event_startday > $event_endday) {
        $event_endday = $event_startday;
    }
    if ($event_startmonth > $event_endmonth) {
        $event_endmonth = $event_startmonth;
    }
    if ($event_startyear > $event_endyear) {
        $event_endyear = $event_startyear;
    }
    $tpl->assign('patient_id', $PatientID);
    $tpl->assign('provider_id', $ProviderID);
    $tpl->assign("event_category", pnVarCleanFromInput("event_category"));
    $tpl->assign("event_subject", pnVarCleanFromInput("event_subject"));
    $output = new pnHTML();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata = $output->FormSelectMultiple('event_startday', $sel_data);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata .= $output->FormSelectMultiple('event_startmonth', $sel_data);
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata = $output->FormSelectMultiple('event_startmonth', $sel_data);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata .= $output->FormSelectMultiple('event_startday', $sel_data);
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_startyear));
    $formdata .= $output->FormSelectMultiple('event_startyear', $sel_data);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectDateTimeStart', $formdata);
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata = $output->FormSelectMultiple('event_endday', $sel_data);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata .= $output->FormSelectMultiple('event_endmonth', $sel_data);
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata = $output->FormSelectMultiple('event_endmonth', $sel_data);
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata .= $output->FormSelectMultiple('event_endday', $sel_data);
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_endyear));
    $formdata .= $output->FormSelectMultiple('event_endyear', $sel_data);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectDateTimeEnd', $formdata);
    $output = null;
    if (_SETTING_DISPLAY_TOPICS) {
        $topics = postcalendar_userapi_getTopics();
        $top_options = '';
        foreach ($topics as $topic) {
            $top_options .= "<option value=\"{$topic['id']}\">{$topic['text']}</option>";
        }
        $tpl->assign_by_ref('TOPIC_OPTIONS', $top_options);
    }
    //=================================================================
    //  Find out what Template we're using
    //=================================================================
    $template_name = _SETTING_TEMPLATE;
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    //=================================================================
    //  Output the search form
    //=================================================================
    $tpl->assign('FORM_ACTION', pnModURL(__POSTCALENDAR__, 'user', 'search'));
    //=================================================================
    //  Perform the search if we have data
    //=================================================================
    if (!empty($submit) && strtolower($submit) == "find first") {
        // not sure how we get here...
        $searchargs = array();
        $searchargs['start'] = pnVarCleanFromInput("event_startmonth") . "/" . pnVarCleanFromInput("event_startday") . "/" . pnVarCleanFromInput("event_startyear");
        $searchargs['end'] = pnVarCleanFromInput("event_endmonth") . "/" . pnVarCleanFromInput("event_endday") . "/" . pnVarCleanFromInput("event_endyear");
        $searchargs['provider_id'] = pnVarCleanFromInput("provider_id");
        $searchargs['faFlag'] = true;
        //print_r($searchargs);
        //echo "<br />";
        //set defaults to current week if empty
        if ($searchargs['start'] == "//") {
            $searchargs['start'] = date("m/d/Y");
        }
        if ($searchargs['end'] == "//") {
            $searchargs['end'] = date("m/d/Y", strtotime("+7 Days", strtotime($searchargs['start'])));
        }
        //print_r($searchargs);
        $eventsByDate =& postcalendar_userapi_pcGetEvents($searchargs);
        //print_r($eventsByDate);
        $found = findFirstAvailable($eventsByDate);
        $tpl->assign('available_times', $found);
        //print_r($_POST);
        $tpl->assign('SEARCH_PERFORMED', true);
        $tpl->assign('A_EVENTS', $eventsByDate);
    }
    if (!empty($submit) && strtolower($submit) == "listapps") {
        // not sure how we get here...
        $searchargs = array();
        $searchargs['start'] = date("m/d/Y");
        $searchargs['end'] = date("m/d/Y", strtotime("+1 year", strtotime($searchargs['start'])));
        $searchargs['patient_id'] = pnVarCleanFromInput("patient_id");
        $searchargs['listappsFlag'] = true;
        $sqlKeywords .= "(a.pc_pid = '" . pnVarCleanFromInput("patient_id") . "' )";
        $searchargs['s_keywords'] = $sqlKeywords;
        //print_r($searchargs);
        $eventsByDate =& postcalendar_userapi_pcGetEvents($searchargs);
        //print_r($eventsByDate);
        $tpl->assign('appointments', $eventsByDate);
        //print_r($_POST);
        $tpl->assign('SEARCH_PERFORMED', true);
        $tpl->assign('A_EVENTS', $eventsByDate);
    } elseif (!empty($submit)) {
        // we get here by searching via the PostCalendar search
        $sqlKeywords = '';
        $keywords = explode(' ', $k);
        // build our search query
        foreach ($keywords as $word) {
            if (!empty($sqlKeywords)) {
                $sqlKeywords .= " {$k_andor} ";
            }
            $sqlKeywords .= '(';
            $sqlKeywords .= "pd.lname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "pd.fname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "u.lname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "u.fname LIKE '%{$word}%' OR ";
            $sqlKeywords .= "a.pc_title LIKE '%{$word}%' OR ";
            $sqlKeywords .= "a.pc_hometext LIKE '%{$word}%' OR ";
            $sqlKeywords .= "a.pc_location LIKE '%{$word}%'";
            $sqlKeywords .= ') ';
        }
        if (!empty($pc_category)) {
            $s_category = "a.pc_catid = '{$pc_category}'";
        }
        if (!empty($pc_topic)) {
            $s_topic = "a.pc_topic = '{$pc_topic}'";
        }
        $searchargs = array();
        if (!empty($sqlKeywords)) {
            $searchargs['s_keywords'] = $sqlKeywords;
        }
        if (!empty($s_category)) {
            $searchargs['s_category'] = $s_category;
        }
        if (!empty($s_topic)) {
            $searchargs['s_topic'] = $s_topic;
        }
        // some new search parameters introduced in the ajax_search form...  JRM March 2008
        // the ajax_search form has form parameters for 'start' and 'end' already built in
        // so use them if available
        $tmpDate = pnVarCleanFromInput("start");
        if (isset($tmpDate) && $tmpDate != "") {
            $searchargs['start'] = pnVarCleanFromInput("start");
        } else {
            $searchargs['start'] = "//";
        }
        $tmpDate = pnVarCleanFromInput("end");
        if (isset($tmpDate) && $tmpDate != "") {
            $searchargs['end'] = pnVarCleanFromInput("end");
        } else {
            $searchargs['end'] = "//";
        }
        // we can limit our search by provider -- JRM March 2008
        if (isset($ProviderID) && $ProviderID != "") {
            // && $ProviderID != "_ALL_") {
            $searchargs['provider_id'] = array();
            array_push($searchargs['provider_id'], $ProviderID);
        }
        $eventsByDate =& postcalendar_userapi_pcGetEvents($searchargs);
        // we can limit our search by facility -- JRM March 2008
        if (isset($pc_facility) && $pc_facility != "") {
            $searchargs['pc_facility'] = $pc_facility;
        }
        //print_r($eventsByDate);
        $tpl->assign('SEARCH_PERFORMED', true);
        $tpl->assign('A_EVENTS', $eventsByDate);
    }
    $tpl->caching = false;
    $tpl->assign('STYLE', $GLOBALS['style']);
    $pageSetup =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'pageSetup');
    if (pnVarCleanFromInput("no_nav") == 1) {
        $return = $pageSetup . $tpl->fetch($template_name . '/user/findfirst.html');
    } elseif (pnVarCleanFromInput("no_nav") == 2) {
        $return = $pageSetup . $tpl->fetch($template_name . '/user/listapps.html');
    } else {
        $return = $pageSetup . $tpl->fetch($template_name . '/user/search.html');
    }
    return $return;
}
Exemple #8
0
             $apptStyle = " style='background-color:#e6e6ff;'";
         } else {
             $apptStyle = '';
         }
     }
     //////
     echo "<div " . $apptStyle . ">";
     echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
     echo "<b>" . htmlspecialchars($row['pc_eventDate'], ENT_NOQUOTES) . ", ";
     echo htmlspecialchars(sprintf("%02d", $disphour) . ":{$dispmin} " . xl($dispampm) . " (" . xl($dayname), ENT_NOQUOTES) . ")</b> ";
     if ($row['pc_recurrtype']) {
         echo "<img src='" . $GLOBALS['webroot'] . "/interface/main/calendar/modules/PostCalendar/pntemplates/default/images/repeating8.png' border='0' style='margin:0px 2px 0px 2px;' title='" . htmlspecialchars(xl("Repeating event"), ENT_QUOTES) . "' alt='" . htmlspecialchars(xl("Repeating event"), ENT_QUOTES) . "'>";
     }
     echo "<span title='" . generate_display_field(array('data_type' => '1', 'list_id' => 'apptstat'), $row['pc_apptstatus']) . "'>";
     echo "<br>" . xlt('Status') . "( " . htmlspecialchars($row['pc_apptstatus'], ENT_NOQUOTES) . " ) </span>";
     echo htmlspecialchars(xl_appt_category($row['pc_catname']), ENT_NOQUOTES) . "\n";
     if ($row['pc_hometext']) {
         echo " <span style='color:green'> Com</span>";
     }
     echo "<br>" . htmlspecialchars($row['ufname'] . " " . $row['ulname'], ENT_NOQUOTES) . "</a></div>\n";
     //////
 }
 if ($resNotNull) {
     //////
     if ($count < 1) {
         echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
     } else {
         //////
         if ($extraApptDate) {
             echo "<div>&nbsp;</div>";
         } else {
        echo $appointment['pubpid'];
        ?>
</td>

                <td class="detail">&nbsp;<?php 
        echo $appointment['phone_home'];
        ?>
</td>

                <td class="detail">&nbsp;<?php 
        echo $appointment['phone_cell'];
        ?>
</td>

		<td class="detail">&nbsp;<?php 
        echo xl_appt_category($appointment['pc_catname']);
        ?>
		</td>

		<td class="detail">&nbsp;<?php 
        echo $appointment['pc_hometext'];
        ?>
</td>

	</tr>

	<?php 
        $lastdocname = $docname;
    }
    // assign the session key with the $pid_list array - note array might be empty -- handle on the printed_fee_sheet.php page.
    $_SESSION['pidList'] = $pid_list;
Exemple #10
0
/**
 *  postcalendar_userapi_pcQueryEvents
 *  INPUT
 *  $args = Array of values possibly containing:
 *     $provider_id = array of provider ID numbers
 *     
 *  Returns an array containing the event's information
 *  @params array(key=>value)
 *  @params string key eventstatus
 *  @params int value -1 == hidden ; 0 == queued ; 1 == approved
 *  @return array $events[][]
 */
function &postcalendar_userapi_pcQueryEvents($args)
{
    $end = '0000-00-00';
    extract($args);
    // echo "<!-- args = "; print_r($args); echo " -->\n"; // debugging
    // $pc_username = pnVarCleanFromInput('pc_username');
    $pc_username = $_SESSION['pc_username'];
    // from Michael Brinson 2006-09-19
    if (empty($pc_username) || is_array($pc_username)) {
        $pc_username = "******";
    }
    //echo "DEBUG pc_username: $pc_username \n"; // debugging
    $topic = pnVarCleanFromInput('pc_topic');
    $category = pnVarCleanFromInput('pc_category');
    if (!empty($pc_username) && strtolower($pc_username) != 'anonymous') {
        if ($pc_username == '__PC_ALL__' || $pc_username == -1) {
            $ruserid = -1;
        } else {
            $ruserid = getIDfromUser($pc_username);
        }
    }
    if (!isset($eventstatus)) {
        $eventstatus = 1;
    }
    // sanity check on eventstatus
    if ((int) $eventstatus < -1 || (int) $eventstatus > 1) {
        $eventstatus = 1;
    }
    if (!isset($start)) {
        $start = Date_Calc::dateNow('%Y-%m-%d');
    }
    list($sy, $sm, $sd) = explode('-', $start);
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    // link to the events tables
    $table = $pntable['postcalendar_events'];
    $cattable = $pntable['postcalendar_categories'];
    $topictable = $pntable['postcalendar_topics'];
    $sql = "SELECT DISTINCT a.pc_eid,  a.pc_informant, a.pc_catid, " . "a.pc_title, a.pc_time, a.pc_hometext, a.pc_eventDate, a.pc_duration, " . "a.pc_endDate, a.pc_startTime, a.pc_recurrtype, a.pc_recurrfreq, " . "a.pc_recurrspec, a.pc_topic, a.pc_alldayevent, a.pc_location, " . "a.pc_conttel, a.pc_contname, a.pc_contemail, a.pc_website, a.pc_fee, " . "a.pc_sharing, a.pc_prefcatid, b.pc_catcolor, b.pc_catname, " . "b.pc_catdesc, a.pc_pid, a.pc_apptstatus, a.pc_aid, " . "concat(u.fname,' ',u.lname) as provider_name, " . "concat(pd.lname,', ',pd.fname) as patient_name, " . "concat(u2.fname, ' ', u2.lname) as owner_name, " . "DOB as patient_dob, a.pc_facility, pd.pubpid " . "FROM  ( {$table} AS a ) " . "LEFT JOIN {$cattable} AS b ON b.pc_catid = a.pc_catid " . "LEFT JOIN users as u ON a.pc_aid = u.id " . "LEFT JOIN users as u2 ON a.pc_aid = u2.id " . "LEFT JOIN patient_data as pd ON a.pc_pid = pd.pid " . "WHERE  a.pc_eventstatus = {$eventstatus} " . "AND ((a.pc_endDate >= '{$start}' AND a.pc_eventDate <= '{$end}') OR " . "(a.pc_endDate = '0000-00-00' AND a.pc_eventDate >= '{$start}' AND " . "a.pc_eventDate <= '{$end}')) ";
    //==================================
    //FACILITY FILTERING (lemonsoftware)(CHEMED)
    if ($_SESSION['pc_facility']) {
        $pc_facility = $_SESSION['pc_facility'];
        $sql .= " AND a.pc_facility = {$pc_facility} ";
        /*
                              AND u.facility_id = $pc_facility
                              AND u2.facility_id = $pc_facility "; */
    } else {
        if ($pc_facility) {
            // pc_facility could be provided in the search arguments -- JRM March 2008
            $sql .= " AND a.pc_facility = {$pc_facility} ";
            /*.
              " AND u.facility_id = $pc_facility".
              " AND u2.facility_id = $pc_facility "; */
        }
    }
    //EOS FACILITY FILTERING (lemonsoftware)
    //==================================
    // The above 3 lines replaced these:
    //   AND (a.pc_endDate >= '$start' OR a.pc_endDate = '0000-00-00')
    //   AND a.pc_eventDate <= '$end' ";
    if (!empty($providerID)) {
        $ruserid = $providerID;
    }
    // eliminate ruserid if we're trying to query by provider_id -- JRM
    if (!empty($provider_id)) {
        unset($ruserid);
    }
    if (isset($ruserid)) {
        // get all events for the specified username
        if ($ruserid == -1) {
            $sql .= "AND (a.pc_sharing = '" . SHARING_BUSY . "' ";
            $sql .= "OR a.pc_sharing = '" . SHARING_PUBLIC . "') ";
        } else {
            $sql .= "AND a.pc_aid IN (0, " . $ruserid . ") ";
        }
    } elseif (!pnUserLoggedIn()) {
        // get all events for anonymous users
        $sql .= "AND a.pc_sharing = '" . SHARING_GLOBAL . "' ";
    } elseif (!empty($provider_id)) {
        // get all events for a variety of provider IDs -- JRM
        if ($provider_id[0] != "_ALL_") {
            /**add all the events from the clinic provider id = 0*/
            $sql .= "AND a.pc_aid in (0," . implode(",", $provider_id) . ") ";
        }
    } else {
        // get all events for logged in user plus global events
        $sql .= "AND (a.pc_aid IN (0," . $_SESSION['authUserID'] . ") OR a.pc_sharing = '" . SHARING_GLOBAL . "') ";
    }
    //======================================================================
    //  START SEARCH FUNCTIONALITY
    //======================================================================
    if (!empty($s_keywords)) {
        $sql .= "AND ({$s_keywords}) ";
    }
    if (!empty($s_category)) {
        $sql .= "AND ({$s_category}) ";
    }
    if (!empty($s_topic)) {
        $sql .= "AND ({$s_topic}) ";
    }
    if (!empty($category)) {
        $sql .= "AND (a.pc_catid = '" . pnVarPrepForStore($category) . "') ";
    }
    if (!empty($topic)) {
        $sql .= "AND (a.pc_topic = '" . pnVarPrepForStore($topic) . "') ";
    }
    //======================================================================
    //  Search sort and limitation
    //======================================================================
    if (empty($sort)) {
        $sql .= "GROUP BY a.pc_eid ORDER BY a.pc_time DESC";
    } else {
        $sql .= "GROUP BY a.pc_eid ORDER BY a.{$sort}";
    }
    //======================================================================
    //  END SEARCH FUNCTIONALITY
    //======================================================================
    //echo "<br>sq: $sql<br />";
    // echo "<!-- " . $sql . " -->\n"; // debugging
    $result = $dbconn->Execute($sql);
    if ($dbconn->ErrorNo() != 0) {
        die($dbconn->ErrorMsg());
    }
    // put the information into an array for easy access
    $events = array();
    // return an empty array if we don't have any results
    if (!isset($result)) {
        return $events;
    }
    for ($i = 0; !$result->EOF; $result->MoveNext()) {
        // WHY are we using an array for intermediate storage???  -- Rod
        // get the results from the query
        if (isset($tmp)) {
            unset($tmp);
        }
        $tmp = array();
        list($tmp['eid'], $tmp['uname'], $tmp['catid'], $tmp['title'], $tmp['time'], $tmp['hometext'], $tmp['eventDate'], $tmp['duration'], $tmp['endDate'], $tmp['startTime'], $tmp['recurrtype'], $tmp['recurrfreq'], $tmp['recurrspec'], $tmp['topic'], $tmp['alldayevent'], $tmp['location'], $tmp['conttel'], $tmp['contname'], $tmp['contemail'], $tmp['website'], $tmp['fee'], $tmp['sharing'], $tmp['prefcatid'], $tmp['catcolor'], $tmp['catname'], $tmp['catdesc'], $tmp['pid'], $tmp['apptstatus'], $tmp['aid'], $tmp['provider_name'], $tmp['patient_name'], $tmp['owner_name'], $tmp['patient_dob'], $tmp['facility'], $tmp['pubpid']) = $result->fields;
        // grab the name of the topic
        $topicname = pcGetTopicName($tmp['topic']);
        // get the user id of event's author
        $cuserid = @$nuke_users[strtolower($tmp['uname'])];
        // check the current event's permissions
        // the user does not have permission to view this event
        // if any of the following evaluate as false
        if (!pnSecAuthAction(0, 'PostCalendar::Event', "{$tmp['title']}::{$tmp['eid']}", ACCESS_OVERVIEW)) {
            continue;
        } elseif (!pnSecAuthAction(0, 'PostCalendar::Category', "{$tmp['catname']}::{$tmp['catid']}", ACCESS_OVERVIEW)) {
            continue;
        } elseif (!pnSecAuthAction(0, 'PostCalendar::User', "{$tmp['uname']}::{$cuserid}", ACCESS_OVERVIEW)) {
            continue;
        } elseif (!pnSecAuthAction(0, 'PostCalendar::Topic', "{$topicname}::{$tmp['topic']}", ACCESS_OVERVIEW)) {
            continue;
        } elseif ($tmp['sharing'] == SHARING_PRIVATE && $cuserid != $userid) {
            continue;
        }
        // add event to the array if we passed the permissions check
        // this is the common information
        $events[$i]['intervals'] = $tmp['duration'] / 60 / $GLOBALS['day_calandar_interval'];
        //sets the number of rows this event should span
        $events[$i]['eid'] = $tmp['eid'];
        $events[$i]['uname'] = $tmp['uname'];
        $events[$i]['uid'] = $cuserid;
        $events[$i]['catid'] = $tmp['catid'];
        $events[$i]['time'] = $tmp['time'];
        $events[$i]['eventDate'] = $tmp['eventDate'];
        $events[$i]['duration'] = $tmp['duration'];
        // there has to be a more intelligent way to do this
        @(list($events[$i]['duration_hours'], $dmin) = @explode('.', $tmp['duration'] / 60 / 60));
        $events[$i]['duration_minutes'] = substr(sprintf('%.2f', '.' . 60 * ($dmin / 100)), 2, 2);
        //''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        $events[$i]['endDate'] = $tmp['endDate'];
        $events[$i]['startTime'] = $tmp['startTime'];
        $events[$i]['recurrtype'] = $tmp['recurrtype'];
        $events[$i]['recurrfreq'] = $tmp['recurrfreq'];
        $events[$i]['recurrspec'] = $tmp['recurrspec'];
        $events[$i]['topic'] = $tmp['topic'];
        $events[$i]['alldayevent'] = $tmp['alldayevent'];
        $events[$i]['catcolor'] = $tmp['catcolor'];
        // Modified 06-2009 by BM to translate the category if applicable
        $events[$i]['catname'] = xl_appt_category($tmp['catname']);
        $events[$i]['catdesc'] = $tmp['catdesc'];
        $events[$i]['pid'] = $tmp['pid'];
        $events[$i]['apptstatus'] = $tmp['apptstatus'];
        $events[$i]['pubpid'] = $tmp['pubpid'];
        $events[$i]['patient_name'] = $tmp['patient_name'];
        $events[$i]['provider_name'] = $tmp['provider_name'];
        $events[$i]['owner_name'] = $tmp['owner_name'];
        $events[$i]['patient_dob'] = $tmp['patient_dob'];
        $events[$i]['patient_age'] = getPatientAge($tmp['patient_dob']);
        $events[$i]['facility'] = getFacility($tmp['facility']);
        $events[$i]['sharing'] = $tmp['sharing'];
        $events[$i]['prefcatid'] = $tmp['prefcatid'];
        $events[$i]['aid'] = $tmp['aid'];
        $events[$i]['topictext'] = $topicname;
        $events[$i]['intervals'] = ceil($tmp['duration'] / 60 / $GLOBALS['calendar_interval']);
        if ($events[$i]['intervals'] == 0) {
            $events[$i]['intervals'] = 1;
        }
        // is this a public event to be shown as busy?
        if ($tmp['sharing'] == SHARING_BUSY && $cuserid != $userid) {
            // make it not display any information
            $events[$i]['title'] = _USER_BUSY_TITLE;
            $events[$i]['hometext'] = _USER_BUSY_MESSAGE;
            $events[$i]['desc'] = _USER_BUSY_MESSAGE;
            $events[$i]['conttel'] = '';
            $events[$i]['contname'] = '';
            $events[$i]['contemail'] = '';
            $events[$i]['website'] = '';
            $events[$i]['fee'] = '';
            $events[$i]['location'] = '';
            $events[$i]['street1'] = '';
            $events[$i]['street2'] = '';
            $events[$i]['city'] = '';
            $events[$i]['state'] = '';
            $events[$i]['postal'] = '';
        } else {
            $display_type = substr($tmp['hometext'], 0, 6);
            if ($display_type == ':text:') {
                $prepFunction = 'pcVarPrepForDisplay';
                $tmp['hometext'] = substr($tmp['hometext'], 6);
            } elseif ($display_type == ':html:') {
                $prepFunction = 'pcVarPrepHTMLDisplay';
                $tmp['hometext'] = substr($tmp['hometext'], 6);
            } else {
                $prepFunction = 'pcVarPrepHTMLDisplay';
            }
            unset($display_type);
            $events[$i]['title'] = $prepFunction($tmp['title']);
            $events[$i]['hometext'] = $prepFunction($tmp['hometext']);
            $events[$i]['desc'] = $events[$i]['hometext'];
            $events[$i]['conttel'] = $prepFunction($tmp['conttel']);
            $events[$i]['contname'] = $prepFunction($tmp['contname']);
            $events[$i]['contemail'] = $prepFunction($tmp['contemail']);
            $events[$i]['website'] = $prepFunction(postcalendar_makeValidURL($tmp['website']));
            $events[$i]['fee'] = $prepFunction($tmp['fee']);
            $loc = unserialize($tmp['location']);
            $events[$i]['location'] = $prepFunction($loc['event_location']);
            $events[$i]['street1'] = $prepFunction($loc['event_street1']);
            $events[$i]['street2'] = $prepFunction($loc['event_street2']);
            $events[$i]['city'] = $prepFunction($loc['event_city']);
            $events[$i]['state'] = $prepFunction($loc['event_state']);
            $events[$i]['postal'] = $prepFunction($loc['event_postal']);
        }
        $i++;
    }
    unset($tmp);
    $result->Close();
    return $events;
}
            echo text(oeFormatTime($appointment['pc_startTime']));
            ?>
        </td>

        <td class="detail">&nbsp;<?php 
            echo text($appointment['fname'] . " " . $appointment['lname']);
            ?>
        </td>

        <td class="detail">&nbsp;<?php 
            echo text($appointment['pubpid']);
            ?>
        </td>

        <td class="detail">&nbsp;<?php 
            echo text(xl_appt_category($appointment['pc_catname']));
            ?>
        </td>

        <td class="detail">
            <?php 
            //Appointment Status
            if ($chk_show_details) {
                if ($no_visit != 1) {
                    echo xlt('Complete Visit Time');
                }
            } else {
                if ($tracker_status != "") {
                    $frow['data_type'] = 1;
                    $frow['list_id'] = 'apptstat';
                    generate_print_field($frow, $tracker_status);
        <td class="detail">&nbsp;<?php echo ($docname == $lastdocname) ? "" : $docname ?>
        </td>

        <td class="detail"><?php echo text(oeFormatShortDate($appointment['pc_eventDate'])) ?>
        </td>
        
        <td class="detail"><?php echo text(oeFormatTime($appointment['pc_startTime'])) ?>
        </td>

        <td class="detail">&nbsp;<?php echo text($appointment['fname'] . " " . $appointment['lname']) ?>
        </td>

        <td class="detail">&nbsp;<?php echo text($appointment['pubpid']) ?>
        </td>

        <td class="detail">&nbsp;<?php echo text(xl_appt_category($appointment['pc_catname'])) ?>
        </td>

        <td class="detail">
            <?php
                //Appointment Status
                if($chk_show_details) {
                   if($no_visit != 1) {
                    echo xlt('Complete Visit Time');
                   }
                }
                else
                {
                 if($tracker_status != ""){
                    $frow['data_type']=1;
                    $frow['list_id']='apptstat';
Exemple #13
0
	EncounterIdArray=new Array;
	Count=0;
	 <?php 
if (sqlNumRows($result4) > 0) {
    while ($rowresult4 = sqlFetchArray($result4)) {
        ?>
					EncounterIdArray[Count]='<?php 
        echo attr($rowresult4['encounter']);
        ?>
';
					EncounterDateArray[Count]='<?php 
        echo attr(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date']))));
        ?>
';
					CalendarCategoryArray[Count]='<?php 
        echo attr(xl_appt_category($rowresult4['pc_catname']));
        ?>
';
					Count++;
	 <?php 
    }
}
?>
	 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
 top.restoreSession();
<?php 
if ($mode == 'new') {
    ?>
 parent.left_nav.setEncounter(<?php 
    echo "'" . attr(oeFormatShortDate($date)) . "', '" . attr($encounter) . "', window.name";
    ?>
  <td class="detail">
   &nbsp;<?php 
            echo $row['fname'] . " " . $row['lname'];
            ?>
  </td>

  <td class="detail">
   &nbsp;<?php 
            echo $row['pubpid'];
            ?>
  </td>

  <td class="detail">
   &nbsp;<?php 
            echo xl_appt_category($row['pc_catname']);
            ?>
  </td>

 </tr>

<?php 
            $lastdocname = $docname;
        }
    }
    ?>
</tbody>
</table>
</div>  <!-- end of search results -->
<?php 
} else {
Exemple #15
0
    } else {
        if ($crow['pc_catid'] == $default_catid) {
            $catoptions .= " selected";
            $thisduration = $duration;
        }
    }
    $catoptions .= ">" . xl_appt_category($crow['pc_catname']) . "</option>\n";
    // This section is to build the list of preferred categories:
    if ($duration) {
        $prefcat_options .= "    <option value='" . $crow['pc_catid'] . "'";
        if ($eid) {
            if ($crow['pc_catid'] == $row['pc_prefcatid']) {
                $prefcat_options .= " selected";
            }
        }
        $prefcat_options .= ">" . xl_appt_category($crow['pc_catname']) . "</option>\n";
    }
}
?>

<?php 
require $GLOBALS['srcdir'] . "/restoreSession.php";
?>

 // This is for callback by the find-patient popup.
 function setpatient(pid, lname, fname, dob) {
  var f = document.forms[0];
  f.form_patient.value = lname + ', ' + fname;
  f.form_pid.value = pid;
  dobstyle = (dob == '' || dob.substr(5, 10) == '00-00') ? '' : 'none';
  document.getElementById('dob_row').style.display = dobstyle;
Exemple #16
0
function postcalendar_admin_categoryLimits($msg = '', $e = '', $args)
{
    if (!PC_ACCESS_ADD) {
        return _POSTCALENDARNOAUTH;
    }
    extract($args);
    unset($args);
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    // set up Smarty
    $tpl = new pcSmarty();
    $tpl->caching = false;
    $template_name = pnModGetVar(__POSTCALENDAR__, 'pcTemplate');
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    if (!empty($e)) {
        $output->Text('<div style="padding:5px; border:1px solid red; background-color: pink;">');
        $output->Text('<center><b>' . $e . '</b></center>');
        $output->Text('</div><br />');
    }
    if (!empty($msg)) {
        $output->Text('<div style="padding:5px; border:1px solid green; background-color: lightgreen;">');
        $output->Text('<center><b>' . $msg . '</b></center>');
        $output->Text('</div><br />');
    }
    //=================================================================
    //  Setup the correct config file path for the templates
    //=================================================================
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $modir = pnVarPrepForOS($modinfo['directory']);
    $modname = $modinfo['displayname'];
    //print_r($all_categories);
    unset($modinfo);
    $tpl->assign('action', pnModURL(__POSTCALENDAR__, 'admin', 'categoryLimitsUpdate'));
    //===============================================================
    //  Setup titles for smarty
    //===============================================================
    $tpl->assign('_PC_LIMIT_TITLE', _PC_LIMIT_TITLE);
    $tpl->assign('StartTimeTitle', _PC_LIMIT_START_TIME);
    $tpl->assign('EndTimeTile', _PC_LIMIT_END_TIME);
    $tpl->assign('LimitHoursTitle', _PC_TIMED_DURATION_HOURS);
    $tpl->assign('LimitMinutesTitle', _PC_TIMED_DURATION_MINUTES);
    //=============================================================
    // Setup Vars for smarty
    //============================================================
    $tpl->assign('mer_title', 'mer');
    $mer = array('am', 'pm');
    $tpl->assign_by_ref('mer', $mer);
    $tpl->assign('starttimeh', 'starttimeh');
    $tpl->assign('starttimem', 'starttimem');
    $tpl->assign('endtimeh', 'endtimeh');
    $tpl->assign('endtimem', 'endtimem');
    $tpl->assign('InputLimit', 'limit');
    $tpl->assign('LimitTitle', _PC_LIMIT_TITLE);
    $tpl->assign('_PC_NEW_LIMIT_TITLE', _PC_NEW_LIMIT_TITLE);
    $tpl->assign('_PC_CAT_DELETE', _PC_CAT_DELETE);
    $tpl->assign('EndTimeTitle', _PC_LIMIT_END_TIME);
    $hour_array = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '21', '21', '22', '23');
    $min_array = array('00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55');
    $tpl->assign_by_ref('hour_array', $hour_array);
    $tpl->assign_by_ref('min_array', $min_array);
    $categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    // create translations of category names if applicable
    $sizeAllCat = count($categories);
    for ($m = 0; $m < $sizeAllCat; $m++) {
        $tempCategory = $categories[$m]["name"];
        $categories[$m]["name"] = xl_appt_category($tempCategory);
    }
    $tpl->assign_by_ref('categories', $categories);
    $limits = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategoryLimits');
    $tpl->assign_by_ref('limits', $limits);
    $tpl->assign('BGCOLOR2', $GLOBALS['style']['BGCOLOR2']);
    $tpl->assign("catTitle", _PC_REP_CAT_TITLE_S);
    $tpl->assign("catid", "catid");
    $form_submit = '<input type=hidden name="form_action" value="commit"/>
				   ' . $authkey . '<input type="submit" name="submit" value="' . xl('go') . '">';
    $tpl->assign('FormSubmit', $form_submit);
    $output->Text($tpl->fetch($template_name . '/admin/submit_category_limit.html'));
    $output->Text(postcalendar_footer());
    return $output->GetOutput();
}
Exemple #17
0
	<option value='_blank'>-- <?php 
echo xlt('Select One');
?>
 --</option>
<?php 
$cres = sqlStatement("SELECT pc_catid, pc_catname " . "FROM openemr_postcalendar_categories where pc_active = 1 ORDER BY pc_seq ");
while ($crow = sqlFetchArray($cres)) {
    $catid = $crow['pc_catid'];
    if ($catid < 9 && $catid != 5) {
        continue;
    }
    echo "       <option value='" . attr($catid) . "'";
    if ($viewmode && $crow['pc_catid'] == $result['pc_catid']) {
        echo " selected";
    }
    echo ">" . text(xl_appt_category($crow['pc_catname'])) . "</option>\n";
}
?>
      </select>
     </td>
    </tr>

    <tr>
     <td class='bold' nowrap><?php 
echo xlt('Facility:');
?>
</td>
     <td class='text'>
      <select name='facility_id' onChange="bill_loc()">
<?php 
if ($viewmode) {
/**
 *  $Id$
 *
 *  PostCalendar::PostNuke Events Calendar Module
 *  Copyright (C) 2002  The PostCalendar Team
 *  http://postcalendar.tv
 *  
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  To read the license please read the docs/license.txt or visit
 *  http://www.gnu.org/copyleft/gpl.html
 *
 */
function smarty_function_pc_filter($args, &$smarty)
{
    extract($args);
    unset($args);
    if (empty($type)) {
        $smarty->trigger_error("pc_filter: missing 'type' parameter");
        return;
    }
    $Date = postcalendar_getDate();
    if (!isset($y)) {
        $y = substr($Date, 0, 4);
    }
    if (!isset($m)) {
        $m = substr($Date, 4, 2);
    }
    if (!isset($d)) {
        $d = substr($Date, 6, 2);
    }
    $tplview = pnVarCleanFromInput('tplview');
    $viewtype = pnVarCleanFromInput('viewtype');
    $pc_username = pnVarCleanFromInput('pc_username');
    if (!isset($viewtype)) {
        $viewtype = _SETTING_DEFAULT_VIEW;
    }
    $types = explode(',', $type);
    $output = new pnHTML();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $mdir = pnVarPrepForOS($modinfo['directory']);
    unset($modinfo);
    $pcTemplate = pnVarPrepForOS(_SETTING_TEMPLATE);
    if (empty($pcTemplate)) {
        $pcTemplate = 'default';
    }
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    //================================================================
    //	build the username filter pulldown
    //================================================================
    if (in_array('user', $types)) {
        @define('_PC_FORM_USERNAME', true);
        $sql = "SELECT DISTINCT users.username, users.lname, users.fname\n\t \t\t\tFROM {$pntable['postcalendar_events']}, users where users.id=pc_aid\n\t\t\t\tORDER BY pc_aid";
        $result = $dbconn->Execute($sql);
        if ($result !== false) {
            $useroptions = "<select multiple='multiple' size='3' name=\"pc_username[]\" class=\"{$class}\">";
            $useroptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_USERS . "</option>";
            $selected = $pc_username == '__PC_ALL__' ? 'selected="selected"' : '';
            $useroptions .= "<option value=\"__PC_ALL__\" class=\"{$class}\" {$selected}>" . _PC_FILTER_USERS_ALL . "</option>";
            for (; !$result->EOF; $result->MoveNext()) {
                $sel = $pc_username == $result->fields[0] ? 'selected="selected"' : '';
                $useroptions .= "<option value=\"" . $result->fields[0] . "\" {$sel} class=\"{$class}\">" . $result->fields[1] . ", " . $result->fields[2] . "</option>";
            }
            $useroptions .= '</select>';
            $result->Close();
        }
    }
    //================================================================
    //	build the category filter pulldown
    //================================================================
    if (in_array('category', $types)) {
        @define('_PC_FORM_CATEGORY', true);
        $category = pnVarCleanFromInput('pc_category');
        $categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
        $catoptions = "<select name=\"pc_category\" class=\"{$class}\">";
        $catoptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_CATEGORY . "</option>";
        foreach ($categories as $c) {
            $sel = $category == $c['id'] ? 'selected="selected"' : '';
            $catoptions .= "<option value=\"{$c['id']}\" {$sel} class=\"{$class}\">" . xl_appt_category($c[name]) . "</option>";
        }
        $catoptions .= '</select>';
    }
    //================================================================
    //	build the topic filter pulldown
    //================================================================
    if (in_array('topic', $types) && _SETTING_DISPLAY_TOPICS) {
        @define('_PC_FORM_TOPIC', true);
        $topic = pnVarCleanFromInput('pc_topic');
        $topics = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getTopics');
        $topoptions = "<select name=\"pc_topic\" class=\"{$class}\">";
        $topoptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_TOPIC . "</option>";
        foreach ($topics as $t) {
            $sel = $topic == $t['id'] ? 'selected="selected"' : '';
            $topoptions .= "<option value=\"{$t['id']}\" {$sel} class=\"{$class}\">{$t['text']}</option>";
        }
        $topoptions .= '</select>';
    } else {
        $topoptions = '';
    }
    //================================================================
    //	build it in the correct order
    //================================================================
    if (!isset($label)) {
        $label = _PC_TPL_VIEW_SUBMIT;
    }
    $submit = "<input type=\"submit\" valign=\"middle\" name=\"submit\" value=\"{$label}\" class=\"{$class}\" />";
    $orderArray = array('user' => $useroptions, 'category' => $catoptions, 'topic' => $topoptions, 'jump' => $submit);
    if (isset($order)) {
        $newOrder = array();
        $order = explode(',', $order);
        foreach ($order as $tmp_order) {
            array_push($newOrder, $orderArray[$tmp_order]);
        }
        foreach ($orderArray as $key => $old_order) {
            if (!in_array($key, $newOrder)) {
                array_push($newOrder, $orderArray[$old_order]);
            }
        }
        $order = $newOrder;
    } else {
        $order = $orderArray;
    }
    foreach ($order as $element) {
        echo $element;
    }
    if (!in_array('user', $types)) {
        echo $output->FormHidden('pc_username', $pc_username);
    }
}