<?php

    include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
    include_once( PLOG_CLASS_PATH."plugins/adminnotifier/class/view/admineventlistview.class.php" );
    include_once( PLOG_CLASS_PATH."class/config/config.class.php" );

    /**
     * updates the list of events to be notified
     */     
    class AdminNotifierUpdateEventsAction extends SiteAdminAction
    {
    
        function AdminNotifierUpdateEventsAction( $actionInfo, $request )
        {
            $this->SiteAdminAction( $actionInfo, $request );
        }
        
        function perform()
        {
            // read the data from the form
            $events = $this->_request->getValue( "event" );
            
            // save the settings in the db. We save this as global data (in the config table)
            // because these settings will be common to all administrators
            $config =& Config::getConfig();
            $config->setValue( "plugin_adminnotifier_events", $events );
            $config->save();
                        
            // reload the list
            $this->_view = new AdminEventListView( $this->_blogInfo );
            $this->_view->setSuccessMessage( $this->_locale->tr( "admin_notifier_settings_saved_ok" ));
            $this->setCommonData();
            
            return( true );
        }
    }
?>