<?php
lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."plugins/clean/class/view/admincleanview.class.php" );	

	/**
	 * shows a form with the current configuration
	 */
	class AdminCleanAction extends AdminAction
	{
    	function AdminCleanAction( $actionInfo, $request )
        {
        	$this->AdminAction( $actionInfo, $request );
			$this->requireAdminPermission( "view_site_blogs" );

            $this->registerFieldValidator( "last_update", new IntegerValidator(), true);
            $this->registerFieldValidator( "total_posts_less_then", new IntegerValidator(), true);
			$this->registerFieldValidator( "searchTerms", new StringValidator(), true );

            $view = new AdminCleanView( $this->_blogInfo );
            $view->setErrorMessage( $this->_locale->tr("clean_error_invalid_filter_terms" ));
            $this->setValidationErrorView( $view );
            
        }
        
        function perform()
        {
            $last_update = $this->_request->getValue( "last_update" );
            $total_posts_less_than = $this->_request->getValue( "total_posts_less_than" );
            $search_terms = $this->_request->getValue( "searchTerms" );
            
	        $this->_view = new AdminCleanView( $this->_blogInfo,
                                               Array( "last_update" => $last_update,
                                                      "total_posts_less_than" => $total_posts_less_than,
                                                      "search_terms" => $search_terms)
                                               );
	        $this->setCommonData();	        
            return true;
        }
    }
?>