DynamicController.class.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * This controller is designed to react to input without predefined actions attached to it.
  4. * For every inaccessible action that is called the dynamo() function is called instead. Thus,
  5. * there will be no "Page Not Found" errors when calling this controller with any user specified
  6. * action. The first parameter will be the action that was called. The remaining params will be
  7. * any paramenters sent to the action.
  8. *
  9. * @author Ironpilot
  10. * @copyright Copywrite (c) 2011, STAPLE CODE
  11. *
  12. * This file is part of the STAPLE Framework.
  13. *
  14. * The STAPLE Framework is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Lesser General Public License as published by the
  16. * Free Software Foundation, either version 3 of the License, or (at your option)
  17. * any later version.
  18. *
  19. * The STAPLE Framework is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  21. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  22. * more details.
  23. *
  24. * You should have received a copy of the GNU Lesser General Public License
  25. * along with the STAPLE Framework. If not, see <http://www.gnu.org/licenses/>.
  26. *
  27. */
  28. abstract class Staple_DynamicController extends Staple_Controller
  29. {
  30. public function __call($action, $arguments)
  31. {
  32. $this->view->setView($action);
  33. array_unshift($arguments, $action);
  34. call_user_func_array(array($this,"dynamo"), $arguments);
  35. }
  36. abstract public function dynamo();
  37. }
  38. ?>