コード例 #1
0
function hmgt_add_category()
{
    global $wpdb;
    $model = $_REQUEST['model'];
    $array_var = array();
    $data['category_name'] = $_REQUEST['medicine_cat_name'];
    if ($model == 'medicine') {
        $obj_medicine = new Hmgtmedicine();
        $obj_medicine->hmgt_add_medicinecategory($data);
        $id = $wpdb->insert_id;
    }
    if ($model == 'department') {
        $user_object = new Hmgtuser();
        $user_object->add_staff_department($data);
        $id = $wpdb->insert_id;
    }
    if ($model == 'bedtype') {
        $bed_type = new Hmgtbedmanage();
        $bed_type->hmgt_add_bedtype($data);
        $id = $wpdb->insert_id;
    }
    if ($model == 'specialization') {
        $user_object = new Hmgtuser();
        $user_object->add_doctor_specilize($data);
        $id = $wpdb->insert_id;
    }
    if ($model == 'operation') {
        $operation_type = new Hmgt_operation();
        $operation_type->hmgt_add_operationtype($data);
        $id = $wpdb->insert_id;
    }
    if ($model == 'report_type') {
        $report_type = new Hmgt_dignosis();
        $report_type->hmgt_add_report_type($data);
        $id = $wpdb->insert_id;
    }
    $row1 = '<tr id="cat-' . $id . '"><td>' . $_REQUEST['medicine_cat_name'] . '</td><td><a class="btn-delete-cat badge badge-delete" href="#" id=' . $id . '>X</a></td></tr>';
    $option = "<option value='{$id}'>" . $_REQUEST['medicine_cat_name'] . "</option>";
    $array_var[] = $row1;
    $array_var[] = $option;
    echo json_encode($array_var);
    die;
}
コード例 #2
0
<?php

$obj_medicine = new Hmgtmedicine();
if (isset($_REQUEST['save_category'])) {
    $result = $obj_medicine->hmgt_add_medicinecategory($_POST);
    if ($result) {
        ?>
			<div id="message" class="updated below-h2">
			<?php 
        _e('Record inserted successfully', 'hospital_mgt');
        ?>
</div><?php 
    }
}
if (isset($_REQUEST['save_medicine'])) {
    if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'insert' || $_REQUEST['action'] == 'edit')) {
        $result = $obj_medicine->hmgt_add_medicine($_POST);
        if ($result) {
            if ($_REQUEST['action'] == 'edit') {
                wp_redirect(home_url() . '?dashboard=user&page=medicine&tab=medicinelist&message=2');
            } else {
                wp_redirect(home_url() . '?dashboard=user&page=medicine&tab=medicinelist&message=1');
            }
        }
    }
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
    $result = $obj_medicine->delete_medicine($_REQUEST['medicine_id']);
    if ($result) {
        wp_redirect(home_url() . '?dashboard=user&page=medicine&tab=medicinelist&message=3');
    }