function save_orderlist($id = FALSE) { if ($_POST) { foreach ($_POST['orderlist'] as $key => $item) { if ($item) { $gallery = new Gallery(@$_POST['orderid'][$key]); $gallery->from_array(array('orderlist' => $item)); $gallery->save(); } } set_notify('success', lang('save_data_complete')); } redirect($_SERVER['HTTP_REFERER']); }
function save($cat_id, $id = FALSE) { if ($_POST) { $gallery = new Gallery($id); if ($_FILES['image']['name']) { if ($gallery->id) { $gallery->delete_file($gallery->id, 'uploads/galleries/', 'image'); } $_POST['image'] = $gallery->upload($_FILES['image'], 'uploads/galleries/'); $gallery->thumb('uploads/galleries/thumbs/', 170, 120); } $_POST['user_id'] = $this->session->userdata('id'); $gallery->from_array($_POST); $gallery->save(); set_notify('success', lang('save_data_complete')); } redirect('galleries/admin/galleries/form/' . $cat_id); }