public function update_specialty() { $this->use->use_model('data_base'); $this->use->use_lib('table/tpl_specialty'); $tpl = new tpl_specialty(); $db = new data_base($tpl->table(), array($tpl->id_college() => $_POST['name_college_update'], $tpl->name() => $_POST['name_update']), array($tpl->id() => $_POST['id'])); echo json_encode(array('valid' => $db->change(), 'massage' => '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>Update success </strong></div>')); }
public function ajax_students() { $db = new data_base(tpl_specialty::specialty(), array(tpl_specialty::id(), tpl_specialty::active(), tpl_specialty::name(), data_base::select_multiple_table(tpl_college::college(), tpl_college::college() . '.' . tpl_college::id(), tpl_specialty::specialty() . '.' . tpl_specialty::id_college(), tpl_college::name(), tpl_college::college() . '_' . tpl_college::name()), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id_specialty(), tpl_specialty::specialty() . '.' . tpl_specialty::id(), 'COUNT(' . tpl_students::id() . ')', tpl_students::students() . '_' . tpl_students::id()))); echo json_encode($db->get()); }
public function get_all_specialty() { if (isset($_POST['id_college'])) { $id = $_POST['id_college']; if (!empty($id)) { $db = new data_base(tpl_specialty::specialty(), array(tpl_specialty::id(), tpl_specialty::name()), array(tpl_specialty::id_college() => $id, tpl_specialty::active() => 1)); $data = $db->get_where(); $w = ' <option></option>'; foreach ($data as $row) { $w = $w . '<option value="' . $row[tpl_specialty::id()] . '">' . $row[tpl_specialty::name()] . '</option>'; } echo $w; } else { echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error empty')); } } else { echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error isset')); } }
echo tpl_specialty::specialty() . '_' . tpl_specialty::name() . '_update'; ?> "/> </div> <div class="form-group"> <label>College <?php echo tpl_specialty::specialty(); ?> : </label> <select name="<?php echo tpl_specialty::specialty() . '_' . tpl_specialty::id_college() . '_update'; ?> " id="<?php echo tpl_specialty::specialty() . '_' . tpl_specialty::id_college() . '_update'; ?> " class="form-control"> <?php $new = new specialty_lib_ad(); echo $new->find_college(); ?> </select> </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 class="table-responsive"> <table id="table" data-toggle="table" data-url="<?php echo site_url('admin/find_all_Specialty_table_ajax'); ?> " 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" data-toolbar="#toolbar"> <thead> <tr> <th data-field="<?php echo $tpl_specialty->id(); ?> " data-halign="center" data-sortable="true"> ID</th> <th data-field="<?php echo $tpl_specialty->id_college() . '_name'; ?> " data-halign="center" data-sortable="true"> College</th> <th data-field="<?php echo $tpl_specialty->name(); ?> " data-halign="center" data-sortable="true"> Specialty</th> <th data-field="operate" data-formatter="operateFormatter" data-events="operateEvents" data-align="center" >Action </th> </tr>