kopia lustrzana https://github.com/magicbug/Cloudlog
impemented del_fav
rodzic
e86b0a2f86
commit
baa3724da9
|
@ -11,6 +11,9 @@ class User_Options extends CI_Controller {
|
|||
|
||||
public function add_edit_fav() {
|
||||
$obj = json_decode(file_get_contents("php://input"), true);
|
||||
foreach($obj as $option_key => $option_value) {
|
||||
$obj[$option_key]=$this->security->xss_clean($option_value);
|
||||
}
|
||||
if ($obj['sat_name'] ?? '' != '') {
|
||||
$option_name=$obj['sat_name'];
|
||||
} else {
|
||||
|
@ -19,7 +22,7 @@ class User_Options extends CI_Controller {
|
|||
return $this->user_options_model->set_option('Favourite',$option_name, $obj);
|
||||
}
|
||||
|
||||
public function get_favs() {
|
||||
public function get_fav() {
|
||||
$result=$this->user_options_model->get_options('Favourite');
|
||||
foreach($result->result() as $options) {
|
||||
$jsonout[$options->option_name][$options->option_key]=$options->option_value;
|
||||
|
@ -27,6 +30,16 @@ class User_Options extends CI_Controller {
|
|||
header('Content-Type: application/json');
|
||||
echo json_encode($jsonout);
|
||||
}
|
||||
|
||||
public function del_fav() {
|
||||
$result=$this->user_options_model->get_options('Favourite');
|
||||
$obj = json_decode(file_get_contents("php://input"), true);
|
||||
if ($obj['option_name'] ?? '' != '') {
|
||||
$option_name=$this->security->xss_clean($obj['option_name']);
|
||||
$this->user_options_model->del_option('Favourite',$option_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,12 @@ class User_options_model extends CI_Model {
|
|||
return $this->db->query($sql, array($uid, $option_type));
|
||||
}
|
||||
|
||||
public function del_option($option_type, $option_name) {
|
||||
$uid=$this->session->userdata('user_id');
|
||||
$sql='delete from user_options where user_id=? and option_type=? and option_name=?';
|
||||
return $this->db->query($sql, array($uid, $option_type,$option_name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Ładowanie…
Reference in New Issue