Changeset 1109
- Timestamp:
- 03/16/10 00:23:44 (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
common/db/round.php (modified) (1 diff)
-
scripts/seek-value-in-db.php (added)
-
www/controllers/round.php (modified) (2 diffs)
-
www/index.php (modified) (1 diff)
-
www/views/round_delete.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/db/round.php
r1094 r1109 423 423 } 424 424 425 function round_delete($round_id) { 426 log_assert(is_round_id($round_id)); 427 428 // Delete round from cache 429 _round_cache_delete($round_id); 430 431 // Delete job_tests 432 $query = sprintf("SELECT `id` 433 FROM `ia_job` 434 WHERE `round_id` = %s", 435 db_quote($round_id)); 436 437 $job_ids_fetched = db_fetch_all($query); 438 439 $job_ids = array(); 440 foreach ($job_ids_fetched as $job) { 441 $job_ids[] = (int)$job["id"]; 442 } 443 444 if (count($job_ids)) { 445 $formated_job_ids = implode(", ", array_map("db_quote", $job_ids)); 446 $query = sprintf("DELETE FROM `ia_job_test` 447 WHERE `job_id` IN (%s)", 448 $formated_job_ids); 449 db_query($query); 450 451 $query = sprintf("DELETE FROM `ia_job` 452 WHERE `id` IN (%s)", 453 $formated_job_ids); 454 db_query($query); 455 } 456 457 // Delete entries from ia_parameter_value... 458 $query = sprintf("DELETE FROM `ia_parameter_value` 459 WHERE `object_type` = 'round' 460 AND `object_id` = %s", 461 db_quote($round_id)); 462 db_query($query); 463 464 // Delete entries from round-task 465 $query = sprintf("DELETE FROM `ia_round_task` 466 WHERE `round_id` = %s", 467 db_quote($round_id)); 468 db_query($query); 469 470 // Delete entries from user-round 471 $query = sprintf("DELETE FROM `ia_user_round` 472 WHERE `round_id` = %s", 473 db_quote($round_id)); 474 db_query($query); 475 476 // Delete entries from round-task 477 $query = sprintf("DELETE FROM `ia_round_task` 478 WHERE `round_id` = %s", 479 db_quote($round_id)); 480 db_query($query); 481 482 // Delete entries from ia_score 483 $query = sprintf("DELETE FROM `ia_score` 484 WHERE `round_id` = %s", 485 db_quote($round_id)); 486 db_query($query); 487 488 // ACTUALLY DELETE THE ROUND 489 $query = sprintf("DELETE FROM `ia_round` 490 WHERE `id` = %s", 491 db_quote($round_id)); 492 db_query($query); 493 } 494 425 495 ?> -
trunk/www/controllers/round.php
r1091 r1109 270 270 } 271 271 272 function controller_round_delete ($round_id) {272 function controller_round_delete_view($round_id) { 273 273 // Validate round_id 274 274 if (!is_round_id($round_id)) { … … 324 324 } 325 325 326 function controller_round_delete($round_id) { 327 if (!request_is_post()) { 328 flash_error('Runda nu a putut fi stearsa.'); 329 } 330 331 // Validate round_id 332 if (!is_round_id($round_id)) { 333 flash_error('Identificatorul rundei este invalid.'); 334 redirect(url_home()); 335 } 336 337 // Get round 338 $round = round_get($round_id); 339 if (!$round) { 340 flash_error('Runda nu exista.'); 341 redirect(url_home()); 342 } 343 344 // Security check 345 identity_require('round-delete', $round); 346 347 // Delete all the round related information from the database 348 round_delete($round_id); 349 350 flash('Runda a fost stearsa.'); 351 redirect(url_home()); 352 } 353 326 354 ?> -
trunk/www/index.php
r1095 r1109 127 127 require_once(IA_ROOT_DIR.'www/controllers/textblock.php'); 128 128 if ($action == 'sterge-runda') { 129 if (request('delete ')) {129 if (request('delete-pages')) { 130 130 $v = request('textblocks'); 131 131 controller_textblock_delete_many($v, url_round_delete($obj_id)); 132 } elseif (request('delete-round')) { 133 controller_round_delete($obj_id); 132 134 } else { 133 controller_round_delete ($obj_id);135 controller_round_delete_view($obj_id); 134 136 } 135 137 } else { -
trunk/www/views/round_delete.php
r1086 r1109 70 70 if ($view['total_entries']) { 71 71 ?> 72 <br /><input type="submit" value="Sterge Paginile" class="button" name="delete " onclick="return confirm('Aceasta actiune este ireversibila! Doresti sa continui?');" />72 <br /><input type="submit" value="Sterge Paginile" class="button" name="delete-pages" onclick="return confirm('Aceasta actiune este ireversibila! Doresti sa continui?');" /> 73 73 <?php } ?> 74 74 </form> 75 75 76 <form method = 'post' action = ''> 77 <input type="submit" value="Sterge Runda, Forever..." class="button" name="delete-round" onclick="return confirm('Aceasta actiune este ireversibila! Doresti sa continui?');" /> 78 </form> 79 76 80 <?php include('footer.php'); ?>
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)