include_once $modx->config['base_path'] . 'assets/modules/easy_board/easy_board.config.php'; include_once $modx->config['base_path'] . 'assets/modules/easy_board/easy_board.inc.php'; // Формирование ответа для ajax запросов if (isset($_GET[act])) { if ($_GET[act] == "del" and isset($_GET[item_id])) { $item_id = (int) $_GET[item_id]; delImage($item_id, $mod_table); $modx->db->delete($mod_table, "id = {$item_id}"); die("Запись №{$item_id} удалена"); } if ($_GET[act] == "pub" and isset($_GET[item_id])) { $item_id = (int) $_GET[item_id]; $fields = array('published' => 1); $query = $modx->db->update($fields, $mod_table, "id = {$item_id}"); die('<a href="#" title="Отменить публикацию" onclick="ItemAjax(\'unpub\', \'' . $item_id . '\', \'pub\');return false"> <img style="margin-top:11px;" src="' . $modx->config['site_url'] . 'assets/modules/easy_board/images/published1.png" /></a>'); } if ($_GET[act] == "unpub" and isset($_GET[item_id])) { $item_id = (int) $_GET[item_id]; $fields = array('published' => 0); $query = $modx->db->update($fields, $mod_table, "id = {$item_id}"); die('<a href="#" title="Опубликовать" onclick="ItemAjax(\'pub\', \'' . $item_id . '\', \'pub\');return false"> <img style="margin-top:11px;" src="' . $modx->config['site_url'] . 'assets/modules/easy_board/images/published0.png" /></a>'); } if ($_GET[act] == "delpic" and isset($_GET[item_id])) { delImage((int) $_GET[item_id], $mod_table); $fields = array('image' => ""); $query = $modx->db->update($fields, $mod_table, "id = " . (int) $_GET[item_id]); die("<input name=\"image\" type=\"file\" />"); } }
/** * gallery meta delete */ public function metaDel() { $delIds = array(); $postIds = $this->_post('id'); if (!empty($postIds)) { $delIds = $postIds; } $getId = intval($this->_get('id')); if (!empty($getId)) { $delIds[] = $getId; } if (empty($delIds)) { echo json_encode(array('code' => '0', 'msg' => '请选择您要删除的数据')); exit; } $map['id'] = array('in', $delIds); $paths = D('GalleryMeta')->where($map)->getField('path', true); foreach ($paths as $k => $v) { delImage($v); } if (D('GalleryMeta')->where($map)->delete()) { echo json_encode(array('code' => '1', 'msg' => '删除成功')); } else { echo json_encode(array('code' => '0', 'msg' => '删除失败')); } }