json_return(null, 9, 'Operation failed.'); } break; // Delete // Delete case 'delete': if ($_POST) { $id = (int) $_POST['id']; $db = db::init(); $db->beginTrans(); $rs = $db->prepare("DELETE FROM `a_good` WHERE `id`=:id")->execute(array(':id' => $id)); if (false === $rs) { $db->rollback(); json_return(null, 1, 'Operation failed.'); } action::exec('delete', $id); if ($db->commit()) { json_return(1); } json_return(null, 9, 'Operation failed.'); } break; // List page // List page case 'default': default: $keyword = ''; template::assign('keyword', $keyword); $db = db::init(); $sql = "SELECT * FROM `a_good` WHERE `user`=:uid ORDER BY `id` DESC"; $list = $db->prepare($sql)->execute(array(':uid' => $uid));
} ?> <?php if ($v['star'] * 10 % 10 >= 5) { ?> <span class="glyphicon glyphicon-star-empty"></span> <?php } ?> </label> <?php } ?> </td> <?php \pt\tool\action::exec('list', $v); ?> <td> <button class="btn-refresh btn btn-default" title="Refresh"><span class="glyphicon glyphicon-refresh"></span></button> <?php if ($v['disable']) { ?> <button class="btn-status btn btn-default" title="Enable"><span class="glyphicon glyphicon-eye-open"></span></button> <?php } else { ?> <button class="btn-status btn btn-default" title="Disable"><span class="glyphicon glyphicon-eye-close"></span></button> <?php } ?> <button class="btn-delete btn btn-danger" title="Delete"><span class="glyphicon glyphicon-trash"></span></button>
} }, error : function(){ tr.addClass("danger"); }, dataType : "json", timeout : <?php echo config('web.refresh_timeout') * 1000; ?> }); }, first = btnlist.prop("disabled", true).eq(0); refresh(first); }); }(".refresh-all", "#list tr:not(.disable) .btn-refresh"); !function(btn, li){ $(btn).click(function(){ $(li).toggle(); }); }(".toggle-disabled", "tr.disable"); }); </script> <?php \pt\tool\action::exec('footer'); ?> </body> </html>