public function generate_resource_booking_settings() { $rb = new Resource_Booking(); // Get something like plugins/resource-booking/ $rb_plugin_dir = $rb->get_plugin_dir(); //$css_bootstrap = $rb_plugin_dir . 'css/bootstrap.min.css'; wp_enqueue_style("bootstrap", $rb_plugin_dir . 'css/bootstrap.css'); wp_enqueue_style('bootstrap-datetimepicker', $rb_plugin_dir . 'css/bootstrap-datetimepicker.min.css'); wp_enqueue_style('chosen-jquery', $rb_plugin_dir . 'css/bootstrap-chosen.css'); wp_enqueue_script("bootstrap", "//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js", array("jquery"), "", true); wp_enqueue_script('moment', $rb_plugin_dir . 'js/libraries/moment.min.js', array("jquery"), "", true); wp_enqueue_script("bootstrap-datetimepicker", $rb_plugin_dir . "js/libraries/bootstrap-datetimepicker.min.js", array("bootstrap", "moment"), "", true); wp_enqueue_script("chosen-jquery", $rb_plugin_dir . "js/libraries/chosen.jquery.js", array("jquery"), "", true); wp_enqueue_script('calendarOpts', $rb_plugin_dir . 'js/calendarOpts.js', array('jquery'), "", true); wp_enqueue_script('resources-management', $rb_plugin_dir . 'js/resources-management.js', array('jquery'), "", true); wp_localize_script('resources-management', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php'), 'we_value' => 1234)); ?> <section> <header><h1>Resource Bookings Settings</h1></header> <div class="container"> <div class="row"> <p>From this page, the lab manager can ...</p> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label for="select-resources" class="col-md-2 control-label">Select a resource:</label> <div class="col-md-6"> <select class="form-control" id="select-resources" name="select-resources"> <optgroup label='Apply to al resources'> <option value='none'></option> <option value='all'>---All resources---</option> </optgroup> <?php $resourcesA = get_resource_list(); foreach ($resourcesA as $type => $r) { $type = ucwords($type); echo "<optgroup label='{$type}'>"; foreach ($r as $resource) { $value = $resource->resource_id; $title = $resource->resource_name; echo "<option value='{$value}'>{$title}</option>"; } echo "</optgroup>"; } ?> </select> </div> </div> </div> </div> <div class="row"> <p>Or select only a type of resource</p> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label for="select-types" class="col-md-2 control-label">Select a resource type:</label> <div class="col-md-6"> <select class="form-control" id="select-types" name="select-types"> <option value='none'></option> <?php $resources_types = get_resources_types_list(); foreach ($resources_types as $type) { $value = $type->resource_type; $title = ucwords($value); echo "<option value='{$value}'>{$title}</option>"; } ?> </select> </div> </div> </div> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label for="select-reasons" class="col-md-2 control-label">Select a reason:</label> <div class="col-md-6"> <select class="form-control" id="select-reasons" name="select-reasons"> <option value="1">Clean room closed</option> <option value="2">Machine(s) out of work</option> <option value="3">Holidays</option> <option value="0">Available again</option> </select> </div> </div> </div> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label for="notify-users" class="col-md-2 control-label">Notify users via email:</label> <div class="col-md-6"> <input type="checkbox" class="form-control" id="notify-users" name="notify-users"> </div> </div> </div> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label for="notify-users" class="col-md-2 control-label">From:</label> <div class="col-md-6"> <div class='input-group date col-md-4' id='datetimepickerFrom'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> </div> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label for="notify-users" class="col-md-2 control-label">To:</label> <div class="col-md-6"> <div class='input-group date col-md-4' id='datetimepickerTo'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> </div> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label for="duration" class="col-md-2 control-label">Duration:</label> <div class="col-md-6 form-control-static"> <p id="duration" /> </div> </div> </div> </div> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <div class="col-md-8 col-md-offset-2"> <input class="btn btn-default" type="submit" value="Submit" id="buttonSubmit"> </div> </div> </div> </div> </div> <!-- Modal Alert--> <div class="modal fade" id="modalAlert" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Message</h4> </div> <div class="modal-body"> <form class="form-horizontal"> <div class="form-group"> <label for="errorMessageDiv" class="col-md-2 control-label">Message:</label> <div class="col-md-8"> <div id="errorMessageDiv" class="form-control-static"></div> </div> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> </div> </div> </div> </div><!-- End Modal Alert--> </section> <?php }
/** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 1.0.0 */ function run_resource_booking() { $plugin = new Resource_Booking(); $plugin->run(); }