All pastes #511737 Raw Edit

Untitled

public php v1 · immutable
#511737 ·published 2007-05-26 16:40 UTC
rendered paste body
<?php    class RFPACreateException extends Exception { }    class RFPACreate {		static public function getForm() {	    	    if(!isset($_SESSION['rfpastep'])) {				$_SESSION['rfpastep'] = 1;			    }	    	    $f = '././view/templates/default/Applications/rfpa/create/step'. $_SESSION['rfpastep'] .'.php';	    	    if(file_exists($f)) {				return $f;			    } else {				throw new RFPACreateException('Unable to load file: '. $f);	    }	    	}		static public function submit( $data ) {	    	    $m = 'validate'.$_SESSION['rfpastep'];	    	    if(self::$m( $data )) {				$_SESSION['rfpastep']++;		return true;			    } else {				return false;			    }	    	}		static public function getNumberSteps() {	    	    $f = '././view/templates/default/Applications/rfpa/create';	    	    $files = scandir($f);	    	    $num = count($files);	    	    //remove the types.php, ., .. from the count	    $num = $num - 3;	    	    return $num;	    	}		static private function validate1( $data ) {	    	    if( strlen($data['form_name']) < 3 ) {		self::addError('name','Must be 3 characters');	    } else if( strlen($data['form_name']) > 15 ) {		self::addError('name','Can not exceed 15 characters');	    } else {		self::removeError('name');	    }	    	    if( $data['form_type'] == '' ) {		self::addError('purpose','You must select a form purpose.');	    } else {		self::removeError('name');	    }	    	    	}		static private function validate2( $data ) {	    	    return false;	    	}		static private function addError($item, $error) {	    	    $_SESSION['errors'][$item] = $error;	    	}		static private function removeError($item) {	    	    unset($_SESSION['errors'][$item]);	    	}	    }?>