/** * 删除专题 * */ public function action_del() { $id = $this->getRequest('sid'); if (!is_array($id)) { $id = array($id); } if (empty($id)) { $this->show_message('请选择要删除的专题'); } $tag = new Tags(); foreach ($id as $value) { DB::delete('specialpics')->where('sid', '=', $value)->execute(); DB::delete('comments')->where('item_id', '=', $value)->where('app', '=', 'img_subject')->execute(); $tag->del($value, 'img_subject'); } $this->request->redirect('/admin/picsubject/list'); $this->auto_render = false; }
if (!empty($_GET['id'])) { $id = intval($_GET['id']); } if ($do == "edit") { if ($id) { setvar("item", $tag->read("*", $id)); } $tpl_file = "tag.edit"; template($tpl_file); exit; } if ($do == "search" && !empty($_GET['q'])) { $conditions[] = "Tag.name like '%" . trim($_GET['q']) . "%'"; } if ($do == "del" && !empty($id)) { $tag->del($id); } } if (isset($_POST['del']) && !empty($_POST['id'])) { $tag->del($_POST['id']); } if (isset($_POST['save']) && !empty($_POST['data']['tag'])) { if (isset($_POST['id'])) { $id = intval($_POST['id']); } if ($id) { $tag->save($_POST['data']['tag'], "update", $id); } else { $tag->save($_POST['data']['tag']); } }
/** * 删除专题 * */ public function action_delsubject() { $this->checklogin(); $sid = (int) $this->getQuery('sid'); if (empty($sid)) { $this->show_message('请选择要删除的专题'); } DB::delete('specialpics')->where('sid', '=', $sid)->execute(); $go_url = '/picsubject/list'; $tag = new Tags(); $tag->del($sid, 'img_subject'); $this->request->redirect($go_url); $this->auto_render = false; }