Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 abstract class MonolithicController extends BaseEditor
00016 {
00017 public function __construct(Prototyped $subject)
00018 {
00019 $this->commandMap['import'] = 'doImport';
00020 $this->commandMap['drop'] = 'doDrop';
00021 $this->commandMap['save'] = 'doSave';
00022 $this->commandMap['edit'] = 'doEdit';
00023 $this->commandMap['add'] = 'doAdd';
00024
00025 parent::__construct($subject);
00026 }
00027
00031 public function handleRequest(HttpRequest $request)
00032 {
00033 $this->map->import($request);
00034
00035 $form = $this->getForm();
00036
00037 if (!$command = $form->getValue('action'))
00038 $command = $form->get('action')->getDefault();
00039
00040 if ($command) {
00041 $mav = $this->{$this->commandMap[$command]}(
00042 $this->subject, $form, $request
00043 );
00044 } else
00045 $mav = ModelAndView::create();
00046
00047 return $this->postHandleRequest($mav, $request);
00048 }
00049
00053 public function doImport(
00054 Prototyped $subject, Form $form, HttpRequest $request
00055 )
00056 {
00057 return ImportCommand::create()->run($subject, $form, $request);
00058 }
00059
00063 public function doDrop(
00064 Prototyped $subject, Form $form, HttpRequest $request
00065 )
00066 {
00067 return DropCommand::create()->run($subject, $form, $request);
00068 }
00069
00073 public function doSave(
00074 Prototyped $subject, Form $form, HttpRequest $request
00075 )
00076 {
00077 return SaveCommand::create()->run($subject, $form, $request);
00078 }
00079
00083 public function doEdit(
00084 Prototyped $subject, Form $form, HttpRequest $request
00085 )
00086 {
00087 return EditCommand::create()->run($subject, $form, $request);
00088 }
00089
00093 public function doAdd(
00094 Prototyped $subject, Form $form, HttpRequest $request
00095 )
00096 {
00097 return AddCommand::create()->run($subject, $form, $request);
00098 }
00099 }
00100 ?>