$x = new XhtmlForm(); $x->addHidden('roomid', $o->id); //XXX haxx $x->addInput('name', 'Name', $o->name, 200); $x->addCheckbox('locked', 'Lock chatroom (read only)', $o->locked_by ? 1 : 0); $x->addSubmit('Save'); $x->setHandler('editHandler'); echo $x->render(); echo '<br/>'; echo '» ' . ahref('a/chatroom/empty/' . $this->child, 'Empty chatroom of messages') . '<br/>'; echo '<br/>'; echo '» ' . ahref('a/chatroom/remove/' . $this->child, 'Remove chatroom') . '<br/>'; break; case 'remove': if (confirmed('Are you sure you want to remove this chatroom?')) { ChatRoom::remove($this->child); js_redirect('a/chatroom/list'); } break; case 'empty': if (confirmed('Are you sure you want to remove all messages from this chatroom?')) { ChatMessage::deleteByRoom($this->child); js_redirect('a/chatroom/list'); } break; case 'new': function createHandler($p) { $o = new ChatRoom(); $o->name = trim($p['name']); $o->id = $o->store();