<?php

    include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
    include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
    include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );

    include_once( PLOG_CLASS_PATH."plugins/shoutbox/class/dao/shoutbox.class.php" );
    
    /**
     * updates the plugin configuration
     */
    class PluginShoutboxDeleteShoutsAction extends AdminAction
    {
    
        var $_pluginEnabled;
        var $_Shoutboxet;
        
        function PluginShoutboxDeleteShoutsAction( $actionInfo, $request )
        {
            $this->AdminAction( $actionInfo, $request );
        }
  

        function perform()
        {
            $backLink = "<br><br><a href='admin.php?op=shoutbox'>Back to the shoutbox</a>";
        
            // and check which smiley set we should be using, or if none, then the default one
            $blogSettings = $this->_blogInfo->getSettings();

            if(is_array($this->_request->getValue('del')) ) {
                $endMessage = "Shouts successfully deleted.";
                $s = new Shoutbox($this->_blogInfo->getId(), $blogSettings);
                foreach($this->_request->getValue('del') as $k => $v) {
                    //echo("Delete $k<br>");
                    $s->deleteShout($k);
                }
            }
            else
                $endMessage = "Nothing to do (no shouts selected).";

            $this->_view = new AdminMessageView( $this->_blogInfo );
            $this->_view->setMessage($endMessage . $backLink);
            $this->setCommonData();

            return true;
        }
    }
?>