예제 #1
0
 function form_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];
         if ($get_vars["drug_id"]) {
             $sql = "select drug_id, drug_name, drug_cat, drug_preparation, drug_formulation, manufacturer_id, drug_source, admin_desc ".
                    "from m_lib_drugs where drug_id = '".$get_vars["drug_id"]."'";
             if ($result = mysql_query($sql)) {
                 if (mysql_num_rows($result)) {
                     $drug = mysql_fetch_array($result);
                 }
             }
         }
     }
     print "<table width='400'>";
     print "<form action = '".$_SERVER["SELF"]."?page=LIBRARIES&menu_id=$menu_id' name='form_drug' method='post'>";
     print "<tr valign='top'><td>";
     print "<span class='library'>".FTITLE_DRUG_FORM."</span><br><br>";
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>".LBL_DRUG_NAME."</span><br> ";
     print "<input type='text' class='textbox' size='25' maxlength='50' name='drug_name' value='".($drug["drug_name"]?$drug["drug_name"]:$post_vars["drug_name"])."' style='border: 1px solid #000000'><br>";
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>".LBL_DRUG_CATEGORY."</span><br> ";
     print drug::show_drugcat($drug["drug_cat"]);
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>".LBL_DRUG_PREPARATION."</span><br> ";
     print drug::show_drugprep($drug["drug_preparation"]);
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>".LBL_DRUG_FORMULATION."</span><br> ";
     print drug::show_drugform($drug["drug_formulation"]);
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>".LBL_DRUG_MANUFACTURER."</span><br> ";
     print drug::show_drugmanufacturer($drug["manufacturer_id"]);
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>".LBL_DRUG_SOURCE."</span><br> ";
     print drug::show_drugsource($drug["drug_source"]);
     print "</td></tr>";
     print "<tr valign='top'><td>";
     print "<span class='boxtitle'>".LBL_ADMIN_DESC."</span><br> ";
     print "<textarea class='textbox' rows='5' cols='40' name='admin_desc' style='border: 1px solid #000000'>".($drug["admin_desc"]?$drug["admin_desc"]:$post_vars["admin_desc"])."</textarea><br>";
     print "</td></tr>";
     print "<tr><td><br>";
     if ($get_vars["drug_id"]) {
         print "<input type='hidden' name='drug_id' value='".$get_vars["drug_id"]."'>";
         if ($_SESSION["priv_update"]) {
             print "<input type='submit' value = 'Update Drug' class='textbox' name='submitdrug' style='border: 1px solid #000000'> ";
         }
         if ($_SESSION["priv_delete"]) {
             print "<input type='submit' value = 'Delete Drug' class='textbox' name='submitdrug' style='border: 1px solid #000000'> ";
         }
     } else {
         if ($_SESSION["priv_add"]) {
             print "<input type='submit' value = 'Add Drug' class='textbox' name='submitdrug' style='border: 1px solid #000000'> ";
         }
     }
     print "</td></tr>";
     print "</form>";
     print "</table><br>";
 }