public function widget($args, $instance) { echo $args["before_widget"]; echo $args["before_title"] . __("Find Tutor", "ttr-db") . $args["after_title"]; $s_url = get_site_url() . "/tutor_search"; ?> <form class="search_widget_form" action="<?php echo $s_url; ?> "> <!-- Province Group --> <div class="form-group"> <label for="province"><?php _e("Province", "ttr-db"); ?> :</label> <select name="province" id="province" class="form-control"> <option value="-1"><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> </div> <!-- City Group --> <div class="form-group"> <label for="city"><?php _e("City", "ttr-db"); ?> :</label> <select name="city" id="city" class="form-control" disabled></select> </div> <!-- Subject Group --> <div class="form-group"> <label for="subject"><?php _e("Subject", "ttr-db"); ?> :</label> <select class="form-control" id="subject" name="subject"> <option value="-1"><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> </div> <!-- Age Group --> <div class="form-group"> <label for="age"><?php _e("Age", "ttr-db"); ?> :</label> <!--<input type="text" class="form-control" id="age" name="age" value="<?php echo $_REQUEST['age']; ?> ">--> <select class="form-control age" id="age" name="age"> <option value="-1"><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> </div> <button type="submit" id="search_btn" style="float:right;" class="btn btn-default" name="action" value="search" disabled> <?php _e("Search", "ttr-db"); ?> <span class="glyphicon glyphicon-search"></span> </button> </form> <!-- Added Admin Scripts --> <?php if (isset($_REQUEST['action']) && $_REQUEST['action'] === "search") { ttr_db_admin_script($_REQUEST['city'], $_REQUEST['province'], $_REQUEST['subject'], $_REQUEST['age']); } else { ttr_db_admin_script(); } ?> <?php echo $args["after_widget"]; }
function ttr_db_admin_form($id = -1, $fname = "", $lname = "", $mname = "", $min_age = "", $max_age = "", $province = "", $city = "", $subject = "", $descp = "") { $lst_page = get_site_url() . "/wp-admin/admin.php?page=tutor-database"; ttr_db_admin_script($city, $province, $subject, "", $min_age, $max_age); ?> <div class="warp"> <h1><?php _e("Add Tutor", "ttr-db"); ?> </h1> <div id="tutor-form"> <form method="post" action="<?php echo $lst_page; ?> "> <table class="form-edit"> <!-- Last, First, Middle Names --> <tr> <td> <label for="lname"><?php _e("Last Name", "ttr-db"); ?> :</label> </td> <td> <input type="text" name="lname" class="form-obj" id="lname" value="<?php echo $lname; ?> "> </td> </tr> <tr> <td> <label for="fname" class="form-obj"><?php _e("First Name", "ttr-db"); ?> :</label> </td> <td> <input type="text" name="fname" class="form-obj" id="fname" value="<?php echo $fname; ?> "> </td> </tr> <tr> <td> <label for="mname" class="form-obj"><?php _e("Middle Name", "ttr-db"); ?> :</label> </td> <td> <input type="text" name="mname" class="form-obj" id="mname" value="<?php echo $mname; ?> "> </td> </tr> <!-- Province And City --> <tr> <td> <label for="province"><?php _e("Province", "ttr-db"); ?> :</label> </td> <td> <select id="province" name="province"> <option disabled><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> </td> </tr> <tr> <td> <label for="city"><?php _e("City", "ttr-db"); ?> :</label> </td> <td> <select id="city" name="city"></select> </td> </tr> <!-- Age --> <tr> <td> <label for="age"><?php _e("Age", "ttr-db"); ?> :</label> </td> <td> <select class="age" name="min_age" id="min_age"> <option disabled><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> - <select class="age" name="max_age" id="max_age"> <option disabled><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> </td> </tr> <!-- Subject --> <tr> <td> <label for="subject"><?php _e("Subject", "ttr-db"); ?> :</label> </td> <td id="sbj_rw"> <div class="rw"> <select id="subject" class="sbj_sel"> <option disabled><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> <button type="button" id="new_sbj">+</button> <input type="hidden" id="sbj_sel_itm" name="subject[]"> </div> <!--<div class="rw"> <select class="sbj_sel"> <option disabled><?php _e("-- SELECT --", "ttr-db"); ?> </option> </select> <button type="button" class="del_sbj">-</button> <input type="hidden" name="subject[]"> </div>--> </td> </tr> <!-- Description Textbox--> <tr> <td> <label for="descp"><?php _e("Description", "ttr-db"); ?> :</label> </td> <td> <textarea name="descp" id="descp"><?php echo $descp; ?> </textarea> </td> </tr> </table> <?php if ($id == -1) { ?> <?php wp_nonce_field('add-new-tutor'); ?> <button id="add_tutor" class="btn-default" name="action" value="add" type="submit"><?php _e("Add", "ttr-db"); ?> </button> <?php } else { ?> <?php wp_nonce_field('edit-tutor-data_' . $id); ?> <input type="hidden" name="id" value="<?php echo $id; ?> "> <button id="add_tutor" class="btn-default" name="action" value="upt" type="submit"><?php _e("Update", "ttr-db"); ?> </button> <?php } ?> </form> </div> </div> <?php }