Exemplo n.º 1
0
 function display_drug() {
     if (func_num_args()) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
         $validuser = $arg_list[3];
         $isadmin = $arg_list[4];
     }
     print "<table width='550' cellspacing='0' cellpadding='2'>";
     print "<tr valign='top'><td colspan='3'>";
     print "<span class='library'>".FTITLE_DRUG_LIST."</span><br>";
     print "</td></tr>";
     print "<tr valign='top' bgcolor='#CCCCCC'><td><b>ID</b></td>".
           "<td><b>".THEAD_NAME."</b></td>".
           "<td><b>".THEAD_PREP."</b></td>".
           "<td><b>".THEAD_FORM."</b></td>".
           "<td><b>".THEAD_SOURCE."</b></td>".
           "<td><b>".THEAD_MAN."</b></td>".
           "</tr>";
     $sql = "select drug_id, drug_name, drug_cat, drug_preparation, drug_formulation, ".
            "manufacturer_id, drug_source, admin_desc ".
            "from m_lib_drugs order by drug_cat, drug_name";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while (list($id, $name, $cat, $prep, $form, $man, $src) = mysql_fetch_array($result)) {
                 if ($prev_cat<>$cat) {
                     print "<tr valign='top' bgcolor='#FFCC00'><td colspan='6'><b>".strtoupper(drug::get_category_name($cat))."</b></td></tr>";
                 }
                 print "<tr valign='top' bgcolor='white'>";
                 print "<td>$id</td><td><a href='".$_SERVER["SELF"]."?page=LIBRARIES&menu_id=$menu_id&drug_id=$id'>$name</a></td>";
                 print "<td>".$prep."</td>";
                 print "<td>".drug::get_formulation_name($form)."</td>";
                 print "<td>".$src."</td>";
                 print "<td>".$man."</td>";
                 print "</tr>";
                 $prev_cat = $cat;
             }
         } else {
             print "<tr><td colspan='6'><font color='red'>No drugs in database.</font></td></tr>";
         }
     }
     print "</table><br>";
 }