@@ 271-338 (lines=68) @@ | ||
268 | * |
|
269 | * @param mixed $confirm |
|
270 | */ |
|
271 | public function doDrop($confirm) |
|
272 | { |
|
273 | $data = $this->misc->getDatabaseAccessor(); |
|
274 | ||
275 | if (empty($_REQUEST['matview']) && empty($_REQUEST['ma'])) { |
|
276 | return $this->doDefault($this->lang['strspecifyviewtodrop']); |
|
277 | } |
|
278 | ||
279 | if ($confirm) { |
|
280 | $this->printTrail('getTrail'); |
|
281 | $this->printTitle($this->lang['strdrop'], 'pg.matview.drop'); |
|
282 | ||
283 | echo '<form action="'.\SUBFOLDER.'/src/views/materializedviews" method="post">'.PHP_EOL; |
|
284 | ||
285 | //If multi drop |
|
286 | if (isset($_REQUEST['ma'])) { |
|
287 | foreach ($_REQUEST['ma'] as $v) { |
|
288 | $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); |
|
289 | echo '<p>', sprintf($this->lang['strconfdropview'], $this->misc->printVal($a['view'])), '</p>'.PHP_EOL; |
|
290 | echo '<input type="hidden" name="view[]" value="', htmlspecialchars($a['view']), '" />'.PHP_EOL; |
|
291 | } |
|
292 | } else { |
|
293 | echo '<p>', sprintf($this->lang['strconfdropview'], $this->misc->printVal($_REQUEST['matview'])), '</p>'.PHP_EOL; |
|
294 | echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST['matview']), '" />'.PHP_EOL; |
|
295 | } |
|
296 | ||
297 | echo '<input type="hidden" name="action" value="drop" />'.PHP_EOL; |
|
298 | ||
299 | echo $this->misc->form; |
|
300 | echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL; |
|
301 | echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL; |
|
302 | echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />".PHP_EOL; |
|
303 | echo '</form>'.PHP_EOL; |
|
304 | } else { |
|
305 | if (is_array($_POST['view'])) { |
|
306 | $msg = ''; |
|
307 | $status = $data->beginTransaction(); |
|
308 | if (0 == $status) { |
|
309 | foreach ($_POST['view'] as $s) { |
|
310 | $status = $data->dropView($s, isset($_POST['cascade'])); |
|
311 | if (0 == $status) { |
|
312 | $msg .= sprintf('%s: %s<br />', htmlentities($s, ENT_QUOTES, 'UTF-8'), $this->lang['strviewdropped']); |
|
313 | } else { |
|
314 | $data->endTransaction(); |
|
315 | $this->doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($s, ENT_QUOTES, 'UTF-8'), $this->lang['strviewdroppedbad'])); |
|
316 | ||
317 | return; |
|
318 | } |
|
319 | } |
|
320 | } |
|
321 | if (0 == $data->endTransaction()) { |
|
322 | // Everything went fine, back to the Default page.... |
|
323 | $this->misc->setReloadBrowser(true); |
|
324 | $this->doDefault($msg); |
|
325 | } else { |
|
326 | $this->doDefault($this->lang['strviewdroppedbad']); |
|
327 | } |
|
328 | } else { |
|
329 | $status = $data->dropView($_POST['view'], isset($_POST['cascade'])); |
|
330 | if (0 == $status) { |
|
331 | $this->misc->setReloadBrowser(true); |
|
332 | $this->doDefault($this->lang['strviewdropped']); |
|
333 | } else { |
|
334 | $this->doDefault($this->lang['strviewdroppedbad']); |
|
335 | } |
|
336 | } |
|
337 | } |
|
338 | } |
|
339 | ||
340 | /** |
|
341 | * Sets up choices for table linkage, and which fields to select for the view we're creating. |
@@ 396-463 (lines=68) @@ | ||
393 | * @param mixed $confirm |
|
394 | * @param mixed $msg |
|
395 | */ |
|
396 | public function doDrop($confirm, $msg = '') |
|
397 | { |
|
398 | $data = $this->misc->getDatabaseAccessor(); |
|
399 | ||
400 | if (empty($_REQUEST['sequence']) && empty($_REQUEST['ma'])) { |
|
401 | return $this->doDefault($this->lang['strspecifysequencetodrop']); |
|
402 | } |
|
403 | ||
404 | if ($confirm) { |
|
405 | $this->printTrail('sequence'); |
|
406 | $this->printTitle($this->lang['strdrop'], 'pg.sequence.drop'); |
|
407 | $this->printMsg($msg); |
|
408 | ||
409 | echo '<form action="'.\SUBFOLDER.'/src/views/sequences" method="post">'.PHP_EOL; |
|
410 | ||
411 | //If multi drop |
|
412 | if (isset($_REQUEST['ma'])) { |
|
413 | foreach ($_REQUEST['ma'] as $v) { |
|
414 | $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); |
|
415 | echo '<p>', sprintf($this->lang['strconfdropsequence'], $this->misc->printVal($a['sequence'])), '</p>'.PHP_EOL; |
|
416 | printf('<input type="hidden" name="sequence[]" value="%s" />', htmlspecialchars($a['sequence'])); |
|
417 | } |
|
418 | } else { |
|
419 | echo '<p>', sprintf($this->lang['strconfdropsequence'], $this->misc->printVal($_REQUEST['sequence'])), '</p>'.PHP_EOL; |
|
420 | echo '<input type="hidden" name="sequence" value="', htmlspecialchars($_REQUEST['sequence']), '" />'.PHP_EOL; |
|
421 | } |
|
422 | ||
423 | echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL; |
|
424 | echo '<p><input type="hidden" name="action" value="drop" />'.PHP_EOL; |
|
425 | echo $this->misc->form; |
|
426 | echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL; |
|
427 | echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL; |
|
428 | echo '</form>'.PHP_EOL; |
|
429 | } else { |
|
430 | if (is_array($_POST['sequence'])) { |
|
431 | $msg = ''; |
|
432 | $status = $data->beginTransaction(); |
|
433 | if (0 == $status) { |
|
434 | foreach ($_POST['sequence'] as $s) { |
|
435 | $status = $data->dropSequence($s, isset($_POST['cascade'])); |
|
436 | if (0 == $status) { |
|
437 | $msg .= sprintf('%s: %s<br />', htmlentities($s, ENT_QUOTES, 'UTF-8'), $this->lang['strsequencedropped']); |
|
438 | } else { |
|
439 | $data->endTransaction(); |
|
440 | $this->doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($s, ENT_QUOTES, 'UTF-8'), $this->lang['strsequencedroppedbad'])); |
|
441 | ||
442 | return; |
|
443 | } |
|
444 | } |
|
445 | } |
|
446 | if (0 == $data->endTransaction()) { |
|
447 | // Everything went fine, back to the Default page.... |
|
448 | $this->misc->setReloadBrowser(true); |
|
449 | $this->doDefault($msg); |
|
450 | } else { |
|
451 | $this->doDefault($this->lang['strsequencedroppedbad']); |
|
452 | } |
|
453 | } else { |
|
454 | $status = $data->dropSequence($_POST['sequence'], isset($_POST['cascade'])); |
|
455 | if (0 == $status) { |
|
456 | $this->misc->setReloadBrowser(true); |
|
457 | $this->doDefault($this->lang['strsequencedropped']); |
|
458 | } else { |
|
459 | $this->doDrop(true, $this->lang['strsequencedroppedbad']); |
|
460 | } |
|
461 | } |
|
462 | } |
|
463 | } |
|
464 | ||
465 | /** |
|
466 | * Displays a screen where they can enter a new sequence. |
@@ 271-338 (lines=68) @@ | ||
268 | * |
|
269 | * @param mixed $confirm |
|
270 | */ |
|
271 | public function doDrop($confirm) |
|
272 | { |
|
273 | $data = $this->misc->getDatabaseAccessor(); |
|
274 | ||
275 | if (empty($_REQUEST['view']) && empty($_REQUEST['ma'])) { |
|
276 | return $this->doDefault($this->lang['strspecifyviewtodrop']); |
|
277 | } |
|
278 | ||
279 | if ($confirm) { |
|
280 | $this->printTrail('view'); |
|
281 | $this->printTitle($this->lang['strdrop'], 'pg.view.drop'); |
|
282 | ||
283 | echo '<form action="'.\SUBFOLDER.'/src/views/views" method="post">'.PHP_EOL; |
|
284 | ||
285 | //If multi drop |
|
286 | if (isset($_REQUEST['ma'])) { |
|
287 | foreach ($_REQUEST['ma'] as $v) { |
|
288 | $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); |
|
289 | echo '<p>', sprintf($this->lang['strconfdropview'], $this->misc->printVal($a['view'])), '</p>'.PHP_EOL; |
|
290 | echo '<input type="hidden" name="view[]" value="', htmlspecialchars($a['view']), '" />'.PHP_EOL; |
|
291 | } |
|
292 | } else { |
|
293 | echo '<p>', sprintf($this->lang['strconfdropview'], $this->misc->printVal($_REQUEST['view'])), '</p>'.PHP_EOL; |
|
294 | echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST['view']), '" />'.PHP_EOL; |
|
295 | } |
|
296 | ||
297 | echo '<input type="hidden" name="action" value="drop" />'.PHP_EOL; |
|
298 | ||
299 | echo $this->misc->form; |
|
300 | echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL; |
|
301 | echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL; |
|
302 | echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />".PHP_EOL; |
|
303 | echo '</form>'.PHP_EOL; |
|
304 | } else { |
|
305 | if (is_array($_POST['view'])) { |
|
306 | $msg = ''; |
|
307 | $status = $data->beginTransaction(); |
|
308 | if (0 == $status) { |
|
309 | foreach ($_POST['view'] as $s) { |
|
310 | $status = $data->dropView($s, isset($_POST['cascade'])); |
|
311 | if (0 == $status) { |
|
312 | $msg .= sprintf('%s: %s<br />', htmlentities($s, ENT_QUOTES, 'UTF-8'), $this->lang['strviewdropped']); |
|
313 | } else { |
|
314 | $data->endTransaction(); |
|
315 | $this->doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($s, ENT_QUOTES, 'UTF-8'), $this->lang['strviewdroppedbad'])); |
|
316 | ||
317 | return; |
|
318 | } |
|
319 | } |
|
320 | } |
|
321 | if (0 == $data->endTransaction()) { |
|
322 | // Everything went fine, back to the Default page.... |
|
323 | $this->misc->setReloadBrowser(true); |
|
324 | $this->doDefault($msg); |
|
325 | } else { |
|
326 | $this->doDefault($this->lang['strviewdroppedbad']); |
|
327 | } |
|
328 | } else { |
|
329 | $status = $data->dropView($_POST['view'], isset($_POST['cascade'])); |
|
330 | if (0 == $status) { |
|
331 | $this->misc->setReloadBrowser(true); |
|
332 | $this->doDefault($this->lang['strviewdropped']); |
|
333 | } else { |
|
334 | $this->doDefault($this->lang['strviewdroppedbad']); |
|
335 | } |
|
336 | } |
|
337 | } |
|
338 | } |
|
339 | ||
340 | /** |
|
341 | * Sets up choices for table linkage, and which fields to select for the view we're creating. |