Exemple #1
0
     $x->setHandler('editHandler');
     echo $x->render();
     echo '<br/>';
     echo '&raquo; ' . ahref('a/chatroom/empty/' . $this->child, 'Empty chatroom of messages') . '<br/>';
     echo '<br/>';
     echo '&raquo; ' . 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();
         js_redirect('a/chatroom/list');
     }
     echo '<h2>Create new chatroom</h2>';
     $x = new XhtmlForm();
     $x->addInput('name', 'Name');
     $x->addSubmit('Create');