EditorController.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2006-2007 by Anton E. Lebedevich                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: EditorController.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012     
00016     abstract class EditorController extends BaseEditor
00017     {
00018         public function __construct(Prototyped $subject)
00019         {
00020             $this->commandMap['import'] = new ImportCommand();
00021             $this->commandMap['drop'] = new DropCommand();
00022             $this->commandMap['save'] = new SaveCommand();
00023             $this->commandMap['edit'] = new EditCommand();
00024             $this->commandMap['add'] = new AddCommand();
00025             
00026             parent::__construct($subject);
00027         }
00028         
00032         public function handleRequest(HttpRequest $request)
00033         {
00034             $this->map->import($request);
00035             
00036             $form = $this->map->getForm();
00037             
00038             if (!$command = $form->getValue('action'))
00039                 $command = $form->get('action')->getDefault();
00040             
00041             if ($command) {
00042                 $mav = $this->commandMap[$command]->run(
00043                     $this->subject, $form, $request
00044                 );
00045             } else
00046                 $mav = ModelAndView::create();
00047             
00048             return $this->postHandleRequest($mav, $request);
00049         }
00050     }
00051 ?>

Generated on Sun Dec 9 21:56:24 2007 for onPHP by  doxygen 1.5.4