public function update_image_students() { $this->use->use_model('data_base'); $this->use->use_lib('table/tpl_slider'); $this->use->use_lib('system/image/class_upload_image'); $tpl = new tpl_slider(); $image = new class_upload_image('image_update', 'include/img/slider'); if ($image->get_type() == 'image/png' || $image->get_type() == 'image/jpeg') { if ($image->get_error()) { $image_path = $image->move_file(); if ($image_path == false) { echo json_encode(array('valid' => false)); } else { $db = new data_base($tpl->table(), array($tpl->image() => $image_path), array($tpl->id() => $_POST['id_image_update'])); if ($db->change()) { echo json_encode(array('valid' => true, 'image' => $image_path)); } else { echo json_encode(array('valid' => false)); } } } else { echo json_encode(array('valid' => false)); } } else { echo json_encode(array('valid' => false)); } }
public function find_slider() { $this->use->use_model('data_base'); $this->use->use_lib('table/tpl_slider'); $tpl = new tpl_slider(); $db = new data_base($tpl->table(), array($tpl->id(), $tpl->text(), $tpl->image()), array($tpl->status() => 1)); return $db->get_where(); }