Example #1
0
    start_column();
    space();
    //spasi
    end_column();
    //div button
    start_div("class='btn-toolbar list-toolbar'");
    if ($_POST['AddNew'] != 'update') {
        //add new
        submit_button('submit', '<i class="fa fa-save"></i> Add', "class='btn btn-primary'");
    } else {
        //update
        input_hidden('id', $val_selected['id']);
        submit_button('submit_update', '<i class="fa fa-save"></i> Update', "class='btn btn-primary'");
    }
    //link kembali ke table
    link_text("?" . $parameter_key . "kd_tabel=tb_categories", 'kembali', "class='btn btn-danger'");
    end_div();
    end_row();
    end_table();
    end_div();
} else {
    //-------------------------------DISPLAY-----------------------------------------
    submit_button('AddNew', '<i class="fa fa-plus"></i> Add New', "class='btn btn-primary'");
    br();
    start_table(" class='table table-bordered table-striped table-hover' ");
    $head = array('Id Category', 'Category Name', 'Description', 'Action');
    head_table($head);
    //display dengan fungsi rekursif
    display_categories(0, '');
    end_table();
}
Example #2
0
    space();
    //spasi
    end_column();
    start_column();
    if ($_POST['AddNew'] != 'update') {
        //add new
        submit_button('submit', 'Add');
    } else {
        //update
        input_hidden('id', $val_selected['id']);
        submit_button('submit_update', 'Update');
    }
    end_column();
    end_row();
    end_table();
    link_text("?" . $parameter_key . "kd_tabel=tb_stores", '<- kembali');
} else {
    //-------------------------------DISPLAY-----------------------------------------
    submit_button('AddNew', 'Add New');
    $sql = sql_display_table_master_stores();
    $query = db_query($sql);
    $jumlah = db_num_rows($query);
    br();
    echo "Jumlah data : " . $jumlah;
    br(2);
    start_table("border='3px' class='data display datatable' id='example' width='80%'");
    $head = array('Id Store', 'Store Name', 'Description', 'Address', 'Contact', 'Person Name', 'Action');
    head_table($head);
    while ($row = db_fetch($query)) {
        start_row("class='odd gradeX'");
        text_cell($row['id'], "align='center'");
        if (empty($id_item)) {
            //tidak ada parameter get id_item
            text_cell($row['item_code'], "align='left'");
            text_cell($row['item_name'], "align='left'");
        }
        text_cell($row['id_category'], "align='center'");
        text_cell($row['category_name'], "align='left'");
        //text_cell($row['description'], "align='left'");
        start_column("align='center' ");
        delete_link('tb_maping_item_category', $row['id'], $_SESSION['key'], "", "item=" . $id_item);
        end_column();
        end_row();
        $no++;
    }
    //ini satu item yang akan dikirim ke halaman form butuh item nya biar tidak bisa dirubah
    $item_ = $find_item['item_code'] . " >> " . $find_item['item_name'];
    if (!empty($id_item)) {
        input_hidden("item_name", $item_);
        input_hidden("id_item", $id_item);
        //parameter post id item untuk dikirim ke halaman form
    }
    end_table();
    if (!empty($id_item)) {
        link_text("?" . $parameter_key . "kd_tabel=tb_items", '<- kembali', "class='btn btn-default'");
    }
}
end_form();
br();
//end div kotak
end_div();
//------------------------------------------------------------------------------