<?php include '../../script/pdocrud.php'; ?>
<?php include 'includes/header.php'; ?>

<body class="hold-transition skin-blue sidebar-mini">
    <!-- Site wrapper -->
    <div class="wrapper">
        <?php include 'includes/topheader.php'; ?>
        <?php include 'includes/sidebar.php'; ?>
        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    Image Preview Plugin example
                </h1>
            </section>

            <!-- Default box -->
            <div class="box">                
                <div class="box-body">                    
                    <div class="box-function-ref">
                        <section class="code-section">
                            <pre class="brush: php;">  
                            $pdocrud = new PDOCrud();
                            $pdocrud->addPlugin("image-preview");//to add plugin      
                            $pdocrud->formFields(array("product_image"));
                            $pdocrud->fieldCssClass("product_image", array("class1"));// add css classes
                            $pdocrud->fieldTypes("product_image", "image");
                            echo $pdocrud->dbTable("producttable")->render("insertform");
                            echo $pdocrud->loadPluginJsCode("image-preview",".class1");//to add plugin call on input[type=number] elements
                            </pre>
                        </section>  
                    </div>
                </div>
            </div>  

            <!-- Main content -->
            <section class="content">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">Plugin image preview example - PDOCrud</h3>
                        <div class="box-tools pull-right">
                            <button class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i class="fa fa-minus"></i></button>
                        </div>
                    </div>
                    <div class="box-body">
                          <!-- bootstrap-imageupload. -->
          
                        <div class="box-body table-responsive no-padding">
                            <?php
                            $pdocrud = new PDOCrud();
                            $pdocrud->addPlugin("image-preview");//to add plugin      
                            $pdocrud->formFields(array("product_image"));//optional showing only field type file
                            $pdocrud->fieldTypes("product_image", "image_preview");//change type of image preview
                            $pdocrud->crudTableCol(array("product_image","product_id","product_name"));//optional showing only few columns
                            echo $pdocrud->dbTable("producttable")->render();
                            echo $pdocrud->loadPluginJsCode("image-preview",".imageupload");//to add plugin call on class imageupload to make it work
                            ?>
                        </div><!-- /.box-body -->
                    </div>
                </div>
            </section><!-- /.content -->
        </div><!-- /.content-wrapper -->
    </div><!-- ./wrapper -->
    <?php include 'includes/footer.php'; ?>   
        
</body>
</html>