function mainDelete($get) { $recno = isset($get['recno']) && $get['recno'] != '' ? htmlspecialchars($get['recno']) : -1; $uuid = isset($get['uuid']) && $get['uuid'] != '' ? htmlspecialchars($get['uuid']) : ''; $id = isset($_REQUEST['id']) && $_REQUEST['id'] != '' ? htmlspecialchars($_REQUEST['id']) : ''; if ($recno < 0 && $uuid == '' & $id == '') { Debugger::log('[micka_main_lib.mainDelete] ' . "Not complete input data! recno={$recno}, uuid={$uuid}, id={$id}", 'ERROR'); require PHPINC_DIR . '/templates/404_record.php'; } $rs = array(); $rs['akce'] = 'error'; $rs['ok'] = FALSE; $rs['report'] = ''; $rs['data'] = ''; if ($id != '') { $md_record = new MdRecord(); $id_arr = explode(",", $id); foreach ($id_arr as $key => $value) { $uuid = trim($value); if ($uuid != '') { $where_col = 'uuid'; $where_value = $uuid; $del_report = $md_record->deleteMdRecords($where_col, $where_value); $rs['report'][$uuid] = $del_report['report']; } } $rs['akce'] = 'json'; } else { $where_col = $recno > 0 ? 'recno' : 'uuid'; $where_value = $recno > 0 ? $recno : $uuid; $md_record = new MdRecord(); $del_report = $md_record->deleteMdRecords($where_col, $where_value); if ($del_report['report'] != 'ok') { $rs['report'] = $del_report['report']; Debugger::log('[micka_main_lib.mainDelete] ' . $del_report['report'], 'ERROR'); require PHPINC_DIR . '/templates/404_record.php'; return $rs; } if ($where_col == 'recno') { $rs['akce'] = 'search'; } else { $rs['akce'] = 'window_close'; } } if ($rs['akce'] == 'search') { $redirectUrl = getUrlSearchFromSession(); } else { $redirectUrl = ''; } //return $rs; return $redirectUrl; }
private function deleteRecord() { $rs = array(); $report = array(); $md_record = new MdRecord(); $md_record->setTableMode('md'); foreach ($this->md_head as $key => $row) { $report = $md_record->deleteMdRecords('uuid', $row['uuid']); if ($report['report'] == 'ok') { $this->setReport($key, 'info', ''); $this->md_head[$key]['ok'] = 1; } else { $this->setReport($key, 'info', $report['report']); $this->md_head[$key]['ok'] = 0; } } return $rs; }