function save_orderlist($id = FALSE) { if ($_POST) { foreach ($_POST['orderlist'] as $key => $item) { if ($item) { $hilight = new Hilight(@$_POST['orderid'][$key]); $hilight->from_array(array('orderlist' => $item)); $hilight->save(); } } set_notify('success', lang('save_data_complete')); } redirect($_SERVER['HTTP_REFERER']); }
public function save($id = null) { if ($this->perm->can_create == 'y') { if ($_POST) { if ($_POST['id'] == '') { $show_no = $this->db->query("SELECT MAX(show_no)show_no FROM acm_hilights")->result(); $_POST['show_no'] = @$show_no[0]->show_no < 1 ? 1 : $show_no[0]->show_no + 1; $_POST['created_by'] = $this->current_user->id; } else { $_POST['updated_by'] = $this->current_user->id; } $data = new Hilight($id); $data->from_array($_POST); $data->save(); $action = $_POST['id'] > 0 ? "UPDATE" : "CREATE"; save_logs($this->menu_id, $action, $data->id, $action . ' Hilights '); } } redirect("admin/hilights"); }