All pastes #960835 Raw Edit

Untitled

public php v1 · immutable
#960835 ·published 2008-03-28 14:27 UTC
rendered paste body
  	<sandbox>  		  <crud>        	     <routes>        	       <route name=".add" pattern="^/add$" Module="Crud" action="Add" />        	       <route name=".edit" pattern="^/edit/(id:\d+)$" Module="Crud" action="Edit" />        	       <route name=".manage" pattern="^/manage$" Module="Crud" action="Manage" />        	       <route name=".delete" pattern="^/delete/(id:\d+)$" Module="Crud" action="Delete" />        	     </routes>			  		  </crud>  	</sandbox>  	   <route name=".products" pattern="^/products" module="Products">     <routes>       <xi:include xpointer="xpointer(/configurations/sandbox/crud/routes/route)" />	     </routes>   </route>   <route name=".promotions" pattern="^/promotions" module="Promotions">	     <routes>       <xi:include xpointer="xpointer(/configurations/sandbox/crud/routes/route)" />     </routes>   </route>  	class Crud_AddAction extends CustomBaseAction{	public function getCredentials()	{		return "{$this->modelName}.edit";	}		public function isSecure()	{		return true;	}		public function executeWrite(AgaviRequestDataHolder $rd)	{		# 1. find out Model we are dealing with, eg. Products/Promotions, in BaseAction		$model = new $this->modelName;		try {			$model->add($rd->getParameter('form'));			$this->flash("Added {$this->modelName}!");			$return = 'Success';		} catch(Exception $e) {			$return = 'Error';			$this->flash($e->getMessage());		}		return array($this->modelName,"Add".$return); # eg. Products,AddSuccess	}}