public function update() { $id = $_POST[tpl_degree::degree() . '_' . tpl_degree::id() . '_update']; $name = $_POST[tpl_degree::degree() . '_' . tpl_degree::name() . '_update']; $star_number = $_POST[tpl_degree::degree() . '_' . tpl_degree::star_number() . '_update']; $db = new data_base(tpl_degree::degree(), array(tpl_degree::name() => $name, tpl_degree::star_number() => $star_number, tpl_degree::date_in() => date_time::Date_time_24()), array(tpl_degree::id() => $id)); $results = $db->change(); if ($results) { echo json_encode(array('valid' => 1, 'title' => 'Successfully !!', 'massage' => 'I\'ve been Update ' . $name)); } else { echo json_encode(array('valid' => 0, 'title' => 'Oops !!', 'massage' => 'Was not Update ' . $name . ', please try again')); } }
public function ajax_degree() { $db = new data_base(tpl_degree::degree(), array(tpl_degree::id(), tpl_degree::name(), tpl_degree::star_number()), array(tpl_degree::active() => 1)); echo json_encode($db->get_where()); }
" data-cache="false" data-height="400" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-pagination="true" data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-flat="true"> <thead> <tr> <th data-field="<?php echo tpl_degree::id(); ?> " data-halign="center" data-sortable="true"> ID</th> <th data-field="<?php echo tpl_degree::name(); ?> " data-halign="center" data-sortable="true"> Name <th data-field="<?php echo tpl_degree::star_number(); ?> " data-halign="center" data-sortable="true"># star </th> </tr> </thead> </table> </div> </div> <div class="col-sm-4"> <h3 class="page-header">Department</h3> <div class="table-responsive"> <table id="tpl_ajax_department" data-toggle="table" data-url="<?php echo site_url('admin/home/ajax_department'); ?>
echo tpl_degree::degree() . '_' . tpl_degree::name() . '_update'; ?> "/> </div> <div class="form-group"> <label for=""><?php echo tpl_degree::star_number() . ' ' . tpl_degree::degree(); ?> : </label> <input type="text" class="form-control" id="<?php echo tpl_degree::degree() . '_' . tpl_degree::star_number() . '_update'; ?> " name="<?php echo tpl_degree::degree() . '_' . tpl_degree::star_number() . '_update'; ?> "/> </div> <button type="submit" class="btn btn-success" id="update" name="update">Save</button> </form> </br> </br> <div class="" id="result_massages_update"></div> </div> </div> </div> </div>