<?php $c_id = isset($_GET['c_id']) ? $_GET['c_id'] : null; if (isset($_GET['todo'])) { if ($_GET['todo'] == 'delete') { $b = new ExamplePlayers($_GET['id']); $b->delete(); } elseif ($_GET['todo'] == 'up') { $b = new ExamplePlayers($_GET['b_id']); $b->moveUp(' `cat_id`= \'' . $b->cat_id . '\''); } elseif ($_GET['todo'] == 'down') { $b = new ExamplePlayers($_GET['b_id']); $b->moveDown(' `cat_id`= \'' . $b->cat_id . '\''); } else { Messages::addNotice('Error'); } } $eb = new ExamplePlayers(); $smarty->assign('b_list', $eb->getAll("WHERE `cat_id`= '{$c_id}' ORDER BY `display_order` ASC")); $smarty->assign('c_id', $c_id);
<?php $todo = isset($_GET['todo']) ? $_GET['todo'] : null; switch ($todo) { case 'delete': $exampleCat = new ExampleCategories($_GET['id']); if ($exampleCat->id) { $players = ExamplePlayers::getAllFromCat($_GET['id']); foreach ($players as $player) { $player->delete(); } $exampleCat->delete(); Messages::addNotice('Category successfully deleted'); } else { Messages::addError('Delete Failed'); } break; case 'up': $c = new ExampleCategories($_GET['id']); $c->moveUp(); break; case 'down': $c = new ExampleCategories($_GET['id']); $c->moveDown(); break; } $ec = new ExampleCategories(); $smarty->assign('c_list', $ec->getAll(' ORDER BY `display_order` ASC'));
$b->hash = $_POST['b_hash']; $b->update(); } Messages::addNotice('The changes were saved!'); jump('index.php?page=examples&action=manage_players&c_id=' . $_GET['c_id']); } else { Messages::addError('No changes!'); jump('index.php?page=examples&action=manage_players&c_id=' . $_GET['c_id']); } } else { //add if ($_FILES['b_thumbnail']['name'] == '') { Messages::addError('You have to fill all fields!'); $smarty->assign('post', $_POST); } else { $eb = new ExamplePlayers(); $eb->cat_id = $_GET['c_id']; //deg($_GET,$_POST); $eb->hash = $_POST['b_hash']; $eb->save(); $finfo = getimagesize($_FILES['b_thumbnail']['tmp_name']); $result = S3::putObjectFile($_FILES['b_thumbnail']['tmp_name'], $config->amazon->S3Bucket, $config->amazon->folders['site']['examples']['thumbs'] . '/' . $eb->id, S3::ACL_PUBLIC_READ, array(), $finfo['mime']); Messages::addNotice('The notification was added succesfully!'); jump('index.php?page=examples&action=manage_players&c_id=' . $_GET['c_id']); } } } if (isset($_GET['todo']) && $_GET['todo'] == 'edit') { $b = new ExamplePlayers($_GET['b_id']); $smarty->assign('b', $b); $smarty->assign('edit', 1);